@tresjs/cientos 4.0.0 → 4.0.1
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/trescientos.js +1248 -1248
- package/dist/trescientos.umd.cjs +47 -47
- package/package.json +4 -4
package/dist/trescientos.umd.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/cientos
|
|
3
|
-
* version: v4.0.
|
|
3
|
+
* version: v4.0.1
|
|
4
4
|
* (c) 2024
|
|
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(re,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("three"),require("vue"),require("@tresjs/core")):typeof define=="function"&&define.amd?define(["exports","three","vue","@tresjs/core"],l):(re=typeof globalThis<"u"?globalThis:re||self,l(re.trescientos={},re.Three,re.Vue,re.TresjsCore))})(this,function(re,l,u,ee){"use strict";var
|
|
8
|
+
(function(re,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("three"),require("vue"),require("@tresjs/core")):typeof define=="function"&&define.amd?define(["exports","three","vue","@tresjs/core"],l):(re=typeof globalThis<"u"?globalThis:re||self,l(re.trescientos={},re.Three,re.Vue,re.TresjsCore))})(this,function(re,l,u,ee){"use strict";var sp=Object.defineProperty;var rp=(re,l,u)=>l in re?sp(re,l,{enumerable:!0,configurable:!0,writable:!0,value:u}):re[l]=u;var ue=(re,l,u)=>rp(re,typeof l!="symbol"?l+"":l,u);function oo(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 Qs=oo(l),Qt=parseInt(l.REVISION.replace(/\D+/g,"")),ao=Qt>=125?"uv1":"uv2";function Js(o,e){if(e===l.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(e===l.TriangleFanDrawMode||e===l.TriangleStripDrawMode){let t=o.getIndex();if(t===null){const i=[],a=o.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)i.push(c);o.setIndex(i),t=o.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),o}const n=t.count-2,s=[];if(t)if(e===l.TriangleFanDrawMode)for(let i=1;i<=n;i++)s.push(t.getX(0)),s.push(t.getX(i)),s.push(t.getX(i+1));else for(let i=0;i<n;i++)i%2===0?(s.push(t.getX(i)),s.push(t.getX(i+1)),s.push(t.getX(i+2))):(s.push(t.getX(i+2)),s.push(t.getX(i+1)),s.push(t.getX(i)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=o.clone();return r.setIndex(s),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),o}var lo=Object.defineProperty,co=(o,e,t)=>e in o?lo(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,uo=(o,e,t)=>(co(o,e+"",t),t);async function Hs(o){const e=await o.arrayBuffer(),t=btoa(String.fromCharCode(...new Uint8Array(e)));return`data:${o.type||""};base64,${t}`}let wn,Zn,Nt,bn;function Kn(o,e=1/0,t=null){Zn||(Zn=new l.PlaneGeometry(2,2,1,1)),Nt||(Nt=new l.ShaderMaterial({uniforms:{blitTexture:new l.Uniform(o)},vertexShader:`
|
|
9
9
|
varying vec2 vUv;
|
|
10
10
|
void main(){
|
|
11
11
|
vUv = uv;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
gl_FragColor = texture2D( blitTexture, vUv);
|
|
25
25
|
#endif
|
|
26
26
|
}
|
|
27
|
-
`})),Nt.uniforms.blitTexture.value=o,Nt.defines.IS_SRGB="colorSpace"in o?o.colorSpace==="srgb":o.encoding===3001,Nt.needsUpdate=!0,bn||(bn=new l.Mesh(Zn,Nt),bn.frustrumCulled=!1);const n=new l.PerspectiveCamera,s=new l.Scene;s.add(bn),t||(t=wn=new l.WebGLRenderer({antialias:!1})),t.setSize(Math.min(o.image.width,e),Math.min(o.image.height,e)),t.clear(),t.render(s,n);const r=new l.Texture(t.domElement);return r.minFilter=o.minFilter,r.magFilter=o.magFilter,r.wrapS=o.wrapS,r.wrapT=o.wrapT,r.name=o.name,wn&&(wn.dispose(),wn=null),r}const $s={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class qn{constructor(){this.pluginCallbacks=[],this.register(function(e){return new wo(e)}),this.register(function(e){return new bo(e)}),this.register(function(e){return new Ao(e)}),this.register(function(e){return new Co(e)}),this.register(function(e){return new Po(e)}),this.register(function(e){return new To(e)}),this.register(function(e){return new Mo(e)}),this.register(function(e){return new So(e)}),this.register(function(e){return new Io(e)}),this.register(function(e){return new Oo(e)}),this.register(function(e){return new Do(e)})}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){const r=new vo,i=[];for(let a=0,c=this.pluginCallbacks.length;a<c;a++)i.push(this.pluginCallbacks[a](r));r.setPlugins(i),r.write(e,t,s).catch(n)}parseAsync(e,t){const n=this;return new Promise(function(s,r){n.parse(e,s,r,t)})}}uo(qn,"Utils",{insertKeyframe:function(o,e){const n=o.getValueSize(),s=new o.TimeBufferType(o.times.length+1),r=new o.ValueBufferType(o.values.length+n),i=o.createInterpolant(new o.ValueBufferType(n));let a;if(o.times.length===0){s[0]=e;for(let c=0;c<n;c++)r[c]=0;a=0}else if(e<o.times[0]){if(Math.abs(o.times[0]-e)<.001)return 0;s[0]=e,s.set(o.times,1),r.set(i.evaluate(e),0),r.set(o.values,n),a=0}else if(e>o.times[o.times.length-1]){if(Math.abs(o.times[o.times.length-1]-e)<.001)return o.times.length-1;s[s.length-1]=e,s.set(o.times,0),r.set(o.values,0),r.set(i.evaluate(e),o.values.length),a=s.length-1}else for(let c=0;c<o.times.length;c++){if(Math.abs(o.times[c]-e)<.001)return c;if(o.times[c]<e&&o.times[c+1]>e){s.set(o.times.slice(0,c+1),0),s[c+1]=e,s.set(o.times.slice(c+1),c+2),r.set(o.values.slice(0,(c+1)*n),0),r.set(i.evaluate(e),(c+1)*n),r.set(o.values.slice((c+1)*n),(c+2)*n),a=c+1;break}}return o.times=s,o.values=r,a},mergeMorphTargetTracks:function(o,e){const t=[],n={},s=o.tracks;for(let r=0;r<s.length;++r){let i=s[r];const a=l.PropertyBinding.parseTrackName(i.name),c=l.PropertyBinding.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){t.push(i);continue}if(i.createInterpolant!==i.InterpolantFactoryMethodDiscrete&&i.createInterpolant!==i.InterpolantFactoryMethodLinear){if(i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),i=i.clone(),i.setInterpolation(l.InterpolateLinear)}const h=c.morphTargetInfluences.length,d=c.morphTargetDictionary[a.propertyIndex];if(d===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let f;if(n[c.uuid]===void 0){f=i.clone();const p=new f.ValueBufferType(h*f.times.length);for(let _=0;_<f.times.length;_++)p[_*h+d]=f.values[_];f.name=(a.nodeName||"")+".morphTargetInfluences",f.values=p,n[c.uuid]=f,t.push(f);continue}const y=i.createInterpolant(new i.ValueBufferType(1));f=n[c.uuid];for(let p=0;p<f.times.length;p++)f.values[p*h+d]=y.evaluate(f.times[p]);for(let p=0;p<i.times.length;p++){const _=this.insertKeyframe(f,i.times[p]);f.values[_*h+d]=i.values[p]}}return o.tracks=t,o}});const we={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},Qn="KHR_mesh_quantization",Xe={};Xe[l.NearestFilter]=we.NEAREST,Xe[l.NearestMipmapNearestFilter]=we.NEAREST_MIPMAP_NEAREST,Xe[l.NearestMipmapLinearFilter]=we.NEAREST_MIPMAP_LINEAR,Xe[l.LinearFilter]=we.LINEAR,Xe[l.LinearMipmapNearestFilter]=we.LINEAR_MIPMAP_NEAREST,Xe[l.LinearMipmapLinearFilter]=we.LINEAR_MIPMAP_LINEAR,Xe[l.ClampToEdgeWrapping]=we.CLAMP_TO_EDGE,Xe[l.RepeatWrapping]=we.REPEAT,Xe[l.MirroredRepeatWrapping]=we.MIRRORED_REPEAT;const er={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},ho=new l.Color,tr=12,fo=1179937895,po=2,nr=8,mo=1313821514,go=5130562;function Jt(o,e){return o.length===e.length&&o.every(function(t,n){return t===e[n]})}function yo(o){return new TextEncoder().encode(o).buffer}function _o(o){return Jt(o.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function xo(o,e,t){const n={min:new Array(o.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(o.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let s=e;s<e+t;s++)for(let r=0;r<o.itemSize;r++){let i;o.itemSize>4?i=o.array[s*o.itemSize+r]:(r===0?i=o.getX(s):r===1?i=o.getY(s):r===2?i=o.getZ(s):r===3&&(i=o.getW(s)),o.normalized===!0&&(i=l.MathUtils.normalize(i,o.array))),n.min[r]=Math.min(n.min[r],i),n.max[r]=Math.max(n.max[r],i)}return n}function sr(o){return Math.ceil(o/4)*4}function Jn(o,e=0){const t=sr(o.byteLength);if(t!==o.byteLength){const n=new Uint8Array(t);if(n.set(new Uint8Array(o)),e!==0)for(let s=o.byteLength;s<t;s++)n[s]=e;return n.buffer}return o}function rr(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function ir(o,e){if(o.toBlob!==void 0)return new Promise(n=>o.toBlob(n,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),o.convertToBlob({type:e,quality:t})}class vo{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const s=this,r=s.buffers,i=s.json;n=s.options;const a=s.extensionsUsed,c=s.extensionsRequired,h=new Blob(r,{type:"application/octet-stream"}),d=Object.keys(a),f=Object.keys(c);d.length>0&&(i.extensionsUsed=d),f.length>0&&(i.extensionsRequired=f),i.buffers&&i.buffers.length>0&&(i.buffers[0].byteLength=h.size),n.binary===!0?h.arrayBuffer().then(y=>{const p=Jn(y),_=new DataView(new ArrayBuffer(nr));_.setUint32(0,p.byteLength,!0),_.setUint32(4,go,!0);const g=Jn(yo(JSON.stringify(i)),32),x=new DataView(new ArrayBuffer(nr));x.setUint32(0,g.byteLength,!0),x.setUint32(4,mo,!0);const m=new ArrayBuffer(tr),M=new DataView(m);M.setUint32(0,fo,!0),M.setUint32(4,po,!0);const v=tr+x.byteLength+g.byteLength+_.byteLength+p.byteLength;M.setUint32(8,v,!0),new Blob([m,x,g,_,p],{type:"application/octet-stream"}).arrayBuffer().then(t)}):i.buffers&&i.buffers.length>0?Hs(h).then(y=>{i.buffers[0].uri=y,t(i)}):t(i)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const n=this.options,s=this.extensionsUsed;try{const r=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&r.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const i in r.gltfExtensions)t.extensions[i]=r.gltfExtensions[i],s[i]=!0;delete r.gltfExtensions}Object.keys(r).length>0&&(t.extras=r)}catch(r){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+r.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const s=new Map;s.set(!0,this.uid++),s.set(!1,this.uid++),this.uids.set(e,s)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new l.Vector3;for(let s=0,r=e.count;s<r;s++)if(Math.abs(n.fromBufferAttribute(e,s).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const n=e.clone(),s=new l.Vector3;for(let r=0,i=n.count;r<i;r++)s.fromBufferAttribute(n,r),s.x===0&&s.y===0&&s.z===0?s.setX(1):s.normalize(),n.setXYZ(r,s.x,s.y,s.z);return t.attributesNormalized.set(e,n),n}applyTextureTransform(e,t){let n=!1;const s={};(t.offset.x!==0||t.offset.y!==0)&&(s.offset=t.offset.toArray(),n=!0),t.rotation!==0&&(s.rotation=t.rotation,n=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(s.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function n(p){return("colorSpace"in p?p.colorSpace==="srgb":p.encoding===3001)?function(g){return g<.04045?g*.0773993808:Math.pow(g*.9478672986+.0521327014,2.4)}:function(g){return g}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof l.CompressedTexture&&(e=Kn(e)),t instanceof l.CompressedTexture&&(t=Kn(t));const s=e?e.image:null,r=t?t.image:null,i=Math.max(s?s.width:0,r?r.width:0),a=Math.max(s?s.height:0,r?r.height:0),c=rr();c.width=i,c.height=a;const h=c.getContext("2d");h.fillStyle="#00ffff",h.fillRect(0,0,i,a);const d=h.getImageData(0,0,i,a);if(s){h.drawImage(s,0,0,i,a);const p=n(e),_=h.getImageData(0,0,i,a).data;for(let g=2;g<_.length;g+=4)d.data[g]=p(_[g]/256)*256}if(r){h.drawImage(r,0,0,i,a);const p=n(t),_=h.getImageData(0,0,i,a).data;for(let g=1;g<_.length;g+=4)d.data[g]=p(_[g]/256)*256}h.putImageData(d,0,0);const y=(e||t).clone();return y.source=new l.Texture(c).source,"colorSpace"in y?y.colorSpace="":y.encoding=3e3,y.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),y}processBuffer(e){const t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}processBufferView(e,t,n,s,r){const i=this.json;i.bufferViews||(i.bufferViews=[]);let a;switch(t){case we.BYTE:case we.UNSIGNED_BYTE:a=1;break;case we.SHORT:case we.UNSIGNED_SHORT:a=2;break;default:a=4}const c=sr(s*e.itemSize*a),h=new DataView(new ArrayBuffer(c));let d=0;for(let p=n;p<n+s;p++)for(let _=0;_<e.itemSize;_++){let g;e.itemSize>4?g=e.array[p*e.itemSize+_]:(_===0?g=e.getX(p):_===1?g=e.getY(p):_===2?g=e.getZ(p):_===3&&(g=e.getW(p)),e.normalized===!0&&(g=l.MathUtils.normalize(g,e.array))),t===we.FLOAT?h.setFloat32(d,g,!0):t===we.INT?h.setInt32(d,g,!0):t===we.UNSIGNED_INT?h.setUint32(d,g,!0):t===we.SHORT?h.setInt16(d,g,!0):t===we.UNSIGNED_SHORT?h.setUint16(d,g,!0):t===we.BYTE?h.setInt8(d,g):t===we.UNSIGNED_BYTE&&h.setUint8(d,g),d+=a}const f={buffer:this.processBuffer(h.buffer),byteOffset:this.byteOffset,byteLength:c};return r!==void 0&&(f.target=r),r===we.ARRAY_BUFFER&&(f.byteStride=e.itemSize*a),this.byteOffset+=c,i.bufferViews.push(f),{id:i.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),e.arrayBuffer().then(s=>{const r=Jn(s),i={buffer:t.processBuffer(r),byteOffset:t.byteOffset,byteLength:r.byteLength};return t.byteOffset+=r.byteLength,n.bufferViews.push(i)-1})}processAccessor(e,t,n,s){const r=this.json,i={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=we.FLOAT;else if(e.array.constructor===Int32Array)a=we.INT;else if(e.array.constructor===Uint32Array)a=we.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=we.SHORT;else if(e.array.constructor===Uint16Array)a=we.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=we.BYTE;else if(e.array.constructor===Uint8Array)a=we.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),s===void 0&&(s=e.count),s===0)return null;const c=xo(e,n,s);let h;t!==void 0&&(h=e===t.index?we.ELEMENT_ARRAY_BUFFER:we.ARRAY_BUFFER);const d=this.processBufferView(e,a,n,s,h),f={bufferView:d.id,byteOffset:d.byteOffset,componentType:a,count:s,max:c.max,min:c.min,type:i[e.itemSize]};return e.normalized===!0&&(f.normalized=!0),r.accessors||(r.accessors=[]),r.accessors.push(f)-1}processImage(e,t,n,s="image/png"){if(e!==null){const r=this,i=r.cache,a=r.json,c=r.options,h=r.pending;i.images.has(e)||i.images.set(e,{});const d=i.images.get(e),f=s+":flipY/"+n.toString();if(d[f]!==void 0)return d[f];a.images||(a.images=[]);const y={mimeType:s},p=rr();p.width=Math.min(e.width,c.maxTextureSize),p.height=Math.min(e.height,c.maxTextureSize);const _=p.getContext("2d");if(n===!0&&(_.translate(0,p.height),_.scale(1,-1)),e.data!==void 0){t!==l.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const x=new Uint8ClampedArray(e.height*e.width*4);for(let m=0;m<x.length;m+=4)x[m+0]=e.data[m+0],x[m+1]=e.data[m+1],x[m+2]=e.data[m+2],x[m+3]=e.data[m+3];_.putImageData(new ImageData(x,e.width,e.height),0,0)}else _.drawImage(e,0,0,p.width,p.height);c.binary===!0?h.push(ir(p,s).then(x=>r.processBufferViewImage(x)).then(x=>{y.bufferView=x})):p.toDataURL!==void 0?y.uri=p.toDataURL(s):h.push(ir(p,s).then(Hs).then(x=>{y.uri=x}));const g=a.images.push(y)-1;return d[f]=g,g}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const n={magFilter:Xe[e.magFilter],minFilter:Xe[e.minFilter],wrapS:Xe[e.wrapS],wrapT:Xe[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){const n=this.options,s=this.cache,r=this.json;if(s.textures.has(e))return s.textures.get(e);r.textures||(r.textures=[]),e instanceof l.CompressedTexture&&(e=Kn(e,n.maxTextureSize));let i=e.userData.mimeType;i==="image/webp"&&(i="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)};e.name&&(a.name=e.name),this._invokeAll(function(h){h.writeTexture&&h.writeTexture(e,a)});const c=r.textures.push(a)-1;return s.textures.set(e,c),c}processMaterial(e){const t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const s={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const r=e.color.toArray().concat([e.opacity]);if(Jt(r,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=r),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=.5,s.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),c={index:this.processTexture(a),channel:a.channel};this.applyTextureTransform(c,a),s.pbrMetallicRoughness.metallicRoughnessTexture=c}if(e.map){const a={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(a,e.map),s.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive;if(Math.max(a.r,a.g,a.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const h={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(h,e.emissiveMap),s.emissiveTexture=h}}if(e.normalMap){const a={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),s.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),s.occlusionTexture=a}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),e.side===l.DoubleSide&&(s.doubleSided=!0),e.name!==""&&(s.name=e.name),this.serializeUserData(e,s),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,s)});const i=n.materials.push(s)-1;return t.materials.set(e,i),i}processMesh(e){const t=this.cache,n=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let v=0,C=e.material.length;v<C;v++)s.push(e.material[v].uuid);else s.push(e.material.uuid);const r=s.join(":");if(t.meshes.has(r))return t.meshes.get(r);const i=e.geometry;let a;e.isLineSegments?a=we.LINES:e.isLineLoop?a=we.LINE_LOOP:e.isLine?a=we.LINE_STRIP:e.isPoints?a=we.POINTS:a=e.material.wireframe?we.LINES:we.TRIANGLES;const c={},h={},d=[],f=[],y={...Qt>=152?{uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3"}:{uv:"TEXCOORD_0",uv2:"TEXCOORD_1"},color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},p=i.getAttribute("normal");p!==void 0&&!this.isNormalizedNormalAttribute(p)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),i.setAttribute("normal",this.createNormalizedNormalAttribute(p)));let _=null;for(let v in i.attributes){if(v.slice(0,5)==="morph")continue;const C=i.attributes[v];if(v=y[v]||v.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(v)||(v="_"+v),t.attributes.has(this.getUID(C))){h[v]=t.attributes.get(this.getUID(C));continue}_=null;const S=C.array;v==="JOINTS_0"&&!(S instanceof Uint16Array)&&!(S instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),_=new l.BufferAttribute(new Uint16Array(S),C.itemSize,C.normalized));const A=this.processAccessor(_||C,i);A!==null&&(v.startsWith("_")||this.detectMeshQuantization(v,C),h[v]=A,t.attributes.set(this.getUID(C),A))}if(p!==void 0&&i.setAttribute("normal",p),Object.keys(h).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const v=[],C=[],O={};if(e.morphTargetDictionary!==void 0)for(const S in e.morphTargetDictionary)O[e.morphTargetDictionary[S]]=S;for(let S=0;S<e.morphTargetInfluences.length;++S){const A={};let b=!1;for(const P in i.morphAttributes){if(P!=="position"&&P!=="normal"){b||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),b=!0);continue}const w=i.morphAttributes[P][S],D=P.toUpperCase(),L=i.attributes[P];if(t.attributes.has(this.getUID(w,!0))){A[D]=t.attributes.get(this.getUID(w,!0));continue}const V=w.clone();if(!i.morphTargetsRelative)for(let R=0,Y=w.count;R<Y;R++)for(let W=0;W<w.itemSize;W++)W===0&&V.setX(R,w.getX(R)-L.getX(R)),W===1&&V.setY(R,w.getY(R)-L.getY(R)),W===2&&V.setZ(R,w.getZ(R)-L.getZ(R)),W===3&&V.setW(R,w.getW(R)-L.getW(R));A[D]=this.processAccessor(V,i),t.attributes.set(this.getUID(L,!0),A[D])}f.push(A),v.push(e.morphTargetInfluences[S]),e.morphTargetDictionary!==void 0&&C.push(O[S])}c.weights=v,C.length>0&&(c.extras={},c.extras.targetNames=C)}const g=Array.isArray(e.material);if(g&&i.groups.length===0)return null;const x=g?e.material:[e.material],m=g?i.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let v=0,C=m.length;v<C;v++){const O={mode:a,attributes:h};if(this.serializeUserData(i,O),f.length>0&&(O.targets=f),i.index!==null){let A=this.getUID(i.index);(m[v].start!==void 0||m[v].count!==void 0)&&(A+=":"+m[v].start+":"+m[v].count),t.attributes.has(A)?O.indices=t.attributes.get(A):(O.indices=this.processAccessor(i.index,i,m[v].start,m[v].count),t.attributes.set(A,O.indices)),O.indices===null&&delete O.indices}const S=this.processMaterial(x[m[v].materialIndex]);S!==null&&(O.material=S),d.push(O)}c.primitives=d,n.meshes||(n.meshes=[]),this._invokeAll(function(v){v.writeMesh&&v.writeMesh(e,c)});const M=n.meshes.push(c)-1;return t.meshes.set(r,M),M}detectMeshQuantization(e,t){if(this.extensionsUsed[Qn])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");const s=e.split("_",1)[0];$s[s]&&$s[s].includes(n)&&(this.extensionsUsed[Qn]=!0,this.extensionsRequired[Qn]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const n=e.isOrthographicCamera,s={type:n?"orthographic":"perspective"};return n?s.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:s.perspective={aspectRatio:e.aspect,yfov:l.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(s.name=e.type),t.cameras.push(s)-1}processAnimation(e,t){const n=this.json,s=this.nodeMap;n.animations||(n.animations=[]),e=qn.Utils.mergeMorphTargetTracks(e.clone(),t);const r=e.tracks,i=[],a=[];for(let c=0;c<r.length;++c){const h=r[c],d=l.PropertyBinding.parseTrackName(h.name);let f=l.PropertyBinding.findNode(t,d.nodeName);const y=er[d.propertyName];if(d.objectName==="bones"&&(f.isSkinnedMesh===!0?f=f.skeleton.getBoneByName(d.objectIndex):f=void 0),!f||!y)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',h.name),null;const p=1;let _=h.values.length/h.times.length;y===er.morphTargetInfluences&&(_/=f.morphTargetInfluences.length);let g;h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(g="CUBICSPLINE",_/=3):h.getInterpolation()===l.InterpolateDiscrete?g="STEP":g="LINEAR",a.push({input:this.processAccessor(new l.BufferAttribute(h.times,p)),output:this.processAccessor(new l.BufferAttribute(h.values,_)),interpolation:g}),i.push({sampler:a.length-1,target:{node:s.get(f),path:y}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:a,channels:i}),n.animations.length-1}processSkin(e){const t=this.json,n=this.nodeMap,s=t.nodes[n.get(e)],r=e.skeleton;if(r===void 0)return null;const i=e.skeleton.bones[0];if(i===void 0)return null;const a=[],c=new Float32Array(r.bones.length*16),h=new l.Matrix4;for(let f=0;f<r.bones.length;++f)a.push(n.get(r.bones[f])),h.copy(r.boneInverses[f]),h.multiply(e.bindMatrix).toArray(c,f*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new l.BufferAttribute(c,16)),joints:a,skeleton:n.get(i)}),s.skin=t.skins.length-1}processNode(e){const t=this.json,n=this.options,s=this.nodeMap;t.nodes||(t.nodes=[]);const r={};if(n.trs){const a=e.quaternion.toArray(),c=e.position.toArray(),h=e.scale.toArray();Jt(a,[0,0,0,1])||(r.rotation=a),Jt(c,[0,0,0])||(r.translation=c),Jt(h,[1,1,1])||(r.scale=h)}else e.matrixAutoUpdate&&e.updateMatrix(),_o(e.matrix)===!1&&(r.matrix=e.matrix.elements);if(e.name!==""&&(r.name=String(e.name)),this.serializeUserData(e,r),e.isMesh||e.isLine||e.isPoints){const a=this.processMesh(e);a!==null&&(r.mesh=a)}else e.isCamera&&(r.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const a=[];for(let c=0,h=e.children.length;c<h;c++){const d=e.children[c];if(d.visible||n.onlyVisible===!1){const f=this.processNode(d);f!==null&&a.push(f)}}a.length>0&&(r.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,r)});const i=t.nodes.push(r)-1;return s.set(e,i),i}processScene(e){const t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};e.name!==""&&(s.name=e.name),t.scenes.push(s);const r=[];for(let i=0,a=e.children.length;i<a;i++){const c=e.children[i];if(c.visible||n.onlyVisible===!1){const h=this.processNode(c);h!==null&&r.push(h)}}r.length>0&&(s.nodes=r),this.serializeUserData(e,s)}processObjects(e){const t=new l.Scene;t.name="AuxScene";for(let n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(s){s.beforeParse&&s.beforeParse(e)});const n=[];for(let s=0;s<e.length;s++)e[s]instanceof l.Scene?this.processScene(e[s]):n.push(e[s]);n.length>0&&this.processObjects(n);for(let s=0;s<this.skins.length;++s)this.processSkin(this.skins[s]);for(let s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s],e[0]);this._invokeAll(function(s){s.afterParse&&s.afterParse(e)})}_invokeAll(e){for(let t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}class wo{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const n=this.writer,s=n.json,r=n.extensionsUsed,i={};e.name&&(i.name=e.name),i.color=e.color.toArray(),i.intensity=e.intensity,e.isDirectionalLight?i.type="directional":e.isPointLight?(i.type="point",e.distance>0&&(i.range=e.distance)):e.isSpotLight&&(i.type="spot",e.distance>0&&(i.range=e.distance),i.spot={},i.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,i.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),r[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},r[this.name]=!0);const a=s.extensions[this.name].lights;a.push(i),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}let bo=class{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const s=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},s[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}},Mo=class{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const n=this.writer,s=n.extensionsUsed,r={};if(r.clearcoatFactor=e.clearcoat,e.clearcoatMap){const i={index:n.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};n.applyTextureTransform(i,e.clearcoatMap),r.clearcoatTexture=i}if(r.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const i={index:n.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};n.applyTextureTransform(i,e.clearcoatRoughnessMap),r.clearcoatRoughnessTexture=i}if(e.clearcoatNormalMap){const i={index:n.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};n.applyTextureTransform(i,e.clearcoatNormalMap),r.clearcoatNormalTexture=i}t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},So=class{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const n=this.writer,s=n.extensionsUsed,r={};if(r.iridescenceFactor=e.iridescence,e.iridescenceMap){const i={index:n.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};n.applyTextureTransform(i,e.iridescenceMap),r.iridescenceTexture=i}if(r.iridescenceIor=e.iridescenceIOR,r.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],r.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const i={index:n.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};n.applyTextureTransform(i,e.iridescenceThicknessMap),r.iridescenceThicknessTexture=i}t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Ao=class{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,s=n.extensionsUsed,r={};if(r.transmissionFactor=e.transmission,e.transmissionMap){const i={index:n.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(i,e.transmissionMap),r.transmissionTexture=i}t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Co=class{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,s=n.extensionsUsed,r={};if(r.thicknessFactor=e.thickness,e.thicknessMap){const i={index:n.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};n.applyTextureTransform(i,e.thicknessMap),r.thicknessTexture=i}r.attenuationDistance=e.attenuationDistance,r.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Po=class{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const s=this.writer.extensionsUsed,r={};r.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},To=class{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(ho)&&!e.specularIntensityMap&&!e.specularColorTexture)return;const n=this.writer,s=n.extensionsUsed,r={};if(e.specularIntensityMap){const i={index:n.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};n.applyTextureTransform(i,e.specularIntensityMap),r.specularTexture=i}if(e.specularColorMap){const i={index:n.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};n.applyTextureTransform(i,e.specularColorMap),r.specularColorTexture=i}r.specularFactor=e.specularIntensity,r.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Io=class{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const n=this.writer,s=n.extensionsUsed,r={};if(e.sheenRoughnessMap){const i={index:n.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(i,e.sheenRoughnessMap),r.sheenRoughnessTexture=i}if(e.sheenColorMap){const i={index:n.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(i,e.sheenColorMap),r.sheenColorTexture=i}r.sheenRoughnessFactor=e.sheenRoughness,r.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Oo=class{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const n=this.writer,s=n.extensionsUsed,r={};if(e.anisotropyMap){const i={index:n.processTexture(e.anisotropyMap)};n.applyTextureTransform(i,e.anisotropyMap),r.anisotropyTexture=i}r.anisotropyStrength=e.anisotropy,r.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Do=class{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const s=this.writer.extensionsUsed,r={};r.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}};var Ke=Uint8Array,yt=Uint16Array,Hn=Uint32Array,or=new Ke([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]),ar=new Ke([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]),Lo=new Ke([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lr=function(o,e){for(var t=new yt(31),n=0;n<31;++n)t[n]=e+=1<<o[n-1];for(var s=new Hn(t[30]),n=1;n<30;++n)for(var r=t[n];r<t[n+1];++r)s[r]=r-t[n]<<5|n;return[t,s]},cr=lr(or,2),ur=cr[0],Bo=cr[1];ur[28]=258,Bo[258]=28;for(var ko=lr(ar,0),Fo=ko[0],$n=new yt(32768),Te=0;Te<32768;++Te){var _t=(Te&43690)>>>1|(Te&21845)<<1;_t=(_t&52428)>>>2|(_t&13107)<<2,_t=(_t&61680)>>>4|(_t&3855)<<4,$n[Te]=((_t&65280)>>>8|(_t&255)<<8)>>>1}for(var Ht=function(o,e,t){for(var n=o.length,s=0,r=new yt(e);s<n;++s)++r[o[s]-1];var i=new yt(e);for(s=0;s<e;++s)i[s]=i[s-1]+r[s-1]<<1;var a;if(t){a=new yt(1<<e);var c=15-e;for(s=0;s<n;++s)if(o[s])for(var h=s<<4|o[s],d=e-o[s],f=i[o[s]-1]++<<d,y=f|(1<<d)-1;f<=y;++f)a[$n[f]>>>c]=h}else for(a=new yt(n),s=0;s<n;++s)o[s]&&(a[s]=$n[i[o[s]-1]++]>>>15-o[s]);return a},$t=new Ke(288),Te=0;Te<144;++Te)$t[Te]=8;for(var Te=144;Te<256;++Te)$t[Te]=9;for(var Te=256;Te<280;++Te)$t[Te]=7;for(var Te=280;Te<288;++Te)$t[Te]=8;for(var hr=new Ke(32),Te=0;Te<32;++Te)hr[Te]=5;var Uo=Ht($t,9,1),No=Ht(hr,5,1),es=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},et=function(o,e,t){var n=e/8|0;return(o[n]|o[n+1]<<8)>>(e&7)&t},ts=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},zo=function(o){return(o/8|0)+(o&7&&1)},Vo=function(o,e,t){(t==null||t>o.length)&&(t=o.length);var n=new(o instanceof yt?yt:o instanceof Hn?Hn:Ke)(t-e);return n.set(o.subarray(e,t)),n},Ro=function(o,e,t){var n=o.length;if(!n||t&&!t.l&&n<5)return e||new Ke(0);var s=!e||t,r=!t||t.i;t||(t={}),e||(e=new Ke(n*3));var i=function(F){var k=e.length;if(F>k){var G=new Ke(Math.max(k*2,F));G.set(e),e=G}},a=t.f||0,c=t.p||0,h=t.b||0,d=t.l,f=t.d,y=t.m,p=t.n,_=n*8;do{if(!d){t.f=a=et(o,c,1);var g=et(o,c+1,3);if(c+=3,g)if(g==1)d=Uo,f=No,y=9,p=5;else if(g==2){var v=et(o,c,31)+257,C=et(o,c+10,15)+4,O=v+et(o,c+5,31)+1;c+=14;for(var S=new Ke(O),A=new Ke(19),b=0;b<C;++b)A[Lo[b]]=et(o,c+b*3,7);c+=C*3;for(var P=es(A),w=(1<<P)-1,D=Ht(A,P,1),b=0;b<O;){var L=D[et(o,c,w)];c+=L&15;var x=L>>>4;if(x<16)S[b++]=x;else{var V=0,R=0;for(x==16?(R=3+et(o,c,3),c+=2,V=S[b-1]):x==17?(R=3+et(o,c,7),c+=3):x==18&&(R=11+et(o,c,127),c+=7);R--;)S[b++]=V}}var Y=S.subarray(0,v),W=S.subarray(v);y=es(Y),p=es(W),d=Ht(Y,y,1),f=Ht(W,p,1)}else throw"invalid block type";else{var x=zo(c)+4,m=o[x-4]|o[x-3]<<8,M=x+m;if(M>n){if(r)throw"unexpected EOF";break}s&&i(h+m),e.set(o.subarray(x,M),h),t.b=h+=m,t.p=c=M*8;continue}if(c>_){if(r)throw"unexpected EOF";break}}s&&i(h+131072);for(var $=(1<<y)-1,q=(1<<p)-1,ne=c;;ne=c){var V=d[ts(o,c)&$],te=V>>>4;if(c+=V&15,c>_){if(r)throw"unexpected EOF";break}if(!V)throw"invalid length/literal";if(te<256)e[h++]=te;else if(te==256){ne=c,d=null;break}else{var ce=te-254;if(te>264){var b=te-257,le=or[b];ce=et(o,c,(1<<le)-1)+ur[b],c+=le}var me=f[ts(o,c)&q],B=me>>>4;if(!me)throw"invalid distance";c+=me&15;var W=Fo[B];if(B>3){var le=ar[B];W+=ts(o,c)&(1<<le)-1,c+=le}if(c>_){if(r)throw"unexpected EOF";break}s&&i(h+131072);for(var z=h+ce;h<z;h+=4)e[h]=e[h-W],e[h+1]=e[h+1-W],e[h+2]=e[h+2-W],e[h+3]=e[h+3-W];h=z}}t.l=d,t.p=ne,t.b=h,d&&(a=1,t.m=y,t.d=f,t.n=p)}while(!a);return h==e.length?e:Vo(e,0,h)},Go=new Ke(0),jo=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 Eo(o,e){return Ro((jo(o),o.subarray(2,-4)),e)}var Yo=typeof TextDecoder<"u"&&new TextDecoder,Wo=0;try{Yo.decode(Go,{stream:!0}),Wo=1}catch{}var Xo=Object.defineProperty,Zo=(o,e,t)=>e in o?Xo(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Ko=(o,e,t)=>(Zo(o,e+"",t),t);const fr=class extends l.Mesh{constructor(o,e={}){super(o),this.isReflector=!0,this.type="Reflector",this.camera=new l.PerspectiveCamera;const t=this,n=e.color!==void 0?new l.Color(e.color):new l.Color(8355711),s=e.textureWidth||512,r=e.textureHeight||512,i=e.clipBias||0,a=e.shader||fr.ReflectorShader,c=e.multisample!==void 0?e.multisample:4,h=new l.Plane,d=new l.Vector3,f=new l.Vector3,y=new l.Vector3,p=new l.Matrix4,_=new l.Vector3(0,0,-1),g=new l.Vector4,x=new l.Vector3,m=new l.Vector3,M=new l.Vector4,v=new l.Matrix4,C=this.camera,O=new l.WebGLRenderTarget(s,r,{samples:c,type:l.HalfFloatType}),S=new l.ShaderMaterial({uniforms:l.UniformsUtils.clone(a.uniforms),fragmentShader:a.fragmentShader,vertexShader:a.vertexShader});S.uniforms.tDiffuse.value=O.texture,S.uniforms.color.value=n,S.uniforms.textureMatrix.value=v,this.material=S,this.onBeforeRender=function(A,b,P){if(f.setFromMatrixPosition(t.matrixWorld),y.setFromMatrixPosition(P.matrixWorld),p.extractRotation(t.matrixWorld),d.set(0,0,1),d.applyMatrix4(p),x.subVectors(f,y),x.dot(d)>0)return;x.reflect(d).negate(),x.add(f),p.extractRotation(P.matrixWorld),_.set(0,0,-1),_.applyMatrix4(p),_.add(y),m.subVectors(f,_),m.reflect(d).negate(),m.add(f),C.position.copy(x),C.up.set(0,1,0),C.up.applyMatrix4(p),C.up.reflect(d),C.lookAt(m),C.far=P.far,C.updateMatrixWorld(),C.projectionMatrix.copy(P.projectionMatrix),v.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),v.multiply(C.projectionMatrix),v.multiply(C.matrixWorldInverse),v.multiply(t.matrixWorld),h.setFromNormalAndCoplanarPoint(d,f),h.applyMatrix4(C.matrixWorldInverse),g.set(h.normal.x,h.normal.y,h.normal.z,h.constant);const w=C.projectionMatrix;M.x=(Math.sign(g.x)+w.elements[8])/w.elements[0],M.y=(Math.sign(g.y)+w.elements[9])/w.elements[5],M.z=-1,M.w=(1+w.elements[10])/w.elements[14],g.multiplyScalar(2/g.dot(M)),w.elements[2]=g.x,w.elements[6]=g.y,w.elements[10]=g.z+1-i,w.elements[14]=g.w,t.visible=!1;const D=A.getRenderTarget(),L=A.xr.enabled,V=A.shadowMap.autoUpdate,R=A.toneMapping;let Y=!1;"outputColorSpace"in A?Y=A.outputColorSpace==="srgb":Y=A.outputEncoding===3001,A.xr.enabled=!1,A.shadowMap.autoUpdate=!1,"outputColorSpace"in A?A.outputColorSpace="srgb-linear":A.outputEncoding=3e3,A.toneMapping=l.NoToneMapping,A.setRenderTarget(O),A.state.buffers.depth.setMask(!0),A.autoClear===!1&&A.clear(),A.render(b,C),A.xr.enabled=L,A.shadowMap.autoUpdate=V,A.toneMapping=R,"outputColorSpace"in A?A.outputColorSpace=Y?"srgb":"srgb-linear":A.outputEncoding=Y?3001:3e3,A.setRenderTarget(D);const W=P.viewport;W!==void 0&&A.state.viewport(W),t.visible=!0},this.getRenderTarget=function(){return O},this.dispose=function(){O.dispose(),t.material.dispose()}}};let ns=fr;Ko(ns,"ReflectorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:`
|
|
27
|
+
`})),Nt.uniforms.blitTexture.value=o,Nt.defines.IS_SRGB="colorSpace"in o?o.colorSpace==="srgb":o.encoding===3001,Nt.needsUpdate=!0,bn||(bn=new l.Mesh(Zn,Nt),bn.frustrumCulled=!1);const n=new l.PerspectiveCamera,s=new l.Scene;s.add(bn),t||(t=wn=new l.WebGLRenderer({antialias:!1})),t.setSize(Math.min(o.image.width,e),Math.min(o.image.height,e)),t.clear(),t.render(s,n);const r=new l.Texture(t.domElement);return r.minFilter=o.minFilter,r.magFilter=o.magFilter,r.wrapS=o.wrapS,r.wrapT=o.wrapT,r.name=o.name,wn&&(wn.dispose(),wn=null),r}const $s={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class qn{constructor(){this.pluginCallbacks=[],this.register(function(e){return new wo(e)}),this.register(function(e){return new bo(e)}),this.register(function(e){return new Ao(e)}),this.register(function(e){return new Co(e)}),this.register(function(e){return new Po(e)}),this.register(function(e){return new To(e)}),this.register(function(e){return new Mo(e)}),this.register(function(e){return new So(e)}),this.register(function(e){return new Io(e)}),this.register(function(e){return new Oo(e)}),this.register(function(e){return new Do(e)})}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){const r=new vo,i=[];for(let a=0,c=this.pluginCallbacks.length;a<c;a++)i.push(this.pluginCallbacks[a](r));r.setPlugins(i),r.write(e,t,s).catch(n)}parseAsync(e,t){const n=this;return new Promise(function(s,r){n.parse(e,s,r,t)})}}uo(qn,"Utils",{insertKeyframe:function(o,e){const n=o.getValueSize(),s=new o.TimeBufferType(o.times.length+1),r=new o.ValueBufferType(o.values.length+n),i=o.createInterpolant(new o.ValueBufferType(n));let a;if(o.times.length===0){s[0]=e;for(let c=0;c<n;c++)r[c]=0;a=0}else if(e<o.times[0]){if(Math.abs(o.times[0]-e)<.001)return 0;s[0]=e,s.set(o.times,1),r.set(i.evaluate(e),0),r.set(o.values,n),a=0}else if(e>o.times[o.times.length-1]){if(Math.abs(o.times[o.times.length-1]-e)<.001)return o.times.length-1;s[s.length-1]=e,s.set(o.times,0),r.set(o.values,0),r.set(i.evaluate(e),o.values.length),a=s.length-1}else for(let c=0;c<o.times.length;c++){if(Math.abs(o.times[c]-e)<.001)return c;if(o.times[c]<e&&o.times[c+1]>e){s.set(o.times.slice(0,c+1),0),s[c+1]=e,s.set(o.times.slice(c+1),c+2),r.set(o.values.slice(0,(c+1)*n),0),r.set(i.evaluate(e),(c+1)*n),r.set(o.values.slice((c+1)*n),(c+2)*n),a=c+1;break}}return o.times=s,o.values=r,a},mergeMorphTargetTracks:function(o,e){const t=[],n={},s=o.tracks;for(let r=0;r<s.length;++r){let i=s[r];const a=l.PropertyBinding.parseTrackName(i.name),c=l.PropertyBinding.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){t.push(i);continue}if(i.createInterpolant!==i.InterpolantFactoryMethodDiscrete&&i.createInterpolant!==i.InterpolantFactoryMethodLinear){if(i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),i=i.clone(),i.setInterpolation(l.InterpolateLinear)}const h=c.morphTargetInfluences.length,d=c.morphTargetDictionary[a.propertyIndex];if(d===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let f;if(n[c.uuid]===void 0){f=i.clone();const p=new f.ValueBufferType(h*f.times.length);for(let _=0;_<f.times.length;_++)p[_*h+d]=f.values[_];f.name=(a.nodeName||"")+".morphTargetInfluences",f.values=p,n[c.uuid]=f,t.push(f);continue}const g=i.createInterpolant(new i.ValueBufferType(1));f=n[c.uuid];for(let p=0;p<f.times.length;p++)f.values[p*h+d]=g.evaluate(f.times[p]);for(let p=0;p<i.times.length;p++){const _=this.insertKeyframe(f,i.times[p]);f.values[_*h+d]=i.values[p]}}return o.tracks=t,o}});const we={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},Qn="KHR_mesh_quantization",Xe={};Xe[l.NearestFilter]=we.NEAREST,Xe[l.NearestMipmapNearestFilter]=we.NEAREST_MIPMAP_NEAREST,Xe[l.NearestMipmapLinearFilter]=we.NEAREST_MIPMAP_LINEAR,Xe[l.LinearFilter]=we.LINEAR,Xe[l.LinearMipmapNearestFilter]=we.LINEAR_MIPMAP_NEAREST,Xe[l.LinearMipmapLinearFilter]=we.LINEAR_MIPMAP_LINEAR,Xe[l.ClampToEdgeWrapping]=we.CLAMP_TO_EDGE,Xe[l.RepeatWrapping]=we.REPEAT,Xe[l.MirroredRepeatWrapping]=we.MIRRORED_REPEAT;const er={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},ho=new l.Color,tr=12,fo=1179937895,po=2,nr=8,mo=1313821514,go=5130562;function Jt(o,e){return o.length===e.length&&o.every(function(t,n){return t===e[n]})}function yo(o){return new TextEncoder().encode(o).buffer}function _o(o){return Jt(o.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function xo(o,e,t){const n={min:new Array(o.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(o.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let s=e;s<e+t;s++)for(let r=0;r<o.itemSize;r++){let i;o.itemSize>4?i=o.array[s*o.itemSize+r]:(r===0?i=o.getX(s):r===1?i=o.getY(s):r===2?i=o.getZ(s):r===3&&(i=o.getW(s)),o.normalized===!0&&(i=l.MathUtils.normalize(i,o.array))),n.min[r]=Math.min(n.min[r],i),n.max[r]=Math.max(n.max[r],i)}return n}function sr(o){return Math.ceil(o/4)*4}function Jn(o,e=0){const t=sr(o.byteLength);if(t!==o.byteLength){const n=new Uint8Array(t);if(n.set(new Uint8Array(o)),e!==0)for(let s=o.byteLength;s<t;s++)n[s]=e;return n.buffer}return o}function rr(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function ir(o,e){if(o.toBlob!==void 0)return new Promise(n=>o.toBlob(n,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),o.convertToBlob({type:e,quality:t})}class vo{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const s=this,r=s.buffers,i=s.json;n=s.options;const a=s.extensionsUsed,c=s.extensionsRequired,h=new Blob(r,{type:"application/octet-stream"}),d=Object.keys(a),f=Object.keys(c);d.length>0&&(i.extensionsUsed=d),f.length>0&&(i.extensionsRequired=f),i.buffers&&i.buffers.length>0&&(i.buffers[0].byteLength=h.size),n.binary===!0?h.arrayBuffer().then(g=>{const p=Jn(g),_=new DataView(new ArrayBuffer(nr));_.setUint32(0,p.byteLength,!0),_.setUint32(4,go,!0);const y=Jn(yo(JSON.stringify(i)),32),x=new DataView(new ArrayBuffer(nr));x.setUint32(0,y.byteLength,!0),x.setUint32(4,mo,!0);const m=new ArrayBuffer(tr),M=new DataView(m);M.setUint32(0,fo,!0),M.setUint32(4,po,!0);const v=tr+x.byteLength+y.byteLength+_.byteLength+p.byteLength;M.setUint32(8,v,!0),new Blob([m,x,y,_,p],{type:"application/octet-stream"}).arrayBuffer().then(t)}):i.buffers&&i.buffers.length>0?Hs(h).then(g=>{i.buffers[0].uri=g,t(i)}):t(i)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const n=this.options,s=this.extensionsUsed;try{const r=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&r.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const i in r.gltfExtensions)t.extensions[i]=r.gltfExtensions[i],s[i]=!0;delete r.gltfExtensions}Object.keys(r).length>0&&(t.extras=r)}catch(r){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+r.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const s=new Map;s.set(!0,this.uid++),s.set(!1,this.uid++),this.uids.set(e,s)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new l.Vector3;for(let s=0,r=e.count;s<r;s++)if(Math.abs(n.fromBufferAttribute(e,s).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const n=e.clone(),s=new l.Vector3;for(let r=0,i=n.count;r<i;r++)s.fromBufferAttribute(n,r),s.x===0&&s.y===0&&s.z===0?s.setX(1):s.normalize(),n.setXYZ(r,s.x,s.y,s.z);return t.attributesNormalized.set(e,n),n}applyTextureTransform(e,t){let n=!1;const s={};(t.offset.x!==0||t.offset.y!==0)&&(s.offset=t.offset.toArray(),n=!0),t.rotation!==0&&(s.rotation=t.rotation,n=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(s.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function n(p){return("colorSpace"in p?p.colorSpace==="srgb":p.encoding===3001)?function(y){return y<.04045?y*.0773993808:Math.pow(y*.9478672986+.0521327014,2.4)}:function(y){return y}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof l.CompressedTexture&&(e=Kn(e)),t instanceof l.CompressedTexture&&(t=Kn(t));const s=e?e.image:null,r=t?t.image:null,i=Math.max(s?s.width:0,r?r.width:0),a=Math.max(s?s.height:0,r?r.height:0),c=rr();c.width=i,c.height=a;const h=c.getContext("2d");h.fillStyle="#00ffff",h.fillRect(0,0,i,a);const d=h.getImageData(0,0,i,a);if(s){h.drawImage(s,0,0,i,a);const p=n(e),_=h.getImageData(0,0,i,a).data;for(let y=2;y<_.length;y+=4)d.data[y]=p(_[y]/256)*256}if(r){h.drawImage(r,0,0,i,a);const p=n(t),_=h.getImageData(0,0,i,a).data;for(let y=1;y<_.length;y+=4)d.data[y]=p(_[y]/256)*256}h.putImageData(d,0,0);const g=(e||t).clone();return g.source=new l.Texture(c).source,"colorSpace"in g?g.colorSpace="":g.encoding=3e3,g.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),g}processBuffer(e){const t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}processBufferView(e,t,n,s,r){const i=this.json;i.bufferViews||(i.bufferViews=[]);let a;switch(t){case we.BYTE:case we.UNSIGNED_BYTE:a=1;break;case we.SHORT:case we.UNSIGNED_SHORT:a=2;break;default:a=4}const c=sr(s*e.itemSize*a),h=new DataView(new ArrayBuffer(c));let d=0;for(let p=n;p<n+s;p++)for(let _=0;_<e.itemSize;_++){let y;e.itemSize>4?y=e.array[p*e.itemSize+_]:(_===0?y=e.getX(p):_===1?y=e.getY(p):_===2?y=e.getZ(p):_===3&&(y=e.getW(p)),e.normalized===!0&&(y=l.MathUtils.normalize(y,e.array))),t===we.FLOAT?h.setFloat32(d,y,!0):t===we.INT?h.setInt32(d,y,!0):t===we.UNSIGNED_INT?h.setUint32(d,y,!0):t===we.SHORT?h.setInt16(d,y,!0):t===we.UNSIGNED_SHORT?h.setUint16(d,y,!0):t===we.BYTE?h.setInt8(d,y):t===we.UNSIGNED_BYTE&&h.setUint8(d,y),d+=a}const f={buffer:this.processBuffer(h.buffer),byteOffset:this.byteOffset,byteLength:c};return r!==void 0&&(f.target=r),r===we.ARRAY_BUFFER&&(f.byteStride=e.itemSize*a),this.byteOffset+=c,i.bufferViews.push(f),{id:i.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),e.arrayBuffer().then(s=>{const r=Jn(s),i={buffer:t.processBuffer(r),byteOffset:t.byteOffset,byteLength:r.byteLength};return t.byteOffset+=r.byteLength,n.bufferViews.push(i)-1})}processAccessor(e,t,n,s){const r=this.json,i={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=we.FLOAT;else if(e.array.constructor===Int32Array)a=we.INT;else if(e.array.constructor===Uint32Array)a=we.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=we.SHORT;else if(e.array.constructor===Uint16Array)a=we.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=we.BYTE;else if(e.array.constructor===Uint8Array)a=we.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),s===void 0&&(s=e.count),s===0)return null;const c=xo(e,n,s);let h;t!==void 0&&(h=e===t.index?we.ELEMENT_ARRAY_BUFFER:we.ARRAY_BUFFER);const d=this.processBufferView(e,a,n,s,h),f={bufferView:d.id,byteOffset:d.byteOffset,componentType:a,count:s,max:c.max,min:c.min,type:i[e.itemSize]};return e.normalized===!0&&(f.normalized=!0),r.accessors||(r.accessors=[]),r.accessors.push(f)-1}processImage(e,t,n,s="image/png"){if(e!==null){const r=this,i=r.cache,a=r.json,c=r.options,h=r.pending;i.images.has(e)||i.images.set(e,{});const d=i.images.get(e),f=s+":flipY/"+n.toString();if(d[f]!==void 0)return d[f];a.images||(a.images=[]);const g={mimeType:s},p=rr();p.width=Math.min(e.width,c.maxTextureSize),p.height=Math.min(e.height,c.maxTextureSize);const _=p.getContext("2d");if(n===!0&&(_.translate(0,p.height),_.scale(1,-1)),e.data!==void 0){t!==l.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const x=new Uint8ClampedArray(e.height*e.width*4);for(let m=0;m<x.length;m+=4)x[m+0]=e.data[m+0],x[m+1]=e.data[m+1],x[m+2]=e.data[m+2],x[m+3]=e.data[m+3];_.putImageData(new ImageData(x,e.width,e.height),0,0)}else _.drawImage(e,0,0,p.width,p.height);c.binary===!0?h.push(ir(p,s).then(x=>r.processBufferViewImage(x)).then(x=>{g.bufferView=x})):p.toDataURL!==void 0?g.uri=p.toDataURL(s):h.push(ir(p,s).then(Hs).then(x=>{g.uri=x}));const y=a.images.push(g)-1;return d[f]=y,y}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const n={magFilter:Xe[e.magFilter],minFilter:Xe[e.minFilter],wrapS:Xe[e.wrapS],wrapT:Xe[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){const n=this.options,s=this.cache,r=this.json;if(s.textures.has(e))return s.textures.get(e);r.textures||(r.textures=[]),e instanceof l.CompressedTexture&&(e=Kn(e,n.maxTextureSize));let i=e.userData.mimeType;i==="image/webp"&&(i="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)};e.name&&(a.name=e.name),this._invokeAll(function(h){h.writeTexture&&h.writeTexture(e,a)});const c=r.textures.push(a)-1;return s.textures.set(e,c),c}processMaterial(e){const t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const s={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const r=e.color.toArray().concat([e.opacity]);if(Jt(r,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=r),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=.5,s.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),c={index:this.processTexture(a),channel:a.channel};this.applyTextureTransform(c,a),s.pbrMetallicRoughness.metallicRoughnessTexture=c}if(e.map){const a={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(a,e.map),s.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive;if(Math.max(a.r,a.g,a.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const h={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(h,e.emissiveMap),s.emissiveTexture=h}}if(e.normalMap){const a={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),s.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),s.occlusionTexture=a}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),e.side===l.DoubleSide&&(s.doubleSided=!0),e.name!==""&&(s.name=e.name),this.serializeUserData(e,s),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,s)});const i=n.materials.push(s)-1;return t.materials.set(e,i),i}processMesh(e){const t=this.cache,n=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let v=0,C=e.material.length;v<C;v++)s.push(e.material[v].uuid);else s.push(e.material.uuid);const r=s.join(":");if(t.meshes.has(r))return t.meshes.get(r);const i=e.geometry;let a;e.isLineSegments?a=we.LINES:e.isLineLoop?a=we.LINE_LOOP:e.isLine?a=we.LINE_STRIP:e.isPoints?a=we.POINTS:a=e.material.wireframe?we.LINES:we.TRIANGLES;const c={},h={},d=[],f=[],g={...Qt>=152?{uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3"}:{uv:"TEXCOORD_0",uv2:"TEXCOORD_1"},color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},p=i.getAttribute("normal");p!==void 0&&!this.isNormalizedNormalAttribute(p)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),i.setAttribute("normal",this.createNormalizedNormalAttribute(p)));let _=null;for(let v in i.attributes){if(v.slice(0,5)==="morph")continue;const C=i.attributes[v];if(v=g[v]||v.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(v)||(v="_"+v),t.attributes.has(this.getUID(C))){h[v]=t.attributes.get(this.getUID(C));continue}_=null;const S=C.array;v==="JOINTS_0"&&!(S instanceof Uint16Array)&&!(S instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),_=new l.BufferAttribute(new Uint16Array(S),C.itemSize,C.normalized));const A=this.processAccessor(_||C,i);A!==null&&(v.startsWith("_")||this.detectMeshQuantization(v,C),h[v]=A,t.attributes.set(this.getUID(C),A))}if(p!==void 0&&i.setAttribute("normal",p),Object.keys(h).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const v=[],C=[],O={};if(e.morphTargetDictionary!==void 0)for(const S in e.morphTargetDictionary)O[e.morphTargetDictionary[S]]=S;for(let S=0;S<e.morphTargetInfluences.length;++S){const A={};let b=!1;for(const P in i.morphAttributes){if(P!=="position"&&P!=="normal"){b||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),b=!0);continue}const w=i.morphAttributes[P][S],D=P.toUpperCase(),L=i.attributes[P];if(t.attributes.has(this.getUID(w,!0))){A[D]=t.attributes.get(this.getUID(w,!0));continue}const V=w.clone();if(!i.morphTargetsRelative)for(let R=0,Y=w.count;R<Y;R++)for(let W=0;W<w.itemSize;W++)W===0&&V.setX(R,w.getX(R)-L.getX(R)),W===1&&V.setY(R,w.getY(R)-L.getY(R)),W===2&&V.setZ(R,w.getZ(R)-L.getZ(R)),W===3&&V.setW(R,w.getW(R)-L.getW(R));A[D]=this.processAccessor(V,i),t.attributes.set(this.getUID(L,!0),A[D])}f.push(A),v.push(e.morphTargetInfluences[S]),e.morphTargetDictionary!==void 0&&C.push(O[S])}c.weights=v,C.length>0&&(c.extras={},c.extras.targetNames=C)}const y=Array.isArray(e.material);if(y&&i.groups.length===0)return null;const x=y?e.material:[e.material],m=y?i.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let v=0,C=m.length;v<C;v++){const O={mode:a,attributes:h};if(this.serializeUserData(i,O),f.length>0&&(O.targets=f),i.index!==null){let A=this.getUID(i.index);(m[v].start!==void 0||m[v].count!==void 0)&&(A+=":"+m[v].start+":"+m[v].count),t.attributes.has(A)?O.indices=t.attributes.get(A):(O.indices=this.processAccessor(i.index,i,m[v].start,m[v].count),t.attributes.set(A,O.indices)),O.indices===null&&delete O.indices}const S=this.processMaterial(x[m[v].materialIndex]);S!==null&&(O.material=S),d.push(O)}c.primitives=d,n.meshes||(n.meshes=[]),this._invokeAll(function(v){v.writeMesh&&v.writeMesh(e,c)});const M=n.meshes.push(c)-1;return t.meshes.set(r,M),M}detectMeshQuantization(e,t){if(this.extensionsUsed[Qn])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");const s=e.split("_",1)[0];$s[s]&&$s[s].includes(n)&&(this.extensionsUsed[Qn]=!0,this.extensionsRequired[Qn]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const n=e.isOrthographicCamera,s={type:n?"orthographic":"perspective"};return n?s.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:s.perspective={aspectRatio:e.aspect,yfov:l.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(s.name=e.type),t.cameras.push(s)-1}processAnimation(e,t){const n=this.json,s=this.nodeMap;n.animations||(n.animations=[]),e=qn.Utils.mergeMorphTargetTracks(e.clone(),t);const r=e.tracks,i=[],a=[];for(let c=0;c<r.length;++c){const h=r[c],d=l.PropertyBinding.parseTrackName(h.name);let f=l.PropertyBinding.findNode(t,d.nodeName);const g=er[d.propertyName];if(d.objectName==="bones"&&(f.isSkinnedMesh===!0?f=f.skeleton.getBoneByName(d.objectIndex):f=void 0),!f||!g)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',h.name),null;const p=1;let _=h.values.length/h.times.length;g===er.morphTargetInfluences&&(_/=f.morphTargetInfluences.length);let y;h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(y="CUBICSPLINE",_/=3):h.getInterpolation()===l.InterpolateDiscrete?y="STEP":y="LINEAR",a.push({input:this.processAccessor(new l.BufferAttribute(h.times,p)),output:this.processAccessor(new l.BufferAttribute(h.values,_)),interpolation:y}),i.push({sampler:a.length-1,target:{node:s.get(f),path:g}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:a,channels:i}),n.animations.length-1}processSkin(e){const t=this.json,n=this.nodeMap,s=t.nodes[n.get(e)],r=e.skeleton;if(r===void 0)return null;const i=e.skeleton.bones[0];if(i===void 0)return null;const a=[],c=new Float32Array(r.bones.length*16),h=new l.Matrix4;for(let f=0;f<r.bones.length;++f)a.push(n.get(r.bones[f])),h.copy(r.boneInverses[f]),h.multiply(e.bindMatrix).toArray(c,f*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new l.BufferAttribute(c,16)),joints:a,skeleton:n.get(i)}),s.skin=t.skins.length-1}processNode(e){const t=this.json,n=this.options,s=this.nodeMap;t.nodes||(t.nodes=[]);const r={};if(n.trs){const a=e.quaternion.toArray(),c=e.position.toArray(),h=e.scale.toArray();Jt(a,[0,0,0,1])||(r.rotation=a),Jt(c,[0,0,0])||(r.translation=c),Jt(h,[1,1,1])||(r.scale=h)}else e.matrixAutoUpdate&&e.updateMatrix(),_o(e.matrix)===!1&&(r.matrix=e.matrix.elements);if(e.name!==""&&(r.name=String(e.name)),this.serializeUserData(e,r),e.isMesh||e.isLine||e.isPoints){const a=this.processMesh(e);a!==null&&(r.mesh=a)}else e.isCamera&&(r.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const a=[];for(let c=0,h=e.children.length;c<h;c++){const d=e.children[c];if(d.visible||n.onlyVisible===!1){const f=this.processNode(d);f!==null&&a.push(f)}}a.length>0&&(r.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,r)});const i=t.nodes.push(r)-1;return s.set(e,i),i}processScene(e){const t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};e.name!==""&&(s.name=e.name),t.scenes.push(s);const r=[];for(let i=0,a=e.children.length;i<a;i++){const c=e.children[i];if(c.visible||n.onlyVisible===!1){const h=this.processNode(c);h!==null&&r.push(h)}}r.length>0&&(s.nodes=r),this.serializeUserData(e,s)}processObjects(e){const t=new l.Scene;t.name="AuxScene";for(let n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(s){s.beforeParse&&s.beforeParse(e)});const n=[];for(let s=0;s<e.length;s++)e[s]instanceof l.Scene?this.processScene(e[s]):n.push(e[s]);n.length>0&&this.processObjects(n);for(let s=0;s<this.skins.length;++s)this.processSkin(this.skins[s]);for(let s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s],e[0]);this._invokeAll(function(s){s.afterParse&&s.afterParse(e)})}_invokeAll(e){for(let t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}class wo{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const n=this.writer,s=n.json,r=n.extensionsUsed,i={};e.name&&(i.name=e.name),i.color=e.color.toArray(),i.intensity=e.intensity,e.isDirectionalLight?i.type="directional":e.isPointLight?(i.type="point",e.distance>0&&(i.range=e.distance)):e.isSpotLight&&(i.type="spot",e.distance>0&&(i.range=e.distance),i.spot={},i.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,i.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),r[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},r[this.name]=!0);const a=s.extensions[this.name].lights;a.push(i),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}let bo=class{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const s=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},s[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}},Mo=class{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const n=this.writer,s=n.extensionsUsed,r={};if(r.clearcoatFactor=e.clearcoat,e.clearcoatMap){const i={index:n.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};n.applyTextureTransform(i,e.clearcoatMap),r.clearcoatTexture=i}if(r.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const i={index:n.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};n.applyTextureTransform(i,e.clearcoatRoughnessMap),r.clearcoatRoughnessTexture=i}if(e.clearcoatNormalMap){const i={index:n.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};n.applyTextureTransform(i,e.clearcoatNormalMap),r.clearcoatNormalTexture=i}t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},So=class{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const n=this.writer,s=n.extensionsUsed,r={};if(r.iridescenceFactor=e.iridescence,e.iridescenceMap){const i={index:n.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};n.applyTextureTransform(i,e.iridescenceMap),r.iridescenceTexture=i}if(r.iridescenceIor=e.iridescenceIOR,r.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],r.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const i={index:n.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};n.applyTextureTransform(i,e.iridescenceThicknessMap),r.iridescenceThicknessTexture=i}t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Ao=class{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,s=n.extensionsUsed,r={};if(r.transmissionFactor=e.transmission,e.transmissionMap){const i={index:n.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(i,e.transmissionMap),r.transmissionTexture=i}t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Co=class{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,s=n.extensionsUsed,r={};if(r.thicknessFactor=e.thickness,e.thicknessMap){const i={index:n.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};n.applyTextureTransform(i,e.thicknessMap),r.thicknessTexture=i}r.attenuationDistance=e.attenuationDistance,r.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Po=class{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const s=this.writer.extensionsUsed,r={};r.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},To=class{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(ho)&&!e.specularIntensityMap&&!e.specularColorTexture)return;const n=this.writer,s=n.extensionsUsed,r={};if(e.specularIntensityMap){const i={index:n.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};n.applyTextureTransform(i,e.specularIntensityMap),r.specularTexture=i}if(e.specularColorMap){const i={index:n.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};n.applyTextureTransform(i,e.specularColorMap),r.specularColorTexture=i}r.specularFactor=e.specularIntensity,r.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Io=class{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const n=this.writer,s=n.extensionsUsed,r={};if(e.sheenRoughnessMap){const i={index:n.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(i,e.sheenRoughnessMap),r.sheenRoughnessTexture=i}if(e.sheenColorMap){const i={index:n.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(i,e.sheenColorMap),r.sheenColorTexture=i}r.sheenRoughnessFactor=e.sheenRoughness,r.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Oo=class{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const n=this.writer,s=n.extensionsUsed,r={};if(e.anisotropyMap){const i={index:n.processTexture(e.anisotropyMap)};n.applyTextureTransform(i,e.anisotropyMap),r.anisotropyTexture=i}r.anisotropyStrength=e.anisotropy,r.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}},Do=class{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const s=this.writer.extensionsUsed,r={};r.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}};var Ke=Uint8Array,yt=Uint16Array,Hn=Uint32Array,or=new Ke([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]),ar=new Ke([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]),Lo=new Ke([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lr=function(o,e){for(var t=new yt(31),n=0;n<31;++n)t[n]=e+=1<<o[n-1];for(var s=new Hn(t[30]),n=1;n<30;++n)for(var r=t[n];r<t[n+1];++r)s[r]=r-t[n]<<5|n;return[t,s]},cr=lr(or,2),ur=cr[0],Bo=cr[1];ur[28]=258,Bo[258]=28;for(var ko=lr(ar,0),Fo=ko[0],$n=new yt(32768),Te=0;Te<32768;++Te){var _t=(Te&43690)>>>1|(Te&21845)<<1;_t=(_t&52428)>>>2|(_t&13107)<<2,_t=(_t&61680)>>>4|(_t&3855)<<4,$n[Te]=((_t&65280)>>>8|(_t&255)<<8)>>>1}for(var Ht=function(o,e,t){for(var n=o.length,s=0,r=new yt(e);s<n;++s)++r[o[s]-1];var i=new yt(e);for(s=0;s<e;++s)i[s]=i[s-1]+r[s-1]<<1;var a;if(t){a=new yt(1<<e);var c=15-e;for(s=0;s<n;++s)if(o[s])for(var h=s<<4|o[s],d=e-o[s],f=i[o[s]-1]++<<d,g=f|(1<<d)-1;f<=g;++f)a[$n[f]>>>c]=h}else for(a=new yt(n),s=0;s<n;++s)o[s]&&(a[s]=$n[i[o[s]-1]++]>>>15-o[s]);return a},$t=new Ke(288),Te=0;Te<144;++Te)$t[Te]=8;for(var Te=144;Te<256;++Te)$t[Te]=9;for(var Te=256;Te<280;++Te)$t[Te]=7;for(var Te=280;Te<288;++Te)$t[Te]=8;for(var hr=new Ke(32),Te=0;Te<32;++Te)hr[Te]=5;var Uo=Ht($t,9,1),No=Ht(hr,5,1),es=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},et=function(o,e,t){var n=e/8|0;return(o[n]|o[n+1]<<8)>>(e&7)&t},ts=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},zo=function(o){return(o/8|0)+(o&7&&1)},Vo=function(o,e,t){(t==null||t>o.length)&&(t=o.length);var n=new(o instanceof yt?yt:o instanceof Hn?Hn:Ke)(t-e);return n.set(o.subarray(e,t)),n},Ro=function(o,e,t){var n=o.length;if(!n||t&&!t.l&&n<5)return e||new Ke(0);var s=!e||t,r=!t||t.i;t||(t={}),e||(e=new Ke(n*3));var i=function(F){var k=e.length;if(F>k){var G=new Ke(Math.max(k*2,F));G.set(e),e=G}},a=t.f||0,c=t.p||0,h=t.b||0,d=t.l,f=t.d,g=t.m,p=t.n,_=n*8;do{if(!d){t.f=a=et(o,c,1);var y=et(o,c+1,3);if(c+=3,y)if(y==1)d=Uo,f=No,g=9,p=5;else if(y==2){var v=et(o,c,31)+257,C=et(o,c+10,15)+4,O=v+et(o,c+5,31)+1;c+=14;for(var S=new Ke(O),A=new Ke(19),b=0;b<C;++b)A[Lo[b]]=et(o,c+b*3,7);c+=C*3;for(var P=es(A),w=(1<<P)-1,D=Ht(A,P,1),b=0;b<O;){var L=D[et(o,c,w)];c+=L&15;var x=L>>>4;if(x<16)S[b++]=x;else{var V=0,R=0;for(x==16?(R=3+et(o,c,3),c+=2,V=S[b-1]):x==17?(R=3+et(o,c,7),c+=3):x==18&&(R=11+et(o,c,127),c+=7);R--;)S[b++]=V}}var Y=S.subarray(0,v),W=S.subarray(v);g=es(Y),p=es(W),d=Ht(Y,g,1),f=Ht(W,p,1)}else throw"invalid block type";else{var x=zo(c)+4,m=o[x-4]|o[x-3]<<8,M=x+m;if(M>n){if(r)throw"unexpected EOF";break}s&&i(h+m),e.set(o.subarray(x,M),h),t.b=h+=m,t.p=c=M*8;continue}if(c>_){if(r)throw"unexpected EOF";break}}s&&i(h+131072);for(var $=(1<<g)-1,q=(1<<p)-1,ne=c;;ne=c){var V=d[ts(o,c)&$],te=V>>>4;if(c+=V&15,c>_){if(r)throw"unexpected EOF";break}if(!V)throw"invalid length/literal";if(te<256)e[h++]=te;else if(te==256){ne=c,d=null;break}else{var ce=te-254;if(te>264){var b=te-257,le=or[b];ce=et(o,c,(1<<le)-1)+ur[b],c+=le}var me=f[ts(o,c)&q],B=me>>>4;if(!me)throw"invalid distance";c+=me&15;var W=Fo[B];if(B>3){var le=ar[B];W+=ts(o,c)&(1<<le)-1,c+=le}if(c>_){if(r)throw"unexpected EOF";break}s&&i(h+131072);for(var z=h+ce;h<z;h+=4)e[h]=e[h-W],e[h+1]=e[h+1-W],e[h+2]=e[h+2-W],e[h+3]=e[h+3-W];h=z}}t.l=d,t.p=ne,t.b=h,d&&(a=1,t.m=g,t.d=f,t.n=p)}while(!a);return h==e.length?e:Vo(e,0,h)},Go=new Ke(0),jo=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 Eo(o,e){return Ro((jo(o),o.subarray(2,-4)),e)}var Yo=typeof TextDecoder<"u"&&new TextDecoder,Wo=0;try{Yo.decode(Go,{stream:!0}),Wo=1}catch{}var Xo=Object.defineProperty,Zo=(o,e,t)=>e in o?Xo(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Ko=(o,e,t)=>(Zo(o,e+"",t),t);const fr=class extends l.Mesh{constructor(o,e={}){super(o),this.isReflector=!0,this.type="Reflector",this.camera=new l.PerspectiveCamera;const t=this,n=e.color!==void 0?new l.Color(e.color):new l.Color(8355711),s=e.textureWidth||512,r=e.textureHeight||512,i=e.clipBias||0,a=e.shader||fr.ReflectorShader,c=e.multisample!==void 0?e.multisample:4,h=new l.Plane,d=new l.Vector3,f=new l.Vector3,g=new l.Vector3,p=new l.Matrix4,_=new l.Vector3(0,0,-1),y=new l.Vector4,x=new l.Vector3,m=new l.Vector3,M=new l.Vector4,v=new l.Matrix4,C=this.camera,O=new l.WebGLRenderTarget(s,r,{samples:c,type:l.HalfFloatType}),S=new l.ShaderMaterial({uniforms:l.UniformsUtils.clone(a.uniforms),fragmentShader:a.fragmentShader,vertexShader:a.vertexShader});S.uniforms.tDiffuse.value=O.texture,S.uniforms.color.value=n,S.uniforms.textureMatrix.value=v,this.material=S,this.onBeforeRender=function(A,b,P){if(f.setFromMatrixPosition(t.matrixWorld),g.setFromMatrixPosition(P.matrixWorld),p.extractRotation(t.matrixWorld),d.set(0,0,1),d.applyMatrix4(p),x.subVectors(f,g),x.dot(d)>0)return;x.reflect(d).negate(),x.add(f),p.extractRotation(P.matrixWorld),_.set(0,0,-1),_.applyMatrix4(p),_.add(g),m.subVectors(f,_),m.reflect(d).negate(),m.add(f),C.position.copy(x),C.up.set(0,1,0),C.up.applyMatrix4(p),C.up.reflect(d),C.lookAt(m),C.far=P.far,C.updateMatrixWorld(),C.projectionMatrix.copy(P.projectionMatrix),v.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),v.multiply(C.projectionMatrix),v.multiply(C.matrixWorldInverse),v.multiply(t.matrixWorld),h.setFromNormalAndCoplanarPoint(d,f),h.applyMatrix4(C.matrixWorldInverse),y.set(h.normal.x,h.normal.y,h.normal.z,h.constant);const w=C.projectionMatrix;M.x=(Math.sign(y.x)+w.elements[8])/w.elements[0],M.y=(Math.sign(y.y)+w.elements[9])/w.elements[5],M.z=-1,M.w=(1+w.elements[10])/w.elements[14],y.multiplyScalar(2/y.dot(M)),w.elements[2]=y.x,w.elements[6]=y.y,w.elements[10]=y.z+1-i,w.elements[14]=y.w,t.visible=!1;const D=A.getRenderTarget(),L=A.xr.enabled,V=A.shadowMap.autoUpdate,R=A.toneMapping;let Y=!1;"outputColorSpace"in A?Y=A.outputColorSpace==="srgb":Y=A.outputEncoding===3001,A.xr.enabled=!1,A.shadowMap.autoUpdate=!1,"outputColorSpace"in A?A.outputColorSpace="srgb-linear":A.outputEncoding=3e3,A.toneMapping=l.NoToneMapping,A.setRenderTarget(O),A.state.buffers.depth.setMask(!0),A.autoClear===!1&&A.clear(),A.render(b,C),A.xr.enabled=L,A.shadowMap.autoUpdate=V,A.toneMapping=R,"outputColorSpace"in A?A.outputColorSpace=Y?"srgb":"srgb-linear":A.outputEncoding=Y?3001:3e3,A.setRenderTarget(D);const W=P.viewport;W!==void 0&&A.state.viewport(W),t.visible=!0},this.getRenderTarget=function(){return O},this.dispose=function(){O.dispose(),t.material.dispose()}}};let ns=fr;Ko(ns,"ReflectorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:`
|
|
28
28
|
uniform mat4 textureMatrix;
|
|
29
29
|
varying vec4 vUv;
|
|
30
30
|
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
#include <tonemapping_fragment>
|
|
69
69
|
#include <${Qt>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
70
70
|
|
|
71
|
-
}`});class qo extends l.Mesh{constructor(e,t={}){super(e),this.isWater=!0;const n=this,s=t.textureWidth!==void 0?t.textureWidth:512,r=t.textureHeight!==void 0?t.textureHeight:512,i=t.clipBias!==void 0?t.clipBias:0,a=t.alpha!==void 0?t.alpha:1,c=t.time!==void 0?t.time:0,h=t.waterNormals!==void 0?t.waterNormals:null,d=t.sunDirection!==void 0?t.sunDirection:new l.Vector3(.70707,.70707,0),f=new l.Color(t.sunColor!==void 0?t.sunColor:16777215),
|
|
71
|
+
}`});class qo extends l.Mesh{constructor(e,t={}){super(e),this.isWater=!0;const n=this,s=t.textureWidth!==void 0?t.textureWidth:512,r=t.textureHeight!==void 0?t.textureHeight:512,i=t.clipBias!==void 0?t.clipBias:0,a=t.alpha!==void 0?t.alpha:1,c=t.time!==void 0?t.time:0,h=t.waterNormals!==void 0?t.waterNormals:null,d=t.sunDirection!==void 0?t.sunDirection:new l.Vector3(.70707,.70707,0),f=new l.Color(t.sunColor!==void 0?t.sunColor:16777215),g=new l.Color(t.waterColor!==void 0?t.waterColor:8355711),p=t.eye!==void 0?t.eye:new l.Vector3(0,0,0),_=t.distortionScale!==void 0?t.distortionScale:20,y=t.side!==void 0?t.side:l.FrontSide,x=t.fog!==void 0?t.fog:!1,m=new l.Plane,M=new l.Vector3,v=new l.Vector3,C=new l.Vector3,O=new l.Matrix4,S=new l.Vector3(0,0,-1),A=new l.Vector4,b=new l.Vector3,P=new l.Vector3,w=new l.Vector4,D=new l.Matrix4,L=new l.PerspectiveCamera,V=new l.WebGLRenderTarget(s,r),R={uniforms:l.UniformsUtils.merge([l.UniformsLib.fog,l.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new l.Matrix4},sunColor:{value:new l.Color(8355711)},sunDirection:{value:new l.Vector3(.70707,.70707,0)},eye:{value:new l.Vector3},waterColor:{value:new l.Color(5592405)}}]),vertexShader:`
|
|
72
72
|
uniform mat4 textureMatrix;
|
|
73
73
|
uniform float time;
|
|
74
74
|
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
#include <tonemapping_fragment>
|
|
165
165
|
#include <${parseInt(l.REVISION.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
166
166
|
#include <fog_fragment>
|
|
167
|
-
}`},Y=new l.ShaderMaterial({fragmentShader:R.fragmentShader,vertexShader:R.vertexShader,uniforms:l.UniformsUtils.clone(R.uniforms),lights:!0,side:
|
|
167
|
+
}`},Y=new l.ShaderMaterial({fragmentShader:R.fragmentShader,vertexShader:R.vertexShader,uniforms:l.UniformsUtils.clone(R.uniforms),lights:!0,side:y,fog:x});Y.uniforms.mirrorSampler.value=V.texture,Y.uniforms.textureMatrix.value=D,Y.uniforms.alpha.value=a,Y.uniforms.time.value=c,Y.uniforms.normalSampler.value=h,Y.uniforms.sunColor.value=f,Y.uniforms.waterColor.value=g,Y.uniforms.sunDirection.value=d,Y.uniforms.distortionScale.value=_,Y.uniforms.eye.value=p,n.material=Y,n.onBeforeRender=function(W,$,q){if(v.setFromMatrixPosition(n.matrixWorld),C.setFromMatrixPosition(q.matrixWorld),O.extractRotation(n.matrixWorld),M.set(0,0,1),M.applyMatrix4(O),b.subVectors(v,C),b.dot(M)>0)return;b.reflect(M).negate(),b.add(v),O.extractRotation(q.matrixWorld),S.set(0,0,-1),S.applyMatrix4(O),S.add(C),P.subVectors(v,S),P.reflect(M).negate(),P.add(v),L.position.copy(b),L.up.set(0,1,0),L.up.applyMatrix4(O),L.up.reflect(M),L.lookAt(P),L.far=q.far,L.updateMatrixWorld(),L.projectionMatrix.copy(q.projectionMatrix),D.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),D.multiply(L.projectionMatrix),D.multiply(L.matrixWorldInverse),m.setFromNormalAndCoplanarPoint(M,v),m.applyMatrix4(L.matrixWorldInverse),A.set(m.normal.x,m.normal.y,m.normal.z,m.constant);const ne=L.projectionMatrix;w.x=(Math.sign(A.x)+ne.elements[8])/ne.elements[0],w.y=(Math.sign(A.y)+ne.elements[9])/ne.elements[5],w.z=-1,w.w=(1+ne.elements[10])/ne.elements[14],A.multiplyScalar(2/A.dot(w)),ne.elements[2]=A.x,ne.elements[6]=A.y,ne.elements[10]=A.z+1-i,ne.elements[14]=A.w,p.setFromMatrixPosition(q.matrixWorld);const te=W.getRenderTarget(),ce=W.xr.enabled,le=W.shadowMap.autoUpdate;n.visible=!1,W.xr.enabled=!1,W.shadowMap.autoUpdate=!1,W.setRenderTarget(V),W.state.buffers.depth.setMask(!0),W.autoClear===!1&&W.clear(),W.render($,L),n.visible=!0,W.xr.enabled=ce,W.shadowMap.autoUpdate=le,W.setRenderTarget(te);const me=q.viewport;me!==void 0&&W.state.viewport(me)}}}var Qo=Object.defineProperty,Jo=(o,e,t)=>e in o?Qo(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,dr=(o,e,t)=>(Jo(o,typeof e!="symbol"?e+"":e,t),t);const Mn={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new l.Vector3},up:{value:new l.Vector3(0,1,0)}},vertexShader:`
|
|
168
168
|
uniform vec3 sunPosition;
|
|
169
169
|
uniform float rayleigh;
|
|
170
170
|
uniform float turbidity;
|
|
@@ -321,7 +321,7 @@
|
|
|
321
321
|
#include <${Qt>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
322
322
|
|
|
323
323
|
}
|
|
324
|
-
`},pr=new l.ShaderMaterial({name:"SkyShader",fragmentShader:Mn.fragmentShader,vertexShader:Mn.vertexShader,uniforms:l.UniformsUtils.clone(Mn.uniforms),side:l.BackSide,depthWrite:!1});class ss extends l.Mesh{constructor(){super(new l.BoxGeometry(1,1,1),pr)}}dr(ss,"SkyShader",Mn),dr(ss,"material",pr);const Fe=new l.Triangle,Sn=new l.Vector3;class Ho{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 i=1;t&&(i=t.getX(r)+t.getX(r+1)+t.getX(r+2)),Fe.a.fromBufferAttribute(e,r),Fe.b.fromBufferAttribute(e,r+1),Fe.c.fromBufferAttribute(e,r+2),i*=Fe.getArea(),n[r/3]=i}this.distribution=new Float32Array(e.count/3);let s=0;for(let r=0;r<n.length;r++)s+=n[r],this.distribution[r]=s;return this}setRandomGenerator(e){return this.randomFunction=e,this}sample(e,t,n){const s=this.sampleFaceIndex();return this.sampleFace(s,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,s=t.length-1,r=-1;for(;n<=s;){const i=Math.ceil((n+s)/2);if(i===0||t[i-1]<=e&&t[i]>e){r=i;break}else e<t[i]?s=i-1:n=i+1}return r}sampleFace(e,t,n,s){let r=this.randomFunction(),i=this.randomFunction();return r+i>1&&(r=1-r,i=1-i),Fe.a.fromBufferAttribute(this.positionAttribute,e*3),Fe.b.fromBufferAttribute(this.positionAttribute,e*3+1),Fe.c.fromBufferAttribute(this.positionAttribute,e*3+2),t.set(0,0,0).addScaledVector(Fe.a,r).addScaledVector(Fe.b,i).addScaledVector(Fe.c,1-(r+i)),n!==void 0&&Fe.getNormal(n),s!==void 0&&this.colorAttribute!==void 0&&(Fe.a.fromBufferAttribute(this.colorAttribute,e*3),Fe.b.fromBufferAttribute(this.colorAttribute,e*3+1),Fe.c.fromBufferAttribute(this.colorAttribute,e*3+2),Sn.set(0,0,0).addScaledVector(Fe.a,r).addScaledVector(Fe.b,i).addScaledVector(Fe.c,1-(r+i)),s.r=Sn.x,s.g=Sn.y,s.b=Sn.z),this}}var $o=Object.defineProperty,ea=(o,e,t)=>e in o?$o(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Q=(o,e,t)=>(ea(o,typeof e!="symbol"?e+"":e,t),t);class ta extends l.Object3D{constructor(e,t){super(),Q(this,"isTransformControls",!0),Q(this,"visible",!1),Q(this,"domElement"),Q(this,"raycaster",new l.Raycaster),Q(this,"gizmo"),Q(this,"plane"),Q(this,"tempVector",new l.Vector3),Q(this,"tempVector2",new l.Vector3),Q(this,"tempQuaternion",new l.Quaternion),Q(this,"unit",{X:new l.Vector3(1,0,0),Y:new l.Vector3(0,1,0),Z:new l.Vector3(0,0,1)}),Q(this,"pointStart",new l.Vector3),Q(this,"pointEnd",new l.Vector3),Q(this,"offset",new l.Vector3),Q(this,"rotationAxis",new l.Vector3),Q(this,"startNorm",new l.Vector3),Q(this,"endNorm",new l.Vector3),Q(this,"rotationAngle",0),Q(this,"cameraPosition",new l.Vector3),Q(this,"cameraQuaternion",new l.Quaternion),Q(this,"cameraScale",new l.Vector3),Q(this,"parentPosition",new l.Vector3),Q(this,"parentQuaternion",new l.Quaternion),Q(this,"parentQuaternionInv",new l.Quaternion),Q(this,"parentScale",new l.Vector3),Q(this,"worldPositionStart",new l.Vector3),Q(this,"worldQuaternionStart",new l.Quaternion),Q(this,"worldScaleStart",new l.Vector3),Q(this,"worldPosition",new l.Vector3),Q(this,"worldQuaternion",new l.Quaternion),Q(this,"worldQuaternionInv",new l.Quaternion),Q(this,"worldScale",new l.Vector3),Q(this,"eye",new l.Vector3),Q(this,"positionStart",new l.Vector3),Q(this,"quaternionStart",new l.Quaternion),Q(this,"scaleStart",new l.Vector3),Q(this,"camera"),Q(this,"object"),Q(this,"enabled",!0),Q(this,"axis",null),Q(this,"mode","translate"),Q(this,"translationSnap",null),Q(this,"rotationSnap",null),Q(this,"scaleSnap",null),Q(this,"space","world"),Q(this,"size",1),Q(this,"dragging",!1),Q(this,"showX",!0),Q(this,"showY",!0),Q(this,"showZ",!0),Q(this,"changeEvent",{type:"change"}),Q(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),Q(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),Q(this,"objectChangeEvent",{type:"objectChange"}),Q(this,"intersectObjectWithRay",(s,r,i)=>{const a=r.intersectObject(s,!0);for(let c=0;c<a.length;c++)if(a[c].object.visible||i)return a[c];return!1}),Q(this,"attach",s=>(this.object=s,this.visible=!0,this)),Q(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),Q(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),Q(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()}),Q(this,"pointerHover",s=>{if(this.object===void 0||this.dragging===!0)return;this.raycaster.setFromCamera(s,this.camera);const r=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);r?this.axis=r.object.name:this.axis=null}),Q(this,"pointerDown",s=>{if(!(this.object===void 0||this.dragging===!0||s.button!==0)&&this.axis!==null){this.raycaster.setFromCamera(s,this.camera);const r=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(r){let i=this.space;if(this.mode==="scale"?i="local":(this.axis==="E"||this.axis==="XYZE"||this.axis==="XYZ")&&(i="world"),i==="local"&&this.mode==="rotate"){const 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)}}),Q(this,"pointerMove",s=>{const r=this.axis,i=this.mode,a=this.object;let c=this.space;if(i==="scale"?c="local":(r==="E"||r==="XYZE"||r==="XYZ")&&(c="world"),a===void 0||r===null||this.dragging===!1||s.button!==-1)return;this.raycaster.setFromCamera(s,this.camera);const h=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(h){if(this.pointEnd.copy(h.point).sub(this.worldPositionStart),i==="translate")this.offset.copy(this.pointEnd).sub(this.pointStart),c==="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),c==="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&&(c==="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)),c==="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(i==="scale"){if(r.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),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(i==="rotate"){this.offset.copy(this.pointEnd).sub(this.pointStart);const d=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))*d):(r==="X"||r==="Y"||r==="Z")&&(this.rotationAxis.copy(this.unit[r]),this.tempVector.copy(this.unit[r]),c==="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),c==="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)}}),Q(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)}),Q(this,"getPointer",s=>{var r;if(this.domElement&&((r=this.domElement.ownerDocument)!=null&&r.pointerLockElement))return{x:0,y:0,button:s.button};{const i=s.changedTouches?s.changedTouches[0]:s,a=this.domElement.getBoundingClientRect();return{x:(i.clientX-a.left)/a.width*2-1,y:-(i.clientY-a.top)/a.height*2+1,button:s.button}}}),Q(this,"onPointerHover",s=>{if(this.enabled)switch(s.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(s));break}}),Q(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)))}),Q(this,"onPointerMove",s=>{this.enabled&&this.pointerMove(this.getPointer(s))}),Q(this,"onPointerUp",s=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(s)))}),Q(this,"getMode",()=>this.mode),Q(this,"setMode",s=>{this.mode=s}),Q(this,"setTranslationSnap",s=>{this.translationSnap=s}),Q(this,"setRotationSnap",s=>{this.rotationSnap=s}),Q(this,"setScaleSnap",s=>{this.scaleSnap=s}),Q(this,"setSize",s=>{this.size=s}),Q(this,"setSpace",s=>{this.space=s}),Q(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),Q(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)}),Q(this,"dispose",()=>{var s,r,i,a,c,h;(s=this.domElement)==null||s.removeEventListener("pointerdown",this.onPointerDown),(r=this.domElement)==null||r.removeEventListener("pointermove",this.onPointerHover),(a=(i=this.domElement)==null?void 0:i.ownerDocument)==null||a.removeEventListener("pointermove",this.onPointerMove),(h=(c=this.domElement)==null?void 0:c.ownerDocument)==null||h.removeEventListener("pointerup",this.onPointerUp),this.traverse(d=>{const f=d;f.geometry&&f.geometry.dispose(),f.material&&f.material.dispose()})}),this.domElement=t,this.camera=e,this.gizmo=new na,this.add(this.gizmo),this.plane=new sa,this.add(this.plane);const n=(s,r)=>{let i=r;Object.defineProperty(this,s,{get:function(){return i!==void 0?i:r},set:function(a){i!==a&&(i=a,this.plane[s]=a,this.gizmo[s]=a,this.dispatchEvent({type:s+"-changed",value:a}),this.dispatchEvent(this.changeEvent))}}),this[s]=r,this.plane[s]=r,this.gizmo[s]=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 na extends l.Object3D{constructor(){super(),Q(this,"isTransformControlsGizmo",!0),Q(this,"type","TransformControlsGizmo"),Q(this,"tempVector",new l.Vector3(0,0,0)),Q(this,"tempEuler",new l.Euler),Q(this,"alignVector",new l.Vector3(0,1,0)),Q(this,"zeroVector",new l.Vector3(0,0,0)),Q(this,"lookAtMatrix",new l.Matrix4),Q(this,"tempQuaternion",new l.Quaternion),Q(this,"tempQuaternion2",new l.Quaternion),Q(this,"identityQuaternion",new l.Quaternion),Q(this,"unitX",new l.Vector3(1,0,0)),Q(this,"unitY",new l.Vector3(0,1,0)),Q(this,"unitZ",new l.Vector3(0,0,1)),Q(this,"gizmo"),Q(this,"picker"),Q(this,"helper"),Q(this,"rotationAxis",new l.Vector3),Q(this,"cameraPosition",new l.Vector3),Q(this,"worldPositionStart",new l.Vector3),Q(this,"worldQuaternionStart",new l.Quaternion),Q(this,"worldPosition",new l.Vector3),Q(this,"worldQuaternion",new l.Quaternion),Q(this,"eye",new l.Vector3),Q(this,"camera",null),Q(this,"enabled",!0),Q(this,"axis",null),Q(this,"mode","translate"),Q(this,"space","world"),Q(this,"size",1),Q(this,"dragging",!1),Q(this,"showX",!0),Q(this,"showY",!0),Q(this,"showZ",!0),Q(this,"updateMatrixWorld",()=>{let te=this.space;this.mode==="scale"&&(te="local");const ce=te==="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 le=[];le=le.concat(this.picker[this.mode].children),le=le.concat(this.gizmo[this.mode].children),le=le.concat(this.helper[this.mode].children);for(let me=0;me<le.length;me++){const B=le[me];B.visible=!0,B.rotation.set(0,0,0),B.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),B.scale.set(1,1,1).multiplyScalar(z*this.size/7),B.tag==="helper"){B.visible=!1,B.name==="AXIS"?(B.position.copy(this.worldPositionStart),B.visible=!!this.axis,this.axis==="X"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),B.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))>.9&&(B.visible=!1)),this.axis==="Y"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),B.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))>.9&&(B.visible=!1)),this.axis==="Z"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),B.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))>.9&&(B.visible=!1)),this.axis==="XYZE"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),B.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),B.quaternion.multiply(this.tempQuaternion),B.visible=this.dragging),this.axis==="E"&&(B.visible=!1)):B.name==="START"?(B.position.copy(this.worldPositionStart),B.visible=this.dragging):B.name==="END"?(B.position.copy(this.worldPosition),B.visible=this.dragging):B.name==="DELTA"?(B.position.copy(this.worldPositionStart),B.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()),B.scale.copy(this.tempVector),B.visible=this.dragging):(B.quaternion.copy(ce),this.dragging?B.position.copy(this.worldPositionStart):B.position.copy(this.worldPosition),this.axis&&(B.visible=this.axis.search(B.name)!==-1));continue}B.quaternion.copy(ce),this.mode==="translate"||this.mode==="scale"?((B.name==="X"||B.name==="XYZX")&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))>.99&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),(B.name==="Y"||B.name==="XYZY")&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))>.99&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),(B.name==="Z"||B.name==="XYZZ")&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))>.99&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),B.name==="XY"&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))<.2&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),B.name==="YZ"&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))<.2&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),B.name==="XZ"&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))<.2&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),B.name.search("X")!==-1&&(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye)<0?B.tag==="fwd"?B.visible=!1:B.scale.x*=-1:B.tag==="bwd"&&(B.visible=!1)),B.name.search("Y")!==-1&&(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye)<0?B.tag==="fwd"?B.visible=!1:B.scale.y*=-1:B.tag==="bwd"&&(B.visible=!1)),B.name.search("Z")!==-1&&(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye)<0?B.tag==="fwd"?B.visible=!1:B.scale.z*=-1:B.tag==="bwd"&&(B.visible=!1))):this.mode==="rotate"&&(this.tempQuaternion2.copy(ce),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(ce).invert()),B.name.search("E")!==-1&&B.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),B.name==="X"&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),B.quaternion.copy(this.tempQuaternion)),B.name==="Y"&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),B.quaternion.copy(this.tempQuaternion)),B.name==="Z"&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),B.quaternion.copy(this.tempQuaternion))),B.visible=B.visible&&(B.name.indexOf("X")===-1||this.showX),B.visible=B.visible&&(B.name.indexOf("Y")===-1||this.showY),B.visible=B.visible&&(B.name.indexOf("Z")===-1||this.showZ),B.visible=B.visible&&(B.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),B.material.tempOpacity=B.material.tempOpacity||B.material.opacity,B.material.tempColor=B.material.tempColor||B.material.color.clone(),B.material.color.copy(B.material.tempColor),B.material.opacity=B.material.tempOpacity,this.enabled?this.axis&&(B.name===this.axis?(B.material.opacity=1,B.material.color.lerp(new l.Color(1,1,1),.5)):this.axis.split("").some(function(F){return B.name===F})?(B.material.opacity=1,B.material.color.lerp(new l.Color(1,1,1),.5)):(B.material.opacity*=.25,B.material.color.lerp(new l.Color(1,1,1),.5))):(B.material.opacity*=.5,B.material.color.lerp(new l.Color(1,1,1),.5))}super.updateMatrixWorld()});const e=new l.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:l.DoubleSide,fog:!1,toneMapped:!1}),t=new l.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),n=e.clone();n.opacity=.15;const s=e.clone();s.opacity=.33;const r=e.clone();r.color.set(16711680);const i=e.clone();i.color.set(65280);const a=e.clone();a.color.set(255);const c=e.clone();c.opacity=.25;const h=c.clone();h.color.set(16776960);const d=c.clone();d.color.set(65535);const f=c.clone();f.color.set(16711935),e.clone().color.set(16776960);const p=t.clone();p.color.set(16711680);const _=t.clone();_.color.set(65280);const g=t.clone();g.color.set(255);const x=t.clone();x.color.set(65535);const m=t.clone();m.color.set(16711935);const M=t.clone();M.color.set(16776960);const v=t.clone();v.color.set(7895160);const C=M.clone();C.opacity=.25;const O=new l.CylinderGeometry(0,.05,.2,12,1,!1),S=new l.BoxGeometry(.125,.125,.125),A=new l.BufferGeometry;A.setAttribute("position",new l.Float32BufferAttribute([0,0,0,1,0,0],3));const b=(te,ce)=>{const le=new l.BufferGeometry,me=[];for(let B=0;B<=64*ce;++B)me.push(0,Math.cos(B/32*Math.PI)*te,Math.sin(B/32*Math.PI)*te);return le.setAttribute("position",new l.Float32BufferAttribute(me,3)),le},P=()=>{const te=new l.BufferGeometry;return te.setAttribute("position",new l.Float32BufferAttribute([0,0,0,1,1,1],3)),te},w={X:[[new l.Mesh(O,r),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new l.Mesh(O,r),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new l.Line(A,p)]],Y:[[new l.Mesh(O,i),[0,1,0],null,null,"fwd"],[new l.Mesh(O,i),[0,1,0],[Math.PI,0,0],null,"bwd"],[new l.Line(A,_),null,[0,0,Math.PI/2]]],Z:[[new l.Mesh(O,a),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new l.Mesh(O,a),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new l.Line(A,g),null,[0,-Math.PI/2,0]]],XYZ:[[new l.Mesh(new l.OctahedronGeometry(.1,0),c.clone()),[0,0,0],[0,0,0]]],XY:[[new l.Mesh(new l.PlaneGeometry(.295,.295),h.clone()),[.15,.15,0]],[new l.Line(A,M),[.18,.3,0],null,[.125,1,1]],[new l.Line(A,M),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new l.Mesh(new l.PlaneGeometry(.295,.295),d.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new l.Line(A,x),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new l.Line(A,x),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new l.Mesh(new l.PlaneGeometry(.295,.295),f.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new l.Line(A,m),[.18,0,.3],null,[.125,1,1]],[new l.Line(A,m),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},D={X:[[new l.Mesh(new l.CylinderGeometry(.2,0,1,4,1,!1),n),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new l.Mesh(new l.CylinderGeometry(.2,0,1,4,1,!1),n),[0,.6,0]]],Z:[[new l.Mesh(new l.CylinderGeometry(.2,0,1,4,1,!1),n),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new l.Mesh(new l.OctahedronGeometry(.2,0),n)]],XY:[[new l.Mesh(new l.PlaneGeometry(.4,.4),n),[.2,.2,0]]],YZ:[[new l.Mesh(new l.PlaneGeometry(.4,.4),n),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new l.Mesh(new l.PlaneGeometry(.4,.4),n),[.2,0,.2],[-Math.PI/2,0,0]]]},L={START:[[new l.Mesh(new l.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new l.Mesh(new l.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new l.Line(P(),s),null,null,null,"helper"]],X:[[new l.Line(A,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new l.Line(A,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new l.Line(A,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},V={X:[[new l.Line(b(1,.5),p)],[new l.Mesh(new l.OctahedronGeometry(.04,0),r),[0,0,.99],null,[1,3,1]]],Y:[[new l.Line(b(1,.5),_),null,[0,0,-Math.PI/2]],[new l.Mesh(new l.OctahedronGeometry(.04,0),i),[0,0,.99],null,[3,1,1]]],Z:[[new l.Line(b(1,.5),g),null,[0,Math.PI/2,0]],[new l.Mesh(new l.OctahedronGeometry(.04,0),a),[.99,0,0],null,[1,3,1]]],E:[[new l.Line(b(1.25,1),C),null,[0,Math.PI/2,0]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),C),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),C),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),C),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),C),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new l.Line(b(1,1),v),null,[0,Math.PI/2,0]]]},R={AXIS:[[new l.Line(A,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},Y={X:[[new l.Mesh(new l.TorusGeometry(1,.1,4,24),n),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new l.Mesh(new l.TorusGeometry(1,.1,4,24),n),[0,0,0],[Math.PI/2,0,0]]],Z:[[new l.Mesh(new l.TorusGeometry(1,.1,4,24),n),[0,0,0],[0,0,-Math.PI/2]]],E:[[new l.Mesh(new l.TorusGeometry(1.25,.1,2,24),n)]],XYZE:[[new l.Mesh(new l.SphereGeometry(.7,10,8),n)]]},W={X:[[new l.Mesh(S,r),[.8,0,0],[0,0,-Math.PI/2]],[new l.Line(A,p),null,null,[.8,1,1]]],Y:[[new l.Mesh(S,i),[0,.8,0]],[new l.Line(A,_),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new l.Mesh(S,a),[0,0,.8],[Math.PI/2,0,0]],[new l.Line(A,g),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new l.Mesh(S,h),[.85,.85,0],null,[2,2,.2]],[new l.Line(A,M),[.855,.98,0],null,[.125,1,1]],[new l.Line(A,M),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new l.Mesh(S,d),[0,.85,.85],null,[.2,2,2]],[new l.Line(A,x),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new l.Line(A,x),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new l.Mesh(S,f),[.85,0,.85],null,[2,.2,2]],[new l.Line(A,m),[.855,0,.98],null,[.125,1,1]],[new l.Line(A,m),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new l.Mesh(new l.BoxGeometry(.125,.125,.125),c.clone()),[1.1,0,0]]],XYZY:[[new l.Mesh(new l.BoxGeometry(.125,.125,.125),c.clone()),[0,1.1,0]]],XYZZ:[[new l.Mesh(new l.BoxGeometry(.125,.125,.125),c.clone()),[0,0,1.1]]]},$={X:[[new l.Mesh(new l.CylinderGeometry(.2,0,.8,4,1,!1),n),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new l.Mesh(new l.CylinderGeometry(.2,0,.8,4,1,!1),n),[0,.5,0]]],Z:[[new l.Mesh(new l.CylinderGeometry(.2,0,.8,4,1,!1),n),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new l.Mesh(S,n),[.85,.85,0],null,[3,3,.2]]],YZ:[[new l.Mesh(S,n),[0,.85,.85],null,[.2,3,3]]],XZ:[[new l.Mesh(S,n),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new l.Mesh(new l.BoxGeometry(.2,.2,.2),n),[1.1,0,0]]],XYZY:[[new l.Mesh(new l.BoxGeometry(.2,.2,.2),n),[0,1.1,0]]],XYZZ:[[new l.Mesh(new l.BoxGeometry(.2,.2,.2),n),[0,0,1.1]]]},q={X:[[new l.Line(A,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new l.Line(A,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new l.Line(A,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},ne=te=>{const ce=new l.Object3D;for(let le in te)for(let me=te[le].length;me--;){const B=te[le][me][0].clone(),z=te[le][me][1],F=te[le][me][2],k=te[le][me][3],G=te[le][me][4];B.name=le,B.tag=G,z&&B.position.set(z[0],z[1],z[2]),F&&B.rotation.set(F[0],F[1],F[2]),k&&B.scale.set(k[0],k[1],k[2]),B.updateMatrix();const T=B.geometry.clone();T.applyMatrix4(B.matrix),B.geometry=T,B.renderOrder=1/0,B.position.set(0,0,0),B.rotation.set(0,0,0),B.scale.set(1,1,1),ce.add(B)}return ce};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=ne(w)),this.add(this.gizmo.rotate=ne(V)),this.add(this.gizmo.scale=ne(W)),this.add(this.picker.translate=ne(D)),this.add(this.picker.rotate=ne(Y)),this.add(this.picker.scale=ne($)),this.add(this.helper.translate=ne(L)),this.add(this.helper.rotate=ne(R)),this.add(this.helper.scale=ne(q)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class sa extends l.Mesh{constructor(){super(new l.PlaneGeometry(1e5,1e5,2,2),new l.MeshBasicMaterial({visible:!1,wireframe:!0,side:l.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),Q(this,"isTransformControlsPlane",!0),Q(this,"type","TransformControlsPlane"),Q(this,"unitX",new l.Vector3(1,0,0)),Q(this,"unitY",new l.Vector3(0,1,0)),Q(this,"unitZ",new l.Vector3(0,0,1)),Q(this,"tempVector",new l.Vector3),Q(this,"dirVector",new l.Vector3),Q(this,"alignVector",new l.Vector3),Q(this,"tempMatrix",new l.Matrix4),Q(this,"identityQuaternion",new l.Quaternion),Q(this,"cameraQuaternion",new l.Quaternion),Q(this,"worldPosition",new l.Vector3),Q(this,"worldQuaternion",new l.Quaternion),Q(this,"eye",new l.Vector3),Q(this,"axis",null),Q(this,"mode","translate"),Q(this,"space","world"),Q(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 ra=Object.defineProperty,ia=(o,e,t)=>e in o?ra(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Be=(o,e,t)=>(ia(o,typeof e!="symbol"?e+"":e,t),t);const zt=new l.Euler(0,0,0,"YXZ"),Vt=new l.Vector3,oa={type:"change"},aa={type:"lock"},la={type:"unlock"},mr=Math.PI/2;class gr extends l.EventDispatcher{constructor(e,t){super(),Be(this,"camera"),Be(this,"domElement"),Be(this,"isLocked"),Be(this,"minPolarAngle"),Be(this,"maxPolarAngle"),Be(this,"pointerSpeed"),Be(this,"onMouseMove",n=>{if(!this.domElement||this.isLocked===!1)return;const s=n.movementX||n.mozMovementX||n.webkitMovementX||0,r=n.movementY||n.mozMovementY||n.webkitMovementY||0;zt.setFromQuaternion(this.camera.quaternion),zt.y-=s*.002*this.pointerSpeed,zt.x-=r*.002*this.pointerSpeed,zt.x=Math.max(mr-this.maxPolarAngle,Math.min(mr-this.minPolarAngle,zt.x)),this.camera.quaternion.setFromEuler(zt),this.dispatchEvent(oa)}),Be(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(aa),this.isLocked=!0):(this.dispatchEvent(la),this.isLocked=!1))}),Be(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),Be(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))}),Be(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))}),Be(this,"dispose",()=>{this.disconnect()}),Be(this,"getObject",()=>this.camera),Be(this,"direction",new l.Vector3(0,0,-1)),Be(this,"getDirection",n=>n.copy(this.direction).applyQuaternion(this.camera.quaternion)),Be(this,"moveForward",n=>{Vt.setFromMatrixColumn(this.camera.matrix,0),Vt.crossVectors(this.camera.up,Vt),this.camera.position.addScaledVector(Vt,n)}),Be(this,"moveRight",n=>{Vt.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(Vt,n)}),Be(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),Be(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 ca=Object.defineProperty,ua=(o,e,t)=>e in o?ca(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,fe=(o,e,t)=>(ua(o,typeof e!="symbol"?e+"":e,t),t);const An=new l.Ray,yr=new l.Plane,ha=Math.cos(70*(Math.PI/180)),_r=(o,e)=>(o%e+e)%e;class xr extends l.EventDispatcher{constructor(e,t){super(),fe(this,"object"),fe(this,"domElement"),fe(this,"enabled",!0),fe(this,"target",new l.Vector3),fe(this,"minDistance",0),fe(this,"maxDistance",1/0),fe(this,"minZoom",0),fe(this,"maxZoom",1/0),fe(this,"minPolarAngle",0),fe(this,"maxPolarAngle",Math.PI),fe(this,"minAzimuthAngle",-1/0),fe(this,"maxAzimuthAngle",1/0),fe(this,"enableDamping",!1),fe(this,"dampingFactor",.05),fe(this,"enableZoom",!0),fe(this,"zoomSpeed",1),fe(this,"enableRotate",!0),fe(this,"rotateSpeed",1),fe(this,"enablePan",!0),fe(this,"panSpeed",1),fe(this,"screenSpacePanning",!0),fe(this,"keyPanSpeed",7),fe(this,"zoomToCursor",!1),fe(this,"autoRotate",!1),fe(this,"autoRotateSpeed",2),fe(this,"reverseOrbit",!1),fe(this,"reverseHorizontalOrbit",!1),fe(this,"reverseVerticalOrbit",!1),fe(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),fe(this,"mouseButtons",{LEFT:l.MOUSE.ROTATE,MIDDLE:l.MOUSE.DOLLY,RIGHT:l.MOUSE.PAN}),fe(this,"touches",{ONE:l.TOUCH.ROTATE,TWO:l.TOUCH.DOLLY_PAN}),fe(this,"target0"),fe(this,"position0"),fe(this,"zoom0"),fe(this,"_domElementKeyEvents",null),fe(this,"getPolarAngle"),fe(this,"getAzimuthalAngle"),fe(this,"setPolarAngle"),fe(this,"setAzimuthalAngle"),fe(this,"getDistance"),fe(this,"listenToKeyEvents"),fe(this,"stopListenToKeyEvents"),fe(this,"saveState"),fe(this,"reset"),fe(this,"update"),fe(this,"connect"),fe(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=K=>{let oe=_r(K,2*Math.PI),ge=d.phi;ge<0&&(ge+=2*Math.PI),oe<0&&(oe+=2*Math.PI);let Me=Math.abs(oe-ge);2*Math.PI-Me<Me&&(oe<ge?oe+=2*Math.PI:ge+=2*Math.PI),f.phi=oe-ge,n.update()},this.setAzimuthalAngle=K=>{let oe=_r(K,2*Math.PI),ge=d.theta;ge<0&&(ge+=2*Math.PI),oe<0&&(oe+=2*Math.PI);let Me=Math.abs(oe-ge);2*Math.PI-Me<Me&&(oe<ge?oe+=2*Math.PI:ge+=2*Math.PI),f.theta=oe-ge,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=K=>{K.addEventListener("keydown",Tt),this._domElementKeyEvents=K},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Tt),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(),c=a.NONE},this.update=(()=>{const K=new l.Vector3,oe=new l.Vector3(0,1,0),ge=new l.Quaternion().setFromUnitVectors(e.up,oe),Me=ge.clone().invert(),ke=new l.Vector3,pt=new l.Quaternion,Ot=2*Math.PI;return function(){const io=n.object.position;ge.setFromUnitVectors(e.up,oe),Me.copy(ge).invert(),K.copy(io).sub(n.target),K.applyQuaternion(ge),d.setFromVector3(K),n.autoRotate&&c===a.NONE&&R(L()),n.enableDamping?(d.theta+=f.theta*n.dampingFactor,d.phi+=f.phi*n.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let mt=n.minAzimuthAngle,gt=n.maxAzimuthAngle;isFinite(mt)&&isFinite(gt)&&(mt<-Math.PI?mt+=Ot:mt>Math.PI&&(mt-=Ot),gt<-Math.PI?gt+=Ot:gt>Math.PI&&(gt-=Ot),mt<=gt?d.theta=Math.max(mt,Math.min(gt,d.theta)):d.theta=d.theta>(mt+gt)/2?Math.max(mt,d.theta):Math.min(gt,d.theta)),d.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,d.phi)),d.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(p,n.dampingFactor):n.target.add(p),n.zoomToCursor&&P||n.object.isOrthographicCamera?d.radius=le(d.radius):d.radius=le(d.radius*y),K.setFromSpherical(d),K.applyQuaternion(Me),io.copy(n.target).add(K),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(f.theta*=1-n.dampingFactor,f.phi*=1-n.dampingFactor,p.multiplyScalar(1-n.dampingFactor)):(f.set(0,0,0),p.set(0,0,0));let _n=!1;if(n.zoomToCursor&&P){let xn=null;if(n.object instanceof l.PerspectiveCamera&&n.object.isPerspectiveCamera){const vn=K.length();xn=le(vn*y);const Xn=vn-xn;n.object.position.addScaledVector(A,Xn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const vn=new l.Vector3(b.x,b.y,0);vn.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/y)),n.object.updateProjectionMatrix(),_n=!0;const Xn=new l.Vector3(b.x,b.y,0);Xn.unproject(n.object),n.object.position.sub(Xn).add(vn),n.object.updateMatrixWorld(),xn=K.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;xn!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(xn).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))<ha?e.lookAt(n.target):(yr.setFromNormalAndCoplanarPoint(n.object.up,n.target),An.intersectPlane(yr,n.target))))}else n.object instanceof l.OrthographicCamera&&n.object.isOrthographicCamera&&(_n=y!==1,_n&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/y)),n.object.updateProjectionMatrix()));return y=1,P=!1,_n||ke.distanceToSquared(n.object.position)>h||8*(1-pt.dot(n.object.quaternion))>h?(n.dispatchEvent(s),ke.copy(n.object.position),pt.copy(n.object.quaternion),_n=!1,!0):!1}})(),this.connect=K=>{n.domElement=K,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",$e),n.domElement.addEventListener("pointerdown",he),n.domElement.addEventListener("pointercancel",Ie),n.domElement.addEventListener("wheel",dt)},this.dispose=()=>{var K,oe,ge,Me,ke,pt;n.domElement&&(n.domElement.style.touchAction="auto"),(K=n.domElement)==null||K.removeEventListener("contextmenu",$e),(oe=n.domElement)==null||oe.removeEventListener("pointerdown",he),(ge=n.domElement)==null||ge.removeEventListener("pointercancel",Ie),(Me=n.domElement)==null||Me.removeEventListener("wheel",dt),(ke=n.domElement)==null||ke.ownerDocument.removeEventListener("pointermove",_e),(pt=n.domElement)==null||pt.ownerDocument.removeEventListener("pointerup",Ie),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",Tt)};const n=this,s={type:"change"},r={type:"start"},i={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 c=a.NONE;const h=1e-6,d=new l.Spherical,f=new l.Spherical;let y=1;const p=new l.Vector3,_=new l.Vector2,g=new l.Vector2,x=new l.Vector2,m=new l.Vector2,M=new l.Vector2,v=new l.Vector2,C=new l.Vector2,O=new l.Vector2,S=new l.Vector2,A=new l.Vector3,b=new l.Vector2;let P=!1;const w=[],D={};function L(){return 2*Math.PI/60/60*n.autoRotateSpeed}function V(){return Math.pow(.95,n.zoomSpeed)}function R(K){n.reverseOrbit||n.reverseHorizontalOrbit?f.theta+=K:f.theta-=K}function Y(K){n.reverseOrbit||n.reverseVerticalOrbit?f.phi+=K:f.phi-=K}const W=(()=>{const K=new l.Vector3;return function(ge,Me){K.setFromMatrixColumn(Me,0),K.multiplyScalar(-ge),p.add(K)}})(),$=(()=>{const K=new l.Vector3;return function(ge,Me){n.screenSpacePanning===!0?K.setFromMatrixColumn(Me,1):(K.setFromMatrixColumn(Me,0),K.crossVectors(n.object.up,K)),K.multiplyScalar(ge),p.add(K)}})(),q=(()=>{const K=new l.Vector3;return function(ge,Me){const ke=n.domElement;if(ke&&n.object instanceof l.PerspectiveCamera&&n.object.isPerspectiveCamera){const pt=n.object.position;K.copy(pt).sub(n.target);let Ot=K.length();Ot*=Math.tan(n.object.fov/2*Math.PI/180),W(2*ge*Ot/ke.clientHeight,n.object.matrix),$(2*Me*Ot/ke.clientHeight,n.object.matrix)}else ke&&n.object instanceof l.OrthographicCamera&&n.object.isOrthographicCamera?(W(ge*(n.object.right-n.object.left)/n.object.zoom/ke.clientWidth,n.object.matrix),$(Me*(n.object.top-n.object.bottom)/n.object.zoom/ke.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ne(K){n.object instanceof l.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof l.OrthographicCamera&&n.object.isOrthographicCamera?y/=K:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function te(K){n.object instanceof l.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof l.OrthographicCamera&&n.object.isOrthographicCamera?y*=K:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ce(K){if(!n.zoomToCursor||!n.domElement)return;P=!0;const oe=n.domElement.getBoundingClientRect(),ge=K.clientX-oe.left,Me=K.clientY-oe.top,ke=oe.width,pt=oe.height;b.x=ge/ke*2-1,b.y=-(Me/pt)*2+1,A.set(b.x,b.y,1).unproject(n.object).sub(n.object.position).normalize()}function le(K){return Math.max(n.minDistance,Math.min(n.maxDistance,K))}function me(K){_.set(K.clientX,K.clientY)}function B(K){ce(K),C.set(K.clientX,K.clientY)}function z(K){m.set(K.clientX,K.clientY)}function F(K){g.set(K.clientX,K.clientY),x.subVectors(g,_).multiplyScalar(n.rotateSpeed);const oe=n.domElement;oe&&(R(2*Math.PI*x.x/oe.clientHeight),Y(2*Math.PI*x.y/oe.clientHeight)),_.copy(g),n.update()}function k(K){O.set(K.clientX,K.clientY),S.subVectors(O,C),S.y>0?ne(V()):S.y<0&&te(V()),C.copy(O),n.update()}function G(K){M.set(K.clientX,K.clientY),v.subVectors(M,m).multiplyScalar(n.panSpeed),q(v.x,v.y),m.copy(M),n.update()}function T(K){ce(K),K.deltaY<0?te(V()):K.deltaY>0&&ne(V()),n.update()}function I(K){let oe=!1;switch(K.code){case n.keys.UP:q(0,n.keyPanSpeed),oe=!0;break;case n.keys.BOTTOM:q(0,-n.keyPanSpeed),oe=!0;break;case n.keys.LEFT:q(n.keyPanSpeed,0),oe=!0;break;case n.keys.RIGHT:q(-n.keyPanSpeed,0),oe=!0;break}oe&&(K.preventDefault(),n.update())}function U(){if(w.length==1)_.set(w[0].pageX,w[0].pageY);else{const K=.5*(w[0].pageX+w[1].pageX),oe=.5*(w[0].pageY+w[1].pageY);_.set(K,oe)}}function Z(){if(w.length==1)m.set(w[0].pageX,w[0].pageY);else{const K=.5*(w[0].pageX+w[1].pageX),oe=.5*(w[0].pageY+w[1].pageY);m.set(K,oe)}}function j(){const K=w[0].pageX-w[1].pageX,oe=w[0].pageY-w[1].pageY,ge=Math.sqrt(K*K+oe*oe);C.set(0,ge)}function E(){n.enableZoom&&j(),n.enablePan&&Z()}function J(){n.enableZoom&&j(),n.enableRotate&&U()}function se(K){if(w.length==1)g.set(K.pageX,K.pageY);else{const ge=yn(K),Me=.5*(K.pageX+ge.x),ke=.5*(K.pageY+ge.y);g.set(Me,ke)}x.subVectors(g,_).multiplyScalar(n.rotateSpeed);const oe=n.domElement;oe&&(R(2*Math.PI*x.x/oe.clientHeight),Y(2*Math.PI*x.y/oe.clientHeight)),_.copy(g)}function ie(K){if(w.length==1)M.set(K.pageX,K.pageY);else{const oe=yn(K),ge=.5*(K.pageX+oe.x),Me=.5*(K.pageY+oe.y);M.set(ge,Me)}v.subVectors(M,m).multiplyScalar(n.panSpeed),q(v.x,v.y),m.copy(M)}function X(K){const oe=yn(K),ge=K.pageX-oe.x,Me=K.pageY-oe.y,ke=Math.sqrt(ge*ge+Me*Me);O.set(0,ke),S.set(0,Math.pow(O.y/C.y,n.zoomSpeed)),ne(S.y),C.copy(O)}function N(K){n.enableZoom&&X(K),n.enablePan&&ie(K)}function ae(K){n.enableZoom&&X(K),n.enableRotate&&se(K)}function he(K){var oe,ge;n.enabled!==!1&&(w.length===0&&((oe=n.domElement)==null||oe.ownerDocument.addEventListener("pointermove",_e),(ge=n.domElement)==null||ge.ownerDocument.addEventListener("pointerup",Ie)),En(K),K.pointerType==="touch"?It(K):Oe(K))}function _e(K){n.enabled!==!1&&(K.pointerType==="touch"?Ze(K):He(K))}function Ie(K){var oe,ge,Me;Yn(K),w.length===0&&((oe=n.domElement)==null||oe.releasePointerCapture(K.pointerId),(ge=n.domElement)==null||ge.ownerDocument.removeEventListener("pointermove",_e),(Me=n.domElement)==null||Me.ownerDocument.removeEventListener("pointerup",Ie)),n.dispatchEvent(i),c=a.NONE}function Oe(K){let oe;switch(K.button){case 0:oe=n.mouseButtons.LEFT;break;case 1:oe=n.mouseButtons.MIDDLE;break;case 2:oe=n.mouseButtons.RIGHT;break;default:oe=-1}switch(oe){case l.MOUSE.DOLLY:if(n.enableZoom===!1)return;B(K),c=a.DOLLY;break;case l.MOUSE.ROTATE:if(K.ctrlKey||K.metaKey||K.shiftKey){if(n.enablePan===!1)return;z(K),c=a.PAN}else{if(n.enableRotate===!1)return;me(K),c=a.ROTATE}break;case l.MOUSE.PAN:if(K.ctrlKey||K.metaKey||K.shiftKey){if(n.enableRotate===!1)return;me(K),c=a.ROTATE}else{if(n.enablePan===!1)return;z(K),c=a.PAN}break;default:c=a.NONE}c!==a.NONE&&n.dispatchEvent(r)}function He(K){if(n.enabled!==!1)switch(c){case a.ROTATE:if(n.enableRotate===!1)return;F(K);break;case a.DOLLY:if(n.enableZoom===!1)return;k(K);break;case a.PAN:if(n.enablePan===!1)return;G(K);break}}function dt(K){n.enabled===!1||n.enableZoom===!1||c!==a.NONE&&c!==a.ROTATE||(K.preventDefault(),n.dispatchEvent(r),T(K),n.dispatchEvent(i))}function Tt(K){n.enabled===!1||n.enablePan===!1||I(K)}function It(K){switch(Wn(K),w.length){case 1:switch(n.touches.ONE){case l.TOUCH.ROTATE:if(n.enableRotate===!1)return;U(),c=a.TOUCH_ROTATE;break;case l.TOUCH.PAN:if(n.enablePan===!1)return;Z(),c=a.TOUCH_PAN;break;default:c=a.NONE}break;case 2:switch(n.touches.TWO){case l.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;E(),c=a.TOUCH_DOLLY_PAN;break;case l.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;J(),c=a.TOUCH_DOLLY_ROTATE;break;default:c=a.NONE}break;default:c=a.NONE}c!==a.NONE&&n.dispatchEvent(r)}function Ze(K){switch(Wn(K),c){case a.TOUCH_ROTATE:if(n.enableRotate===!1)return;se(K),n.update();break;case a.TOUCH_PAN:if(n.enablePan===!1)return;ie(K),n.update();break;case a.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;N(K),n.update();break;case a.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ae(K),n.update();break;default:c=a.NONE}}function $e(K){n.enabled!==!1&&K.preventDefault()}function En(K){w.push(K)}function Yn(K){delete D[K.pointerId];for(let oe=0;oe<w.length;oe++)if(w[oe].pointerId==K.pointerId){w.splice(oe,1);return}}function Wn(K){let oe=D[K.pointerId];oe===void 0&&(oe=new l.Vector2,D[K.pointerId]=oe),oe.set(K.pageX,K.pageY)}function yn(K){const oe=K.pointerId===w[0].pointerId?w[1]:w[0];return D[oe.pointerId]}t!==void 0&&this.connect(t),this.update()}}class fa extends xr{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=l.MOUSE.PAN,this.mouseButtons.RIGHT=l.MOUSE.ROTATE,this.touches.ONE=l.TOUCH.PAN,this.touches.TWO=l.TOUCH.DOLLY_ROTATE}}function Rt(o){if(typeof TextDecoder<"u")return new TextDecoder().decode(o);let e="";for(let t=0,n=o.length;t<n;t++)e+=String.fromCharCode(o[t]);try{return decodeURIComponent(escape(e))}catch{return e}}const Dt="srgb",ct="srgb-linear",vr=3001,da=3e3;class pa extends l.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new xa(t)}),this.register(function(t){return new va(t)}),this.register(function(t){return new Ia(t)}),this.register(function(t){return new Oa(t)}),this.register(function(t){return new Da(t)}),this.register(function(t){return new ba(t)}),this.register(function(t){return new Ma(t)}),this.register(function(t){return new Sa(t)}),this.register(function(t){return new Aa(t)}),this.register(function(t){return new _a(t)}),this.register(function(t){return new Ca(t)}),this.register(function(t){return new wa(t)}),this.register(function(t){return new Ta(t)}),this.register(function(t){return new Pa(t)}),this.register(function(t){return new ga(t)}),this.register(function(t){return new La(t)}),this.register(function(t){return new Ba(t)})}load(e,t,n,s){const r=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const h=l.LoaderUtils.extractUrlBase(e);i=l.LoaderUtils.resolveURL(h,this.path)}else i=l.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(h){s?s(h):console.error(h),r.manager.itemError(e),r.manager.itemEnd(e)},c=new l.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(h){try{r.parse(h,i,function(d){t(d),r.manager.itemEnd(e)},a)}catch(d){a(d)}},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,s){let r;const i={},a={};if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(Rt(new Uint8Array(e.slice(0,4)))===wr){try{i[xe.KHR_BINARY_GLTF]=new ka(e)}catch(d){s&&s(d);return}r=JSON.parse(i[xe.KHR_BINARY_GLTF].content)}else r=JSON.parse(Rt(new Uint8Array(e)));else r=e;if(r.asset===void 0||r.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Za(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const d=this.pluginCallbacks[h](c);d.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[d.name]=d,i[d.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){const d=r.extensionsUsed[h],f=r.extensionsRequired||[];switch(d){case xe.KHR_MATERIALS_UNLIT:i[d]=new ya;break;case xe.KHR_DRACO_MESH_COMPRESSION:i[d]=new Fa(r,this.dracoLoader);break;case xe.KHR_TEXTURE_TRANSFORM:i[d]=new Ua;break;case xe.KHR_MESH_QUANTIZATION:i[d]=new Na;break;default:f.indexOf(d)>=0&&a[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}c.setExtensions(i),c.setPlugins(a),c.parse(n,s)}parseAsync(e,t){const n=this;return new Promise(function(s,r){n.parse(e,t,s,r)})}}function ma(){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_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ga{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,s=t.length;n<s;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 s=t.cache.get(n);if(s)return s;const r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let h;const d=new l.Color(16777215);c.color!==void 0&&d.setRGB(c.color[0],c.color[1],c.color[2],ct);const f=c.range!==void 0?c.range:0;switch(c.type){case"directional":h=new l.DirectionalLight(d),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new l.PointLight(d),h.distance=f;break;case"spot":h=new l.SpotLight(d),h.distance=f,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,h.angle=c.spot.outerConeAngle,h.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return h.position.set(0,0,0),h.decay=2,ut(h,c),c.intensity!==void 0&&(h.intensity=c.intensity),h.name=t.createUniqueName(c.name||"light_"+e),s=Promise.resolve(h),t.cache.add(n,s),s}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(c){return n._getNodeRef(t.cache,a,c)})}}class ya{constructor(){this.name=xe.KHR_MATERIALS_UNLIT}getMaterialType(){return l.MeshBasicMaterial}extendParams(e,t,n){const s=[];e.color=new l.Color(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const i=r.baseColorFactor;e.color.setRGB(i[0],i[1],i[2],ct),e.opacity=i[3]}r.baseColorTexture!==void 0&&s.push(n.assignTexture(e,"map",r.baseColorTexture,Dt))}return Promise.all(s)}}class _a{constructor(e){this.parser=e,this.name=xe.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 r=s.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class xa{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];if(i.clearcoatFactor!==void 0&&(t.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(r.push(n.assignTexture(t,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){const a=i.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new l.Vector2(a,a)}return Promise.all(r)}}class va{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class wa{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];return i.iridescenceFactor!==void 0&&(t.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(t.iridescenceIOR=i.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(r)}}class ba{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new l.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const i=s.extensions[this.name];if(i.sheenColorFactor!==void 0){const a=i.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],ct)}return i.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",i.sheenColorTexture,Dt)),i.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(r)}}class Ma{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];return i.transmissionFactor!==void 0&&(t.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&r.push(n.assignTexture(t,"transmissionMap",i.transmissionTexture)),Promise.all(r)}}class Sa{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];t.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&r.push(n.assignTexture(t,"thicknessMap",i.thicknessTexture)),t.attenuationDistance=i.attenuationDistance||1/0;const a=i.attenuationColor||[1,1,1];return t.attenuationColor=new l.Color().setRGB(a[0],a[1],a[2],ct),Promise.all(r)}}class Aa{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class Ca{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];t.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&r.push(n.assignTexture(t,"specularIntensityMap",i.specularTexture));const a=i.specularColorFactor||[1,1,1];return t.specularColor=new l.Color().setRGB(a[0],a[1],a[2],ct),i.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",i.specularColorTexture,Dt)),Promise.all(r)}}class Pa{constructor(e){this.parser=e,this.name=xe.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];return t.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&r.push(n.assignTexture(t,"bumpMap",i.bumpTexture)),Promise.all(r)}}class Ta{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];return i.anisotropyStrength!==void 0&&(t.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(t.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&r.push(n.assignTexture(t,"anisotropyMap",i.anisotropyTexture)),Promise.all(r)}}class Ia{constructor(e){this.parser=e,this.name=xe.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 r=s.extensions[this.name],i=t.options.ktx2Loader;if(!i){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,i)}}class Oa{constructor(e){this.parser=e,this.name=xe.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const i=r.extensions[t],a=s.images[i.source];let c=n.textureLoader;if(a.uri){const h=n.options.manager.getHandler(a.uri);h!==null&&(c=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,i.source,c);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 Da{constructor(e){this.parser=e,this.name=xe.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const i=r.extensions[t],a=s.images[i.source];let c=n.textureLoader;if(a.uri){const h=n.options.manager.getHandler(a.uri);h!==null&&(c=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,i.source,c);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 La{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 s=n.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const c=s.byteOffset||0,h=s.byteLength||0,d=s.count,f=s.byteStride,y=new Uint8Array(a,c,h);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(d,f,y,s.mode,s.filter).then(function(p){return p.buffer}):i.ready.then(function(){const p=new ArrayBuffer(d*f);return i.decodeGltfBuffer(new Uint8Array(p),d,f,y,s.mode,s.filter),p})})}else return null}}class Ba{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 s=t.meshes[n.mesh];for(const h of s.primitives)if(h.mode!==qe.TRIANGLES&&h.mode!==qe.TRIANGLE_STRIP&&h.mode!==qe.TRIANGLE_FAN&&h.mode!==void 0)return null;const i=n.extensions[this.name].attributes,a=[],c={};for(const h in i)a.push(this.parser.getDependency("accessor",i[h]).then(d=>(c[h]=d,c[h])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(h=>{const d=h.pop(),f=d.isGroup?d.children:[d],y=h[0].count,p=[];for(const _ of f){const g=new l.Matrix4,x=new l.Vector3,m=new l.Quaternion,M=new l.Vector3(1,1,1),v=new l.InstancedMesh(_.geometry,_.material,y);for(let C=0;C<y;C++)c.TRANSLATION&&x.fromBufferAttribute(c.TRANSLATION,C),c.ROTATION&&m.fromBufferAttribute(c.ROTATION,C),c.SCALE&&M.fromBufferAttribute(c.SCALE,C),v.setMatrixAt(C,g.compose(x,m,M));for(const C in c)if(C==="_COLOR_0"){const O=c[C];v.instanceColor=new l.InstancedBufferAttribute(O.array,O.itemSize,O.normalized)}else C!=="TRANSLATION"&&C!=="ROTATION"&&C!=="SCALE"&&_.geometry.setAttribute(C,c[C]);l.Object3D.prototype.copy.call(v,_),this.parser.assignFinalMaterial(v),p.push(v)}return d.isGroup?(d.clear(),d.add(...p),d):p[0]}))}}const wr="glTF",en=12,br={JSON:1313821514,BIN:5130562};class ka{constructor(e){this.name=xe.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,en);if(this.header={magic:Rt(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==wr)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-en,s=new DataView(e,en);let r=0;for(;r<n;){const i=s.getUint32(r,!0);r+=4;const a=s.getUint32(r,!0);if(r+=4,a===br.JSON){const c=new Uint8Array(e,en+r,i);this.content=Rt(c)}else if(a===br.BIN){const c=en+r;this.body=e.slice(c,c+i)}r+=i}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Fa{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,s=this.dracoLoader,r=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,a={},c={},h={};for(const d in i){const f=is[d]||d.toLowerCase();a[f]=i[d]}for(const d in e.attributes){const f=is[d]||d.toLowerCase();if(i[d]!==void 0){const y=n.accessors[e.attributes[d]],p=Gt[y.componentType];h[f]=p.name,c[f]=y.normalized===!0}}return t.getDependency("bufferView",r).then(function(d){return new Promise(function(f,y){s.decodeDracoFile(d,function(p){for(const _ in p.attributes){const g=p.attributes[_],x=c[_];x!==void 0&&(g.normalized=x)}f(p)},a,h,ct,y)})})}}class Ua{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 Na{constructor(){this.name=xe.KHR_MESH_QUANTIZATION}}class Mr extends l.Interpolant{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s*3+s;for(let i=0;i!==s;i++)t[i]=n[r+i];return t}interpolate_(e,t,n,s){const r=this.resultBuffer,i=this.sampleValues,a=this.valueSize,c=a*2,h=a*3,d=s-t,f=(n-t)/d,y=f*f,p=y*f,_=e*h,g=_-h,x=-2*p+3*y,m=p-y,M=1-x,v=m-y+f;for(let C=0;C!==a;C++){const O=i[g+C+a],S=i[g+C+c]*d,A=i[_+C+a],b=i[_+C]*d;r[C]=M*O+v*S+x*A+m*b}return r}}const za=new l.Quaternion;class Va extends Mr{interpolate_(e,t,n,s){const r=super.interpolate_(e,t,n,s);return za.fromArray(r).normalize().toArray(r),r}}const qe={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},Gt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Sr={9728:l.NearestFilter,9729:l.LinearFilter,9984:l.NearestMipmapNearestFilter,9985:l.LinearMipmapNearestFilter,9986:l.NearestMipmapLinearFilter,9987:l.LinearMipmapLinearFilter},Ar={33071:l.ClampToEdgeWrapping,33648:l.MirroredRepeatWrapping,10497:l.RepeatWrapping},rs={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},is={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...Qt>=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"},xt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ra={CUBICSPLINE:void 0,LINEAR:l.InterpolateLinear,STEP:l.InterpolateDiscrete},os={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ga(o){return o.DefaultMaterial===void 0&&(o.DefaultMaterial=new l.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:l.FrontSide})),o.DefaultMaterial}function Lt(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 ut(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 ja(o,e,t){let n=!1,s=!1,r=!1;for(let h=0,d=e.length;h<d;h++){const f=e[h];if(f.POSITION!==void 0&&(n=!0),f.NORMAL!==void 0&&(s=!0),f.COLOR_0!==void 0&&(r=!0),n&&s&&r)break}if(!n&&!s&&!r)return Promise.resolve(o);const i=[],a=[],c=[];for(let h=0,d=e.length;h<d;h++){const f=e[h];if(n){const y=f.POSITION!==void 0?t.getDependency("accessor",f.POSITION):o.attributes.position;i.push(y)}if(s){const y=f.NORMAL!==void 0?t.getDependency("accessor",f.NORMAL):o.attributes.normal;a.push(y)}if(r){const y=f.COLOR_0!==void 0?t.getDependency("accessor",f.COLOR_0):o.attributes.color;c.push(y)}}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(c)]).then(function(h){const d=h[0],f=h[1],y=h[2];return n&&(o.morphAttributes.position=d),s&&(o.morphAttributes.normal=f),r&&(o.morphAttributes.color=y),o.morphTargetsRelative=!0,o})}function Ea(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,s=t.length;n<s;n++)o.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Ya(o){let e;const t=o.extensions&&o.extensions[xe.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+as(t.attributes):e=o.indices+":"+as(o.attributes)+":"+o.mode,o.targets!==void 0)for(let n=0,s=o.targets.length;n<s;n++)e+=":"+as(o.targets[n]);return e}function as(o){let e="";const t=Object.keys(o).sort();for(let n=0,s=t.length;n<s;n++)e+=t[n]+":"+o[t[n]]+";";return e}function ls(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 Wa(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 Xa=new l.Matrix4;class Za{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ma,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,r=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,r=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||s&&r<98?this.textureLoader=new l.TextureLoader(this.options.manager):this.textureLoader=new l.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new l.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,s=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(i){const a={scene:i[0][s.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:s.asset,parser:n,userData:{}};return Lt(r,a,s),ut(a,s),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(a)})).then(function(){for(const c of a.scenes)c.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const i=t[s].joints;for(let a=0,c=i.length;a<c;a++)e[i[a]].isBone=!0}for(let s=0,r=e.length;s<r;s++){const i=e[s];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(n[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const s=n.clone(),r=(i,a)=>{const c=this.associations.get(i);c!=null&&this.associations.set(a,c);for(const[h,d]of i.children.entries())r(d,a.children[h])};return r(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 r=e(t[s]);r&&n.push(r)}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(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":s=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.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(r,i){return n.getDependency(e,i)})),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 s=this.options;return new Promise(function(r,i){n.load(l.LoaderUtils.resolveURL(t.uri,s.path),r,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const s=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+s)})}loadAccessor(e){const t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){const i=rs[s.type],a=Gt[s.componentType],c=s.normalized===!0,h=new a(s.count*i);return Promise.resolve(new l.BufferAttribute(h,i,c))}const r=[];return s.bufferView!==void 0?r.push(this.getDependency("bufferView",s.bufferView)):r.push(null),s.sparse!==void 0&&(r.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(r).then(function(i){const a=i[0],c=rs[s.type],h=Gt[s.componentType],d=h.BYTES_PER_ELEMENT,f=d*c,y=s.byteOffset||0,p=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,_=s.normalized===!0;let g,x;if(p&&p!==f){const m=Math.floor(y/p),M="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+m+":"+s.count;let v=t.cache.get(M);v||(g=new h(a,m*p,s.count*p/d),v=new l.InterleavedBuffer(g,p/d),t.cache.add(M,v)),x=new l.InterleavedBufferAttribute(v,c,y%p/d,_)}else a===null?g=new h(s.count*c):g=new h(a,y,s.count*c),x=new l.BufferAttribute(g,c,_);if(s.sparse!==void 0){const m=rs.SCALAR,M=Gt[s.sparse.indices.componentType],v=s.sparse.indices.byteOffset||0,C=s.sparse.values.byteOffset||0,O=new M(i[1],v,s.sparse.count*m),S=new h(i[2],C,s.sparse.count*c);a!==null&&(x=new l.BufferAttribute(x.array.slice(),x.itemSize,x.normalized));for(let A=0,b=O.length;A<b;A++){const P=O[A];if(x.setX(P,S[A*c]),c>=2&&x.setY(P,S[A*c+1]),c>=3&&x.setZ(P,S[A*c+2]),c>=4&&x.setW(P,S[A*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(e){const t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r];let a=this.textureLoader;if(i.uri){const c=n.manager.getHandler(i.uri);c!==null&&(a=c)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){const s=this,r=this.json,i=r.textures[e],a=r.images[t],c=(a.uri||a.bufferView)+":"+i.sampler;if(this.textureCache[c])return this.textureCache[c];const h=this.loadImageSource(t,n).then(function(d){d.flipY=!1,d.name=i.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const y=(r.samplers||{})[i.sampler]||{};return d.magFilter=Sr[y.magFilter]||l.LinearFilter,d.minFilter=Sr[y.minFilter]||l.LinearMipmapLinearFilter,d.wrapS=Ar[y.wrapS]||l.RepeatWrapping,d.wrapT=Ar[y.wrapT]||l.RepeatWrapping,s.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[c]=h,h}loadImageSource(e,t){const n=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const i=s.images[e],a=self.URL||self.webkitURL;let c=i.uri||"",h=!1;if(i.bufferView!==void 0)c=n.getDependency("bufferView",i.bufferView).then(function(f){h=!0;const y=new Blob([f],{type:i.mimeType});return c=a.createObjectURL(y),c});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(c).then(function(f){return new Promise(function(y,p){let _=y;t.isImageBitmapLoader===!0&&(_=function(g){const x=new l.Texture(g);x.needsUpdate=!0,y(x)}),t.load(l.LoaderUtils.resolveURL(f,r.path),_,void 0,p)})}).then(function(f){return h===!0&&a.revokeObjectURL(c),ut(f,i),f.userData.mimeType=i.mimeType||Wa(i.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),f});return this.sourceCache[e]=d,d}assignTexture(e,t,n,s){const r=this;return this.getDependency("texture",n.index).then(function(i){if(!i)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(i=i.clone(),i.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 c=r.associations.get(i);i=r.extensions[xe.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),r.associations.set(i,c)}}return s!==void 0&&(typeof s=="number"&&(s=s===vr?Dt:ct),"colorSpace"in i?i.colorSpace=s:i.encoding=s===Dt?vr:da),e[t]=i,i})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,i=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new l.PointsMaterial,l.Material.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(a,c)),n=c}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new l.LineBasicMaterial,l.Material.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(a,c)),n=c}if(s||r||i){let a="ClonedMaterial:"+n.uuid+":";s&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),i&&(a+="flat-shading:");let c=this.cache.get(a);c||(c=n.clone(),r&&(c.vertexColors=!0),i&&(c.flatShading=!0),s&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(a,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return l.MeshStandardMaterial}loadMaterial(e){const t=this,n=this.json,s=this.extensions,r=n.materials[e];let i;const a={},c=r.extensions||{},h=[];if(c[xe.KHR_MATERIALS_UNLIT]){const f=s[xe.KHR_MATERIALS_UNLIT];i=f.getMaterialType(),h.push(f.extendParams(a,r,t))}else{const f=r.pbrMetallicRoughness||{};if(a.color=new l.Color(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const y=f.baseColorFactor;a.color.setRGB(y[0],y[1],y[2],ct),a.opacity=y[3]}f.baseColorTexture!==void 0&&h.push(t.assignTexture(a,"map",f.baseColorTexture,Dt)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),h.push(t.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),i=this._invokeOne(function(y){return y.getMaterialType&&y.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(y){return y.extendMaterialParams&&y.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=l.DoubleSide);const d=r.alphaMode||os.OPAQUE;if(d===os.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===os.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&i!==l.MeshBasicMaterial&&(h.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new l.Vector2(1,1),r.normalTexture.scale!==void 0)){const f=r.normalTexture.scale;a.normalScale.set(f,f)}if(r.occlusionTexture!==void 0&&i!==l.MeshBasicMaterial&&(h.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&i!==l.MeshBasicMaterial){const f=r.emissiveFactor;a.emissive=new l.Color().setRGB(f[0],f[1],f[2],ct)}return r.emissiveTexture!==void 0&&i!==l.MeshBasicMaterial&&h.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,Dt)),Promise.all(h).then(function(){const f=new i(a);return r.name&&(f.name=r.name),ut(f,r),t.associations.set(f,{materials:e}),r.extensions&&Lt(s,f,r),f})}createUniqueName(e){const t=l.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,s=this.primitiveCache;function r(a){return n[xe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(c){return Cr(c,a,t)})}const i=[];for(let a=0,c=e.length;a<c;a++){const h=e[a],d=Ya(h),f=s[d];if(f)i.push(f.promise);else{let y;h.extensions&&h.extensions[xe.KHR_DRACO_MESH_COMPRESSION]?y=r(h):y=Cr(new l.BufferGeometry,h,t),s[d]={primitive:h,promise:y},i.push(y)}}return Promise.all(i)}loadMesh(e){const t=this,n=this.json,s=this.extensions,r=n.meshes[e],i=r.primitives,a=[];for(let c=0,h=i.length;c<h;c++){const d=i[c].material===void 0?Ga(this.cache):this.getDependency("material",i[c].material);a.push(d)}return a.push(t.loadGeometries(i)),Promise.all(a).then(function(c){const h=c.slice(0,c.length-1),d=c[c.length-1],f=[];for(let p=0,_=d.length;p<_;p++){const g=d[p],x=i[p];let m;const M=h[p];if(x.mode===qe.TRIANGLES||x.mode===qe.TRIANGLE_STRIP||x.mode===qe.TRIANGLE_FAN||x.mode===void 0)m=r.isSkinnedMesh===!0?new l.SkinnedMesh(g,M):new l.Mesh(g,M),m.isSkinnedMesh===!0&&m.normalizeSkinWeights(),x.mode===qe.TRIANGLE_STRIP?m.geometry=Js(m.geometry,l.TriangleStripDrawMode):x.mode===qe.TRIANGLE_FAN&&(m.geometry=Js(m.geometry,l.TriangleFanDrawMode));else if(x.mode===qe.LINES)m=new l.LineSegments(g,M);else if(x.mode===qe.LINE_STRIP)m=new l.Line(g,M);else if(x.mode===qe.LINE_LOOP)m=new l.LineLoop(g,M);else if(x.mode===qe.POINTS)m=new l.Points(g,M);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(m.geometry.morphAttributes).length>0&&Ea(m,r),m.name=t.createUniqueName(r.name||"mesh_"+e),ut(m,r),x.extensions&&Lt(s,m,x),t.assignFinalMaterial(m),f.push(m)}for(let p=0,_=f.length;p<_;p++)t.associations.set(f[p],{meshes:e,primitives:p});if(f.length===1)return r.extensions&&Lt(s,f[0],r),f[0];const y=new l.Group;r.extensions&&Lt(s,y,r),t.associations.set(y,{meshes:e});for(let p=0,_=f.length;p<_;p++)y.add(f[p]);return y})}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 l.PerspectiveCamera(l.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new l.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),ut(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let s=0,r=t.joints.length;s<r;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 r=s.pop(),i=s,a=[],c=[];for(let h=0,d=i.length;h<d;h++){const f=i[h];if(f){a.push(f);const y=new l.Matrix4;r!==null&&y.fromArray(r.array,h*16),c.push(y)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[h])}return new l.Skeleton(a,c)})}loadAnimation(e){const t=this.json,n=this,s=t.animations[e],r=s.name?s.name:"animation_"+e,i=[],a=[],c=[],h=[],d=[];for(let f=0,y=s.channels.length;f<y;f++){const p=s.channels[f],_=s.samplers[p.sampler],g=p.target,x=g.node,m=s.parameters!==void 0?s.parameters[_.input]:_.input,M=s.parameters!==void 0?s.parameters[_.output]:_.output;g.node!==void 0&&(i.push(this.getDependency("node",x)),a.push(this.getDependency("accessor",m)),c.push(this.getDependency("accessor",M)),h.push(_),d.push(g))}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(c),Promise.all(h),Promise.all(d)]).then(function(f){const y=f[0],p=f[1],_=f[2],g=f[3],x=f[4],m=[];for(let M=0,v=y.length;M<v;M++){const C=y[M],O=p[M],S=_[M],A=g[M],b=x[M];if(C===void 0)continue;C.updateMatrix&&C.updateMatrix();const P=n._createAnimationTracks(C,O,S,A,b);if(P)for(let w=0;w<P.length;w++)m.push(P[w])}return new l.AnimationClip(r,void 0,m)})}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(r){const i=n._getNodeRef(n.meshCache,s.mesh,r);return s.weights!==void 0&&i.traverse(function(a){if(a.isMesh)for(let c=0,h=s.weights.length;c<h;c++)a.morphTargetInfluences[c]=s.weights[c]}),i})}loadNode(e){const t=this.json,n=this,s=t.nodes[e],r=n._loadNodeShallow(e),i=[],a=s.children||[];for(let h=0,d=a.length;h<d;h++)i.push(n.getDependency("node",a[h]));const c=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([r,Promise.all(i),c]).then(function(h){const d=h[0],f=h[1],y=h[2];y!==null&&d.traverse(function(p){p.isSkinnedMesh&&p.bind(y,Xa)});for(let p=0,_=f.length;p<_;p++)d.add(f[p]);return d})}_loadNodeShallow(e){const t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],i=r.name?s.createUniqueName(r.name):"",a=[],c=s._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return c&&a.push(c),r.camera!==void 0&&a.push(s.getDependency("camera",r.camera).then(function(h){return s._getNodeRef(s.cameraCache,r.camera,h)})),s._invokeAll(function(h){return h.createNodeAttachment&&h.createNodeAttachment(e)}).forEach(function(h){a.push(h)}),this.nodeCache[e]=Promise.all(a).then(function(h){let d;if(r.isBone===!0?d=new l.Bone:h.length>1?d=new l.Group:h.length===1?d=h[0]:d=new l.Object3D,d!==h[0])for(let f=0,y=h.length;f<y;f++)d.add(h[f]);if(r.name&&(d.userData.name=r.name,d.name=i),ut(d,r),r.extensions&&Lt(n,d,r),r.matrix!==void 0){const f=new l.Matrix4;f.fromArray(r.matrix),d.applyMatrix4(f)}else r.translation!==void 0&&d.position.fromArray(r.translation),r.rotation!==void 0&&d.quaternion.fromArray(r.rotation),r.scale!==void 0&&d.scale.fromArray(r.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,r=new l.Group;n.name&&(r.name=s.createUniqueName(n.name)),ut(r,n),n.extensions&&Lt(t,r,n);const i=n.nodes||[],a=[];for(let c=0,h=i.length;c<h;c++)a.push(s.getDependency("node",i[c]));return Promise.all(a).then(function(c){for(let d=0,f=c.length;d<f;d++)r.add(c[d]);const h=d=>{const f=new Map;for(const[y,p]of s.associations)(y instanceof l.Material||y instanceof l.Texture)&&f.set(y,p);return d.traverse(y=>{const p=s.associations.get(y);p!=null&&f.set(y,p)}),f};return s.associations=h(r),r})}_createAnimationTracks(e,t,n,s,r){const i=[],a=e.name?e.name:e.uuid,c=[];xt[r.path]===xt.weights?e.traverse(function(y){y.morphTargetInfluences&&c.push(y.name?y.name:y.uuid)}):c.push(a);let h;switch(xt[r.path]){case xt.weights:h=l.NumberKeyframeTrack;break;case xt.rotation:h=l.QuaternionKeyframeTrack;break;case xt.position:case xt.scale:h=l.VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:h=l.NumberKeyframeTrack;break;case 2:case 3:default:h=l.VectorKeyframeTrack;break}break}const d=s.interpolation!==void 0?Ra[s.interpolation]:l.InterpolateLinear,f=this._getArrayFromAccessor(n);for(let y=0,p=c.length;y<p;y++){const _=new h(c[y]+"."+xt[r.path],t.array,f,d);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(_),i.push(_)}return i}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=ls(t.constructor),s=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)s[r]=t[r]*n;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const s=this instanceof l.QuaternionKeyframeTrack?Va:Mr;return new s(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ka(o,e,t){const n=e.attributes,s=new l.Box3;if(n.POSITION!==void 0){const a=t.json.accessors[n.POSITION],c=a.min,h=a.max;if(c!==void 0&&h!==void 0){if(s.set(new l.Vector3(c[0],c[1],c[2]),new l.Vector3(h[0],h[1],h[2])),a.normalized){const d=ls(Gt[a.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 r=e.targets;if(r!==void 0){const a=new l.Vector3,c=new l.Vector3;for(let h=0,d=r.length;h<d;h++){const f=r[h];if(f.POSITION!==void 0){const y=t.json.accessors[f.POSITION],p=y.min,_=y.max;if(p!==void 0&&_!==void 0){if(c.setX(Math.max(Math.abs(p[0]),Math.abs(_[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(_[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(_[2]))),y.normalized){const g=ls(Gt[y.componentType]);c.multiplyScalar(g)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(a)}o.boundingBox=s;const i=new l.Sphere;s.getCenter(i.center),i.radius=s.min.distanceTo(s.max)/2,o.boundingSphere=i}function Cr(o,e,t){const n=e.attributes,s=[];function r(i,a){return t.getDependency("accessor",i).then(function(c){o.setAttribute(a,c)})}for(const i in n){const a=is[i]||i.toLowerCase();a in o.attributes||s.push(r(n[i],a))}if(e.indices!==void 0&&!o.index){const i=t.getDependency("accessor",e.indices).then(function(a){o.setIndex(a)});s.push(i)}return ut(o,e),Ka(o,e,t),Promise.all(s).then(function(){return e.targets!==void 0?ja(o,e.targets,t):o})}const tn=new l.Vector3;function Qe(o,e,t,n,s,r){const i=2*Math.PI*s/4,a=Math.max(r-2*s,0),c=Math.PI/4;tn.copy(e),tn[n]=0,tn.normalize();const h=.5*i/(i+a),d=1-tn.angleTo(o)/c;return Math.sign(tn[t])===1?d*h:a/(i+a)+h+h*(1-d)}class qa extends l.BoxGeometry{constructor(e=1,t=1,n=1,s=2,r=.1){if(s=s*2+1,r=Math.min(e/2,t/2,n/2,r),super(1,1,1,s,s,s),s===1)return;const i=this.toNonIndexed();this.index=null,this.attributes.position=i.attributes.position,this.attributes.normal=i.attributes.normal,this.attributes.uv=i.attributes.uv;const a=new l.Vector3,c=new l.Vector3,h=new l.Vector3(e,t,n).divideScalar(2).subScalar(r),d=this.attributes.position.array,f=this.attributes.normal.array,y=this.attributes.uv.array,p=d.length/6,_=new l.Vector3,g=.5/s;for(let x=0,m=0;x<d.length;x+=3,m+=2)switch(a.fromArray(d,x),c.copy(a),c.x-=Math.sign(c.x)*g,c.y-=Math.sign(c.y)*g,c.z-=Math.sign(c.z)*g,c.normalize(),d[x+0]=h.x*Math.sign(a.x)+c.x*r,d[x+1]=h.y*Math.sign(a.y)+c.y*r,d[x+2]=h.z*Math.sign(a.z)+c.z*r,f[x+0]=c.x,f[x+1]=c.y,f[x+2]=c.z,Math.floor(x/p)){case 0:_.set(1,0,0),y[m+0]=Qe(_,c,"z","y",r,n),y[m+1]=1-Qe(_,c,"y","z",r,t);break;case 1:_.set(-1,0,0),y[m+0]=1-Qe(_,c,"z","y",r,n),y[m+1]=1-Qe(_,c,"y","z",r,t);break;case 2:_.set(0,1,0),y[m+0]=1-Qe(_,c,"x","z",r,e),y[m+1]=Qe(_,c,"z","x",r,n);break;case 3:_.set(0,-1,0),y[m+0]=1-Qe(_,c,"x","z",r,e),y[m+1]=1-Qe(_,c,"z","x",r,n);break;case 4:_.set(0,0,1),y[m+0]=1-Qe(_,c,"x","y",r,e),y[m+1]=1-Qe(_,c,"y","x",r,t);break;case 5:_.set(0,0,-1),y[m+0]=Qe(_,c,"x","y",r,e),y[m+1]=1-Qe(_,c,"y","x",r,t);break}}}class Pr extends l.ExtrudeGeometry{constructor(e,t={}){const{bevelEnabled:n=!1,bevelSize:s=8,bevelThickness:r=10,font:i,height:a=50,size:c=100,lineHeight:h=1,letterSpacing:d=0,...f}=t;if(i===void 0)super();else{const y=i.generateShapes(e,c,{lineHeight:h,letterSpacing:d});super(y,{...f,bevelEnabled:n,bevelSize:s,bevelThickness:r,depth:a})}this.type="TextGeometry"}}const Qa={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
|
324
|
+
`},pr=new l.ShaderMaterial({name:"SkyShader",fragmentShader:Mn.fragmentShader,vertexShader:Mn.vertexShader,uniforms:l.UniformsUtils.clone(Mn.uniforms),side:l.BackSide,depthWrite:!1});class ss extends l.Mesh{constructor(){super(new l.BoxGeometry(1,1,1),pr)}}dr(ss,"SkyShader",Mn),dr(ss,"material",pr);const Fe=new l.Triangle,Sn=new l.Vector3;class Ho{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 i=1;t&&(i=t.getX(r)+t.getX(r+1)+t.getX(r+2)),Fe.a.fromBufferAttribute(e,r),Fe.b.fromBufferAttribute(e,r+1),Fe.c.fromBufferAttribute(e,r+2),i*=Fe.getArea(),n[r/3]=i}this.distribution=new Float32Array(e.count/3);let s=0;for(let r=0;r<n.length;r++)s+=n[r],this.distribution[r]=s;return this}setRandomGenerator(e){return this.randomFunction=e,this}sample(e,t,n){const s=this.sampleFaceIndex();return this.sampleFace(s,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,s=t.length-1,r=-1;for(;n<=s;){const i=Math.ceil((n+s)/2);if(i===0||t[i-1]<=e&&t[i]>e){r=i;break}else e<t[i]?s=i-1:n=i+1}return r}sampleFace(e,t,n,s){let r=this.randomFunction(),i=this.randomFunction();return r+i>1&&(r=1-r,i=1-i),Fe.a.fromBufferAttribute(this.positionAttribute,e*3),Fe.b.fromBufferAttribute(this.positionAttribute,e*3+1),Fe.c.fromBufferAttribute(this.positionAttribute,e*3+2),t.set(0,0,0).addScaledVector(Fe.a,r).addScaledVector(Fe.b,i).addScaledVector(Fe.c,1-(r+i)),n!==void 0&&Fe.getNormal(n),s!==void 0&&this.colorAttribute!==void 0&&(Fe.a.fromBufferAttribute(this.colorAttribute,e*3),Fe.b.fromBufferAttribute(this.colorAttribute,e*3+1),Fe.c.fromBufferAttribute(this.colorAttribute,e*3+2),Sn.set(0,0,0).addScaledVector(Fe.a,r).addScaledVector(Fe.b,i).addScaledVector(Fe.c,1-(r+i)),s.r=Sn.x,s.g=Sn.y,s.b=Sn.z),this}}var $o=Object.defineProperty,ea=(o,e,t)=>e in o?$o(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Q=(o,e,t)=>(ea(o,typeof e!="symbol"?e+"":e,t),t);class ta extends l.Object3D{constructor(e,t){super(),Q(this,"isTransformControls",!0),Q(this,"visible",!1),Q(this,"domElement"),Q(this,"raycaster",new l.Raycaster),Q(this,"gizmo"),Q(this,"plane"),Q(this,"tempVector",new l.Vector3),Q(this,"tempVector2",new l.Vector3),Q(this,"tempQuaternion",new l.Quaternion),Q(this,"unit",{X:new l.Vector3(1,0,0),Y:new l.Vector3(0,1,0),Z:new l.Vector3(0,0,1)}),Q(this,"pointStart",new l.Vector3),Q(this,"pointEnd",new l.Vector3),Q(this,"offset",new l.Vector3),Q(this,"rotationAxis",new l.Vector3),Q(this,"startNorm",new l.Vector3),Q(this,"endNorm",new l.Vector3),Q(this,"rotationAngle",0),Q(this,"cameraPosition",new l.Vector3),Q(this,"cameraQuaternion",new l.Quaternion),Q(this,"cameraScale",new l.Vector3),Q(this,"parentPosition",new l.Vector3),Q(this,"parentQuaternion",new l.Quaternion),Q(this,"parentQuaternionInv",new l.Quaternion),Q(this,"parentScale",new l.Vector3),Q(this,"worldPositionStart",new l.Vector3),Q(this,"worldQuaternionStart",new l.Quaternion),Q(this,"worldScaleStart",new l.Vector3),Q(this,"worldPosition",new l.Vector3),Q(this,"worldQuaternion",new l.Quaternion),Q(this,"worldQuaternionInv",new l.Quaternion),Q(this,"worldScale",new l.Vector3),Q(this,"eye",new l.Vector3),Q(this,"positionStart",new l.Vector3),Q(this,"quaternionStart",new l.Quaternion),Q(this,"scaleStart",new l.Vector3),Q(this,"camera"),Q(this,"object"),Q(this,"enabled",!0),Q(this,"axis",null),Q(this,"mode","translate"),Q(this,"translationSnap",null),Q(this,"rotationSnap",null),Q(this,"scaleSnap",null),Q(this,"space","world"),Q(this,"size",1),Q(this,"dragging",!1),Q(this,"showX",!0),Q(this,"showY",!0),Q(this,"showZ",!0),Q(this,"changeEvent",{type:"change"}),Q(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),Q(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),Q(this,"objectChangeEvent",{type:"objectChange"}),Q(this,"intersectObjectWithRay",(s,r,i)=>{const a=r.intersectObject(s,!0);for(let c=0;c<a.length;c++)if(a[c].object.visible||i)return a[c];return!1}),Q(this,"attach",s=>(this.object=s,this.visible=!0,this)),Q(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),Q(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),Q(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()}),Q(this,"pointerHover",s=>{if(this.object===void 0||this.dragging===!0)return;this.raycaster.setFromCamera(s,this.camera);const r=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);r?this.axis=r.object.name:this.axis=null}),Q(this,"pointerDown",s=>{if(!(this.object===void 0||this.dragging===!0||s.button!==0)&&this.axis!==null){this.raycaster.setFromCamera(s,this.camera);const r=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(r){let i=this.space;if(this.mode==="scale"?i="local":(this.axis==="E"||this.axis==="XYZE"||this.axis==="XYZ")&&(i="world"),i==="local"&&this.mode==="rotate"){const 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)}}),Q(this,"pointerMove",s=>{const r=this.axis,i=this.mode,a=this.object;let c=this.space;if(i==="scale"?c="local":(r==="E"||r==="XYZE"||r==="XYZ")&&(c="world"),a===void 0||r===null||this.dragging===!1||s.button!==-1)return;this.raycaster.setFromCamera(s,this.camera);const h=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(h){if(this.pointEnd.copy(h.point).sub(this.worldPositionStart),i==="translate")this.offset.copy(this.pointEnd).sub(this.pointStart),c==="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),c==="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&&(c==="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)),c==="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(i==="scale"){if(r.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),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(i==="rotate"){this.offset.copy(this.pointEnd).sub(this.pointStart);const d=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))*d):(r==="X"||r==="Y"||r==="Z")&&(this.rotationAxis.copy(this.unit[r]),this.tempVector.copy(this.unit[r]),c==="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),c==="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)}}),Q(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)}),Q(this,"getPointer",s=>{var r;if(this.domElement&&((r=this.domElement.ownerDocument)!=null&&r.pointerLockElement))return{x:0,y:0,button:s.button};{const i=s.changedTouches?s.changedTouches[0]:s,a=this.domElement.getBoundingClientRect();return{x:(i.clientX-a.left)/a.width*2-1,y:-(i.clientY-a.top)/a.height*2+1,button:s.button}}}),Q(this,"onPointerHover",s=>{if(this.enabled)switch(s.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(s));break}}),Q(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)))}),Q(this,"onPointerMove",s=>{this.enabled&&this.pointerMove(this.getPointer(s))}),Q(this,"onPointerUp",s=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(s)))}),Q(this,"getMode",()=>this.mode),Q(this,"setMode",s=>{this.mode=s}),Q(this,"setTranslationSnap",s=>{this.translationSnap=s}),Q(this,"setRotationSnap",s=>{this.rotationSnap=s}),Q(this,"setScaleSnap",s=>{this.scaleSnap=s}),Q(this,"setSize",s=>{this.size=s}),Q(this,"setSpace",s=>{this.space=s}),Q(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),Q(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)}),Q(this,"dispose",()=>{var s,r,i,a,c,h;(s=this.domElement)==null||s.removeEventListener("pointerdown",this.onPointerDown),(r=this.domElement)==null||r.removeEventListener("pointermove",this.onPointerHover),(a=(i=this.domElement)==null?void 0:i.ownerDocument)==null||a.removeEventListener("pointermove",this.onPointerMove),(h=(c=this.domElement)==null?void 0:c.ownerDocument)==null||h.removeEventListener("pointerup",this.onPointerUp),this.traverse(d=>{const f=d;f.geometry&&f.geometry.dispose(),f.material&&f.material.dispose()})}),this.domElement=t,this.camera=e,this.gizmo=new na,this.add(this.gizmo),this.plane=new sa,this.add(this.plane);const n=(s,r)=>{let i=r;Object.defineProperty(this,s,{get:function(){return i!==void 0?i:r},set:function(a){i!==a&&(i=a,this.plane[s]=a,this.gizmo[s]=a,this.dispatchEvent({type:s+"-changed",value:a}),this.dispatchEvent(this.changeEvent))}}),this[s]=r,this.plane[s]=r,this.gizmo[s]=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 na extends l.Object3D{constructor(){super(),Q(this,"isTransformControlsGizmo",!0),Q(this,"type","TransformControlsGizmo"),Q(this,"tempVector",new l.Vector3(0,0,0)),Q(this,"tempEuler",new l.Euler),Q(this,"alignVector",new l.Vector3(0,1,0)),Q(this,"zeroVector",new l.Vector3(0,0,0)),Q(this,"lookAtMatrix",new l.Matrix4),Q(this,"tempQuaternion",new l.Quaternion),Q(this,"tempQuaternion2",new l.Quaternion),Q(this,"identityQuaternion",new l.Quaternion),Q(this,"unitX",new l.Vector3(1,0,0)),Q(this,"unitY",new l.Vector3(0,1,0)),Q(this,"unitZ",new l.Vector3(0,0,1)),Q(this,"gizmo"),Q(this,"picker"),Q(this,"helper"),Q(this,"rotationAxis",new l.Vector3),Q(this,"cameraPosition",new l.Vector3),Q(this,"worldPositionStart",new l.Vector3),Q(this,"worldQuaternionStart",new l.Quaternion),Q(this,"worldPosition",new l.Vector3),Q(this,"worldQuaternion",new l.Quaternion),Q(this,"eye",new l.Vector3),Q(this,"camera",null),Q(this,"enabled",!0),Q(this,"axis",null),Q(this,"mode","translate"),Q(this,"space","world"),Q(this,"size",1),Q(this,"dragging",!1),Q(this,"showX",!0),Q(this,"showY",!0),Q(this,"showZ",!0),Q(this,"updateMatrixWorld",()=>{let te=this.space;this.mode==="scale"&&(te="local");const ce=te==="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 le=[];le=le.concat(this.picker[this.mode].children),le=le.concat(this.gizmo[this.mode].children),le=le.concat(this.helper[this.mode].children);for(let me=0;me<le.length;me++){const B=le[me];B.visible=!0,B.rotation.set(0,0,0),B.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),B.scale.set(1,1,1).multiplyScalar(z*this.size/7),B.tag==="helper"){B.visible=!1,B.name==="AXIS"?(B.position.copy(this.worldPositionStart),B.visible=!!this.axis,this.axis==="X"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),B.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))>.9&&(B.visible=!1)),this.axis==="Y"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),B.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))>.9&&(B.visible=!1)),this.axis==="Z"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),B.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))>.9&&(B.visible=!1)),this.axis==="XYZE"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),B.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),B.quaternion.multiply(this.tempQuaternion),B.visible=this.dragging),this.axis==="E"&&(B.visible=!1)):B.name==="START"?(B.position.copy(this.worldPositionStart),B.visible=this.dragging):B.name==="END"?(B.position.copy(this.worldPosition),B.visible=this.dragging):B.name==="DELTA"?(B.position.copy(this.worldPositionStart),B.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()),B.scale.copy(this.tempVector),B.visible=this.dragging):(B.quaternion.copy(ce),this.dragging?B.position.copy(this.worldPositionStart):B.position.copy(this.worldPosition),this.axis&&(B.visible=this.axis.search(B.name)!==-1));continue}B.quaternion.copy(ce),this.mode==="translate"||this.mode==="scale"?((B.name==="X"||B.name==="XYZX")&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))>.99&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),(B.name==="Y"||B.name==="XYZY")&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))>.99&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),(B.name==="Z"||B.name==="XYZZ")&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))>.99&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),B.name==="XY"&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))<.2&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),B.name==="YZ"&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))<.2&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),B.name==="XZ"&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))<.2&&(B.scale.set(1e-10,1e-10,1e-10),B.visible=!1),B.name.search("X")!==-1&&(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye)<0?B.tag==="fwd"?B.visible=!1:B.scale.x*=-1:B.tag==="bwd"&&(B.visible=!1)),B.name.search("Y")!==-1&&(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye)<0?B.tag==="fwd"?B.visible=!1:B.scale.y*=-1:B.tag==="bwd"&&(B.visible=!1)),B.name.search("Z")!==-1&&(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye)<0?B.tag==="fwd"?B.visible=!1:B.scale.z*=-1:B.tag==="bwd"&&(B.visible=!1))):this.mode==="rotate"&&(this.tempQuaternion2.copy(ce),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(ce).invert()),B.name.search("E")!==-1&&B.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),B.name==="X"&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),B.quaternion.copy(this.tempQuaternion)),B.name==="Y"&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),B.quaternion.copy(this.tempQuaternion)),B.name==="Z"&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),B.quaternion.copy(this.tempQuaternion))),B.visible=B.visible&&(B.name.indexOf("X")===-1||this.showX),B.visible=B.visible&&(B.name.indexOf("Y")===-1||this.showY),B.visible=B.visible&&(B.name.indexOf("Z")===-1||this.showZ),B.visible=B.visible&&(B.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),B.material.tempOpacity=B.material.tempOpacity||B.material.opacity,B.material.tempColor=B.material.tempColor||B.material.color.clone(),B.material.color.copy(B.material.tempColor),B.material.opacity=B.material.tempOpacity,this.enabled?this.axis&&(B.name===this.axis?(B.material.opacity=1,B.material.color.lerp(new l.Color(1,1,1),.5)):this.axis.split("").some(function(F){return B.name===F})?(B.material.opacity=1,B.material.color.lerp(new l.Color(1,1,1),.5)):(B.material.opacity*=.25,B.material.color.lerp(new l.Color(1,1,1),.5))):(B.material.opacity*=.5,B.material.color.lerp(new l.Color(1,1,1),.5))}super.updateMatrixWorld()});const e=new l.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:l.DoubleSide,fog:!1,toneMapped:!1}),t=new l.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),n=e.clone();n.opacity=.15;const s=e.clone();s.opacity=.33;const r=e.clone();r.color.set(16711680);const i=e.clone();i.color.set(65280);const a=e.clone();a.color.set(255);const c=e.clone();c.opacity=.25;const h=c.clone();h.color.set(16776960);const d=c.clone();d.color.set(65535);const f=c.clone();f.color.set(16711935),e.clone().color.set(16776960);const p=t.clone();p.color.set(16711680);const _=t.clone();_.color.set(65280);const y=t.clone();y.color.set(255);const x=t.clone();x.color.set(65535);const m=t.clone();m.color.set(16711935);const M=t.clone();M.color.set(16776960);const v=t.clone();v.color.set(7895160);const C=M.clone();C.opacity=.25;const O=new l.CylinderGeometry(0,.05,.2,12,1,!1),S=new l.BoxGeometry(.125,.125,.125),A=new l.BufferGeometry;A.setAttribute("position",new l.Float32BufferAttribute([0,0,0,1,0,0],3));const b=(te,ce)=>{const le=new l.BufferGeometry,me=[];for(let B=0;B<=64*ce;++B)me.push(0,Math.cos(B/32*Math.PI)*te,Math.sin(B/32*Math.PI)*te);return le.setAttribute("position",new l.Float32BufferAttribute(me,3)),le},P=()=>{const te=new l.BufferGeometry;return te.setAttribute("position",new l.Float32BufferAttribute([0,0,0,1,1,1],3)),te},w={X:[[new l.Mesh(O,r),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new l.Mesh(O,r),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new l.Line(A,p)]],Y:[[new l.Mesh(O,i),[0,1,0],null,null,"fwd"],[new l.Mesh(O,i),[0,1,0],[Math.PI,0,0],null,"bwd"],[new l.Line(A,_),null,[0,0,Math.PI/2]]],Z:[[new l.Mesh(O,a),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new l.Mesh(O,a),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new l.Line(A,y),null,[0,-Math.PI/2,0]]],XYZ:[[new l.Mesh(new l.OctahedronGeometry(.1,0),c.clone()),[0,0,0],[0,0,0]]],XY:[[new l.Mesh(new l.PlaneGeometry(.295,.295),h.clone()),[.15,.15,0]],[new l.Line(A,M),[.18,.3,0],null,[.125,1,1]],[new l.Line(A,M),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new l.Mesh(new l.PlaneGeometry(.295,.295),d.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new l.Line(A,x),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new l.Line(A,x),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new l.Mesh(new l.PlaneGeometry(.295,.295),f.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new l.Line(A,m),[.18,0,.3],null,[.125,1,1]],[new l.Line(A,m),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},D={X:[[new l.Mesh(new l.CylinderGeometry(.2,0,1,4,1,!1),n),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new l.Mesh(new l.CylinderGeometry(.2,0,1,4,1,!1),n),[0,.6,0]]],Z:[[new l.Mesh(new l.CylinderGeometry(.2,0,1,4,1,!1),n),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new l.Mesh(new l.OctahedronGeometry(.2,0),n)]],XY:[[new l.Mesh(new l.PlaneGeometry(.4,.4),n),[.2,.2,0]]],YZ:[[new l.Mesh(new l.PlaneGeometry(.4,.4),n),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new l.Mesh(new l.PlaneGeometry(.4,.4),n),[.2,0,.2],[-Math.PI/2,0,0]]]},L={START:[[new l.Mesh(new l.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new l.Mesh(new l.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new l.Line(P(),s),null,null,null,"helper"]],X:[[new l.Line(A,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new l.Line(A,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new l.Line(A,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},V={X:[[new l.Line(b(1,.5),p)],[new l.Mesh(new l.OctahedronGeometry(.04,0),r),[0,0,.99],null,[1,3,1]]],Y:[[new l.Line(b(1,.5),_),null,[0,0,-Math.PI/2]],[new l.Mesh(new l.OctahedronGeometry(.04,0),i),[0,0,.99],null,[3,1,1]]],Z:[[new l.Line(b(1,.5),y),null,[0,Math.PI/2,0]],[new l.Mesh(new l.OctahedronGeometry(.04,0),a),[.99,0,0],null,[1,3,1]]],E:[[new l.Line(b(1.25,1),C),null,[0,Math.PI/2,0]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),C),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),C),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),C),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),C),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new l.Line(b(1,1),v),null,[0,Math.PI/2,0]]]},R={AXIS:[[new l.Line(A,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},Y={X:[[new l.Mesh(new l.TorusGeometry(1,.1,4,24),n),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new l.Mesh(new l.TorusGeometry(1,.1,4,24),n),[0,0,0],[Math.PI/2,0,0]]],Z:[[new l.Mesh(new l.TorusGeometry(1,.1,4,24),n),[0,0,0],[0,0,-Math.PI/2]]],E:[[new l.Mesh(new l.TorusGeometry(1.25,.1,2,24),n)]],XYZE:[[new l.Mesh(new l.SphereGeometry(.7,10,8),n)]]},W={X:[[new l.Mesh(S,r),[.8,0,0],[0,0,-Math.PI/2]],[new l.Line(A,p),null,null,[.8,1,1]]],Y:[[new l.Mesh(S,i),[0,.8,0]],[new l.Line(A,_),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new l.Mesh(S,a),[0,0,.8],[Math.PI/2,0,0]],[new l.Line(A,y),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new l.Mesh(S,h),[.85,.85,0],null,[2,2,.2]],[new l.Line(A,M),[.855,.98,0],null,[.125,1,1]],[new l.Line(A,M),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new l.Mesh(S,d),[0,.85,.85],null,[.2,2,2]],[new l.Line(A,x),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new l.Line(A,x),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new l.Mesh(S,f),[.85,0,.85],null,[2,.2,2]],[new l.Line(A,m),[.855,0,.98],null,[.125,1,1]],[new l.Line(A,m),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new l.Mesh(new l.BoxGeometry(.125,.125,.125),c.clone()),[1.1,0,0]]],XYZY:[[new l.Mesh(new l.BoxGeometry(.125,.125,.125),c.clone()),[0,1.1,0]]],XYZZ:[[new l.Mesh(new l.BoxGeometry(.125,.125,.125),c.clone()),[0,0,1.1]]]},$={X:[[new l.Mesh(new l.CylinderGeometry(.2,0,.8,4,1,!1),n),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new l.Mesh(new l.CylinderGeometry(.2,0,.8,4,1,!1),n),[0,.5,0]]],Z:[[new l.Mesh(new l.CylinderGeometry(.2,0,.8,4,1,!1),n),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new l.Mesh(S,n),[.85,.85,0],null,[3,3,.2]]],YZ:[[new l.Mesh(S,n),[0,.85,.85],null,[.2,3,3]]],XZ:[[new l.Mesh(S,n),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new l.Mesh(new l.BoxGeometry(.2,.2,.2),n),[1.1,0,0]]],XYZY:[[new l.Mesh(new l.BoxGeometry(.2,.2,.2),n),[0,1.1,0]]],XYZZ:[[new l.Mesh(new l.BoxGeometry(.2,.2,.2),n),[0,0,1.1]]]},q={X:[[new l.Line(A,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new l.Line(A,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new l.Line(A,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},ne=te=>{const ce=new l.Object3D;for(let le in te)for(let me=te[le].length;me--;){const B=te[le][me][0].clone(),z=te[le][me][1],F=te[le][me][2],k=te[le][me][3],G=te[le][me][4];B.name=le,B.tag=G,z&&B.position.set(z[0],z[1],z[2]),F&&B.rotation.set(F[0],F[1],F[2]),k&&B.scale.set(k[0],k[1],k[2]),B.updateMatrix();const T=B.geometry.clone();T.applyMatrix4(B.matrix),B.geometry=T,B.renderOrder=1/0,B.position.set(0,0,0),B.rotation.set(0,0,0),B.scale.set(1,1,1),ce.add(B)}return ce};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=ne(w)),this.add(this.gizmo.rotate=ne(V)),this.add(this.gizmo.scale=ne(W)),this.add(this.picker.translate=ne(D)),this.add(this.picker.rotate=ne(Y)),this.add(this.picker.scale=ne($)),this.add(this.helper.translate=ne(L)),this.add(this.helper.rotate=ne(R)),this.add(this.helper.scale=ne(q)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class sa extends l.Mesh{constructor(){super(new l.PlaneGeometry(1e5,1e5,2,2),new l.MeshBasicMaterial({visible:!1,wireframe:!0,side:l.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),Q(this,"isTransformControlsPlane",!0),Q(this,"type","TransformControlsPlane"),Q(this,"unitX",new l.Vector3(1,0,0)),Q(this,"unitY",new l.Vector3(0,1,0)),Q(this,"unitZ",new l.Vector3(0,0,1)),Q(this,"tempVector",new l.Vector3),Q(this,"dirVector",new l.Vector3),Q(this,"alignVector",new l.Vector3),Q(this,"tempMatrix",new l.Matrix4),Q(this,"identityQuaternion",new l.Quaternion),Q(this,"cameraQuaternion",new l.Quaternion),Q(this,"worldPosition",new l.Vector3),Q(this,"worldQuaternion",new l.Quaternion),Q(this,"eye",new l.Vector3),Q(this,"axis",null),Q(this,"mode","translate"),Q(this,"space","world"),Q(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 ra=Object.defineProperty,ia=(o,e,t)=>e in o?ra(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Be=(o,e,t)=>(ia(o,typeof e!="symbol"?e+"":e,t),t);const zt=new l.Euler(0,0,0,"YXZ"),Vt=new l.Vector3,oa={type:"change"},aa={type:"lock"},la={type:"unlock"},mr=Math.PI/2;class gr extends l.EventDispatcher{constructor(e,t){super(),Be(this,"camera"),Be(this,"domElement"),Be(this,"isLocked"),Be(this,"minPolarAngle"),Be(this,"maxPolarAngle"),Be(this,"pointerSpeed"),Be(this,"onMouseMove",n=>{if(!this.domElement||this.isLocked===!1)return;const s=n.movementX||n.mozMovementX||n.webkitMovementX||0,r=n.movementY||n.mozMovementY||n.webkitMovementY||0;zt.setFromQuaternion(this.camera.quaternion),zt.y-=s*.002*this.pointerSpeed,zt.x-=r*.002*this.pointerSpeed,zt.x=Math.max(mr-this.maxPolarAngle,Math.min(mr-this.minPolarAngle,zt.x)),this.camera.quaternion.setFromEuler(zt),this.dispatchEvent(oa)}),Be(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(aa),this.isLocked=!0):(this.dispatchEvent(la),this.isLocked=!1))}),Be(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),Be(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))}),Be(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))}),Be(this,"dispose",()=>{this.disconnect()}),Be(this,"getObject",()=>this.camera),Be(this,"direction",new l.Vector3(0,0,-1)),Be(this,"getDirection",n=>n.copy(this.direction).applyQuaternion(this.camera.quaternion)),Be(this,"moveForward",n=>{Vt.setFromMatrixColumn(this.camera.matrix,0),Vt.crossVectors(this.camera.up,Vt),this.camera.position.addScaledVector(Vt,n)}),Be(this,"moveRight",n=>{Vt.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(Vt,n)}),Be(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),Be(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 ca=Object.defineProperty,ua=(o,e,t)=>e in o?ca(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,fe=(o,e,t)=>(ua(o,typeof e!="symbol"?e+"":e,t),t);const An=new l.Ray,yr=new l.Plane,ha=Math.cos(70*(Math.PI/180)),_r=(o,e)=>(o%e+e)%e;class xr extends l.EventDispatcher{constructor(e,t){super(),fe(this,"object"),fe(this,"domElement"),fe(this,"enabled",!0),fe(this,"target",new l.Vector3),fe(this,"minDistance",0),fe(this,"maxDistance",1/0),fe(this,"minZoom",0),fe(this,"maxZoom",1/0),fe(this,"minPolarAngle",0),fe(this,"maxPolarAngle",Math.PI),fe(this,"minAzimuthAngle",-1/0),fe(this,"maxAzimuthAngle",1/0),fe(this,"enableDamping",!1),fe(this,"dampingFactor",.05),fe(this,"enableZoom",!0),fe(this,"zoomSpeed",1),fe(this,"enableRotate",!0),fe(this,"rotateSpeed",1),fe(this,"enablePan",!0),fe(this,"panSpeed",1),fe(this,"screenSpacePanning",!0),fe(this,"keyPanSpeed",7),fe(this,"zoomToCursor",!1),fe(this,"autoRotate",!1),fe(this,"autoRotateSpeed",2),fe(this,"reverseOrbit",!1),fe(this,"reverseHorizontalOrbit",!1),fe(this,"reverseVerticalOrbit",!1),fe(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),fe(this,"mouseButtons",{LEFT:l.MOUSE.ROTATE,MIDDLE:l.MOUSE.DOLLY,RIGHT:l.MOUSE.PAN}),fe(this,"touches",{ONE:l.TOUCH.ROTATE,TWO:l.TOUCH.DOLLY_PAN}),fe(this,"target0"),fe(this,"position0"),fe(this,"zoom0"),fe(this,"_domElementKeyEvents",null),fe(this,"getPolarAngle"),fe(this,"getAzimuthalAngle"),fe(this,"setPolarAngle"),fe(this,"setAzimuthalAngle"),fe(this,"getDistance"),fe(this,"listenToKeyEvents"),fe(this,"stopListenToKeyEvents"),fe(this,"saveState"),fe(this,"reset"),fe(this,"update"),fe(this,"connect"),fe(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=K=>{let oe=_r(K,2*Math.PI),ge=d.phi;ge<0&&(ge+=2*Math.PI),oe<0&&(oe+=2*Math.PI);let Me=Math.abs(oe-ge);2*Math.PI-Me<Me&&(oe<ge?oe+=2*Math.PI:ge+=2*Math.PI),f.phi=oe-ge,n.update()},this.setAzimuthalAngle=K=>{let oe=_r(K,2*Math.PI),ge=d.theta;ge<0&&(ge+=2*Math.PI),oe<0&&(oe+=2*Math.PI);let Me=Math.abs(oe-ge);2*Math.PI-Me<Me&&(oe<ge?oe+=2*Math.PI:ge+=2*Math.PI),f.theta=oe-ge,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=K=>{K.addEventListener("keydown",Tt),this._domElementKeyEvents=K},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Tt),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(),c=a.NONE},this.update=(()=>{const K=new l.Vector3,oe=new l.Vector3(0,1,0),ge=new l.Quaternion().setFromUnitVectors(e.up,oe),Me=ge.clone().invert(),ke=new l.Vector3,pt=new l.Quaternion,Ot=2*Math.PI;return function(){const io=n.object.position;ge.setFromUnitVectors(e.up,oe),Me.copy(ge).invert(),K.copy(io).sub(n.target),K.applyQuaternion(ge),d.setFromVector3(K),n.autoRotate&&c===a.NONE&&R(L()),n.enableDamping?(d.theta+=f.theta*n.dampingFactor,d.phi+=f.phi*n.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let mt=n.minAzimuthAngle,gt=n.maxAzimuthAngle;isFinite(mt)&&isFinite(gt)&&(mt<-Math.PI?mt+=Ot:mt>Math.PI&&(mt-=Ot),gt<-Math.PI?gt+=Ot:gt>Math.PI&&(gt-=Ot),mt<=gt?d.theta=Math.max(mt,Math.min(gt,d.theta)):d.theta=d.theta>(mt+gt)/2?Math.max(mt,d.theta):Math.min(gt,d.theta)),d.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,d.phi)),d.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(p,n.dampingFactor):n.target.add(p),n.zoomToCursor&&P||n.object.isOrthographicCamera?d.radius=le(d.radius):d.radius=le(d.radius*g),K.setFromSpherical(d),K.applyQuaternion(Me),io.copy(n.target).add(K),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(f.theta*=1-n.dampingFactor,f.phi*=1-n.dampingFactor,p.multiplyScalar(1-n.dampingFactor)):(f.set(0,0,0),p.set(0,0,0));let _n=!1;if(n.zoomToCursor&&P){let xn=null;if(n.object instanceof l.PerspectiveCamera&&n.object.isPerspectiveCamera){const vn=K.length();xn=le(vn*g);const Xn=vn-xn;n.object.position.addScaledVector(A,Xn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const vn=new l.Vector3(b.x,b.y,0);vn.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/g)),n.object.updateProjectionMatrix(),_n=!0;const Xn=new l.Vector3(b.x,b.y,0);Xn.unproject(n.object),n.object.position.sub(Xn).add(vn),n.object.updateMatrixWorld(),xn=K.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;xn!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(xn).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))<ha?e.lookAt(n.target):(yr.setFromNormalAndCoplanarPoint(n.object.up,n.target),An.intersectPlane(yr,n.target))))}else n.object instanceof l.OrthographicCamera&&n.object.isOrthographicCamera&&(_n=g!==1,_n&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/g)),n.object.updateProjectionMatrix()));return g=1,P=!1,_n||ke.distanceToSquared(n.object.position)>h||8*(1-pt.dot(n.object.quaternion))>h?(n.dispatchEvent(s),ke.copy(n.object.position),pt.copy(n.object.quaternion),_n=!1,!0):!1}})(),this.connect=K=>{n.domElement=K,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",$e),n.domElement.addEventListener("pointerdown",he),n.domElement.addEventListener("pointercancel",Ie),n.domElement.addEventListener("wheel",dt)},this.dispose=()=>{var K,oe,ge,Me,ke,pt;n.domElement&&(n.domElement.style.touchAction="auto"),(K=n.domElement)==null||K.removeEventListener("contextmenu",$e),(oe=n.domElement)==null||oe.removeEventListener("pointerdown",he),(ge=n.domElement)==null||ge.removeEventListener("pointercancel",Ie),(Me=n.domElement)==null||Me.removeEventListener("wheel",dt),(ke=n.domElement)==null||ke.ownerDocument.removeEventListener("pointermove",_e),(pt=n.domElement)==null||pt.ownerDocument.removeEventListener("pointerup",Ie),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",Tt)};const n=this,s={type:"change"},r={type:"start"},i={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 c=a.NONE;const h=1e-6,d=new l.Spherical,f=new l.Spherical;let g=1;const p=new l.Vector3,_=new l.Vector2,y=new l.Vector2,x=new l.Vector2,m=new l.Vector2,M=new l.Vector2,v=new l.Vector2,C=new l.Vector2,O=new l.Vector2,S=new l.Vector2,A=new l.Vector3,b=new l.Vector2;let P=!1;const w=[],D={};function L(){return 2*Math.PI/60/60*n.autoRotateSpeed}function V(){return Math.pow(.95,n.zoomSpeed)}function R(K){n.reverseOrbit||n.reverseHorizontalOrbit?f.theta+=K:f.theta-=K}function Y(K){n.reverseOrbit||n.reverseVerticalOrbit?f.phi+=K:f.phi-=K}const W=(()=>{const K=new l.Vector3;return function(ge,Me){K.setFromMatrixColumn(Me,0),K.multiplyScalar(-ge),p.add(K)}})(),$=(()=>{const K=new l.Vector3;return function(ge,Me){n.screenSpacePanning===!0?K.setFromMatrixColumn(Me,1):(K.setFromMatrixColumn(Me,0),K.crossVectors(n.object.up,K)),K.multiplyScalar(ge),p.add(K)}})(),q=(()=>{const K=new l.Vector3;return function(ge,Me){const ke=n.domElement;if(ke&&n.object instanceof l.PerspectiveCamera&&n.object.isPerspectiveCamera){const pt=n.object.position;K.copy(pt).sub(n.target);let Ot=K.length();Ot*=Math.tan(n.object.fov/2*Math.PI/180),W(2*ge*Ot/ke.clientHeight,n.object.matrix),$(2*Me*Ot/ke.clientHeight,n.object.matrix)}else ke&&n.object instanceof l.OrthographicCamera&&n.object.isOrthographicCamera?(W(ge*(n.object.right-n.object.left)/n.object.zoom/ke.clientWidth,n.object.matrix),$(Me*(n.object.top-n.object.bottom)/n.object.zoom/ke.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ne(K){n.object instanceof l.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof l.OrthographicCamera&&n.object.isOrthographicCamera?g/=K:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function te(K){n.object instanceof l.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof l.OrthographicCamera&&n.object.isOrthographicCamera?g*=K:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ce(K){if(!n.zoomToCursor||!n.domElement)return;P=!0;const oe=n.domElement.getBoundingClientRect(),ge=K.clientX-oe.left,Me=K.clientY-oe.top,ke=oe.width,pt=oe.height;b.x=ge/ke*2-1,b.y=-(Me/pt)*2+1,A.set(b.x,b.y,1).unproject(n.object).sub(n.object.position).normalize()}function le(K){return Math.max(n.minDistance,Math.min(n.maxDistance,K))}function me(K){_.set(K.clientX,K.clientY)}function B(K){ce(K),C.set(K.clientX,K.clientY)}function z(K){m.set(K.clientX,K.clientY)}function F(K){y.set(K.clientX,K.clientY),x.subVectors(y,_).multiplyScalar(n.rotateSpeed);const oe=n.domElement;oe&&(R(2*Math.PI*x.x/oe.clientHeight),Y(2*Math.PI*x.y/oe.clientHeight)),_.copy(y),n.update()}function k(K){O.set(K.clientX,K.clientY),S.subVectors(O,C),S.y>0?ne(V()):S.y<0&&te(V()),C.copy(O),n.update()}function G(K){M.set(K.clientX,K.clientY),v.subVectors(M,m).multiplyScalar(n.panSpeed),q(v.x,v.y),m.copy(M),n.update()}function T(K){ce(K),K.deltaY<0?te(V()):K.deltaY>0&&ne(V()),n.update()}function I(K){let oe=!1;switch(K.code){case n.keys.UP:q(0,n.keyPanSpeed),oe=!0;break;case n.keys.BOTTOM:q(0,-n.keyPanSpeed),oe=!0;break;case n.keys.LEFT:q(n.keyPanSpeed,0),oe=!0;break;case n.keys.RIGHT:q(-n.keyPanSpeed,0),oe=!0;break}oe&&(K.preventDefault(),n.update())}function U(){if(w.length==1)_.set(w[0].pageX,w[0].pageY);else{const K=.5*(w[0].pageX+w[1].pageX),oe=.5*(w[0].pageY+w[1].pageY);_.set(K,oe)}}function Z(){if(w.length==1)m.set(w[0].pageX,w[0].pageY);else{const K=.5*(w[0].pageX+w[1].pageX),oe=.5*(w[0].pageY+w[1].pageY);m.set(K,oe)}}function j(){const K=w[0].pageX-w[1].pageX,oe=w[0].pageY-w[1].pageY,ge=Math.sqrt(K*K+oe*oe);C.set(0,ge)}function E(){n.enableZoom&&j(),n.enablePan&&Z()}function J(){n.enableZoom&&j(),n.enableRotate&&U()}function se(K){if(w.length==1)y.set(K.pageX,K.pageY);else{const ge=yn(K),Me=.5*(K.pageX+ge.x),ke=.5*(K.pageY+ge.y);y.set(Me,ke)}x.subVectors(y,_).multiplyScalar(n.rotateSpeed);const oe=n.domElement;oe&&(R(2*Math.PI*x.x/oe.clientHeight),Y(2*Math.PI*x.y/oe.clientHeight)),_.copy(y)}function ie(K){if(w.length==1)M.set(K.pageX,K.pageY);else{const oe=yn(K),ge=.5*(K.pageX+oe.x),Me=.5*(K.pageY+oe.y);M.set(ge,Me)}v.subVectors(M,m).multiplyScalar(n.panSpeed),q(v.x,v.y),m.copy(M)}function X(K){const oe=yn(K),ge=K.pageX-oe.x,Me=K.pageY-oe.y,ke=Math.sqrt(ge*ge+Me*Me);O.set(0,ke),S.set(0,Math.pow(O.y/C.y,n.zoomSpeed)),ne(S.y),C.copy(O)}function N(K){n.enableZoom&&X(K),n.enablePan&&ie(K)}function ae(K){n.enableZoom&&X(K),n.enableRotate&&se(K)}function he(K){var oe,ge;n.enabled!==!1&&(w.length===0&&((oe=n.domElement)==null||oe.ownerDocument.addEventListener("pointermove",_e),(ge=n.domElement)==null||ge.ownerDocument.addEventListener("pointerup",Ie)),En(K),K.pointerType==="touch"?It(K):Oe(K))}function _e(K){n.enabled!==!1&&(K.pointerType==="touch"?Ze(K):He(K))}function Ie(K){var oe,ge,Me;Yn(K),w.length===0&&((oe=n.domElement)==null||oe.releasePointerCapture(K.pointerId),(ge=n.domElement)==null||ge.ownerDocument.removeEventListener("pointermove",_e),(Me=n.domElement)==null||Me.ownerDocument.removeEventListener("pointerup",Ie)),n.dispatchEvent(i),c=a.NONE}function Oe(K){let oe;switch(K.button){case 0:oe=n.mouseButtons.LEFT;break;case 1:oe=n.mouseButtons.MIDDLE;break;case 2:oe=n.mouseButtons.RIGHT;break;default:oe=-1}switch(oe){case l.MOUSE.DOLLY:if(n.enableZoom===!1)return;B(K),c=a.DOLLY;break;case l.MOUSE.ROTATE:if(K.ctrlKey||K.metaKey||K.shiftKey){if(n.enablePan===!1)return;z(K),c=a.PAN}else{if(n.enableRotate===!1)return;me(K),c=a.ROTATE}break;case l.MOUSE.PAN:if(K.ctrlKey||K.metaKey||K.shiftKey){if(n.enableRotate===!1)return;me(K),c=a.ROTATE}else{if(n.enablePan===!1)return;z(K),c=a.PAN}break;default:c=a.NONE}c!==a.NONE&&n.dispatchEvent(r)}function He(K){if(n.enabled!==!1)switch(c){case a.ROTATE:if(n.enableRotate===!1)return;F(K);break;case a.DOLLY:if(n.enableZoom===!1)return;k(K);break;case a.PAN:if(n.enablePan===!1)return;G(K);break}}function dt(K){n.enabled===!1||n.enableZoom===!1||c!==a.NONE&&c!==a.ROTATE||(K.preventDefault(),n.dispatchEvent(r),T(K),n.dispatchEvent(i))}function Tt(K){n.enabled===!1||n.enablePan===!1||I(K)}function It(K){switch(Wn(K),w.length){case 1:switch(n.touches.ONE){case l.TOUCH.ROTATE:if(n.enableRotate===!1)return;U(),c=a.TOUCH_ROTATE;break;case l.TOUCH.PAN:if(n.enablePan===!1)return;Z(),c=a.TOUCH_PAN;break;default:c=a.NONE}break;case 2:switch(n.touches.TWO){case l.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;E(),c=a.TOUCH_DOLLY_PAN;break;case l.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;J(),c=a.TOUCH_DOLLY_ROTATE;break;default:c=a.NONE}break;default:c=a.NONE}c!==a.NONE&&n.dispatchEvent(r)}function Ze(K){switch(Wn(K),c){case a.TOUCH_ROTATE:if(n.enableRotate===!1)return;se(K),n.update();break;case a.TOUCH_PAN:if(n.enablePan===!1)return;ie(K),n.update();break;case a.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;N(K),n.update();break;case a.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ae(K),n.update();break;default:c=a.NONE}}function $e(K){n.enabled!==!1&&K.preventDefault()}function En(K){w.push(K)}function Yn(K){delete D[K.pointerId];for(let oe=0;oe<w.length;oe++)if(w[oe].pointerId==K.pointerId){w.splice(oe,1);return}}function Wn(K){let oe=D[K.pointerId];oe===void 0&&(oe=new l.Vector2,D[K.pointerId]=oe),oe.set(K.pageX,K.pageY)}function yn(K){const oe=K.pointerId===w[0].pointerId?w[1]:w[0];return D[oe.pointerId]}t!==void 0&&this.connect(t),this.update()}}class fa extends xr{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=l.MOUSE.PAN,this.mouseButtons.RIGHT=l.MOUSE.ROTATE,this.touches.ONE=l.TOUCH.PAN,this.touches.TWO=l.TOUCH.DOLLY_ROTATE}}function Rt(o){if(typeof TextDecoder<"u")return new TextDecoder().decode(o);let e="";for(let t=0,n=o.length;t<n;t++)e+=String.fromCharCode(o[t]);try{return decodeURIComponent(escape(e))}catch{return e}}const Dt="srgb",ct="srgb-linear",vr=3001,da=3e3;class pa extends l.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new xa(t)}),this.register(function(t){return new va(t)}),this.register(function(t){return new Ia(t)}),this.register(function(t){return new Oa(t)}),this.register(function(t){return new Da(t)}),this.register(function(t){return new ba(t)}),this.register(function(t){return new Ma(t)}),this.register(function(t){return new Sa(t)}),this.register(function(t){return new Aa(t)}),this.register(function(t){return new _a(t)}),this.register(function(t){return new Ca(t)}),this.register(function(t){return new wa(t)}),this.register(function(t){return new Ta(t)}),this.register(function(t){return new Pa(t)}),this.register(function(t){return new ga(t)}),this.register(function(t){return new La(t)}),this.register(function(t){return new Ba(t)})}load(e,t,n,s){const r=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const h=l.LoaderUtils.extractUrlBase(e);i=l.LoaderUtils.resolveURL(h,this.path)}else i=l.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(h){s?s(h):console.error(h),r.manager.itemError(e),r.manager.itemEnd(e)},c=new l.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(h){try{r.parse(h,i,function(d){t(d),r.manager.itemEnd(e)},a)}catch(d){a(d)}},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,s){let r;const i={},a={};if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(Rt(new Uint8Array(e.slice(0,4)))===wr){try{i[xe.KHR_BINARY_GLTF]=new ka(e)}catch(d){s&&s(d);return}r=JSON.parse(i[xe.KHR_BINARY_GLTF].content)}else r=JSON.parse(Rt(new Uint8Array(e)));else r=e;if(r.asset===void 0||r.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Za(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const d=this.pluginCallbacks[h](c);d.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[d.name]=d,i[d.name]=!0}if(r.extensionsUsed)for(let h=0;h<r.extensionsUsed.length;++h){const d=r.extensionsUsed[h],f=r.extensionsRequired||[];switch(d){case xe.KHR_MATERIALS_UNLIT:i[d]=new ya;break;case xe.KHR_DRACO_MESH_COMPRESSION:i[d]=new Fa(r,this.dracoLoader);break;case xe.KHR_TEXTURE_TRANSFORM:i[d]=new Ua;break;case xe.KHR_MESH_QUANTIZATION:i[d]=new Na;break;default:f.indexOf(d)>=0&&a[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}c.setExtensions(i),c.setPlugins(a),c.parse(n,s)}parseAsync(e,t){const n=this;return new Promise(function(s,r){n.parse(e,t,s,r)})}}function ma(){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_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ga{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,s=t.length;n<s;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 s=t.cache.get(n);if(s)return s;const r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let h;const d=new l.Color(16777215);c.color!==void 0&&d.setRGB(c.color[0],c.color[1],c.color[2],ct);const f=c.range!==void 0?c.range:0;switch(c.type){case"directional":h=new l.DirectionalLight(d),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new l.PointLight(d),h.distance=f;break;case"spot":h=new l.SpotLight(d),h.distance=f,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,h.angle=c.spot.outerConeAngle,h.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return h.position.set(0,0,0),h.decay=2,ut(h,c),c.intensity!==void 0&&(h.intensity=c.intensity),h.name=t.createUniqueName(c.name||"light_"+e),s=Promise.resolve(h),t.cache.add(n,s),s}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(c){return n._getNodeRef(t.cache,a,c)})}}class ya{constructor(){this.name=xe.KHR_MATERIALS_UNLIT}getMaterialType(){return l.MeshBasicMaterial}extendParams(e,t,n){const s=[];e.color=new l.Color(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const i=r.baseColorFactor;e.color.setRGB(i[0],i[1],i[2],ct),e.opacity=i[3]}r.baseColorTexture!==void 0&&s.push(n.assignTexture(e,"map",r.baseColorTexture,Dt))}return Promise.all(s)}}class _a{constructor(e){this.parser=e,this.name=xe.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 r=s.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class xa{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];if(i.clearcoatFactor!==void 0&&(t.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(r.push(n.assignTexture(t,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){const a=i.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new l.Vector2(a,a)}return Promise.all(r)}}class va{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_DISPERSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class wa{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];return i.iridescenceFactor!==void 0&&(t.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(t.iridescenceIOR=i.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(r)}}class ba{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new l.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const i=s.extensions[this.name];if(i.sheenColorFactor!==void 0){const a=i.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],ct)}return i.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",i.sheenColorTexture,Dt)),i.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(r)}}class Ma{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];return i.transmissionFactor!==void 0&&(t.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&r.push(n.assignTexture(t,"transmissionMap",i.transmissionTexture)),Promise.all(r)}}class Sa{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];t.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&r.push(n.assignTexture(t,"thicknessMap",i.thicknessTexture)),t.attenuationDistance=i.attenuationDistance||1/0;const a=i.attenuationColor||[1,1,1];return t.attenuationColor=new l.Color().setRGB(a[0],a[1],a[2],ct),Promise.all(r)}}class Aa{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class Ca{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];t.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&r.push(n.assignTexture(t,"specularIntensityMap",i.specularTexture));const a=i.specularColorFactor||[1,1,1];return t.specularColor=new l.Color().setRGB(a[0],a[1],a[2],ct),i.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",i.specularColorTexture,Dt)),Promise.all(r)}}class Pa{constructor(e){this.parser=e,this.name=xe.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];return t.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&r.push(n.assignTexture(t,"bumpMap",i.bumpTexture)),Promise.all(r)}}class Ta{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:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],i=s.extensions[this.name];return i.anisotropyStrength!==void 0&&(t.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(t.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&r.push(n.assignTexture(t,"anisotropyMap",i.anisotropyTexture)),Promise.all(r)}}class Ia{constructor(e){this.parser=e,this.name=xe.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 r=s.extensions[this.name],i=t.options.ktx2Loader;if(!i){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,i)}}class Oa{constructor(e){this.parser=e,this.name=xe.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const i=r.extensions[t],a=s.images[i.source];let c=n.textureLoader;if(a.uri){const h=n.options.manager.getHandler(a.uri);h!==null&&(c=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,i.source,c);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 Da{constructor(e){this.parser=e,this.name=xe.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const i=r.extensions[t],a=s.images[i.source];let c=n.textureLoader;if(a.uri){const h=n.options.manager.getHandler(a.uri);h!==null&&(c=h)}return this.detectSupport().then(function(h){if(h)return n.loadTextureImage(e,i.source,c);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 La{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 s=n.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const c=s.byteOffset||0,h=s.byteLength||0,d=s.count,f=s.byteStride,g=new Uint8Array(a,c,h);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(d,f,g,s.mode,s.filter).then(function(p){return p.buffer}):i.ready.then(function(){const p=new ArrayBuffer(d*f);return i.decodeGltfBuffer(new Uint8Array(p),d,f,g,s.mode,s.filter),p})})}else return null}}class Ba{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 s=t.meshes[n.mesh];for(const h of s.primitives)if(h.mode!==qe.TRIANGLES&&h.mode!==qe.TRIANGLE_STRIP&&h.mode!==qe.TRIANGLE_FAN&&h.mode!==void 0)return null;const i=n.extensions[this.name].attributes,a=[],c={};for(const h in i)a.push(this.parser.getDependency("accessor",i[h]).then(d=>(c[h]=d,c[h])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(h=>{const d=h.pop(),f=d.isGroup?d.children:[d],g=h[0].count,p=[];for(const _ of f){const y=new l.Matrix4,x=new l.Vector3,m=new l.Quaternion,M=new l.Vector3(1,1,1),v=new l.InstancedMesh(_.geometry,_.material,g);for(let C=0;C<g;C++)c.TRANSLATION&&x.fromBufferAttribute(c.TRANSLATION,C),c.ROTATION&&m.fromBufferAttribute(c.ROTATION,C),c.SCALE&&M.fromBufferAttribute(c.SCALE,C),v.setMatrixAt(C,y.compose(x,m,M));for(const C in c)if(C==="_COLOR_0"){const O=c[C];v.instanceColor=new l.InstancedBufferAttribute(O.array,O.itemSize,O.normalized)}else C!=="TRANSLATION"&&C!=="ROTATION"&&C!=="SCALE"&&_.geometry.setAttribute(C,c[C]);l.Object3D.prototype.copy.call(v,_),this.parser.assignFinalMaterial(v),p.push(v)}return d.isGroup?(d.clear(),d.add(...p),d):p[0]}))}}const wr="glTF",en=12,br={JSON:1313821514,BIN:5130562};class ka{constructor(e){this.name=xe.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,en);if(this.header={magic:Rt(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==wr)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-en,s=new DataView(e,en);let r=0;for(;r<n;){const i=s.getUint32(r,!0);r+=4;const a=s.getUint32(r,!0);if(r+=4,a===br.JSON){const c=new Uint8Array(e,en+r,i);this.content=Rt(c)}else if(a===br.BIN){const c=en+r;this.body=e.slice(c,c+i)}r+=i}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Fa{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,s=this.dracoLoader,r=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,a={},c={},h={};for(const d in i){const f=is[d]||d.toLowerCase();a[f]=i[d]}for(const d in e.attributes){const f=is[d]||d.toLowerCase();if(i[d]!==void 0){const g=n.accessors[e.attributes[d]],p=Gt[g.componentType];h[f]=p.name,c[f]=g.normalized===!0}}return t.getDependency("bufferView",r).then(function(d){return new Promise(function(f,g){s.decodeDracoFile(d,function(p){for(const _ in p.attributes){const y=p.attributes[_],x=c[_];x!==void 0&&(y.normalized=x)}f(p)},a,h,ct,g)})})}}class Ua{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 Na{constructor(){this.name=xe.KHR_MESH_QUANTIZATION}}class Mr extends l.Interpolant{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,r=e*s*3+s;for(let i=0;i!==s;i++)t[i]=n[r+i];return t}interpolate_(e,t,n,s){const r=this.resultBuffer,i=this.sampleValues,a=this.valueSize,c=a*2,h=a*3,d=s-t,f=(n-t)/d,g=f*f,p=g*f,_=e*h,y=_-h,x=-2*p+3*g,m=p-g,M=1-x,v=m-g+f;for(let C=0;C!==a;C++){const O=i[y+C+a],S=i[y+C+c]*d,A=i[_+C+a],b=i[_+C]*d;r[C]=M*O+v*S+x*A+m*b}return r}}const za=new l.Quaternion;class Va extends Mr{interpolate_(e,t,n,s){const r=super.interpolate_(e,t,n,s);return za.fromArray(r).normalize().toArray(r),r}}const qe={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},Gt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Sr={9728:l.NearestFilter,9729:l.LinearFilter,9984:l.NearestMipmapNearestFilter,9985:l.LinearMipmapNearestFilter,9986:l.NearestMipmapLinearFilter,9987:l.LinearMipmapLinearFilter},Ar={33071:l.ClampToEdgeWrapping,33648:l.MirroredRepeatWrapping,10497:l.RepeatWrapping},rs={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},is={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...Qt>=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"},xt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ra={CUBICSPLINE:void 0,LINEAR:l.InterpolateLinear,STEP:l.InterpolateDiscrete},os={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ga(o){return o.DefaultMaterial===void 0&&(o.DefaultMaterial=new l.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:l.FrontSide})),o.DefaultMaterial}function Lt(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 ut(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 ja(o,e,t){let n=!1,s=!1,r=!1;for(let h=0,d=e.length;h<d;h++){const f=e[h];if(f.POSITION!==void 0&&(n=!0),f.NORMAL!==void 0&&(s=!0),f.COLOR_0!==void 0&&(r=!0),n&&s&&r)break}if(!n&&!s&&!r)return Promise.resolve(o);const i=[],a=[],c=[];for(let h=0,d=e.length;h<d;h++){const f=e[h];if(n){const g=f.POSITION!==void 0?t.getDependency("accessor",f.POSITION):o.attributes.position;i.push(g)}if(s){const g=f.NORMAL!==void 0?t.getDependency("accessor",f.NORMAL):o.attributes.normal;a.push(g)}if(r){const g=f.COLOR_0!==void 0?t.getDependency("accessor",f.COLOR_0):o.attributes.color;c.push(g)}}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(c)]).then(function(h){const d=h[0],f=h[1],g=h[2];return n&&(o.morphAttributes.position=d),s&&(o.morphAttributes.normal=f),r&&(o.morphAttributes.color=g),o.morphTargetsRelative=!0,o})}function Ea(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,s=t.length;n<s;n++)o.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Ya(o){let e;const t=o.extensions&&o.extensions[xe.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+as(t.attributes):e=o.indices+":"+as(o.attributes)+":"+o.mode,o.targets!==void 0)for(let n=0,s=o.targets.length;n<s;n++)e+=":"+as(o.targets[n]);return e}function as(o){let e="";const t=Object.keys(o).sort();for(let n=0,s=t.length;n<s;n++)e+=t[n]+":"+o[t[n]]+";";return e}function ls(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 Wa(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 Xa=new l.Matrix4;class Za{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ma,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,r=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,r=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||s&&r<98?this.textureLoader=new l.TextureLoader(this.options.manager):this.textureLoader=new l.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new l.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,s=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(i){const a={scene:i[0][s.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:s.asset,parser:n,userData:{}};return Lt(r,a,s),ut(a,s),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(a)})).then(function(){for(const c of a.scenes)c.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const i=t[s].joints;for(let a=0,c=i.length;a<c;a++)e[i[a]].isBone=!0}for(let s=0,r=e.length;s<r;s++){const i=e[s];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(n[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const s=n.clone(),r=(i,a)=>{const c=this.associations.get(i);c!=null&&this.associations.set(a,c);for(const[h,d]of i.children.entries())r(d,a.children[h])};return r(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 r=e(t[s]);r&&n.push(r)}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(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":s=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.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(r,i){return n.getDependency(e,i)})),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 s=this.options;return new Promise(function(r,i){n.load(l.LoaderUtils.resolveURL(t.uri,s.path),r,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const s=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+s)})}loadAccessor(e){const t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){const i=rs[s.type],a=Gt[s.componentType],c=s.normalized===!0,h=new a(s.count*i);return Promise.resolve(new l.BufferAttribute(h,i,c))}const r=[];return s.bufferView!==void 0?r.push(this.getDependency("bufferView",s.bufferView)):r.push(null),s.sparse!==void 0&&(r.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(r).then(function(i){const a=i[0],c=rs[s.type],h=Gt[s.componentType],d=h.BYTES_PER_ELEMENT,f=d*c,g=s.byteOffset||0,p=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,_=s.normalized===!0;let y,x;if(p&&p!==f){const m=Math.floor(g/p),M="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+m+":"+s.count;let v=t.cache.get(M);v||(y=new h(a,m*p,s.count*p/d),v=new l.InterleavedBuffer(y,p/d),t.cache.add(M,v)),x=new l.InterleavedBufferAttribute(v,c,g%p/d,_)}else a===null?y=new h(s.count*c):y=new h(a,g,s.count*c),x=new l.BufferAttribute(y,c,_);if(s.sparse!==void 0){const m=rs.SCALAR,M=Gt[s.sparse.indices.componentType],v=s.sparse.indices.byteOffset||0,C=s.sparse.values.byteOffset||0,O=new M(i[1],v,s.sparse.count*m),S=new h(i[2],C,s.sparse.count*c);a!==null&&(x=new l.BufferAttribute(x.array.slice(),x.itemSize,x.normalized));for(let A=0,b=O.length;A<b;A++){const P=O[A];if(x.setX(P,S[A*c]),c>=2&&x.setY(P,S[A*c+1]),c>=3&&x.setZ(P,S[A*c+2]),c>=4&&x.setW(P,S[A*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(e){const t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r];let a=this.textureLoader;if(i.uri){const c=n.manager.getHandler(i.uri);c!==null&&(a=c)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){const s=this,r=this.json,i=r.textures[e],a=r.images[t],c=(a.uri||a.bufferView)+":"+i.sampler;if(this.textureCache[c])return this.textureCache[c];const h=this.loadImageSource(t,n).then(function(d){d.flipY=!1,d.name=i.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const g=(r.samplers||{})[i.sampler]||{};return d.magFilter=Sr[g.magFilter]||l.LinearFilter,d.minFilter=Sr[g.minFilter]||l.LinearMipmapLinearFilter,d.wrapS=Ar[g.wrapS]||l.RepeatWrapping,d.wrapT=Ar[g.wrapT]||l.RepeatWrapping,s.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[c]=h,h}loadImageSource(e,t){const n=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const i=s.images[e],a=self.URL||self.webkitURL;let c=i.uri||"",h=!1;if(i.bufferView!==void 0)c=n.getDependency("bufferView",i.bufferView).then(function(f){h=!0;const g=new Blob([f],{type:i.mimeType});return c=a.createObjectURL(g),c});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(c).then(function(f){return new Promise(function(g,p){let _=g;t.isImageBitmapLoader===!0&&(_=function(y){const x=new l.Texture(y);x.needsUpdate=!0,g(x)}),t.load(l.LoaderUtils.resolveURL(f,r.path),_,void 0,p)})}).then(function(f){return h===!0&&a.revokeObjectURL(c),ut(f,i),f.userData.mimeType=i.mimeType||Wa(i.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),f});return this.sourceCache[e]=d,d}assignTexture(e,t,n,s){const r=this;return this.getDependency("texture",n.index).then(function(i){if(!i)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(i=i.clone(),i.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 c=r.associations.get(i);i=r.extensions[xe.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),r.associations.set(i,c)}}return s!==void 0&&(typeof s=="number"&&(s=s===vr?Dt:ct),"colorSpace"in i?i.colorSpace=s:i.encoding=s===Dt?vr:da),e[t]=i,i})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,i=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new l.PointsMaterial,l.Material.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(a,c)),n=c}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let c=this.cache.get(a);c||(c=new l.LineBasicMaterial,l.Material.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(a,c)),n=c}if(s||r||i){let a="ClonedMaterial:"+n.uuid+":";s&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),i&&(a+="flat-shading:");let c=this.cache.get(a);c||(c=n.clone(),r&&(c.vertexColors=!0),i&&(c.flatShading=!0),s&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(a,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return l.MeshStandardMaterial}loadMaterial(e){const t=this,n=this.json,s=this.extensions,r=n.materials[e];let i;const a={},c=r.extensions||{},h=[];if(c[xe.KHR_MATERIALS_UNLIT]){const f=s[xe.KHR_MATERIALS_UNLIT];i=f.getMaterialType(),h.push(f.extendParams(a,r,t))}else{const f=r.pbrMetallicRoughness||{};if(a.color=new l.Color(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const g=f.baseColorFactor;a.color.setRGB(g[0],g[1],g[2],ct),a.opacity=g[3]}f.baseColorTexture!==void 0&&h.push(t.assignTexture(a,"map",f.baseColorTexture,Dt)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),h.push(t.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),i=this._invokeOne(function(g){return g.getMaterialType&&g.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(g){return g.extendMaterialParams&&g.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=l.DoubleSide);const d=r.alphaMode||os.OPAQUE;if(d===os.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===os.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&i!==l.MeshBasicMaterial&&(h.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new l.Vector2(1,1),r.normalTexture.scale!==void 0)){const f=r.normalTexture.scale;a.normalScale.set(f,f)}if(r.occlusionTexture!==void 0&&i!==l.MeshBasicMaterial&&(h.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&i!==l.MeshBasicMaterial){const f=r.emissiveFactor;a.emissive=new l.Color().setRGB(f[0],f[1],f[2],ct)}return r.emissiveTexture!==void 0&&i!==l.MeshBasicMaterial&&h.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,Dt)),Promise.all(h).then(function(){const f=new i(a);return r.name&&(f.name=r.name),ut(f,r),t.associations.set(f,{materials:e}),r.extensions&&Lt(s,f,r),f})}createUniqueName(e){const t=l.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,s=this.primitiveCache;function r(a){return n[xe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(c){return Cr(c,a,t)})}const i=[];for(let a=0,c=e.length;a<c;a++){const h=e[a],d=Ya(h),f=s[d];if(f)i.push(f.promise);else{let g;h.extensions&&h.extensions[xe.KHR_DRACO_MESH_COMPRESSION]?g=r(h):g=Cr(new l.BufferGeometry,h,t),s[d]={primitive:h,promise:g},i.push(g)}}return Promise.all(i)}loadMesh(e){const t=this,n=this.json,s=this.extensions,r=n.meshes[e],i=r.primitives,a=[];for(let c=0,h=i.length;c<h;c++){const d=i[c].material===void 0?Ga(this.cache):this.getDependency("material",i[c].material);a.push(d)}return a.push(t.loadGeometries(i)),Promise.all(a).then(function(c){const h=c.slice(0,c.length-1),d=c[c.length-1],f=[];for(let p=0,_=d.length;p<_;p++){const y=d[p],x=i[p];let m;const M=h[p];if(x.mode===qe.TRIANGLES||x.mode===qe.TRIANGLE_STRIP||x.mode===qe.TRIANGLE_FAN||x.mode===void 0)m=r.isSkinnedMesh===!0?new l.SkinnedMesh(y,M):new l.Mesh(y,M),m.isSkinnedMesh===!0&&m.normalizeSkinWeights(),x.mode===qe.TRIANGLE_STRIP?m.geometry=Js(m.geometry,l.TriangleStripDrawMode):x.mode===qe.TRIANGLE_FAN&&(m.geometry=Js(m.geometry,l.TriangleFanDrawMode));else if(x.mode===qe.LINES)m=new l.LineSegments(y,M);else if(x.mode===qe.LINE_STRIP)m=new l.Line(y,M);else if(x.mode===qe.LINE_LOOP)m=new l.LineLoop(y,M);else if(x.mode===qe.POINTS)m=new l.Points(y,M);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(m.geometry.morphAttributes).length>0&&Ea(m,r),m.name=t.createUniqueName(r.name||"mesh_"+e),ut(m,r),x.extensions&&Lt(s,m,x),t.assignFinalMaterial(m),f.push(m)}for(let p=0,_=f.length;p<_;p++)t.associations.set(f[p],{meshes:e,primitives:p});if(f.length===1)return r.extensions&&Lt(s,f[0],r),f[0];const g=new l.Group;r.extensions&&Lt(s,g,r),t.associations.set(g,{meshes:e});for(let p=0,_=f.length;p<_;p++)g.add(f[p]);return g})}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 l.PerspectiveCamera(l.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new l.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),ut(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let s=0,r=t.joints.length;s<r;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 r=s.pop(),i=s,a=[],c=[];for(let h=0,d=i.length;h<d;h++){const f=i[h];if(f){a.push(f);const g=new l.Matrix4;r!==null&&g.fromArray(r.array,h*16),c.push(g)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[h])}return new l.Skeleton(a,c)})}loadAnimation(e){const t=this.json,n=this,s=t.animations[e],r=s.name?s.name:"animation_"+e,i=[],a=[],c=[],h=[],d=[];for(let f=0,g=s.channels.length;f<g;f++){const p=s.channels[f],_=s.samplers[p.sampler],y=p.target,x=y.node,m=s.parameters!==void 0?s.parameters[_.input]:_.input,M=s.parameters!==void 0?s.parameters[_.output]:_.output;y.node!==void 0&&(i.push(this.getDependency("node",x)),a.push(this.getDependency("accessor",m)),c.push(this.getDependency("accessor",M)),h.push(_),d.push(y))}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(c),Promise.all(h),Promise.all(d)]).then(function(f){const g=f[0],p=f[1],_=f[2],y=f[3],x=f[4],m=[];for(let M=0,v=g.length;M<v;M++){const C=g[M],O=p[M],S=_[M],A=y[M],b=x[M];if(C===void 0)continue;C.updateMatrix&&C.updateMatrix();const P=n._createAnimationTracks(C,O,S,A,b);if(P)for(let w=0;w<P.length;w++)m.push(P[w])}return new l.AnimationClip(r,void 0,m)})}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(r){const i=n._getNodeRef(n.meshCache,s.mesh,r);return s.weights!==void 0&&i.traverse(function(a){if(a.isMesh)for(let c=0,h=s.weights.length;c<h;c++)a.morphTargetInfluences[c]=s.weights[c]}),i})}loadNode(e){const t=this.json,n=this,s=t.nodes[e],r=n._loadNodeShallow(e),i=[],a=s.children||[];for(let h=0,d=a.length;h<d;h++)i.push(n.getDependency("node",a[h]));const c=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([r,Promise.all(i),c]).then(function(h){const d=h[0],f=h[1],g=h[2];g!==null&&d.traverse(function(p){p.isSkinnedMesh&&p.bind(g,Xa)});for(let p=0,_=f.length;p<_;p++)d.add(f[p]);return d})}_loadNodeShallow(e){const t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],i=r.name?s.createUniqueName(r.name):"",a=[],c=s._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return c&&a.push(c),r.camera!==void 0&&a.push(s.getDependency("camera",r.camera).then(function(h){return s._getNodeRef(s.cameraCache,r.camera,h)})),s._invokeAll(function(h){return h.createNodeAttachment&&h.createNodeAttachment(e)}).forEach(function(h){a.push(h)}),this.nodeCache[e]=Promise.all(a).then(function(h){let d;if(r.isBone===!0?d=new l.Bone:h.length>1?d=new l.Group:h.length===1?d=h[0]:d=new l.Object3D,d!==h[0])for(let f=0,g=h.length;f<g;f++)d.add(h[f]);if(r.name&&(d.userData.name=r.name,d.name=i),ut(d,r),r.extensions&&Lt(n,d,r),r.matrix!==void 0){const f=new l.Matrix4;f.fromArray(r.matrix),d.applyMatrix4(f)}else r.translation!==void 0&&d.position.fromArray(r.translation),r.rotation!==void 0&&d.quaternion.fromArray(r.rotation),r.scale!==void 0&&d.scale.fromArray(r.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,r=new l.Group;n.name&&(r.name=s.createUniqueName(n.name)),ut(r,n),n.extensions&&Lt(t,r,n);const i=n.nodes||[],a=[];for(let c=0,h=i.length;c<h;c++)a.push(s.getDependency("node",i[c]));return Promise.all(a).then(function(c){for(let d=0,f=c.length;d<f;d++)r.add(c[d]);const h=d=>{const f=new Map;for(const[g,p]of s.associations)(g instanceof l.Material||g instanceof l.Texture)&&f.set(g,p);return d.traverse(g=>{const p=s.associations.get(g);p!=null&&f.set(g,p)}),f};return s.associations=h(r),r})}_createAnimationTracks(e,t,n,s,r){const i=[],a=e.name?e.name:e.uuid,c=[];xt[r.path]===xt.weights?e.traverse(function(g){g.morphTargetInfluences&&c.push(g.name?g.name:g.uuid)}):c.push(a);let h;switch(xt[r.path]){case xt.weights:h=l.NumberKeyframeTrack;break;case xt.rotation:h=l.QuaternionKeyframeTrack;break;case xt.position:case xt.scale:h=l.VectorKeyframeTrack;break;default:switch(n.itemSize){case 1:h=l.NumberKeyframeTrack;break;case 2:case 3:default:h=l.VectorKeyframeTrack;break}break}const d=s.interpolation!==void 0?Ra[s.interpolation]:l.InterpolateLinear,f=this._getArrayFromAccessor(n);for(let g=0,p=c.length;g<p;g++){const _=new h(c[g]+"."+xt[r.path],t.array,f,d);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(_),i.push(_)}return i}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=ls(t.constructor),s=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)s[r]=t[r]*n;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const s=this instanceof l.QuaternionKeyframeTrack?Va:Mr;return new s(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Ka(o,e,t){const n=e.attributes,s=new l.Box3;if(n.POSITION!==void 0){const a=t.json.accessors[n.POSITION],c=a.min,h=a.max;if(c!==void 0&&h!==void 0){if(s.set(new l.Vector3(c[0],c[1],c[2]),new l.Vector3(h[0],h[1],h[2])),a.normalized){const d=ls(Gt[a.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 r=e.targets;if(r!==void 0){const a=new l.Vector3,c=new l.Vector3;for(let h=0,d=r.length;h<d;h++){const f=r[h];if(f.POSITION!==void 0){const g=t.json.accessors[f.POSITION],p=g.min,_=g.max;if(p!==void 0&&_!==void 0){if(c.setX(Math.max(Math.abs(p[0]),Math.abs(_[0]))),c.setY(Math.max(Math.abs(p[1]),Math.abs(_[1]))),c.setZ(Math.max(Math.abs(p[2]),Math.abs(_[2]))),g.normalized){const y=ls(Gt[g.componentType]);c.multiplyScalar(y)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(a)}o.boundingBox=s;const i=new l.Sphere;s.getCenter(i.center),i.radius=s.min.distanceTo(s.max)/2,o.boundingSphere=i}function Cr(o,e,t){const n=e.attributes,s=[];function r(i,a){return t.getDependency("accessor",i).then(function(c){o.setAttribute(a,c)})}for(const i in n){const a=is[i]||i.toLowerCase();a in o.attributes||s.push(r(n[i],a))}if(e.indices!==void 0&&!o.index){const i=t.getDependency("accessor",e.indices).then(function(a){o.setIndex(a)});s.push(i)}return ut(o,e),Ka(o,e,t),Promise.all(s).then(function(){return e.targets!==void 0?ja(o,e.targets,t):o})}const tn=new l.Vector3;function Qe(o,e,t,n,s,r){const i=2*Math.PI*s/4,a=Math.max(r-2*s,0),c=Math.PI/4;tn.copy(e),tn[n]=0,tn.normalize();const h=.5*i/(i+a),d=1-tn.angleTo(o)/c;return Math.sign(tn[t])===1?d*h:a/(i+a)+h+h*(1-d)}class qa extends l.BoxGeometry{constructor(e=1,t=1,n=1,s=2,r=.1){if(s=s*2+1,r=Math.min(e/2,t/2,n/2,r),super(1,1,1,s,s,s),s===1)return;const i=this.toNonIndexed();this.index=null,this.attributes.position=i.attributes.position,this.attributes.normal=i.attributes.normal,this.attributes.uv=i.attributes.uv;const a=new l.Vector3,c=new l.Vector3,h=new l.Vector3(e,t,n).divideScalar(2).subScalar(r),d=this.attributes.position.array,f=this.attributes.normal.array,g=this.attributes.uv.array,p=d.length/6,_=new l.Vector3,y=.5/s;for(let x=0,m=0;x<d.length;x+=3,m+=2)switch(a.fromArray(d,x),c.copy(a),c.x-=Math.sign(c.x)*y,c.y-=Math.sign(c.y)*y,c.z-=Math.sign(c.z)*y,c.normalize(),d[x+0]=h.x*Math.sign(a.x)+c.x*r,d[x+1]=h.y*Math.sign(a.y)+c.y*r,d[x+2]=h.z*Math.sign(a.z)+c.z*r,f[x+0]=c.x,f[x+1]=c.y,f[x+2]=c.z,Math.floor(x/p)){case 0:_.set(1,0,0),g[m+0]=Qe(_,c,"z","y",r,n),g[m+1]=1-Qe(_,c,"y","z",r,t);break;case 1:_.set(-1,0,0),g[m+0]=1-Qe(_,c,"z","y",r,n),g[m+1]=1-Qe(_,c,"y","z",r,t);break;case 2:_.set(0,1,0),g[m+0]=1-Qe(_,c,"x","z",r,e),g[m+1]=Qe(_,c,"z","x",r,n);break;case 3:_.set(0,-1,0),g[m+0]=1-Qe(_,c,"x","z",r,e),g[m+1]=1-Qe(_,c,"z","x",r,n);break;case 4:_.set(0,0,1),g[m+0]=1-Qe(_,c,"x","y",r,e),g[m+1]=1-Qe(_,c,"y","x",r,t);break;case 5:_.set(0,0,-1),g[m+0]=Qe(_,c,"x","y",r,e),g[m+1]=1-Qe(_,c,"y","x",r,t);break}}}class Pr extends l.ExtrudeGeometry{constructor(e,t={}){const{bevelEnabled:n=!1,bevelSize:s=8,bevelThickness:r=10,font:i,height:a=50,size:c=100,lineHeight:h=1,letterSpacing:d=0,...f}=t;if(i===void 0)super();else{const g=i.generateShapes(e,c,{lineHeight:h,letterSpacing:d});super(g,{...f,bevelEnabled:n,bevelSize:s,bevelThickness:r,depth:a})}this.type="TextGeometry"}}const Qa={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
|
325
325
|
varying vec2 vUv;
|
|
326
326
|
|
|
327
327
|
void main() {
|
|
@@ -386,13 +386,13 @@
|
|
|
386
386
|
gl_FragColor = sum;
|
|
387
387
|
|
|
388
388
|
}
|
|
389
|
-
`};function Tr(o,e,t){const n=t.length-o-1;if(e>=t[n])return n-1;if(e<=t[o])return o;let s=o,r=n,i=Math.floor((s+r)/2);for(;e<t[i]||e>=t[i+1];)e<t[i]?r=i:s=i,i=Math.floor((s+r)/2);return i}function Ha(o,e,t,n){const s=[],r=[],i=[];s[0]=1;for(let a=1;a<=t;++a){r[a]=e-n[o+1-a],i[a]=n[o+a]-e;let c=0;for(let h=0;h<a;++h){const d=i[h+1],f=r[a-h],y=s[h]/(d+f);s[h]=c+d*y,c=f*y}s[a]=c}return s}function $a(o,e,t,n){const s=Tr(o,n,e),r=Ha(s,n,o,e),i=new l.Vector4(0,0,0,0);for(let a=0;a<=o;++a){const c=t[s-o+a],h=r[a],d=c.w*h;i.x+=c.x*d,i.y+=c.y*d,i.z+=c.z*d,i.w+=c.w*h}return i}function el(o,e,t,n,s){const r=[];for(let f=0;f<=t;++f)r[f]=0;const i=[];for(let f=0;f<=n;++f)i[f]=r.slice(0);const a=[];for(let f=0;f<=t;++f)a[f]=r.slice(0);a[0][0]=1;const c=r.slice(0),h=r.slice(0);for(let f=1;f<=t;++f){c[f]=e-s[o+1-f],h[f]=s[o+f]-e;let y=0;for(let p=0;p<f;++p){const _=h[p+1],g=c[f-p];a[f][p]=_+g;const x=a[p][f-1]/a[f][p];a[p][f]=y+_*x,y=g*x}a[f][f]=y}for(let f=0;f<=t;++f)i[0][f]=a[f][t];for(let f=0;f<=t;++f){let y=0,p=1;const _=[];for(let g=0;g<=t;++g)_[g]=r.slice(0);_[0][0]=1;for(let g=1;g<=n;++g){let x=0;const m=f-g,M=t-g;f>=g&&(_[p][0]=_[y][0]/a[M+1][m],x=_[p][0]*a[m][M]);const v=m>=-1?1:-m,C=f-1<=M?g-1:t-f;for(let S=v;S<=C;++S)_[p][S]=(_[y][S]-_[y][S-1])/a[M+1][m+S],x+=_[p][S]*a[m+S][M];f<=M&&(_[p][g]=-_[y][g-1]/a[M+1][f],x+=_[p][g]*a[f][M]),i[g][f]=x;const O=y;y=p,p=O}}let d=t;for(let f=1;f<=n;++f){for(let y=0;y<=t;++y)i[f][y]*=d;d*=t-f}return i}function tl(o,e,t,n,s){const r=s<o?s:o,i=[],a=Tr(o,n,e),c=el(a,n,o,r,e),h=[];for(let d=0;d<t.length;++d){const f=t[d].clone(),y=f.w;f.x*=y,f.y*=y,f.z*=y,h[d]=f}for(let d=0;d<=r;++d){const f=h[a-o].clone().multiplyScalar(c[d][0]);for(let y=1;y<=o;++y)f.add(h[a-o+y].clone().multiplyScalar(c[d][y]));i[d]=f}for(let d=r+1;d<=s+1;++d)i[d]=new l.Vector4(0,0,0);return i}function nl(o,e){let t=1;for(let s=2;s<=o;++s)t*=s;let n=1;for(let s=2;s<=e;++s)n*=s;for(let s=2;s<=o-e;++s)n*=s;return t/n}function sl(o){const e=o.length,t=[],n=[];for(let r=0;r<e;++r){const i=o[r];t[r]=new l.Vector3(i.x,i.y,i.z),n[r]=i.w}const s=[];for(let r=0;r<e;++r){const i=t[r].clone();for(let a=1;a<=r;++a)i.sub(s[r-a].clone().multiplyScalar(nl(r,a)*n[a]));s[r]=i.divideScalar(n[0])}return s}function rl(o,e,t,n,s){const r=tl(o,e,t,n,s);return sl(r)}class Ir extends l.Curve{constructor(e,t,n,s,r){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=s||0,this.endKnot=r||this.knots.length-1;for(let i=0;i<n.length;++i){const a=n[i];this.controlPoints[i]=new l.Vector4(a.x,a.y,a.z,a.w)}}getPoint(e,t){const n=t||new l.Vector3,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),r=$a(this.degree,this.knots,this.controlPoints,s);return r.w!=1&&r.divideScalar(r.w),n.set(r.x,r.y,r.z)}getTangent(e,t){const n=t||new l.Vector3,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),r=rl(this.degree,this.knots,this.controlPoints,s,1);return n.copy(r[1]).normalize(),n}}let ve,Le,je;class il extends l.Loader{constructor(e){super(e)}load(e,t,n,s){const r=this,i=r.path===""?l.LoaderUtils.extractUrlBase(e):r.path,a=new l.FileLoader(this.manager);a.setPath(r.path),a.setResponseType("arraybuffer"),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(c){try{t(r.parse(c,i))}catch(h){s?s(h):console.error(h),r.manager.itemError(e)}},n,s)}parse(e,t){if(hl(e))ve=new ul().parse(e);else{const s=Fr(e);if(!fl(s))throw new Error("THREE.FBXLoader: Unknown format.");if(Lr(s)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Lr(s));ve=new cl().parse(s)}const n=new l.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new ol(n,this.manager).parse(ve)}}class ol{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Le=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),s=this.parseDeformers(),r=new al().parse(s);return this.parseScene(s,r,n),je}parseConnections(){const e=new Map;return"Connections"in ve&&ve.Connections.connections.forEach(function(n){const s=n[0],r=n[1],i=n[2];e.has(s)||e.set(s,{parents:[],children:[]});const a={ID:r,relationship:i};e.get(s).parents.push(a),e.has(r)||e.set(r,{parents:[],children:[]});const c={ID:s,relationship:i};e.get(r).children.push(c)}),e}parseImages(){const e={},t={};if("Video"in ve.Objects){const n=ve.Objects.Video;for(const s in n){const r=n[s],i=parseInt(s);if(e[i]=r.RelativeFilename||r.Filename,"Content"in r){const a=r.Content instanceof ArrayBuffer&&r.Content.byteLength>0,c=typeof r.Content=="string"&&r.Content!=="";if(a||c){const h=this.parseImage(n[s]);t[r.RelativeFilename||r.Filename]=h}}}}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 r;switch(s){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 "'+s+'" is not supported.');return}if(typeof t=="string")return"data:"+r+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:r}))}}parseTextures(e){const t=new Map;if("Texture"in ve.Objects){const n=ve.Objects.Texture;for(const s in n){const r=this.parseTexture(n[s],e);t.set(parseInt(s),r)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const s=e.WrapModeU,r=e.WrapModeV,i=s!==void 0?s.value:0,a=r!==void 0?r.value:0;if(n.wrapS=i===0?l.RepeatWrapping:l.ClampToEdgeWrapping,n.wrapT=a===0?l.RepeatWrapping:l.ClampToEdgeWrapping,"Scaling"in e){const c=e.Scaling.value;n.repeat.x=c[0],n.repeat.y=c[1]}return n}loadTexture(e,t){let n;const s=this.textureLoader.path,r=Le.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 i;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const c=this.manager.getHandler(".tga");c===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new l.Texture):(c.setPath(this.textureLoader.path),i=c.load(n))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new l.Texture):i=this.textureLoader.load(n);return this.textureLoader.setPath(s),i}parseMaterials(e){const t=new Map;if("Material"in ve.Objects){const n=ve.Objects.Material;for(const s in n){const r=this.parseMaterial(n[s],e);r!==null&&t.set(parseInt(s),r)}}return t}parseMaterial(e,t){const n=e.id,s=e.attrName;let r=e.ShadingModel;if(typeof r=="object"&&(r=r.value),!Le.has(n))return null;const i=this.parseParameters(e,t,n);let a;switch(r.toLowerCase()){case"phong":a=new l.MeshPhongMaterial;break;case"lambert":a=new l.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),a=new l.MeshPhongMaterial;break}return a.setValues(i),a.name=s,a}parseParameters(e,t,n){const s={};e.BumpFactor&&(s.bumpScale=e.BumpFactor.value),e.Diffuse?s.color=new l.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(s.color=new l.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(s.displacementScale=e.DisplacementFactor.value),e.Emissive?s.emissive=new l.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(s.emissive=new l.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 l.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(s.specular=new l.Color().fromArray(e.SpecularColor.value));const r=this;return Le.get(n).children.forEach(function(i){const a=i.relationship;switch(a){case"Bump":s.bumpMap=r.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":s.aoMap=r.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":s.map=r.getTexture(t,i.ID),s.map!==void 0&&("colorSpace"in s.map?s.map.colorSpace="srgb":s.map.encoding=3001);break;case"DisplacementColor":s.displacementMap=r.getTexture(t,i.ID);break;case"EmissiveColor":s.emissiveMap=r.getTexture(t,i.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=r.getTexture(t,i.ID);break;case"ReflectionColor":s.envMap=r.getTexture(t,i.ID),s.envMap!==void 0&&(s.envMap.mapping=l.EquirectangularReflectionMapping,"colorSpace"in s.envMap?s.envMap.colorSpace="srgb":s.envMap.encoding=3001);break;case"SpecularColor":s.specularMap=r.getTexture(t,i.ID),s.specularMap!==void 0&&("colorSpace"in s.specularMap?s.specularMap.colorSpace="srgb":s.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":s.alphaMap=r.getTexture(t,i.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.",a);break}}),s}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=Le.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in ve.Objects){const n=ve.Objects.Deformer;for(const s in n){const r=n[s],i=Le.get(parseInt(s));if(r.attrType==="Skin"){const a=this.parseSkeleton(i,n);a.ID=s,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=i.parents[0].ID,e[s]=a}else if(r.attrType==="BlendShape"){const a={id:s};a.rawTargets=this.parseMorphTargets(i,n),a.id=s,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[s]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(s){const r=t[s.ID];if(r.attrType!=="Cluster")return;const i={ID:s.ID,indices:[],weights:[],transformLink:new l.Matrix4().fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let s=0;s<e.children.length;s++){const r=e.children[s],i=t[r.ID],a={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if(i.attrType!=="BlendShapeChannel")return;a.geoID=Le.get(parseInt(r.ID)).children.filter(function(c){return c.relationship===void 0})[0].ID,n.push(a)}return n}parseScene(e,t,n){je=new l.Group;const s=this.parseModels(e.skeletons,t,n),r=ve.Objects.Model,i=this;s.forEach(function(c){const h=r[c.ID];i.setLookAtProperties(c,h),Le.get(c.ID).parents.forEach(function(f){const y=s.get(f.ID);y!==void 0&&y.add(c)}),c.parent===null&&je.add(c)}),this.bindSkeleton(e.skeletons,t,s),this.createAmbientLight(),je.traverse(function(c){if(c.userData.transformData){c.parent&&(c.userData.transformData.parentMatrix=c.parent.matrix,c.userData.transformData.parentMatrixWorld=c.parent.matrixWorld);const h=Br(c.userData.transformData);c.applyMatrix4(h),c.updateWorldMatrix()}});const a=new ll().parse();je.children.length===1&&je.children[0].isGroup&&(je.children[0].animations=a,je=je.children[0]),je.animations=a}parseModels(e,t,n){const s=new Map,r=ve.Objects.Model;for(const i in r){const a=parseInt(i),c=r[i],h=Le.get(a);let d=this.buildSkeleton(h,e,a,c.attrName);if(!d){switch(c.attrType){case"Camera":d=this.createCamera(h);break;case"Light":d=this.createLight(h);break;case"Mesh":d=this.createMesh(h,t,n);break;case"NurbsCurve":d=this.createCurve(h,t);break;case"LimbNode":case"Root":d=new l.Bone;break;case"Null":default:d=new l.Group;break}d.name=c.attrName?l.PropertyBinding.sanitizeNodeName(c.attrName):"",d.ID=a}this.getTransformData(d,c),s.set(a,d)}return s}buildSkeleton(e,t,n,s){let r=null;return e.parents.forEach(function(i){for(const a in t){const c=t[a];c.rawBones.forEach(function(h,d){if(h.ID===i.ID){const f=r;r=new l.Bone,r.matrixWorld.copy(h.transformLink),r.name=s?l.PropertyBinding.sanitizeNodeName(s):"",r.ID=n,c.bones[d]=r,f!==null&&r.add(f)}})}}),r}createCamera(e){let t,n;if(e.children.forEach(function(s){const r=ve.Objects.NodeAttribute[s.ID];r!==void 0&&(n=r)}),n===void 0)t=new l.Object3D;else{let s=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(s=1);let r=1;n.NearPlane!==void 0&&(r=n.NearPlane.value/1e3);let i=1e3;n.FarPlane!==void 0&&(i=n.FarPlane.value/1e3);let a=window.innerWidth,c=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(a=n.AspectWidth.value,c=n.AspectHeight.value);const h=a/c;let d=45;n.FieldOfView!==void 0&&(d=n.FieldOfView.value);const f=n.FocalLength?n.FocalLength.value:null;switch(s){case 0:t=new l.PerspectiveCamera(d,h,r,i),f!==null&&t.setFocalLength(f);break;case 1:t=new l.OrthographicCamera(-a/2,a/2,c/2,-c/2,r,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),t=new l.Object3D;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(s){const r=ve.Objects.NodeAttribute[s.ID];r!==void 0&&(n=r)}),n===void 0)t=new l.Object3D;else{let s;n.LightType===void 0?s=0:s=n.LightType.value;let r=16777215;n.Color!==void 0&&(r=new l.Color().fromArray(n.Color.value));let i=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(i=0);let a=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?a=0:a=n.FarAttenuationEnd.value);const c=1;switch(s){case 0:t=new l.PointLight(r,i,a,c);break;case 1:t=new l.DirectionalLight(r,i);break;case 2:let h=Math.PI/3;n.InnerAngle!==void 0&&(h=l.MathUtils.degToRad(n.InnerAngle.value));let d=0;n.OuterAngle!==void 0&&(d=l.MathUtils.degToRad(n.OuterAngle.value),d=Math.max(d,1)),t=new l.SpotLight(r,i,a,h,d,c);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new l.PointLight(r,i);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let s,r=null,i=null;const a=[];return e.children.forEach(function(c){t.has(c.ID)&&(r=t.get(c.ID)),n.has(c.ID)&&a.push(n.get(c.ID))}),a.length>1?i=a:a.length>0?i=a[0]:(i=new l.MeshPhongMaterial({color:13421772}),a.push(i)),"color"in r.attributes&&a.forEach(function(c){c.vertexColors=!0}),r.FBX_Deformer?(s=new l.SkinnedMesh(r,i),s.normalizeSkinWeights()):s=new l.Mesh(r,i),s}createCurve(e,t){const n=e.children.reduce(function(r,i){return t.has(i.ID)&&(r=t.get(i.ID)),r},null),s=new l.LineBasicMaterial({color:3342591,linewidth:1});return new l.Line(n,s)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=kr(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&&Le.get(e.ID).children.forEach(function(s){if(s.relationship==="LookAtProperty"){const r=ve.Objects.Model[s.ID];if("Lcl_Translation"in r){const i=r.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),je.add(e.target)):e.lookAt(new l.Vector3().fromArray(i))}}})}bindSkeleton(e,t,n){const s=this.parsePoseNodes();for(const r in e){const i=e[r];Le.get(parseInt(i.ID)).parents.forEach(function(c){if(t.has(c.ID)){const h=c.ID;Le.get(h).parents.forEach(function(f){n.has(f.ID)&&n.get(f.ID).bind(new l.Skeleton(i.bones),s[f.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 s=t[n].PoseNode;Array.isArray(s)?s.forEach(function(r){e[r.Node]=new l.Matrix4().fromArray(r.Matrix.a)}):e[s.Node]=new l.Matrix4().fromArray(s.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],s=e[2];if(t!==0||n!==0||s!==0){const r=new l.Color(t,n,s);je.add(new l.AmbientLight(r,1))}}}}class al{parse(e){const t=new Map;if("Geometry"in ve.Objects){const n=ve.Objects.Geometry;for(const s in n){const r=Le.get(parseInt(s)),i=this.parseGeometry(r,n[s],e);t.set(parseInt(s),i)}}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,r=[],i=e.parents.map(function(f){return ve.Objects.Model[f.ID]});if(i.length===0)return;const a=e.children.reduce(function(f,y){return s[y.ID]!==void 0&&(f=s[y.ID]),f},null);e.children.forEach(function(f){n.morphTargets[f.ID]!==void 0&&r.push(n.morphTargets[f.ID])});const c=i[0],h={};"RotationOrder"in c&&(h.eulerOrder=kr(c.RotationOrder.value)),"InheritType"in c&&(h.inheritType=parseInt(c.InheritType.value)),"GeometricTranslation"in c&&(h.translation=c.GeometricTranslation.value),"GeometricRotation"in c&&(h.rotation=c.GeometricRotation.value),"GeometricScaling"in c&&(h.scale=c.GeometricScaling.value);const d=Br(h);return this.genGeometry(t,a,r,d)}genGeometry(e,t,n,s){const r=new l.BufferGeometry;e.attrName&&(r.name=e.attrName);const i=this.parseGeoNode(e,t),a=this.genBuffers(i),c=new l.Float32BufferAttribute(a.vertex,3);if(c.applyMatrix4(s),r.setAttribute("position",c),a.colors.length>0&&r.setAttribute("color",new l.Float32BufferAttribute(a.colors,3)),t&&(r.setAttribute("skinIndex",new l.Uint16BufferAttribute(a.weightsIndices,4)),r.setAttribute("skinWeight",new l.Float32BufferAttribute(a.vertexWeights,4)),r.FBX_Deformer=t),a.normal.length>0){const h=new l.Matrix3().getNormalMatrix(s),d=new l.Float32BufferAttribute(a.normal,3);d.applyNormalMatrix(h),r.setAttribute("normal",d)}if(a.uvs.forEach(function(h,d){ao==="uv2"&&d++;const f=d===0?"uv":`uv${d}`;r.setAttribute(f,new l.Float32BufferAttribute(a.uvs[d],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=a.materialIndex[0],d=0;if(a.materialIndex.forEach(function(f,y){f!==h&&(r.addGroup(d,y-d,h),h=f,d=y)}),r.groups.length>0){const f=r.groups[r.groups.length-1],y=f.start+f.count;y!==a.materialIndex.length&&r.addGroup(y,a.materialIndex.length-y,h)}r.groups.length===0&&r.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(r,e,n,s),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 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,r){s.indices.forEach(function(i,a){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:r,weight:s.weights[a]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,s=0,r=!1,i=[],a=[],c=[],h=[],d=[],f=[];const y=this;return e.vertexIndices.forEach(function(p,_){let g,x=!1;p<0&&(p=p^-1,x=!0);let m=[],M=[];if(i.push(p*3,p*3+1,p*3+2),e.color){const v=Cn(_,n,p,e.color);c.push(v[0],v[1],v[2])}if(e.skeleton){if(e.weightTable[p]!==void 0&&e.weightTable[p].forEach(function(v){M.push(v.weight),m.push(v.id)}),M.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const v=[0,0,0,0],C=[0,0,0,0];M.forEach(function(O,S){let A=O,b=m[S];C.forEach(function(P,w,D){if(A>P){D[w]=A,A=P;const L=v[w];v[w]=b,b=L}})}),m=v,M=C}for(;M.length<4;)M.push(0),m.push(0);for(let v=0;v<4;++v)d.push(M[v]),f.push(m[v])}if(e.normal){const v=Cn(_,n,p,e.normal);a.push(v[0],v[1],v[2])}e.material&&e.material.mappingType!=="AllSame"&&(g=Cn(_,n,p,e.material)[0]),e.uv&&e.uv.forEach(function(v,C){const O=Cn(_,n,p,v);h[C]===void 0&&(h[C]=[]),h[C].push(O[0]),h[C].push(O[1])}),s++,x&&(y.genFace(t,e,i,g,a,c,h,d,f,s),n++,s=0,i=[],a=[],c=[],h=[],d=[],f=[])}),t}genFace(e,t,n,s,r,i,a,c,h,d){for(let f=2;f<d;f++)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[(f-1)*3]]),e.vertex.push(t.vertexPositions[n[(f-1)*3+1]]),e.vertex.push(t.vertexPositions[n[(f-1)*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),t.skeleton&&(e.vertexWeights.push(c[0]),e.vertexWeights.push(c[1]),e.vertexWeights.push(c[2]),e.vertexWeights.push(c[3]),e.vertexWeights.push(c[(f-1)*4]),e.vertexWeights.push(c[(f-1)*4+1]),e.vertexWeights.push(c[(f-1)*4+2]),e.vertexWeights.push(c[(f-1)*4+3]),e.vertexWeights.push(c[f*4]),e.vertexWeights.push(c[f*4+1]),e.vertexWeights.push(c[f*4+2]),e.vertexWeights.push(c[f*4+3]),e.weightsIndices.push(h[0]),e.weightsIndices.push(h[1]),e.weightsIndices.push(h[2]),e.weightsIndices.push(h[3]),e.weightsIndices.push(h[(f-1)*4]),e.weightsIndices.push(h[(f-1)*4+1]),e.weightsIndices.push(h[(f-1)*4+2]),e.weightsIndices.push(h[(f-1)*4+3]),e.weightsIndices.push(h[f*4]),e.weightsIndices.push(h[f*4+1]),e.weightsIndices.push(h[f*4+2]),e.weightsIndices.push(h[f*4+3])),t.color&&(e.colors.push(i[0]),e.colors.push(i[1]),e.colors.push(i[2]),e.colors.push(i[(f-1)*3]),e.colors.push(i[(f-1)*3+1]),e.colors.push(i[(f-1)*3+2]),e.colors.push(i[f*3]),e.colors.push(i[f*3+1]),e.colors.push(i[f*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(r[0]),e.normal.push(r[1]),e.normal.push(r[2]),e.normal.push(r[(f-1)*3]),e.normal.push(r[(f-1)*3+1]),e.normal.push(r[(f-1)*3+2]),e.normal.push(r[f*3]),e.normal.push(r[f*3+1]),e.normal.push(r[f*3+2])),t.uv&&t.uv.forEach(function(y,p){e.uvs[p]===void 0&&(e.uvs[p]=[]),e.uvs[p].push(a[p][0]),e.uvs[p].push(a[p][1]),e.uvs[p].push(a[p][(f-1)*2]),e.uvs[p].push(a[p][(f-1)*2+1]),e.uvs[p].push(a[p][f*2]),e.uvs[p].push(a[p][f*2+1])})}addMorphTargets(e,t,n,s){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const r=this;n.forEach(function(i){i.rawTargets.forEach(function(a){const c=ve.Objects.Geometry[a.geoID];c!==void 0&&r.genMorphGeometry(e,t,c,s,a.name)})})}genMorphGeometry(e,t,n,s,r){const i=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],a=n.Vertices!==void 0?n.Vertices.a:[],c=n.Indexes!==void 0?n.Indexes.a:[],h=e.attributes.position.count*3,d=new Float32Array(h);for(let _=0;_<c.length;_++){const g=c[_]*3;d[g]=a[_*3],d[g+1]=a[_*3+1],d[g+2]=a[_*3+2]}const f={vertexIndices:i,vertexPositions:d},y=this.genBuffers(f),p=new l.Float32BufferAttribute(y.vertex,3);p.name=r||n.attrName,p.applyMatrix4(s),e.morphAttributes.position.push(p)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=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:s,indices:r,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.UV.a;let r=[];return n==="IndexToDirect"&&(r=e.UVIndex.a),{dataSize:2,buffer:s,indices:r,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.Colors.a;let r=[];return n==="IndexToDirect"&&(r=e.ColorIndex.a),{dataSize:4,buffer:s,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 s=e.Materials.a,r=[];for(let i=0;i<s.length;++i)r.push(i);return{dataSize:1,buffer:s,indices:r,mappingType:t,referenceType:n}}parseNurbsGeometry(e){if(Ir===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new l.BufferGeometry;const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new l.BufferGeometry;const n=t-1,s=e.KnotVector.a,r=[],i=e.Points.a;for(let f=0,y=i.length;f<y;f+=4)r.push(new l.Vector4().fromArray(i,f));let a,c;if(e.Form==="Closed")r.push(r[0]);else if(e.Form==="Periodic"){a=n,c=s.length-1-a;for(let f=0;f<n;++f)r.push(r[f])}const d=new Ir(n,s,r,a,c).getPoints(r.length*12);return new l.BufferGeometry().setFromPoints(d)}}class ll{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const s=t[n],r=this.addClip(s);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 s=e[n];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){const r={id:s.id,attr:s.attrName,curves:{}};t.set(r.id,r)}}return t}parseAnimationCurves(e){const t=ve.Objects.AnimationCurve;for(const n in t){const s={id:t[n].id,times:t[n].KeyTime.a.map(dl),values:t[n].KeyValueFloat.a},r=Le.get(s.id);if(r!==void 0){const i=r.parents[0].ID,a=r.parents[0].relationship;a.match(/X/)?e.get(i).curves.x=s:a.match(/Y/)?e.get(i).curves.y=s:a.match(/Z/)?e.get(i).curves.z=s:a.match(/d|DeformPercent/)&&e.has(i)&&(e.get(i).curves.morph=s)}}}parseAnimationLayers(e){const t=ve.Objects.AnimationLayer,n=new Map;for(const s in t){const r=[],i=Le.get(parseInt(s));i!==void 0&&(i.children.forEach(function(c,h){if(e.has(c.ID)){const d=e.get(c.ID);if(d.curves.x!==void 0||d.curves.y!==void 0||d.curves.z!==void 0){if(r[h]===void 0){const f=Le.get(c.ID).parents.filter(function(y){return y.relationship!==void 0})[0].ID;if(f!==void 0){const y=ve.Objects.Model[f.toString()];if(y===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",c);return}const p={modelName:y.attrName?l.PropertyBinding.sanitizeNodeName(y.attrName):"",ID:y.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};je.traverse(function(_){_.ID===y.id&&(p.transform=_.matrix,_.userData.transformData&&(p.eulerOrder=_.userData.transformData.eulerOrder))}),p.transform||(p.transform=new l.Matrix4),"PreRotation"in y&&(p.preRotation=y.PreRotation.value),"PostRotation"in y&&(p.postRotation=y.PostRotation.value),r[h]=p}}r[h]&&(r[h][d.attr]=d)}else if(d.curves.morph!==void 0){if(r[h]===void 0){const f=Le.get(c.ID).parents.filter(function(m){return m.relationship!==void 0})[0].ID,y=Le.get(f).parents[0].ID,p=Le.get(y).parents[0].ID,_=Le.get(p).parents[0].ID,g=ve.Objects.Model[_],x={modelName:g.attrName?l.PropertyBinding.sanitizeNodeName(g.attrName):"",morphName:ve.Objects.Deformer[f].attrName};r[h]=x}r[h][d.attr]=d}}}),n.set(parseInt(s),r))}return n}parseAnimStacks(e){const t=ve.Objects.AnimationStack,n={};for(const s in t){const r=Le.get(parseInt(s)).children;r.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(r[0].ID);n[s]={name:t[s].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(s){t=t.concat(n.generateTracks(s))}),new l.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let n=new l.Vector3,s=new l.Quaternion,r=new l.Vector3;if(e.transform&&e.transform.decompose(n,s,r),n=n.toArray(),s=new l.Euler().setFromQuaternion(s,e.eulerOrder).toArray(),r=r.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,s,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,r,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,s){const r=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(r,t,n);return new l.VectorKeyframeTrack(e+"."+s,r,i)}generateRotationTrack(e,t,n,s,r,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(l.MathUtils.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(l.MathUtils.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(l.MathUtils.degToRad));const a=this.getTimesForAllAxes(t),c=this.getKeyframeTrackValues(a,t,n);s!==void 0&&(s=s.map(l.MathUtils.degToRad),s.push(i),s=new l.Euler().fromArray(s),s=new l.Quaternion().setFromEuler(s)),r!==void 0&&(r=r.map(l.MathUtils.degToRad),r.push(i),r=new l.Euler().fromArray(r),r=new l.Quaternion().setFromEuler(r).invert());const h=new l.Quaternion,d=new l.Euler,f=[];for(let y=0;y<c.length;y+=3)d.set(c[y],c[y+1],c[y+2],i),h.setFromEuler(d),s!==void 0&&h.premultiply(s),r!==void 0&&h.multiply(r),h.toArray(f,y/3*4);return new l.QuaternionKeyframeTrack(e+".quaternion",a,f)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(r){return r/100}),s=je.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new l.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 r=1;r<t.length;r++){const i=t[r];i!==s&&(t[n]=i,s=i,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const s=n,r=[];let i=-1,a=-1,c=-1;return e.forEach(function(h){if(t.x&&(i=t.x.times.indexOf(h)),t.y&&(a=t.y.times.indexOf(h)),t.z&&(c=t.z.times.indexOf(h)),i!==-1){const d=t.x.values[i];r.push(d),s[0]=d}else r.push(s[0]);if(a!==-1){const d=t.y.values[a];r.push(d),s[1]=d}else r.push(s[1]);if(c!==-1){const d=t.z.values[c];r.push(d),s[2]=d}else r.push(s[2])}),r}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const n=e.values[t-1],s=e.values[t]-n,r=Math.abs(s);if(r>=180){const i=r/180,a=s/i;let c=n+a;const h=e.times[t-1],f=(e.times[t]-h)/i;let y=h+f;const p=[],_=[];for(;y<e.times[t];)p.push(y),y+=f,_.push(c),c+=a;e.times=Ur(e.times,t,p),e.values=Ur(e.values,t,_)}}}}class cl{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 Dr,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(s,r){const i=s.match(/^[\s\t]*;/),a=s.match(/^[\s\t]*$/);if(i||a)return;const c=s.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),h=s.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),d=s.match("^\\t{"+(t.currentIndent-1)+"}}");c?t.parseNodeBegin(s,c):h?t.parseNodeProperty(s,h,n[++r]):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(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),r={name:n},i=this.parseNodeAttr(s),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]),i.id!==""&&(a[n][i.id]=r)):typeof i.id=="number"?(a[n]={},a[n][i.id]=r):n!=="Properties70"&&(n==="PoseNode"?a[n]=[r]:a[n]=r),typeof i.id=="number"&&(r.id=i.id),i.name!==""&&(r.attrName=i.name),i.type!==""&&(r.attrType=i.type),this.pushStack(r)}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(),r=t[2].replace(/^"/,"").replace(/"$/,"").trim();s==="Content"&&r===","&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,s,r);return}if(s==="C"){const c=r.split(",").slice(1),h=parseInt(c[0]),d=parseInt(c[1]);let f=r.split(",").slice(3);f=f.map(function(y){return y.trim().replace(/^"/,"")}),s="connections",r=[h,d],ml(r,f),i[s]===void 0&&(i[s]=[])}s==="Node"&&(i.id=r),s in i&&Array.isArray(i[s])?i[s].push(r):s!=="a"?i[s]=r:i.a=r,this.setCurrentProp(i,s),s==="a"&&r.slice(-1)!==","&&(i.a=us(r))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=us(t.a))}parseNodeSpecialProperty(e,t,n){const s=n.split('",').map(function(d){return d.trim().replace(/^\"/,"").replace(/\s/,"_")}),r=s[0],i=s[1],a=s[2],c=s[3];let h=s[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=us(h);break}this.getPrevNode()[r]={type:i,type2:a,flag:c,value:h},this.setCurrentProp(this.getPrevNode(),r)}}class ul{parse(e){const t=new Or(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 Dr;for(;!this.endOfContent(t);){const r=this.parseNode(t,n);r!==null&&s.add(r.name,r)}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(),r=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),a=e.getString(i);if(s===0)return null;const c=[];for(let y=0;y<r;y++)c.push(this.parseProperty(e));const h=c.length>0?c[0]:"",d=c.length>1?c[1]:"",f=c.length>2?c[2]:"";for(n.singleProperty=r===1&&e.getOffset()===s;s>e.getOffset();){const y=this.parseNode(e,t);y!==null&&this.parseSubNode(a,n,y)}return n.propertyList=c,typeof h=="number"&&(n.id=h),d!==""&&(n.attrName=d),f!==""&&(n.attrType=f),a!==""&&(n.name=a),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(r,i){i!==0&&s.push(r)}),t.connections===void 0&&(t.connections=[]),t.connections.push(s)}else if(n.name==="Properties70")Object.keys(n).forEach(function(r){t[r]=n[r]});else if(e==="Properties70"&&n.name==="P"){let s=n.propertyList[0],r=n.propertyList[1];const i=n.propertyList[2],a=n.propertyList[3];let c;s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),r==="Color"||r==="ColorRGB"||r==="Vector"||r==="Vector3D"||r.indexOf("Lcl_")===0?c=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:c=n.propertyList[4],t[s]={type:r,type2:i,flag:a,value:c}}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(),r=e.getUint32(),i=e.getUint32();if(r===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 a=Eo(new Uint8Array(e.getArrayBuffer(i))),c=new Or(a.buffer);switch(t){case"b":case"c":return c.getBooleanArray(s);case"d":return c.getFloat64Array(s);case"f":return c.getFloat32Array(s);case"i":return c.getInt32Array(s);case"l":return c.getInt64Array(s)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Or{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)),Rt(new Uint8Array(t))}}class Dr{add(e,t){this[e]=t}}function hl(o){const e="Kaydara FBX Binary \0";return o.byteLength>=e.length&&e===Fr(o,0,e.length)}function fl(o){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 r=o[s-1];return o=o.slice(t+s),t++,r}for(let s=0;s<e.length;++s)if(n(1)===e[s])return!1;return!0}function Lr(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 dl(o){return o/46186158e3}const pl=[];function Cn(o,e,t,n){let s;switch(n.mappingType){case"ByPolygonVertex":s=o;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 r=s*n.dataSize,i=r+n.dataSize;return gl(pl,n.buffer,r,i)}const cs=new l.Euler,jt=new l.Vector3;function Br(o){const e=new l.Matrix4,t=new l.Matrix4,n=new l.Matrix4,s=new l.Matrix4,r=new l.Matrix4,i=new l.Matrix4,a=new l.Matrix4,c=new l.Matrix4,h=new l.Matrix4,d=new l.Matrix4,f=new l.Matrix4,y=new l.Matrix4,p=o.inheritType?o.inheritType:0;if(o.translation&&e.setPosition(jt.fromArray(o.translation)),o.preRotation){const w=o.preRotation.map(l.MathUtils.degToRad);w.push(o.eulerOrder),t.makeRotationFromEuler(cs.fromArray(w))}if(o.rotation){const w=o.rotation.map(l.MathUtils.degToRad);w.push(o.eulerOrder),n.makeRotationFromEuler(cs.fromArray(w))}if(o.postRotation){const w=o.postRotation.map(l.MathUtils.degToRad);w.push(o.eulerOrder),s.makeRotationFromEuler(cs.fromArray(w)),s.invert()}o.scale&&r.scale(jt.fromArray(o.scale)),o.scalingOffset&&a.setPosition(jt.fromArray(o.scalingOffset)),o.scalingPivot&&i.setPosition(jt.fromArray(o.scalingPivot)),o.rotationOffset&&c.setPosition(jt.fromArray(o.rotationOffset)),o.rotationPivot&&h.setPosition(jt.fromArray(o.rotationPivot)),o.parentMatrixWorld&&(f.copy(o.parentMatrix),d.copy(o.parentMatrixWorld));const _=t.clone().multiply(n).multiply(s),g=new l.Matrix4;g.extractRotation(d);const x=new l.Matrix4;x.copyPosition(d);const m=x.clone().invert().multiply(d),M=g.clone().invert().multiply(m),v=r,C=new l.Matrix4;if(p===0)C.copy(g).multiply(_).multiply(M).multiply(v);else if(p===1)C.copy(g).multiply(M).multiply(_).multiply(v);else{const D=new l.Matrix4().scale(new l.Vector3().setFromMatrixScale(f)).clone().invert(),L=M.clone().multiply(D);C.copy(g).multiply(_).multiply(L).multiply(v)}const O=h.clone().invert(),S=i.clone().invert();let A=e.clone().multiply(c).multiply(h).multiply(t).multiply(n).multiply(s).multiply(O).multiply(a).multiply(i).multiply(r).multiply(S);const b=new l.Matrix4().copyPosition(A),P=d.clone().multiply(b);return y.copyPosition(P),A=y.clone().multiply(C),A.premultiply(d.invert()),A}function kr(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 us(o){return o.split(",").map(function(t){return parseFloat(t)})}function Fr(o,e,t){return e===void 0&&(e=0),t===void 0&&(t=o.byteLength),Rt(new Uint8Array(o,e,t))}function ml(o,e){for(let t=0,n=o.length,s=e.length;t<s;t++,n++)o[n]=e[t]}function gl(o,e,t,n){for(let s=t,r=0;s<n;s++,r++)o[r]=e[s];return o}function Ur(o,e,t){return o.slice(0,e).concat(t).concat(o.slice(e))}var yl=Object.defineProperty,_l=(o,e,t)=>e in o?yl(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,hs=(o,e,t)=>(_l(o,typeof e!="symbol"?e+"":e,t),t);class xl extends l.Loader{constructor(e){super(e)}load(e,t,n,s){const r=new l.FileLoader(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,i=>{if(typeof i!="string")throw new Error("unsupported data type");const a=JSON.parse(i),c=this.parse(a);t&&t(c)},n,s)}loadAsync(e,t){return super.loadAsync(e,t)}parse(e){return new fs(e)}}class fs{constructor(e){hs(this,"data"),this.data=e}generateShapes(e,t=100,n){const s=[],r={letterSpacing:0,lineHeight:1,...n},i=vl(e,t,this.data,r);for(let a=0,c=i.length;a<c;a++)Array.prototype.push.apply(s,i[a].toShapes(!1));return s}}hs(fs,"isFont"),hs(fs,"type");function vl(o,e,t,n){const s=Array.from(o),r=e/t.resolution,i=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*r,a=[];let c=0,h=0;for(let d=0;d<s.length;d++){const f=s[d];if(f===`
|
|
390
|
-
`)c=0,h-=i*n.lineHeight;else{const
|
|
391
|
-
`,f=function(b,P,w){P=P||1024;let L=b.pos,V=-1,R=0,Y="",W=String.fromCharCode.apply(null,new Uint16Array(b.subarray(L,L+128)));for(;0>(V=W.indexOf(d))&&R<P&&L<b.byteLength;)Y+=W,R+=W.length,L+=128,W+=String.fromCharCode.apply(null,new Uint16Array(b.subarray(L,L+128)));return-1<V?(b.pos+=R+V+1,Y+W.slice(0,V)):!1},
|
|
389
|
+
`};function Tr(o,e,t){const n=t.length-o-1;if(e>=t[n])return n-1;if(e<=t[o])return o;let s=o,r=n,i=Math.floor((s+r)/2);for(;e<t[i]||e>=t[i+1];)e<t[i]?r=i:s=i,i=Math.floor((s+r)/2);return i}function Ha(o,e,t,n){const s=[],r=[],i=[];s[0]=1;for(let a=1;a<=t;++a){r[a]=e-n[o+1-a],i[a]=n[o+a]-e;let c=0;for(let h=0;h<a;++h){const d=i[h+1],f=r[a-h],g=s[h]/(d+f);s[h]=c+d*g,c=f*g}s[a]=c}return s}function $a(o,e,t,n){const s=Tr(o,n,e),r=Ha(s,n,o,e),i=new l.Vector4(0,0,0,0);for(let a=0;a<=o;++a){const c=t[s-o+a],h=r[a],d=c.w*h;i.x+=c.x*d,i.y+=c.y*d,i.z+=c.z*d,i.w+=c.w*h}return i}function el(o,e,t,n,s){const r=[];for(let f=0;f<=t;++f)r[f]=0;const i=[];for(let f=0;f<=n;++f)i[f]=r.slice(0);const a=[];for(let f=0;f<=t;++f)a[f]=r.slice(0);a[0][0]=1;const c=r.slice(0),h=r.slice(0);for(let f=1;f<=t;++f){c[f]=e-s[o+1-f],h[f]=s[o+f]-e;let g=0;for(let p=0;p<f;++p){const _=h[p+1],y=c[f-p];a[f][p]=_+y;const x=a[p][f-1]/a[f][p];a[p][f]=g+_*x,g=y*x}a[f][f]=g}for(let f=0;f<=t;++f)i[0][f]=a[f][t];for(let f=0;f<=t;++f){let g=0,p=1;const _=[];for(let y=0;y<=t;++y)_[y]=r.slice(0);_[0][0]=1;for(let y=1;y<=n;++y){let x=0;const m=f-y,M=t-y;f>=y&&(_[p][0]=_[g][0]/a[M+1][m],x=_[p][0]*a[m][M]);const v=m>=-1?1:-m,C=f-1<=M?y-1:t-f;for(let S=v;S<=C;++S)_[p][S]=(_[g][S]-_[g][S-1])/a[M+1][m+S],x+=_[p][S]*a[m+S][M];f<=M&&(_[p][y]=-_[g][y-1]/a[M+1][f],x+=_[p][y]*a[f][M]),i[y][f]=x;const O=g;g=p,p=O}}let d=t;for(let f=1;f<=n;++f){for(let g=0;g<=t;++g)i[f][g]*=d;d*=t-f}return i}function tl(o,e,t,n,s){const r=s<o?s:o,i=[],a=Tr(o,n,e),c=el(a,n,o,r,e),h=[];for(let d=0;d<t.length;++d){const f=t[d].clone(),g=f.w;f.x*=g,f.y*=g,f.z*=g,h[d]=f}for(let d=0;d<=r;++d){const f=h[a-o].clone().multiplyScalar(c[d][0]);for(let g=1;g<=o;++g)f.add(h[a-o+g].clone().multiplyScalar(c[d][g]));i[d]=f}for(let d=r+1;d<=s+1;++d)i[d]=new l.Vector4(0,0,0);return i}function nl(o,e){let t=1;for(let s=2;s<=o;++s)t*=s;let n=1;for(let s=2;s<=e;++s)n*=s;for(let s=2;s<=o-e;++s)n*=s;return t/n}function sl(o){const e=o.length,t=[],n=[];for(let r=0;r<e;++r){const i=o[r];t[r]=new l.Vector3(i.x,i.y,i.z),n[r]=i.w}const s=[];for(let r=0;r<e;++r){const i=t[r].clone();for(let a=1;a<=r;++a)i.sub(s[r-a].clone().multiplyScalar(nl(r,a)*n[a]));s[r]=i.divideScalar(n[0])}return s}function rl(o,e,t,n,s){const r=tl(o,e,t,n,s);return sl(r)}class Ir extends l.Curve{constructor(e,t,n,s,r){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=s||0,this.endKnot=r||this.knots.length-1;for(let i=0;i<n.length;++i){const a=n[i];this.controlPoints[i]=new l.Vector4(a.x,a.y,a.z,a.w)}}getPoint(e,t){const n=t||new l.Vector3,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),r=$a(this.degree,this.knots,this.controlPoints,s);return r.w!=1&&r.divideScalar(r.w),n.set(r.x,r.y,r.z)}getTangent(e,t){const n=t||new l.Vector3,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),r=rl(this.degree,this.knots,this.controlPoints,s,1);return n.copy(r[1]).normalize(),n}}let ve,Le,je;class il extends l.Loader{constructor(e){super(e)}load(e,t,n,s){const r=this,i=r.path===""?l.LoaderUtils.extractUrlBase(e):r.path,a=new l.FileLoader(this.manager);a.setPath(r.path),a.setResponseType("arraybuffer"),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(c){try{t(r.parse(c,i))}catch(h){s?s(h):console.error(h),r.manager.itemError(e)}},n,s)}parse(e,t){if(hl(e))ve=new ul().parse(e);else{const s=Fr(e);if(!fl(s))throw new Error("THREE.FBXLoader: Unknown format.");if(Lr(s)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Lr(s));ve=new cl().parse(s)}const n=new l.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new ol(n,this.manager).parse(ve)}}class ol{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Le=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),s=this.parseDeformers(),r=new al().parse(s);return this.parseScene(s,r,n),je}parseConnections(){const e=new Map;return"Connections"in ve&&ve.Connections.connections.forEach(function(n){const s=n[0],r=n[1],i=n[2];e.has(s)||e.set(s,{parents:[],children:[]});const a={ID:r,relationship:i};e.get(s).parents.push(a),e.has(r)||e.set(r,{parents:[],children:[]});const c={ID:s,relationship:i};e.get(r).children.push(c)}),e}parseImages(){const e={},t={};if("Video"in ve.Objects){const n=ve.Objects.Video;for(const s in n){const r=n[s],i=parseInt(s);if(e[i]=r.RelativeFilename||r.Filename,"Content"in r){const a=r.Content instanceof ArrayBuffer&&r.Content.byteLength>0,c=typeof r.Content=="string"&&r.Content!=="";if(a||c){const h=this.parseImage(n[s]);t[r.RelativeFilename||r.Filename]=h}}}}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 r;switch(s){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 "'+s+'" is not supported.');return}if(typeof t=="string")return"data:"+r+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:r}))}}parseTextures(e){const t=new Map;if("Texture"in ve.Objects){const n=ve.Objects.Texture;for(const s in n){const r=this.parseTexture(n[s],e);t.set(parseInt(s),r)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const s=e.WrapModeU,r=e.WrapModeV,i=s!==void 0?s.value:0,a=r!==void 0?r.value:0;if(n.wrapS=i===0?l.RepeatWrapping:l.ClampToEdgeWrapping,n.wrapT=a===0?l.RepeatWrapping:l.ClampToEdgeWrapping,"Scaling"in e){const c=e.Scaling.value;n.repeat.x=c[0],n.repeat.y=c[1]}return n}loadTexture(e,t){let n;const s=this.textureLoader.path,r=Le.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 i;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const c=this.manager.getHandler(".tga");c===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new l.Texture):(c.setPath(this.textureLoader.path),i=c.load(n))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new l.Texture):i=this.textureLoader.load(n);return this.textureLoader.setPath(s),i}parseMaterials(e){const t=new Map;if("Material"in ve.Objects){const n=ve.Objects.Material;for(const s in n){const r=this.parseMaterial(n[s],e);r!==null&&t.set(parseInt(s),r)}}return t}parseMaterial(e,t){const n=e.id,s=e.attrName;let r=e.ShadingModel;if(typeof r=="object"&&(r=r.value),!Le.has(n))return null;const i=this.parseParameters(e,t,n);let a;switch(r.toLowerCase()){case"phong":a=new l.MeshPhongMaterial;break;case"lambert":a=new l.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),a=new l.MeshPhongMaterial;break}return a.setValues(i),a.name=s,a}parseParameters(e,t,n){const s={};e.BumpFactor&&(s.bumpScale=e.BumpFactor.value),e.Diffuse?s.color=new l.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(s.color=new l.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(s.displacementScale=e.DisplacementFactor.value),e.Emissive?s.emissive=new l.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(s.emissive=new l.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 l.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(s.specular=new l.Color().fromArray(e.SpecularColor.value));const r=this;return Le.get(n).children.forEach(function(i){const a=i.relationship;switch(a){case"Bump":s.bumpMap=r.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":s.aoMap=r.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":s.map=r.getTexture(t,i.ID),s.map!==void 0&&("colorSpace"in s.map?s.map.colorSpace="srgb":s.map.encoding=3001);break;case"DisplacementColor":s.displacementMap=r.getTexture(t,i.ID);break;case"EmissiveColor":s.emissiveMap=r.getTexture(t,i.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=r.getTexture(t,i.ID);break;case"ReflectionColor":s.envMap=r.getTexture(t,i.ID),s.envMap!==void 0&&(s.envMap.mapping=l.EquirectangularReflectionMapping,"colorSpace"in s.envMap?s.envMap.colorSpace="srgb":s.envMap.encoding=3001);break;case"SpecularColor":s.specularMap=r.getTexture(t,i.ID),s.specularMap!==void 0&&("colorSpace"in s.specularMap?s.specularMap.colorSpace="srgb":s.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":s.alphaMap=r.getTexture(t,i.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.",a);break}}),s}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=Le.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in ve.Objects){const n=ve.Objects.Deformer;for(const s in n){const r=n[s],i=Le.get(parseInt(s));if(r.attrType==="Skin"){const a=this.parseSkeleton(i,n);a.ID=s,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=i.parents[0].ID,e[s]=a}else if(r.attrType==="BlendShape"){const a={id:s};a.rawTargets=this.parseMorphTargets(i,n),a.id=s,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[s]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(s){const r=t[s.ID];if(r.attrType!=="Cluster")return;const i={ID:s.ID,indices:[],weights:[],transformLink:new l.Matrix4().fromArray(r.TransformLink.a)};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let s=0;s<e.children.length;s++){const r=e.children[s],i=t[r.ID],a={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if(i.attrType!=="BlendShapeChannel")return;a.geoID=Le.get(parseInt(r.ID)).children.filter(function(c){return c.relationship===void 0})[0].ID,n.push(a)}return n}parseScene(e,t,n){je=new l.Group;const s=this.parseModels(e.skeletons,t,n),r=ve.Objects.Model,i=this;s.forEach(function(c){const h=r[c.ID];i.setLookAtProperties(c,h),Le.get(c.ID).parents.forEach(function(f){const g=s.get(f.ID);g!==void 0&&g.add(c)}),c.parent===null&&je.add(c)}),this.bindSkeleton(e.skeletons,t,s),this.createAmbientLight(),je.traverse(function(c){if(c.userData.transformData){c.parent&&(c.userData.transformData.parentMatrix=c.parent.matrix,c.userData.transformData.parentMatrixWorld=c.parent.matrixWorld);const h=Br(c.userData.transformData);c.applyMatrix4(h),c.updateWorldMatrix()}});const a=new ll().parse();je.children.length===1&&je.children[0].isGroup&&(je.children[0].animations=a,je=je.children[0]),je.animations=a}parseModels(e,t,n){const s=new Map,r=ve.Objects.Model;for(const i in r){const a=parseInt(i),c=r[i],h=Le.get(a);let d=this.buildSkeleton(h,e,a,c.attrName);if(!d){switch(c.attrType){case"Camera":d=this.createCamera(h);break;case"Light":d=this.createLight(h);break;case"Mesh":d=this.createMesh(h,t,n);break;case"NurbsCurve":d=this.createCurve(h,t);break;case"LimbNode":case"Root":d=new l.Bone;break;case"Null":default:d=new l.Group;break}d.name=c.attrName?l.PropertyBinding.sanitizeNodeName(c.attrName):"",d.ID=a}this.getTransformData(d,c),s.set(a,d)}return s}buildSkeleton(e,t,n,s){let r=null;return e.parents.forEach(function(i){for(const a in t){const c=t[a];c.rawBones.forEach(function(h,d){if(h.ID===i.ID){const f=r;r=new l.Bone,r.matrixWorld.copy(h.transformLink),r.name=s?l.PropertyBinding.sanitizeNodeName(s):"",r.ID=n,c.bones[d]=r,f!==null&&r.add(f)}})}}),r}createCamera(e){let t,n;if(e.children.forEach(function(s){const r=ve.Objects.NodeAttribute[s.ID];r!==void 0&&(n=r)}),n===void 0)t=new l.Object3D;else{let s=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(s=1);let r=1;n.NearPlane!==void 0&&(r=n.NearPlane.value/1e3);let i=1e3;n.FarPlane!==void 0&&(i=n.FarPlane.value/1e3);let a=window.innerWidth,c=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(a=n.AspectWidth.value,c=n.AspectHeight.value);const h=a/c;let d=45;n.FieldOfView!==void 0&&(d=n.FieldOfView.value);const f=n.FocalLength?n.FocalLength.value:null;switch(s){case 0:t=new l.PerspectiveCamera(d,h,r,i),f!==null&&t.setFocalLength(f);break;case 1:t=new l.OrthographicCamera(-a/2,a/2,c/2,-c/2,r,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),t=new l.Object3D;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(s){const r=ve.Objects.NodeAttribute[s.ID];r!==void 0&&(n=r)}),n===void 0)t=new l.Object3D;else{let s;n.LightType===void 0?s=0:s=n.LightType.value;let r=16777215;n.Color!==void 0&&(r=new l.Color().fromArray(n.Color.value));let i=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(i=0);let a=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?a=0:a=n.FarAttenuationEnd.value);const c=1;switch(s){case 0:t=new l.PointLight(r,i,a,c);break;case 1:t=new l.DirectionalLight(r,i);break;case 2:let h=Math.PI/3;n.InnerAngle!==void 0&&(h=l.MathUtils.degToRad(n.InnerAngle.value));let d=0;n.OuterAngle!==void 0&&(d=l.MathUtils.degToRad(n.OuterAngle.value),d=Math.max(d,1)),t=new l.SpotLight(r,i,a,h,d,c);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new l.PointLight(r,i);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let s,r=null,i=null;const a=[];return e.children.forEach(function(c){t.has(c.ID)&&(r=t.get(c.ID)),n.has(c.ID)&&a.push(n.get(c.ID))}),a.length>1?i=a:a.length>0?i=a[0]:(i=new l.MeshPhongMaterial({color:13421772}),a.push(i)),"color"in r.attributes&&a.forEach(function(c){c.vertexColors=!0}),r.FBX_Deformer?(s=new l.SkinnedMesh(r,i),s.normalizeSkinWeights()):s=new l.Mesh(r,i),s}createCurve(e,t){const n=e.children.reduce(function(r,i){return t.has(i.ID)&&(r=t.get(i.ID)),r},null),s=new l.LineBasicMaterial({color:3342591,linewidth:1});return new l.Line(n,s)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=kr(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&&Le.get(e.ID).children.forEach(function(s){if(s.relationship==="LookAtProperty"){const r=ve.Objects.Model[s.ID];if("Lcl_Translation"in r){const i=r.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),je.add(e.target)):e.lookAt(new l.Vector3().fromArray(i))}}})}bindSkeleton(e,t,n){const s=this.parsePoseNodes();for(const r in e){const i=e[r];Le.get(parseInt(i.ID)).parents.forEach(function(c){if(t.has(c.ID)){const h=c.ID;Le.get(h).parents.forEach(function(f){n.has(f.ID)&&n.get(f.ID).bind(new l.Skeleton(i.bones),s[f.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 s=t[n].PoseNode;Array.isArray(s)?s.forEach(function(r){e[r.Node]=new l.Matrix4().fromArray(r.Matrix.a)}):e[s.Node]=new l.Matrix4().fromArray(s.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],s=e[2];if(t!==0||n!==0||s!==0){const r=new l.Color(t,n,s);je.add(new l.AmbientLight(r,1))}}}}class al{parse(e){const t=new Map;if("Geometry"in ve.Objects){const n=ve.Objects.Geometry;for(const s in n){const r=Le.get(parseInt(s)),i=this.parseGeometry(r,n[s],e);t.set(parseInt(s),i)}}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,r=[],i=e.parents.map(function(f){return ve.Objects.Model[f.ID]});if(i.length===0)return;const a=e.children.reduce(function(f,g){return s[g.ID]!==void 0&&(f=s[g.ID]),f},null);e.children.forEach(function(f){n.morphTargets[f.ID]!==void 0&&r.push(n.morphTargets[f.ID])});const c=i[0],h={};"RotationOrder"in c&&(h.eulerOrder=kr(c.RotationOrder.value)),"InheritType"in c&&(h.inheritType=parseInt(c.InheritType.value)),"GeometricTranslation"in c&&(h.translation=c.GeometricTranslation.value),"GeometricRotation"in c&&(h.rotation=c.GeometricRotation.value),"GeometricScaling"in c&&(h.scale=c.GeometricScaling.value);const d=Br(h);return this.genGeometry(t,a,r,d)}genGeometry(e,t,n,s){const r=new l.BufferGeometry;e.attrName&&(r.name=e.attrName);const i=this.parseGeoNode(e,t),a=this.genBuffers(i),c=new l.Float32BufferAttribute(a.vertex,3);if(c.applyMatrix4(s),r.setAttribute("position",c),a.colors.length>0&&r.setAttribute("color",new l.Float32BufferAttribute(a.colors,3)),t&&(r.setAttribute("skinIndex",new l.Uint16BufferAttribute(a.weightsIndices,4)),r.setAttribute("skinWeight",new l.Float32BufferAttribute(a.vertexWeights,4)),r.FBX_Deformer=t),a.normal.length>0){const h=new l.Matrix3().getNormalMatrix(s),d=new l.Float32BufferAttribute(a.normal,3);d.applyNormalMatrix(h),r.setAttribute("normal",d)}if(a.uvs.forEach(function(h,d){ao==="uv2"&&d++;const f=d===0?"uv":`uv${d}`;r.setAttribute(f,new l.Float32BufferAttribute(a.uvs[d],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=a.materialIndex[0],d=0;if(a.materialIndex.forEach(function(f,g){f!==h&&(r.addGroup(d,g-d,h),h=f,d=g)}),r.groups.length>0){const f=r.groups[r.groups.length-1],g=f.start+f.count;g!==a.materialIndex.length&&r.addGroup(g,a.materialIndex.length-g,h)}r.groups.length===0&&r.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(r,e,n,s),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 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,r){s.indices.forEach(function(i,a){n.weightTable[i]===void 0&&(n.weightTable[i]=[]),n.weightTable[i].push({id:r,weight:s.weights[a]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,s=0,r=!1,i=[],a=[],c=[],h=[],d=[],f=[];const g=this;return e.vertexIndices.forEach(function(p,_){let y,x=!1;p<0&&(p=p^-1,x=!0);let m=[],M=[];if(i.push(p*3,p*3+1,p*3+2),e.color){const v=Cn(_,n,p,e.color);c.push(v[0],v[1],v[2])}if(e.skeleton){if(e.weightTable[p]!==void 0&&e.weightTable[p].forEach(function(v){M.push(v.weight),m.push(v.id)}),M.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const v=[0,0,0,0],C=[0,0,0,0];M.forEach(function(O,S){let A=O,b=m[S];C.forEach(function(P,w,D){if(A>P){D[w]=A,A=P;const L=v[w];v[w]=b,b=L}})}),m=v,M=C}for(;M.length<4;)M.push(0),m.push(0);for(let v=0;v<4;++v)d.push(M[v]),f.push(m[v])}if(e.normal){const v=Cn(_,n,p,e.normal);a.push(v[0],v[1],v[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=Cn(_,n,p,e.material)[0]),e.uv&&e.uv.forEach(function(v,C){const O=Cn(_,n,p,v);h[C]===void 0&&(h[C]=[]),h[C].push(O[0]),h[C].push(O[1])}),s++,x&&(g.genFace(t,e,i,y,a,c,h,d,f,s),n++,s=0,i=[],a=[],c=[],h=[],d=[],f=[])}),t}genFace(e,t,n,s,r,i,a,c,h,d){for(let f=2;f<d;f++)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[(f-1)*3]]),e.vertex.push(t.vertexPositions[n[(f-1)*3+1]]),e.vertex.push(t.vertexPositions[n[(f-1)*3+2]]),e.vertex.push(t.vertexPositions[n[f*3]]),e.vertex.push(t.vertexPositions[n[f*3+1]]),e.vertex.push(t.vertexPositions[n[f*3+2]]),t.skeleton&&(e.vertexWeights.push(c[0]),e.vertexWeights.push(c[1]),e.vertexWeights.push(c[2]),e.vertexWeights.push(c[3]),e.vertexWeights.push(c[(f-1)*4]),e.vertexWeights.push(c[(f-1)*4+1]),e.vertexWeights.push(c[(f-1)*4+2]),e.vertexWeights.push(c[(f-1)*4+3]),e.vertexWeights.push(c[f*4]),e.vertexWeights.push(c[f*4+1]),e.vertexWeights.push(c[f*4+2]),e.vertexWeights.push(c[f*4+3]),e.weightsIndices.push(h[0]),e.weightsIndices.push(h[1]),e.weightsIndices.push(h[2]),e.weightsIndices.push(h[3]),e.weightsIndices.push(h[(f-1)*4]),e.weightsIndices.push(h[(f-1)*4+1]),e.weightsIndices.push(h[(f-1)*4+2]),e.weightsIndices.push(h[(f-1)*4+3]),e.weightsIndices.push(h[f*4]),e.weightsIndices.push(h[f*4+1]),e.weightsIndices.push(h[f*4+2]),e.weightsIndices.push(h[f*4+3])),t.color&&(e.colors.push(i[0]),e.colors.push(i[1]),e.colors.push(i[2]),e.colors.push(i[(f-1)*3]),e.colors.push(i[(f-1)*3+1]),e.colors.push(i[(f-1)*3+2]),e.colors.push(i[f*3]),e.colors.push(i[f*3+1]),e.colors.push(i[f*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(r[0]),e.normal.push(r[1]),e.normal.push(r[2]),e.normal.push(r[(f-1)*3]),e.normal.push(r[(f-1)*3+1]),e.normal.push(r[(f-1)*3+2]),e.normal.push(r[f*3]),e.normal.push(r[f*3+1]),e.normal.push(r[f*3+2])),t.uv&&t.uv.forEach(function(g,p){e.uvs[p]===void 0&&(e.uvs[p]=[]),e.uvs[p].push(a[p][0]),e.uvs[p].push(a[p][1]),e.uvs[p].push(a[p][(f-1)*2]),e.uvs[p].push(a[p][(f-1)*2+1]),e.uvs[p].push(a[p][f*2]),e.uvs[p].push(a[p][f*2+1])})}addMorphTargets(e,t,n,s){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const r=this;n.forEach(function(i){i.rawTargets.forEach(function(a){const c=ve.Objects.Geometry[a.geoID];c!==void 0&&r.genMorphGeometry(e,t,c,s,a.name)})})}genMorphGeometry(e,t,n,s,r){const i=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],a=n.Vertices!==void 0?n.Vertices.a:[],c=n.Indexes!==void 0?n.Indexes.a:[],h=e.attributes.position.count*3,d=new Float32Array(h);for(let _=0;_<c.length;_++){const y=c[_]*3;d[y]=a[_*3],d[y+1]=a[_*3+1],d[y+2]=a[_*3+2]}const f={vertexIndices:i,vertexPositions:d},g=this.genBuffers(f),p=new l.Float32BufferAttribute(g.vertex,3);p.name=r||n.attrName,p.applyMatrix4(s),e.morphAttributes.position.push(p)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=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:s,indices:r,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.UV.a;let r=[];return n==="IndexToDirect"&&(r=e.UVIndex.a),{dataSize:2,buffer:s,indices:r,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.Colors.a;let r=[];return n==="IndexToDirect"&&(r=e.ColorIndex.a),{dataSize:4,buffer:s,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 s=e.Materials.a,r=[];for(let i=0;i<s.length;++i)r.push(i);return{dataSize:1,buffer:s,indices:r,mappingType:t,referenceType:n}}parseNurbsGeometry(e){if(Ir===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new l.BufferGeometry;const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new l.BufferGeometry;const n=t-1,s=e.KnotVector.a,r=[],i=e.Points.a;for(let f=0,g=i.length;f<g;f+=4)r.push(new l.Vector4().fromArray(i,f));let a,c;if(e.Form==="Closed")r.push(r[0]);else if(e.Form==="Periodic"){a=n,c=s.length-1-a;for(let f=0;f<n;++f)r.push(r[f])}const d=new Ir(n,s,r,a,c).getPoints(r.length*12);return new l.BufferGeometry().setFromPoints(d)}}class ll{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const s=t[n],r=this.addClip(s);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 s=e[n];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){const r={id:s.id,attr:s.attrName,curves:{}};t.set(r.id,r)}}return t}parseAnimationCurves(e){const t=ve.Objects.AnimationCurve;for(const n in t){const s={id:t[n].id,times:t[n].KeyTime.a.map(dl),values:t[n].KeyValueFloat.a},r=Le.get(s.id);if(r!==void 0){const i=r.parents[0].ID,a=r.parents[0].relationship;a.match(/X/)?e.get(i).curves.x=s:a.match(/Y/)?e.get(i).curves.y=s:a.match(/Z/)?e.get(i).curves.z=s:a.match(/d|DeformPercent/)&&e.has(i)&&(e.get(i).curves.morph=s)}}}parseAnimationLayers(e){const t=ve.Objects.AnimationLayer,n=new Map;for(const s in t){const r=[],i=Le.get(parseInt(s));i!==void 0&&(i.children.forEach(function(c,h){if(e.has(c.ID)){const d=e.get(c.ID);if(d.curves.x!==void 0||d.curves.y!==void 0||d.curves.z!==void 0){if(r[h]===void 0){const f=Le.get(c.ID).parents.filter(function(g){return g.relationship!==void 0})[0].ID;if(f!==void 0){const g=ve.Objects.Model[f.toString()];if(g===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",c);return}const p={modelName:g.attrName?l.PropertyBinding.sanitizeNodeName(g.attrName):"",ID:g.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};je.traverse(function(_){_.ID===g.id&&(p.transform=_.matrix,_.userData.transformData&&(p.eulerOrder=_.userData.transformData.eulerOrder))}),p.transform||(p.transform=new l.Matrix4),"PreRotation"in g&&(p.preRotation=g.PreRotation.value),"PostRotation"in g&&(p.postRotation=g.PostRotation.value),r[h]=p}}r[h]&&(r[h][d.attr]=d)}else if(d.curves.morph!==void 0){if(r[h]===void 0){const f=Le.get(c.ID).parents.filter(function(m){return m.relationship!==void 0})[0].ID,g=Le.get(f).parents[0].ID,p=Le.get(g).parents[0].ID,_=Le.get(p).parents[0].ID,y=ve.Objects.Model[_],x={modelName:y.attrName?l.PropertyBinding.sanitizeNodeName(y.attrName):"",morphName:ve.Objects.Deformer[f].attrName};r[h]=x}r[h][d.attr]=d}}}),n.set(parseInt(s),r))}return n}parseAnimStacks(e){const t=ve.Objects.AnimationStack,n={};for(const s in t){const r=Le.get(parseInt(s)).children;r.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(r[0].ID);n[s]={name:t[s].attrName,layer:i}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(s){t=t.concat(n.generateTracks(s))}),new l.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let n=new l.Vector3,s=new l.Quaternion,r=new l.Vector3;if(e.transform&&e.transform.decompose(n,s,r),n=n.toArray(),s=new l.Euler().setFromQuaternion(s,e.eulerOrder).toArray(),r=r.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,s,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,r,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,n,s){const r=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(r,t,n);return new l.VectorKeyframeTrack(e+"."+s,r,i)}generateRotationTrack(e,t,n,s,r,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(l.MathUtils.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(l.MathUtils.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(l.MathUtils.degToRad));const a=this.getTimesForAllAxes(t),c=this.getKeyframeTrackValues(a,t,n);s!==void 0&&(s=s.map(l.MathUtils.degToRad),s.push(i),s=new l.Euler().fromArray(s),s=new l.Quaternion().setFromEuler(s)),r!==void 0&&(r=r.map(l.MathUtils.degToRad),r.push(i),r=new l.Euler().fromArray(r),r=new l.Quaternion().setFromEuler(r).invert());const h=new l.Quaternion,d=new l.Euler,f=[];for(let g=0;g<c.length;g+=3)d.set(c[g],c[g+1],c[g+2],i),h.setFromEuler(d),s!==void 0&&h.premultiply(s),r!==void 0&&h.multiply(r),h.toArray(f,g/3*4);return new l.QuaternionKeyframeTrack(e+".quaternion",a,f)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(r){return r/100}),s=je.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new l.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 r=1;r<t.length;r++){const i=t[r];i!==s&&(t[n]=i,s=i,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const s=n,r=[];let i=-1,a=-1,c=-1;return e.forEach(function(h){if(t.x&&(i=t.x.times.indexOf(h)),t.y&&(a=t.y.times.indexOf(h)),t.z&&(c=t.z.times.indexOf(h)),i!==-1){const d=t.x.values[i];r.push(d),s[0]=d}else r.push(s[0]);if(a!==-1){const d=t.y.values[a];r.push(d),s[1]=d}else r.push(s[1]);if(c!==-1){const d=t.z.values[c];r.push(d),s[2]=d}else r.push(s[2])}),r}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const n=e.values[t-1],s=e.values[t]-n,r=Math.abs(s);if(r>=180){const i=r/180,a=s/i;let c=n+a;const h=e.times[t-1],f=(e.times[t]-h)/i;let g=h+f;const p=[],_=[];for(;g<e.times[t];)p.push(g),g+=f,_.push(c),c+=a;e.times=Ur(e.times,t,p),e.values=Ur(e.values,t,_)}}}}class cl{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 Dr,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(s,r){const i=s.match(/^[\s\t]*;/),a=s.match(/^[\s\t]*$/);if(i||a)return;const c=s.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),h=s.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),d=s.match("^\\t{"+(t.currentIndent-1)+"}}");c?t.parseNodeBegin(s,c):h?t.parseNodeProperty(s,h,n[++r]):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(c){return c.trim().replace(/^"/,"").replace(/"$/,"")}),r={name:n},i=this.parseNodeAttr(s),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]),i.id!==""&&(a[n][i.id]=r)):typeof i.id=="number"?(a[n]={},a[n][i.id]=r):n!=="Properties70"&&(n==="PoseNode"?a[n]=[r]:a[n]=r),typeof i.id=="number"&&(r.id=i.id),i.name!==""&&(r.attrName=i.name),i.type!==""&&(r.attrType=i.type),this.pushStack(r)}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(),r=t[2].replace(/^"/,"").replace(/"$/,"").trim();s==="Content"&&r===","&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,s,r);return}if(s==="C"){const c=r.split(",").slice(1),h=parseInt(c[0]),d=parseInt(c[1]);let f=r.split(",").slice(3);f=f.map(function(g){return g.trim().replace(/^"/,"")}),s="connections",r=[h,d],ml(r,f),i[s]===void 0&&(i[s]=[])}s==="Node"&&(i.id=r),s in i&&Array.isArray(i[s])?i[s].push(r):s!=="a"?i[s]=r:i.a=r,this.setCurrentProp(i,s),s==="a"&&r.slice(-1)!==","&&(i.a=us(r))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=us(t.a))}parseNodeSpecialProperty(e,t,n){const s=n.split('",').map(function(d){return d.trim().replace(/^\"/,"").replace(/\s/,"_")}),r=s[0],i=s[1],a=s[2],c=s[3];let h=s[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=us(h);break}this.getPrevNode()[r]={type:i,type2:a,flag:c,value:h},this.setCurrentProp(this.getPrevNode(),r)}}class ul{parse(e){const t=new Or(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 Dr;for(;!this.endOfContent(t);){const r=this.parseNode(t,n);r!==null&&s.add(r.name,r)}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(),r=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),a=e.getString(i);if(s===0)return null;const c=[];for(let g=0;g<r;g++)c.push(this.parseProperty(e));const h=c.length>0?c[0]:"",d=c.length>1?c[1]:"",f=c.length>2?c[2]:"";for(n.singleProperty=r===1&&e.getOffset()===s;s>e.getOffset();){const g=this.parseNode(e,t);g!==null&&this.parseSubNode(a,n,g)}return n.propertyList=c,typeof h=="number"&&(n.id=h),d!==""&&(n.attrName=d),f!==""&&(n.attrType=f),a!==""&&(n.name=a),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(r,i){i!==0&&s.push(r)}),t.connections===void 0&&(t.connections=[]),t.connections.push(s)}else if(n.name==="Properties70")Object.keys(n).forEach(function(r){t[r]=n[r]});else if(e==="Properties70"&&n.name==="P"){let s=n.propertyList[0],r=n.propertyList[1];const i=n.propertyList[2],a=n.propertyList[3];let c;s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),r==="Color"||r==="ColorRGB"||r==="Vector"||r==="Vector3D"||r.indexOf("Lcl_")===0?c=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:c=n.propertyList[4],t[s]={type:r,type2:i,flag:a,value:c}}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(),r=e.getUint32(),i=e.getUint32();if(r===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 a=Eo(new Uint8Array(e.getArrayBuffer(i))),c=new Or(a.buffer);switch(t){case"b":case"c":return c.getBooleanArray(s);case"d":return c.getFloat64Array(s);case"f":return c.getFloat32Array(s);case"i":return c.getInt32Array(s);case"l":return c.getInt64Array(s)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Or{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)),Rt(new Uint8Array(t))}}class Dr{add(e,t){this[e]=t}}function hl(o){const e="Kaydara FBX Binary \0";return o.byteLength>=e.length&&e===Fr(o,0,e.length)}function fl(o){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 r=o[s-1];return o=o.slice(t+s),t++,r}for(let s=0;s<e.length;++s)if(n(1)===e[s])return!1;return!0}function Lr(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 dl(o){return o/46186158e3}const pl=[];function Cn(o,e,t,n){let s;switch(n.mappingType){case"ByPolygonVertex":s=o;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 r=s*n.dataSize,i=r+n.dataSize;return gl(pl,n.buffer,r,i)}const cs=new l.Euler,jt=new l.Vector3;function Br(o){const e=new l.Matrix4,t=new l.Matrix4,n=new l.Matrix4,s=new l.Matrix4,r=new l.Matrix4,i=new l.Matrix4,a=new l.Matrix4,c=new l.Matrix4,h=new l.Matrix4,d=new l.Matrix4,f=new l.Matrix4,g=new l.Matrix4,p=o.inheritType?o.inheritType:0;if(o.translation&&e.setPosition(jt.fromArray(o.translation)),o.preRotation){const w=o.preRotation.map(l.MathUtils.degToRad);w.push(o.eulerOrder),t.makeRotationFromEuler(cs.fromArray(w))}if(o.rotation){const w=o.rotation.map(l.MathUtils.degToRad);w.push(o.eulerOrder),n.makeRotationFromEuler(cs.fromArray(w))}if(o.postRotation){const w=o.postRotation.map(l.MathUtils.degToRad);w.push(o.eulerOrder),s.makeRotationFromEuler(cs.fromArray(w)),s.invert()}o.scale&&r.scale(jt.fromArray(o.scale)),o.scalingOffset&&a.setPosition(jt.fromArray(o.scalingOffset)),o.scalingPivot&&i.setPosition(jt.fromArray(o.scalingPivot)),o.rotationOffset&&c.setPosition(jt.fromArray(o.rotationOffset)),o.rotationPivot&&h.setPosition(jt.fromArray(o.rotationPivot)),o.parentMatrixWorld&&(f.copy(o.parentMatrix),d.copy(o.parentMatrixWorld));const _=t.clone().multiply(n).multiply(s),y=new l.Matrix4;y.extractRotation(d);const x=new l.Matrix4;x.copyPosition(d);const m=x.clone().invert().multiply(d),M=y.clone().invert().multiply(m),v=r,C=new l.Matrix4;if(p===0)C.copy(y).multiply(_).multiply(M).multiply(v);else if(p===1)C.copy(y).multiply(M).multiply(_).multiply(v);else{const D=new l.Matrix4().scale(new l.Vector3().setFromMatrixScale(f)).clone().invert(),L=M.clone().multiply(D);C.copy(y).multiply(_).multiply(L).multiply(v)}const O=h.clone().invert(),S=i.clone().invert();let A=e.clone().multiply(c).multiply(h).multiply(t).multiply(n).multiply(s).multiply(O).multiply(a).multiply(i).multiply(r).multiply(S);const b=new l.Matrix4().copyPosition(A),P=d.clone().multiply(b);return g.copyPosition(P),A=g.clone().multiply(C),A.premultiply(d.invert()),A}function kr(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 us(o){return o.split(",").map(function(t){return parseFloat(t)})}function Fr(o,e,t){return e===void 0&&(e=0),t===void 0&&(t=o.byteLength),Rt(new Uint8Array(o,e,t))}function ml(o,e){for(let t=0,n=o.length,s=e.length;t<s;t++,n++)o[n]=e[t]}function gl(o,e,t,n){for(let s=t,r=0;s<n;s++,r++)o[r]=e[s];return o}function Ur(o,e,t){return o.slice(0,e).concat(t).concat(o.slice(e))}var yl=Object.defineProperty,_l=(o,e,t)=>e in o?yl(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,hs=(o,e,t)=>(_l(o,typeof e!="symbol"?e+"":e,t),t);class xl extends l.Loader{constructor(e){super(e)}load(e,t,n,s){const r=new l.FileLoader(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,i=>{if(typeof i!="string")throw new Error("unsupported data type");const a=JSON.parse(i),c=this.parse(a);t&&t(c)},n,s)}loadAsync(e,t){return super.loadAsync(e,t)}parse(e){return new fs(e)}}class fs{constructor(e){hs(this,"data"),this.data=e}generateShapes(e,t=100,n){const s=[],r={letterSpacing:0,lineHeight:1,...n},i=vl(e,t,this.data,r);for(let a=0,c=i.length;a<c;a++)Array.prototype.push.apply(s,i[a].toShapes(!1));return s}}hs(fs,"isFont"),hs(fs,"type");function vl(o,e,t,n){const s=Array.from(o),r=e/t.resolution,i=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*r,a=[];let c=0,h=0;for(let d=0;d<s.length;d++){const f=s[d];if(f===`
|
|
390
|
+
`)c=0,h-=i*n.lineHeight;else{const g=wl(f,r,c,h,t);g&&(c+=g.offsetX+n.letterSpacing,a.push(g.path))}}return a}function wl(o,e,t,n,s){const r=s.glyphs[o]||s.glyphs["?"];if(!r){console.error('THREE.Font: character "'+o+'" does not exists in font family '+s.familyName+".");return}const i=new l.ShapePath;let a,c,h,d,f,g,p,_;if(r.o){const y=r._cachedOutline||(r._cachedOutline=r.o.split(" "));for(let x=0,m=y.length;x<m;)switch(y[x++]){case"m":a=parseInt(y[x++])*e+t,c=parseInt(y[x++])*e+n,i.moveTo(a,c);break;case"l":a=parseInt(y[x++])*e+t,c=parseInt(y[x++])*e+n,i.lineTo(a,c);break;case"q":h=parseInt(y[x++])*e+t,d=parseInt(y[x++])*e+n,f=parseInt(y[x++])*e+t,g=parseInt(y[x++])*e+n,i.quadraticCurveTo(f,g,h,d);break;case"b":h=parseInt(y[x++])*e+t,d=parseInt(y[x++])*e+n,f=parseInt(y[x++])*e+t,g=parseInt(y[x++])*e+n,p=parseInt(y[x++])*e+t,_=parseInt(y[x++])*e+n,i.bezierCurveTo(f,g,p,_,h,d);break}}return{offsetX:r.ha*e,path:i}}class Nr extends l.DataTextureLoader{constructor(e){super(e),this.type=l.HalfFloatType}parse(e){const i=function(b,P){switch(b){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(P||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(P||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(P||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(P||""))}},d=`
|
|
391
|
+
`,f=function(b,P,w){P=P||1024;let L=b.pos,V=-1,R=0,Y="",W=String.fromCharCode.apply(null,new Uint16Array(b.subarray(L,L+128)));for(;0>(V=W.indexOf(d))&&R<P&&L<b.byteLength;)Y+=W,R+=W.length,L+=128,W+=String.fromCharCode.apply(null,new Uint16Array(b.subarray(L,L+128)));return-1<V?(b.pos+=R+V+1,Y+W.slice(0,V)):!1},g=function(b){const P=/^#\?(\S+)/,w=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,D=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,L=/^\s*FORMAT=(\S+)\s*$/,V=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,R={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let Y,W;for((b.pos>=b.byteLength||!(Y=f(b)))&&i(1,"no header found"),(W=Y.match(P))||i(3,"bad initial token"),R.valid|=1,R.programtype=W[1],R.string+=Y+`
|
|
392
392
|
`;Y=f(b),Y!==!1;){if(R.string+=Y+`
|
|
393
393
|
`,Y.charAt(0)==="#"){R.comments+=Y+`
|
|
394
|
-
`;continue}if((W=Y.match(w))&&(R.gamma=parseFloat(W[1])),(W=Y.match(D))&&(R.exposure=parseFloat(W[1])),(W=Y.match(L))&&(R.valid|=2,R.format=W[1]),(W=Y.match(V))&&(R.valid|=4,R.height=parseInt(W[1],10),R.width=parseInt(W[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},p=function(b,P,w){const D=P;if(D<8||D>32767||b[0]!==2||b[1]!==2||b[2]&128)return new Uint8Array(b);D!==(b[2]<<8|b[3])&&i(3,"wrong scanline width");const L=new Uint8Array(4*P*w);L.length||i(4,"unable to allocate buffer space");let V=0,R=0;const Y=4*D,W=new Uint8Array(4),$=new Uint8Array(Y);let q=w;for(;q>0&&R<b.byteLength;){R+4>b.byteLength&&i(1),W[0]=b[R++],W[1]=b[R++],W[2]=b[R++],W[3]=b[R++],(W[0]!=2||W[1]!=2||(W[2]<<8|W[3])!=D)&&i(3,"bad rgbe scanline format");let ne=0,te;for(;ne<Y&&R<b.byteLength;){te=b[R++];const le=te>128;if(le&&(te-=128),(te===0||ne+te>Y)&&i(3,"bad scanline data"),le){const me=b[R++];for(let B=0;B<te;B++)$[ne++]=me}else $.set(b.subarray(R,R+te),ne),ne+=te,R+=te}const ce=D;for(let le=0;le<ce;le++){let me=0;L[V]=$[le+me],me+=D,L[V+1]=$[le+me],me+=D,L[V+2]=$[le+me],me+=D,L[V+3]=$[le+me],V+=4}q--}return L},_=function(b,P,w,D){const L=b[P+3],V=Math.pow(2,L-128)/255;w[D+0]=b[P+0]*V,w[D+1]=b[P+1]*V,w[D+2]=b[P+2]*V,w[D+3]=1},g=function(b,P,w,D){const L=b[P+3],V=Math.pow(2,L-128)/255;w[D+0]=l.DataUtils.toHalfFloat(Math.min(b[P+0]*V,65504)),w[D+1]=l.DataUtils.toHalfFloat(Math.min(b[P+1]*V,65504)),w[D+2]=l.DataUtils.toHalfFloat(Math.min(b[P+2]*V,65504)),w[D+3]=l.DataUtils.toHalfFloat(1)},x=new Uint8Array(e);x.pos=0;const m=y(x),M=m.width,v=m.height,C=p(x.subarray(x.pos),M,v);let O,S,A;switch(this.type){case l.FloatType:A=C.length/4;const b=new Float32Array(A*4);for(let w=0;w<A;w++)_(C,w*4,b,w*4);O=b,S=l.FloatType;break;case l.HalfFloatType:A=C.length/4;const P=new Uint16Array(A*4);for(let w=0;w<A;w++)g(C,w*4,P,w*4);O=P,S=l.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:M,height:v,data:O,header:m.string,gamma:m.gamma,exposure:m.exposure,type:S}}setDataType(e){return this.type=e,this}load(e,t,n,s){function r(i,a){switch(i.type){case l.FloatType:case l.HalfFloatType:"colorSpace"in i?i.colorSpace="srgb-linear":i.encoding=3e3,i.minFilter=l.LinearFilter,i.magFilter=l.LinearFilter,i.generateMipmaps=!1,i.flipY=!0;break}t&&t(i,a)}return super.load(e,r,n,s)}}const bl="srgb";class nn extends l.Loader{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(e,t,n,s){const r=this,i=new l.FileLoader(r.manager);i.setPath(r.path),i.setRequestHeader(r.requestHeader),i.setWithCredentials(r.withCredentials),i.load(e,function(a){try{t(r.parse(a))}catch(c){s?s(c):console.error(c),r.manager.itemError(e)}},n,s)}parse(e){const t=this;function n(B,z){if(B.nodeType!==1)return;const F=C(B);let k=!1,G=null;switch(B.nodeName){case"svg":z=_(B,z);break;case"style":r(B);break;case"g":z=_(B,z);break;case"path":z=_(B,z),B.hasAttribute("d")&&(G=s(B));break;case"rect":z=_(B,z),G=c(B);break;case"polygon":z=_(B,z),G=h(B);break;case"polyline":z=_(B,z),G=d(B);break;case"circle":z=_(B,z),G=f(B);break;case"ellipse":z=_(B,z),G=y(B);break;case"line":z=_(B,z),G=p(B);break;case"defs":k=!0;break;case"use":z=_(B,z);const U=(B.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),Z=B.viewportElement.getElementById(U);Z?n(Z,z):console.warn("SVGLoader: 'use node' references non-existent node id: "+U);break}G&&(z.fill!==void 0&&z.fill!=="none"&&G.color.setStyle(z.fill,bl),S(G,ce),L.push(G),G.userData={node:B,style:z});const T=B.childNodes;for(let I=0;I<T.length;I++){const U=T[I];k&&U.nodeName!=="style"&&U.nodeName!=="defs"||n(U,z)}F&&(R.pop(),R.length>0?ce.copy(R[R.length-1]):ce.identity())}function s(B){const z=new l.ShapePath,F=new l.Vector2,k=new l.Vector2,G=new l.Vector2;let T=!0,I=!1;const U=B.getAttribute("d");if(U===""||U==="none")return null;const Z=U.match(/[a-df-z][^a-df-z]*/gi);for(let j=0,E=Z.length;j<E;j++){const J=Z[j],se=J.charAt(0),ie=J.slice(1).trim();T===!0&&(I=!0,T=!1);let X;switch(se){case"M":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2)F.x=X[N+0],F.y=X[N+1],k.x=F.x,k.y=F.y,N===0?z.moveTo(F.x,F.y):z.lineTo(F.x,F.y),N===0&&G.copy(F);break;case"H":X=x(ie);for(let N=0,ae=X.length;N<ae;N++)F.x=X[N],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"V":X=x(ie);for(let N=0,ae=X.length;N<ae;N++)F.y=X[N],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"L":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2)F.x=X[N+0],F.y=X[N+1],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"C":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=6)z.bezierCurveTo(X[N+0],X[N+1],X[N+2],X[N+3],X[N+4],X[N+5]),k.x=X[N+2],k.y=X[N+3],F.x=X[N+4],F.y=X[N+5],N===0&&I===!0&&G.copy(F);break;case"S":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=4)z.bezierCurveTo(g(F.x,k.x),g(F.y,k.y),X[N+0],X[N+1],X[N+2],X[N+3]),k.x=X[N+0],k.y=X[N+1],F.x=X[N+2],F.y=X[N+3],N===0&&I===!0&&G.copy(F);break;case"Q":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=4)z.quadraticCurveTo(X[N+0],X[N+1],X[N+2],X[N+3]),k.x=X[N+0],k.y=X[N+1],F.x=X[N+2],F.y=X[N+3],N===0&&I===!0&&G.copy(F);break;case"T":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2){const he=g(F.x,k.x),_e=g(F.y,k.y);z.quadraticCurveTo(he,_e,X[N+0],X[N+1]),k.x=he,k.y=_e,F.x=X[N+0],F.y=X[N+1],N===0&&I===!0&&G.copy(F)}break;case"A":X=x(ie,[3,4],7);for(let N=0,ae=X.length;N<ae;N+=7){if(X[N+5]==F.x&&X[N+6]==F.y)continue;const he=F.clone();F.x=X[N+5],F.y=X[N+6],k.x=F.x,k.y=F.y,i(z,X[N],X[N+1],X[N+2],X[N+3],X[N+4],he,F),N===0&&I===!0&&G.copy(F)}break;case"m":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2)F.x+=X[N+0],F.y+=X[N+1],k.x=F.x,k.y=F.y,N===0?z.moveTo(F.x,F.y):z.lineTo(F.x,F.y),N===0&&G.copy(F);break;case"h":X=x(ie);for(let N=0,ae=X.length;N<ae;N++)F.x+=X[N],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"v":X=x(ie);for(let N=0,ae=X.length;N<ae;N++)F.y+=X[N],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"l":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2)F.x+=X[N+0],F.y+=X[N+1],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"c":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=6)z.bezierCurveTo(F.x+X[N+0],F.y+X[N+1],F.x+X[N+2],F.y+X[N+3],F.x+X[N+4],F.y+X[N+5]),k.x=F.x+X[N+2],k.y=F.y+X[N+3],F.x+=X[N+4],F.y+=X[N+5],N===0&&I===!0&&G.copy(F);break;case"s":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=4)z.bezierCurveTo(g(F.x,k.x),g(F.y,k.y),F.x+X[N+0],F.y+X[N+1],F.x+X[N+2],F.y+X[N+3]),k.x=F.x+X[N+0],k.y=F.y+X[N+1],F.x+=X[N+2],F.y+=X[N+3],N===0&&I===!0&&G.copy(F);break;case"q":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=4)z.quadraticCurveTo(F.x+X[N+0],F.y+X[N+1],F.x+X[N+2],F.y+X[N+3]),k.x=F.x+X[N+0],k.y=F.y+X[N+1],F.x+=X[N+2],F.y+=X[N+3],N===0&&I===!0&&G.copy(F);break;case"t":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2){const he=g(F.x,k.x),_e=g(F.y,k.y);z.quadraticCurveTo(he,_e,F.x+X[N+0],F.y+X[N+1]),k.x=he,k.y=_e,F.x=F.x+X[N+0],F.y=F.y+X[N+1],N===0&&I===!0&&G.copy(F)}break;case"a":X=x(ie,[3,4],7);for(let N=0,ae=X.length;N<ae;N+=7){if(X[N+5]==0&&X[N+6]==0)continue;const he=F.clone();F.x+=X[N+5],F.y+=X[N+6],k.x=F.x,k.y=F.y,i(z,X[N],X[N+1],X[N+2],X[N+3],X[N+4],he,F),N===0&&I===!0&&G.copy(F)}break;case"Z":case"z":z.currentPath.autoClose=!0,z.currentPath.curves.length>0&&(F.copy(G),z.currentPath.currentPoint.copy(F),T=!0);break;default:console.warn(J)}I=!1}return z}function r(B){if(!(!B.sheet||!B.sheet.cssRules||!B.sheet.cssRules.length))for(let z=0;z<B.sheet.cssRules.length;z++){const F=B.sheet.cssRules[z];if(F.type!==1)continue;const k=F.selectorText.split(/,/gm).filter(Boolean).map(G=>G.trim());for(let G=0;G<k.length;G++){const T=Object.fromEntries(Object.entries(F.style).filter(([,I])=>I!==""));V[k[G]]=Object.assign(V[k[G]]||{},T)}}}function i(B,z,F,k,G,T,I,U){if(z==0||F==0){B.lineTo(U.x,U.y);return}k=k*Math.PI/180,z=Math.abs(z),F=Math.abs(F);const Z=(I.x-U.x)/2,j=(I.y-U.y)/2,E=Math.cos(k)*Z+Math.sin(k)*j,J=-Math.sin(k)*Z+Math.cos(k)*j;let se=z*z,ie=F*F;const X=E*E,N=J*J,ae=X/se+N/ie;if(ae>1){const $e=Math.sqrt(ae);z=$e*z,F=$e*F,se=z*z,ie=F*F}const he=se*N+ie*X,_e=(se*ie-he)/he;let Ie=Math.sqrt(Math.max(0,_e));G===T&&(Ie=-Ie);const Oe=Ie*z*J/F,He=-Ie*F*E/z,dt=Math.cos(k)*Oe-Math.sin(k)*He+(I.x+U.x)/2,Tt=Math.sin(k)*Oe+Math.cos(k)*He+(I.y+U.y)/2,It=a(1,0,(E-Oe)/z,(J-He)/F),Ze=a((E-Oe)/z,(J-He)/F,(-E-Oe)/z,(-J-He)/F)%(Math.PI*2);B.currentPath.absellipse(dt,Tt,z,F,It,It+Ze,T===0,k)}function a(B,z,F,k){const G=B*F+z*k,T=Math.sqrt(B*B+z*z)*Math.sqrt(F*F+k*k);let I=Math.acos(Math.max(-1,Math.min(1,G/T)));return B*k-z*F<0&&(I=-I),I}function c(B){const z=v(B.getAttribute("x")||0),F=v(B.getAttribute("y")||0),k=v(B.getAttribute("rx")||B.getAttribute("ry")||0),G=v(B.getAttribute("ry")||B.getAttribute("rx")||0),T=v(B.getAttribute("width")),I=v(B.getAttribute("height")),U=1-.551915024494,Z=new l.ShapePath;return Z.moveTo(z+k,F),Z.lineTo(z+T-k,F),(k!==0||G!==0)&&Z.bezierCurveTo(z+T-k*U,F,z+T,F+G*U,z+T,F+G),Z.lineTo(z+T,F+I-G),(k!==0||G!==0)&&Z.bezierCurveTo(z+T,F+I-G*U,z+T-k*U,F+I,z+T-k,F+I),Z.lineTo(z+k,F+I),(k!==0||G!==0)&&Z.bezierCurveTo(z+k*U,F+I,z,F+I-G*U,z,F+I-G),Z.lineTo(z,F+G),(k!==0||G!==0)&&Z.bezierCurveTo(z,F+G*U,z+k*U,F,z+k,F),Z}function h(B){function z(T,I,U){const Z=v(I),j=v(U);G===0?k.moveTo(Z,j):k.lineTo(Z,j),G++}const F=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,k=new l.ShapePath;let G=0;return B.getAttribute("points").replace(F,z),k.currentPath.autoClose=!0,k}function d(B){function z(T,I,U){const Z=v(I),j=v(U);G===0?k.moveTo(Z,j):k.lineTo(Z,j),G++}const F=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,k=new l.ShapePath;let G=0;return B.getAttribute("points").replace(F,z),k.currentPath.autoClose=!1,k}function f(B){const z=v(B.getAttribute("cx")||0),F=v(B.getAttribute("cy")||0),k=v(B.getAttribute("r")||0),G=new l.Path;G.absarc(z,F,k,0,Math.PI*2);const T=new l.ShapePath;return T.subPaths.push(G),T}function y(B){const z=v(B.getAttribute("cx")||0),F=v(B.getAttribute("cy")||0),k=v(B.getAttribute("rx")||0),G=v(B.getAttribute("ry")||0),T=new l.Path;T.absellipse(z,F,k,G,0,Math.PI*2);const I=new l.ShapePath;return I.subPaths.push(T),I}function p(B){const z=v(B.getAttribute("x1")||0),F=v(B.getAttribute("y1")||0),k=v(B.getAttribute("x2")||0),G=v(B.getAttribute("y2")||0),T=new l.ShapePath;return T.moveTo(z,F),T.lineTo(k,G),T.currentPath.autoClose=!1,T}function _(B,z){z=Object.assign({},z);let F={};if(B.hasAttribute("class")){const I=B.getAttribute("class").split(/\s/).filter(Boolean).map(U=>U.trim());for(let U=0;U<I.length;U++)F=Object.assign(F,V["."+I[U]])}B.hasAttribute("id")&&(F=Object.assign(F,V["#"+B.getAttribute("id")]));function k(I,U,Z){Z===void 0&&(Z=function(E){return E.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),E}),B.hasAttribute(I)&&(z[U]=Z(B.getAttribute(I))),F[I]&&(z[U]=Z(F[I])),B.style&&B.style[I]!==""&&(z[U]=Z(B.style[I]))}function G(I){return Math.max(0,Math.min(1,v(I)))}function T(I){return Math.max(0,v(I))}return k("fill","fill"),k("fill-opacity","fillOpacity",G),k("fill-rule","fillRule"),k("opacity","opacity",G),k("stroke","stroke"),k("stroke-opacity","strokeOpacity",G),k("stroke-width","strokeWidth",T),k("stroke-linejoin","strokeLineJoin"),k("stroke-linecap","strokeLineCap"),k("stroke-miterlimit","strokeMiterLimit",T),k("visibility","visibility"),z}function g(B,z){return B-(z-B)}function x(B,z,F){if(typeof B!="string")throw new TypeError("Invalid input: "+typeof B);const k={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},G=0,T=1,I=2,U=3;let Z=G,j=!0,E="",J="";const se=[];function ie(he,_e,Ie){const Oe=new SyntaxError('Unexpected character "'+he+'" at index '+_e+".");throw Oe.partial=Ie,Oe}function X(){E!==""&&(J===""?se.push(Number(E)):se.push(Number(E)*Math.pow(10,Number(J)))),E="",J=""}let N;const ae=B.length;for(let he=0;he<ae;he++){if(N=B[he],Array.isArray(z)&&z.includes(se.length%F)&&k.FLAGS.test(N)){Z=T,E=N,X();continue}if(Z===G){if(k.WHITESPACE.test(N))continue;if(k.DIGIT.test(N)||k.SIGN.test(N)){Z=T,E=N;continue}if(k.POINT.test(N)){Z=I,E=N;continue}k.COMMA.test(N)&&(j&&ie(N,he,se),j=!0)}if(Z===T){if(k.DIGIT.test(N)){E+=N;continue}if(k.POINT.test(N)){E+=N,Z=I;continue}if(k.EXP.test(N)){Z=U;continue}k.SIGN.test(N)&&E.length===1&&k.SIGN.test(E[0])&&ie(N,he,se)}if(Z===I){if(k.DIGIT.test(N)){E+=N;continue}if(k.EXP.test(N)){Z=U;continue}k.POINT.test(N)&&E[E.length-1]==="."&&ie(N,he,se)}if(Z===U){if(k.DIGIT.test(N)){J+=N;continue}if(k.SIGN.test(N)){if(J===""){J+=N;continue}J.length===1&&k.SIGN.test(J)&&ie(N,he,se)}}k.WHITESPACE.test(N)?(X(),Z=G,j=!1):k.COMMA.test(N)?(X(),Z=G,j=!0):k.SIGN.test(N)?(X(),Z=T,E=N):k.POINT.test(N)?(X(),Z=I,E=N):ie(N,he,se)}return X(),se}const m=["mm","cm","in","pt","pc","px"],M={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(B){let z="px";if(typeof B=="string"||B instanceof String)for(let k=0,G=m.length;k<G;k++){const T=m[k];if(B.endsWith(T)){z=T,B=B.substring(0,B.length-T.length);break}}let F;return z==="px"&&t.defaultUnit!=="px"?F=M.in[t.defaultUnit]/t.defaultDPI:(F=M[z][t.defaultUnit],F<0&&(F=M[z].in*t.defaultDPI)),F*parseFloat(B)}function C(B){if(!(B.hasAttribute("transform")||B.nodeName==="use"&&(B.hasAttribute("x")||B.hasAttribute("y"))))return null;const z=O(B);return R.length>0&&z.premultiply(R[R.length-1]),ce.copy(z),R.push(z),z}function O(B){const z=new l.Matrix3,F=Y;if(B.nodeName==="use"&&(B.hasAttribute("x")||B.hasAttribute("y"))){const k=v(B.getAttribute("x")),G=v(B.getAttribute("y"));z.translate(k,G)}if(B.hasAttribute("transform")){const k=B.getAttribute("transform").split(")");for(let G=k.length-1;G>=0;G--){const T=k[G].trim();if(T==="")continue;const I=T.indexOf("("),U=T.length;if(I>0&&I<U){const Z=T.slice(0,I),j=x(T.slice(I+1));switch(F.identity(),Z){case"translate":if(j.length>=1){const E=j[0];let J=0;j.length>=2&&(J=j[1]),F.translate(E,J)}break;case"rotate":if(j.length>=1){let E=0,J=0,se=0;E=j[0]*Math.PI/180,j.length>=3&&(J=j[1],se=j[2]),W.makeTranslation(-J,-se),$.makeRotation(E),q.multiplyMatrices($,W),W.makeTranslation(J,se),F.multiplyMatrices(W,q)}break;case"scale":if(j.length>=1){const E=j[0];let J=E;j.length>=2&&(J=j[1]),F.scale(E,J)}break;case"skewX":j.length===1&&F.set(1,Math.tan(j[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":j.length===1&&F.set(1,0,0,Math.tan(j[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":j.length===6&&F.set(j[0],j[2],j[4],j[1],j[3],j[5],0,0,1);break}}z.premultiply(F)}}return z}function S(B,z){function F(I){te.set(I.x,I.y,1).applyMatrix3(z),I.set(te.x,te.y)}function k(I){const U=I.xRadius,Z=I.yRadius,j=Math.cos(I.aRotation),E=Math.sin(I.aRotation),J=new l.Vector3(U*j,U*E,0),se=new l.Vector3(-Z*E,Z*j,0),ie=J.applyMatrix3(z),X=se.applyMatrix3(z),N=Y.set(ie.x,X.x,0,ie.y,X.y,0,0,0,1),ae=W.copy(N).invert(),Ie=$.copy(ae).transpose().multiply(ae).elements,Oe=D(Ie[0],Ie[1],Ie[4]),He=Math.sqrt(Oe.rt1),dt=Math.sqrt(Oe.rt2);if(I.xRadius=1/He,I.yRadius=1/dt,I.aRotation=Math.atan2(Oe.sn,Oe.cs),!((I.aEndAngle-I.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const It=W.set(He,0,0,0,dt,0,0,0,1),Ze=$.set(Oe.cs,Oe.sn,0,-Oe.sn,Oe.cs,0,0,0,1),$e=It.multiply(Ze).multiply(N),En=Yn=>{const{x:Wn,y:yn}=new l.Vector3(Math.cos(Yn),Math.sin(Yn),0).applyMatrix3($e);return Math.atan2(yn,Wn)};I.aStartAngle=En(I.aStartAngle),I.aEndAngle=En(I.aEndAngle),A(z)&&(I.aClockwise=!I.aClockwise)}}function G(I){const U=P(z),Z=w(z);I.xRadius*=U,I.yRadius*=Z;const j=U>Number.EPSILON?Math.atan2(z.elements[1],z.elements[0]):Math.atan2(-z.elements[3],z.elements[4]);I.aRotation+=j,A(z)&&(I.aStartAngle*=-1,I.aEndAngle*=-1,I.aClockwise=!I.aClockwise)}const T=B.subPaths;for(let I=0,U=T.length;I<U;I++){const j=T[I].curves;for(let E=0;E<j.length;E++){const J=j[E];J.isLineCurve?(F(J.v1),F(J.v2)):J.isCubicBezierCurve?(F(J.v0),F(J.v1),F(J.v2),F(J.v3)):J.isQuadraticBezierCurve?(F(J.v0),F(J.v1),F(J.v2)):J.isEllipseCurve&&(ne.set(J.aX,J.aY),F(ne),J.aX=ne.x,J.aY=ne.y,b(z)?k(J):G(J))}}}function A(B){const z=B.elements;return z[0]*z[4]-z[1]*z[3]<0}function b(B){const z=B.elements,F=z[0]*z[3]+z[1]*z[4];if(F===0)return!1;const k=P(B),G=w(B);return Math.abs(F/(k*G))>Number.EPSILON}function P(B){const z=B.elements;return Math.sqrt(z[0]*z[0]+z[1]*z[1])}function w(B){const z=B.elements;return Math.sqrt(z[3]*z[3]+z[4]*z[4])}function D(B,z,F){let k,G,T,I,U;const Z=B+F,j=B-F,E=Math.sqrt(j*j+4*z*z);return Z>0?(k=.5*(Z+E),U=1/k,G=B*U*F-z*U*z):Z<0?G=.5*(Z-E):(k=.5*E,G=-.5*E),j>0?T=j+E:T=j-E,Math.abs(T)>2*Math.abs(z)?(U=-2*z/T,I=1/Math.sqrt(1+U*U),T=U*I):Math.abs(z)===0?(T=1,I=0):(U=-.5*T/z,T=1/Math.sqrt(1+U*U),I=U*T),j>0&&(U=T,T=-I,I=U),{rt1:k,rt2:G,cs:T,sn:I}}const L=[],V={},R=[],Y=new l.Matrix3,W=new l.Matrix3,$=new l.Matrix3,q=new l.Matrix3,ne=new l.Vector2,te=new l.Vector3,ce=new l.Matrix3,le=new DOMParser().parseFromString(e,"image/svg+xml");return n(le.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:L,xml:le.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 r(g,x,m,M){const v=g.x,C=x.x,O=m.x,S=M.x,A=g.y,b=x.y,P=m.y,w=M.y,D=(S-O)*(A-P)-(w-P)*(v-O),L=(C-v)*(A-P)-(b-A)*(v-O),V=(w-P)*(C-v)-(S-O)*(b-A),R=D/V,Y=L/V;if(V===0&&D!==0||R<=0||R>=1||Y<0||Y>1)return null;if(D===0&&V===0){for(let W=0;W<2;W++)if(i(W===0?m:M,g,x),s.loc==n.ORIGIN){const $=W===0?m:M;return{x:$.x,y:$.y,t:s.t}}else if(s.loc==n.BETWEEN){const $=+(v+s.t*(C-v)).toPrecision(10),q=+(A+s.t*(b-A)).toPrecision(10);return{x:$,y:q,t:s.t}}return null}else{for(let q=0;q<2;q++)if(i(q===0?m:M,g,x),s.loc==n.ORIGIN){const ne=q===0?m:M;return{x:ne.x,y:ne.y,t:s.t}}const W=+(v+R*(C-v)).toPrecision(10),$=+(A+R*(b-A)).toPrecision(10);return{x:W,y:$,t:R}}}function i(g,x,m){const M=m.x-x.x,v=m.y-x.y,C=g.x-x.x,O=g.y-x.y,S=M*O-C*v;if(g.x===x.x&&g.y===x.y){s.loc=n.ORIGIN,s.t=0;return}if(g.x===m.x&&g.y===m.y){s.loc=n.DESTINATION,s.t=1;return}if(S<-Number.EPSILON){s.loc=n.LEFT;return}if(S>Number.EPSILON){s.loc=n.RIGHT;return}if(M*C<0||v*O<0){s.loc=n.BEHIND;return}if(Math.sqrt(M*M+v*v)<Math.sqrt(C*C+O*O)){s.loc=n.BEYOND;return}let A;M!==0?A=C/M:A=O/v,s.loc=n.BETWEEN,s.t=A}function a(g,x){const m=[],M=[];for(let v=1;v<g.length;v++){const C=g[v-1],O=g[v];for(let S=1;S<x.length;S++){const A=x[S-1],b=x[S],P=r(C,O,A,b);P!==null&&m.find(w=>w.t<=P.t+Number.EPSILON&&w.t>=P.t-Number.EPSILON)===void 0&&(m.push(P),M.push(new l.Vector2(P.x,P.y)))}}return M}function c(g,x,m){const M=new l.Vector2;x.getCenter(M);const v=[];return m.forEach(C=>{C.boundingBox.containsPoint(M)&&a(g,C.points).forEach(S=>{v.push({identifier:C.identifier,isCW:C.isCW,point:S})})}),v.sort((C,O)=>C.point.x-O.point.x),v}function h(g,x,m,M,v){(v==null||v==="")&&(v="nonzero");const C=new l.Vector2;g.boundingBox.getCenter(C);const O=[new l.Vector2(m,C.y),new l.Vector2(M,C.y)],S=c(O,g.boundingBox,x);S.sort((L,V)=>L.point.x-V.point.x);const A=[],b=[];S.forEach(L=>{L.identifier===g.identifier?A.push(L):b.push(L)});const P=A[0].point.x,w=[];let D=0;for(;D<b.length&&b[D].point.x<P;)w.length>0&&w[w.length-1]===b[D].identifier?w.pop():w.push(b[D].identifier),D++;if(w.push(g.identifier),v==="evenodd"){const L=w.length%2===0,V=w[w.length-2];return{identifier:g.identifier,isHole:L,for:V}}else if(v==="nonzero"){let L=!0,V=null,R=null;for(let Y=0;Y<w.length;Y++){const W=w[Y];L?(R=x[W].isCW,L=!1,V=W):R!==x[W].isCW&&(R=x[W].isCW,L=!0)}return{identifier:g.identifier,isHole:L,for:V}}else console.warn('fill-rule: "'+v+'" is currently not implemented.')}let d=999999999,f=-999999999,y=e.subPaths.map(g=>{const x=g.getPoints();let m=-999999999,M=999999999,v=-999999999,C=999999999;for(let O=0;O<x.length;O++){const S=x[O];S.y>m&&(m=S.y),S.y<M&&(M=S.y),S.x>v&&(v=S.x),S.x<C&&(C=S.x)}return f<=v&&(f=v+1),d>=C&&(d=C-1),{curves:g.curves,points:x,isCW:l.ShapeUtils.isClockWise(x),identifier:-1,boundingBox:new l.Box2(new l.Vector2(C,M),new l.Vector2(v,m))}});y=y.filter(g=>g.points.length>1);for(let g=0;g<y.length;g++)y[g].identifier=g;const p=y.map(g=>h(g,y,d,f,e.userData?e.userData.style.fillRule:void 0)),_=[];return y.forEach(g=>{if(!p[g.identifier].isHole){const m=new l.Shape;m.curves=g.curves,p.filter(v=>v.isHole&&v.for===g.identifier).forEach(v=>{const C=y[v.identifier],O=new l.Path;O.curves=C.curves,m.holes.push(O)}),_.push(m)}}),_}static getStrokeStyle(e,t,n,s,r){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",r=r!==void 0?r:4,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:s,strokeMiterLimit:r}}static pointsToStroke(e,t,n,s){const r=[],i=[],a=[];if(nn.pointsToStrokeWithBuffers(e,t,n,s,r,i,a)===0)return null;const c=new l.BufferGeometry;return c.setAttribute("position",new l.Float32BufferAttribute(r,3)),c.setAttribute("normal",new l.Float32BufferAttribute(i,3)),c.setAttribute("uv",new l.Float32BufferAttribute(a,2)),c}static pointsToStrokeWithBuffers(e,t,n,s,r,i,a,c){const h=new l.Vector2,d=new l.Vector2,f=new l.Vector2,y=new l.Vector2,p=new l.Vector2,_=new l.Vector2,g=new l.Vector2,x=new l.Vector2,m=new l.Vector2,M=new l.Vector2,v=new l.Vector2,C=new l.Vector2,O=new l.Vector2,S=new l.Vector2,A=new l.Vector2,b=new l.Vector2,P=new l.Vector2;n=n!==void 0?n:12,s=s!==void 0?s:.001,c=c!==void 0?c:0,e=j(e);const w=e.length;if(w<2)return 0;const D=e[0].equals(e[w-1]);let L,V=e[0],R;const Y=t.strokeWidth/2,W=1/(w-1);let $=0,q,ne,te,ce,le=!1,me=0,B=c*3,z=c*2;F(e[0],e[1],h).multiplyScalar(Y),x.copy(e[0]).sub(h),m.copy(e[0]).add(h),M.copy(x),v.copy(m);for(let E=1;E<w;E++){L=e[E],E===w-1?D?R=e[1]:R=void 0:R=e[E+1];const J=h;if(F(V,L,J),f.copy(J).multiplyScalar(Y),C.copy(L).sub(f),O.copy(L).add(f),q=$+W,ne=!1,R!==void 0){F(L,R,d),f.copy(d).multiplyScalar(Y),S.copy(L).sub(f),A.copy(L).add(f),te=!0,f.subVectors(R,V),J.dot(f)<0&&(te=!1),E===1&&(le=te),f.subVectors(R,L),f.normalize();const se=Math.abs(J.dot(f));if(se>Number.EPSILON){const ie=Y/se;f.multiplyScalar(-ie),y.subVectors(L,V),p.copy(y).setLength(ie).add(f),b.copy(p).negate();const X=p.length(),N=y.length();y.divideScalar(N),_.subVectors(R,L);const ae=_.length();switch(_.divideScalar(ae),y.dot(b)<N&&_.dot(b)<ae&&(ne=!0),P.copy(p).add(L),b.add(L),ce=!1,ne?te?(A.copy(b),O.copy(b)):(S.copy(b),C.copy(b)):T(),t.strokeLineJoin){case"bevel":I(te,ne,q);break;case"round":U(te,ne),te?G(L,C,S,q,0):G(L,A,O,q,1);break;case"miter":case"miter-clip":default:const he=Y*t.strokeMiterLimit/X;if(he<1)if(t.strokeLineJoin!=="miter-clip"){I(te,ne,q);break}else U(te,ne),te?(_.subVectors(P,C).multiplyScalar(he).add(C),g.subVectors(P,S).multiplyScalar(he).add(S),k(C,q,0),k(_,q,0),k(L,q,.5),k(L,q,.5),k(_,q,0),k(g,q,0),k(L,q,.5),k(g,q,0),k(S,q,0)):(_.subVectors(P,O).multiplyScalar(he).add(O),g.subVectors(P,A).multiplyScalar(he).add(A),k(O,q,1),k(_,q,1),k(L,q,.5),k(L,q,.5),k(_,q,1),k(g,q,1),k(L,q,.5),k(g,q,1),k(A,q,1));else ne?(te?(k(m,$,1),k(x,$,0),k(P,q,0),k(m,$,1),k(P,q,0),k(b,q,1)):(k(m,$,1),k(x,$,0),k(P,q,1),k(x,$,0),k(b,q,0),k(P,q,1)),te?S.copy(P):A.copy(P)):te?(k(C,q,0),k(P,q,0),k(L,q,.5),k(L,q,.5),k(P,q,0),k(S,q,0)):(k(O,q,1),k(P,q,1),k(L,q,.5),k(L,q,.5),k(P,q,1),k(A,q,1)),ce=!0;break}}else T()}else T();!D&&E===w-1&&Z(e[0],M,v,te,!0,$),$=q,V=L,x.copy(S),m.copy(A)}if(!D)Z(L,C,O,te,!1,q);else if(ne&&r){let E=P,J=b;le!==te&&(E=b,J=P),te?(ce||le)&&(J.toArray(r,0*3),J.toArray(r,3*3),ce&&E.toArray(r,1*3)):(ce||!le)&&(J.toArray(r,1*3),J.toArray(r,3*3),ce&&E.toArray(r,0*3))}return me;function F(E,J,se){return se.subVectors(J,E),se.set(-se.y,se.x).normalize()}function k(E,J,se){r&&(r[B]=E.x,r[B+1]=E.y,r[B+2]=0,i&&(i[B]=0,i[B+1]=0,i[B+2]=1),B+=3,a&&(a[z]=J,a[z+1]=se,z+=2)),me+=3}function G(E,J,se,ie,X){h.copy(J).sub(E).normalize(),d.copy(se).sub(E).normalize();let N=Math.PI;const ae=h.dot(d);Math.abs(ae)<1&&(N=Math.abs(Math.acos(ae))),N/=n,f.copy(J);for(let he=0,_e=n-1;he<_e;he++)y.copy(f).rotateAround(E,N),k(f,ie,X),k(y,ie,X),k(E,ie,.5),f.copy(y);k(y,ie,X),k(se,ie,X),k(E,ie,.5)}function T(){k(m,$,1),k(x,$,0),k(C,q,0),k(m,$,1),k(C,q,0),k(O,q,1)}function I(E,J,se){J?E?(k(m,$,1),k(x,$,0),k(C,q,0),k(m,$,1),k(C,q,0),k(b,q,1),k(C,se,0),k(S,se,0),k(b,se,.5)):(k(m,$,1),k(x,$,0),k(O,q,1),k(x,$,0),k(b,q,0),k(O,q,1),k(O,se,1),k(b,se,0),k(A,se,1)):E?(k(C,se,0),k(S,se,0),k(L,se,.5)):(k(O,se,1),k(A,se,0),k(L,se,.5))}function U(E,J){J&&(E?(k(m,$,1),k(x,$,0),k(C,q,0),k(m,$,1),k(C,q,0),k(b,q,1),k(C,$,0),k(L,q,.5),k(b,q,1),k(L,q,.5),k(S,$,0),k(b,q,1)):(k(m,$,1),k(x,$,0),k(O,q,1),k(x,$,0),k(b,q,0),k(O,q,1),k(O,$,1),k(b,q,0),k(L,q,.5),k(L,q,.5),k(b,q,0),k(A,$,1)))}function Z(E,J,se,ie,X,N){switch(t.strokeLineCap){case"round":X?G(E,se,J,N,.5):G(E,J,se,N,.5);break;case"square":if(X)h.subVectors(J,E),d.set(h.y,-h.x),f.addVectors(h,d).add(E),y.subVectors(d,h).add(E),ie?(f.toArray(r,1*3),y.toArray(r,0*3),y.toArray(r,3*3)):(f.toArray(r,1*3),a[3*2+1]===1?y.toArray(r,3*3):f.toArray(r,3*3),y.toArray(r,0*3));else{h.subVectors(se,E),d.set(h.y,-h.x),f.addVectors(h,d).add(E),y.subVectors(d,h).add(E);const ae=r.length;ie?(f.toArray(r,ae-1*3),y.toArray(r,ae-2*3),y.toArray(r,ae-4*3)):(y.toArray(r,ae-2*3),f.toArray(r,ae-1*3),y.toArray(r,ae-4*3))}break}}function j(E){let J=!1;for(let ie=1,X=E.length-1;ie<X;ie++)if(E[ie].distanceTo(E[ie+1])<s){J=!0;break}if(!J)return E;const se=[];se.push(E[0]);for(let ie=1,X=E.length-1;ie<X;ie++)E[ie].distanceTo(E[ie+1])>=s&&se.push(E[ie]);return se.push(E[E.length-1]),se}}}const ds=new WeakMap;class Ml extends l.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,s){const r=new l.FileLoader(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,i=>{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(i,a).then(t).catch(s)},n,s)}decodeDracoFile(e,t,n,s){const r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,r).then(t)}decodeGeometry(e,t){for(const c in t.attributeTypes){const h=t.attributeTypes[c];h.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[c]=h.name)}const n=JSON.stringify(t);if(ds.has(e)){const c=ds.get(e);if(c.key===n)return c.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 r=this.workerNextTaskID++,i=e.byteLength,a=this._getWorker(r,i).then(c=>(s=c,new Promise((h,d)=>{s._callbacks[r]={resolve:h,reject:d},s.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return a.catch(()=>!0).then(()=>{s&&r&&this._releaseTask(s,r)}),ds.set(e,{key:n,promise:a}),a}_createGeometry(e){const t=new l.BufferGeometry;e.index&&t.setIndex(new l.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n],r=s.name,i=s.array,a=s.itemSize;t.setAttribute(r,new l.BufferAttribute(i,a))}return t}_loadLibrary(e,t){const n=new l.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((s,r)=>{n.load(e,s,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 s=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const r=Sl.toString(),i=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
|
|
395
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),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(r){const i=r.data;switch(i.type){case"decode":s._callbacks[i.id].resolve(i);break;case"error":s._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,r){return s._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 Sl(){let o,e;onmessage=function(i){const a=i.data;switch(a.type){case"init":o=a.decoderConfig,e=new Promise(function(d){o.onModuleLoaded=function(f){d({draco:f})},DracoDecoderModule(o)});break;case"decode":const c=a.buffer,h=a.taskConfig;e.then(d=>{const f=d.draco,y=new f.Decoder,p=new f.DecoderBuffer;p.Init(new Int8Array(c),c.byteLength);try{const _=t(f,y,p,h),g=_.attributes.map(x=>x.array.buffer);_.index&&g.push(_.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:_},g)}catch(_){console.error(_),self.postMessage({type:"error",id:a.id,error:_.message})}finally{f.destroy(p),f.destroy(y)}});break}};function t(i,a,c,h){const d=h.attributeIDs,f=h.attributeTypes;let y,p;const _=a.GetEncodedGeometryType(c);if(_===i.TRIANGULAR_MESH)y=new i.Mesh,p=a.DecodeBufferToMesh(c,y);else if(_===i.POINT_CLOUD)y=new i.PointCloud,p=a.DecodeBufferToPointCloud(c,y);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||y.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const g={index:null,attributes:[]};for(const x in d){const m=self[f[x]];let M,v;if(h.useUniqueIDs)v=d[x],M=a.GetAttributeByUniqueId(y,v);else{if(v=a.GetAttributeId(y,i[d[x]]),v===-1)continue;M=a.GetAttribute(y,v)}g.attributes.push(s(i,a,y,x,m,M))}return _===i.TRIANGULAR_MESH&&(g.index=n(i,a,y)),i.destroy(y),g}function n(i,a,c){const d=c.num_faces()*3,f=d*4,y=i._malloc(f);a.GetTrianglesUInt32Array(c,f,y);const p=new Uint32Array(i.HEAPF32.buffer,y,d).slice();return i._free(y),{array:p,itemSize:1}}function s(i,a,c,h,d,f){const y=f.num_components(),_=c.num_points()*y,g=_*d.BYTES_PER_ELEMENT,x=r(i,d),m=i._malloc(g);a.GetAttributeDataArrayForAllPoints(c,f,x,g,m);const M=new d(i.HEAPF32.buffer,m,_).slice();return i._free(m),{name:h,array:M,itemSize:y}}function r(i,a){switch(a){case Float32Array:return i.DT_FLOAT32;case Int8Array:return i.DT_INT8;case Int16Array:return i.DT_INT16;case Int32Array:return i.DT_INT32;case Uint8Array:return i.DT_UINT8;case Uint16Array:return i.DT_UINT16;case Uint32Array:return i.DT_UINT32}}}const Al=["args","center"],Cl=u.defineComponent({__name:"Text3D",props:{font:{},text:{},size:{default:.5},height:{default:.2},curveSegments:{default:5},bevelEnabled:{type:Boolean,default:!0},bevelThickness:{default:.05},bevelSize:{default:.02},bevelOffset:{default:0},bevelSegments:{default:4},center:{type:Boolean,default:!1},needUpdates:{type:Boolean,default:!1}},async setup(o,{expose:e}){let t,n;const s=o,{center:r,font:i,text:a,needUpdates:c,size:h,height:d,curveSegments:f,bevelEnabled:y,bevelThickness:p,bevelSize:_,bevelOffset:g,bevelSegments:x}=u.toRefs(s),{extend:m,invalidate:M}=ee.useTresContext();u.watch(s,()=>M()),m({TextGeometry:Pr});const v=new xl,C=u.useSlots(),O=u.computed(()=>{var P;return a!=null&&a.value?a.value:C.default?(P=C.default()[0].children)==null?void 0:P.trim():c.value?"":"TresJS"}),S=u.shallowRef();e({instance:S});const A=([t,n]=u.withAsyncContext(()=>new Promise((P,w)=>{try{typeof i.value=="string"?v.load(i.value,D=>{P(D)}):P(i.value)}catch(D){w(console.error("cientos",D))}})),t=await t,n(),t),b=u.computed(()=>({font:A,size:u.toValue(h),height:u.toValue(d),curveSegments:u.toValue(f),bevelEnabled:u.toValue(y),bevelThickness:u.toValue(p),bevelSize:u.toValue(_),bevelOffset:u.toValue(g),bevelSegments:u.toValue(x)}));return u.watchEffect(()=>{S.value&&c.value&&(S.value.geometry.dispose(),S.value.geometry=new Pr(O.value,b.value),r.value&&S.value.geometry.center())}),(P,w)=>u.unref(i)?(u.openBlock(),u.createElementBlock("TresMesh",{key:0,ref_key:"text3DRef",ref:S},[O.value?(u.openBlock(),u.createElementBlock("TresTextGeometry",{key:0,args:[O.value,b.value],center:u.unref(r)},null,8,Al)):u.createCommentVNode("",!0),u.renderSlot(P.$slots,"default")],512)):u.createCommentVNode("",!0)}});function Pl(o,e){const t=u.ref(e),n=new l.AnimationMixer(t.value),s=u.shallowReactive({});o.forEach(i=>{const a=n.clipAction(i,t.value);s[i.name]=a});const{onBeforeRender:r}=ee.useLoop();return r(({delta:i})=>{n.update(i)}),{actions:s,mixer:n}}const Tl=u.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=u.shallowRef();e({instance:n});{const c=Math.random()*1e4,{onBeforeRender:h}=ee.useLoop();let d=c;h(({delta:f,invalidate:y})=>{if(!n.value)return;d+=f*t.speed;const p=d*.25,_=n.value;_.rotation.x=Math.cos(p)*.125*t.rotationFactor,_.rotation.y=Math.sin(p)*.125*t.rotationFactor,_.rotation.z=Math.sin(p)*.05*t.rotationFactor,_.position.y=l.MathUtils.mapLinear(Math.sin(p),-1,1,t.range[0],t.range[1])*t.floatFactor,y()})}return(s,r)=>(u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps(s.$attrs,{ref_key:"groupRef",ref:n}),[u.renderSlot(s.$slots,"default")],16))}}),Il=["args","material-uniforms-color-value"],Ol=u.createElementVNode("TresPlaneGeometry",{args:[5,5]},null,-1),Dl=u.defineComponent({__name:"Reflector",props:{color:{default:"#333"},textureWidth:{default:512},textureHeight:{default:512},clipBias:{default:0},multisample:{default:4},shader:{default:ns.ReflectorShader}},setup(o,{expose:e}){const t=o,{extend:n,invalidate:s}=ee.useTresContext(),r=u.shallowRef();n({Reflector:ns});const{color:i,textureWidth:a,textureHeight:c,clipBias:h,multisample:d,shader:f}=u.toRefs(t);return u.watch(t,()=>s()),e({instance:r}),(y,p)=>(u.openBlock(),u.createElementBlock("TresReflector",{ref_key:"reflectorRef",ref:r,args:[void 0,{textureWidth:u.unref(a),textureHeight:u.unref(c),clipBias:u.unref(h),multisample:u.unref(d),shader:u.unref(f)}],"material-uniforms-color-value":u.unref(i)},[u.renderSlot(y.$slots,"default",{},()=>[Ol])],8,Il))}});function ps(o){return u.getCurrentScope()?(u.onScopeDispose(o),!0):!1}function Ge(o){return typeof o=="function"?o():u.unref(o)}const Ll=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Bl=Object.prototype.toString,kl=o=>Bl.call(o)==="[object Object]",vt=()=>{};function ms(o,e){function t(...n){return new Promise((s,r)=>{Promise.resolve(o(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})).then(s).catch(r)})}return t}const Fl=o=>o();function Ul(o,e={}){let t,n,s=vt;const r=a=>{clearTimeout(a),s(),s=vt};return a=>{const c=Ge(o),h=Ge(e.maxWait);return t&&r(t),c<=0||h!==void 0&&h<=0?(n&&(r(n),n=null),Promise.resolve(a())):new Promise((d,f)=>{s=e.rejectOnCancel?f:d,h&&!n&&(n=setTimeout(()=>{t&&r(t),n=null,d(a())},h)),t=setTimeout(()=>{n&&r(n),n=null,d(a())},c)})}}function zr(...o){let e=0,t,n=!0,s=vt,r,i,a,c,h;!u.isRef(o[0])&&typeof o[0]=="object"?{delay:i,trailing:a=!0,leading:c=!0,rejectOnCancel:h=!1}=o[0]:[i,a=!0,c=!0,h=!1]=o;const d=()=>{t&&(clearTimeout(t),t=void 0,s(),s=vt)};return y=>{const p=Ge(i),_=Date.now()-e,g=()=>r=y();return d(),p<=0?(e=Date.now(),g()):(_>p&&(c||!n)?(e=Date.now(),g()):a&&(r=new Promise((x,m)=>{s=h?m:x,t=setTimeout(()=>{e=Date.now(),n=!0,x(g()),d()},Math.max(0,p-_))})),!c&&!t&&(t=setTimeout(()=>n=!0,p)),n=!1,r)}}function Nl(o){return u.getCurrentInstance()}function zl(o,e=200,t={}){return ms(Ul(e,t),o)}function Vl(o,e=200,t=!1,n=!0,s=!1){return ms(zr(e,t,n,s),o)}function Rl(o,e,t={}){const{eventFilter:n=Fl,...s}=t;return u.watch(o,ms(n,e),s)}function gs(o,e=!0,t){Nl()?u.onMounted(o,t):e?o():u.nextTick(o)}function Gl(o,e,t={}){const{throttle:n=0,trailing:s=!0,leading:r=!0,...i}=t;return Rl(o,e,{...i,eventFilter:zr(n,s,r)})}function wt(o){var e;const t=Ge(o);return(e=t==null?void 0:t.$el)!=null?e:t}const ht=Ll?window:void 0;function Ce(...o){let e,t,n,s;if(typeof o[0]=="string"||Array.isArray(o[0])?([t,n,s]=o,e=ht):[e,t,n,s]=o,!e)return vt;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const r=[],i=()=>{r.forEach(d=>d()),r.length=0},a=(d,f,y,p)=>(d.addEventListener(f,y,p),()=>d.removeEventListener(f,y,p)),c=u.watch(()=>[wt(e),Ge(s)],([d,f])=>{if(i(),!d)return;const y=kl(f)?{...f}:f;r.push(...t.flatMap(p=>n.map(_=>a(d,p,_,y))))},{immediate:!0,flush:"post"}),h=()=>{c(),i()};return ps(h),h}function jl(){const o=u.ref(!1),e=u.getCurrentInstance();return e&&u.onMounted(()=>{o.value=!0},e),o}function Vr(o){const e=jl();return u.computed(()=>(e.value,!!o()))}function El(o,e={}){const{window:t=ht}=e,n=Vr(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let s;const r=u.ref(!1),i=h=>{r.value=h.matches},a=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",i):s.removeListener(i))},c=u.watchEffect(()=>{n.value&&(a(),s=t.matchMedia(Ge(o)),"addEventListener"in s?s.addEventListener("change",i):s.addListener(i),r.value=s.matches)});return ps(()=>{c(),a(),s=void 0}),r}function Yl(o,e,t={}){const{window:n=ht,...s}=t;let r;const i=Vr(()=>n&&"ResizeObserver"in n),a=()=>{r&&(r.disconnect(),r=void 0)},c=u.computed(()=>{const f=Ge(o);return Array.isArray(f)?f.map(y=>wt(y)):[wt(f)]}),h=u.watch(c,f=>{if(a(),i.value&&n){r=new ResizeObserver(e);for(const y of f)y&&r.observe(y,s)}},{immediate:!0,flush:"post"}),d=()=>{a(),h()};return ps(d),{isSupported:i,stop:d}}function Wl(o,e={width:0,height:0},t={}){const{window:n=ht,box:s="content-box"}=t,r=u.computed(()=>{var f,y;return(y=(f=wt(o))==null?void 0:f.namespaceURI)==null?void 0:y.includes("svg")}),i=u.ref(e.width),a=u.ref(e.height),{stop:c}=Yl(o,([f])=>{const y=s==="border-box"?f.borderBoxSize:s==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(n&&r.value){const p=wt(o);if(p){const _=p.getBoundingClientRect();i.value=_.width,a.value=_.height}}else if(y){const p=Array.isArray(y)?y:[y];i.value=p.reduce((_,{inlineSize:g})=>_+g,0),a.value=p.reduce((_,{blockSize:g})=>_+g,0)}else i.value=f.contentRect.width,a.value=f.contentRect.height},t);gs(()=>{const f=wt(o);f&&(i.value="offsetWidth"in f?f.offsetWidth:e.width,a.value="offsetHeight"in f?f.offsetHeight:e.height)});const h=u.watch(()=>wt(o),f=>{i.value=f?e.width:0,a.value=f?e.height:0});function d(){c(),h()}return{width:i,height:a,stop:d}}const Rr=1;function Xl(o,e={}){const{throttle:t=0,idle:n=200,onStop:s=vt,onScroll:r=vt,offset:i={left:0,right:0,top:0,bottom:0},eventListenerOptions:a={capture:!1,passive:!0},behavior:c="auto",window:h=ht,onError:d=A=>{console.error(A)}}=e,f=u.ref(0),y=u.ref(0),p=u.computed({get(){return f.value},set(A){g(A,void 0)}}),_=u.computed({get(){return y.value},set(A){g(void 0,A)}});function g(A,b){var P,w,D,L;if(!h)return;const V=Ge(o);if(!V)return;(D=V instanceof Document?h.document.body:V)==null||D.scrollTo({top:(P=Ge(b))!=null?P:_.value,left:(w=Ge(A))!=null?w:p.value,behavior:Ge(c)});const R=((L=V==null?void 0:V.document)==null?void 0:L.documentElement)||(V==null?void 0:V.documentElement)||V;p!=null&&(f.value=R.scrollLeft),_!=null&&(y.value=R.scrollTop)}const x=u.ref(!1),m=u.reactive({left:!0,right:!1,top:!0,bottom:!1}),M=u.reactive({left:!1,right:!1,top:!1,bottom:!1}),v=A=>{x.value&&(x.value=!1,M.left=!1,M.right=!1,M.top=!1,M.bottom=!1,s(A))},C=zl(v,t+n),O=A=>{var b;if(!h)return;const P=((b=A==null?void 0:A.document)==null?void 0:b.documentElement)||(A==null?void 0:A.documentElement)||wt(A),{display:w,flexDirection:D}=getComputedStyle(P),L=P.scrollLeft;M.left=L<f.value,M.right=L>f.value;const V=Math.abs(L)<=(i.left||0),R=Math.abs(L)+P.clientWidth>=P.scrollWidth-(i.right||0)-Rr;w==="flex"&&D==="row-reverse"?(m.left=R,m.right=V):(m.left=V,m.right=R),f.value=L;let Y=P.scrollTop;A===h.document&&!Y&&(Y=h.document.body.scrollTop),M.top=Y<y.value,M.bottom=Y>y.value;const W=Math.abs(Y)<=(i.top||0),$=Math.abs(Y)+P.clientHeight>=P.scrollHeight-(i.bottom||0)-Rr;w==="flex"&&D==="column-reverse"?(m.top=$,m.bottom=W):(m.top=W,m.bottom=$),y.value=Y},S=A=>{var b;if(!h)return;const P=(b=A.target.documentElement)!=null?b:A.target;O(P),x.value=!0,C(A),r(A)};return Ce(o,"scroll",t?Vl(S,t,!0,!1):S,a),gs(()=>{try{const A=Ge(o);if(!A)return;O(A)}catch(A){d(A)}}),Ce(o,"scrollend",v,a),{x:p,y:_,isScrolling:x,arrivedState:m,directions:M,measure(){const A=Ge(o);h&&A&&O(A)}}}const Zl={ctrl:"control",command:"meta",cmd:"meta",option:"alt",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright"};function Kl(o={}){const{reactive:e=!1,target:t=ht,aliasMap:n=Zl,passive:s=!0,onEventFired:r=vt}=o,i=u.reactive(new Set),a={toJSON(){return{}},current:i},c=e?u.reactive(a):a,h=new Set,d=new Set;function f(g,x){g in c&&(e?c[g]=x:c[g].value=x)}function y(){i.clear();for(const g of d)f(g,!1)}function p(g,x){var m,M;const v=(m=g.key)==null?void 0:m.toLowerCase(),O=[(M=g.code)==null?void 0:M.toLowerCase(),v].filter(Boolean);v&&(x?i.add(v):i.delete(v));for(const S of O)d.add(S),f(S,x);v==="meta"&&!x?(h.forEach(S=>{i.delete(S),f(S,!1)}),h.clear()):typeof g.getModifierState=="function"&&g.getModifierState("Meta")&&x&&[...i,...O].forEach(S=>h.add(S))}Ce(t,"keydown",g=>(p(g,!0),r(g)),{passive:s}),Ce(t,"keyup",g=>(p(g,!1),r(g)),{passive:s}),Ce("blur",y,{passive:!0}),Ce("focus",y,{passive:!0});const _=new Proxy(c,{get(g,x,m){if(typeof x!="string")return Reflect.get(g,x,m);if(x=x.toLowerCase(),x in n&&(x=n[x]),!(x in c))if(/[+_-]/.test(x)){const v=x.split(/[+_-]/g).map(C=>C.trim());c[x]=u.computed(()=>v.every(C=>Ge(_[C])))}else c[x]=u.ref(!1);const M=Reflect.get(g,x,m);return e?Ge(M):M}});return _}const ql={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 Ql(o={}){const{type:e="page",touch:t=!0,resetOnTouchEnds:n=!1,initialValue:s={x:0,y:0},window:r=ht,target:i=r,scroll:a=!0,eventFilter:c}=o;let h=null;const d=u.ref(s.x),f=u.ref(s.y),y=u.ref(null),p=typeof e=="function"?e:ql[e],_=O=>{const S=p(O);h=O,S&&([d.value,f.value]=S,y.value="mouse")},g=O=>{if(O.touches.length>0){const S=p(O.touches[0]);S&&([d.value,f.value]=S,y.value="touch")}},x=()=>{if(!h||!r)return;const O=p(h);h instanceof MouseEvent&&O&&(d.value=O[0]+r.scrollX,f.value=O[1]+r.scrollY)},m=()=>{d.value=s.x,f.value=s.y},M=c?O=>c(()=>_(O),{}):O=>_(O),v=c?O=>c(()=>g(O),{}):O=>g(O),C=c?()=>c(()=>x(),{}):()=>x();if(i){const O={passive:!0};Ce(i,["mousemove","dragover"],M,O),t&&e!=="movement"&&(Ce(i,["touchstart","touchmove"],v,O),n&&Ce(i,"touchend",m,O)),a&&e==="page"&&Ce(r,"scroll",C,{passive:!0})}return{x:d,y:f,sourceType:y}}function Jl(o={}){const{window:e=ht,behavior:t="auto"}=o;if(!e)return{x:u.ref(0),y:u.ref(0)};const n=u.ref(e.scrollX),s=u.ref(e.scrollY),r=u.computed({get(){return n.value},set(a){scrollTo({left:a,behavior:t})}}),i=u.computed({get(){return s.value},set(a){scrollTo({top:a,behavior:t})}});return Ce(e,"scroll",()=>{n.value=e.scrollX,s.value=e.scrollY},{capture:!1,passive:!0}),{x:r,y:i}}function Gr(o={}){const{window:e=ht,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:r=!0,type:i="inner"}=o,a=u.ref(t),c=u.ref(n),h=()=>{e&&(i==="outer"?(a.value=e.outerWidth,c.value=e.outerHeight):r?(a.value=e.innerWidth,c.value=e.innerHeight):(a.value=e.document.documentElement.clientWidth,c.value=e.document.documentElement.clientHeight))};if(h(),gs(h),Ce("resize",h,{passive:!0}),s){const d=El("(orientation: portrait)");u.watch(d,()=>h())}return{width:a,height:c}}const Hl=u.defineComponent({__name:"MouseParallax",props:{disabled:{type:Boolean,default:!1},factor:{default:2.5},ease:{default:.1},local:{type:Boolean,default:!1}},setup(o){const e=o,{camera:t,renderer:n}=ee.useTresContext(),{disabled:s,factor:r,ease:i,local:a}=u.toRefs(e),c={};a.value&&(c.target=n.value.domElement,c.type="client");const{x:h,y:d}=Ql(c),{width:f,height:y}=a.value?Wl(n.value.domElement):Gr(),p=u.shallowRef(),_=u.ref(),g=u.ref();u.watch([r,i],()=>{_.value=Array.isArray(r.value)?r.value:[r.value,r.value],g.value=Array.isArray(i.value)?i.value:[i.value,i.value]},{immediate:!0});const x=u.computed(()=>(h.value/f.value-.5)*_.value[0]),m=u.computed(()=>-(d.value/y.value-.5)*_.value[1]),{onBeforeRender:M}=ee.useLoop();return M(({delta:v,invalidate:C})=>{s.value||!p.value||Number.isNaN(x.value)||Number.isNaN(m.value)||(p.value.position.x+=(x.value-p.value.position.x)*g.value[0]*v,p.value.position.y+=(m.value-p.value.position.y)*g.value[1]*v,C())}),u.watch(()=>p.value,v=>v==null?void 0:v.add(t.value)),(v,C)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"cameraGroupRef",ref:p},null,512))}}),$l=u.defineComponent({name:"GlobalAudio",props:["src","loop","volume","playbackRate","playTrigger","stopTrigger"],async setup(o,{expose:e,emit:t}){var f;const{camera:n,renderer:s}=ee.useTresContext(),r=new l.AudioListener;(f=n.value)==null||f.add(r);const i=new l.Audio(r),a=new l.AudioLoader;e({instance:i}),u.onUnmounted(()=>{i&&i.disconnect()}),u.watch(()=>[o.playbackRate],()=>i.setPlaybackRate(o.playbackRate??1),{immediate:!0}),u.watch(()=>[o.volume],()=>i.setVolume(o.volume??.5),{immediate:!0}),u.watch(()=>[o.loop],()=>i.setLoop(o.loop??!1),{immediate:!0}),u.watch(()=>[o.src],async()=>{const y=await a.loadAsync(o.src);i.setBuffer(y)},{immediate:!0});const h=document.getElementById(o.playTrigger??"")||s.value.domElement;Ce(h,"click",()=>{i.isPlaying?i.pause():i.play(),t("isPlaying",i.isPlaying)});const d=document.getElementById(o.stopTrigger??"");return d&&Ce(d,"click",()=>{i.stop(),t("isPlaying",i.isPlaying)}),null}});class sn extends l.Mesh{constructor(){super(sn.Geometry,new l.MeshBasicMaterial({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const e=new l.Vector3,t=new l.Vector3,n=new l.FramebufferTexture(16,16),s=new l.FramebufferTexture(16,16);let r=l.UnsignedByteType;const i=sn.Geometry,a=new l.RawShaderMaterial({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
394
|
+
`;continue}if((W=Y.match(w))&&(R.gamma=parseFloat(W[1])),(W=Y.match(D))&&(R.exposure=parseFloat(W[1])),(W=Y.match(L))&&(R.valid|=2,R.format=W[1]),(W=Y.match(V))&&(R.valid|=4,R.height=parseInt(W[1],10),R.width=parseInt(W[2],10)),R.valid&2&&R.valid&4)break}return R.valid&2||i(3,"missing format specifier"),R.valid&4||i(3,"missing image size specifier"),R},p=function(b,P,w){const D=P;if(D<8||D>32767||b[0]!==2||b[1]!==2||b[2]&128)return new Uint8Array(b);D!==(b[2]<<8|b[3])&&i(3,"wrong scanline width");const L=new Uint8Array(4*P*w);L.length||i(4,"unable to allocate buffer space");let V=0,R=0;const Y=4*D,W=new Uint8Array(4),$=new Uint8Array(Y);let q=w;for(;q>0&&R<b.byteLength;){R+4>b.byteLength&&i(1),W[0]=b[R++],W[1]=b[R++],W[2]=b[R++],W[3]=b[R++],(W[0]!=2||W[1]!=2||(W[2]<<8|W[3])!=D)&&i(3,"bad rgbe scanline format");let ne=0,te;for(;ne<Y&&R<b.byteLength;){te=b[R++];const le=te>128;if(le&&(te-=128),(te===0||ne+te>Y)&&i(3,"bad scanline data"),le){const me=b[R++];for(let B=0;B<te;B++)$[ne++]=me}else $.set(b.subarray(R,R+te),ne),ne+=te,R+=te}const ce=D;for(let le=0;le<ce;le++){let me=0;L[V]=$[le+me],me+=D,L[V+1]=$[le+me],me+=D,L[V+2]=$[le+me],me+=D,L[V+3]=$[le+me],V+=4}q--}return L},_=function(b,P,w,D){const L=b[P+3],V=Math.pow(2,L-128)/255;w[D+0]=b[P+0]*V,w[D+1]=b[P+1]*V,w[D+2]=b[P+2]*V,w[D+3]=1},y=function(b,P,w,D){const L=b[P+3],V=Math.pow(2,L-128)/255;w[D+0]=l.DataUtils.toHalfFloat(Math.min(b[P+0]*V,65504)),w[D+1]=l.DataUtils.toHalfFloat(Math.min(b[P+1]*V,65504)),w[D+2]=l.DataUtils.toHalfFloat(Math.min(b[P+2]*V,65504)),w[D+3]=l.DataUtils.toHalfFloat(1)},x=new Uint8Array(e);x.pos=0;const m=g(x),M=m.width,v=m.height,C=p(x.subarray(x.pos),M,v);let O,S,A;switch(this.type){case l.FloatType:A=C.length/4;const b=new Float32Array(A*4);for(let w=0;w<A;w++)_(C,w*4,b,w*4);O=b,S=l.FloatType;break;case l.HalfFloatType:A=C.length/4;const P=new Uint16Array(A*4);for(let w=0;w<A;w++)y(C,w*4,P,w*4);O=P,S=l.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:M,height:v,data:O,header:m.string,gamma:m.gamma,exposure:m.exposure,type:S}}setDataType(e){return this.type=e,this}load(e,t,n,s){function r(i,a){switch(i.type){case l.FloatType:case l.HalfFloatType:"colorSpace"in i?i.colorSpace="srgb-linear":i.encoding=3e3,i.minFilter=l.LinearFilter,i.magFilter=l.LinearFilter,i.generateMipmaps=!1,i.flipY=!0;break}t&&t(i,a)}return super.load(e,r,n,s)}}const bl="srgb";class nn extends l.Loader{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(e,t,n,s){const r=this,i=new l.FileLoader(r.manager);i.setPath(r.path),i.setRequestHeader(r.requestHeader),i.setWithCredentials(r.withCredentials),i.load(e,function(a){try{t(r.parse(a))}catch(c){s?s(c):console.error(c),r.manager.itemError(e)}},n,s)}parse(e){const t=this;function n(B,z){if(B.nodeType!==1)return;const F=C(B);let k=!1,G=null;switch(B.nodeName){case"svg":z=_(B,z);break;case"style":r(B);break;case"g":z=_(B,z);break;case"path":z=_(B,z),B.hasAttribute("d")&&(G=s(B));break;case"rect":z=_(B,z),G=c(B);break;case"polygon":z=_(B,z),G=h(B);break;case"polyline":z=_(B,z),G=d(B);break;case"circle":z=_(B,z),G=f(B);break;case"ellipse":z=_(B,z),G=g(B);break;case"line":z=_(B,z),G=p(B);break;case"defs":k=!0;break;case"use":z=_(B,z);const U=(B.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),Z=B.viewportElement.getElementById(U);Z?n(Z,z):console.warn("SVGLoader: 'use node' references non-existent node id: "+U);break}G&&(z.fill!==void 0&&z.fill!=="none"&&G.color.setStyle(z.fill,bl),S(G,ce),L.push(G),G.userData={node:B,style:z});const T=B.childNodes;for(let I=0;I<T.length;I++){const U=T[I];k&&U.nodeName!=="style"&&U.nodeName!=="defs"||n(U,z)}F&&(R.pop(),R.length>0?ce.copy(R[R.length-1]):ce.identity())}function s(B){const z=new l.ShapePath,F=new l.Vector2,k=new l.Vector2,G=new l.Vector2;let T=!0,I=!1;const U=B.getAttribute("d");if(U===""||U==="none")return null;const Z=U.match(/[a-df-z][^a-df-z]*/gi);for(let j=0,E=Z.length;j<E;j++){const J=Z[j],se=J.charAt(0),ie=J.slice(1).trim();T===!0&&(I=!0,T=!1);let X;switch(se){case"M":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2)F.x=X[N+0],F.y=X[N+1],k.x=F.x,k.y=F.y,N===0?z.moveTo(F.x,F.y):z.lineTo(F.x,F.y),N===0&&G.copy(F);break;case"H":X=x(ie);for(let N=0,ae=X.length;N<ae;N++)F.x=X[N],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"V":X=x(ie);for(let N=0,ae=X.length;N<ae;N++)F.y=X[N],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"L":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2)F.x=X[N+0],F.y=X[N+1],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"C":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=6)z.bezierCurveTo(X[N+0],X[N+1],X[N+2],X[N+3],X[N+4],X[N+5]),k.x=X[N+2],k.y=X[N+3],F.x=X[N+4],F.y=X[N+5],N===0&&I===!0&&G.copy(F);break;case"S":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=4)z.bezierCurveTo(y(F.x,k.x),y(F.y,k.y),X[N+0],X[N+1],X[N+2],X[N+3]),k.x=X[N+0],k.y=X[N+1],F.x=X[N+2],F.y=X[N+3],N===0&&I===!0&&G.copy(F);break;case"Q":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=4)z.quadraticCurveTo(X[N+0],X[N+1],X[N+2],X[N+3]),k.x=X[N+0],k.y=X[N+1],F.x=X[N+2],F.y=X[N+3],N===0&&I===!0&&G.copy(F);break;case"T":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2){const he=y(F.x,k.x),_e=y(F.y,k.y);z.quadraticCurveTo(he,_e,X[N+0],X[N+1]),k.x=he,k.y=_e,F.x=X[N+0],F.y=X[N+1],N===0&&I===!0&&G.copy(F)}break;case"A":X=x(ie,[3,4],7);for(let N=0,ae=X.length;N<ae;N+=7){if(X[N+5]==F.x&&X[N+6]==F.y)continue;const he=F.clone();F.x=X[N+5],F.y=X[N+6],k.x=F.x,k.y=F.y,i(z,X[N],X[N+1],X[N+2],X[N+3],X[N+4],he,F),N===0&&I===!0&&G.copy(F)}break;case"m":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2)F.x+=X[N+0],F.y+=X[N+1],k.x=F.x,k.y=F.y,N===0?z.moveTo(F.x,F.y):z.lineTo(F.x,F.y),N===0&&G.copy(F);break;case"h":X=x(ie);for(let N=0,ae=X.length;N<ae;N++)F.x+=X[N],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"v":X=x(ie);for(let N=0,ae=X.length;N<ae;N++)F.y+=X[N],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"l":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2)F.x+=X[N+0],F.y+=X[N+1],k.x=F.x,k.y=F.y,z.lineTo(F.x,F.y),N===0&&I===!0&&G.copy(F);break;case"c":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=6)z.bezierCurveTo(F.x+X[N+0],F.y+X[N+1],F.x+X[N+2],F.y+X[N+3],F.x+X[N+4],F.y+X[N+5]),k.x=F.x+X[N+2],k.y=F.y+X[N+3],F.x+=X[N+4],F.y+=X[N+5],N===0&&I===!0&&G.copy(F);break;case"s":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=4)z.bezierCurveTo(y(F.x,k.x),y(F.y,k.y),F.x+X[N+0],F.y+X[N+1],F.x+X[N+2],F.y+X[N+3]),k.x=F.x+X[N+0],k.y=F.y+X[N+1],F.x+=X[N+2],F.y+=X[N+3],N===0&&I===!0&&G.copy(F);break;case"q":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=4)z.quadraticCurveTo(F.x+X[N+0],F.y+X[N+1],F.x+X[N+2],F.y+X[N+3]),k.x=F.x+X[N+0],k.y=F.y+X[N+1],F.x+=X[N+2],F.y+=X[N+3],N===0&&I===!0&&G.copy(F);break;case"t":X=x(ie);for(let N=0,ae=X.length;N<ae;N+=2){const he=y(F.x,k.x),_e=y(F.y,k.y);z.quadraticCurveTo(he,_e,F.x+X[N+0],F.y+X[N+1]),k.x=he,k.y=_e,F.x=F.x+X[N+0],F.y=F.y+X[N+1],N===0&&I===!0&&G.copy(F)}break;case"a":X=x(ie,[3,4],7);for(let N=0,ae=X.length;N<ae;N+=7){if(X[N+5]==0&&X[N+6]==0)continue;const he=F.clone();F.x+=X[N+5],F.y+=X[N+6],k.x=F.x,k.y=F.y,i(z,X[N],X[N+1],X[N+2],X[N+3],X[N+4],he,F),N===0&&I===!0&&G.copy(F)}break;case"Z":case"z":z.currentPath.autoClose=!0,z.currentPath.curves.length>0&&(F.copy(G),z.currentPath.currentPoint.copy(F),T=!0);break;default:console.warn(J)}I=!1}return z}function r(B){if(!(!B.sheet||!B.sheet.cssRules||!B.sheet.cssRules.length))for(let z=0;z<B.sheet.cssRules.length;z++){const F=B.sheet.cssRules[z];if(F.type!==1)continue;const k=F.selectorText.split(/,/gm).filter(Boolean).map(G=>G.trim());for(let G=0;G<k.length;G++){const T=Object.fromEntries(Object.entries(F.style).filter(([,I])=>I!==""));V[k[G]]=Object.assign(V[k[G]]||{},T)}}}function i(B,z,F,k,G,T,I,U){if(z==0||F==0){B.lineTo(U.x,U.y);return}k=k*Math.PI/180,z=Math.abs(z),F=Math.abs(F);const Z=(I.x-U.x)/2,j=(I.y-U.y)/2,E=Math.cos(k)*Z+Math.sin(k)*j,J=-Math.sin(k)*Z+Math.cos(k)*j;let se=z*z,ie=F*F;const X=E*E,N=J*J,ae=X/se+N/ie;if(ae>1){const $e=Math.sqrt(ae);z=$e*z,F=$e*F,se=z*z,ie=F*F}const he=se*N+ie*X,_e=(se*ie-he)/he;let Ie=Math.sqrt(Math.max(0,_e));G===T&&(Ie=-Ie);const Oe=Ie*z*J/F,He=-Ie*F*E/z,dt=Math.cos(k)*Oe-Math.sin(k)*He+(I.x+U.x)/2,Tt=Math.sin(k)*Oe+Math.cos(k)*He+(I.y+U.y)/2,It=a(1,0,(E-Oe)/z,(J-He)/F),Ze=a((E-Oe)/z,(J-He)/F,(-E-Oe)/z,(-J-He)/F)%(Math.PI*2);B.currentPath.absellipse(dt,Tt,z,F,It,It+Ze,T===0,k)}function a(B,z,F,k){const G=B*F+z*k,T=Math.sqrt(B*B+z*z)*Math.sqrt(F*F+k*k);let I=Math.acos(Math.max(-1,Math.min(1,G/T)));return B*k-z*F<0&&(I=-I),I}function c(B){const z=v(B.getAttribute("x")||0),F=v(B.getAttribute("y")||0),k=v(B.getAttribute("rx")||B.getAttribute("ry")||0),G=v(B.getAttribute("ry")||B.getAttribute("rx")||0),T=v(B.getAttribute("width")),I=v(B.getAttribute("height")),U=1-.551915024494,Z=new l.ShapePath;return Z.moveTo(z+k,F),Z.lineTo(z+T-k,F),(k!==0||G!==0)&&Z.bezierCurveTo(z+T-k*U,F,z+T,F+G*U,z+T,F+G),Z.lineTo(z+T,F+I-G),(k!==0||G!==0)&&Z.bezierCurveTo(z+T,F+I-G*U,z+T-k*U,F+I,z+T-k,F+I),Z.lineTo(z+k,F+I),(k!==0||G!==0)&&Z.bezierCurveTo(z+k*U,F+I,z,F+I-G*U,z,F+I-G),Z.lineTo(z,F+G),(k!==0||G!==0)&&Z.bezierCurveTo(z,F+G*U,z+k*U,F,z+k,F),Z}function h(B){function z(T,I,U){const Z=v(I),j=v(U);G===0?k.moveTo(Z,j):k.lineTo(Z,j),G++}const F=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,k=new l.ShapePath;let G=0;return B.getAttribute("points").replace(F,z),k.currentPath.autoClose=!0,k}function d(B){function z(T,I,U){const Z=v(I),j=v(U);G===0?k.moveTo(Z,j):k.lineTo(Z,j),G++}const F=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,k=new l.ShapePath;let G=0;return B.getAttribute("points").replace(F,z),k.currentPath.autoClose=!1,k}function f(B){const z=v(B.getAttribute("cx")||0),F=v(B.getAttribute("cy")||0),k=v(B.getAttribute("r")||0),G=new l.Path;G.absarc(z,F,k,0,Math.PI*2);const T=new l.ShapePath;return T.subPaths.push(G),T}function g(B){const z=v(B.getAttribute("cx")||0),F=v(B.getAttribute("cy")||0),k=v(B.getAttribute("rx")||0),G=v(B.getAttribute("ry")||0),T=new l.Path;T.absellipse(z,F,k,G,0,Math.PI*2);const I=new l.ShapePath;return I.subPaths.push(T),I}function p(B){const z=v(B.getAttribute("x1")||0),F=v(B.getAttribute("y1")||0),k=v(B.getAttribute("x2")||0),G=v(B.getAttribute("y2")||0),T=new l.ShapePath;return T.moveTo(z,F),T.lineTo(k,G),T.currentPath.autoClose=!1,T}function _(B,z){z=Object.assign({},z);let F={};if(B.hasAttribute("class")){const I=B.getAttribute("class").split(/\s/).filter(Boolean).map(U=>U.trim());for(let U=0;U<I.length;U++)F=Object.assign(F,V["."+I[U]])}B.hasAttribute("id")&&(F=Object.assign(F,V["#"+B.getAttribute("id")]));function k(I,U,Z){Z===void 0&&(Z=function(E){return E.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),E}),B.hasAttribute(I)&&(z[U]=Z(B.getAttribute(I))),F[I]&&(z[U]=Z(F[I])),B.style&&B.style[I]!==""&&(z[U]=Z(B.style[I]))}function G(I){return Math.max(0,Math.min(1,v(I)))}function T(I){return Math.max(0,v(I))}return k("fill","fill"),k("fill-opacity","fillOpacity",G),k("fill-rule","fillRule"),k("opacity","opacity",G),k("stroke","stroke"),k("stroke-opacity","strokeOpacity",G),k("stroke-width","strokeWidth",T),k("stroke-linejoin","strokeLineJoin"),k("stroke-linecap","strokeLineCap"),k("stroke-miterlimit","strokeMiterLimit",T),k("visibility","visibility"),z}function y(B,z){return B-(z-B)}function x(B,z,F){if(typeof B!="string")throw new TypeError("Invalid input: "+typeof B);const k={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},G=0,T=1,I=2,U=3;let Z=G,j=!0,E="",J="";const se=[];function ie(he,_e,Ie){const Oe=new SyntaxError('Unexpected character "'+he+'" at index '+_e+".");throw Oe.partial=Ie,Oe}function X(){E!==""&&(J===""?se.push(Number(E)):se.push(Number(E)*Math.pow(10,Number(J)))),E="",J=""}let N;const ae=B.length;for(let he=0;he<ae;he++){if(N=B[he],Array.isArray(z)&&z.includes(se.length%F)&&k.FLAGS.test(N)){Z=T,E=N,X();continue}if(Z===G){if(k.WHITESPACE.test(N))continue;if(k.DIGIT.test(N)||k.SIGN.test(N)){Z=T,E=N;continue}if(k.POINT.test(N)){Z=I,E=N;continue}k.COMMA.test(N)&&(j&&ie(N,he,se),j=!0)}if(Z===T){if(k.DIGIT.test(N)){E+=N;continue}if(k.POINT.test(N)){E+=N,Z=I;continue}if(k.EXP.test(N)){Z=U;continue}k.SIGN.test(N)&&E.length===1&&k.SIGN.test(E[0])&&ie(N,he,se)}if(Z===I){if(k.DIGIT.test(N)){E+=N;continue}if(k.EXP.test(N)){Z=U;continue}k.POINT.test(N)&&E[E.length-1]==="."&&ie(N,he,se)}if(Z===U){if(k.DIGIT.test(N)){J+=N;continue}if(k.SIGN.test(N)){if(J===""){J+=N;continue}J.length===1&&k.SIGN.test(J)&&ie(N,he,se)}}k.WHITESPACE.test(N)?(X(),Z=G,j=!1):k.COMMA.test(N)?(X(),Z=G,j=!0):k.SIGN.test(N)?(X(),Z=T,E=N):k.POINT.test(N)?(X(),Z=I,E=N):ie(N,he,se)}return X(),se}const m=["mm","cm","in","pt","pc","px"],M={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(B){let z="px";if(typeof B=="string"||B instanceof String)for(let k=0,G=m.length;k<G;k++){const T=m[k];if(B.endsWith(T)){z=T,B=B.substring(0,B.length-T.length);break}}let F;return z==="px"&&t.defaultUnit!=="px"?F=M.in[t.defaultUnit]/t.defaultDPI:(F=M[z][t.defaultUnit],F<0&&(F=M[z].in*t.defaultDPI)),F*parseFloat(B)}function C(B){if(!(B.hasAttribute("transform")||B.nodeName==="use"&&(B.hasAttribute("x")||B.hasAttribute("y"))))return null;const z=O(B);return R.length>0&&z.premultiply(R[R.length-1]),ce.copy(z),R.push(z),z}function O(B){const z=new l.Matrix3,F=Y;if(B.nodeName==="use"&&(B.hasAttribute("x")||B.hasAttribute("y"))){const k=v(B.getAttribute("x")),G=v(B.getAttribute("y"));z.translate(k,G)}if(B.hasAttribute("transform")){const k=B.getAttribute("transform").split(")");for(let G=k.length-1;G>=0;G--){const T=k[G].trim();if(T==="")continue;const I=T.indexOf("("),U=T.length;if(I>0&&I<U){const Z=T.slice(0,I),j=x(T.slice(I+1));switch(F.identity(),Z){case"translate":if(j.length>=1){const E=j[0];let J=0;j.length>=2&&(J=j[1]),F.translate(E,J)}break;case"rotate":if(j.length>=1){let E=0,J=0,se=0;E=j[0]*Math.PI/180,j.length>=3&&(J=j[1],se=j[2]),W.makeTranslation(-J,-se),$.makeRotation(E),q.multiplyMatrices($,W),W.makeTranslation(J,se),F.multiplyMatrices(W,q)}break;case"scale":if(j.length>=1){const E=j[0];let J=E;j.length>=2&&(J=j[1]),F.scale(E,J)}break;case"skewX":j.length===1&&F.set(1,Math.tan(j[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":j.length===1&&F.set(1,0,0,Math.tan(j[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":j.length===6&&F.set(j[0],j[2],j[4],j[1],j[3],j[5],0,0,1);break}}z.premultiply(F)}}return z}function S(B,z){function F(I){te.set(I.x,I.y,1).applyMatrix3(z),I.set(te.x,te.y)}function k(I){const U=I.xRadius,Z=I.yRadius,j=Math.cos(I.aRotation),E=Math.sin(I.aRotation),J=new l.Vector3(U*j,U*E,0),se=new l.Vector3(-Z*E,Z*j,0),ie=J.applyMatrix3(z),X=se.applyMatrix3(z),N=Y.set(ie.x,X.x,0,ie.y,X.y,0,0,0,1),ae=W.copy(N).invert(),Ie=$.copy(ae).transpose().multiply(ae).elements,Oe=D(Ie[0],Ie[1],Ie[4]),He=Math.sqrt(Oe.rt1),dt=Math.sqrt(Oe.rt2);if(I.xRadius=1/He,I.yRadius=1/dt,I.aRotation=Math.atan2(Oe.sn,Oe.cs),!((I.aEndAngle-I.aStartAngle)%(2*Math.PI)<Number.EPSILON)){const It=W.set(He,0,0,0,dt,0,0,0,1),Ze=$.set(Oe.cs,Oe.sn,0,-Oe.sn,Oe.cs,0,0,0,1),$e=It.multiply(Ze).multiply(N),En=Yn=>{const{x:Wn,y:yn}=new l.Vector3(Math.cos(Yn),Math.sin(Yn),0).applyMatrix3($e);return Math.atan2(yn,Wn)};I.aStartAngle=En(I.aStartAngle),I.aEndAngle=En(I.aEndAngle),A(z)&&(I.aClockwise=!I.aClockwise)}}function G(I){const U=P(z),Z=w(z);I.xRadius*=U,I.yRadius*=Z;const j=U>Number.EPSILON?Math.atan2(z.elements[1],z.elements[0]):Math.atan2(-z.elements[3],z.elements[4]);I.aRotation+=j,A(z)&&(I.aStartAngle*=-1,I.aEndAngle*=-1,I.aClockwise=!I.aClockwise)}const T=B.subPaths;for(let I=0,U=T.length;I<U;I++){const j=T[I].curves;for(let E=0;E<j.length;E++){const J=j[E];J.isLineCurve?(F(J.v1),F(J.v2)):J.isCubicBezierCurve?(F(J.v0),F(J.v1),F(J.v2),F(J.v3)):J.isQuadraticBezierCurve?(F(J.v0),F(J.v1),F(J.v2)):J.isEllipseCurve&&(ne.set(J.aX,J.aY),F(ne),J.aX=ne.x,J.aY=ne.y,b(z)?k(J):G(J))}}}function A(B){const z=B.elements;return z[0]*z[4]-z[1]*z[3]<0}function b(B){const z=B.elements,F=z[0]*z[3]+z[1]*z[4];if(F===0)return!1;const k=P(B),G=w(B);return Math.abs(F/(k*G))>Number.EPSILON}function P(B){const z=B.elements;return Math.sqrt(z[0]*z[0]+z[1]*z[1])}function w(B){const z=B.elements;return Math.sqrt(z[3]*z[3]+z[4]*z[4])}function D(B,z,F){let k,G,T,I,U;const Z=B+F,j=B-F,E=Math.sqrt(j*j+4*z*z);return Z>0?(k=.5*(Z+E),U=1/k,G=B*U*F-z*U*z):Z<0?G=.5*(Z-E):(k=.5*E,G=-.5*E),j>0?T=j+E:T=j-E,Math.abs(T)>2*Math.abs(z)?(U=-2*z/T,I=1/Math.sqrt(1+U*U),T=U*I):Math.abs(z)===0?(T=1,I=0):(U=-.5*T/z,T=1/Math.sqrt(1+U*U),I=U*T),j>0&&(U=T,T=-I,I=U),{rt1:k,rt2:G,cs:T,sn:I}}const L=[],V={},R=[],Y=new l.Matrix3,W=new l.Matrix3,$=new l.Matrix3,q=new l.Matrix3,ne=new l.Vector2,te=new l.Vector3,ce=new l.Matrix3,le=new DOMParser().parseFromString(e,"image/svg+xml");return n(le.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:L,xml:le.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 r(y,x,m,M){const v=y.x,C=x.x,O=m.x,S=M.x,A=y.y,b=x.y,P=m.y,w=M.y,D=(S-O)*(A-P)-(w-P)*(v-O),L=(C-v)*(A-P)-(b-A)*(v-O),V=(w-P)*(C-v)-(S-O)*(b-A),R=D/V,Y=L/V;if(V===0&&D!==0||R<=0||R>=1||Y<0||Y>1)return null;if(D===0&&V===0){for(let W=0;W<2;W++)if(i(W===0?m:M,y,x),s.loc==n.ORIGIN){const $=W===0?m:M;return{x:$.x,y:$.y,t:s.t}}else if(s.loc==n.BETWEEN){const $=+(v+s.t*(C-v)).toPrecision(10),q=+(A+s.t*(b-A)).toPrecision(10);return{x:$,y:q,t:s.t}}return null}else{for(let q=0;q<2;q++)if(i(q===0?m:M,y,x),s.loc==n.ORIGIN){const ne=q===0?m:M;return{x:ne.x,y:ne.y,t:s.t}}const W=+(v+R*(C-v)).toPrecision(10),$=+(A+R*(b-A)).toPrecision(10);return{x:W,y:$,t:R}}}function i(y,x,m){const M=m.x-x.x,v=m.y-x.y,C=y.x-x.x,O=y.y-x.y,S=M*O-C*v;if(y.x===x.x&&y.y===x.y){s.loc=n.ORIGIN,s.t=0;return}if(y.x===m.x&&y.y===m.y){s.loc=n.DESTINATION,s.t=1;return}if(S<-Number.EPSILON){s.loc=n.LEFT;return}if(S>Number.EPSILON){s.loc=n.RIGHT;return}if(M*C<0||v*O<0){s.loc=n.BEHIND;return}if(Math.sqrt(M*M+v*v)<Math.sqrt(C*C+O*O)){s.loc=n.BEYOND;return}let A;M!==0?A=C/M:A=O/v,s.loc=n.BETWEEN,s.t=A}function a(y,x){const m=[],M=[];for(let v=1;v<y.length;v++){const C=y[v-1],O=y[v];for(let S=1;S<x.length;S++){const A=x[S-1],b=x[S],P=r(C,O,A,b);P!==null&&m.find(w=>w.t<=P.t+Number.EPSILON&&w.t>=P.t-Number.EPSILON)===void 0&&(m.push(P),M.push(new l.Vector2(P.x,P.y)))}}return M}function c(y,x,m){const M=new l.Vector2;x.getCenter(M);const v=[];return m.forEach(C=>{C.boundingBox.containsPoint(M)&&a(y,C.points).forEach(S=>{v.push({identifier:C.identifier,isCW:C.isCW,point:S})})}),v.sort((C,O)=>C.point.x-O.point.x),v}function h(y,x,m,M,v){(v==null||v==="")&&(v="nonzero");const C=new l.Vector2;y.boundingBox.getCenter(C);const O=[new l.Vector2(m,C.y),new l.Vector2(M,C.y)],S=c(O,y.boundingBox,x);S.sort((L,V)=>L.point.x-V.point.x);const A=[],b=[];S.forEach(L=>{L.identifier===y.identifier?A.push(L):b.push(L)});const P=A[0].point.x,w=[];let D=0;for(;D<b.length&&b[D].point.x<P;)w.length>0&&w[w.length-1]===b[D].identifier?w.pop():w.push(b[D].identifier),D++;if(w.push(y.identifier),v==="evenodd"){const L=w.length%2===0,V=w[w.length-2];return{identifier:y.identifier,isHole:L,for:V}}else if(v==="nonzero"){let L=!0,V=null,R=null;for(let Y=0;Y<w.length;Y++){const W=w[Y];L?(R=x[W].isCW,L=!1,V=W):R!==x[W].isCW&&(R=x[W].isCW,L=!0)}return{identifier:y.identifier,isHole:L,for:V}}else console.warn('fill-rule: "'+v+'" is currently not implemented.')}let d=999999999,f=-999999999,g=e.subPaths.map(y=>{const x=y.getPoints();let m=-999999999,M=999999999,v=-999999999,C=999999999;for(let O=0;O<x.length;O++){const S=x[O];S.y>m&&(m=S.y),S.y<M&&(M=S.y),S.x>v&&(v=S.x),S.x<C&&(C=S.x)}return f<=v&&(f=v+1),d>=C&&(d=C-1),{curves:y.curves,points:x,isCW:l.ShapeUtils.isClockWise(x),identifier:-1,boundingBox:new l.Box2(new l.Vector2(C,M),new l.Vector2(v,m))}});g=g.filter(y=>y.points.length>1);for(let y=0;y<g.length;y++)g[y].identifier=y;const p=g.map(y=>h(y,g,d,f,e.userData?e.userData.style.fillRule:void 0)),_=[];return g.forEach(y=>{if(!p[y.identifier].isHole){const m=new l.Shape;m.curves=y.curves,p.filter(v=>v.isHole&&v.for===y.identifier).forEach(v=>{const C=g[v.identifier],O=new l.Path;O.curves=C.curves,m.holes.push(O)}),_.push(m)}}),_}static getStrokeStyle(e,t,n,s,r){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",r=r!==void 0?r:4,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:s,strokeMiterLimit:r}}static pointsToStroke(e,t,n,s){const r=[],i=[],a=[];if(nn.pointsToStrokeWithBuffers(e,t,n,s,r,i,a)===0)return null;const c=new l.BufferGeometry;return c.setAttribute("position",new l.Float32BufferAttribute(r,3)),c.setAttribute("normal",new l.Float32BufferAttribute(i,3)),c.setAttribute("uv",new l.Float32BufferAttribute(a,2)),c}static pointsToStrokeWithBuffers(e,t,n,s,r,i,a,c){const h=new l.Vector2,d=new l.Vector2,f=new l.Vector2,g=new l.Vector2,p=new l.Vector2,_=new l.Vector2,y=new l.Vector2,x=new l.Vector2,m=new l.Vector2,M=new l.Vector2,v=new l.Vector2,C=new l.Vector2,O=new l.Vector2,S=new l.Vector2,A=new l.Vector2,b=new l.Vector2,P=new l.Vector2;n=n!==void 0?n:12,s=s!==void 0?s:.001,c=c!==void 0?c:0,e=j(e);const w=e.length;if(w<2)return 0;const D=e[0].equals(e[w-1]);let L,V=e[0],R;const Y=t.strokeWidth/2,W=1/(w-1);let $=0,q,ne,te,ce,le=!1,me=0,B=c*3,z=c*2;F(e[0],e[1],h).multiplyScalar(Y),x.copy(e[0]).sub(h),m.copy(e[0]).add(h),M.copy(x),v.copy(m);for(let E=1;E<w;E++){L=e[E],E===w-1?D?R=e[1]:R=void 0:R=e[E+1];const J=h;if(F(V,L,J),f.copy(J).multiplyScalar(Y),C.copy(L).sub(f),O.copy(L).add(f),q=$+W,ne=!1,R!==void 0){F(L,R,d),f.copy(d).multiplyScalar(Y),S.copy(L).sub(f),A.copy(L).add(f),te=!0,f.subVectors(R,V),J.dot(f)<0&&(te=!1),E===1&&(le=te),f.subVectors(R,L),f.normalize();const se=Math.abs(J.dot(f));if(se>Number.EPSILON){const ie=Y/se;f.multiplyScalar(-ie),g.subVectors(L,V),p.copy(g).setLength(ie).add(f),b.copy(p).negate();const X=p.length(),N=g.length();g.divideScalar(N),_.subVectors(R,L);const ae=_.length();switch(_.divideScalar(ae),g.dot(b)<N&&_.dot(b)<ae&&(ne=!0),P.copy(p).add(L),b.add(L),ce=!1,ne?te?(A.copy(b),O.copy(b)):(S.copy(b),C.copy(b)):T(),t.strokeLineJoin){case"bevel":I(te,ne,q);break;case"round":U(te,ne),te?G(L,C,S,q,0):G(L,A,O,q,1);break;case"miter":case"miter-clip":default:const he=Y*t.strokeMiterLimit/X;if(he<1)if(t.strokeLineJoin!=="miter-clip"){I(te,ne,q);break}else U(te,ne),te?(_.subVectors(P,C).multiplyScalar(he).add(C),y.subVectors(P,S).multiplyScalar(he).add(S),k(C,q,0),k(_,q,0),k(L,q,.5),k(L,q,.5),k(_,q,0),k(y,q,0),k(L,q,.5),k(y,q,0),k(S,q,0)):(_.subVectors(P,O).multiplyScalar(he).add(O),y.subVectors(P,A).multiplyScalar(he).add(A),k(O,q,1),k(_,q,1),k(L,q,.5),k(L,q,.5),k(_,q,1),k(y,q,1),k(L,q,.5),k(y,q,1),k(A,q,1));else ne?(te?(k(m,$,1),k(x,$,0),k(P,q,0),k(m,$,1),k(P,q,0),k(b,q,1)):(k(m,$,1),k(x,$,0),k(P,q,1),k(x,$,0),k(b,q,0),k(P,q,1)),te?S.copy(P):A.copy(P)):te?(k(C,q,0),k(P,q,0),k(L,q,.5),k(L,q,.5),k(P,q,0),k(S,q,0)):(k(O,q,1),k(P,q,1),k(L,q,.5),k(L,q,.5),k(P,q,1),k(A,q,1)),ce=!0;break}}else T()}else T();!D&&E===w-1&&Z(e[0],M,v,te,!0,$),$=q,V=L,x.copy(S),m.copy(A)}if(!D)Z(L,C,O,te,!1,q);else if(ne&&r){let E=P,J=b;le!==te&&(E=b,J=P),te?(ce||le)&&(J.toArray(r,0*3),J.toArray(r,3*3),ce&&E.toArray(r,1*3)):(ce||!le)&&(J.toArray(r,1*3),J.toArray(r,3*3),ce&&E.toArray(r,0*3))}return me;function F(E,J,se){return se.subVectors(J,E),se.set(-se.y,se.x).normalize()}function k(E,J,se){r&&(r[B]=E.x,r[B+1]=E.y,r[B+2]=0,i&&(i[B]=0,i[B+1]=0,i[B+2]=1),B+=3,a&&(a[z]=J,a[z+1]=se,z+=2)),me+=3}function G(E,J,se,ie,X){h.copy(J).sub(E).normalize(),d.copy(se).sub(E).normalize();let N=Math.PI;const ae=h.dot(d);Math.abs(ae)<1&&(N=Math.abs(Math.acos(ae))),N/=n,f.copy(J);for(let he=0,_e=n-1;he<_e;he++)g.copy(f).rotateAround(E,N),k(f,ie,X),k(g,ie,X),k(E,ie,.5),f.copy(g);k(g,ie,X),k(se,ie,X),k(E,ie,.5)}function T(){k(m,$,1),k(x,$,0),k(C,q,0),k(m,$,1),k(C,q,0),k(O,q,1)}function I(E,J,se){J?E?(k(m,$,1),k(x,$,0),k(C,q,0),k(m,$,1),k(C,q,0),k(b,q,1),k(C,se,0),k(S,se,0),k(b,se,.5)):(k(m,$,1),k(x,$,0),k(O,q,1),k(x,$,0),k(b,q,0),k(O,q,1),k(O,se,1),k(b,se,0),k(A,se,1)):E?(k(C,se,0),k(S,se,0),k(L,se,.5)):(k(O,se,1),k(A,se,0),k(L,se,.5))}function U(E,J){J&&(E?(k(m,$,1),k(x,$,0),k(C,q,0),k(m,$,1),k(C,q,0),k(b,q,1),k(C,$,0),k(L,q,.5),k(b,q,1),k(L,q,.5),k(S,$,0),k(b,q,1)):(k(m,$,1),k(x,$,0),k(O,q,1),k(x,$,0),k(b,q,0),k(O,q,1),k(O,$,1),k(b,q,0),k(L,q,.5),k(L,q,.5),k(b,q,0),k(A,$,1)))}function Z(E,J,se,ie,X,N){switch(t.strokeLineCap){case"round":X?G(E,se,J,N,.5):G(E,J,se,N,.5);break;case"square":if(X)h.subVectors(J,E),d.set(h.y,-h.x),f.addVectors(h,d).add(E),g.subVectors(d,h).add(E),ie?(f.toArray(r,1*3),g.toArray(r,0*3),g.toArray(r,3*3)):(f.toArray(r,1*3),a[3*2+1]===1?g.toArray(r,3*3):f.toArray(r,3*3),g.toArray(r,0*3));else{h.subVectors(se,E),d.set(h.y,-h.x),f.addVectors(h,d).add(E),g.subVectors(d,h).add(E);const ae=r.length;ie?(f.toArray(r,ae-1*3),g.toArray(r,ae-2*3),g.toArray(r,ae-4*3)):(g.toArray(r,ae-2*3),f.toArray(r,ae-1*3),g.toArray(r,ae-4*3))}break}}function j(E){let J=!1;for(let ie=1,X=E.length-1;ie<X;ie++)if(E[ie].distanceTo(E[ie+1])<s){J=!0;break}if(!J)return E;const se=[];se.push(E[0]);for(let ie=1,X=E.length-1;ie<X;ie++)E[ie].distanceTo(E[ie+1])>=s&&se.push(E[ie]);return se.push(E[E.length-1]),se}}}const ds=new WeakMap;class Ml extends l.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,s){const r=new l.FileLoader(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,i=>{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(i,a).then(t).catch(s)},n,s)}decodeDracoFile(e,t,n,s){const r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,r).then(t)}decodeGeometry(e,t){for(const c in t.attributeTypes){const h=t.attributeTypes[c];h.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[c]=h.name)}const n=JSON.stringify(t);if(ds.has(e)){const c=ds.get(e);if(c.key===n)return c.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 r=this.workerNextTaskID++,i=e.byteLength,a=this._getWorker(r,i).then(c=>(s=c,new Promise((h,d)=>{s._callbacks[r]={resolve:h,reject:d},s.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return a.catch(()=>!0).then(()=>{s&&r&&this._releaseTask(s,r)}),ds.set(e,{key:n,promise:a}),a}_createGeometry(e){const t=new l.BufferGeometry;e.index&&t.setIndex(new l.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n],r=s.name,i=s.array,a=s.itemSize;t.setAttribute(r,new l.BufferAttribute(i,a))}return t}_loadLibrary(e,t){const n=new l.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((s,r)=>{n.load(e,s,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 s=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const r=Sl.toString(),i=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
|
|
395
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),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(r){const i=r.data;switch(i.type){case"decode":s._callbacks[i.id].resolve(i);break;case"error":s._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,r){return s._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 Sl(){let o,e;onmessage=function(i){const a=i.data;switch(a.type){case"init":o=a.decoderConfig,e=new Promise(function(d){o.onModuleLoaded=function(f){d({draco:f})},DracoDecoderModule(o)});break;case"decode":const c=a.buffer,h=a.taskConfig;e.then(d=>{const f=d.draco,g=new f.Decoder,p=new f.DecoderBuffer;p.Init(new Int8Array(c),c.byteLength);try{const _=t(f,g,p,h),y=_.attributes.map(x=>x.array.buffer);_.index&&y.push(_.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:_},y)}catch(_){console.error(_),self.postMessage({type:"error",id:a.id,error:_.message})}finally{f.destroy(p),f.destroy(g)}});break}};function t(i,a,c,h){const d=h.attributeIDs,f=h.attributeTypes;let g,p;const _=a.GetEncodedGeometryType(c);if(_===i.TRIANGULAR_MESH)g=new i.Mesh,p=a.DecodeBufferToMesh(c,g);else if(_===i.POINT_CLOUD)g=new i.PointCloud,p=a.DecodeBufferToPointCloud(c,g);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||g.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const y={index:null,attributes:[]};for(const x in d){const m=self[f[x]];let M,v;if(h.useUniqueIDs)v=d[x],M=a.GetAttributeByUniqueId(g,v);else{if(v=a.GetAttributeId(g,i[d[x]]),v===-1)continue;M=a.GetAttribute(g,v)}y.attributes.push(s(i,a,g,x,m,M))}return _===i.TRIANGULAR_MESH&&(y.index=n(i,a,g)),i.destroy(g),y}function n(i,a,c){const d=c.num_faces()*3,f=d*4,g=i._malloc(f);a.GetTrianglesUInt32Array(c,f,g);const p=new Uint32Array(i.HEAPF32.buffer,g,d).slice();return i._free(g),{array:p,itemSize:1}}function s(i,a,c,h,d,f){const g=f.num_components(),_=c.num_points()*g,y=_*d.BYTES_PER_ELEMENT,x=r(i,d),m=i._malloc(y);a.GetAttributeDataArrayForAllPoints(c,f,x,y,m);const M=new d(i.HEAPF32.buffer,m,_).slice();return i._free(m),{name:h,array:M,itemSize:g}}function r(i,a){switch(a){case Float32Array:return i.DT_FLOAT32;case Int8Array:return i.DT_INT8;case Int16Array:return i.DT_INT16;case Int32Array:return i.DT_INT32;case Uint8Array:return i.DT_UINT8;case Uint16Array:return i.DT_UINT16;case Uint32Array:return i.DT_UINT32}}}const Al=["args","center"],Cl=u.defineComponent({__name:"Text3D",props:{font:{},text:{},size:{default:.5},height:{default:.2},curveSegments:{default:5},bevelEnabled:{type:Boolean,default:!0},bevelThickness:{default:.05},bevelSize:{default:.02},bevelOffset:{default:0},bevelSegments:{default:4},center:{type:Boolean,default:!1},needUpdates:{type:Boolean,default:!1}},async setup(o,{expose:e}){let t,n;const s=o,{center:r,font:i,text:a,needUpdates:c,size:h,height:d,curveSegments:f,bevelEnabled:g,bevelThickness:p,bevelSize:_,bevelOffset:y,bevelSegments:x}=u.toRefs(s),{extend:m,invalidate:M}=ee.useTresContext();u.watch(s,()=>M()),m({TextGeometry:Pr});const v=new xl,C=u.useSlots(),O=u.computed(()=>{var P;return a!=null&&a.value?a.value:C.default?(P=C.default()[0].children)==null?void 0:P.trim():c.value?"":"TresJS"}),S=u.shallowRef();e({instance:S});const A=([t,n]=u.withAsyncContext(()=>new Promise((P,w)=>{try{typeof i.value=="string"?v.load(i.value,D=>{P(D)}):P(i.value)}catch(D){w(console.error("cientos",D))}})),t=await t,n(),t),b=u.computed(()=>({font:A,size:u.toValue(h),height:u.toValue(d),curveSegments:u.toValue(f),bevelEnabled:u.toValue(g),bevelThickness:u.toValue(p),bevelSize:u.toValue(_),bevelOffset:u.toValue(y),bevelSegments:u.toValue(x)}));return u.watchEffect(()=>{S.value&&c.value&&(S.value.geometry.dispose(),S.value.geometry=new Pr(O.value,b.value),r.value&&S.value.geometry.center())}),(P,w)=>u.unref(i)?(u.openBlock(),u.createElementBlock("TresMesh",{key:0,ref_key:"text3DRef",ref:S},[O.value?(u.openBlock(),u.createElementBlock("TresTextGeometry",{key:0,args:[O.value,b.value],center:u.unref(r)},null,8,Al)):u.createCommentVNode("",!0),u.renderSlot(P.$slots,"default")],512)):u.createCommentVNode("",!0)}});function Pl(o,e){const t=u.ref(e),n=new l.AnimationMixer(t.value),s=u.shallowReactive({});o.forEach(i=>{const a=n.clipAction(i,t.value);s[i.name]=a});const{onBeforeRender:r}=ee.useLoop();return r(({delta:i})=>{n.update(i)}),{actions:s,mixer:n}}const Tl=u.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=u.shallowRef();e({instance:n});{const c=Math.random()*1e4,{onBeforeRender:h}=ee.useLoop();let d=c;h(({delta:f,invalidate:g})=>{if(!n.value)return;d+=f*t.speed;const p=d*.25,_=n.value;_.rotation.x=Math.cos(p)*.125*t.rotationFactor,_.rotation.y=Math.sin(p)*.125*t.rotationFactor,_.rotation.z=Math.sin(p)*.05*t.rotationFactor,_.position.y=l.MathUtils.mapLinear(Math.sin(p),-1,1,t.range[0],t.range[1])*t.floatFactor,g()})}return(s,r)=>(u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps(s.$attrs,{ref_key:"groupRef",ref:n}),[u.renderSlot(s.$slots,"default")],16))}}),Il=["args","material-uniforms-color-value"],Ol=u.createElementVNode("TresPlaneGeometry",{args:[5,5]},null,-1),Dl=u.defineComponent({__name:"Reflector",props:{color:{default:"#333"},textureWidth:{default:512},textureHeight:{default:512},clipBias:{default:0},multisample:{default:4},shader:{default:ns.ReflectorShader}},setup(o,{expose:e}){const t=o,{extend:n,invalidate:s}=ee.useTresContext(),r=u.shallowRef();n({Reflector:ns});const{color:i,textureWidth:a,textureHeight:c,clipBias:h,multisample:d,shader:f}=u.toRefs(t);return u.watch(t,()=>s()),e({instance:r}),(g,p)=>(u.openBlock(),u.createElementBlock("TresReflector",{ref_key:"reflectorRef",ref:r,args:[void 0,{textureWidth:u.unref(a),textureHeight:u.unref(c),clipBias:u.unref(h),multisample:u.unref(d),shader:u.unref(f)}],"material-uniforms-color-value":u.unref(i)},[u.renderSlot(g.$slots,"default",{},()=>[Ol])],8,Il))}});function ps(o){return u.getCurrentScope()?(u.onScopeDispose(o),!0):!1}function Ge(o){return typeof o=="function"?o():u.unref(o)}const Ll=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Bl=Object.prototype.toString,kl=o=>Bl.call(o)==="[object Object]",vt=()=>{};function ms(o,e){function t(...n){return new Promise((s,r)=>{Promise.resolve(o(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})).then(s).catch(r)})}return t}const Fl=o=>o();function Ul(o,e={}){let t,n,s=vt;const r=a=>{clearTimeout(a),s(),s=vt};return a=>{const c=Ge(o),h=Ge(e.maxWait);return t&&r(t),c<=0||h!==void 0&&h<=0?(n&&(r(n),n=null),Promise.resolve(a())):new Promise((d,f)=>{s=e.rejectOnCancel?f:d,h&&!n&&(n=setTimeout(()=>{t&&r(t),n=null,d(a())},h)),t=setTimeout(()=>{n&&r(n),n=null,d(a())},c)})}}function zr(...o){let e=0,t,n=!0,s=vt,r,i,a,c,h;!u.isRef(o[0])&&typeof o[0]=="object"?{delay:i,trailing:a=!0,leading:c=!0,rejectOnCancel:h=!1}=o[0]:[i,a=!0,c=!0,h=!1]=o;const d=()=>{t&&(clearTimeout(t),t=void 0,s(),s=vt)};return g=>{const p=Ge(i),_=Date.now()-e,y=()=>r=g();return d(),p<=0?(e=Date.now(),y()):(_>p&&(c||!n)?(e=Date.now(),y()):a&&(r=new Promise((x,m)=>{s=h?m:x,t=setTimeout(()=>{e=Date.now(),n=!0,x(y()),d()},Math.max(0,p-_))})),!c&&!t&&(t=setTimeout(()=>n=!0,p)),n=!1,r)}}function Nl(o){return u.getCurrentInstance()}function zl(o,e=200,t={}){return ms(Ul(e,t),o)}function Vl(o,e=200,t=!1,n=!0,s=!1){return ms(zr(e,t,n,s),o)}function Rl(o,e,t={}){const{eventFilter:n=Fl,...s}=t;return u.watch(o,ms(n,e),s)}function gs(o,e=!0,t){Nl()?u.onMounted(o,t):e?o():u.nextTick(o)}function Gl(o,e,t={}){const{throttle:n=0,trailing:s=!0,leading:r=!0,...i}=t;return Rl(o,e,{...i,eventFilter:zr(n,s,r)})}function wt(o){var e;const t=Ge(o);return(e=t==null?void 0:t.$el)!=null?e:t}const ht=Ll?window:void 0;function Ce(...o){let e,t,n,s;if(typeof o[0]=="string"||Array.isArray(o[0])?([t,n,s]=o,e=ht):[e,t,n,s]=o,!e)return vt;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const r=[],i=()=>{r.forEach(d=>d()),r.length=0},a=(d,f,g,p)=>(d.addEventListener(f,g,p),()=>d.removeEventListener(f,g,p)),c=u.watch(()=>[wt(e),Ge(s)],([d,f])=>{if(i(),!d)return;const g=kl(f)?{...f}:f;r.push(...t.flatMap(p=>n.map(_=>a(d,p,_,g))))},{immediate:!0,flush:"post"}),h=()=>{c(),i()};return ps(h),h}function jl(){const o=u.ref(!1),e=u.getCurrentInstance();return e&&u.onMounted(()=>{o.value=!0},e),o}function Vr(o){const e=jl();return u.computed(()=>(e.value,!!o()))}function El(o,e={}){const{window:t=ht}=e,n=Vr(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let s;const r=u.ref(!1),i=h=>{r.value=h.matches},a=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",i):s.removeListener(i))},c=u.watchEffect(()=>{n.value&&(a(),s=t.matchMedia(Ge(o)),"addEventListener"in s?s.addEventListener("change",i):s.addListener(i),r.value=s.matches)});return ps(()=>{c(),a(),s=void 0}),r}function Yl(o,e,t={}){const{window:n=ht,...s}=t;let r;const i=Vr(()=>n&&"ResizeObserver"in n),a=()=>{r&&(r.disconnect(),r=void 0)},c=u.computed(()=>{const f=Ge(o);return Array.isArray(f)?f.map(g=>wt(g)):[wt(f)]}),h=u.watch(c,f=>{if(a(),i.value&&n){r=new ResizeObserver(e);for(const g of f)g&&r.observe(g,s)}},{immediate:!0,flush:"post"}),d=()=>{a(),h()};return ps(d),{isSupported:i,stop:d}}function Wl(o,e={width:0,height:0},t={}){const{window:n=ht,box:s="content-box"}=t,r=u.computed(()=>{var f,g;return(g=(f=wt(o))==null?void 0:f.namespaceURI)==null?void 0:g.includes("svg")}),i=u.ref(e.width),a=u.ref(e.height),{stop:c}=Yl(o,([f])=>{const g=s==="border-box"?f.borderBoxSize:s==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(n&&r.value){const p=wt(o);if(p){const _=p.getBoundingClientRect();i.value=_.width,a.value=_.height}}else if(g){const p=Array.isArray(g)?g:[g];i.value=p.reduce((_,{inlineSize:y})=>_+y,0),a.value=p.reduce((_,{blockSize:y})=>_+y,0)}else i.value=f.contentRect.width,a.value=f.contentRect.height},t);gs(()=>{const f=wt(o);f&&(i.value="offsetWidth"in f?f.offsetWidth:e.width,a.value="offsetHeight"in f?f.offsetHeight:e.height)});const h=u.watch(()=>wt(o),f=>{i.value=f?e.width:0,a.value=f?e.height:0});function d(){c(),h()}return{width:i,height:a,stop:d}}const Rr=1;function Xl(o,e={}){const{throttle:t=0,idle:n=200,onStop:s=vt,onScroll:r=vt,offset:i={left:0,right:0,top:0,bottom:0},eventListenerOptions:a={capture:!1,passive:!0},behavior:c="auto",window:h=ht,onError:d=A=>{console.error(A)}}=e,f=u.ref(0),g=u.ref(0),p=u.computed({get(){return f.value},set(A){y(A,void 0)}}),_=u.computed({get(){return g.value},set(A){y(void 0,A)}});function y(A,b){var P,w,D,L;if(!h)return;const V=Ge(o);if(!V)return;(D=V instanceof Document?h.document.body:V)==null||D.scrollTo({top:(P=Ge(b))!=null?P:_.value,left:(w=Ge(A))!=null?w:p.value,behavior:Ge(c)});const R=((L=V==null?void 0:V.document)==null?void 0:L.documentElement)||(V==null?void 0:V.documentElement)||V;p!=null&&(f.value=R.scrollLeft),_!=null&&(g.value=R.scrollTop)}const x=u.ref(!1),m=u.reactive({left:!0,right:!1,top:!0,bottom:!1}),M=u.reactive({left:!1,right:!1,top:!1,bottom:!1}),v=A=>{x.value&&(x.value=!1,M.left=!1,M.right=!1,M.top=!1,M.bottom=!1,s(A))},C=zl(v,t+n),O=A=>{var b;if(!h)return;const P=((b=A==null?void 0:A.document)==null?void 0:b.documentElement)||(A==null?void 0:A.documentElement)||wt(A),{display:w,flexDirection:D}=getComputedStyle(P),L=P.scrollLeft;M.left=L<f.value,M.right=L>f.value;const V=Math.abs(L)<=(i.left||0),R=Math.abs(L)+P.clientWidth>=P.scrollWidth-(i.right||0)-Rr;w==="flex"&&D==="row-reverse"?(m.left=R,m.right=V):(m.left=V,m.right=R),f.value=L;let Y=P.scrollTop;A===h.document&&!Y&&(Y=h.document.body.scrollTop),M.top=Y<g.value,M.bottom=Y>g.value;const W=Math.abs(Y)<=(i.top||0),$=Math.abs(Y)+P.clientHeight>=P.scrollHeight-(i.bottom||0)-Rr;w==="flex"&&D==="column-reverse"?(m.top=$,m.bottom=W):(m.top=W,m.bottom=$),g.value=Y},S=A=>{var b;if(!h)return;const P=(b=A.target.documentElement)!=null?b:A.target;O(P),x.value=!0,C(A),r(A)};return Ce(o,"scroll",t?Vl(S,t,!0,!1):S,a),gs(()=>{try{const A=Ge(o);if(!A)return;O(A)}catch(A){d(A)}}),Ce(o,"scrollend",v,a),{x:p,y:_,isScrolling:x,arrivedState:m,directions:M,measure(){const A=Ge(o);h&&A&&O(A)}}}const Zl={ctrl:"control",command:"meta",cmd:"meta",option:"alt",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright"};function Kl(o={}){const{reactive:e=!1,target:t=ht,aliasMap:n=Zl,passive:s=!0,onEventFired:r=vt}=o,i=u.reactive(new Set),a={toJSON(){return{}},current:i},c=e?u.reactive(a):a,h=new Set,d=new Set;function f(y,x){y in c&&(e?c[y]=x:c[y].value=x)}function g(){i.clear();for(const y of d)f(y,!1)}function p(y,x){var m,M;const v=(m=y.key)==null?void 0:m.toLowerCase(),O=[(M=y.code)==null?void 0:M.toLowerCase(),v].filter(Boolean);v&&(x?i.add(v):i.delete(v));for(const S of O)d.add(S),f(S,x);v==="meta"&&!x?(h.forEach(S=>{i.delete(S),f(S,!1)}),h.clear()):typeof y.getModifierState=="function"&&y.getModifierState("Meta")&&x&&[...i,...O].forEach(S=>h.add(S))}Ce(t,"keydown",y=>(p(y,!0),r(y)),{passive:s}),Ce(t,"keyup",y=>(p(y,!1),r(y)),{passive:s}),Ce("blur",g,{passive:!0}),Ce("focus",g,{passive:!0});const _=new Proxy(c,{get(y,x,m){if(typeof x!="string")return Reflect.get(y,x,m);if(x=x.toLowerCase(),x in n&&(x=n[x]),!(x in c))if(/[+_-]/.test(x)){const v=x.split(/[+_-]/g).map(C=>C.trim());c[x]=u.computed(()=>v.every(C=>Ge(_[C])))}else c[x]=u.ref(!1);const M=Reflect.get(y,x,m);return e?Ge(M):M}});return _}const ql={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 Ql(o={}){const{type:e="page",touch:t=!0,resetOnTouchEnds:n=!1,initialValue:s={x:0,y:0},window:r=ht,target:i=r,scroll:a=!0,eventFilter:c}=o;let h=null;const d=u.ref(s.x),f=u.ref(s.y),g=u.ref(null),p=typeof e=="function"?e:ql[e],_=O=>{const S=p(O);h=O,S&&([d.value,f.value]=S,g.value="mouse")},y=O=>{if(O.touches.length>0){const S=p(O.touches[0]);S&&([d.value,f.value]=S,g.value="touch")}},x=()=>{if(!h||!r)return;const O=p(h);h instanceof MouseEvent&&O&&(d.value=O[0]+r.scrollX,f.value=O[1]+r.scrollY)},m=()=>{d.value=s.x,f.value=s.y},M=c?O=>c(()=>_(O),{}):O=>_(O),v=c?O=>c(()=>y(O),{}):O=>y(O),C=c?()=>c(()=>x(),{}):()=>x();if(i){const O={passive:!0};Ce(i,["mousemove","dragover"],M,O),t&&e!=="movement"&&(Ce(i,["touchstart","touchmove"],v,O),n&&Ce(i,"touchend",m,O)),a&&e==="page"&&Ce(r,"scroll",C,{passive:!0})}return{x:d,y:f,sourceType:g}}function Jl(o={}){const{window:e=ht,behavior:t="auto"}=o;if(!e)return{x:u.ref(0),y:u.ref(0)};const n=u.ref(e.scrollX),s=u.ref(e.scrollY),r=u.computed({get(){return n.value},set(a){scrollTo({left:a,behavior:t})}}),i=u.computed({get(){return s.value},set(a){scrollTo({top:a,behavior:t})}});return Ce(e,"scroll",()=>{n.value=e.scrollX,s.value=e.scrollY},{capture:!1,passive:!0}),{x:r,y:i}}function Gr(o={}){const{window:e=ht,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:r=!0,type:i="inner"}=o,a=u.ref(t),c=u.ref(n),h=()=>{e&&(i==="outer"?(a.value=e.outerWidth,c.value=e.outerHeight):r?(a.value=e.innerWidth,c.value=e.innerHeight):(a.value=e.document.documentElement.clientWidth,c.value=e.document.documentElement.clientHeight))};if(h(),gs(h),Ce("resize",h,{passive:!0}),s){const d=El("(orientation: portrait)");u.watch(d,()=>h())}return{width:a,height:c}}const Hl=u.defineComponent({__name:"MouseParallax",props:{disabled:{type:Boolean,default:!1},factor:{default:2.5},ease:{default:.1},local:{type:Boolean,default:!1}},setup(o){const e=o,{camera:t,renderer:n}=ee.useTresContext(),{disabled:s,factor:r,ease:i,local:a}=u.toRefs(e),c={};a.value&&(c.target=n.value.domElement,c.type="client");const{x:h,y:d}=Ql(c),{width:f,height:g}=a.value?Wl(n.value.domElement):Gr(),p=u.shallowRef(),_=u.ref(),y=u.ref();u.watch([r,i],()=>{_.value=Array.isArray(r.value)?r.value:[r.value,r.value],y.value=Array.isArray(i.value)?i.value:[i.value,i.value]},{immediate:!0});const x=u.computed(()=>(h.value/f.value-.5)*_.value[0]),m=u.computed(()=>-(d.value/g.value-.5)*_.value[1]),{onBeforeRender:M}=ee.useLoop();return M(({delta:v,invalidate:C})=>{s.value||!p.value||Number.isNaN(x.value)||Number.isNaN(m.value)||(p.value.position.x+=(x.value-p.value.position.x)*y.value[0]*v,p.value.position.y+=(m.value-p.value.position.y)*y.value[1]*v,C())}),u.watch(()=>p.value,v=>v==null?void 0:v.add(t.value)),(v,C)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"cameraGroupRef",ref:p},null,512))}}),$l=u.defineComponent({name:"GlobalAudio",props:["src","loop","volume","playbackRate","playTrigger","stopTrigger"],async setup(o,{expose:e,emit:t}){var f;const{camera:n,renderer:s}=ee.useTresContext(),r=new l.AudioListener;(f=n.value)==null||f.add(r);const i=new l.Audio(r),a=new l.AudioLoader;e({instance:i}),u.onUnmounted(()=>{i&&i.disconnect()}),u.watch(()=>[o.playbackRate],()=>i.setPlaybackRate(o.playbackRate??1),{immediate:!0}),u.watch(()=>[o.volume],()=>i.setVolume(o.volume??.5),{immediate:!0}),u.watch(()=>[o.loop],()=>i.setLoop(o.loop??!1),{immediate:!0}),u.watch(()=>[o.src],async()=>{const g=await a.loadAsync(o.src);i.setBuffer(g)},{immediate:!0});const h=document.getElementById(o.playTrigger??"")||s.value.domElement;Ce(h,"click",()=>{i.isPlaying?i.pause():i.play(),t("isPlaying",i.isPlaying)});const d=document.getElementById(o.stopTrigger??"");return d&&Ce(d,"click",()=>{i.stop(),t("isPlaying",i.isPlaying)}),null}});class sn extends l.Mesh{constructor(){super(sn.Geometry,new l.MeshBasicMaterial({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const e=new l.Vector3,t=new l.Vector3,n=new l.FramebufferTexture(16,16),s=new l.FramebufferTexture(16,16);let r=l.UnsignedByteType;const i=sn.Geometry,a=new l.RawShaderMaterial({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
396
396
|
|
|
397
397
|
precision highp float;
|
|
398
398
|
|
|
@@ -443,7 +443,7 @@
|
|
|
443
443
|
|
|
444
444
|
gl_FragColor = texture2D( map, vUV );
|
|
445
445
|
|
|
446
|
-
}`,depthTest:!1,depthWrite:!1,transparent:!1}),h=new l.Mesh(i,a),d=[],f=jr.Shader,
|
|
446
|
+
}`,depthTest:!1,depthWrite:!1,transparent:!1}),h=new l.Mesh(i,a),d=[],f=jr.Shader,g=new l.RawShaderMaterial({name:f.name,uniforms:{map:{value:null},occlusionMap:{value:s},color:{value:new l.Color(16777215)},scale:{value:new l.Vector2},screenPosition:{value:new l.Vector3}},vertexShader:f.vertexShader,fragmentShader:f.fragmentShader,blending:l.AdditiveBlending,transparent:!0,depthWrite:!1}),p=new l.Mesh(i,g);this.addElement=function(M){d.push(M)};const _=new l.Vector2,y=new l.Vector2,x=new l.Box2,m=new l.Vector4;this.onBeforeRender=function(M,v,C){M.getCurrentViewport(m);const O=M.getRenderTarget(),S=O!==null?O.texture.type:l.UnsignedByteType;r!==S&&(n.dispose(),s.dispose(),n.type=s.type=S,r=S);const A=m.w/m.z,b=m.z/2,P=m.w/2;let w=16/m.w;if(_.set(w*A,w),x.min.set(m.x,m.y),x.max.set(m.x+(m.z-16),m.y+(m.w-16)),t.setFromMatrixPosition(this.matrixWorld),t.applyMatrix4(C.matrixWorldInverse),!(t.z>0)&&(e.copy(t).applyMatrix4(C.projectionMatrix),y.x=m.x+e.x*b+b-8,y.y=m.y+e.y*P+P-8,x.containsPoint(y))){M.copyFramebufferToTexture(n,y);let D=a.uniforms;D.scale.value=_,D.screenPosition.value=e,M.renderBufferDirect(C,null,i,a,h,null),M.copyFramebufferToTexture(s,y),D=c.uniforms,D.scale.value=_,D.screenPosition.value=e,M.renderBufferDirect(C,null,i,c,h,null);const L=-e.x*2,V=-e.y*2;for(let R=0,Y=d.length;R<Y;R++){const W=d[R],$=g.uniforms;$.color.value.copy(W.color),$.map.value=W.texture,$.screenPosition.value.x=e.x+L*W.distance,$.screenPosition.value.y=e.y+V*W.distance,w=W.size/m.w;const q=m.w/m.z;$.scale.value.set(w*q,w),g.uniformsNeedUpdate=!0,M.renderBufferDirect(C,null,i,g,p,null)}}},this.dispose=function(){a.dispose(),c.dispose(),g.dispose(),n.dispose(),s.dispose();for(let M=0,v=d.length;M<v;M++)d[M].texture.dispose()}}}class jr{constructor(e,t=1,n=0,s=new l.Color(16777215)){this.texture=e,this.size=t,this.distance=n,this.color=s}}jr.Shader={name:"LensflareElementShader",uniforms:{map:{value:null},occlusionMap:{value:null},color:{value:null},scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
447
447
|
|
|
448
448
|
precision highp float;
|
|
449
449
|
|
|
@@ -497,20 +497,20 @@
|
|
|
497
497
|
gl_FragColor = texture;
|
|
498
498
|
gl_FragColor.rgb *= color;
|
|
499
499
|
|
|
500
|
-
}`},sn.Geometry=function(){const o=new l.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 l.InterleavedBuffer(e,5);return o.setIndex([0,1,2,0,2,3]),o.setAttribute("position",new l.InterleavedBufferAttribute(t,3,0,!1)),o.setAttribute("uv",new l.InterleavedBufferAttribute(t,2,3,!1)),o}();function ec(o){return o}function tc(o){return o*o*o}function nc(o){return o<.5?4*o*o*o:1-(-2*o+2)**3/2}function sc(o){return o*o*o*o}function rc(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 Er=l.MathUtils.clamp;class Yr{constructor(e=0,t){ue(this,"_getNext");ue(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=Er(t,0,s-1),n=Er(n??s-1,0,s-1);const r=this.int(t,n),i=this.shuffle(e.map((c,h)=>h)),a=Math.min(e.length,r);return i.slice(0,a).sort().map(c=>e[c])}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 e>0&&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 ft="https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/",ys=`${ft}circle.png`,Pn=`${ft}circleBlur.png`,ic=`${ft}circleRainbow.png`,oc=`${ft}line.png`,Wr=`${ft}poly6.png`,Xr=`${ft}polyStroke6.png`,ac=`${ft}rays.png`,Tn=`${ft}ring.png`,lc=`${ft}starThin6.png`,cc={texture:[oc,Tn],color:["white"],distance:[0,0],size:[750,1024],length:[0,2]},uc={texture:[Pn],color:["white"],distance:[0,0],size:[180,512],length:[1,1]},hc={texture:[ac],color:["white"],distance:[0,0],size:[180,512],length:[1,1]},fc={texture:[ys,ic,Tn,lc],color:["white"],distance:[0,0],size:[180,512],length:[2,3]},[Zr,Kr]=[3679071,132442],_s=[cc,uc,hc,fc,{texture:[Pn,ys,Tn,Wr,Xr],color:["dimgray","gray","darkgray",Zr,Kr],distance:[.5,2.5],size:[20,180],length:[5,21]},{texture:[Pn,ys,Tn,Wr,Xr],color:["dimgray","gray","darkgray",Zr,Kr],distance:[-.6,-.1],size:[180,360],length:[0,5]}],In={color:"white",distance:0,size:512,texture:Pn},dc=[ec,tc,nc,sc,rc],qr=l.MathUtils.lerp,Qr=(o=0,e=_s)=>{const n=new Yr(o).choice(dc);return e.map((s,r)=>{const i=new Yr(o*(r*7907+1)+(typeof s.seed=="number"?s.seed:0)),a=i.int(s.length[0],s.length[1]);return Array.from({length:a}).fill(0).map(()=>{const c=n(i.rand());return{texture:i.defaultChoice(s.texture,In.texture),size:qr(s.size[0],s.size[1],n(1-c)),distance:qr(s.distance[0],s.distance[1],c),color:i.defaultChoice(s.color,In.color)}})}).flat()},Jr=(o,e,t=void 0,n=void 0,s=In)=>{if(o!==void 0&&o.length>0&&(typeof t=="number"||typeof n<"u")){const a=Qr(t??0,n??_s),c=a.length,h=o.length;return c>=h?a.map((d,f)=>Object.assign(d,e,f<h?o[f]:{})):o.map((d,f)=>Object.assign({},s,f<c?a[f]:{},e,d))}if(o!==void 0&&o.length>0){const a=Object.assign({},s,e);return o.map(c=>Object.assign({},a,c))}const r=n===void 0||n.length===0?_s:n;return Qr(t??0,r).map(a=>Object.assign({},a,e))};function pc(o){return mc(o,(e,t)=>t in In&&e!==void 0)}function mc(o,e){const t={};return Object.keys(o).forEach(n=>{e(o[n],n)&&(t[n]=o[n])}),t}const gc=u.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=u.shallowRef(),s=u.shallowRef([]),r=u.shallowRef(pc(t));e({instance:n});const i=new l.TextureLoader,a=new sn,c=[],h=()=>{var p,_,
|
|
500
|
+
}`},sn.Geometry=function(){const o=new l.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 l.InterleavedBuffer(e,5);return o.setIndex([0,1,2,0,2,3]),o.setAttribute("position",new l.InterleavedBufferAttribute(t,3,0,!1)),o.setAttribute("uv",new l.InterleavedBufferAttribute(t,2,3,!1)),o}();function ec(o){return o}function tc(o){return o*o*o}function nc(o){return o<.5?4*o*o*o:1-(-2*o+2)**3/2}function sc(o){return o*o*o*o}function rc(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 Er=l.MathUtils.clamp;class Yr{constructor(e=0,t){ue(this,"_getNext");ue(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=Er(t,0,s-1),n=Er(n??s-1,0,s-1);const r=this.int(t,n),i=this.shuffle(e.map((c,h)=>h)),a=Math.min(e.length,r);return i.slice(0,a).sort().map(c=>e[c])}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 e>0&&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 ft="https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/",ys=`${ft}circle.png`,Pn=`${ft}circleBlur.png`,ic=`${ft}circleRainbow.png`,oc=`${ft}line.png`,Wr=`${ft}poly6.png`,Xr=`${ft}polyStroke6.png`,ac=`${ft}rays.png`,Tn=`${ft}ring.png`,lc=`${ft}starThin6.png`,cc={texture:[oc,Tn],color:["white"],distance:[0,0],size:[750,1024],length:[0,2]},uc={texture:[Pn],color:["white"],distance:[0,0],size:[180,512],length:[1,1]},hc={texture:[ac],color:["white"],distance:[0,0],size:[180,512],length:[1,1]},fc={texture:[ys,ic,Tn,lc],color:["white"],distance:[0,0],size:[180,512],length:[2,3]},[Zr,Kr]=[3679071,132442],_s=[cc,uc,hc,fc,{texture:[Pn,ys,Tn,Wr,Xr],color:["dimgray","gray","darkgray",Zr,Kr],distance:[.5,2.5],size:[20,180],length:[5,21]},{texture:[Pn,ys,Tn,Wr,Xr],color:["dimgray","gray","darkgray",Zr,Kr],distance:[-.6,-.1],size:[180,360],length:[0,5]}],In={color:"white",distance:0,size:512,texture:Pn},dc=[ec,tc,nc,sc,rc],qr=l.MathUtils.lerp,Qr=(o=0,e=_s)=>{const n=new Yr(o).choice(dc);return e.map((s,r)=>{const i=new Yr(o*(r*7907+1)+(typeof s.seed=="number"?s.seed:0)),a=i.int(s.length[0],s.length[1]);return Array.from({length:a}).fill(0).map(()=>{const c=n(i.rand());return{texture:i.defaultChoice(s.texture,In.texture),size:qr(s.size[0],s.size[1],n(1-c)),distance:qr(s.distance[0],s.distance[1],c),color:i.defaultChoice(s.color,In.color)}})}).flat()},Jr=(o,e,t=void 0,n=void 0,s=In)=>{if(o!==void 0&&o.length>0&&(typeof t=="number"||typeof n<"u")){const a=Qr(t??0,n??_s),c=a.length,h=o.length;return c>=h?a.map((d,f)=>Object.assign(d,e,f<h?o[f]:{})):o.map((d,f)=>Object.assign({},s,f<c?a[f]:{},e,d))}if(o!==void 0&&o.length>0){const a=Object.assign({},s,e);return o.map(c=>Object.assign({},a,c))}const r=n===void 0||n.length===0?_s:n;return Qr(t??0,r).map(a=>Object.assign({},a,e))};function pc(o){return mc(o,(e,t)=>t in In&&e!==void 0)}function mc(o,e){const t={};return Object.keys(o).forEach(n=>{e(o[n],n)&&(t[n]=o[n])}),t}const gc=u.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=u.shallowRef(),s=u.shallowRef([]),r=u.shallowRef(pc(t));e({instance:n});const i=new l.TextureLoader,a=new sn,c=[],h=()=>{var p,_,y;for(;c.length;)c.pop();(p=n.value)==null||p.children.forEach(x=>{"dispose"in x&&x.dispose()}),(_=n.value)==null||_.remove(...n.value.children),(y=n.value)==null||y.dispose()},d=p=>{if(typeof p.texture=="string"){const _=p.texture;p.texture=i.load(_),p.texture.name=_}return p.color=ee.normalizeColor(p.color),p},f=()=>{for(let p=s.value.length-1;p<c.length;p++)c[p].size=0;s.value.forEach((p,_)=>{c[_].size=p.size*t.scale})},g=()=>{for(;s.value.length>c.length;){const _={...d(s.value[c.length])};c.push(_),a.addElement(_)}s.value.forEach((p,_)=>{const y=c[_],{texture:x,size:m,distance:M,color:v}=p;if(typeof x=="string"){if(y.texture.name!==x){y.texture.dispose();const C=x;y.texture=i.load(C),y.texture.name=C}}else y.texture!==x&&(y.texture.dispose(),y.texture=x);y.size=m,y.distance=M,y.color=ee.normalizeColor(v)}),f()};return u.onUnmounted(()=>{h()}),u.onMounted(()=>{var p;(p=n.value)==null||p.add(a),s.value=Jr(t.elements,r.value,t.seed,t.seedProps)}),u.watch(()=>[t.color,t.distance,t.size,t.texture],()=>{r.value={color:t.color,distance:t.distance,size:t.size,texture:t.texture}}),u.watch(()=>[r.value,t.elements,t.seed,t.seedProps],()=>{s.value=Jr(t.elements,r.value,t.seed,t.seedProps)}),u.watch(()=>t.scale,()=>{f()}),u.watch(()=>s.value,()=>{g()}),(p,_)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"lensflareRef",ref:n},null,512))}});function Hr(o){const e=u.ref(null),{height:t,width:n,settings:s,depth:r,autoRender:i=u.ref(!0)}=u.isReactive(o)?u.toRefs(o):u.toRefs(u.reactive(o)),{onBeforeRender:a}=ee.useLoop(),{camera:c,renderer:h,scene:d,sizes:f,invalidate:g}=ee.useTresContext();return u.watch(()=>[n==null?void 0:n.value,f.width.value,t==null?void 0:t.value,f.height.value],()=>{var p;(p=e.value)==null||p.dispose(),e.value=new l.WebGLRenderTarget((n==null?void 0:n.value)||f.width.value,(t==null?void 0:t.value)||f.height.value,{minFilter:l.LinearFilter,magFilter:l.LinearFilter,type:l.HalfFloatType,...s==null?void 0:s.value}),r!=null&&r.value&&(e.value.depthTexture=new l.DepthTexture((n==null?void 0:n.value)||f.width.value,(t==null?void 0:t.value)||f.height.value,l.FloatType)),g()},{immediate:!0}),a(()=>{i.value&&(h.value.setRenderTarget(e.value),h.value.clear(),h.value.render(d.value,c.value),h.value.setRenderTarget(null))},Number.POSITIVE_INFINITY),u.onBeforeUnmount(()=>{var p;(p=e.value)==null||p.dispose()}),e}const yc=u.defineComponent({__name:"component",props:{width:{},height:{},depth:{type:Boolean,default:!1},settings:{default:void 0},autoRender:{type:Boolean,default:!0}},setup(o,{expose:e}){const n=Hr(o);return e({instance:n}),()=>{}}}),$r=(o,e=16,t,n,s)=>{const r=new Float32Array(e*16),i=u.ref(new l.InterleavedBuffer(r,16));return(()=>{if(!o)return;const c=new Ho(o);n&&c.setWeightAttribute(n),c.build();const h=new l.Vector3,d=new l.Vector3,f=new l.Color,g=new l.Object3D;o.updateMatrixWorld(!0);for(let p=0;p<e;p++)c.sample(h,d,f),typeof s=="function"?s({dummy:g,sampledMesh:o,position:h,normal:d,color:f},p):g.position.copy(h),g.updateMatrix(),t&&t.setMatrixAt(p,g.matrix),g.matrix.toArray(i.value.array,p*16);t&&(t.instanceMatrix.needsUpdate=!0),i.value.needsUpdate=!0})(),{buffer:i}},_c=u.defineComponent({__name:"component",props:{transform:{type:Function},weight:{},count:{},mesh:{},instanceMesh:{}},setup(o,{expose:e}){const t=o,n=u.ref(),s=u.ref(),r=u.ref(),{invalidate:i}=ee.useTresContext();return u.watch(t,()=>i()),u.watchEffect(()=>{var a,c;s.value=t.instanceMesh??((a=n.value)==null?void 0:a.children.find(h=>Object.prototype.hasOwnProperty.call(h,"instanceMatrix"))),r.value=t.mesh??((c=n.value)==null?void 0:c.children.find(h=>h.type==="Mesh")),$r(r.value,t.count,s.value,t.weight,t.transform)}),e({samplerRef:n}),(a,c)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"samplerRef",ref:n},[u.renderSlot(a.$slots,"default")],512))}}),xc=/\d*$/,vc=/_*\d*$/;function wc(o){return o.replace(vc,"")}function bc(o){const e=o.match(xc);return e?Number.parseInt(e[e.length-1]):null}function Mc(o){const e=Sc(o),t=[];for(const{startFrame:n,endFrame:s,duration:r}of e)if(!(r<=0))if(s<0||n===s){for(let i=0;i<r;i++)t.push(n);continue}else{const i=Math.sign(s-n);for(let a=n;a!==s+i;a+=i)for(let c=0;c<r;c++)t.push(a)}return t}function Sc(o){let e="START_FRAME_IN";const t=[];for(const{name:n,value:s,startI:r}of Ac(o))e==="START_FRAME_IN"?n==="NUMBER"?(t.push({startFrame:s,endFrame:s,duration:1}),e="START_FRAME_OUT"):Bt("number",n,o,r):e==="START_FRAME_OUT"?n==="COMMA"?e="START_FRAME_IN":n==="HYPHEN"?e="END_FRAME_IN":n==="OPEN_PAREN"?e="DURATION_IN":Bt('",", "-", "("',n,o,r):e==="END_FRAME_IN"?n==="NUMBER"?(t[t.length-1].endFrame=s,e="END_FRAME_OUT"):Bt("number",n,o,r):e==="END_FRAME_OUT"?n==="COMMA"?e="START_FRAME_IN":n==="OPEN_PAREN"?e="DURATION_IN":Bt("',' or '('",n,o,r):e==="DURATION_IN"?n==="NUMBER"?(t[t.length-1].duration=s,e="DURATION_OUT"):Bt("number",n,o,r):e==="DURATION_OUT"?n==="CLOSE_PAREN"?e="NEXT_OR_DONE":Bt('"("',n,o,r):e==="NEXT_OR_DONE"&&(n==="COMMA"?e="START_FRAME_IN":Bt('","',n,o,r));return t}function Ac(o){const e=[];for(let t=0;t<o.length;t++){const n=o[t];if("0123456789".includes(n))e.length&&e[e.length-1].name==="NUMBER"?(e[e.length-1].value*=10,e[e.length-1].value+=Number.parseInt(n)):e.push({name:"NUMBER",value:Number.parseInt(n),startI:t});else{if(n===" ")continue;n===","?e.push({name:"COMMA",value:-1,startI:t}):n==="("?e.push({name:"OPEN_PAREN",value:-1,startI:t}):n===")"?e.push({name:"CLOSE_PAREN",value:-1,startI:t}):n==="-"?e.push({name:"HYPHEN",value:-1,startI:t}):Cc("0123456789,-()",n,o,t)}}return e}function Cc(o,e,t,n){ee.useLogger().logError(`Cientos AnimationDefinitionParser: Unexpected character while processing animation definition: expected ${o}, got ${e}.
|
|
501
501
|
${t}
|
|
502
|
-
${Array(n+1).join(" ")}^`)}function Bt(o,e,t,n){ee.useLogger().logError(`Cientos AnimationDefinitionParser: Syntax error while processing animation definition: expected ${o}, got ${e}.
|
|
502
|
+
${Array.from({length:n+1}).join(" ")}^`)}function Bt(o,e,t,n){ee.useLogger().logError(`Cientos AnimationDefinitionParser: Syntax error while processing animation definition: expected ${o}, got ${e}.
|
|
503
503
|
${t}
|
|
504
|
-
${Array(n+1).join(" ")}^`)}async function Pc(o,e){const t=ee.useLoader(l.TextureLoader,o),n=typeof e!="string"?new Promise(s=>s(e)):fetch(e).then(s=>s.json()).catch(s=>ee.useLogger().logError(`Cientos Atlas - ${s}`));return Promise.all([t,n]).then(([s,r])=>{const i=Tc(r,s.image.width,s.image.height);return[s,i]})}function Tc(o,e,t){const n=typeof o=="number"||Array.isArray(o)?Lc(o,e,t):Ic(o,e,t);return{frames:n,animations:ti(n)}}function rn(o,e,t){let n;return typeof e=="string"?n=kc(o,e):typeof e=="number"?n=ei(o,e,e):n=ei(o,e[0],e[1]),t?n.toReversed():n}function xs(){return{name:"null",width:0,height:0,offsetX:0,offsetY:0,repeatX:0,repeatY:0}}function Ic(o,e,t){return Array.isArray(o.frames)?Oc(o,e,t):Dc(o,e,t)}function Oc(o,e,t){const n=1/e,s=1/t;return o.frames.map(r=>({name:r.filename,offsetX:r.frame.x*n,offsetY:1-(r.frame.y+r.frame.h)*s,repeatX:r.frame.w*n,repeatY:r.frame.h*s,width:r.frame.w,height:r.frame.h}))}function Dc(o,e,t){const n=1/e,s=1/t;return Object.entries(o.frames).map(([r,i])=>({name:r,offsetX:i.frame.x*n,offsetY:1-(i.frame.y+i.frame.h)*s,repeatX:i.frame.w*n,repeatY:i.frame.h*s,width:i.frame.w,height:i.frame.h}))}function Lc(o,e,t,n="default"){const[s,r]=Array.isArray(o)?o:[o,1],i=e/s,a=t/r,c=(s*r).toString().length,h=1/s,d=1/r,f=[];let
|
|
504
|
+
${Array.from({length:n+1}).join(" ")}^`)}async function Pc(o,e){const t=ee.useLoader(l.TextureLoader,o),n=typeof e!="string"?new Promise(s=>s(e)):fetch(e).then(s=>s.json()).catch(s=>ee.useLogger().logError(`Cientos Atlas - ${s}`));return Promise.all([t,n]).then(([s,r])=>{const i=Tc(r,s.image.width,s.image.height);return[s,i]})}function Tc(o,e,t){const n=typeof o=="number"||Array.isArray(o)?Lc(o,e,t):Ic(o,e,t);return{frames:n,animations:ti(n)}}function rn(o,e,t){let n;return typeof e=="string"?n=kc(o,e):typeof e=="number"?n=ei(o,e,e):n=ei(o,e[0],e[1]),t?n.toReversed():n}function xs(){return{name:"null",width:0,height:0,offsetX:0,offsetY:0,repeatX:0,repeatY:0}}function Ic(o,e,t){return Array.isArray(o.frames)?Oc(o,e,t):Dc(o,e,t)}function Oc(o,e,t){const n=1/e,s=1/t;return o.frames.map(r=>({name:r.filename,offsetX:r.frame.x*n,offsetY:1-(r.frame.y+r.frame.h)*s,repeatX:r.frame.w*n,repeatY:r.frame.h*s,width:r.frame.w,height:r.frame.h}))}function Dc(o,e,t){const n=1/e,s=1/t;return Object.entries(o.frames).map(([r,i])=>({name:r,offsetX:i.frame.x*n,offsetY:1-(i.frame.y+i.frame.h)*s,repeatX:i.frame.w*n,repeatY:i.frame.h*s,width:i.frame.w,height:i.frame.h}))}function Lc(o,e,t,n="default"){const[s,r]=Array.isArray(o)?o:[o,1],i=e/s,a=t/r,c=(s*r).toString().length,h=1/s,d=1/r,f=[];let g=0;for(let p=r-1;p>=0;p--)for(let _=0;_<s;_++)g++,f.push({name:n+String(g).padStart(c,"0"),offsetX:_*h,offsetY:p*d,repeatX:h,repeatY:d,width:i,height:a});return f}function Bc(o,e={}){const t=ti(o.frames);for(const[n,s]of Object.entries(e)){const r=rn(o,n,!1),i=Mc(s);for(const a of i)(a<0||r.length<=a)&&ee.useLogger().logError(`Cientos Atlas: Attempting to access frame index ${a} in animation ${n}, but it does not exist.`);t[n]=i.map(a=>r[a])}o.animations=t}function kc(o,e){if(!(e in o.animations)){const t=Object.keys(o.animations).map(n=>`* ${n}
|
|
505
505
|
`).join("");return ee.useLogger().logError(`Cientos Atlas: getAtlasFramesByAnimationName
|
|
506
506
|
The animation name "${e}" does not exist in this atlas.
|
|
507
507
|
Available names:
|
|
508
|
-
${t}`),[xs()]}return o.animations[e]}function ei(o,e,t){if(e<0||o.frames.length<=e||t<0||o.frames.length<=t)return ee.useLogger().logError(`Cientos Atlas: getFramesByIndex – [${e}, ${t}] is out of bounds.`),[xs()];const n=[],s=Math.sign(t-e);if(s===0)return[o.frames[e]];for(let r=e;r!==t+s;r+=s)n.push(o.frames[r]);return n}function ti(o){const e={};for(const t of o)if(bc(t.name)!==null){const n=wc(t.name);Object.prototype.hasOwnProperty.call(e,n)?e[n].push(t):e[n]=[t]}for(const t of Object.values(e))t.sort((n,s)=>n.name.localeCompare(s.name));return e}const Fc=["scale","position"],Uc=["map","alphaTest"],Nc=["scale","position"],zc=u.createElementVNode("TresPlaneGeometry",{args:[1,1]},null,-1),Vc=["side","map","alphaTest","depthWrite","depthTest"],On=.01,Rc=u.defineComponent({__name:"component",props:{image:{},atlas:{},definitions:{},fps:{default:30},loop:{type:Boolean,default:!0},animation:{default:0},paused:{type:Boolean,default:!1},reversed:{type:Boolean,default:!1},flipX:{type:Boolean,default:!1},resetOnEnd:{type:Boolean,default:!1},asSprite:{type:Boolean,default:!0},center:{default:()=>[.5,.5]},alphaTest:{default:0},depthTest:{type:Boolean,default:!0},depthWrite:{type:Boolean,default:!0}},emits:["frame","end","loop"],async setup(o,{expose:e,emit:t}){let n,s;const r=o,i=t,{invalidate:a}=ee.useTresContext();u.watch(r,()=>{a()});const c=u.ref(0),h=u.ref(0),d=u.ref(0),f=u.ref(0),y=u.shallowRef();e({instance:y});const[p,_]=([n,s]=u.withAsyncContext(()=>Pc(r.image,r.atlas)),n=await n,s(),n);p.matrixAutoUpdate=!1;let g=rn(_,r.animation,r.reversed),x=.5,m=.5,M=1,v=xs(),C=null,O=0,S=!1,A=!0;ee.useLoop().onBeforeRender(({delta:P})=>{for(!r.paused&&!S&&(M-=P*r.fps);M<=0;)M++,O++,r.loop?(O>=g.length&&i("loop",g[g.length-1].name),O%=g.length):O>=g.length&&(S=!0,O=r.resetOnEnd?0:g.length-1,i("end",g[g.length-1].name));g[O]!==v&&(v=g[O],C=v.name,b()),A&&(A=!1,p.offset.x=v.offsetX+(r.flipX?v.repeatX:0),p.offset.y=v.offsetY,p.repeat.x=v.repeatX*(r.flipX?-1:1),p.repeat.y=v.repeatY,p.updateMatrix(),d.value=v.width*On,f.value=v.height*On,c.value=(.5-x)*v.width*On,h.value=(.5-m)*v.height*On),C&&(i("frame",C),C=null)});function b(){A=!0}return u.watch(()=>r.animation,(P,w)=>{JSON.stringify(P)!==JSON.stringify(w)&&(g=rn(_,r.animation,r.reversed),O=0,M=1,S=!1,b())},{immediate:!0}),u.watch(()=>r.reversed,()=>{O=(g.length-O-1)%g.length,g=rn(_,r.animation,r.reversed),S&&(O=r.resetOnEnd?0:g.length-1),b()}),u.watch(()=>r.paused,()=>{S=!1}),u.watch(()=>r.loop,()=>{S&&r.loop&&(S=!1)}),u.watch(()=>r.resetOnEnd,()=>{S&&(O=r.resetOnEnd?0:g.length-1,b())}),u.watch(()=>r.flipX,b),u.watch(()=>[r.center],()=>{[x,m]=ee.normalizeVectorFlexibleParam(r.center),b()},{immediate:!0}),u.watch(()=>[r.definitions],()=>{Bc(_,r.definitions),g=rn(_,r.animation,r.reversed),M=1,O=0,b()},{immediate:!0}),u.onUnmounted(()=>{p.dispose()}),(P,w)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"groupRef",ref:y},[r.asSprite?(u.openBlock(),u.createElementBlock("TresSprite",{key:0,scale:[d.value,f.value,1],position:[c.value,h.value,0]},[u.createElementVNode("TresSpriteMaterial",{toneMapped:!1,map:u.unref(p),transparent:!0,alphaTest:r.alphaTest},null,8,Uc)],8,Fc)):(u.openBlock(),u.createElementBlock("TresMesh",{key:1,scale:[d.value,f.value,1],position:[c.value,h.value,0]},[zc,u.createElementVNode("TresMeshBasicMaterial",{toneMapped:!1,side:u.unref(l.DoubleSide),map:u.unref(p),transparent:!0,alphaTest:r.alphaTest,depthWrite:r.depthWrite,depthTest:r.depthTest},null,8,Vc)],8,Nc)),u.renderSlot(P.$slots,"default")],512))}});class Gc extends l.Line{constructor(e,t=1,n=16,s=2){const r=new l.BufferGeometry,i=n+s*2,a=new Float32Array((i*3+3)*3);r.setAttribute("position",new l.BufferAttribute(a,3));const c=new l.LineBasicMaterial({color:65280}),h=new l.LineBasicMaterial({color:16776960});super(r,[h,c]),this.audio=e,this.range=t,this.divisionsInnerAngle=n,this.divisionsOuterAngle=s,this.type="PositionalAudioHelper",this.update()}update(){const e=this.audio,t=this.range,n=this.divisionsInnerAngle,s=this.divisionsOuterAngle,r=l.MathUtils.degToRad(e.panner.coneInnerAngle),i=l.MathUtils.degToRad(e.panner.coneOuterAngle),a=r/2,c=i/2;let h=0,d=0,f,y;const p=this.geometry,_=p.attributes.position;p.clearGroups();function g(x,m,M,v){const C=(m-x)/M;for(_.setXYZ(h,0,0,0),d++,f=x;f<m;f+=C)y=h+d,_.setXYZ(y,Math.sin(f)*t,0,Math.cos(f)*t),_.setXYZ(y+1,Math.sin(Math.min(f+C,m))*t,0,Math.cos(Math.min(f+C,m))*t),_.setXYZ(y+2,0,0,0),d+=3;p.addGroup(h,d,v),h+=d,d=0}g(-c,-a,s,0),g(-a,a,n,1),g(a,c,s,0),_.needsUpdate=!0,r===i&&(this.material[0].visible=!1)}dispose(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()}}const jc=["args"],Ec=u.defineComponent({__name:"PositionalAudio",props:{ready:{type:Boolean,default:!1},url:{},distance:{default:2},helper:{type:Boolean,default:!1},loop:{type:Boolean,default:!1},autoplay:{type:Boolean,default:!1},innerAngle:{default:360},outerAngle:{default:360},outerGain:{default:0}},emits:["isPlaying"],async setup(o,{expose:e,emit:t}){let n,s;const r=o,i=t,{ready:a,url:c,distance:h,helper:d,loop:f,autoplay:y,innerAngle:p,outerAngle:_,outerGain:g}=u.toRefs(r),{camera:x}=ee.useTresContext(),m=u.shallowRef(null),M=u.shallowRef(null),v=u.shallowRef(null),C=u.shallowReactive(new l.AudioListener),O=()=>{var V,R,Y;(V=m==null?void 0:m.value)!=null&&V.isPlaying||((R=m==null?void 0:m.value)==null||R.play(),i("isPlaying",(Y=m==null?void 0:m.value)==null?void 0:Y.isPlaying))},S=()=>{var V,R;(V=m==null?void 0:m.value)!=null&&V.isPlaying&&(m.value.pause(),i("isPlaying",(R=m==null?void 0:m.value)==null?void 0:R.isPlaying))},A=()=>{var V;m.value&&(m.value.stop(),i("isPlaying",(V=m==null?void 0:m.value)==null?void 0:V.isPlaying))},b=()=>{if(!(m!=null&&m.value))return;A();const V=m.value;V.source&&V.disconnect()},P=()=>{var V,R;!(m!=null&&m.value)||!(M!=null&&M.value)||((V=M==null?void 0:M.value)==null||V.dispose(),(R=m==null?void 0:m.value)==null||R.remove(M==null?void 0:M.value))},w=()=>{var V;if(m.value&&(m.value.setBuffer(v.value),m.value.setRefDistance(h.value),m.value.setLoop(f.value),m.value.setDirectionalCone(p.value,_.value,g.value),(V=M==null?void 0:M.value)==null||V.update(),M!=null&&M.value)){const R=M.value.material[0];!R.visible&&_.value!==p.value&&(R.visible=!0)}},D=()=>{var W,$;w();const V=(W=m.value)==null?void 0:W.parent,R=new l.Box3().setFromObject(V),Y=(R.max.z-R.min.z)*2;M.value=new Gc(m.value,Y,32,16),($=m==null?void 0:m.value)==null||$.add(M.value),M.value.update()},L=()=>{var V;(V=x==null?void 0:x.value)==null||V.remove(C),b(),P()};return e({root:m,play:O,stop:A,pause:S,dispose:L}),v.value=([n,s]=u.withAsyncContext(()=>ee.useLoader(l.AudioLoader,c.value)),n=await n,s(),n),u.watch(m,()=>{m!=null&&m.value&&(d.value&&D(),a.value&&y&&O())}),u.watch(d,()=>{d.value?D():P()}),u.watch(a,()=>{a.value&&w(),y.value&&a.value&&O(),!y.value&&a.value&&A()}),u.watch([h,f,v,p,_,g,y],()=>{w()}),u.onMounted(()=>{var V;(V=x==null?void 0:x.value)==null||V.add(C)}),u.onBeforeUnmount(()=>{L()}),(V,R)=>(u.openBlock(),u.createElementBlock("TresPositionalAudio",u.mergeProps({ref_key:"positionalAudioRef",ref:m,args:[u.unref(C)]},V.$attrs),null,16,jc))}}),Dn={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"},Yc="https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/";async function ni(o,e){const{scene:t,invalidate:n}=ee.useTresContext(),{preset:s,blur:r,files:i=u.ref([]),path:a=u.ref(""),background:c}=u.toRefs(o);u.watch(o,()=>{n()});const h=u.ref(null),d=u.computed(()=>Array.isArray(i.value)),f=u.computed(()=>d.value?l.CubeTextureLoader:Nr),y=u.ref();return u.watch([i,a],async([p,_])=>{if(p&&p.length>0&&!(s!=null&&s.value)){try{y.value=await ee.useLoader(f.value,d.value?[...u.unref(p)]:u.unref(p),g=>{_&&g.setPath(u.unref(_))})}catch(g){throw new Error(`Failed to load environment map: ${g}`)}y.value&&(h.value=d.value?y.value[0]:y.value,h.value&&(h.value.mapping=d.value?l.CubeReflectionMapping:l.EquirectangularReflectionMapping))}},{immediate:!0}),u.watch(h,p=>{t.value&&p&&(t.value.environment=p)},{immediate:!0}),u.watch([c,h],([p,_])=>{if(t.value){const g=e!=null&&e.value?e.value.texture:_;g&&(t.value.background=p?g:null)}},{immediate:!0}),u.watch(()=>r==null?void 0:r.value,p=>{t.value&&p&&(t.value.backgroundBlurriness=p)},{immediate:!0}),u.watch(()=>s==null?void 0:s.value,async p=>{if(p&&p in Dn){const _=Yc,g=Dn[p];try{y.value=await ee.useLoader(Nr,g,x=>{_&&x.setPath(_)})}catch(x){throw new Error(`Failed to load environment map: ${x}`)}y.value&&(h.value=y.value,h.value&&(h.value.mapping=l.EquirectangularReflectionMapping)),n()}else if(p&&!(p in Dn))throw new Error(`Preset must be one of: ${Object.keys(Dn).join(", ")}`)},{immediate:!0}),h}let bt=null;function Wc(o,e){return t=>{e&&e(t),o.draco&&(bt||(bt=new Ml),bt.setDecoderPath(o.decoderPath||"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),t.setDRACOLoader&&t.setDRACOLoader(bt))}}async function si(o,e={draco:!1},t){const n=await ee.useLoader(pa,o,Wc(e,t));return bt==null||bt.dispose(),bt=null,n}const Xc=["object"],Zc=u.defineComponent({__name:"component",props:{path:{},draco:{type:Boolean,default:!1},decoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.4.1/"},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1}},async setup(o,{expose:e}){let t,n;const s=o,r=u.ref();e({instance:r});const{scene:i}=([t,n]=u.withAsyncContext(()=>si(s.path,{draco:s.draco,decoderPath:s.decoderPath})),t=await t,n(),t);return(s.castShadow||s.receiveShadow)&&i.traverse(a=>{a.isMesh&&(a.castShadow=s.castShadow,a.receiveShadow=s.receiveShadow)}),(a,c)=>(u.openBlock(),u.createElementBlock("primitive",u.mergeProps({ref_key:"modelRef",ref:r,object:u.unref(i)},a.$attrs),null,16,Xc))}});async function ri(o){return await ee.useLoader(il,o)}const Kc=["object"],qc=u.defineComponent({__name:"component",props:{path:{},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1}},async setup(o,{expose:e}){let t,n;const s=o,r=u.ref();e({instance:r});const i=([t,n]=u.withAsyncContext(()=>ri(s.path)),t=await t,n(),t);return(s.castShadow||s.receiveShadow)&&i.traverse(a=>{a.isMesh&&(a.castShadow=s.castShadow,a.receiveShadow=s.receiveShadow)}),(a,c)=>(u.openBlock(),u.createElementBlock("primitive",u.mergeProps({ref_key:"modelRef",ref:r,object:u.unref(i)},a.$attrs),null,16,Kc))}}),Qc=["geometry","render-order"],Jc=u.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:s,skipFills:r,fillMaterial:i,strokeMaterial:a,fillMeshProps:c,strokeMeshProps:h,depth:d}=u.toRefs(t),f=u.shallowRef(),y=u.shallowRef([]),p=u.shallowRef([]);e({instance:f}),u.watchEffect(async()=>_(n.value).then(m=>p.value=m.paths)),u.watch([r,s,i,a,p],x);async function _(m){const M=m.startsWith("<svg")?encodeURI(`data:image/svg+xml;utf8,${m}`):m;return ee.useLoader(nn,M)}u.onUnmounted(g);function g(){y.value.forEach(m=>m.geometry.dispose())}function x(){var O,S,A;g();const m=[],[M,v]=(()=>{const b={flat:!1,renderOrder:!1,offsetZ:!0},P={flat:0,renderOrder:0,offsetZ:.025},w=d.value;return typeof w=="number"?[!0,w]:[b[w],P[w]]})();let C=0;for(const b of p.value){const P=((O=b.userData)==null?void 0:O.style)??{},w=Object.assign({color:P.fill,opacity:P.fillOpacity,transparent:!0,side:l.DoubleSide,depthWrite:M},t.fillMaterial);if(!r.value&&P.fill!==void 0&&P.fill!=="none")for(const D of nn.createShapes(b)){const L=new l.ShapeGeometry(D);L.scale(1,-1,1),v&&L.translate(0,0,C++*v),m.push({geometry:L,material:w,isStroke:!1})}if(!s.value&&P.stroke!==void 0&&P.stroke!=="none"){const D=Object.assign({color:(S=b.userData)==null?void 0:S.style.stroke,opacity:(A=b.userData)==null?void 0:A.style.strokeOpacity,transparent:!0,side:l.DoubleSide,depthWrite:M},t.strokeMaterial);for(const L of b.subPaths){const V=L.getPoints().map(Y=>new l.Vector2(Y.x,-Y.y)),R=nn.pointsToStroke(V,P||"none");v&&R.translate(0,0,C++*v),m.push({geometry:R,material:D,isStroke:!0})}}}y.value=m}return(m,M)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"svgRef",ref:f},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(y.value,({geometry:v,material:C,isStroke:O},S)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({key:`${S}`,ref_for:!0},O?u.unref(h):u.unref(c),{geometry:v,"render-order":u.unref(d)==="renderOrder"?S:0}),[u.createElementVNode("TresMeshBasicMaterial",u.mergeProps({ref_for:!0},C),null,16)],16,Qc))),128))],512))}}),ii="[TresJS - Cientos ▲ ■ ♥] ";function oi(){function o(n,s){console.error(`${ii} ${n}`,s||"")}function e(n){console.warn(`${ii} ${n}`)}function t(n,s){}return{logError:o,logWarning:e,logMessage:t}}let vs=0;function Hc(){const o=u.ref(!1),e=u.ref(0),t=u.ref([]),{logError:n}=oi();return new Promise(s=>{l.DefaultLoadingManager.onStart=()=>{o.value=!1},l.DefaultLoadingManager.onLoad=()=>{o.value=!0},l.DefaultLoadingManager.onProgress=(r,i,a)=>{i===a&&(vs=a,o.value=!0,t.value.push(r)),e.value=Math.round((i-vs)/(a-vs)*100||100)},l.DefaultLoadingManager.onError=r=>{n("Error loading assets",new Error(r)),o.value=!0},s({items:t,hasFinishLoading:o,progress:e})})}async function $c(o,e){const{logError:t}=oi();if(!o)return t("Error no path provided");const{unsuspend:n,start:s,crossOrigin:r,muted:i,loop:a,...c}={unsuspend:"loadedmetadata",crossOrigin:"Anonymous",muted:!0,loop:!0,start:!0,playsInline:!0,...e};function h(){return new Promise((d,f)=>{const y=Object.assign(document.createElement("video"),{src:typeof o=="string"&&o||void 0,crossOrigin:r,loop:a,muted:i,autoplay:!0,...c}),p=new l.VideoTexture(y);return y.addEventListener(n,()=>d(p)),y.addEventListener("error",()=>f(new Error("Error loading video"))),p})}try{const d=await h();return s&&d.image&&d.image.play(),d}catch{t("Error loading resource")}}const eu=["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"],tu=u.defineComponent({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[0,0,0]},enableDamping:{type:Boolean,default:!0},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:Number.POSITIVE_INFINITY},minZoom:{default:0},maxZoom:{default:Number.POSITIVE_INFINITY},touches:{default:()=>({ONE:l.TOUCH.ROTATE,TWO:l.TOUCH.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1}},emits:["change","start","end"],setup(o,{expose:e,emit:t}){const n=o,s=t,{makeDefault:r,autoRotate:i,autoRotateSpeed:a,enableDamping:c,dampingFactor:h,enablePan:d,keyPanSpeed:f,maxAzimuthAngle:y,minAzimuthAngle:p,maxPolarAngle:_,minPolarAngle:g,minDistance:x,maxDistance:m,minZoom:M,maxZoom:v,enableZoom:C,zoomSpeed:O,enableRotate:S,touches:A,rotateSpeed:b,target:P}=u.toRefs(n),{camera:w,renderer:D,extend:L,controls:V,invalidate:R}=ee.useTresContext(),Y=u.ref(null);L({OrbitControls:xr}),u.watch(Y,q=>{W(),q&&r.value?V.value=q:V.value=null});function W(){Ce(Y.value,"change",()=>{s("change",Y.value),R()}),Ce(Y.value,"start",()=>s("start",Y.value)),Ce(Y.value,"end",()=>s("end",Y.value))}const{onBeforeRender:$}=ee.useLoop();return $(({invalidate:q})=>{Y.value&&(c.value||i.value)&&(Y.value.update(),i.value&&q())}),u.onUnmounted(()=>{Y.value&&Y.value.dispose()}),e({instance:Y}),(q,ne)=>(q.camera||u.unref(w))&&(q.domElement||u.unref(D))?(u.openBlock(),u.createElementBlock("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:Y,target:u.unref(P),"auto-rotate":u.unref(i),"auto-rotate-speed":u.unref(a),"enable-damping":u.unref(c),"damping-factor":u.unref(h),"enable-pan":u.unref(d),"key-pan-speed":u.unref(f),keys:q.keys,"max-azimuth-angle":u.unref(y),"min-azimuth-angle":u.unref(p),"max-polar-angle":u.unref(_),"min-polar-angle":u.unref(g),"min-distance":u.unref(x),"max-distance":u.unref(m),"min-zoom":u.unref(M),"max-zoom":u.unref(v),touches:u.unref(A),"enable-zoom":u.unref(C),"zoom-speed":u.unref(O),"enable-rotate":u.unref(S),"rotate-speed":u.unref(b),args:[q.camera||u.unref(w),q.domElement||u.unref(D).domElement]},null,8,eu)):u.createCommentVNode("",!0)}}),nu=u.defineComponent({__name:"KeyboardControls",props:{makeDefault:{type:Boolean,default:!0},camera:{},domElement:{},moveSpeed:{default:.2},selector:{}},emits:["isLock","change"],setup(o,{expose:e,emit:t}){const n=o,s=t,{moveSpeed:r}=u.toRefs(n),{camera:i,controls:a,renderer:c,invalidate:h}=ee.useTresContext();u.watch(n,()=>{h()});const d=u.ref(0),f=u.ref(0),{w:y,s:p,a:_,d:g,Up:x,Down:m,Left:M,Right:v}=Kl();u.watchEffect(()=>{_.value||M.value?d.value=-r.value:g.value||v.value?d.value=r.value:d.value=0,y.value||x.value?f.value=r.value:p.value||m.value?f.value=-r.value:f.value=0}),e({instance:a});const C=D=>s("isLock",D),O=D=>s("change",D),S=new l.Vector3,A=new l.Vector3,b=new l.Quaternion,P=(D,L)=>{var Y;if(!((Y=i.value)!=null&&Y.position)&&!S)return;const V=i.value,R=D*.001;V==null||V.translateZ(-L),b.set(A.x*R,A.y*R,A.z*R,1).normalize(),V==null||V.quaternion.multiply(b),(d.value||f.value)&&s("change",a.value)},{onBeforeRender:w}=ee.useLoop();return w(({delta:D,invalidate:L})=>{var V;a.value instanceof gr&&((V=a.value)!=null&&V.isLocked)&&(P(D,f.value),a.value.moveRight(d.value),L())}),(D,L)=>(u.openBlock(),u.createBlock(u.unref(ai),{selector:D.selector,"make-default":D.makeDefault,camera:D.camera||u.unref(i),"dom-element":D.domElement||u.unref(c).domElement,onIsLock:C,onChange:O},null,8,["selector","make-default","camera","dom-element"]))}}),su=["object","args","mode","enabled","axis","translation-snap","rotation-snap","scale-snap","space","size","show-x","show-y","show-z"],ru=u.defineComponent({__name:"TransformControls",props:{object:{},camera:{},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,{expose:e,emit:t}){const n=o,s=t,{object:r,mode:i,enabled:a,axis:c,translationSnap:h,rotationSnap:d,scaleSnap:f,space:y,size:p,showX:_,showY:g,showZ:x}=u.toRefs(n),m=u.shallowRef(null),{controls:M,camera:v,renderer:C,extend:O,invalidate:S}=ee.useTresContext();u.watch([r,i,a,c,h,d,f,y,p,_,g,x],()=>{S()}),O({TransformControls:ta});const A=()=>{S(),s("change")},b=V=>{M.value&&(M.value.enabled=!V.value),S(),s("dragging",V.value)},P=()=>{S(),s("mouseDown")},w=()=>{S(),s("mouseDown")},D=()=>{S(),s("objectChange")};function L(){Ce(m.value,"change",A),Ce(m.value,"dragging-changed",b),Ce(m.value,"mouseDown",P),Ce(m.value,"mouseUp",w),Ce(m.value,"objectChange",D)}return u.watch(m,V=>{V&&L()}),u.onUnmounted(()=>{m.value&&m.value.dispose()}),e({instance:m}),(V,R)=>{var Y;return(V.camera||u.unref(v))&&u.unref(C)?(u.openBlock(),u.createElementBlock("TresTransformControls",{ref_key:"controlsRef",ref:m,key:(Y=V.camera||u.unref(v))==null?void 0:Y.uuid,object:u.unref(r),args:[V.camera||u.unref(v),u.unref(C).domElement],mode:u.unref(i),enabled:u.unref(a),axis:u.unref(c),"translation-snap":u.unref(h),"rotation-snap":u.unref(d),"scale-snap":u.unref(f),space:u.unref(y),size:u.unref(p),"show-x":u.unref(_),"show-y":u.unref(g),"show-z":u.unref(x),visible:!0},null,8,su)):u.createCommentVNode("",!0)}}}),iu=["args"],ai=u.defineComponent({__name:"PointerLockControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},selector:{}},emits:["isLock","change"],setup(o,{expose:e,emit:t}){const n=o,s=t,{camera:r,renderer:i,extend:a,controls:c,invalidate:h}=ee.useTresContext();u.watch(n,()=>{h()});const d=u.ref(null);let f;a({PointerLockControls:gr});const y=p=>{s("isLock",p)};return u.watch(d,p=>{p&&n.makeDefault?c.value=p:c.value=null,f=document.getElementById(n.selector||"")||i.value.domElement,Ce(c.value,"change",()=>{s("change",c.value),h()}),Ce(f,"click",()=>{var g,x,m;(g=d.value)==null||g.lock(),(x=d.value)==null||x.addEventListener("lock",()=>y(!0)),(m=d.value)==null||m.addEventListener("unlock",()=>y(!1)),h()})}),u.onUnmounted(()=>{var p,_;(p=c.value)==null||p.removeEventListener("lock",()=>y(!0)),(_=c.value)==null||_.removeEventListener("unlock",()=>y(!1)),d.value&&d.value.dispose()}),e({instance:c}),(p,_)=>(p.camera||u.unref(r))&&(p.domElement||u.unref(i))?(u.openBlock(),u.createElementBlock("TresPointerLockControls",{key:0,ref_key:"controlsRef",ref:d,args:[p.camera||u.unref(r),p.domElement||u.unref(i).domElement]},null,8,iu)):u.createCommentVNode("",!0)}}),ou=["args","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","enable-zoom","zoom-speed","enable-rotate","rotate-speed"],au=u.defineComponent({__name:"MapControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{},enableDamping:{type:Boolean,default:!0},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:Number.POSITIVE_INFINITY},minZoom:{default:0},maxZoom:{default:Number.POSITIVE_INFINITY},touches:{},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,{autoRotate:s,autoRotateSpeed:r,enableDamping:i,dampingFactor:a,enablePan:c,keyPanSpeed:h,maxAzimuthAngle:d,minAzimuthAngle:f,maxPolarAngle:y,minPolarAngle:p,minDistance:_,maxDistance:g,minZoom:x,maxZoom:m,enableZoom:M,zoomSpeed:v,enableRotate:C,rotateSpeed:O}=u.toRefs(n),{camera:S,renderer:A,extend:b,controls:P,invalidate:w}=ee.useTresContext();u.watch(n,()=>{w()});const D=u.ref(null);b({MapControls:fa}),u.watch(P,V=>{V&&n.makeDefault?P.value=V:P.value=null});const{onBeforeRender:L}=ee.useLoop();return L(({invalidate:V})=>{D.value&&(i.value||s.value)&&(D.value.update(),V())}),u.onUnmounted(()=>{D.value&&D.value.dispose()}),e({instance:D}),(V,R)=>(V.camera||u.unref(S))&&(V.domElement||u.unref(A))?(u.openBlock(),u.createElementBlock("TresMapControls",{key:0,ref_key:"controlsRef",ref:D,args:[V.camera||u.unref(S),V.domElement||u.unref(A).domElement],"auto-rotate":u.unref(s),"auto-rotate-speed":u.unref(r),"enable-damping":u.unref(i),"damping-factor":u.unref(a),"enable-pan":u.unref(c),"key-pan-speed":u.unref(h),keys:V.keys,"max-azimuth-angle":u.unref(d),"min-azimuth-angle":u.unref(f),"max-polar-angle":u.unref(y),"min-polar-angle":u.unref(p),"min-distance":u.unref(_),"max-distance":u.unref(g),"min-zoom":u.unref(x),"max-zoom":u.unref(m),"enable-zoom":u.unref(M),"zoom-speed":u.unref(v),"enable-rotate":u.unref(C),"rotate-speed":u.unref(O)},null,8,ou)):u.createCommentVNode("",!0)}}),lu=u.defineComponent({__name:"ScrollControls",props:{pages:{default:4},distance:{default:4},smoothScroll:{default:.1},horizontal:{type:Boolean,default:!1},htmlScroll:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(o,{expose:e,emit:t}){const n=o,s=t,{logWarning:r}=ee.useLogger();n.smoothScroll<0&&r("SmoothControl must be greater than zero"),n.pages<0&&r("Pages must be greater than zero");const{camera:i,controls:a,renderer:c,invalidate:h}=ee.useTresContext();u.watch(n,()=>{h()});const d=u.shallowRef(),f=document.createElement("div"),{y}=Jl(),{x:p,y:_,isScrolling:g}=Xl(f),{height:x,width:m}=Gr();let M=0;const v=u.ref(!1),C=u.ref(0),O=u.ref(0),S=u.ref(0),A=n.horizontal?"x":"y",b=u.watch(i,w=>{if(v.value){b();return}M=n.horizontal?(w==null?void 0:w.position.x)||0:(w==null?void 0:w.position.y)||0,v.value=!0},{immediate:!0});u.watch(g,w=>{a.value&&(a.value.enabled=!w)},{immediate:!0}),u.watch(y,w=>{!g.value&&!n.htmlScroll||(O.value=w/x.value/(S.value/x.value-1),C.value=-1*O.value,s("update:modelValue",O.value))}),u.watch(_,w=>{O.value=w/x.value/(S.value/x.value),C.value=-1*O.value,s("update:modelValue",O.value)}),u.watch(p,w=>{O.value=w/m.value/(S.value/m.value-1),C.value=+O.value,s("update:modelValue",O.value)}),u.watch(c,w=>{var L,V;const D=w==null?void 0:w.domElement;if(n.htmlScroll&&(w!=null&&w.domElement))D!=null&&D.style.width&&(D!=null&&D.style.position)&&(D!=null&&D.style.top)&&(D!=null&&D.style.left)&&(D.style.width="100%",D.style.position="fixed",D.style.zIndex=" -99999",D.style.top="0",D.style.left="0"),S.value=document.body.scrollHeight;else{const R=document.createElement("div"),Y=document.createElement("div");f.style[n.horizontal?"overflowX":"overflowY"]="auto",f.style[n.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"),R.style.position="sticky",R.style.top="0px",R.style.left="0px",R.style.width="100%",R.style.height="100%",R.style.overflow="hidden",f.appendChild(R),Y.style.height=n.horizontal?"100%":`${x.value*n.pages}px`,Y.style.width=n.horizontal?`${m.value*n.pages}px`:"100vw",Y.style.pointerEvents="none",D.style.position="fixed",D.style.zIndex="0",D!=null&&D.style.width&&(D.style.width="100%"),f.appendChild(Y),w!=null&&w.domElement.parentNode&&(w.domElement.parentNode.style.position="relative"),(V=(L=w==null?void 0:w.domElement)==null?void 0:L.parentNode)==null||V.appendChild(f),S.value=n.horizontal?m.value*n.pages:x.value*n.pages}},{immediate:!0});const{onBeforeRender:P}=ee.useLoop();return P(({invalidate:w})=>{var D;if((D=i.value)!=null&&D.position){const L=(C.value*n.distance-i.value.position[A]+M)*n.smoothScroll;i.value.position[A]+=L,d.value.children.length>0&&(d.value.position[A]+=L),w()}}),e({instance:d}),(w,D)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:d},[u.renderSlot(w.$slots,"default")],512))}});/*!
|
|
508
|
+
${t}`),[xs()]}return o.animations[e]}function ei(o,e,t){if(e<0||o.frames.length<=e||t<0||o.frames.length<=t)return ee.useLogger().logError(`Cientos Atlas: getFramesByIndex – [${e}, ${t}] is out of bounds.`),[xs()];const n=[],s=Math.sign(t-e);if(s===0)return[o.frames[e]];for(let r=e;r!==t+s;r+=s)n.push(o.frames[r]);return n}function ti(o){const e={};for(const t of o)if(bc(t.name)!==null){const n=wc(t.name);Object.prototype.hasOwnProperty.call(e,n)?e[n].push(t):e[n]=[t]}for(const t of Object.values(e))t.sort((n,s)=>n.name.localeCompare(s.name));return e}const Fc=["scale","position"],Uc=["map","alphaTest"],Nc=["scale","position"],zc=u.createElementVNode("TresPlaneGeometry",{args:[1,1]},null,-1),Vc=["side","map","alphaTest","depthWrite","depthTest"],On=.01,Rc=u.defineComponent({__name:"component",props:{image:{},atlas:{},definitions:{},fps:{default:30},loop:{type:Boolean,default:!0},animation:{default:0},paused:{type:Boolean,default:!1},reversed:{type:Boolean,default:!1},flipX:{type:Boolean,default:!1},resetOnEnd:{type:Boolean,default:!1},asSprite:{type:Boolean,default:!0},center:{default:()=>[.5,.5]},alphaTest:{default:0},depthTest:{type:Boolean,default:!0},depthWrite:{type:Boolean,default:!0}},emits:["frame","end","loop"],async setup(o,{expose:e,emit:t}){let n,s;const r=o,i=t,{invalidate:a}=ee.useTresContext();u.watch(r,()=>{a()});const c=u.ref(0),h=u.ref(0),d=u.ref(0),f=u.ref(0),g=u.shallowRef();e({instance:g});const[p,_]=([n,s]=u.withAsyncContext(()=>Pc(r.image,r.atlas)),n=await n,s(),n);p.matrixAutoUpdate=!1;let y=rn(_,r.animation,r.reversed),x=.5,m=.5,M=1,v=xs(),C=null,O=0,S=!1,A=!0;ee.useLoop().onBeforeRender(({delta:P})=>{for(!r.paused&&!S&&(M-=P*r.fps);M<=0;)M++,O++,r.loop?(O>=y.length&&i("loop",y[y.length-1].name),O%=y.length):O>=y.length&&(S=!0,O=r.resetOnEnd?0:y.length-1,i("end",y[y.length-1].name));y[O]!==v&&(v=y[O],C=v.name,b()),A&&(A=!1,p.offset.x=v.offsetX+(r.flipX?v.repeatX:0),p.offset.y=v.offsetY,p.repeat.x=v.repeatX*(r.flipX?-1:1),p.repeat.y=v.repeatY,p.updateMatrix(),d.value=v.width*On,f.value=v.height*On,c.value=(.5-x)*v.width*On,h.value=(.5-m)*v.height*On),C&&(i("frame",C),C=null)});function b(){A=!0}return u.watch(()=>r.animation,(P,w)=>{JSON.stringify(P)!==JSON.stringify(w)&&(y=rn(_,r.animation,r.reversed),O=0,M=1,S=!1,b())},{immediate:!0}),u.watch(()=>r.reversed,()=>{O=(y.length-O-1)%y.length,y=rn(_,r.animation,r.reversed),S&&(O=r.resetOnEnd?0:y.length-1),b()}),u.watch(()=>r.paused,()=>{S=!1}),u.watch(()=>r.loop,()=>{S&&r.loop&&(S=!1)}),u.watch(()=>r.resetOnEnd,()=>{S&&(O=r.resetOnEnd?0:y.length-1,b())}),u.watch(()=>r.flipX,b),u.watch(()=>[r.center],()=>{[x,m]=ee.normalizeVectorFlexibleParam(r.center),b()},{immediate:!0}),u.watch(()=>[r.definitions],()=>{Bc(_,r.definitions),y=rn(_,r.animation,r.reversed),M=1,O=0,b()},{immediate:!0}),u.onUnmounted(()=>{p.dispose()}),(P,w)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"groupRef",ref:g},[r.asSprite?(u.openBlock(),u.createElementBlock("TresSprite",{key:0,scale:[d.value,f.value,1],position:[c.value,h.value,0]},[u.createElementVNode("TresSpriteMaterial",{toneMapped:!1,map:u.unref(p),transparent:!0,alphaTest:r.alphaTest},null,8,Uc)],8,Fc)):(u.openBlock(),u.createElementBlock("TresMesh",{key:1,scale:[d.value,f.value,1],position:[c.value,h.value,0]},[zc,u.createElementVNode("TresMeshBasicMaterial",{toneMapped:!1,side:u.unref(l.DoubleSide),map:u.unref(p),transparent:!0,alphaTest:r.alphaTest,depthWrite:r.depthWrite,depthTest:r.depthTest},null,8,Vc)],8,Nc)),u.renderSlot(P.$slots,"default")],512))}});class Gc extends l.Line{constructor(e,t=1,n=16,s=2){const r=new l.BufferGeometry,i=n+s*2,a=new Float32Array((i*3+3)*3);r.setAttribute("position",new l.BufferAttribute(a,3));const c=new l.LineBasicMaterial({color:65280}),h=new l.LineBasicMaterial({color:16776960});super(r,[h,c]),this.audio=e,this.range=t,this.divisionsInnerAngle=n,this.divisionsOuterAngle=s,this.type="PositionalAudioHelper",this.update()}update(){const e=this.audio,t=this.range,n=this.divisionsInnerAngle,s=this.divisionsOuterAngle,r=l.MathUtils.degToRad(e.panner.coneInnerAngle),i=l.MathUtils.degToRad(e.panner.coneOuterAngle),a=r/2,c=i/2;let h=0,d=0,f,g;const p=this.geometry,_=p.attributes.position;p.clearGroups();function y(x,m,M,v){const C=(m-x)/M;for(_.setXYZ(h,0,0,0),d++,f=x;f<m;f+=C)g=h+d,_.setXYZ(g,Math.sin(f)*t,0,Math.cos(f)*t),_.setXYZ(g+1,Math.sin(Math.min(f+C,m))*t,0,Math.cos(Math.min(f+C,m))*t),_.setXYZ(g+2,0,0,0),d+=3;p.addGroup(h,d,v),h+=d,d=0}y(-c,-a,s,0),y(-a,a,n,1),y(a,c,s,0),_.needsUpdate=!0,r===i&&(this.material[0].visible=!1)}dispose(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()}}const jc=["args"],Ec=u.defineComponent({__name:"PositionalAudio",props:{ready:{type:Boolean,default:!1},url:{},distance:{default:2},helper:{type:Boolean,default:!1},loop:{type:Boolean,default:!1},autoplay:{type:Boolean,default:!1},innerAngle:{default:360},outerAngle:{default:360},outerGain:{default:0}},emits:["isPlaying"],async setup(o,{expose:e,emit:t}){let n,s;const r=o,i=t,{ready:a,url:c,distance:h,helper:d,loop:f,autoplay:g,innerAngle:p,outerAngle:_,outerGain:y}=u.toRefs(r),{camera:x}=ee.useTresContext(),m=u.shallowRef(null),M=u.shallowRef(null),v=u.shallowRef(null),C=u.shallowReactive(new l.AudioListener),O=()=>{var V,R,Y;(V=m==null?void 0:m.value)!=null&&V.isPlaying||((R=m==null?void 0:m.value)==null||R.play(),i("isPlaying",(Y=m==null?void 0:m.value)==null?void 0:Y.isPlaying))},S=()=>{var V,R;(V=m==null?void 0:m.value)!=null&&V.isPlaying&&(m.value.pause(),i("isPlaying",(R=m==null?void 0:m.value)==null?void 0:R.isPlaying))},A=()=>{var V;m.value&&(m.value.stop(),i("isPlaying",(V=m==null?void 0:m.value)==null?void 0:V.isPlaying))},b=()=>{if(!(m!=null&&m.value))return;A();const V=m.value;V.source&&V.disconnect()},P=()=>{var V,R;!(m!=null&&m.value)||!(M!=null&&M.value)||((V=M==null?void 0:M.value)==null||V.dispose(),(R=m==null?void 0:m.value)==null||R.remove(M==null?void 0:M.value))},w=()=>{var V;if(m.value&&(m.value.setBuffer(v.value),m.value.setRefDistance(h.value),m.value.setLoop(f.value),m.value.setDirectionalCone(p.value,_.value,y.value),(V=M==null?void 0:M.value)==null||V.update(),M!=null&&M.value)){const R=M.value.material[0];!R.visible&&_.value!==p.value&&(R.visible=!0)}},D=()=>{var W,$;w();const V=(W=m.value)==null?void 0:W.parent,R=new l.Box3().setFromObject(V),Y=(R.max.z-R.min.z)*2;M.value=new Gc(m.value,Y,32,16),($=m==null?void 0:m.value)==null||$.add(M.value),M.value.update()},L=()=>{var V;(V=x==null?void 0:x.value)==null||V.remove(C),b(),P()};return e({root:m,play:O,stop:A,pause:S,dispose:L}),v.value=([n,s]=u.withAsyncContext(()=>ee.useLoader(l.AudioLoader,c.value)),n=await n,s(),n),u.watch(m,()=>{m!=null&&m.value&&(d.value&&D(),a.value&&g&&O())}),u.watch(d,()=>{d.value?D():P()}),u.watch(a,()=>{a.value&&w(),g.value&&a.value&&O(),!g.value&&a.value&&A()}),u.watch([h,f,v,p,_,y,g],()=>{w()}),u.onMounted(()=>{var V;(V=x==null?void 0:x.value)==null||V.add(C)}),u.onBeforeUnmount(()=>{L()}),(V,R)=>(u.openBlock(),u.createElementBlock("TresPositionalAudio",u.mergeProps({ref_key:"positionalAudioRef",ref:m,args:[u.unref(C)]},V.$attrs),null,16,jc))}}),Dn={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"},Yc="https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/";async function ni(o,e){const{scene:t,invalidate:n}=ee.useTresContext(),{preset:s,blur:r,files:i=u.ref([]),path:a=u.ref(""),background:c}=u.toRefs(o);u.watch(o,()=>{n()});const h=u.ref(null),d=u.computed(()=>Array.isArray(i.value)),f=u.computed(()=>d.value?l.CubeTextureLoader:Nr);return u.watch([i,a],async([g,p])=>{if(g&&g.length>0&&!(s!=null&&s.value)){try{h.value=await ee.useLoader(f.value,d.value?[...u.unref(g)]:u.unref(g),_=>{p&&_.setPath(u.unref(p))})}catch(_){throw new Error(`Failed to load environment map: ${_}`)}h.value&&(h.value.mapping=d.value?l.CubeReflectionMapping:l.EquirectangularReflectionMapping)}},{immediate:!0}),u.watch(h,g=>{t.value&&g&&(t.value.environment=g)},{immediate:!0}),u.watch([c,h],([g,p])=>{if(t.value){const _=e!=null&&e.value?e.value.texture:p;_&&(t.value.background=g?_:null)}},{immediate:!0}),u.watch(()=>r==null?void 0:r.value,g=>{t.value&&g&&(t.value.backgroundBlurriness=g)},{immediate:!0}),u.watch(()=>s==null?void 0:s.value,async g=>{if(g&&g in Dn){const p=Yc,_=Dn[g];try{h.value=await ee.useLoader(Nr,_,y=>{p&&y.setPath(p)})}catch(y){throw new Error(`Failed to load environment map: ${y}`)}h.value&&h.value&&(h.value.mapping=l.EquirectangularReflectionMapping),n()}else if(g&&!(g in Dn))throw new Error(`Preset must be one of: ${Object.keys(Dn).join(", ")}`)},{immediate:!0}),h}let bt=null;function Wc(o,e){return t=>{e&&e(t),o.draco&&(bt||(bt=new Ml),bt.setDecoderPath(o.decoderPath||"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),t.setDRACOLoader&&t.setDRACOLoader(bt))}}async function si(o,e={draco:!1},t){const n=await ee.useLoader(pa,o,Wc(e,t));return bt==null||bt.dispose(),bt=null,n}const Xc=["object"],Zc=u.defineComponent({__name:"component",props:{path:{},draco:{type:Boolean,default:!1},decoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.4.1/"},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1}},async setup(o,{expose:e}){let t,n;const s=o,r=u.ref();e({instance:r});const{scene:i}=([t,n]=u.withAsyncContext(()=>si(s.path,{draco:s.draco,decoderPath:s.decoderPath})),t=await t,n(),t);return(s.castShadow||s.receiveShadow)&&i.traverse(a=>{a.isMesh&&(a.castShadow=s.castShadow,a.receiveShadow=s.receiveShadow)}),(a,c)=>(u.openBlock(),u.createElementBlock("primitive",u.mergeProps({ref_key:"modelRef",ref:r,object:u.unref(i)},a.$attrs),null,16,Xc))}});async function ri(o){return await ee.useLoader(il,o)}const Kc=["object"],qc=u.defineComponent({__name:"component",props:{path:{},castShadow:{type:Boolean,default:!1},receiveShadow:{type:Boolean,default:!1}},async setup(o,{expose:e}){let t,n;const s=o,r=u.ref();e({instance:r});const i=([t,n]=u.withAsyncContext(()=>ri(s.path)),t=await t,n(),t);return(s.castShadow||s.receiveShadow)&&i.traverse(a=>{a.isMesh&&(a.castShadow=s.castShadow,a.receiveShadow=s.receiveShadow)}),(a,c)=>(u.openBlock(),u.createElementBlock("primitive",u.mergeProps({ref_key:"modelRef",ref:r,object:u.unref(i)},a.$attrs),null,16,Kc))}}),Qc=["geometry","render-order"],Jc=u.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:s,skipFills:r,fillMaterial:i,strokeMaterial:a,fillMeshProps:c,strokeMeshProps:h,depth:d}=u.toRefs(t),f=u.shallowRef(),g=u.shallowRef([]),p=u.shallowRef([]);e({instance:f}),u.watchEffect(async()=>_(n.value).then(m=>p.value=m.paths)),u.watch([r,s,i,a,p],x);async function _(m){const M=m.startsWith("<svg")?encodeURI(`data:image/svg+xml;utf8,${m}`):m;return ee.useLoader(nn,M)}u.onUnmounted(y);function y(){g.value.forEach(m=>m.geometry.dispose())}function x(){var O,S,A;y();const m=[],[M,v]=(()=>{const b={flat:!1,renderOrder:!1,offsetZ:!0},P={flat:0,renderOrder:0,offsetZ:.025},w=d.value;return typeof w=="number"?[!0,w]:[b[w],P[w]]})();let C=0;for(const b of p.value){const P=((O=b.userData)==null?void 0:O.style)??{},w=Object.assign({color:P.fill,opacity:P.fillOpacity,transparent:!0,side:l.DoubleSide,depthWrite:M},t.fillMaterial);if(!r.value&&P.fill!==void 0&&P.fill!=="none")for(const D of nn.createShapes(b)){const L=new l.ShapeGeometry(D);L.scale(1,-1,1),v&&L.translate(0,0,C++*v),m.push({geometry:L,material:w,isStroke:!1})}if(!s.value&&P.stroke!==void 0&&P.stroke!=="none"){const D=Object.assign({color:(S=b.userData)==null?void 0:S.style.stroke,opacity:(A=b.userData)==null?void 0:A.style.strokeOpacity,transparent:!0,side:l.DoubleSide,depthWrite:M},t.strokeMaterial);for(const L of b.subPaths){const V=L.getPoints().map(Y=>new l.Vector2(Y.x,-Y.y)),R=nn.pointsToStroke(V,P||"none");v&&R.translate(0,0,C++*v),m.push({geometry:R,material:D,isStroke:!0})}}}g.value=m}return(m,M)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"svgRef",ref:f},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(g.value,({geometry:v,material:C,isStroke:O},S)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({key:`${S}`,ref_for:!0},O?u.unref(h):u.unref(c),{geometry:v,"render-order":u.unref(d)==="renderOrder"?S:0}),[u.createElementVNode("TresMeshBasicMaterial",u.mergeProps({ref_for:!0},C),null,16)],16,Qc))),128))],512))}}),ii="[TresJS - Cientos ▲ ■ ♥] ";function Hc(o,e){console.error(`${ii} ${o}`,e||"")}function $c(o){console.warn(`${ii} ${o}`)}function eu(o,e){}function oi(){return{logError:Hc,logWarning:$c,logMessage:eu}}let vs=0;function tu(){const o=u.ref(!1),e=u.ref(0),t=u.ref([]),{logError:n}=oi();return new Promise(s=>{l.DefaultLoadingManager.onStart=()=>{o.value=!1},l.DefaultLoadingManager.onLoad=()=>{o.value=!0},l.DefaultLoadingManager.onProgress=(r,i,a)=>{i===a&&(vs=a,o.value=!0,t.value.push(r)),e.value=Math.round((i-vs)/(a-vs)*100||100)},l.DefaultLoadingManager.onError=r=>{n("Error loading assets",new Error(r)),o.value=!0},s({items:t,hasFinishLoading:o,progress:e})})}async function nu(o,e){const{logError:t}=oi();if(!o)return t("Error no path provided");const{unsuspend:n,start:s,crossOrigin:r,muted:i,loop:a,...c}={unsuspend:"loadedmetadata",crossOrigin:"Anonymous",muted:!0,loop:!0,start:!0,playsInline:!0,...e};function h(){return new Promise((d,f)=>{const g=Object.assign(document.createElement("video"),{src:typeof o=="string"&&o||void 0,crossOrigin:r,loop:a,muted:i,autoplay:!0,...c}),p=new l.VideoTexture(g);return g.addEventListener(n,()=>d(p)),g.addEventListener("error",()=>f(new Error("Error loading video"))),p})}try{const d=await h();return s&&d.image&&d.image.play(),d}catch{t("Error loading resource")}}const su=["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"],ru=u.defineComponent({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[0,0,0]},enableDamping:{type:Boolean,default:!0},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:Number.POSITIVE_INFINITY},minZoom:{default:0},maxZoom:{default:Number.POSITIVE_INFINITY},touches:{default:()=>({ONE:l.TOUCH.ROTATE,TWO:l.TOUCH.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1}},emits:["change","start","end"],setup(o,{expose:e,emit:t}){const n=o,s=t,{makeDefault:r,autoRotate:i,autoRotateSpeed:a,enableDamping:c,dampingFactor:h,enablePan:d,keyPanSpeed:f,maxAzimuthAngle:g,minAzimuthAngle:p,maxPolarAngle:_,minPolarAngle:y,minDistance:x,maxDistance:m,minZoom:M,maxZoom:v,enableZoom:C,zoomSpeed:O,enableRotate:S,touches:A,rotateSpeed:b,target:P}=u.toRefs(n),{camera:w,renderer:D,extend:L,controls:V,invalidate:R}=ee.useTresContext(),Y=u.ref(null);L({OrbitControls:xr}),u.watch(Y,q=>{W(),q&&r.value?V.value=q:V.value=null});function W(){Ce(Y.value,"change",()=>{s("change",Y.value),R()}),Ce(Y.value,"start",()=>s("start",Y.value)),Ce(Y.value,"end",()=>s("end",Y.value))}const{onBeforeRender:$}=ee.useLoop();return $(({invalidate:q})=>{Y.value&&(c.value||i.value)&&(Y.value.update(),i.value&&q())}),u.onUnmounted(()=>{Y.value&&Y.value.dispose()}),e({instance:Y}),(q,ne)=>(q.camera||u.unref(w))&&(q.domElement||u.unref(D))?(u.openBlock(),u.createElementBlock("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:Y,target:u.unref(P),"auto-rotate":u.unref(i),"auto-rotate-speed":u.unref(a),"enable-damping":u.unref(c),"damping-factor":u.unref(h),"enable-pan":u.unref(d),"key-pan-speed":u.unref(f),keys:q.keys,"max-azimuth-angle":u.unref(g),"min-azimuth-angle":u.unref(p),"max-polar-angle":u.unref(_),"min-polar-angle":u.unref(y),"min-distance":u.unref(x),"max-distance":u.unref(m),"min-zoom":u.unref(M),"max-zoom":u.unref(v),touches:u.unref(A),"enable-zoom":u.unref(C),"zoom-speed":u.unref(O),"enable-rotate":u.unref(S),"rotate-speed":u.unref(b),args:[q.camera||u.unref(w),q.domElement||u.unref(D).domElement]},null,8,su)):u.createCommentVNode("",!0)}}),iu=u.defineComponent({__name:"KeyboardControls",props:{makeDefault:{type:Boolean,default:!0},camera:{},domElement:{},moveSpeed:{default:.2},selector:{}},emits:["isLock","change"],setup(o,{expose:e,emit:t}){const n=o,s=t,{moveSpeed:r}=u.toRefs(n),{camera:i,controls:a,renderer:c,invalidate:h}=ee.useTresContext();u.watch(n,()=>{h()});const d=u.ref(0),f=u.ref(0),{w:g,s:p,a:_,d:y,Up:x,Down:m,Left:M,Right:v}=Kl();u.watchEffect(()=>{_.value||M.value?d.value=-r.value:y.value||v.value?d.value=r.value:d.value=0,g.value||x.value?f.value=r.value:p.value||m.value?f.value=-r.value:f.value=0}),e({instance:a});const C=D=>s("isLock",D),O=D=>s("change",D),S=new l.Vector3,A=new l.Vector3,b=new l.Quaternion,P=(D,L)=>{var Y;if(!((Y=i.value)!=null&&Y.position)&&!S)return;const V=i.value,R=D*.001;V==null||V.translateZ(-L),b.set(A.x*R,A.y*R,A.z*R,1).normalize(),V==null||V.quaternion.multiply(b),(d.value||f.value)&&s("change",a.value)},{onBeforeRender:w}=ee.useLoop();return w(({delta:D,invalidate:L})=>{var V;a.value instanceof gr&&((V=a.value)!=null&&V.isLocked)&&(P(D,f.value),a.value.moveRight(d.value),L())}),(D,L)=>(u.openBlock(),u.createBlock(u.unref(ai),{selector:D.selector,"make-default":D.makeDefault,camera:D.camera||u.unref(i),"dom-element":D.domElement||u.unref(c).domElement,onIsLock:C,onChange:O},null,8,["selector","make-default","camera","dom-element"]))}}),ou=["object","args","mode","enabled","axis","translation-snap","rotation-snap","scale-snap","space","size","show-x","show-y","show-z"],au=u.defineComponent({__name:"TransformControls",props:{object:{},camera:{},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,{expose:e,emit:t}){const n=o,s=t,{object:r,mode:i,enabled:a,axis:c,translationSnap:h,rotationSnap:d,scaleSnap:f,space:g,size:p,showX:_,showY:y,showZ:x}=u.toRefs(n),m=u.shallowRef(null),{controls:M,camera:v,renderer:C,extend:O,invalidate:S}=ee.useTresContext();u.watch([r,i,a,c,h,d,f,g,p,_,y,x],()=>{S()}),O({TransformControls:ta});const A=()=>{S(),s("change")},b=V=>{M.value&&(M.value.enabled=!V.value),S(),s("dragging",V.value)},P=()=>{S(),s("mouseDown")},w=()=>{S(),s("mouseDown")},D=()=>{S(),s("objectChange")};function L(){Ce(m.value,"change",A),Ce(m.value,"dragging-changed",b),Ce(m.value,"mouseDown",P),Ce(m.value,"mouseUp",w),Ce(m.value,"objectChange",D)}return u.watch(m,V=>{V&&L()}),u.onUnmounted(()=>{m.value&&m.value.dispose()}),e({instance:m}),(V,R)=>{var Y;return(V.camera||u.unref(v))&&u.unref(C)?(u.openBlock(),u.createElementBlock("TresTransformControls",{ref_key:"controlsRef",ref:m,key:(Y=V.camera||u.unref(v))==null?void 0:Y.uuid,object:u.unref(r),args:[V.camera||u.unref(v),u.unref(C).domElement],mode:u.unref(i),enabled:u.unref(a),axis:u.unref(c),"translation-snap":u.unref(h),"rotation-snap":u.unref(d),"scale-snap":u.unref(f),space:u.unref(g),size:u.unref(p),"show-x":u.unref(_),"show-y":u.unref(y),"show-z":u.unref(x),visible:!0},null,8,ou)):u.createCommentVNode("",!0)}}}),lu=["args"],ai=u.defineComponent({__name:"PointerLockControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},selector:{}},emits:["isLock","change"],setup(o,{expose:e,emit:t}){const n=o,s=t,{camera:r,renderer:i,extend:a,controls:c,invalidate:h}=ee.useTresContext();u.watch(n,()=>{h()});const d=u.ref(null);let f;a({PointerLockControls:gr});const g=p=>{s("isLock",p)};return u.watch(d,p=>{p&&n.makeDefault?c.value=p:c.value=null,f=document.getElementById(n.selector||"")||i.value.domElement,Ce(c.value,"change",()=>{s("change",c.value),h()}),Ce(f,"click",()=>{var y,x,m;(y=d.value)==null||y.lock(),(x=d.value)==null||x.addEventListener("lock",()=>g(!0)),(m=d.value)==null||m.addEventListener("unlock",()=>g(!1)),h()})}),u.onUnmounted(()=>{var p,_;(p=c.value)==null||p.removeEventListener("lock",()=>g(!0)),(_=c.value)==null||_.removeEventListener("unlock",()=>g(!1)),d.value&&d.value.dispose()}),e({instance:c}),(p,_)=>(p.camera||u.unref(r))&&(p.domElement||u.unref(i))?(u.openBlock(),u.createElementBlock("TresPointerLockControls",{key:0,ref_key:"controlsRef",ref:d,args:[p.camera||u.unref(r),p.domElement||u.unref(i).domElement]},null,8,lu)):u.createCommentVNode("",!0)}}),cu=["args","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","enable-zoom","zoom-speed","enable-rotate","rotate-speed"],uu=u.defineComponent({__name:"MapControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{},enableDamping:{type:Boolean,default:!0},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:Number.POSITIVE_INFINITY},minZoom:{default:0},maxZoom:{default:Number.POSITIVE_INFINITY},touches:{},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,{autoRotate:s,autoRotateSpeed:r,enableDamping:i,dampingFactor:a,enablePan:c,keyPanSpeed:h,maxAzimuthAngle:d,minAzimuthAngle:f,maxPolarAngle:g,minPolarAngle:p,minDistance:_,maxDistance:y,minZoom:x,maxZoom:m,enableZoom:M,zoomSpeed:v,enableRotate:C,rotateSpeed:O}=u.toRefs(n),{camera:S,renderer:A,extend:b,controls:P,invalidate:w}=ee.useTresContext();u.watch(n,()=>{w()});const D=u.ref(null);b({MapControls:fa}),u.watch(P,V=>{V&&n.makeDefault?P.value=V:P.value=null});const{onBeforeRender:L}=ee.useLoop();return L(({invalidate:V})=>{D.value&&(i.value||s.value)&&(D.value.update(),V())}),u.onUnmounted(()=>{D.value&&D.value.dispose()}),e({instance:D}),(V,R)=>(V.camera||u.unref(S))&&(V.domElement||u.unref(A))?(u.openBlock(),u.createElementBlock("TresMapControls",{key:0,ref_key:"controlsRef",ref:D,args:[V.camera||u.unref(S),V.domElement||u.unref(A).domElement],"auto-rotate":u.unref(s),"auto-rotate-speed":u.unref(r),"enable-damping":u.unref(i),"damping-factor":u.unref(a),"enable-pan":u.unref(c),"key-pan-speed":u.unref(h),keys:V.keys,"max-azimuth-angle":u.unref(d),"min-azimuth-angle":u.unref(f),"max-polar-angle":u.unref(g),"min-polar-angle":u.unref(p),"min-distance":u.unref(_),"max-distance":u.unref(y),"min-zoom":u.unref(x),"max-zoom":u.unref(m),"enable-zoom":u.unref(M),"zoom-speed":u.unref(v),"enable-rotate":u.unref(C),"rotate-speed":u.unref(O)},null,8,cu)):u.createCommentVNode("",!0)}}),hu=u.defineComponent({__name:"ScrollControls",props:{pages:{default:4},distance:{default:4},smoothScroll:{default:.1},horizontal:{type:Boolean,default:!1},htmlScroll:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(o,{expose:e,emit:t}){const n=o,s=t,{logWarning:r}=ee.useLogger();n.smoothScroll<0&&r("SmoothControl must be greater than zero"),n.pages<0&&r("Pages must be greater than zero");const{camera:i,controls:a,renderer:c,invalidate:h}=ee.useTresContext();u.watch(n,()=>{h()});const d=u.shallowRef(),f=document.createElement("div"),{y:g}=Jl(),{x:p,y:_,isScrolling:y}=Xl(f),{height:x,width:m}=Gr();let M=0;const v=u.ref(!1),C=u.ref(0),O=u.ref(0),S=u.ref(0),A=n.horizontal?"x":"y",b=u.watch(i,w=>{if(v.value){b();return}M=n.horizontal?(w==null?void 0:w.position.x)||0:(w==null?void 0:w.position.y)||0,v.value=!0},{immediate:!0});u.watch(y,w=>{a.value&&(a.value.enabled=!w)},{immediate:!0}),u.watch(g,w=>{!y.value&&!n.htmlScroll||(O.value=w/x.value/(S.value/x.value-1),C.value=-1*O.value,s("update:modelValue",O.value))}),u.watch(_,w=>{O.value=w/x.value/(S.value/x.value),C.value=-1*O.value,s("update:modelValue",O.value)}),u.watch(p,w=>{O.value=w/m.value/(S.value/m.value-1),C.value=+O.value,s("update:modelValue",O.value)}),u.watch(c,w=>{var L,V;const D=w==null?void 0:w.domElement;if(n.htmlScroll&&(w!=null&&w.domElement))D!=null&&D.style.width&&(D!=null&&D.style.position)&&(D!=null&&D.style.top)&&(D!=null&&D.style.left)&&(D.style.width="100%",D.style.position="fixed",D.style.zIndex=" -99999",D.style.top="0",D.style.left="0"),S.value=document.body.scrollHeight;else{const R=document.createElement("div"),Y=document.createElement("div");f.style[n.horizontal?"overflowX":"overflowY"]="auto",f.style[n.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"),R.style.position="sticky",R.style.top="0px",R.style.left="0px",R.style.width="100%",R.style.height="100%",R.style.overflow="hidden",f.appendChild(R),Y.style.height=n.horizontal?"100%":`${x.value*n.pages}px`,Y.style.width=n.horizontal?`${m.value*n.pages}px`:"100vw",Y.style.pointerEvents="none",D.style.position="fixed",D.style.zIndex="0",D!=null&&D.style.width&&(D.style.width="100%"),f.appendChild(Y),w!=null&&w.domElement.parentNode&&(w.domElement.parentNode.style.position="relative"),(V=(L=w==null?void 0:w.domElement)==null?void 0:L.parentNode)==null||V.appendChild(f),S.value=n.horizontal?m.value*n.pages:x.value*n.pages}},{immediate:!0});const{onBeforeRender:P}=ee.useLoop();return P(({invalidate:w})=>{var D;if((D=i.value)!=null&&D.position){const L=(C.value*n.distance-i.value.position[A]+M)*n.smoothScroll;i.value.position[A]+=L,d.value.children.length>0&&(d.value.position[A]+=L),w()}}),e({instance:d}),(w,D)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:d},[u.renderSlot(w.$slots,"default")],512))}});/*!
|
|
509
509
|
* camera-controls
|
|
510
510
|
* https://github.com/yomotsu/camera-controls
|
|
511
511
|
* (c) 2017 @yomotsu
|
|
512
512
|
* Released under the MIT License.
|
|
513
|
-
*/const De={LEFT:1,RIGHT:2,MIDDLE:4},H=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}),Et={NONE:0,IN:1,OUT:-1};function kt(o){return o.isPerspectiveCamera}function Mt(o){return o.isOrthographicCamera}const Yt=Math.PI*2,li=Math.PI/2,ci=1e-5,on=Math.PI/180;function tt(o,e,t){return Math.max(e,Math.min(t,o))}function Pe(o,e=ci){return Math.abs(o)<e}function Se(o,e,t=ci){return Pe(o-e,t)}function ui(o,e){return Math.round(o/e)*e}function an(o){return isFinite(o)?o:o<0?-Number.MAX_VALUE:Number.MAX_VALUE}function ln(o){return Math.abs(o)<Number.MAX_VALUE?o:o*(1/0)}function Ln(o,e,t,n,s=1/0,r){n=Math.max(1e-4,n);const i=2/n,a=i*r,c=1/(1+a+.48*a*a+.235*a*a*a);let h=o-e;const d=e,f=s*n;h=tt(h,-f,f),e=o-h;const y=(t.value+i*h)*r;t.value=(t.value-i*y)*c;let p=e+(h+y)*c;return d-o>0==p>d&&(p=d,t.value=(p-d)/r),p}function hi(o,e,t,n,s=1/0,r,i){n=Math.max(1e-4,n);const a=2/n,c=a*r,h=1/(1+c+.48*c*c+.235*c*c*c);let d=e.x,f=e.y,y=e.z,p=o.x-d,_=o.y-f,g=o.z-y;const x=d,m=f,M=y,v=s*n,C=v*v,O=p*p+_*_+g*g;if(O>C){const Y=Math.sqrt(O);p=p/Y*v,_=_/Y*v,g=g/Y*v}d=o.x-p,f=o.y-_,y=o.z-g;const S=(t.x+a*p)*r,A=(t.y+a*_)*r,b=(t.z+a*g)*r;t.x=(t.x-a*S)*h,t.y=(t.y-a*A)*h,t.z=(t.z-a*b)*h,i.x=d+(p+S)*h,i.y=f+(_+A)*h,i.z=y+(g+b)*h;const P=x-o.x,w=m-o.y,D=M-o.z,L=i.x-x,V=i.y-m,R=i.z-M;return P*L+w*V+D*R>0&&(i.x=x,i.y=m,i.z=M,t.x=(i.x-x)/r,t.y=(i.y-m)/r,t.z=(i.z-M)/r),i}function ws(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 bs(o,e){return Mt(o)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class cu{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 r=s.indexOf(t);r!==-1&&s.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 s=n.slice(0);for(let r=0,i=s.length;r<i;r++)s[r].call(this,e)}}}var Ms;const uu="2.9.0",Bn=1/8,hu=/Mac/.test((Ms=globalThis==null?void 0:globalThis.navigator)===null||Ms===void 0?void 0:Ms.platform);let de,fi,kn,Ss,Ee,ye,be,Wt,cn,rt,it,Ft,di,pi,Je,un,Xt,mi,As,gi,Cs,Ps,Fn;class Ue extends cu{static install(e){de=e.THREE,fi=Object.freeze(new de.Vector3(0,0,0)),kn=Object.freeze(new de.Vector3(0,1,0)),Ss=Object.freeze(new de.Vector3(0,0,1)),Ee=new de.Vector2,ye=new de.Vector3,be=new de.Vector3,Wt=new de.Vector3,cn=new de.Vector3,rt=new de.Vector3,it=new de.Vector3,Ft=new de.Vector3,di=new de.Vector3,pi=new de.Vector3,Je=new de.Spherical,un=new de.Spherical,Xt=new de.Box3,mi=new de.Box3,As=new de.Sphere,gi=new de.Quaternion,Cs=new de.Quaternion,Ps=new de.Matrix4,Fn=new de.Raycaster}static get ACTION(){return H}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=H.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=Et.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new de.Vector3,this._focalOffsetVelocity=new de.Vector3,this._zoomVelocity={value:0},this._truckInternal=(m,M,v)=>{let C,O;if(kt(this._camera)){const S=ye.copy(this._camera.position).sub(this._target),A=this._camera.getEffectiveFOV()*on,b=S.length()*Math.tan(A*.5);C=this.truckSpeed*m*b/this._elementRect.height,O=this.truckSpeed*M*b/this._elementRect.height}else if(Mt(this._camera)){const S=this._camera;C=m*(S.right-S.left)/S.zoom/this._elementRect.width,O=M*(S.top-S.bottom)/S.zoom/this._elementRect.height}else return;this.verticalDragToForward?(v?this.setFocalOffset(this._focalOffsetEnd.x+C,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(C,0,!0),this.forward(-O,!0)):v?this.setFocalOffset(this._focalOffsetEnd.x+C,this._focalOffsetEnd.y+O,this._focalOffsetEnd.z,!0):this.truck(C,O,!0)},this._rotateInternal=(m,M)=>{const v=Yt*this.azimuthRotateSpeed*m/this._elementRect.height,C=Yt*this.polarRotateSpeed*M/this._elementRect.height;this.rotate(v,C,!0)},this._dollyInternal=(m,M,v)=>{const C=Math.pow(.95,-m*this.dollySpeed),O=this._sphericalEnd.radius,S=this._sphericalEnd.radius*C,A=tt(S,this.minDistance,this.maxDistance),b=A-S;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(S,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(b,!0),this._dollyToNoClamp(A,!0)):this._dollyToNoClamp(A,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?S:A)-O,this._dollyControlCoord.set(M,v)),this._lastDollyDirection=Math.sign(-m)},this._zoomInternal=(m,M,v)=>{const C=Math.pow(.95,m*this.dollySpeed),O=this._zoom,S=this._zoom*C;this.zoomTo(S,!0),this.dollyToCursor&&(this._changedZoom+=S-O,this._dollyControlCoord.set(M,v))},typeof de>"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 de.Quaternion().setFromUnitVectors(this._camera.up,kn),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=H.NONE,this._target=new de.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new de.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new de.Spherical().setFromVector3(ye.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 de.Vector3,new de.Vector3,new de.Vector3,new de.Vector3],this._updateNearPlaneCorners(),this._boundary=new de.Box3(new de.Vector3(-1/0,-1/0,-1/0),new de.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 de.Vector2,this.mouseButtons={left:H.ROTATE,middle:H.DOLLY,right:H.TRUCK,wheel:kt(this._camera)?H.DOLLY:Mt(this._camera)?H.ZOOM:H.NONE},this.touches={one:H.TOUCH_ROTATE,two:kt(this._camera)?H.TOUCH_DOLLY_TRUCK:Mt(this._camera)?H.TOUCH_ZOOM_TRUCK:H.NONE,three:H.TOUCH_TRUCK};const n=new de.Vector2,s=new de.Vector2,r=new de.Vector2,i=m=>{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(),O=m.clientX/C.width,S=m.clientY/C.height;if(O<this._interactiveArea.left||O>this._interactiveArea.right||S<this._interactiveArea.top||S>this._interactiveArea.bottom)return}const M=m.pointerType!=="mouse"?null:(m.buttons&De.LEFT)===De.LEFT?De.LEFT:(m.buttons&De.MIDDLE)===De.MIDDLE?De.MIDDLE:(m.buttons&De.RIGHT)===De.RIGHT?De.RIGHT:null;if(M!==null){const C=this._findPointerByMouseButton(M);C&&this._disposePointer(C)}if((m.buttons&De.LEFT)===De.LEFT&&this._lockedPointer)return;const v={pointerId:m.pointerId,clientX:m.clientX,clientY:m.clientY,deltaX:0,deltaY:0,mouseButton:M};this._activePointers.push(v),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",c),this._isDragging=!0,y(m)},a=m=>{m.cancelable&&m.preventDefault();const M=m.pointerId,v=this._lockedPointer||this._findPointerById(M);if(v){if(v.clientX=m.clientX,v.clientY=m.clientY,v.deltaX=m.movementX,v.deltaY=m.movementY,this._state=0,m.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&&(m.buttons&De.LEFT)===De.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(m.buttons&De.MIDDLE)===De.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(m.buttons&De.RIGHT)===De.RIGHT&&(this._state=this._state|this.mouseButtons.right);p()}},c=m=>{const M=this._findPointerById(m.pointerId);if(!(M&&M===this._lockedPointer)){if(M&&this._disposePointer(M),m.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=H.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=H.NONE;_()}};let h=-1;const d=m=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===H.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const S=this._domElement.getBoundingClientRect(),A=m.clientX/S.width,b=m.clientY/S.height;if(A<this._interactiveArea.left||A>this._interactiveArea.right||b<this._interactiveArea.top||b>this._interactiveArea.bottom)return}if(m.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===H.ROTATE||this.mouseButtons.wheel===H.TRUCK){const S=performance.now();h-S<1e3&&this._getClientRect(this._elementRect),h=S}const M=hu?-1:-3,v=m.deltaMode===1?m.deltaY/M:m.deltaY/(M*10),C=this.dollyToCursor?(m.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,O=this.dollyToCursor?(m.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case H.ROTATE:{this._rotateInternal(m.deltaX,m.deltaY),this._isUserControllingRotate=!0;break}case H.TRUCK:{this._truckInternal(m.deltaX,m.deltaY,!1),this._isUserControllingTruck=!0;break}case H.OFFSET:{this._truckInternal(m.deltaX,m.deltaY,!0),this._isUserControllingOffset=!0;break}case H.DOLLY:{this._dollyInternal(-v,C,O),this._isUserControllingDolly=!0;break}case H.ZOOM:{this._zoomInternal(-v,C,O),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},f=m=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Ue.ACTION.NONE){const M=m instanceof PointerEvent?m.pointerId:0,v=this._findPointerById(M);v&&this._disposePointer(v),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c);return}m.preventDefault()}},y=m=>{if(!this._enabled)return;if(ws(this._activePointers,Ee),this._getClientRect(this._elementRect),n.copy(Ee),s.copy(Ee),this._activePointers.length>=2){const v=Ee.x-this._activePointers[1].clientX,C=Ee.y-this._activePointers[1].clientY,O=Math.sqrt(v*v+C*C);r.set(0,O);const S=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,A=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(S,A)}if(this._state=0,!m)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in m&&m.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&&(m.buttons&De.LEFT)===De.LEFT&&(this._state=this._state|this.mouseButtons.left),(m.buttons&De.MIDDLE)===De.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(m.buttons&De.RIGHT)===De.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&H.ROTATE)===H.ROTATE||(this._state&H.TOUCH_ROTATE)===H.TOUCH_ROTATE||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.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&H.TRUCK)===H.TRUCK||(this._state&H.TOUCH_TRUCK)===H.TOUCH_TRUCK||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&H.DOLLY)===H.DOLLY||(this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&H.ZOOM)===H.ZOOM||(this._state&H.TOUCH_ZOOM)===H.TOUCH_ZOOM||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&H.OFFSET)===H.OFFSET||(this._state&H.TOUCH_OFFSET)===H.TOUCH_OFFSET||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},p=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,ws(this._activePointers,Ee);const M=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,v=M?-M.deltaX:s.x-Ee.x,C=M?-M.deltaY:s.y-Ee.y;if(s.copy(Ee),((this._state&H.ROTATE)===H.ROTATE||(this._state&H.TOUCH_ROTATE)===H.TOUCH_ROTATE||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(v,C),this._isUserControllingRotate=!0),(this._state&H.DOLLY)===H.DOLLY||(this._state&H.ZOOM)===H.ZOOM){const O=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,S=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,A=this.dollyDragInverted?-1:1;(this._state&H.DOLLY)===H.DOLLY?(this._dollyInternal(A*C*Bn,O,S),this._isUserControllingDolly=!0):(this._zoomInternal(A*C*Bn,O,S),this._isUserControllingZoom=!0)}if((this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_ZOOM)===H.TOUCH_ZOOM||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE){const O=Ee.x-this._activePointers[1].clientX,S=Ee.y-this._activePointers[1].clientY,A=Math.sqrt(O*O+S*S),b=r.y-A;r.set(0,A);const P=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET?(this._dollyInternal(b*Bn,P,w),this._isUserControllingDolly=!0):(this._zoomInternal(b*Bn,P,w),this._isUserControllingZoom=!0)}((this._state&H.TRUCK)===H.TRUCK||(this._state&H.TOUCH_TRUCK)===H.TOUCH_TRUCK||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(v,C,!1),this._isUserControllingTruck=!0),((this._state&H.OFFSET)===H.OFFSET||(this._state&H.TOUCH_OFFSET)===H.TOUCH_OFFSET||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(v,C,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},_=()=>{ws(this._activePointers,Ee),s.copy(Ee),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",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",g),this._domElement.ownerDocument.addEventListener("pointerlockerror",x),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",c),y())},this.unlockPointer=()=>{var m,M,v;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(m=this._domElement)===null||m===void 0||m.ownerDocument.exitPointerLock(),(M=this._domElement)===null||M===void 0||M.ownerDocument.removeEventListener("pointerlockchange",g),(v=this._domElement)===null||v===void 0||v.ownerDocument.removeEventListener("pointerlockerror",x),this.cancel()};const g=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},x=()=>{this.unlockPointer()};this._addAllEventListeners=m=>{this._domElement=m,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",i),this._domElement.addEventListener("pointercancel",c),this._domElement.addEventListener("wheel",d,{passive:!1}),this._domElement.addEventListener("contextmenu",f)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",i),this._domElement.removeEventListener("pointercancel",c),this._domElement.removeEventListener("wheel",d,{passive:!1}),this._domElement.removeEventListener("contextmenu",f),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.ownerDocument.removeEventListener("pointerlockchange",g),this._domElement.ownerDocument.removeEventListener("pointerlockerror",x))},this.cancel=()=>{this._state!==H.NONE&&(this._state=H.NONE,this._activePointers.length=0,_())},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=tt(e.width,0,1),this._interactiveArea.height=tt(e.height,0,1),this._interactiveArea.x=tt(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=tt(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 s=tt(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=tt(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const i=!n||Se(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Se(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(i)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Et.NONE,this._changedDolly=0,this._dollyToNoClamp(tt(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const i=this._collisionTest(),a=Se(i,this._spherical.radius);if(!(n>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,i)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||Se(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(cn).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||Se(this._target.x,this._targetEnd.x,this.restThreshold)&&Se(this._target.y,this._targetEnd.y,this.restThreshold)&&Se(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=tt(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||Se(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(),rt.setFromMatrixColumn(this._camera.matrix,0),it.setFromMatrixColumn(this._camera.matrix,1),rt.multiplyScalar(e),it.multiplyScalar(-t);const s=ye.copy(rt).add(it),r=be.copy(this._targetEnd).add(s);return this.moveTo(r.x,r.y,r.z,n)}forward(e,t=!1){ye.setFromMatrixColumn(this._camera.matrix,0),ye.crossVectors(this._camera.up,ye),ye.multiplyScalar(e);const n=be.copy(this._targetEnd).add(ye);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return ye.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ye.x,this._targetEnd.y+ye.y,this._targetEnd.z+ye.z,t)}moveTo(e,t,n,s=!1){this._isUserControllingTruck=!1;const r=ye.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const i=!s||Se(this._target.x,this._targetEnd.x,this.restThreshold)&&Se(this._target.y,this._targetEnd.y,this.restThreshold)&&Se(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}lookInDirectionOf(e,t,n,s=!1){const a=ye.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(a.x,a.y,a.z,s)}fitToBox(e,t,{cover:n=!1,paddingLeft:s=0,paddingRight:r=0,paddingBottom:i=0,paddingTop:a=0}={}){const c=[],h=e.isBox3?Xt.copy(e):Xt.setFromObject(e);h.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const d=ui(this._sphericalEnd.theta,li),f=ui(this._sphericalEnd.phi,li);c.push(this.rotateTo(d,f,t));const y=ye.setFromSpherical(this._sphericalEnd).normalize(),p=gi.setFromUnitVectors(y,Ss),_=Se(Math.abs(y.y),1);_&&p.multiply(Cs.setFromAxisAngle(kn,d)),p.multiply(this._yAxisUpSpaceInverse);const g=mi.makeEmpty();be.copy(h.min).applyQuaternion(p),g.expandByPoint(be),be.copy(h.min).setX(h.max.x).applyQuaternion(p),g.expandByPoint(be),be.copy(h.min).setY(h.max.y).applyQuaternion(p),g.expandByPoint(be),be.copy(h.max).setZ(h.min.z).applyQuaternion(p),g.expandByPoint(be),be.copy(h.min).setZ(h.max.z).applyQuaternion(p),g.expandByPoint(be),be.copy(h.max).setY(h.min.y).applyQuaternion(p),g.expandByPoint(be),be.copy(h.max).setX(h.min.x).applyQuaternion(p),g.expandByPoint(be),be.copy(h.max).applyQuaternion(p),g.expandByPoint(be),g.min.x-=s,g.min.y-=i,g.max.x+=r,g.max.y+=a,p.setFromUnitVectors(Ss,y),_&&p.premultiply(Cs.invert()),p.premultiply(this._yAxisUpSpace);const x=g.getSize(ye),m=g.getCenter(be).applyQuaternion(p);if(kt(this._camera)){const M=this.getDistanceToFitBox(x.x,x.y,x.z,n);c.push(this.moveTo(m.x,m.y,m.z,t)),c.push(this.dollyTo(M,t)),c.push(this.setFocalOffset(0,0,0,t))}else if(Mt(this._camera)){const M=this._camera,v=M.right-M.left,C=M.top-M.bottom,O=n?Math.max(v/x.x,C/x.y):Math.min(v/x.x,C/x.y);c.push(this.moveTo(m.x,m.y,m.z,t)),c.push(this.zoomTo(O,t)),c.push(this.setFocalOffset(0,0,0,t))}return Promise.all(c)}fitToSphere(e,t){const n=[],r="isObject3D"in e?Ue.createBoundingSphere(e,As):As.copy(e);if(n.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),kt(this._camera)){const i=this.getDistanceToFitSphere(r.radius);n.push(this.dollyTo(i,t))}else if(Mt(this._camera)){const i=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,c=2*r.radius,h=Math.min(i/c,a/c);n.push(this.zoomTo(h,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,s,r,i,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Et.NONE,this._changedDolly=0;const c=be.set(s,r,i),h=ye.set(e,t,n);this._targetEnd.copy(c),this._sphericalEnd.setFromVector3(h.sub(c).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const d=!a||Se(this._target.x,this._targetEnd.x,this.restThreshold)&&Se(this._target.y,this._targetEnd.y,this.restThreshold)&&Se(this._target.z,this._targetEnd.z,this.restThreshold)&&Se(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Se(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Se(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}lerpLookAt(e,t,n,s,r,i,a,c,h,d,f,y,p,_=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Et.NONE,this._changedDolly=0;const g=ye.set(s,r,i),x=be.set(e,t,n);Je.setFromVector3(x.sub(g).applyQuaternion(this._yAxisUpSpace));const m=Wt.set(d,f,y),M=be.set(a,c,h);un.setFromVector3(M.sub(m).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(g.lerp(m,p));const v=un.theta-Je.theta,C=un.phi-Je.phi,O=un.radius-Je.radius;this._sphericalEnd.set(Je.radius+O*p,Je.phi+C*p,Je.theta+v*p),this.normalizeRotations(),this._needsUpdate=!0,_||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const S=!_||Se(this._target.x,this._targetEnd.x,this.restThreshold)&&Se(this._target.y,this._targetEnd.y,this.restThreshold)&&Se(this._target.z,this._targetEnd.z,this.restThreshold)&&Se(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Se(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Se(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 r=this.getPosition(ye),i=this.setLookAt(r.x,r.y,r.z,e,t,n,s);return this._sphericalEnd.phi=tt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),i}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 r=!s||Se(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Se(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Se(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),rt.setFromMatrixColumn(this._camera.matrixWorldInverse,0),it.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Ft.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=ye.set(e,t,n),r=s.distanceTo(this._camera.position),i=s.sub(this._camera.position);rt.multiplyScalar(i.x),it.multiplyScalar(i.y),Ft.multiplyScalar(i.z),ye.copy(rt).add(it).add(Ft),ye.z=ye.z+r,this.dollyTo(r,!1),this.setFocalOffset(-ye.x,ye.y,-ye.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 de.Vector4,typeof e=="number"?this._viewport.set(e,t,n,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,s=!1){if(bs(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,i=this._camera.getEffectiveFOV()*on,a=this._camera.aspect;return((s?r>a:r<a)?t:e/a)*.5/Math.tan(i*.5)+n*.5}getDistanceToFitSphere(e){if(bs(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*on,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 de.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new de.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new de.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new de.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%Yt,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=Yt),this._spherical.theta+=Yt*Math.round((this._sphericalEnd.theta-this._spherical.theta)/Yt)}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!Se(this._camera.up.x,this._cameraUp0.x)||!Se(this._camera.up.y,this._cameraUp0.y)||!Se(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(ye);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,kn),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ye.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(ye);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,r=di.subVectors(this._targetEnd,this._target),i=pi.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 f=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Ln(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,f,1/0,e),this._needsUpdate=!0}if(Pe(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const f=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Ln(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,f,1/0,e),this._needsUpdate=!0}if(Pe(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const f=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Ln(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,f,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 f=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;hi(this._target,this._targetEnd,this._targetVelocity,f,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(Pe(i.x)&&Pe(i.y)&&Pe(i.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const f=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;hi(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,f,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(Pe(a))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const f=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Ln(this._zoom,this._zoomEnd,this._zoomVelocity,f,1/0,e)}if(this.dollyToCursor){if(kt(this._camera)&&this._changedDolly!==0){const f=this._spherical.radius-this._lastDistance,y=this._camera,p=this._getCameraDirection(cn),_=ye.copy(p).cross(y.up).normalize();_.lengthSq()===0&&(_.x=1);const g=be.crossVectors(_,p),x=this._sphericalEnd.radius*Math.tan(y.getEffectiveFOV()*on*.5),M=(this._sphericalEnd.radius-f-this._sphericalEnd.radius)/this._sphericalEnd.radius,v=Wt.copy(this._targetEnd).add(_.multiplyScalar(this._dollyControlCoord.x*x*y.aspect)).add(g.multiplyScalar(this._dollyControlCoord.y*x)),C=ye.copy(this._targetEnd).lerp(v,M),O=this._lastDollyDirection===Et.IN&&this._spherical.radius<=this.minDistance,S=this._lastDollyDirection===Et.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(O||S)){this._sphericalEnd.radius-=f,this._spherical.radius-=f;const b=be.copy(p).multiplyScalar(-f);C.add(b)}this._boundary.clampPoint(C,C);const A=be.subVectors(C,this._targetEnd);this._targetEnd.copy(C),this._target.add(A),this._changedDolly-=f,Pe(this._changedDolly)&&(this._changedDolly=0)}else if(Mt(this._camera)&&this._changedZoom!==0){const f=this._zoom-this._lastZoom,y=this._camera,p=ye.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(y.near+y.far)/(y.near-y.far)).unproject(y),_=be.set(0,0,-1).applyQuaternion(y.quaternion),g=Wt.copy(p).add(_.multiplyScalar(-p.dot(y.up))),m=-(this._zoom-f-this._zoom)/this._zoom,M=this._getCameraDirection(cn),v=this._targetEnd.dot(M),C=ye.copy(this._targetEnd).lerp(g,m),O=C.dot(M),S=M.multiplyScalar(O-v);C.sub(S),this._boundary.clampPoint(C,C);const A=be.subVectors(C,this._targetEnd);this._targetEnd.copy(C),this._target.add(A),this._changedZoom-=f,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 c=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,c),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(),rt.setFromMatrixColumn(this._camera.matrix,0),it.setFromMatrixColumn(this._camera.matrix,1),Ft.setFromMatrixColumn(this._camera.matrix,2),rt.multiplyScalar(this._focalOffset.x),it.multiplyScalar(-this._focalOffset.y),Ft.multiplyScalar(this._focalOffset.z),ye.copy(rt).add(it).add(Ft),this._camera.position.add(ye)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ye.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"}),Pe(t,this.restThreshold)&&Pe(n,this.restThreshold)&&Pe(s,this.restThreshold)&&Pe(r.x,this.restThreshold)&&Pe(r.y,this.restThreshold)&&Pe(r.z,this.restThreshold)&&Pe(i.x,this.restThreshold)&&Pe(i.y,this.restThreshold)&&Pe(i.z,this.restThreshold)&&Pe(a,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:an(this.maxDistance),minZoom:this.minZoom,maxZoom:an(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:an(this.maxPolarAngle),minAzimuthAngle:an(this.minAzimuthAngle),maxAzimuthAngle:an(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:ye.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=ln(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=ln(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=ln(n.maxPolarAngle),this.minAzimuthAngle=ln(n.minAzimuthAngle),this.maxAzimuthAngle=ln(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),Je.setFromVector3(ye.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Je.theta,Je.phi,t),this.dollyTo(Je.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",uu),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 r=be.copy(t).add(e),a=this._boundary.clampPoint(r,Wt).sub(r),c=a.lengthSq();if(c===0)return e.add(t);if(c===s)return e;if(n===0)return e.add(t).add(a);{const h=1+n*c/t.dot(a);return e.add(be.copy(t).multiplyScalar(h)).add(a.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(kt(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*on,s=Math.tan(n*.5)*t,r=s*e.aspect;this._nearPlaneCorners[0].set(-r,-s,0),this._nearPlaneCorners[1].set(r,-s,0),this._nearPlaneCorners[2].set(r,s,0),this._nearPlaneCorners[3].set(-r,s,0)}else if(Mt(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,s=e.right*t,r=e.top*t,i=e.bottom*t;this._nearPlaneCorners[0].set(n,r,0),this._nearPlaneCorners[1].set(s,r,0),this._nearPlaneCorners[2].set(s,i,0),this._nearPlaneCorners[3].set(n,i,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||bs(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(cn);Ps.lookAt(fi,n,this._camera.up);for(let s=0;s<4;s++){const r=be.copy(this._nearPlaneCorners[s]);r.applyMatrix4(Ps);const i=Wt.addVectors(this._target,r);Fn.set(i,n),Fn.far=this._spherical.radius+1;const a=Fn.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 de.Sphere){const n=t,s=n.center;Xt.makeEmpty(),e.traverseVisible(i=>{i.isMesh&&Xt.expandByObject(i)}),Xt.getCenter(s);let r=0;return e.traverseVisible(i=>{if(!i.isMesh)return;const a=i,c=a.geometry.clone();c.applyMatrix4(a.matrixWorld);const d=c.attributes.position;for(let f=0,y=d.count;f<y;f++)ye.fromBufferAttribute(d,f),r=Math.max(r,s.distanceToSquared(ye))}),n.radius=Math.sqrt(r),n}}const yi=o=>!!(o&&o.isPerspectiveCamera),_i=o=>!!(o&&o.isOrthographicCamera),fu=["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","mouse-buttons","touches"],xi=(o,e)=>({left:Ue.ACTION.ROTATE,middle:Ue.ACTION.DOLLY,right:Ue.ACTION.TRUCK,wheel:yi(o)?Ue.ACTION.DOLLY:_i(o)?Ue.ACTION.ZOOM:Ue.ACTION.NONE,...e}),vi=(o,e)=>({one:Ue.ACTION.TOUCH_ROTATE,two:yi(o)?Ue.ACTION.TOUCH_DOLLY_TRUCK:_i(o)?Ue.ACTION.TOUCH_ZOOM_TRUCK:Ue.ACTION.NONE,three:Ue.ACTION.TOUCH_TRUCK,...e}),du=u.defineComponent({__name:"CameraControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},minPolarAngle:{default:0},maxPolarAngle:{default:Math.PI},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},distance:{default:()=>ee.useTresContext().camera.value.position.z},minDistance:{default:Number.EPSILON},maxDistance:{default:Number.POSITIVE_INFINITY},infinityDolly:{type:Boolean,default:!1},minZoom:{default:.01},maxZoom:{default:Number.POSITIVE_INFINITY},smoothTime:{default:.25},draggingSmoothTime:{default:.125},maxSpeed:{default:Number.POSITIVE_INFINITY},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:{default:()=>xi(ee.useTresContext().camera.value)},touches:{default:()=>vi(ee.useTresContext().camera.value)}},emits:["change","start","end"],setup(o,{expose:e,emit:t}){const n=o,s=t,{makeDefault:r,minPolarAngle:i,maxPolarAngle:a,minAzimuthAngle:c,maxAzimuthAngle:h,distance:d,minDistance:f,maxDistance:y,infinityDolly:p,minZoom:_,maxZoom:g,smoothTime:x,draggingSmoothTime:m,maxSpeed:M,azimuthRotateSpeed:v,polarRotateSpeed:C,dollySpeed:O,dollyDragInverted:S,truckSpeed:A,dollyToCursor:b,dragToOffset:P,verticalDragToForward:w,boundaryFriction:D,restThreshold:L,colliderMeshes:V}=u.toRefs(n),R={Box3:l.Box3,MathUtils:{clamp:l.MathUtils.clamp},Matrix4:l.Matrix4,Quaternion:l.Quaternion,Raycaster:l.Raycaster,Sphere:l.Sphere,Spherical:l.Spherical,Vector2:l.Vector2,Vector3:l.Vector3,Vector4:l.Vector4};Ue.install({THREE:R});const{camera:Y,renderer:W,extend:$,controls:q,invalidate:ne}=ee.useTresContext();u.watch(n,()=>{ne()});const te=u.computed(()=>xi(n.camera||Y.value,n.mouseButtons)),ce=u.computed(()=>vi(n.camera||Y.value,n.touches)),le=u.ref(null);$({CameraControls:Ue}),u.watchEffect(()=>{me(),le.value&&r.value?q.value=le.value:q.value=null});function me(){Ce(le.value,"update",()=>{s("change",le.value),ne()}),Ce(le.value,"controlend",()=>s("end",le.value)),Ce(le.value,"controlstart",()=>s("start",le.value))}const{onBeforeRender:B}=ee.useLoop();return B(({delta:z,invalidate:F})=>{var k,G;(k=le.value)!=null&&k.enabled&&((G=le.value)==null||G.update(z),F())}),u.onUnmounted(()=>{le.value&&le.value.disconnect()}),e({instance:le}),(z,F)=>(z.camera||u.unref(Y))&&(z.domElement||u.unref(W))?(u.openBlock(),u.createElementBlock("TresCameraControls",{key:0,ref_key:"controlsRef",ref:le,"min-polar-angle":u.unref(i),"max-polar-angle":u.unref(a),"min-azimuth-angle":u.unref(c),"max-azimuth-angle":u.unref(h),distance:u.unref(d),"min-distance":u.unref(f),"max-distance":u.unref(y),"infinity-dolly":u.unref(p),"min-zoom":u.unref(_),"max-zoom":u.unref(g),"smooth-time":u.unref(x),"dragging-smooth-time":u.unref(m),"max-speed":u.unref(M),"azimuth-rotate-speed":u.unref(v),"polar-rotate-speed":u.unref(C),"dolly-speed":u.unref(O),"dolly-drag-inverted":u.unref(S),"truck-speed":u.unref(A),"dolly-to-cursor":u.unref(b),"drag-to-offset":u.unref(P),"vertical-drag-to-forward":u.unref(w),"boundary-friction":u.unref(D),"rest-threshold":u.unref(L),"collider-meshes":u.unref(V),args:[z.camera||u.unref(Y),z.domElement||u.unref(W).domElement],"mouse-buttons":te.value,touches:ce.value},null,8,fu)):u.createCommentVNode("",!0)}});class pu extends l.MeshStandardMaterial{constructor(t={}){super(t);ue(this,"_time");ue(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=`
|
|
513
|
+
*/const De={LEFT:1,RIGHT:2,MIDDLE:4},H=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}),Et={NONE:0,IN:1,OUT:-1};function kt(o){return o.isPerspectiveCamera}function Mt(o){return o.isOrthographicCamera}const Yt=Math.PI*2,li=Math.PI/2,ci=1e-5,on=Math.PI/180;function tt(o,e,t){return Math.max(e,Math.min(t,o))}function Pe(o,e=ci){return Math.abs(o)<e}function Se(o,e,t=ci){return Pe(o-e,t)}function ui(o,e){return Math.round(o/e)*e}function an(o){return isFinite(o)?o:o<0?-Number.MAX_VALUE:Number.MAX_VALUE}function ln(o){return Math.abs(o)<Number.MAX_VALUE?o:o*(1/0)}function Ln(o,e,t,n,s=1/0,r){n=Math.max(1e-4,n);const i=2/n,a=i*r,c=1/(1+a+.48*a*a+.235*a*a*a);let h=o-e;const d=e,f=s*n;h=tt(h,-f,f),e=o-h;const g=(t.value+i*h)*r;t.value=(t.value-i*g)*c;let p=e+(h+g)*c;return d-o>0==p>d&&(p=d,t.value=(p-d)/r),p}function hi(o,e,t,n,s=1/0,r,i){n=Math.max(1e-4,n);const a=2/n,c=a*r,h=1/(1+c+.48*c*c+.235*c*c*c);let d=e.x,f=e.y,g=e.z,p=o.x-d,_=o.y-f,y=o.z-g;const x=d,m=f,M=g,v=s*n,C=v*v,O=p*p+_*_+y*y;if(O>C){const Y=Math.sqrt(O);p=p/Y*v,_=_/Y*v,y=y/Y*v}d=o.x-p,f=o.y-_,g=o.z-y;const S=(t.x+a*p)*r,A=(t.y+a*_)*r,b=(t.z+a*y)*r;t.x=(t.x-a*S)*h,t.y=(t.y-a*A)*h,t.z=(t.z-a*b)*h,i.x=d+(p+S)*h,i.y=f+(_+A)*h,i.z=g+(y+b)*h;const P=x-o.x,w=m-o.y,D=M-o.z,L=i.x-x,V=i.y-m,R=i.z-M;return P*L+w*V+D*R>0&&(i.x=x,i.y=m,i.z=M,t.x=(i.x-x)/r,t.y=(i.y-m)/r,t.z=(i.z-M)/r),i}function ws(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 bs(o,e){return Mt(o)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class fu{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 r=s.indexOf(t);r!==-1&&s.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 s=n.slice(0);for(let r=0,i=s.length;r<i;r++)s[r].call(this,e)}}}var Ms;const du="2.9.0",Bn=1/8,pu=/Mac/.test((Ms=globalThis==null?void 0:globalThis.navigator)===null||Ms===void 0?void 0:Ms.platform);let de,fi,kn,Ss,Ee,ye,be,Wt,cn,rt,it,Ft,di,pi,Je,un,Xt,mi,As,gi,Cs,Ps,Fn;class Ue extends fu{static install(e){de=e.THREE,fi=Object.freeze(new de.Vector3(0,0,0)),kn=Object.freeze(new de.Vector3(0,1,0)),Ss=Object.freeze(new de.Vector3(0,0,1)),Ee=new de.Vector2,ye=new de.Vector3,be=new de.Vector3,Wt=new de.Vector3,cn=new de.Vector3,rt=new de.Vector3,it=new de.Vector3,Ft=new de.Vector3,di=new de.Vector3,pi=new de.Vector3,Je=new de.Spherical,un=new de.Spherical,Xt=new de.Box3,mi=new de.Box3,As=new de.Sphere,gi=new de.Quaternion,Cs=new de.Quaternion,Ps=new de.Matrix4,Fn=new de.Raycaster}static get ACTION(){return H}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=H.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=Et.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new de.Vector3,this._focalOffsetVelocity=new de.Vector3,this._zoomVelocity={value:0},this._truckInternal=(m,M,v)=>{let C,O;if(kt(this._camera)){const S=ye.copy(this._camera.position).sub(this._target),A=this._camera.getEffectiveFOV()*on,b=S.length()*Math.tan(A*.5);C=this.truckSpeed*m*b/this._elementRect.height,O=this.truckSpeed*M*b/this._elementRect.height}else if(Mt(this._camera)){const S=this._camera;C=m*(S.right-S.left)/S.zoom/this._elementRect.width,O=M*(S.top-S.bottom)/S.zoom/this._elementRect.height}else return;this.verticalDragToForward?(v?this.setFocalOffset(this._focalOffsetEnd.x+C,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(C,0,!0),this.forward(-O,!0)):v?this.setFocalOffset(this._focalOffsetEnd.x+C,this._focalOffsetEnd.y+O,this._focalOffsetEnd.z,!0):this.truck(C,O,!0)},this._rotateInternal=(m,M)=>{const v=Yt*this.azimuthRotateSpeed*m/this._elementRect.height,C=Yt*this.polarRotateSpeed*M/this._elementRect.height;this.rotate(v,C,!0)},this._dollyInternal=(m,M,v)=>{const C=Math.pow(.95,-m*this.dollySpeed),O=this._sphericalEnd.radius,S=this._sphericalEnd.radius*C,A=tt(S,this.minDistance,this.maxDistance),b=A-S;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(S,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(b,!0),this._dollyToNoClamp(A,!0)):this._dollyToNoClamp(A,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?S:A)-O,this._dollyControlCoord.set(M,v)),this._lastDollyDirection=Math.sign(-m)},this._zoomInternal=(m,M,v)=>{const C=Math.pow(.95,m*this.dollySpeed),O=this._zoom,S=this._zoom*C;this.zoomTo(S,!0),this.dollyToCursor&&(this._changedZoom+=S-O,this._dollyControlCoord.set(M,v))},typeof de>"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 de.Quaternion().setFromUnitVectors(this._camera.up,kn),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=H.NONE,this._target=new de.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new de.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new de.Spherical().setFromVector3(ye.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 de.Vector3,new de.Vector3,new de.Vector3,new de.Vector3],this._updateNearPlaneCorners(),this._boundary=new de.Box3(new de.Vector3(-1/0,-1/0,-1/0),new de.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 de.Vector2,this.mouseButtons={left:H.ROTATE,middle:H.DOLLY,right:H.TRUCK,wheel:kt(this._camera)?H.DOLLY:Mt(this._camera)?H.ZOOM:H.NONE},this.touches={one:H.TOUCH_ROTATE,two:kt(this._camera)?H.TOUCH_DOLLY_TRUCK:Mt(this._camera)?H.TOUCH_ZOOM_TRUCK:H.NONE,three:H.TOUCH_TRUCK};const n=new de.Vector2,s=new de.Vector2,r=new de.Vector2,i=m=>{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(),O=m.clientX/C.width,S=m.clientY/C.height;if(O<this._interactiveArea.left||O>this._interactiveArea.right||S<this._interactiveArea.top||S>this._interactiveArea.bottom)return}const M=m.pointerType!=="mouse"?null:(m.buttons&De.LEFT)===De.LEFT?De.LEFT:(m.buttons&De.MIDDLE)===De.MIDDLE?De.MIDDLE:(m.buttons&De.RIGHT)===De.RIGHT?De.RIGHT:null;if(M!==null){const C=this._findPointerByMouseButton(M);C&&this._disposePointer(C)}if((m.buttons&De.LEFT)===De.LEFT&&this._lockedPointer)return;const v={pointerId:m.pointerId,clientX:m.clientX,clientY:m.clientY,deltaX:0,deltaY:0,mouseButton:M};this._activePointers.push(v),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",c),this._isDragging=!0,g(m)},a=m=>{m.cancelable&&m.preventDefault();const M=m.pointerId,v=this._lockedPointer||this._findPointerById(M);if(v){if(v.clientX=m.clientX,v.clientY=m.clientY,v.deltaX=m.movementX,v.deltaY=m.movementY,this._state=0,m.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&&(m.buttons&De.LEFT)===De.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(m.buttons&De.MIDDLE)===De.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(m.buttons&De.RIGHT)===De.RIGHT&&(this._state=this._state|this.mouseButtons.right);p()}},c=m=>{const M=this._findPointerById(m.pointerId);if(!(M&&M===this._lockedPointer)){if(M&&this._disposePointer(M),m.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=H.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=H.NONE;_()}};let h=-1;const d=m=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===H.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const S=this._domElement.getBoundingClientRect(),A=m.clientX/S.width,b=m.clientY/S.height;if(A<this._interactiveArea.left||A>this._interactiveArea.right||b<this._interactiveArea.top||b>this._interactiveArea.bottom)return}if(m.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===H.ROTATE||this.mouseButtons.wheel===H.TRUCK){const S=performance.now();h-S<1e3&&this._getClientRect(this._elementRect),h=S}const M=pu?-1:-3,v=m.deltaMode===1?m.deltaY/M:m.deltaY/(M*10),C=this.dollyToCursor?(m.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,O=this.dollyToCursor?(m.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case H.ROTATE:{this._rotateInternal(m.deltaX,m.deltaY),this._isUserControllingRotate=!0;break}case H.TRUCK:{this._truckInternal(m.deltaX,m.deltaY,!1),this._isUserControllingTruck=!0;break}case H.OFFSET:{this._truckInternal(m.deltaX,m.deltaY,!0),this._isUserControllingOffset=!0;break}case H.DOLLY:{this._dollyInternal(-v,C,O),this._isUserControllingDolly=!0;break}case H.ZOOM:{this._zoomInternal(-v,C,O),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},f=m=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Ue.ACTION.NONE){const M=m instanceof PointerEvent?m.pointerId:0,v=this._findPointerById(M);v&&this._disposePointer(v),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c);return}m.preventDefault()}},g=m=>{if(!this._enabled)return;if(ws(this._activePointers,Ee),this._getClientRect(this._elementRect),n.copy(Ee),s.copy(Ee),this._activePointers.length>=2){const v=Ee.x-this._activePointers[1].clientX,C=Ee.y-this._activePointers[1].clientY,O=Math.sqrt(v*v+C*C);r.set(0,O);const S=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,A=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(S,A)}if(this._state=0,!m)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in m&&m.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&&(m.buttons&De.LEFT)===De.LEFT&&(this._state=this._state|this.mouseButtons.left),(m.buttons&De.MIDDLE)===De.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(m.buttons&De.RIGHT)===De.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&H.ROTATE)===H.ROTATE||(this._state&H.TOUCH_ROTATE)===H.TOUCH_ROTATE||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.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&H.TRUCK)===H.TRUCK||(this._state&H.TOUCH_TRUCK)===H.TOUCH_TRUCK||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&H.DOLLY)===H.DOLLY||(this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&H.ZOOM)===H.ZOOM||(this._state&H.TOUCH_ZOOM)===H.TOUCH_ZOOM||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&H.OFFSET)===H.OFFSET||(this._state&H.TOUCH_OFFSET)===H.TOUCH_OFFSET||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},p=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,ws(this._activePointers,Ee);const M=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,v=M?-M.deltaX:s.x-Ee.x,C=M?-M.deltaY:s.y-Ee.y;if(s.copy(Ee),((this._state&H.ROTATE)===H.ROTATE||(this._state&H.TOUCH_ROTATE)===H.TOUCH_ROTATE||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(v,C),this._isUserControllingRotate=!0),(this._state&H.DOLLY)===H.DOLLY||(this._state&H.ZOOM)===H.ZOOM){const O=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,S=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,A=this.dollyDragInverted?-1:1;(this._state&H.DOLLY)===H.DOLLY?(this._dollyInternal(A*C*Bn,O,S),this._isUserControllingDolly=!0):(this._zoomInternal(A*C*Bn,O,S),this._isUserControllingZoom=!0)}if((this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_ZOOM)===H.TOUCH_ZOOM||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_ZOOM_ROTATE)===H.TOUCH_ZOOM_ROTATE){const O=Ee.x-this._activePointers[1].clientX,S=Ee.y-this._activePointers[1].clientY,A=Math.sqrt(O*O+S*S),b=r.y-A;r.set(0,A);const P=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&H.TOUCH_DOLLY)===H.TOUCH_DOLLY||(this._state&H.TOUCH_DOLLY_ROTATE)===H.TOUCH_DOLLY_ROTATE||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET?(this._dollyInternal(b*Bn,P,w),this._isUserControllingDolly=!0):(this._zoomInternal(b*Bn,P,w),this._isUserControllingZoom=!0)}((this._state&H.TRUCK)===H.TRUCK||(this._state&H.TOUCH_TRUCK)===H.TOUCH_TRUCK||(this._state&H.TOUCH_DOLLY_TRUCK)===H.TOUCH_DOLLY_TRUCK||(this._state&H.TOUCH_ZOOM_TRUCK)===H.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(v,C,!1),this._isUserControllingTruck=!0),((this._state&H.OFFSET)===H.OFFSET||(this._state&H.TOUCH_OFFSET)===H.TOUCH_OFFSET||(this._state&H.TOUCH_DOLLY_OFFSET)===H.TOUCH_DOLLY_OFFSET||(this._state&H.TOUCH_ZOOM_OFFSET)===H.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(v,C,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},_=()=>{ws(this._activePointers,Ee),s.copy(Ee),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",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",y),this._domElement.ownerDocument.addEventListener("pointerlockerror",x),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",c),g())},this.unlockPointer=()=>{var m,M,v;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(m=this._domElement)===null||m===void 0||m.ownerDocument.exitPointerLock(),(M=this._domElement)===null||M===void 0||M.ownerDocument.removeEventListener("pointerlockchange",y),(v=this._domElement)===null||v===void 0||v.ownerDocument.removeEventListener("pointerlockerror",x),this.cancel()};const y=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},x=()=>{this.unlockPointer()};this._addAllEventListeners=m=>{this._domElement=m,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",i),this._domElement.addEventListener("pointercancel",c),this._domElement.addEventListener("wheel",d,{passive:!1}),this._domElement.addEventListener("contextmenu",f)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",i),this._domElement.removeEventListener("pointercancel",c),this._domElement.removeEventListener("wheel",d,{passive:!1}),this._domElement.removeEventListener("contextmenu",f),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.ownerDocument.removeEventListener("pointerlockchange",y),this._domElement.ownerDocument.removeEventListener("pointerlockerror",x))},this.cancel=()=>{this._state!==H.NONE&&(this._state=H.NONE,this._activePointers.length=0,_())},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=tt(e.width,0,1),this._interactiveArea.height=tt(e.height,0,1),this._interactiveArea.x=tt(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=tt(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 s=tt(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=tt(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const i=!n||Se(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Se(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(i)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Et.NONE,this._changedDolly=0,this._dollyToNoClamp(tt(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const i=this._collisionTest(),a=Se(i,this._spherical.radius);if(!(n>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,i)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||Se(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(cn).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||Se(this._target.x,this._targetEnd.x,this.restThreshold)&&Se(this._target.y,this._targetEnd.y,this.restThreshold)&&Se(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=tt(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||Se(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(),rt.setFromMatrixColumn(this._camera.matrix,0),it.setFromMatrixColumn(this._camera.matrix,1),rt.multiplyScalar(e),it.multiplyScalar(-t);const s=ye.copy(rt).add(it),r=be.copy(this._targetEnd).add(s);return this.moveTo(r.x,r.y,r.z,n)}forward(e,t=!1){ye.setFromMatrixColumn(this._camera.matrix,0),ye.crossVectors(this._camera.up,ye),ye.multiplyScalar(e);const n=be.copy(this._targetEnd).add(ye);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return ye.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ye.x,this._targetEnd.y+ye.y,this._targetEnd.z+ye.z,t)}moveTo(e,t,n,s=!1){this._isUserControllingTruck=!1;const r=ye.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const i=!s||Se(this._target.x,this._targetEnd.x,this.restThreshold)&&Se(this._target.y,this._targetEnd.y,this.restThreshold)&&Se(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}lookInDirectionOf(e,t,n,s=!1){const a=ye.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(a.x,a.y,a.z,s)}fitToBox(e,t,{cover:n=!1,paddingLeft:s=0,paddingRight:r=0,paddingBottom:i=0,paddingTop:a=0}={}){const c=[],h=e.isBox3?Xt.copy(e):Xt.setFromObject(e);h.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const d=ui(this._sphericalEnd.theta,li),f=ui(this._sphericalEnd.phi,li);c.push(this.rotateTo(d,f,t));const g=ye.setFromSpherical(this._sphericalEnd).normalize(),p=gi.setFromUnitVectors(g,Ss),_=Se(Math.abs(g.y),1);_&&p.multiply(Cs.setFromAxisAngle(kn,d)),p.multiply(this._yAxisUpSpaceInverse);const y=mi.makeEmpty();be.copy(h.min).applyQuaternion(p),y.expandByPoint(be),be.copy(h.min).setX(h.max.x).applyQuaternion(p),y.expandByPoint(be),be.copy(h.min).setY(h.max.y).applyQuaternion(p),y.expandByPoint(be),be.copy(h.max).setZ(h.min.z).applyQuaternion(p),y.expandByPoint(be),be.copy(h.min).setZ(h.max.z).applyQuaternion(p),y.expandByPoint(be),be.copy(h.max).setY(h.min.y).applyQuaternion(p),y.expandByPoint(be),be.copy(h.max).setX(h.min.x).applyQuaternion(p),y.expandByPoint(be),be.copy(h.max).applyQuaternion(p),y.expandByPoint(be),y.min.x-=s,y.min.y-=i,y.max.x+=r,y.max.y+=a,p.setFromUnitVectors(Ss,g),_&&p.premultiply(Cs.invert()),p.premultiply(this._yAxisUpSpace);const x=y.getSize(ye),m=y.getCenter(be).applyQuaternion(p);if(kt(this._camera)){const M=this.getDistanceToFitBox(x.x,x.y,x.z,n);c.push(this.moveTo(m.x,m.y,m.z,t)),c.push(this.dollyTo(M,t)),c.push(this.setFocalOffset(0,0,0,t))}else if(Mt(this._camera)){const M=this._camera,v=M.right-M.left,C=M.top-M.bottom,O=n?Math.max(v/x.x,C/x.y):Math.min(v/x.x,C/x.y);c.push(this.moveTo(m.x,m.y,m.z,t)),c.push(this.zoomTo(O,t)),c.push(this.setFocalOffset(0,0,0,t))}return Promise.all(c)}fitToSphere(e,t){const n=[],r="isObject3D"in e?Ue.createBoundingSphere(e,As):As.copy(e);if(n.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),kt(this._camera)){const i=this.getDistanceToFitSphere(r.radius);n.push(this.dollyTo(i,t))}else if(Mt(this._camera)){const i=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,c=2*r.radius,h=Math.min(i/c,a/c);n.push(this.zoomTo(h,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,s,r,i,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Et.NONE,this._changedDolly=0;const c=be.set(s,r,i),h=ye.set(e,t,n);this._targetEnd.copy(c),this._sphericalEnd.setFromVector3(h.sub(c).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const d=!a||Se(this._target.x,this._targetEnd.x,this.restThreshold)&&Se(this._target.y,this._targetEnd.y,this.restThreshold)&&Se(this._target.z,this._targetEnd.z,this.restThreshold)&&Se(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Se(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Se(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}lerpLookAt(e,t,n,s,r,i,a,c,h,d,f,g,p,_=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Et.NONE,this._changedDolly=0;const y=ye.set(s,r,i),x=be.set(e,t,n);Je.setFromVector3(x.sub(y).applyQuaternion(this._yAxisUpSpace));const m=Wt.set(d,f,g),M=be.set(a,c,h);un.setFromVector3(M.sub(m).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(y.lerp(m,p));const v=un.theta-Je.theta,C=un.phi-Je.phi,O=un.radius-Je.radius;this._sphericalEnd.set(Je.radius+O*p,Je.phi+C*p,Je.theta+v*p),this.normalizeRotations(),this._needsUpdate=!0,_||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const S=!_||Se(this._target.x,this._targetEnd.x,this.restThreshold)&&Se(this._target.y,this._targetEnd.y,this.restThreshold)&&Se(this._target.z,this._targetEnd.z,this.restThreshold)&&Se(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Se(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Se(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 r=this.getPosition(ye),i=this.setLookAt(r.x,r.y,r.z,e,t,n,s);return this._sphericalEnd.phi=tt(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),i}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 r=!s||Se(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Se(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Se(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),rt.setFromMatrixColumn(this._camera.matrixWorldInverse,0),it.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Ft.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=ye.set(e,t,n),r=s.distanceTo(this._camera.position),i=s.sub(this._camera.position);rt.multiplyScalar(i.x),it.multiplyScalar(i.y),Ft.multiplyScalar(i.z),ye.copy(rt).add(it).add(Ft),ye.z=ye.z+r,this.dollyTo(r,!1),this.setFocalOffset(-ye.x,ye.y,-ye.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 de.Vector4,typeof e=="number"?this._viewport.set(e,t,n,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,s=!1){if(bs(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,i=this._camera.getEffectiveFOV()*on,a=this._camera.aspect;return((s?r>a:r<a)?t:e/a)*.5/Math.tan(i*.5)+n*.5}getDistanceToFitSphere(e){if(bs(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*on,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 de.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new de.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e||new de.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new de.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%Yt,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=Yt),this._spherical.theta+=Yt*Math.round((this._sphericalEnd.theta-this._spherical.theta)/Yt)}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(e=!1){if(!Se(this._camera.up.x,this._cameraUp0.x)||!Se(this._camera.up.y,this._cameraUp0.y)||!Se(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(ye);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,kn),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ye.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(ye);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,r=di.subVectors(this._targetEnd,this._target),i=pi.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 f=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Ln(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,f,1/0,e),this._needsUpdate=!0}if(Pe(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const f=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Ln(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,f,1/0,e),this._needsUpdate=!0}if(Pe(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const f=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Ln(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,f,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 f=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;hi(this._target,this._targetEnd,this._targetVelocity,f,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(Pe(i.x)&&Pe(i.y)&&Pe(i.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const f=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;hi(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,f,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(Pe(a))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const f=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Ln(this._zoom,this._zoomEnd,this._zoomVelocity,f,1/0,e)}if(this.dollyToCursor){if(kt(this._camera)&&this._changedDolly!==0){const f=this._spherical.radius-this._lastDistance,g=this._camera,p=this._getCameraDirection(cn),_=ye.copy(p).cross(g.up).normalize();_.lengthSq()===0&&(_.x=1);const y=be.crossVectors(_,p),x=this._sphericalEnd.radius*Math.tan(g.getEffectiveFOV()*on*.5),M=(this._sphericalEnd.radius-f-this._sphericalEnd.radius)/this._sphericalEnd.radius,v=Wt.copy(this._targetEnd).add(_.multiplyScalar(this._dollyControlCoord.x*x*g.aspect)).add(y.multiplyScalar(this._dollyControlCoord.y*x)),C=ye.copy(this._targetEnd).lerp(v,M),O=this._lastDollyDirection===Et.IN&&this._spherical.radius<=this.minDistance,S=this._lastDollyDirection===Et.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(O||S)){this._sphericalEnd.radius-=f,this._spherical.radius-=f;const b=be.copy(p).multiplyScalar(-f);C.add(b)}this._boundary.clampPoint(C,C);const A=be.subVectors(C,this._targetEnd);this._targetEnd.copy(C),this._target.add(A),this._changedDolly-=f,Pe(this._changedDolly)&&(this._changedDolly=0)}else if(Mt(this._camera)&&this._changedZoom!==0){const f=this._zoom-this._lastZoom,g=this._camera,p=ye.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(g.near+g.far)/(g.near-g.far)).unproject(g),_=be.set(0,0,-1).applyQuaternion(g.quaternion),y=Wt.copy(p).add(_.multiplyScalar(-p.dot(g.up))),m=-(this._zoom-f-this._zoom)/this._zoom,M=this._getCameraDirection(cn),v=this._targetEnd.dot(M),C=ye.copy(this._targetEnd).lerp(y,m),O=C.dot(M),S=M.multiplyScalar(O-v);C.sub(S),this._boundary.clampPoint(C,C);const A=be.subVectors(C,this._targetEnd);this._targetEnd.copy(C),this._target.add(A),this._changedZoom-=f,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 c=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,c),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(),rt.setFromMatrixColumn(this._camera.matrix,0),it.setFromMatrixColumn(this._camera.matrix,1),Ft.setFromMatrixColumn(this._camera.matrix,2),rt.multiplyScalar(this._focalOffset.x),it.multiplyScalar(-this._focalOffset.y),Ft.multiplyScalar(this._focalOffset.z),ye.copy(rt).add(it).add(Ft),this._camera.position.add(ye)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ye.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"}),Pe(t,this.restThreshold)&&Pe(n,this.restThreshold)&&Pe(s,this.restThreshold)&&Pe(r.x,this.restThreshold)&&Pe(r.y,this.restThreshold)&&Pe(r.z,this.restThreshold)&&Pe(i.x,this.restThreshold)&&Pe(i.y,this.restThreshold)&&Pe(i.z,this.restThreshold)&&Pe(a,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:an(this.maxDistance),minZoom:this.minZoom,maxZoom:an(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:an(this.maxPolarAngle),minAzimuthAngle:an(this.minAzimuthAngle),maxAzimuthAngle:an(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:ye.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=ln(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=ln(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=ln(n.maxPolarAngle),this.minAzimuthAngle=ln(n.minAzimuthAngle),this.maxAzimuthAngle=ln(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),Je.setFromVector3(ye.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Je.theta,Je.phi,t),this.dollyTo(Je.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",du),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 r=be.copy(t).add(e),a=this._boundary.clampPoint(r,Wt).sub(r),c=a.lengthSq();if(c===0)return e.add(t);if(c===s)return e;if(n===0)return e.add(t).add(a);{const h=1+n*c/t.dot(a);return e.add(be.copy(t).multiplyScalar(h)).add(a.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(kt(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*on,s=Math.tan(n*.5)*t,r=s*e.aspect;this._nearPlaneCorners[0].set(-r,-s,0),this._nearPlaneCorners[1].set(r,-s,0),this._nearPlaneCorners[2].set(r,s,0),this._nearPlaneCorners[3].set(-r,s,0)}else if(Mt(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,s=e.right*t,r=e.top*t,i=e.bottom*t;this._nearPlaneCorners[0].set(n,r,0),this._nearPlaneCorners[1].set(s,r,0),this._nearPlaneCorners[2].set(s,i,0),this._nearPlaneCorners[3].set(n,i,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||bs(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(cn);Ps.lookAt(fi,n,this._camera.up);for(let s=0;s<4;s++){const r=be.copy(this._nearPlaneCorners[s]);r.applyMatrix4(Ps);const i=Wt.addVectors(this._target,r);Fn.set(i,n),Fn.far=this._spherical.radius+1;const a=Fn.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 de.Sphere){const n=t,s=n.center;Xt.makeEmpty(),e.traverseVisible(i=>{i.isMesh&&Xt.expandByObject(i)}),Xt.getCenter(s);let r=0;return e.traverseVisible(i=>{if(!i.isMesh)return;const a=i,c=a.geometry.clone();c.applyMatrix4(a.matrixWorld);const d=c.attributes.position;for(let f=0,g=d.count;f<g;f++)ye.fromBufferAttribute(d,f),r=Math.max(r,s.distanceToSquared(ye))}),n.radius=Math.sqrt(r),n}}const yi=o=>!!(o&&o.isPerspectiveCamera),_i=o=>!!(o&&o.isOrthographicCamera),mu=["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","mouse-buttons","touches"],xi=(o,e)=>({left:Ue.ACTION.ROTATE,middle:Ue.ACTION.DOLLY,right:Ue.ACTION.TRUCK,wheel:yi(o)?Ue.ACTION.DOLLY:_i(o)?Ue.ACTION.ZOOM:Ue.ACTION.NONE,...e}),vi=(o,e)=>({one:Ue.ACTION.TOUCH_ROTATE,two:yi(o)?Ue.ACTION.TOUCH_DOLLY_TRUCK:_i(o)?Ue.ACTION.TOUCH_ZOOM_TRUCK:Ue.ACTION.NONE,three:Ue.ACTION.TOUCH_TRUCK,...e}),gu=u.defineComponent({__name:"CameraControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},minPolarAngle:{default:0},maxPolarAngle:{default:Math.PI},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},distance:{default:()=>ee.useTresContext().camera.value.position.z},minDistance:{default:Number.EPSILON},maxDistance:{default:Number.POSITIVE_INFINITY},infinityDolly:{type:Boolean,default:!1},minZoom:{default:.01},maxZoom:{default:Number.POSITIVE_INFINITY},smoothTime:{default:.25},draggingSmoothTime:{default:.125},maxSpeed:{default:Number.POSITIVE_INFINITY},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:{default:()=>xi(ee.useTresContext().camera.value)},touches:{default:()=>vi(ee.useTresContext().camera.value)}},emits:["change","start","end"],setup(o,{expose:e,emit:t}){const n=o,s=t,{makeDefault:r,minPolarAngle:i,maxPolarAngle:a,minAzimuthAngle:c,maxAzimuthAngle:h,distance:d,minDistance:f,maxDistance:g,infinityDolly:p,minZoom:_,maxZoom:y,smoothTime:x,draggingSmoothTime:m,maxSpeed:M,azimuthRotateSpeed:v,polarRotateSpeed:C,dollySpeed:O,dollyDragInverted:S,truckSpeed:A,dollyToCursor:b,dragToOffset:P,verticalDragToForward:w,boundaryFriction:D,restThreshold:L,colliderMeshes:V}=u.toRefs(n),R={Box3:l.Box3,MathUtils:{clamp:l.MathUtils.clamp},Matrix4:l.Matrix4,Quaternion:l.Quaternion,Raycaster:l.Raycaster,Sphere:l.Sphere,Spherical:l.Spherical,Vector2:l.Vector2,Vector3:l.Vector3,Vector4:l.Vector4};Ue.install({THREE:R});const{camera:Y,renderer:W,extend:$,controls:q,invalidate:ne}=ee.useTresContext();u.watch(n,()=>{ne()});const te=u.computed(()=>xi(n.camera||Y.value,n.mouseButtons)),ce=u.computed(()=>vi(n.camera||Y.value,n.touches)),le=u.ref(null);$({CameraControls:Ue}),u.watchEffect(()=>{me(),le.value&&r.value?q.value=le.value:q.value=null});function me(){Ce(le.value,"update",()=>{s("change",le.value),ne()}),Ce(le.value,"controlend",()=>s("end",le.value)),Ce(le.value,"controlstart",()=>s("start",le.value))}const{onBeforeRender:B}=ee.useLoop();return B(({delta:z,invalidate:F})=>{var k,G;(k=le.value)!=null&&k.enabled&&((G=le.value)==null||G.update(z),F())}),u.onUnmounted(()=>{le.value&&le.value.disconnect()}),e({instance:le}),(z,F)=>(z.camera||u.unref(Y))&&(z.domElement||u.unref(W))?(u.openBlock(),u.createElementBlock("TresCameraControls",{key:0,ref_key:"controlsRef",ref:le,"min-polar-angle":u.unref(i),"max-polar-angle":u.unref(a),"min-azimuth-angle":u.unref(c),"max-azimuth-angle":u.unref(h),distance:u.unref(d),"min-distance":u.unref(f),"max-distance":u.unref(g),"infinity-dolly":u.unref(p),"min-zoom":u.unref(_),"max-zoom":u.unref(y),"smooth-time":u.unref(x),"dragging-smooth-time":u.unref(m),"max-speed":u.unref(M),"azimuth-rotate-speed":u.unref(v),"polar-rotate-speed":u.unref(C),"dolly-speed":u.unref(O),"dolly-drag-inverted":u.unref(S),"truck-speed":u.unref(A),"dolly-to-cursor":u.unref(b),"drag-to-offset":u.unref(P),"vertical-drag-to-forward":u.unref(w),"boundary-friction":u.unref(D),"rest-threshold":u.unref(L),"collider-meshes":u.unref(V),args:[z.camera||u.unref(Y),z.domElement||u.unref(W).domElement],"mouse-buttons":te.value,touches:ce.value},null,8,mu)):u.createCommentVNode("",!0)}});class yu extends l.MeshStandardMaterial{constructor(t={}){super(t);ue(this,"_time");ue(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=`
|
|
514
514
|
uniform float time;
|
|
515
515
|
uniform float factor;
|
|
516
516
|
${t.vertexShader}
|
|
@@ -519,15 +519,15 @@ ${t}`),[xs()]}return o.animations[e]}function ei(o,e,t){if(e<0||o.frames.length<
|
|
|
519
519
|
float s = sin( theta );
|
|
520
520
|
mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );
|
|
521
521
|
vec3 transformed = vec3( position ) * m;
|
|
522
|
-
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 mu=["factor"],gu=u.defineComponent({__name:"index",props:{speed:{default:1},factor:{default:1}},setup(o,{expose:e}){const t=o,n=u.shallowRef(),{extend:s,invalidate:r}=ee.useTresContext();s({MeshWobbleMaterial:pu}),u.watch(t,()=>r());const{onBeforeRender:i}=ee.useLoop();return i(({elapsed:a,invalidate:c})=>{n.value&&(n.value.time=a*(t==null?void 0:t.speed),c())}),e({instance:n}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMeshWobbleMaterial",u.mergeProps({ref_key:"materialRef",ref:n,factor:a.factor},a.$attrs),null,16,mu))}});function St(o,e,t){return Math.max(e,Math.min(t,o))}function yu(o,e){return(o%e+e)%e}function _u(o,e,t,n,s){return n+(o-e)*(s-n)/(t-e)}function Ts(o,e,t){return(1-t)*o+t*e}class Is{constructor(e=0,t=0){Is.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(St(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),r=this.x-e.x,i=this.y-e.y;return this.x=r*n-i*s+e.x,this.y=r*s+i*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const xu="",At="srgb",Os="srgb-linear",vu="display-p3",wi="display-p3-linear",Ds="linear",bi="srgb",Mi="rec709",Si="p3";class hn{constructor(e,t,n,s,r,i,a,c,h){hn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,i,a,c,h)}set(e,t,n,s,r,i,a,c,h){const d=this.elements;return d[0]=e,d[1]=s,d[2]=a,d[3]=t,d[4]=r,d[5]=c,d[6]=n,d[7]=i,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,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,r=this.elements,i=n[0],a=n[3],c=n[6],h=n[1],d=n[4],f=n[7],y=n[2],p=n[5],_=n[8],g=s[0],x=s[3],m=s[6],M=s[1],v=s[4],C=s[7],O=s[2],S=s[5],A=s[8];return r[0]=i*g+a*M+c*O,r[3]=i*x+a*v+c*S,r[6]=i*m+a*C+c*A,r[1]=h*g+d*M+f*O,r[4]=h*x+d*v+f*S,r[7]=h*m+d*C+f*A,r[2]=y*g+p*M+_*O,r[5]=y*x+p*v+_*S,r[8]=y*m+p*C+_*A,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],r=e[3],i=e[4],a=e[5],c=e[6],h=e[7],d=e[8];return t*i*d-t*a*h-n*r*d+n*a*c+s*r*h-s*i*c}invert(){const e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],i=e[4],a=e[5],c=e[6],h=e[7],d=e[8],f=d*i-a*h,y=a*c-d*r,p=h*r-i*c,_=t*f+n*y+s*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/_;return e[0]=f*g,e[1]=(s*h-d*n)*g,e[2]=(a*n-s*i)*g,e[3]=y*g,e[4]=(d*t-s*c)*g,e[5]=(s*r-a*t)*g,e[6]=p*g,e[7]=(n*c-h*t)*g,e[8]=(i*t-n*r)*g,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,r,i,a){const c=Math.cos(r),h=Math.sin(r);return this.set(n*c,n*h,-n*(c*i+h*a)+i+e,-s*h,s*c,-s*(-h*i+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Ls.makeScale(e,t)),this}rotate(e){return this.premultiply(Ls.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ls.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 Ls=new hn,Ai=new hn().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ci=new hn().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),fn={[Os]:{transfer:Ds,primaries:Mi,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o,fromReference:o=>o},[At]:{transfer:bi,primaries:Mi,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o.convertSRGBToLinear(),fromReference:o=>o.convertLinearToSRGB()},[wi]:{transfer:Ds,primaries:Si,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.applyMatrix3(Ci),fromReference:o=>o.applyMatrix3(Ai)},[vu]:{transfer:bi,primaries:Si,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.convertSRGBToLinear().applyMatrix3(Ci),fromReference:o=>o.applyMatrix3(Ai).convertLinearToSRGB()}},wu=new Set([Os,wi]),nt={enabled:!0,_workingColorSpace:Os,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(o){if(!wu.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=fn[e].toReference,s=fn[t].fromReference;return s(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 fn[o].primaries},getTransfer:function(o){return o===xu?Ds:fn[o].transfer},getLuminanceCoefficients:function(o,e=this._workingColorSpace){return o.fromArray(fn[e].luminanceCoefficients)}};function Bs(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function ks(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}const Pi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ct={h:0,s:0,l:0},Un={h:0,s:0,l:0};function Fs(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 Nn{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,nt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,s=nt.workingColorSpace){return this.r=e,this.g=t,this.b=n,nt.toWorkingColorSpace(this,s),this}setHSL(e,t,n,s=nt.workingColorSpace){if(e=yu(e,1),t=St(t,0,1),n=St(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Fs(i,r,e+1/3),this.g=Fs(i,r,e),this.b=Fs(i,r,e-1/3)}return nt.toWorkingColorSpace(this,s),this}setStyle(e,t=At){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const i=s[1],a=s[2];switch(i){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(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],i=r.length;if(i===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(i===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=At){const n=Pi[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=Bs(e.r),this.g=Bs(e.g),this.b=Bs(e.b),this}copyLinearToSRGB(e){return this.r=ks(e.r),this.g=ks(e.g),this.b=ks(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=At){return nt.fromWorkingColorSpace(Re.copy(this),e),Math.round(St(Re.r*255,0,255))*65536+Math.round(St(Re.g*255,0,255))*256+Math.round(St(Re.b*255,0,255))}getHexString(e=At){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=nt.workingColorSpace){nt.fromWorkingColorSpace(Re.copy(this),t);const n=Re.r,s=Re.g,r=Re.b,i=Math.max(n,s,r),a=Math.min(n,s,r);let c,h;const d=(a+i)/2;if(a===i)c=0,h=0;else{const f=i-a;switch(h=d<=.5?f/(i+a):f/(2-i-a),i){case n:c=(s-r)/f+(s<r?6:0);break;case s:c=(r-n)/f+2;break;case r:c=(n-s)/f+4;break}c/=6}return e.h=c,e.s=h,e.l=d,e}getRGB(e,t=nt.workingColorSpace){return nt.fromWorkingColorSpace(Re.copy(this),t),e.r=Re.r,e.g=Re.g,e.b=Re.b,e}getStyle(e=At){nt.fromWorkingColorSpace(Re.copy(this),e);const t=Re.r,n=Re.g,s=Re.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(Ct),this.setHSL(Ct.h+e,Ct.s+t,Ct.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(Ct),e.getHSL(Un);const n=Ts(Ct.h,Un.h,t),s=Ts(Ct.s,Un.s,t),r=Ts(Ct.l,Un.l,t);return this.setHSL(n,s,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,s=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*s,this.g=r[1]*t+r[4]*n+r[7]*s,this.b=r[2]*t+r[5]*n+r[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 Re=new Nn;Nn.NAMES=Pi;class bu extends l.MeshStandardMaterial{constructor(t={}){super();ue(this,"isMeshPhysicalMaterial");ue(this,"clearcoatMap");ue(this,"clearcoatRoughness");ue(this,"clearcoatRoughnessMap");ue(this,"clearcoatNormalScale");ue(this,"clearcoatNormalMap");ue(this,"ior");ue(this,"transmissionMap");ue(this,"thickness");ue(this,"thicknessMap");ue(this,"attenuationDistance");ue(this,"attenuationColor");ue(this,"specularIntensity");ue(this,"specularIntensityMap");ue(this,"specularColor");ue(this,"specularColorMap");ue(this,"_clearcoat");ue(this,"_transmission");this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Is(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get(){return St(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=Number.POSITIVE_INFINITY,this.attenuationColor=new Nn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Nn(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 Mu=u.defineComponent({__name:"index",setup(o,{expose:e}){const t=u.shallowRef(),{extend:n}=ee.useTresContext();return n({MeshGlassMaterial:bu}),e({instance:t}),(s,r)=>(u.openBlock(),u.createElementBlock("TresMeshGlassMaterial",{ref_key:"MeshGlassMaterialClass",ref:t},null,512))}});var Su=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dn(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function zn(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 Ti={exports:{}};(function(o,e){(function(t){o.exports=t()})(function(){return function t(n,s,r){function i(h,d){if(!s[h]){if(!n[h]){var f=typeof zn=="function"&&zn;if(!d&&f)return f(h,!0);if(a)return a(h,!0);throw new Error("Cannot find module '"+h+"'")}d=s[h]={exports:{}},n[h][0].call(d.exports,function(y){var p=n[h][1][y];return i(p||y)},d,d.exports,t,n,s,r)}return s[h].exports}for(var a=typeof zn=="function"&&zn,c=0;c<r.length;c++)i(r[c]);return i}({1:[function(t,n,s){(function(r,i,a,c,h,d,f,y,p){var _=t("crypto");function g(S,A){A=M(S,A);var b;return(b=A.algorithm!=="passthrough"?_.createHash(A.algorithm):new O).write===void 0&&(b.write=b.update,b.end=b.update),C(A,b).dispatch(S),b.update||b.end(""),b.digest?b.digest(A.encoding==="buffer"?void 0:A.encoding):(S=b.read(),A.encoding!=="buffer"?S.toString(A.encoding):S)}(s=n.exports=g).sha1=function(S){return g(S)},s.keys=function(S){return g(S,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},s.MD5=function(S){return g(S,{algorithm:"md5",encoding:"hex"})},s.keysMD5=function(S){return g(S,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var x=_.getHashes?_.getHashes().slice():["sha1","md5"],m=(x.push("passthrough"),["buffer","hex","binary","base64"]);function M(S,A){var b={};if(b.algorithm=(A=A||{}).algorithm||"sha1",b.encoding=A.encoding||"hex",b.excludeValues=!!A.excludeValues,b.algorithm=b.algorithm.toLowerCase(),b.encoding=b.encoding.toLowerCase(),b.ignoreUnknown=A.ignoreUnknown===!0,b.respectType=A.respectType!==!1,b.respectFunctionNames=A.respectFunctionNames!==!1,b.respectFunctionProperties=A.respectFunctionProperties!==!1,b.unorderedArrays=A.unorderedArrays===!0,b.unorderedSets=A.unorderedSets!==!1,b.unorderedObjects=A.unorderedObjects!==!1,b.replacer=A.replacer||void 0,b.excludeKeys=A.excludeKeys||void 0,S===void 0)throw new Error("Object argument required.");for(var P=0;P<x.length;++P)x[P].toLowerCase()===b.algorithm.toLowerCase()&&(b.algorithm=x[P]);if(x.indexOf(b.algorithm)===-1)throw new Error('Algorithm "'+b.algorithm+'" not supported. supported values: '+x.join(", "));if(m.indexOf(b.encoding)===-1&&b.algorithm!=="passthrough")throw new Error('Encoding "'+b.encoding+'" not supported. supported values: '+m.join(", "));return b}function v(S){if(typeof S=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(S))!=null}function C(S,A,b){b=b||[];function P(w){return A.update?A.update(w,"utf8"):A.write(w,"utf8")}return{dispatch:function(w){return this["_"+((w=S.replacer?S.replacer(w):w)===null?"null":typeof w)](w)},_object:function(w){var D,L=Object.prototype.toString.call(w),V=/\[object (.*)\]/i.exec(L);if(V=(V=V?V[1]:"unknown:["+L+"]").toLowerCase(),0<=(L=b.indexOf(w)))return this.dispatch("[CIRCULAR:"+L+"]");if(b.push(w),a!==void 0&&a.isBuffer&&a.isBuffer(w))return P("buffer:"),P(w);if(V==="object"||V==="function"||V==="asyncfunction")return L=Object.keys(w),S.unorderedObjects&&(L=L.sort()),S.respectType===!1||v(w)||L.splice(0,0,"prototype","__proto__","constructor"),S.excludeKeys&&(L=L.filter(function(R){return!S.excludeKeys(R)})),P("object:"+L.length+":"),D=this,L.forEach(function(R){D.dispatch(R),P(":"),S.excludeValues||D.dispatch(w[R]),P(",")});if(!this["_"+V]){if(S.ignoreUnknown)return P("["+V+"]");throw new Error('Unknown object type "'+V+'"')}this["_"+V](w)},_array:function(w,R){R=R!==void 0?R:S.unorderedArrays!==!1;var L=this;if(P("array:"+w.length+":"),!R||w.length<=1)return w.forEach(function(Y){return L.dispatch(Y)});var V=[],R=w.map(function(Y){var W=new O,$=b.slice();return C(S,W,$).dispatch(Y),V=V.concat($.slice(b.length)),W.read().toString()});return b=b.concat(V),R.sort(),this._array(R,!1)},_date:function(w){return P("date:"+w.toJSON())},_symbol:function(w){return P("symbol:"+w.toString())},_error:function(w){return P("error:"+w.toString())},_boolean:function(w){return P("bool:"+w.toString())},_string:function(w){P("string:"+w.length+":"),P(w.toString())},_function:function(w){P("fn:"),v(w)?this.dispatch("[native]"):this.dispatch(w.toString()),S.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(w.name)),S.respectFunctionProperties&&this._object(w)},_number:function(w){return P("number:"+w.toString())},_xml:function(w){return P("xml:"+w.toString())},_null:function(){return P("Null")},_undefined:function(){return P("Undefined")},_regexp:function(w){return P("regex:"+w.toString())},_uint8array:function(w){return P("uint8array:"),this.dispatch(Array.prototype.slice.call(w))},_uint8clampedarray:function(w){return P("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(w))},_int8array:function(w){return P("int8array:"),this.dispatch(Array.prototype.slice.call(w))},_uint16array:function(w){return P("uint16array:"),this.dispatch(Array.prototype.slice.call(w))},_int16array:function(w){return P("int16array:"),this.dispatch(Array.prototype.slice.call(w))},_uint32array:function(w){return P("uint32array:"),this.dispatch(Array.prototype.slice.call(w))},_int32array:function(w){return P("int32array:"),this.dispatch(Array.prototype.slice.call(w))},_float32array:function(w){return P("float32array:"),this.dispatch(Array.prototype.slice.call(w))},_float64array:function(w){return P("float64array:"),this.dispatch(Array.prototype.slice.call(w))},_arraybuffer:function(w){return P("arraybuffer:"),this.dispatch(new Uint8Array(w))},_url:function(w){return P("url:"+w.toString())},_map:function(w){return P("map:"),w=Array.from(w),this._array(w,S.unorderedSets!==!1)},_set:function(w){return P("set:"),w=Array.from(w),this._array(w,S.unorderedSets!==!1)},_file:function(w){return P("file:"),this.dispatch([w.name,w.size,w.type,w.lastModfied])},_blob:function(){if(S.ignoreUnknown)return P("[blob]");throw Error(`Hashing Blob objects is currently not supported
|
|
522
|
+
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 _u=["factor"],xu=u.defineComponent({__name:"index",props:{speed:{default:1},factor:{default:1}},setup(o,{expose:e}){const t=o,n=u.shallowRef(),{extend:s,invalidate:r}=ee.useTresContext();s({MeshWobbleMaterial:yu}),u.watch(t,()=>r());const{onBeforeRender:i}=ee.useLoop();return i(({elapsed:a,invalidate:c})=>{n.value&&(n.value.time=a*(t==null?void 0:t.speed),c())}),e({instance:n}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMeshWobbleMaterial",u.mergeProps({ref_key:"materialRef",ref:n,factor:a.factor},a.$attrs),null,16,_u))}});function St(o,e,t){return Math.max(e,Math.min(t,o))}function vu(o,e){return(o%e+e)%e}function wu(o,e,t,n,s){return n+(o-e)*(s-n)/(t-e)}function Ts(o,e,t){return(1-t)*o+t*e}class Is{constructor(e=0,t=0){Is.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(St(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),r=this.x-e.x,i=this.y-e.y;return this.x=r*n-i*s+e.x,this.y=r*s+i*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const bu="",At="srgb",Os="srgb-linear",Mu="display-p3",wi="display-p3-linear",Ds="linear",bi="srgb",Mi="rec709",Si="p3";class hn{constructor(e,t,n,s,r,i,a,c,h){hn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,s,r,i,a,c,h)}set(e,t,n,s,r,i,a,c,h){const d=this.elements;return d[0]=e,d[1]=s,d[2]=a,d[3]=t,d[4]=r,d[5]=c,d[6]=n,d[7]=i,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,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,r=this.elements,i=n[0],a=n[3],c=n[6],h=n[1],d=n[4],f=n[7],g=n[2],p=n[5],_=n[8],y=s[0],x=s[3],m=s[6],M=s[1],v=s[4],C=s[7],O=s[2],S=s[5],A=s[8];return r[0]=i*y+a*M+c*O,r[3]=i*x+a*v+c*S,r[6]=i*m+a*C+c*A,r[1]=h*y+d*M+f*O,r[4]=h*x+d*v+f*S,r[7]=h*m+d*C+f*A,r[2]=g*y+p*M+_*O,r[5]=g*x+p*v+_*S,r[8]=g*m+p*C+_*A,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],r=e[3],i=e[4],a=e[5],c=e[6],h=e[7],d=e[8];return t*i*d-t*a*h-n*r*d+n*a*c+s*r*h-s*i*c}invert(){const e=this.elements,t=e[0],n=e[1],s=e[2],r=e[3],i=e[4],a=e[5],c=e[6],h=e[7],d=e[8],f=d*i-a*h,g=a*c-d*r,p=h*r-i*c,_=t*f+n*g+s*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/_;return e[0]=f*y,e[1]=(s*h-d*n)*y,e[2]=(a*n-s*i)*y,e[3]=g*y,e[4]=(d*t-s*c)*y,e[5]=(s*r-a*t)*y,e[6]=p*y,e[7]=(n*c-h*t)*y,e[8]=(i*t-n*r)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,s,r,i,a){const c=Math.cos(r),h=Math.sin(r);return this.set(n*c,n*h,-n*(c*i+h*a)+i+e,-s*h,s*c,-s*(-h*i+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Ls.makeScale(e,t)),this}rotate(e){return this.premultiply(Ls.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ls.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 Ls=new hn,Ai=new hn().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ci=new hn().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),fn={[Os]:{transfer:Ds,primaries:Mi,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o,fromReference:o=>o},[At]:{transfer:bi,primaries:Mi,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o.convertSRGBToLinear(),fromReference:o=>o.convertLinearToSRGB()},[wi]:{transfer:Ds,primaries:Si,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.applyMatrix3(Ci),fromReference:o=>o.applyMatrix3(Ai)},[Mu]:{transfer:bi,primaries:Si,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.convertSRGBToLinear().applyMatrix3(Ci),fromReference:o=>o.applyMatrix3(Ai).convertLinearToSRGB()}},Su=new Set([Os,wi]),nt={enabled:!0,_workingColorSpace:Os,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(o){if(!Su.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=fn[e].toReference,s=fn[t].fromReference;return s(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 fn[o].primaries},getTransfer:function(o){return o===bu?Ds:fn[o].transfer},getLuminanceCoefficients:function(o,e=this._workingColorSpace){return o.fromArray(fn[e].luminanceCoefficients)}};function Bs(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function ks(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}const Pi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ct={h:0,s:0,l:0},Un={h:0,s:0,l:0};function Fs(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 Nn{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,nt.toWorkingColorSpace(this,t),this}setRGB(e,t,n,s=nt.workingColorSpace){return this.r=e,this.g=t,this.b=n,nt.toWorkingColorSpace(this,s),this}setHSL(e,t,n,s=nt.workingColorSpace){if(e=vu(e,1),t=St(t,0,1),n=St(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Fs(i,r,e+1/3),this.g=Fs(i,r,e),this.b=Fs(i,r,e-1/3)}return nt.toWorkingColorSpace(this,s),this}setStyle(e,t=At){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const i=s[1],a=s[2];switch(i){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(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],i=r.length;if(i===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(i===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=At){const n=Pi[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=Bs(e.r),this.g=Bs(e.g),this.b=Bs(e.b),this}copyLinearToSRGB(e){return this.r=ks(e.r),this.g=ks(e.g),this.b=ks(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=At){return nt.fromWorkingColorSpace(Re.copy(this),e),Math.round(St(Re.r*255,0,255))*65536+Math.round(St(Re.g*255,0,255))*256+Math.round(St(Re.b*255,0,255))}getHexString(e=At){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=nt.workingColorSpace){nt.fromWorkingColorSpace(Re.copy(this),t);const n=Re.r,s=Re.g,r=Re.b,i=Math.max(n,s,r),a=Math.min(n,s,r);let c,h;const d=(a+i)/2;if(a===i)c=0,h=0;else{const f=i-a;switch(h=d<=.5?f/(i+a):f/(2-i-a),i){case n:c=(s-r)/f+(s<r?6:0);break;case s:c=(r-n)/f+2;break;case r:c=(n-s)/f+4;break}c/=6}return e.h=c,e.s=h,e.l=d,e}getRGB(e,t=nt.workingColorSpace){return nt.fromWorkingColorSpace(Re.copy(this),t),e.r=Re.r,e.g=Re.g,e.b=Re.b,e}getStyle(e=At){nt.fromWorkingColorSpace(Re.copy(this),e);const t=Re.r,n=Re.g,s=Re.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(Ct),this.setHSL(Ct.h+e,Ct.s+t,Ct.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(Ct),e.getHSL(Un);const n=Ts(Ct.h,Un.h,t),s=Ts(Ct.s,Un.s,t),r=Ts(Ct.l,Un.l,t);return this.setHSL(n,s,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,s=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*s,this.g=r[1]*t+r[4]*n+r[7]*s,this.b=r[2]*t+r[5]*n+r[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 Re=new Nn;Nn.NAMES=Pi;class Au extends l.MeshStandardMaterial{constructor(t={}){super();ue(this,"isMeshPhysicalMaterial");ue(this,"clearcoatMap");ue(this,"clearcoatRoughness");ue(this,"clearcoatRoughnessMap");ue(this,"clearcoatNormalScale");ue(this,"clearcoatNormalMap");ue(this,"ior");ue(this,"transmissionMap");ue(this,"thickness");ue(this,"thicknessMap");ue(this,"attenuationDistance");ue(this,"attenuationColor");ue(this,"specularIntensity");ue(this,"specularIntensityMap");ue(this,"specularColor");ue(this,"specularColorMap");ue(this,"_clearcoat");ue(this,"_transmission");this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Is(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get(){return St(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=Number.POSITIVE_INFINITY,this.attenuationColor=new Nn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Nn(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 Cu=u.defineComponent({__name:"index",setup(o,{expose:e}){const t=u.shallowRef(),{extend:n}=ee.useTresContext();return n({MeshGlassMaterial:Au}),e({instance:t}),(s,r)=>(u.openBlock(),u.createElementBlock("TresMeshGlassMaterial",{ref_key:"MeshGlassMaterialClass",ref:t},null,512))}});var Pu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dn(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function zn(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 Ti={exports:{}};(function(o,e){(function(t){o.exports=t()})(function(){return function t(n,s,r){function i(h,d){if(!s[h]){if(!n[h]){var f=typeof zn=="function"&&zn;if(!d&&f)return f(h,!0);if(a)return a(h,!0);throw new Error("Cannot find module '"+h+"'")}d=s[h]={exports:{}},n[h][0].call(d.exports,function(g){var p=n[h][1][g];return i(p||g)},d,d.exports,t,n,s,r)}return s[h].exports}for(var a=typeof zn=="function"&&zn,c=0;c<r.length;c++)i(r[c]);return i}({1:[function(t,n,s){(function(r,i,a,c,h,d,f,g,p){var _=t("crypto");function y(S,A){A=M(S,A);var b;return(b=A.algorithm!=="passthrough"?_.createHash(A.algorithm):new O).write===void 0&&(b.write=b.update,b.end=b.update),C(A,b).dispatch(S),b.update||b.end(""),b.digest?b.digest(A.encoding==="buffer"?void 0:A.encoding):(S=b.read(),A.encoding!=="buffer"?S.toString(A.encoding):S)}(s=n.exports=y).sha1=function(S){return y(S)},s.keys=function(S){return y(S,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},s.MD5=function(S){return y(S,{algorithm:"md5",encoding:"hex"})},s.keysMD5=function(S){return y(S,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var x=_.getHashes?_.getHashes().slice():["sha1","md5"],m=(x.push("passthrough"),["buffer","hex","binary","base64"]);function M(S,A){var b={};if(b.algorithm=(A=A||{}).algorithm||"sha1",b.encoding=A.encoding||"hex",b.excludeValues=!!A.excludeValues,b.algorithm=b.algorithm.toLowerCase(),b.encoding=b.encoding.toLowerCase(),b.ignoreUnknown=A.ignoreUnknown===!0,b.respectType=A.respectType!==!1,b.respectFunctionNames=A.respectFunctionNames!==!1,b.respectFunctionProperties=A.respectFunctionProperties!==!1,b.unorderedArrays=A.unorderedArrays===!0,b.unorderedSets=A.unorderedSets!==!1,b.unorderedObjects=A.unorderedObjects!==!1,b.replacer=A.replacer||void 0,b.excludeKeys=A.excludeKeys||void 0,S===void 0)throw new Error("Object argument required.");for(var P=0;P<x.length;++P)x[P].toLowerCase()===b.algorithm.toLowerCase()&&(b.algorithm=x[P]);if(x.indexOf(b.algorithm)===-1)throw new Error('Algorithm "'+b.algorithm+'" not supported. supported values: '+x.join(", "));if(m.indexOf(b.encoding)===-1&&b.algorithm!=="passthrough")throw new Error('Encoding "'+b.encoding+'" not supported. supported values: '+m.join(", "));return b}function v(S){if(typeof S=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(S))!=null}function C(S,A,b){b=b||[];function P(w){return A.update?A.update(w,"utf8"):A.write(w,"utf8")}return{dispatch:function(w){return this["_"+((w=S.replacer?S.replacer(w):w)===null?"null":typeof w)](w)},_object:function(w){var D,L=Object.prototype.toString.call(w),V=/\[object (.*)\]/i.exec(L);if(V=(V=V?V[1]:"unknown:["+L+"]").toLowerCase(),0<=(L=b.indexOf(w)))return this.dispatch("[CIRCULAR:"+L+"]");if(b.push(w),a!==void 0&&a.isBuffer&&a.isBuffer(w))return P("buffer:"),P(w);if(V==="object"||V==="function"||V==="asyncfunction")return L=Object.keys(w),S.unorderedObjects&&(L=L.sort()),S.respectType===!1||v(w)||L.splice(0,0,"prototype","__proto__","constructor"),S.excludeKeys&&(L=L.filter(function(R){return!S.excludeKeys(R)})),P("object:"+L.length+":"),D=this,L.forEach(function(R){D.dispatch(R),P(":"),S.excludeValues||D.dispatch(w[R]),P(",")});if(!this["_"+V]){if(S.ignoreUnknown)return P("["+V+"]");throw new Error('Unknown object type "'+V+'"')}this["_"+V](w)},_array:function(w,R){R=R!==void 0?R:S.unorderedArrays!==!1;var L=this;if(P("array:"+w.length+":"),!R||w.length<=1)return w.forEach(function(Y){return L.dispatch(Y)});var V=[],R=w.map(function(Y){var W=new O,$=b.slice();return C(S,W,$).dispatch(Y),V=V.concat($.slice(b.length)),W.read().toString()});return b=b.concat(V),R.sort(),this._array(R,!1)},_date:function(w){return P("date:"+w.toJSON())},_symbol:function(w){return P("symbol:"+w.toString())},_error:function(w){return P("error:"+w.toString())},_boolean:function(w){return P("bool:"+w.toString())},_string:function(w){P("string:"+w.length+":"),P(w.toString())},_function:function(w){P("fn:"),v(w)?this.dispatch("[native]"):this.dispatch(w.toString()),S.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(w.name)),S.respectFunctionProperties&&this._object(w)},_number:function(w){return P("number:"+w.toString())},_xml:function(w){return P("xml:"+w.toString())},_null:function(){return P("Null")},_undefined:function(){return P("Undefined")},_regexp:function(w){return P("regex:"+w.toString())},_uint8array:function(w){return P("uint8array:"),this.dispatch(Array.prototype.slice.call(w))},_uint8clampedarray:function(w){return P("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(w))},_int8array:function(w){return P("int8array:"),this.dispatch(Array.prototype.slice.call(w))},_uint16array:function(w){return P("uint16array:"),this.dispatch(Array.prototype.slice.call(w))},_int16array:function(w){return P("int16array:"),this.dispatch(Array.prototype.slice.call(w))},_uint32array:function(w){return P("uint32array:"),this.dispatch(Array.prototype.slice.call(w))},_int32array:function(w){return P("int32array:"),this.dispatch(Array.prototype.slice.call(w))},_float32array:function(w){return P("float32array:"),this.dispatch(Array.prototype.slice.call(w))},_float64array:function(w){return P("float64array:"),this.dispatch(Array.prototype.slice.call(w))},_arraybuffer:function(w){return P("arraybuffer:"),this.dispatch(new Uint8Array(w))},_url:function(w){return P("url:"+w.toString())},_map:function(w){return P("map:"),w=Array.from(w),this._array(w,S.unorderedSets!==!1)},_set:function(w){return P("set:"),w=Array.from(w),this._array(w,S.unorderedSets!==!1)},_file:function(w){return P("file:"),this.dispatch([w.name,w.size,w.type,w.lastModfied])},_blob:function(){if(S.ignoreUnknown)return P("[blob]");throw Error(`Hashing Blob objects is currently not supported
|
|
523
523
|
(see https://github.com/puleos/object-hash/issues/26)
|
|
524
524
|
Use "options.replacer" or "options.ignoreUnknown"
|
|
525
|
-
`)},_domwindow:function(){return P("domwindow")},_bigint:function(w){return P("bigint:"+w.toString())},_process:function(){return P("process")},_timer:function(){return P("timer")},_pipe:function(){return P("pipe")},_tcp:function(){return P("tcp")},_udp:function(){return P("udp")},_tty:function(){return P("tty")},_statwatcher:function(){return P("statwatcher")},_securecontext:function(){return P("securecontext")},_connection:function(){return P("connection")},_zlib:function(){return P("zlib")},_context:function(){return P("context")},_nodescript:function(){return P("nodescript")},_httpparser:function(){return P("httpparser")},_dataview:function(){return P("dataview")},_signal:function(){return P("signal")},_fsevent:function(){return P("fsevent")},_tlswrap:function(){return P("tlswrap")}}}function O(){return{buf:"",write:function(S){this.buf+=S},end:function(S){this.buf+=S},read:function(){return this.buf}}}s.writeToStream=function(S,A,b){return b===void 0&&(b=A,A={}),C(A=M(S,A),b).dispatch(S)}}).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,s){(function(r,i,a,c,h,d,f,
|
|
526
|
-
list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T[0];if(typeof I!="number")for(j=I=0;j<T.length;j++)I+=T[j].length;for(var U=new x(I),Z=0,j=0;j<T.length;j++){var E=T[j];E.copy(U,Z),Z+=E.length}return U},x.prototype.write=function(T,I,U,Z){isFinite(I)?isFinite(U)||(Z=U,U=void 0):(ie=Z,Z=I,I=U,U=ie),I=Number(I)||0;var j,E,J,se,ie=this.length-I;switch((!U||ie<(U=Number(U)))&&(U=ie),Z=String(Z||"utf8").toLowerCase()){case"hex":j=function(X,N,ae,he){ae=Number(ae)||0;var _e=X.length-ae;(!he||_e<(he=Number(he)))&&(he=_e),G((_e=N.length)%2==0,"Invalid hex string"),_e/2<he&&(he=_e/2);for(var Ie=0;Ie<he;Ie++){var Oe=parseInt(N.substr(2*Ie,2),16);G(!isNaN(Oe),"Invalid hex string"),X[ae+Ie]=Oe}return x._charsWritten=2*Ie,Ie}(this,T,I,U);break;case"utf8":case"utf-8":E=this,J=I,se=U,j=x._charsWritten=me(ce(T),E,J,se);break;case"ascii":case"binary":j=m(this,T,I,U);break;case"base64":E=this,J=I,se=U,j=x._charsWritten=me(le(T),E,J,se);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":j=M(this,T,I,U);break;default:throw new Error("Unknown encoding")}return j},x.prototype.toString=function(T,I,U){var Z,j,E,J,se=this;if(T=String(T||"utf8").toLowerCase(),I=Number(I)||0,(U=U!==void 0?Number(U):se.length)===I)return"";switch(T){case"hex":Z=function(ie,X,N){var ae=ie.length;(!X||X<0)&&(X=0),(!N||N<0||ae<N)&&(N=ae);for(var he="",_e=X;_e<N;_e++)he+=te(ie[_e]);return he}(se,I,U);break;case"utf8":case"utf-8":Z=function(ie,X,N){var ae="",he="";N=Math.min(ie.length,N);for(var _e=X;_e<N;_e++)ie[_e]<=127?(ae+=B(he)+String.fromCharCode(ie[_e]),he=""):he+="%"+ie[_e].toString(16);return ae+B(he)}(se,I,U);break;case"ascii":case"binary":Z=v(se,I,U);break;case"base64":j=se,J=U,Z=(E=I)===0&&J===j.length?_.fromByteArray(j):_.fromByteArray(j.slice(E,J));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":Z=function(ie,X,N){for(var ae=ie.slice(X,N),he="",_e=0;_e<ae.length;_e+=2)he+=String.fromCharCode(ae[_e]+256*ae[_e+1]);return he}(se,I,U);break;default:throw new Error("Unknown encoding")}return Z},x.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},x.prototype.copy=function(T,I,U,Z){if(I=I||0,(Z=Z||Z===0?Z:this.length)!==(U=U||0)&&T.length!==0&&this.length!==0){G(U<=Z,"sourceEnd < sourceStart"),G(0<=I&&I<T.length,"targetStart out of bounds"),G(0<=U&&U<this.length,"sourceStart out of bounds"),G(0<=Z&&Z<=this.length,"sourceEnd out of bounds"),Z>this.length&&(Z=this.length);var j=(Z=T.length-I<Z-U?T.length-I+U:Z)-U;if(j<100||!x._useTypedArrays)for(var E=0;E<j;E++)T[E+I]=this[E+U];else T._set(this.subarray(U,U+j),I)}},x.prototype.slice=function(T,I){var U=this.length;if(T=$(T,U,0),I=$(I,U,U),x._useTypedArrays)return x._augment(this.subarray(T,I));for(var Z=I-T,j=new x(Z,void 0,!0),E=0;E<Z;E++)j[E]=this[E+T];return j},x.prototype.get=function(T){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(T)},x.prototype.set=function(T,I){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(T,I)},x.prototype.readUInt8=function(T,I){if(I||(G(T!=null,"missing offset"),G(T<this.length,"Trying to read beyond buffer length")),!(T>=this.length))return this[T]},x.prototype.readUInt16LE=function(T,I){return C(this,T,!0,I)},x.prototype.readUInt16BE=function(T,I){return C(this,T,!1,I)},x.prototype.readUInt32LE=function(T,I){return O(this,T,!0,I)},x.prototype.readUInt32BE=function(T,I){return O(this,T,!1,I)},x.prototype.readInt8=function(T,I){if(I||(G(T!=null,"missing offset"),G(T<this.length,"Trying to read beyond buffer length")),!(T>=this.length))return 128&this[T]?-1*(255-this[T]+1):this[T]},x.prototype.readInt16LE=function(T,I){return S(this,T,!0,I)},x.prototype.readInt16BE=function(T,I){return S(this,T,!1,I)},x.prototype.readInt32LE=function(T,I){return A(this,T,!0,I)},x.prototype.readInt32BE=function(T,I){return A(this,T,!1,I)},x.prototype.readFloatLE=function(T,I){return b(this,T,!0,I)},x.prototype.readFloatBE=function(T,I){return b(this,T,!1,I)},x.prototype.readDoubleLE=function(T,I){return P(this,T,!0,I)},x.prototype.readDoubleBE=function(T,I){return P(this,T,!1,I)},x.prototype.writeUInt8=function(T,I,U){U||(G(T!=null,"missing value"),G(I!=null,"missing offset"),G(I<this.length,"trying to write beyond buffer length"),z(T,255)),I>=this.length||(this[I]=T)},x.prototype.writeUInt16LE=function(T,I,U){w(this,T,I,!0,U)},x.prototype.writeUInt16BE=function(T,I,U){w(this,T,I,!1,U)},x.prototype.writeUInt32LE=function(T,I,U){D(this,T,I,!0,U)},x.prototype.writeUInt32BE=function(T,I,U){D(this,T,I,!1,U)},x.prototype.writeInt8=function(T,I,U){U||(G(T!=null,"missing value"),G(I!=null,"missing offset"),G(I<this.length,"Trying to write beyond buffer length"),F(T,127,-128)),I>=this.length||(0<=T?this.writeUInt8(T,I,U):this.writeUInt8(255+T+1,I,U))},x.prototype.writeInt16LE=function(T,I,U){L(this,T,I,!0,U)},x.prototype.writeInt16BE=function(T,I,U){L(this,T,I,!1,U)},x.prototype.writeInt32LE=function(T,I,U){V(this,T,I,!0,U)},x.prototype.writeInt32BE=function(T,I,U){V(this,T,I,!1,U)},x.prototype.writeFloatLE=function(T,I,U){R(this,T,I,!0,U)},x.prototype.writeFloatBE=function(T,I,U){R(this,T,I,!1,U)},x.prototype.writeDoubleLE=function(T,I,U){Y(this,T,I,!0,U)},x.prototype.writeDoubleBE=function(T,I,U){Y(this,T,I,!1,U)},x.prototype.fill=function(T,I,U){if(I=I||0,U=U||this.length,G(typeof(T=typeof(T=T||0)=="string"?T.charCodeAt(0):T)=="number"&&!isNaN(T),"value is not a number"),G(I<=U,"end < start"),U!==I&&this.length!==0){G(0<=I&&I<this.length,"start out of bounds"),G(0<=U&&U<=this.length,"end out of bounds");for(var Z=I;Z<U;Z++)this[Z]=T}},x.prototype.inspect=function(){for(var T=[],I=this.length,U=0;U<I;U++)if(T[U]=te(this[U]),U===s.INSPECT_MAX_BYTES){T[U+1]="...";break}return"<Buffer "+T.join(" ")+">"},x.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(x._useTypedArrays)return new x(this).buffer;for(var T=new Uint8Array(this.length),I=0,U=T.length;I<U;I+=1)T[I]=this[I];return T.buffer};var W=x.prototype;function $(T,I,U){return typeof T!="number"?U:I<=(T=~~T)?I:0<=T||0<=(T+=I)?T:0}function q(T){return(T=~~Math.ceil(+T))<0?0:T}function ne(T){return(Array.isArray||function(I){return Object.prototype.toString.call(I)==="[object Array]"})(T)}function te(T){return T<16?"0"+T.toString(16):T.toString(16)}function ce(T){for(var I=[],U=0;U<T.length;U++){var Z=T.charCodeAt(U);if(Z<=127)I.push(T.charCodeAt(U));else for(var j=U,E=(55296<=Z&&Z<=57343&&U++,encodeURIComponent(T.slice(j,U+1)).substr(1).split("%")),J=0;J<E.length;J++)I.push(parseInt(E[J],16))}return I}function le(T){return _.toByteArray(T)}function me(T,I,U,Z){for(var j=0;j<Z&&!(j+U>=I.length||j>=T.length);j++)I[j+U]=T[j];return j}function B(T){try{return decodeURIComponent(T)}catch{return"�"}}function z(T,I){G(typeof T=="number","cannot write a non-number as a number"),G(0<=T,"specified a negative value for writing an unsigned value"),G(T<=I,"value is larger than maximum value for type"),G(Math.floor(T)===T,"value has a fractional component")}function F(T,I,U){G(typeof T=="number","cannot write a non-number as a number"),G(T<=I,"value larger than maximum allowed value"),G(U<=T,"value smaller than minimum allowed value"),G(Math.floor(T)===T,"value has a fractional component")}function k(T,I,U){G(typeof T=="number","cannot write a non-number as a number"),G(T<=I,"value larger than maximum allowed value"),G(U<=T,"value smaller than minimum allowed value")}function G(T,I){if(!T)throw new Error(I||"Failed assertion")}x._augment=function(T){return T._isBuffer=!0,T._get=T.get,T._set=T.set,T.get=W.get,T.set=W.set,T.write=W.write,T.toString=W.toString,T.toLocaleString=W.toString,T.toJSON=W.toJSON,T.copy=W.copy,T.slice=W.slice,T.readUInt8=W.readUInt8,T.readUInt16LE=W.readUInt16LE,T.readUInt16BE=W.readUInt16BE,T.readUInt32LE=W.readUInt32LE,T.readUInt32BE=W.readUInt32BE,T.readInt8=W.readInt8,T.readInt16LE=W.readInt16LE,T.readInt16BE=W.readInt16BE,T.readInt32LE=W.readInt32LE,T.readInt32BE=W.readInt32BE,T.readFloatLE=W.readFloatLE,T.readFloatBE=W.readFloatBE,T.readDoubleLE=W.readDoubleLE,T.readDoubleBE=W.readDoubleBE,T.writeUInt8=W.writeUInt8,T.writeUInt16LE=W.writeUInt16LE,T.writeUInt16BE=W.writeUInt16BE,T.writeUInt32LE=W.writeUInt32LE,T.writeUInt32BE=W.writeUInt32BE,T.writeInt8=W.writeInt8,T.writeInt16LE=W.writeInt16LE,T.writeInt16BE=W.writeInt16BE,T.writeInt32LE=W.writeInt32LE,T.writeInt32BE=W.writeInt32BE,T.writeFloatLE=W.writeFloatLE,T.writeFloatBE=W.writeFloatBE,T.writeDoubleLE=W.writeDoubleLE,T.writeDoubleBE=W.writeDoubleBE,T.fill=W.fill,T.inspect=W.inspect,T.toArrayBuffer=W.toArrayBuffer,T}}).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,s){(function(r,i,_,c,h,d,f,y,p){var _=t("buffer").Buffer,g=4,x=new _(g);x.fill(0),n.exports={hash:function(m,M,v,C){for(var O=M(function(w,D){w.length%g!=0&&(L=w.length+(g-w.length%g),w=_.concat([w,x],L));for(var L,V=[],R=D?w.readInt32BE:w.readInt32LE,Y=0;Y<w.length;Y+=g)V.push(R.call(w,Y));return V}(m=_.isBuffer(m)?m:new _(m),C),8*m.length),M=C,S=new _(v),A=M?S.writeInt32BE:S.writeInt32LE,b=0;b<O.length;b++)A.call(S,O[b],4*b,!0);return S}}}).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,s){(function(r,i,_,c,h,d,f,y,p){var _=t("buffer").Buffer,g=t("./sha"),x=t("./sha256"),m=t("./rng"),M={sha1:g,sha256:x,md5:t("./md5")},v=64,C=new _(v);function O(w,D){var L=M[w=w||"sha1"],V=[];return L||S("algorithm:",w,"is not yet supported"),{update:function(R){return _.isBuffer(R)||(R=new _(R)),V.push(R),R.length,this},digest:function(R){var Y=_.concat(V),Y=D?function(W,$,q){_.isBuffer($)||($=new _($)),_.isBuffer(q)||(q=new _(q)),$.length>v?$=W($):$.length<v&&($=_.concat([$,C],v));for(var ne=new _(v),te=new _(v),ce=0;ce<v;ce++)ne[ce]=54^$[ce],te[ce]=92^$[ce];return q=W(_.concat([ne,q])),W(_.concat([te,q]))}(L,D,Y):L(Y);return V=null,R?Y.toString(R):Y}}}function S(){var w=[].slice.call(arguments).join(" ");throw new Error([w,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
527
|
-
`))}C.fill(0),s.createHash=function(w){return O(w)},s.createHmac=O,s.randomBytes=function(w,D){if(!D||!D.call)return new _(m(w));try{D.call(this,void 0,new _(m(w)))}catch(L){D(L)}};var A,b=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],P=function(w){s[w]=function(){S("sorry,",w,"is not implemented yet")}};for(A in b)P(b[A])}).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,s){(function(r,i,a,c,h,d,f,y,p){var _=t("./helpers");function g(S,A){S[A>>5]|=128<<A%32,S[14+(A+64>>>9<<4)]=A;for(var b=1732584193,P=-271733879,w=-1732584194,D=271733878,L=0;L<S.length;L+=16){var V=b,R=P,Y=w,W=D,b=m(b,P,w,D,S[L+0],7,-680876936),D=m(D,b,P,w,S[L+1],12,-389564586),w=m(w,D,b,P,S[L+2],17,606105819),P=m(P,w,D,b,S[L+3],22,-1044525330);b=m(b,P,w,D,S[L+4],7,-176418897),D=m(D,b,P,w,S[L+5],12,1200080426),w=m(w,D,b,P,S[L+6],17,-1473231341),P=m(P,w,D,b,S[L+7],22,-45705983),b=m(b,P,w,D,S[L+8],7,1770035416),D=m(D,b,P,w,S[L+9],12,-1958414417),w=m(w,D,b,P,S[L+10],17,-42063),P=m(P,w,D,b,S[L+11],22,-1990404162),b=m(b,P,w,D,S[L+12],7,1804603682),D=m(D,b,P,w,S[L+13],12,-40341101),w=m(w,D,b,P,S[L+14],17,-1502002290),b=M(b,P=m(P,w,D,b,S[L+15],22,1236535329),w,D,S[L+1],5,-165796510),D=M(D,b,P,w,S[L+6],9,-1069501632),w=M(w,D,b,P,S[L+11],14,643717713),P=M(P,w,D,b,S[L+0],20,-373897302),b=M(b,P,w,D,S[L+5],5,-701558691),D=M(D,b,P,w,S[L+10],9,38016083),w=M(w,D,b,P,S[L+15],14,-660478335),P=M(P,w,D,b,S[L+4],20,-405537848),b=M(b,P,w,D,S[L+9],5,568446438),D=M(D,b,P,w,S[L+14],9,-1019803690),w=M(w,D,b,P,S[L+3],14,-187363961),P=M(P,w,D,b,S[L+8],20,1163531501),b=M(b,P,w,D,S[L+13],5,-1444681467),D=M(D,b,P,w,S[L+2],9,-51403784),w=M(w,D,b,P,S[L+7],14,1735328473),b=v(b,P=M(P,w,D,b,S[L+12],20,-1926607734),w,D,S[L+5],4,-378558),D=v(D,b,P,w,S[L+8],11,-2022574463),w=v(w,D,b,P,S[L+11],16,1839030562),P=v(P,w,D,b,S[L+14],23,-35309556),b=v(b,P,w,D,S[L+1],4,-1530992060),D=v(D,b,P,w,S[L+4],11,1272893353),w=v(w,D,b,P,S[L+7],16,-155497632),P=v(P,w,D,b,S[L+10],23,-1094730640),b=v(b,P,w,D,S[L+13],4,681279174),D=v(D,b,P,w,S[L+0],11,-358537222),w=v(w,D,b,P,S[L+3],16,-722521979),P=v(P,w,D,b,S[L+6],23,76029189),b=v(b,P,w,D,S[L+9],4,-640364487),D=v(D,b,P,w,S[L+12],11,-421815835),w=v(w,D,b,P,S[L+15],16,530742520),b=C(b,P=v(P,w,D,b,S[L+2],23,-995338651),w,D,S[L+0],6,-198630844),D=C(D,b,P,w,S[L+7],10,1126891415),w=C(w,D,b,P,S[L+14],15,-1416354905),P=C(P,w,D,b,S[L+5],21,-57434055),b=C(b,P,w,D,S[L+12],6,1700485571),D=C(D,b,P,w,S[L+3],10,-1894986606),w=C(w,D,b,P,S[L+10],15,-1051523),P=C(P,w,D,b,S[L+1],21,-2054922799),b=C(b,P,w,D,S[L+8],6,1873313359),D=C(D,b,P,w,S[L+15],10,-30611744),w=C(w,D,b,P,S[L+6],15,-1560198380),P=C(P,w,D,b,S[L+13],21,1309151649),b=C(b,P,w,D,S[L+4],6,-145523070),D=C(D,b,P,w,S[L+11],10,-1120210379),w=C(w,D,b,P,S[L+2],15,718787259),P=C(P,w,D,b,S[L+9],21,-343485551),b=O(b,V),P=O(P,R),w=O(w,Y),D=O(D,W)}return Array(b,P,w,D)}function x(S,A,b,P,w,D){return O((A=O(O(A,S),O(P,D)))<<w|A>>>32-w,b)}function m(S,A,b,P,w,D,L){return x(A&b|~A&P,S,A,w,D,L)}function M(S,A,b,P,w,D,L){return x(A&P|b&~P,S,A,w,D,L)}function v(S,A,b,P,w,D,L){return x(A^b^P,S,A,w,D,L)}function C(S,A,b,P,w,D,L){return x(b^(A|~P),S,A,w,D,L)}function O(S,A){var b=(65535&S)+(65535&A);return(S>>16)+(A>>16)+(b>>16)<<16|65535&b}n.exports=function(S){return _.hash(S,g,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,s){(function(r,i,a,c,h,d,f,y,p){n.exports=function(_){for(var g,x=new Array(_),m=0;m<_;m++)!(3&m)&&(g=4294967296*Math.random()),x[m]=g>>>((3&m)<<3)&255;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/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,n,s){(function(r,i,a,c,h,d,f,y,p){var _=t("./helpers");function g(M,v){M[v>>5]|=128<<24-v%32,M[15+(v+64>>9<<4)]=v;for(var C,O,S,A=Array(80),b=1732584193,P=-271733879,w=-1732584194,D=271733878,L=-1009589776,V=0;V<M.length;V+=16){for(var R=b,Y=P,W=w,$=D,q=L,ne=0;ne<80;ne++){A[ne]=ne<16?M[V+ne]:m(A[ne-3]^A[ne-8]^A[ne-14]^A[ne-16],1);var te=x(x(m(b,5),(te=P,O=w,S=D,(C=ne)<20?te&O|~te&S:!(C<40)&&C<60?te&O|te&S|O&S:te^O^S)),x(x(L,A[ne]),(C=ne)<20?1518500249:C<40?1859775393:C<60?-1894007588:-899497514)),L=D,D=w,w=m(P,30),P=b,b=te}b=x(b,R),P=x(P,Y),w=x(w,W),D=x(D,$),L=x(L,q)}return Array(b,P,w,D,L)}function x(M,v){var C=(65535&M)+(65535&v);return(M>>16)+(v>>16)+(C>>16)<<16|65535&C}function m(M,v){return M<<v|M>>>32-v}n.exports=function(M){return _.hash(M,g,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,s){(function(r,i,a,c,h,d,f,y,p){function _(v,C){var O=(65535&v)+(65535&C);return(v>>16)+(C>>16)+(O>>16)<<16|65535&O}function g(v,C){var O,S=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),A=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),b=new Array(64);v[C>>5]|=128<<24-C%32,v[15+(C+64>>9<<4)]=C;for(var P,w,D=0;D<v.length;D+=16){for(var L=A[0],V=A[1],R=A[2],Y=A[3],W=A[4],$=A[5],q=A[6],ne=A[7],te=0;te<64;te++)b[te]=te<16?v[te+D]:_(_(_((w=b[te-2],m(w,17)^m(w,19)^M(w,10)),b[te-7]),(w=b[te-15],m(w,7)^m(w,18)^M(w,3))),b[te-16]),O=_(_(_(_(ne,m(w=W,6)^m(w,11)^m(w,25)),W&$^~W&q),S[te]),b[te]),P=_(m(P=L,2)^m(P,13)^m(P,22),L&V^L&R^V&R),ne=q,q=$,$=W,W=_(Y,O),Y=R,R=V,V=L,L=_(O,P);A[0]=_(L,A[0]),A[1]=_(V,A[1]),A[2]=_(R,A[2]),A[3]=_(Y,A[3]),A[4]=_(W,A[4]),A[5]=_($,A[5]),A[6]=_(q,A[6]),A[7]=_(ne,A[7])}return A}var x=t("./helpers"),m=function(v,C){return v>>>C|v<<32-C},M=function(v,C){return v>>>C};n.exports=function(v){return x.hash(v,g,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,s){(function(r,i,a,c,h,d,f,y,p){s.read=function(_,g,x,m,D){var v,C,O=8*D-m-1,S=(1<<O)-1,A=S>>1,b=-7,P=x?D-1:0,w=x?-1:1,D=_[g+P];for(P+=w,v=D&(1<<-b)-1,D>>=-b,b+=O;0<b;v=256*v+_[g+P],P+=w,b-=8);for(C=v&(1<<-b)-1,v>>=-b,b+=m;0<b;C=256*C+_[g+P],P+=w,b-=8);if(v===0)v=1-A;else{if(v===S)return C?NaN:1/0*(D?-1:1);C+=Math.pow(2,m),v-=A}return(D?-1:1)*C*Math.pow(2,v-m)},s.write=function(_,g,x,m,M,L){var C,O,S=8*L-M-1,A=(1<<S)-1,b=A>>1,P=M===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=m?0:L-1,D=m?1:-1,L=g<0||g===0&&1/g<0?1:0;for(g=Math.abs(g),isNaN(g)||g===1/0?(O=isNaN(g)?1:0,C=A):(C=Math.floor(Math.log(g)/Math.LN2),g*(m=Math.pow(2,-C))<1&&(C--,m*=2),2<=(g+=1<=C+b?P/m:P*Math.pow(2,1-b))*m&&(C++,m/=2),A<=C+b?(O=0,C=A):1<=C+b?(O=(g*m-1)*Math.pow(2,M),C+=b):(O=g*Math.pow(2,b-1)*Math.pow(2,M),C=0));8<=M;_[x+w]=255&O,w+=D,O/=256,M-=8);for(C=C<<M|O,S+=M;0<S;_[x+w]=255&C,w+=D,C/=256,S-=8);_[x+w-D]|=128*L}}).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,s){(function(r,i,a,c,h,d,f,y,p){var _,g,x;function m(){}(r=n.exports={}).nextTick=(g=typeof window<"u"&&window.setImmediate,x=typeof window<"u"&&window.postMessage&&window.addEventListener,g?function(M){return window.setImmediate(M)}:x?(_=[],window.addEventListener("message",function(M){var v=M.source;v!==window&&v!==null||M.data!=="process-tick"||(M.stopPropagation(),0<_.length&&_.shift()())},!0),function(M){_.push(M),window.postMessage("process-tick","*")}):function(M){setTimeout(M,0)}),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.binding=function(M){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(M){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)})})(Ti);var Au=Ti.exports;const Cu=dn(Au);var Ii=["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"],Pu=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],Oi=["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"],Tu=Ii,Iu=Tu.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"]),Us=Oi;Us=Us.slice().filter(function(o){return!/^(gl\_|texture)/.test(o)});var Ou=Us.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"]),Du=Gu,Lu=Ii,Di=Pu,Bu=Oi,ku=Iu,Fu=Ou,st=999,Li=9999,Ns=0,zs=1,Bi=2,ki=3,Fi=4,pn=5,Uu=6,Nu=7,zu=8,Ui=9,Vu=10,Ni=11,Ru=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function Gu(o){var e=0,t=0,n=st,s,r,i=[],a=[],c=1,h=0,d=0,f=!1,y=!1,p="",_;o=o||{};var g=Bu,x=Lu;o.version==="300 es"&&(g=Fu,x=ku);for(var m={},M={},e=0;e<g.length;e++)m[g[e]]=!0;for(var e=0;e<x.length;e++)M[x[e]]=!0;return function($){return a=[],$!==null?C($):O()};function v($){$.length&&a.push({type:Ru[n],data:$,position:d,line:c,column:h})}function C($){e=0,$.toString&&($=$.toString()),p+=$.replace(/\r\n/g,`
|
|
525
|
+
`)},_domwindow:function(){return P("domwindow")},_bigint:function(w){return P("bigint:"+w.toString())},_process:function(){return P("process")},_timer:function(){return P("timer")},_pipe:function(){return P("pipe")},_tcp:function(){return P("tcp")},_udp:function(){return P("udp")},_tty:function(){return P("tty")},_statwatcher:function(){return P("statwatcher")},_securecontext:function(){return P("securecontext")},_connection:function(){return P("connection")},_zlib:function(){return P("zlib")},_context:function(){return P("context")},_nodescript:function(){return P("nodescript")},_httpparser:function(){return P("httpparser")},_dataview:function(){return P("dataview")},_signal:function(){return P("signal")},_fsevent:function(){return P("fsevent")},_tlswrap:function(){return P("tlswrap")}}}function O(){return{buf:"",write:function(S){this.buf+=S},end:function(S){this.buf+=S},read:function(){return this.buf}}}s.writeToStream=function(S,A,b){return b===void 0&&(b=A,A={}),C(A=M(S,A),b).dispatch(S)}}).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,s){(function(r,i,a,c,h,d,f,g,p){(function(_){var y=typeof Uint8Array<"u"?Uint8Array:Array,x=43,m=47,M=48,v=97,C=65,O=45,S=95;function A(b){return b=b.charCodeAt(0),b===x||b===O?62:b===m||b===S?63:b<M?-1:b<M+10?b-M+26+26:b<C+26?b-C:b<v+26?b-v+26:void 0}_.toByteArray=function(b){var P,w;if(0<b.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var D=b.length,D=b.charAt(D-2)==="="?2:b.charAt(D-1)==="="?1:0,L=new y(3*b.length/4-D),V=0<D?b.length-4:b.length,R=0;function Y(W){L[R++]=W}for(P=0;P<V;P+=4,0)Y((16711680&(w=A(b.charAt(P))<<18|A(b.charAt(P+1))<<12|A(b.charAt(P+2))<<6|A(b.charAt(P+3))))>>16),Y((65280&w)>>8),Y(255&w);return D==2?Y(255&(w=A(b.charAt(P))<<2|A(b.charAt(P+1))>>4)):D==1&&(Y((w=A(b.charAt(P))<<10|A(b.charAt(P+1))<<4|A(b.charAt(P+2))>>2)>>8&255),Y(255&w)),L},_.fromByteArray=function(b){var P,w,D,L,V=b.length%3,R="";function Y(W){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(W)}for(P=0,D=b.length-V;P<D;P+=3)w=(b[P]<<16)+(b[P+1]<<8)+b[P+2],R+=Y((L=w)>>18&63)+Y(L>>12&63)+Y(L>>6&63)+Y(63&L);switch(V){case 1:R=(R+=Y((w=b[b.length-1])>>2))+Y(w<<4&63)+"==";break;case 2:R=(R=(R+=Y((w=(b[b.length-2]<<8)+b[b.length-1])>>10))+Y(w>>4&63))+Y(w<<2&63)+"="}return R}})(s===void 0?this.base64js={}:s)}).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,s){(function(r,i,x,c,h,d,f,g,p){var _=t("base64-js"),y=t("ieee754");function x(T,I,U){if(!(this instanceof x))return new x(T,I,U);var Z,j,E,J,se=typeof T;if(I==="base64"&&se=="string")for(T=(J=T).trim?J.trim():J.replace(/^\s+|\s+$/g,"");T.length%4!=0;)T+="=";if(se=="number")Z=q(T);else if(se=="string")Z=x.byteLength(T,I);else{if(se!="object")throw new Error("First argument needs to be a number, array or string.");Z=q(T.length)}if(x._useTypedArrays?j=x._augment(new Uint8Array(Z)):((j=this).length=Z,j._isBuffer=!0),x._useTypedArrays&&typeof T.byteLength=="number")j._set(T);else if(ne(J=T)||x.isBuffer(J)||J&&typeof J=="object"&&typeof J.length=="number")for(E=0;E<Z;E++)x.isBuffer(T)?j[E]=T.readUInt8(E):j[E]=T[E];else if(se=="string")j.write(T,0,I);else if(se=="number"&&!x._useTypedArrays&&!U)for(E=0;E<Z;E++)j[E]=0;return j}function m(T,I,U,Z){return x._charsWritten=me(function(j){for(var E=[],J=0;J<j.length;J++)E.push(255&j.charCodeAt(J));return E}(I),T,U,Z)}function M(T,I,U,Z){return x._charsWritten=me(function(j){for(var E,J,se=[],ie=0;ie<j.length;ie++)J=j.charCodeAt(ie),E=J>>8,J=J%256,se.push(J),se.push(E);return se}(I),T,U,Z)}function v(T,I,U){var Z="";U=Math.min(T.length,U);for(var j=I;j<U;j++)Z+=String.fromCharCode(T[j]);return Z}function C(T,I,U,E){E||(G(typeof U=="boolean","missing or invalid endian"),G(I!=null,"missing offset"),G(I+1<T.length,"Trying to read beyond buffer length"));var j,E=T.length;if(!(E<=I))return U?(j=T[I],I+1<E&&(j|=T[I+1]<<8)):(j=T[I]<<8,I+1<E&&(j|=T[I+1])),j}function O(T,I,U,E){E||(G(typeof U=="boolean","missing or invalid endian"),G(I!=null,"missing offset"),G(I+3<T.length,"Trying to read beyond buffer length"));var j,E=T.length;if(!(E<=I))return U?(I+2<E&&(j=T[I+2]<<16),I+1<E&&(j|=T[I+1]<<8),j|=T[I],I+3<E&&(j+=T[I+3]<<24>>>0)):(I+1<E&&(j=T[I+1]<<16),I+2<E&&(j|=T[I+2]<<8),I+3<E&&(j|=T[I+3]),j+=T[I]<<24>>>0),j}function S(T,I,U,Z){if(Z||(G(typeof U=="boolean","missing or invalid endian"),G(I!=null,"missing offset"),G(I+1<T.length,"Trying to read beyond buffer length")),!(T.length<=I))return Z=C(T,I,U,!0),32768&Z?-1*(65535-Z+1):Z}function A(T,I,U,Z){if(Z||(G(typeof U=="boolean","missing or invalid endian"),G(I!=null,"missing offset"),G(I+3<T.length,"Trying to read beyond buffer length")),!(T.length<=I))return Z=O(T,I,U,!0),2147483648&Z?-1*(4294967295-Z+1):Z}function b(T,I,U,Z){return Z||(G(typeof U=="boolean","missing or invalid endian"),G(I+3<T.length,"Trying to read beyond buffer length")),y.read(T,I,U,23,4)}function P(T,I,U,Z){return Z||(G(typeof U=="boolean","missing or invalid endian"),G(I+7<T.length,"Trying to read beyond buffer length")),y.read(T,I,U,52,8)}function w(T,I,U,Z,j){if(j||(G(I!=null,"missing value"),G(typeof Z=="boolean","missing or invalid endian"),G(U!=null,"missing offset"),G(U+1<T.length,"trying to write beyond buffer length"),z(I,65535)),j=T.length,!(j<=U))for(var E=0,J=Math.min(j-U,2);E<J;E++)T[U+E]=(I&255<<8*(Z?E:1-E))>>>8*(Z?E:1-E)}function D(T,I,U,Z,j){if(j||(G(I!=null,"missing value"),G(typeof Z=="boolean","missing or invalid endian"),G(U!=null,"missing offset"),G(U+3<T.length,"trying to write beyond buffer length"),z(I,4294967295)),j=T.length,!(j<=U))for(var E=0,J=Math.min(j-U,4);E<J;E++)T[U+E]=I>>>8*(Z?E:3-E)&255}function L(T,I,U,Z,j){j||(G(I!=null,"missing value"),G(typeof Z=="boolean","missing or invalid endian"),G(U!=null,"missing offset"),G(U+1<T.length,"Trying to write beyond buffer length"),F(I,32767,-32768)),T.length<=U||w(T,0<=I?I:65535+I+1,U,Z,j)}function V(T,I,U,Z,j){j||(G(I!=null,"missing value"),G(typeof Z=="boolean","missing or invalid endian"),G(U!=null,"missing offset"),G(U+3<T.length,"Trying to write beyond buffer length"),F(I,2147483647,-2147483648)),T.length<=U||D(T,0<=I?I:4294967295+I+1,U,Z,j)}function R(T,I,U,Z,j){j||(G(I!=null,"missing value"),G(typeof Z=="boolean","missing or invalid endian"),G(U!=null,"missing offset"),G(U+3<T.length,"Trying to write beyond buffer length"),k(I,34028234663852886e22,-34028234663852886e22)),T.length<=U||y.write(T,I,U,Z,23,4)}function Y(T,I,U,Z,j){j||(G(I!=null,"missing value"),G(typeof Z=="boolean","missing or invalid endian"),G(U!=null,"missing offset"),G(U+7<T.length,"Trying to write beyond buffer length"),k(I,17976931348623157e292,-17976931348623157e292)),T.length<=U||y.write(T,I,U,Z,52,8)}s.Buffer=x,s.SlowBuffer=x,s.INSPECT_MAX_BYTES=50,x.poolSize=8192,x._useTypedArrays=function(){try{var T=new ArrayBuffer(0),I=new Uint8Array(T);return I.foo=function(){return 42},I.foo()===42&&typeof I.subarray=="function"}catch{return!1}}(),x.isEncoding=function(T){switch(String(T).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}},x.isBuffer=function(T){return!(T==null||!T._isBuffer)},x.byteLength=function(T,I){var U;switch(T+="",I||"utf8"){case"hex":U=T.length/2;break;case"utf8":case"utf-8":U=ce(T).length;break;case"ascii":case"binary":case"raw":U=T.length;break;case"base64":U=le(T).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":U=2*T.length;break;default:throw new Error("Unknown encoding")}return U},x.concat=function(T,I){if(G(ne(T),`Usage: Buffer.concat(list, [totalLength])
|
|
526
|
+
list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T[0];if(typeof I!="number")for(j=I=0;j<T.length;j++)I+=T[j].length;for(var U=new x(I),Z=0,j=0;j<T.length;j++){var E=T[j];E.copy(U,Z),Z+=E.length}return U},x.prototype.write=function(T,I,U,Z){isFinite(I)?isFinite(U)||(Z=U,U=void 0):(ie=Z,Z=I,I=U,U=ie),I=Number(I)||0;var j,E,J,se,ie=this.length-I;switch((!U||ie<(U=Number(U)))&&(U=ie),Z=String(Z||"utf8").toLowerCase()){case"hex":j=function(X,N,ae,he){ae=Number(ae)||0;var _e=X.length-ae;(!he||_e<(he=Number(he)))&&(he=_e),G((_e=N.length)%2==0,"Invalid hex string"),_e/2<he&&(he=_e/2);for(var Ie=0;Ie<he;Ie++){var Oe=parseInt(N.substr(2*Ie,2),16);G(!isNaN(Oe),"Invalid hex string"),X[ae+Ie]=Oe}return x._charsWritten=2*Ie,Ie}(this,T,I,U);break;case"utf8":case"utf-8":E=this,J=I,se=U,j=x._charsWritten=me(ce(T),E,J,se);break;case"ascii":case"binary":j=m(this,T,I,U);break;case"base64":E=this,J=I,se=U,j=x._charsWritten=me(le(T),E,J,se);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":j=M(this,T,I,U);break;default:throw new Error("Unknown encoding")}return j},x.prototype.toString=function(T,I,U){var Z,j,E,J,se=this;if(T=String(T||"utf8").toLowerCase(),I=Number(I)||0,(U=U!==void 0?Number(U):se.length)===I)return"";switch(T){case"hex":Z=function(ie,X,N){var ae=ie.length;(!X||X<0)&&(X=0),(!N||N<0||ae<N)&&(N=ae);for(var he="",_e=X;_e<N;_e++)he+=te(ie[_e]);return he}(se,I,U);break;case"utf8":case"utf-8":Z=function(ie,X,N){var ae="",he="";N=Math.min(ie.length,N);for(var _e=X;_e<N;_e++)ie[_e]<=127?(ae+=B(he)+String.fromCharCode(ie[_e]),he=""):he+="%"+ie[_e].toString(16);return ae+B(he)}(se,I,U);break;case"ascii":case"binary":Z=v(se,I,U);break;case"base64":j=se,J=U,Z=(E=I)===0&&J===j.length?_.fromByteArray(j):_.fromByteArray(j.slice(E,J));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":Z=function(ie,X,N){for(var ae=ie.slice(X,N),he="",_e=0;_e<ae.length;_e+=2)he+=String.fromCharCode(ae[_e]+256*ae[_e+1]);return he}(se,I,U);break;default:throw new Error("Unknown encoding")}return Z},x.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},x.prototype.copy=function(T,I,U,Z){if(I=I||0,(Z=Z||Z===0?Z:this.length)!==(U=U||0)&&T.length!==0&&this.length!==0){G(U<=Z,"sourceEnd < sourceStart"),G(0<=I&&I<T.length,"targetStart out of bounds"),G(0<=U&&U<this.length,"sourceStart out of bounds"),G(0<=Z&&Z<=this.length,"sourceEnd out of bounds"),Z>this.length&&(Z=this.length);var j=(Z=T.length-I<Z-U?T.length-I+U:Z)-U;if(j<100||!x._useTypedArrays)for(var E=0;E<j;E++)T[E+I]=this[E+U];else T._set(this.subarray(U,U+j),I)}},x.prototype.slice=function(T,I){var U=this.length;if(T=$(T,U,0),I=$(I,U,U),x._useTypedArrays)return x._augment(this.subarray(T,I));for(var Z=I-T,j=new x(Z,void 0,!0),E=0;E<Z;E++)j[E]=this[E+T];return j},x.prototype.get=function(T){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(T)},x.prototype.set=function(T,I){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(T,I)},x.prototype.readUInt8=function(T,I){if(I||(G(T!=null,"missing offset"),G(T<this.length,"Trying to read beyond buffer length")),!(T>=this.length))return this[T]},x.prototype.readUInt16LE=function(T,I){return C(this,T,!0,I)},x.prototype.readUInt16BE=function(T,I){return C(this,T,!1,I)},x.prototype.readUInt32LE=function(T,I){return O(this,T,!0,I)},x.prototype.readUInt32BE=function(T,I){return O(this,T,!1,I)},x.prototype.readInt8=function(T,I){if(I||(G(T!=null,"missing offset"),G(T<this.length,"Trying to read beyond buffer length")),!(T>=this.length))return 128&this[T]?-1*(255-this[T]+1):this[T]},x.prototype.readInt16LE=function(T,I){return S(this,T,!0,I)},x.prototype.readInt16BE=function(T,I){return S(this,T,!1,I)},x.prototype.readInt32LE=function(T,I){return A(this,T,!0,I)},x.prototype.readInt32BE=function(T,I){return A(this,T,!1,I)},x.prototype.readFloatLE=function(T,I){return b(this,T,!0,I)},x.prototype.readFloatBE=function(T,I){return b(this,T,!1,I)},x.prototype.readDoubleLE=function(T,I){return P(this,T,!0,I)},x.prototype.readDoubleBE=function(T,I){return P(this,T,!1,I)},x.prototype.writeUInt8=function(T,I,U){U||(G(T!=null,"missing value"),G(I!=null,"missing offset"),G(I<this.length,"trying to write beyond buffer length"),z(T,255)),I>=this.length||(this[I]=T)},x.prototype.writeUInt16LE=function(T,I,U){w(this,T,I,!0,U)},x.prototype.writeUInt16BE=function(T,I,U){w(this,T,I,!1,U)},x.prototype.writeUInt32LE=function(T,I,U){D(this,T,I,!0,U)},x.prototype.writeUInt32BE=function(T,I,U){D(this,T,I,!1,U)},x.prototype.writeInt8=function(T,I,U){U||(G(T!=null,"missing value"),G(I!=null,"missing offset"),G(I<this.length,"Trying to write beyond buffer length"),F(T,127,-128)),I>=this.length||(0<=T?this.writeUInt8(T,I,U):this.writeUInt8(255+T+1,I,U))},x.prototype.writeInt16LE=function(T,I,U){L(this,T,I,!0,U)},x.prototype.writeInt16BE=function(T,I,U){L(this,T,I,!1,U)},x.prototype.writeInt32LE=function(T,I,U){V(this,T,I,!0,U)},x.prototype.writeInt32BE=function(T,I,U){V(this,T,I,!1,U)},x.prototype.writeFloatLE=function(T,I,U){R(this,T,I,!0,U)},x.prototype.writeFloatBE=function(T,I,U){R(this,T,I,!1,U)},x.prototype.writeDoubleLE=function(T,I,U){Y(this,T,I,!0,U)},x.prototype.writeDoubleBE=function(T,I,U){Y(this,T,I,!1,U)},x.prototype.fill=function(T,I,U){if(I=I||0,U=U||this.length,G(typeof(T=typeof(T=T||0)=="string"?T.charCodeAt(0):T)=="number"&&!isNaN(T),"value is not a number"),G(I<=U,"end < start"),U!==I&&this.length!==0){G(0<=I&&I<this.length,"start out of bounds"),G(0<=U&&U<=this.length,"end out of bounds");for(var Z=I;Z<U;Z++)this[Z]=T}},x.prototype.inspect=function(){for(var T=[],I=this.length,U=0;U<I;U++)if(T[U]=te(this[U]),U===s.INSPECT_MAX_BYTES){T[U+1]="...";break}return"<Buffer "+T.join(" ")+">"},x.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(x._useTypedArrays)return new x(this).buffer;for(var T=new Uint8Array(this.length),I=0,U=T.length;I<U;I+=1)T[I]=this[I];return T.buffer};var W=x.prototype;function $(T,I,U){return typeof T!="number"?U:I<=(T=~~T)?I:0<=T||0<=(T+=I)?T:0}function q(T){return(T=~~Math.ceil(+T))<0?0:T}function ne(T){return(Array.isArray||function(I){return Object.prototype.toString.call(I)==="[object Array]"})(T)}function te(T){return T<16?"0"+T.toString(16):T.toString(16)}function ce(T){for(var I=[],U=0;U<T.length;U++){var Z=T.charCodeAt(U);if(Z<=127)I.push(T.charCodeAt(U));else for(var j=U,E=(55296<=Z&&Z<=57343&&U++,encodeURIComponent(T.slice(j,U+1)).substr(1).split("%")),J=0;J<E.length;J++)I.push(parseInt(E[J],16))}return I}function le(T){return _.toByteArray(T)}function me(T,I,U,Z){for(var j=0;j<Z&&!(j+U>=I.length||j>=T.length);j++)I[j+U]=T[j];return j}function B(T){try{return decodeURIComponent(T)}catch{return"�"}}function z(T,I){G(typeof T=="number","cannot write a non-number as a number"),G(0<=T,"specified a negative value for writing an unsigned value"),G(T<=I,"value is larger than maximum value for type"),G(Math.floor(T)===T,"value has a fractional component")}function F(T,I,U){G(typeof T=="number","cannot write a non-number as a number"),G(T<=I,"value larger than maximum allowed value"),G(U<=T,"value smaller than minimum allowed value"),G(Math.floor(T)===T,"value has a fractional component")}function k(T,I,U){G(typeof T=="number","cannot write a non-number as a number"),G(T<=I,"value larger than maximum allowed value"),G(U<=T,"value smaller than minimum allowed value")}function G(T,I){if(!T)throw new Error(I||"Failed assertion")}x._augment=function(T){return T._isBuffer=!0,T._get=T.get,T._set=T.set,T.get=W.get,T.set=W.set,T.write=W.write,T.toString=W.toString,T.toLocaleString=W.toString,T.toJSON=W.toJSON,T.copy=W.copy,T.slice=W.slice,T.readUInt8=W.readUInt8,T.readUInt16LE=W.readUInt16LE,T.readUInt16BE=W.readUInt16BE,T.readUInt32LE=W.readUInt32LE,T.readUInt32BE=W.readUInt32BE,T.readInt8=W.readInt8,T.readInt16LE=W.readInt16LE,T.readInt16BE=W.readInt16BE,T.readInt32LE=W.readInt32LE,T.readInt32BE=W.readInt32BE,T.readFloatLE=W.readFloatLE,T.readFloatBE=W.readFloatBE,T.readDoubleLE=W.readDoubleLE,T.readDoubleBE=W.readDoubleBE,T.writeUInt8=W.writeUInt8,T.writeUInt16LE=W.writeUInt16LE,T.writeUInt16BE=W.writeUInt16BE,T.writeUInt32LE=W.writeUInt32LE,T.writeUInt32BE=W.writeUInt32BE,T.writeInt8=W.writeInt8,T.writeInt16LE=W.writeInt16LE,T.writeInt16BE=W.writeInt16BE,T.writeInt32LE=W.writeInt32LE,T.writeInt32BE=W.writeInt32BE,T.writeFloatLE=W.writeFloatLE,T.writeFloatBE=W.writeFloatBE,T.writeDoubleLE=W.writeDoubleLE,T.writeDoubleBE=W.writeDoubleBE,T.fill=W.fill,T.inspect=W.inspect,T.toArrayBuffer=W.toArrayBuffer,T}}).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,s){(function(r,i,_,c,h,d,f,g,p){var _=t("buffer").Buffer,y=4,x=new _(y);x.fill(0),n.exports={hash:function(m,M,v,C){for(var O=M(function(w,D){w.length%y!=0&&(L=w.length+(y-w.length%y),w=_.concat([w,x],L));for(var L,V=[],R=D?w.readInt32BE:w.readInt32LE,Y=0;Y<w.length;Y+=y)V.push(R.call(w,Y));return V}(m=_.isBuffer(m)?m:new _(m),C),8*m.length),M=C,S=new _(v),A=M?S.writeInt32BE:S.writeInt32LE,b=0;b<O.length;b++)A.call(S,O[b],4*b,!0);return S}}}).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,s){(function(r,i,_,c,h,d,f,g,p){var _=t("buffer").Buffer,y=t("./sha"),x=t("./sha256"),m=t("./rng"),M={sha1:y,sha256:x,md5:t("./md5")},v=64,C=new _(v);function O(w,D){var L=M[w=w||"sha1"],V=[];return L||S("algorithm:",w,"is not yet supported"),{update:function(R){return _.isBuffer(R)||(R=new _(R)),V.push(R),R.length,this},digest:function(R){var Y=_.concat(V),Y=D?function(W,$,q){_.isBuffer($)||($=new _($)),_.isBuffer(q)||(q=new _(q)),$.length>v?$=W($):$.length<v&&($=_.concat([$,C],v));for(var ne=new _(v),te=new _(v),ce=0;ce<v;ce++)ne[ce]=54^$[ce],te[ce]=92^$[ce];return q=W(_.concat([ne,q])),W(_.concat([te,q]))}(L,D,Y):L(Y);return V=null,R?Y.toString(R):Y}}}function S(){var w=[].slice.call(arguments).join(" ");throw new Error([w,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
527
|
+
`))}C.fill(0),s.createHash=function(w){return O(w)},s.createHmac=O,s.randomBytes=function(w,D){if(!D||!D.call)return new _(m(w));try{D.call(this,void 0,new _(m(w)))}catch(L){D(L)}};var A,b=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],P=function(w){s[w]=function(){S("sorry,",w,"is not implemented yet")}};for(A in b)P(b[A])}).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,s){(function(r,i,a,c,h,d,f,g,p){var _=t("./helpers");function y(S,A){S[A>>5]|=128<<A%32,S[14+(A+64>>>9<<4)]=A;for(var b=1732584193,P=-271733879,w=-1732584194,D=271733878,L=0;L<S.length;L+=16){var V=b,R=P,Y=w,W=D,b=m(b,P,w,D,S[L+0],7,-680876936),D=m(D,b,P,w,S[L+1],12,-389564586),w=m(w,D,b,P,S[L+2],17,606105819),P=m(P,w,D,b,S[L+3],22,-1044525330);b=m(b,P,w,D,S[L+4],7,-176418897),D=m(D,b,P,w,S[L+5],12,1200080426),w=m(w,D,b,P,S[L+6],17,-1473231341),P=m(P,w,D,b,S[L+7],22,-45705983),b=m(b,P,w,D,S[L+8],7,1770035416),D=m(D,b,P,w,S[L+9],12,-1958414417),w=m(w,D,b,P,S[L+10],17,-42063),P=m(P,w,D,b,S[L+11],22,-1990404162),b=m(b,P,w,D,S[L+12],7,1804603682),D=m(D,b,P,w,S[L+13],12,-40341101),w=m(w,D,b,P,S[L+14],17,-1502002290),b=M(b,P=m(P,w,D,b,S[L+15],22,1236535329),w,D,S[L+1],5,-165796510),D=M(D,b,P,w,S[L+6],9,-1069501632),w=M(w,D,b,P,S[L+11],14,643717713),P=M(P,w,D,b,S[L+0],20,-373897302),b=M(b,P,w,D,S[L+5],5,-701558691),D=M(D,b,P,w,S[L+10],9,38016083),w=M(w,D,b,P,S[L+15],14,-660478335),P=M(P,w,D,b,S[L+4],20,-405537848),b=M(b,P,w,D,S[L+9],5,568446438),D=M(D,b,P,w,S[L+14],9,-1019803690),w=M(w,D,b,P,S[L+3],14,-187363961),P=M(P,w,D,b,S[L+8],20,1163531501),b=M(b,P,w,D,S[L+13],5,-1444681467),D=M(D,b,P,w,S[L+2],9,-51403784),w=M(w,D,b,P,S[L+7],14,1735328473),b=v(b,P=M(P,w,D,b,S[L+12],20,-1926607734),w,D,S[L+5],4,-378558),D=v(D,b,P,w,S[L+8],11,-2022574463),w=v(w,D,b,P,S[L+11],16,1839030562),P=v(P,w,D,b,S[L+14],23,-35309556),b=v(b,P,w,D,S[L+1],4,-1530992060),D=v(D,b,P,w,S[L+4],11,1272893353),w=v(w,D,b,P,S[L+7],16,-155497632),P=v(P,w,D,b,S[L+10],23,-1094730640),b=v(b,P,w,D,S[L+13],4,681279174),D=v(D,b,P,w,S[L+0],11,-358537222),w=v(w,D,b,P,S[L+3],16,-722521979),P=v(P,w,D,b,S[L+6],23,76029189),b=v(b,P,w,D,S[L+9],4,-640364487),D=v(D,b,P,w,S[L+12],11,-421815835),w=v(w,D,b,P,S[L+15],16,530742520),b=C(b,P=v(P,w,D,b,S[L+2],23,-995338651),w,D,S[L+0],6,-198630844),D=C(D,b,P,w,S[L+7],10,1126891415),w=C(w,D,b,P,S[L+14],15,-1416354905),P=C(P,w,D,b,S[L+5],21,-57434055),b=C(b,P,w,D,S[L+12],6,1700485571),D=C(D,b,P,w,S[L+3],10,-1894986606),w=C(w,D,b,P,S[L+10],15,-1051523),P=C(P,w,D,b,S[L+1],21,-2054922799),b=C(b,P,w,D,S[L+8],6,1873313359),D=C(D,b,P,w,S[L+15],10,-30611744),w=C(w,D,b,P,S[L+6],15,-1560198380),P=C(P,w,D,b,S[L+13],21,1309151649),b=C(b,P,w,D,S[L+4],6,-145523070),D=C(D,b,P,w,S[L+11],10,-1120210379),w=C(w,D,b,P,S[L+2],15,718787259),P=C(P,w,D,b,S[L+9],21,-343485551),b=O(b,V),P=O(P,R),w=O(w,Y),D=O(D,W)}return Array(b,P,w,D)}function x(S,A,b,P,w,D){return O((A=O(O(A,S),O(P,D)))<<w|A>>>32-w,b)}function m(S,A,b,P,w,D,L){return x(A&b|~A&P,S,A,w,D,L)}function M(S,A,b,P,w,D,L){return x(A&P|b&~P,S,A,w,D,L)}function v(S,A,b,P,w,D,L){return x(A^b^P,S,A,w,D,L)}function C(S,A,b,P,w,D,L){return x(b^(A|~P),S,A,w,D,L)}function O(S,A){var b=(65535&S)+(65535&A);return(S>>16)+(A>>16)+(b>>16)<<16|65535&b}n.exports=function(S){return _.hash(S,y,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,s){(function(r,i,a,c,h,d,f,g,p){n.exports=function(_){for(var y,x=new Array(_),m=0;m<_;m++)!(3&m)&&(y=4294967296*Math.random()),x[m]=y>>>((3&m)<<3)&255;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/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,n,s){(function(r,i,a,c,h,d,f,g,p){var _=t("./helpers");function y(M,v){M[v>>5]|=128<<24-v%32,M[15+(v+64>>9<<4)]=v;for(var C,O,S,A=Array(80),b=1732584193,P=-271733879,w=-1732584194,D=271733878,L=-1009589776,V=0;V<M.length;V+=16){for(var R=b,Y=P,W=w,$=D,q=L,ne=0;ne<80;ne++){A[ne]=ne<16?M[V+ne]:m(A[ne-3]^A[ne-8]^A[ne-14]^A[ne-16],1);var te=x(x(m(b,5),(te=P,O=w,S=D,(C=ne)<20?te&O|~te&S:!(C<40)&&C<60?te&O|te&S|O&S:te^O^S)),x(x(L,A[ne]),(C=ne)<20?1518500249:C<40?1859775393:C<60?-1894007588:-899497514)),L=D,D=w,w=m(P,30),P=b,b=te}b=x(b,R),P=x(P,Y),w=x(w,W),D=x(D,$),L=x(L,q)}return Array(b,P,w,D,L)}function x(M,v){var C=(65535&M)+(65535&v);return(M>>16)+(v>>16)+(C>>16)<<16|65535&C}function m(M,v){return M<<v|M>>>32-v}n.exports=function(M){return _.hash(M,y,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,s){(function(r,i,a,c,h,d,f,g,p){function _(v,C){var O=(65535&v)+(65535&C);return(v>>16)+(C>>16)+(O>>16)<<16|65535&O}function y(v,C){var O,S=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),A=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),b=new Array(64);v[C>>5]|=128<<24-C%32,v[15+(C+64>>9<<4)]=C;for(var P,w,D=0;D<v.length;D+=16){for(var L=A[0],V=A[1],R=A[2],Y=A[3],W=A[4],$=A[5],q=A[6],ne=A[7],te=0;te<64;te++)b[te]=te<16?v[te+D]:_(_(_((w=b[te-2],m(w,17)^m(w,19)^M(w,10)),b[te-7]),(w=b[te-15],m(w,7)^m(w,18)^M(w,3))),b[te-16]),O=_(_(_(_(ne,m(w=W,6)^m(w,11)^m(w,25)),W&$^~W&q),S[te]),b[te]),P=_(m(P=L,2)^m(P,13)^m(P,22),L&V^L&R^V&R),ne=q,q=$,$=W,W=_(Y,O),Y=R,R=V,V=L,L=_(O,P);A[0]=_(L,A[0]),A[1]=_(V,A[1]),A[2]=_(R,A[2]),A[3]=_(Y,A[3]),A[4]=_(W,A[4]),A[5]=_($,A[5]),A[6]=_(q,A[6]),A[7]=_(ne,A[7])}return A}var x=t("./helpers"),m=function(v,C){return v>>>C|v<<32-C},M=function(v,C){return v>>>C};n.exports=function(v){return x.hash(v,y,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,s){(function(r,i,a,c,h,d,f,g,p){s.read=function(_,y,x,m,D){var v,C,O=8*D-m-1,S=(1<<O)-1,A=S>>1,b=-7,P=x?D-1:0,w=x?-1:1,D=_[y+P];for(P+=w,v=D&(1<<-b)-1,D>>=-b,b+=O;0<b;v=256*v+_[y+P],P+=w,b-=8);for(C=v&(1<<-b)-1,v>>=-b,b+=m;0<b;C=256*C+_[y+P],P+=w,b-=8);if(v===0)v=1-A;else{if(v===S)return C?NaN:1/0*(D?-1:1);C+=Math.pow(2,m),v-=A}return(D?-1:1)*C*Math.pow(2,v-m)},s.write=function(_,y,x,m,M,L){var C,O,S=8*L-M-1,A=(1<<S)-1,b=A>>1,P=M===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=m?0:L-1,D=m?1:-1,L=y<0||y===0&&1/y<0?1:0;for(y=Math.abs(y),isNaN(y)||y===1/0?(O=isNaN(y)?1:0,C=A):(C=Math.floor(Math.log(y)/Math.LN2),y*(m=Math.pow(2,-C))<1&&(C--,m*=2),2<=(y+=1<=C+b?P/m:P*Math.pow(2,1-b))*m&&(C++,m/=2),A<=C+b?(O=0,C=A):1<=C+b?(O=(y*m-1)*Math.pow(2,M),C+=b):(O=y*Math.pow(2,b-1)*Math.pow(2,M),C=0));8<=M;_[x+w]=255&O,w+=D,O/=256,M-=8);for(C=C<<M|O,S+=M;0<S;_[x+w]=255&C,w+=D,C/=256,S-=8);_[x+w-D]|=128*L}}).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,s){(function(r,i,a,c,h,d,f,g,p){var _,y,x;function m(){}(r=n.exports={}).nextTick=(y=typeof window<"u"&&window.setImmediate,x=typeof window<"u"&&window.postMessage&&window.addEventListener,y?function(M){return window.setImmediate(M)}:x?(_=[],window.addEventListener("message",function(M){var v=M.source;v!==window&&v!==null||M.data!=="process-tick"||(M.stopPropagation(),0<_.length&&_.shift()())},!0),function(M){_.push(M),window.postMessage("process-tick","*")}):function(M){setTimeout(M,0)}),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.binding=function(M){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(M){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)})})(Ti);var Tu=Ti.exports;const Iu=dn(Tu);var Ii=["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"],Ou=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],Oi=["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"],Du=Ii,Lu=Du.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"]),Us=Oi;Us=Us.slice().filter(function(o){return!/^(gl\_|texture)/.test(o)});var Bu=Us.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"]),ku=Yu,Fu=Ii,Di=Ou,Uu=Oi,Nu=Lu,zu=Bu,st=999,Li=9999,Ns=0,zs=1,Bi=2,ki=3,Fi=4,pn=5,Vu=6,Ru=7,Gu=8,Ui=9,ju=10,Ni=11,Eu=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function Yu(o){var e=0,t=0,n=st,s,r,i=[],a=[],c=1,h=0,d=0,f=!1,g=!1,p="",_;o=o||{};var y=Uu,x=Fu;o.version==="300 es"&&(y=zu,x=Nu);for(var m={},M={},e=0;e<y.length;e++)m[y[e]]=!0;for(var e=0;e<x.length;e++)M[x[e]]=!0;return function($){return a=[],$!==null?C($):O()};function v($){$.length&&a.push({type:Eu[n],data:$,position:d,line:c,column:h})}function C($){e=0,$.toString&&($=$.toString()),p+=$.replace(/\r\n/g,`
|
|
528
528
|
`),_=p.length;for(var q;s=p[e],e<_;){switch(q=e,n){case Ns:e=w();break;case zs:e=P();break;case Bi:e=b();break;case ki:e=D();break;case Fi:e=R();break;case Ni:e=V();break;case pn:e=Y();break;case Li:e=W();break;case Ui:e=A();break;case st:e=S();break}if(q!==e)switch(p[q]){case`
|
|
529
|
-
`:h=0,++c;break;default:++h;break}}return t+=e,p=p.slice(e),a}function O($){return i.length&&v(i.join("")),n=
|
|
530
|
-
`)&&r!=="\\"?(v(i.join("")),n=st,e):(i.push(s),r=s,e+1)}function P(){return b()}function w(){return s==="/"&&r==="*"?(i.push(s),v(i.join("")),n=st,e+1):(i.push(s),r=s,e+1)}function D(){if(r==="."&&/\d/.test(s))return n=pn,e;if(r==="/"&&s==="*")return n=Ns,e;if(r==="/"&&s==="/")return n=zs,e;if(s==="."&&i.length){for(;L(i););return n=pn,e}if(s===";"||s===")"||s==="("){if(i.length)for(;L(i););return v(s),n=st,e+1}var $=i.length===2&&s!=="=";if(/[\w_\d\s]/.test(s)||$){for(;L(i););return n=st,e}return i.push(s),r=s,e+1}function L($){var q=0,ne,te;do{if(ne=Di.indexOf($.slice(0,$.length+q).join("")),te=Di[ne],ne===-1){if(q--+$.length>0)continue;te=$.slice(0,1).join("")}return v(te),d+=te.length,i=i.slice(te.length),i.length}while(!0)}function V(){return/[^a-fA-F0-9]/.test(s)?(v(i.join("")),n=st,e):(i.push(s),r=s,e+1)}function R(){return s==="."||/[eE]/.test(s)?(i.push(s),n=pn,r=s,e+1):s==="x"&&i.length===1&&i[0]==="0"?(n=Ni,i.push(s),r=s,e+1):/[^\d]/.test(s)?(v(i.join("")),n=st,e):(i.push(s),r=s,e+1)}function Y(){return s==="f"&&(i.push(s),r=s,e+=1),/[eE]/.test(s)||(s==="-"||s==="+")&&/[eE]/.test(r)?(i.push(s),r=s,e+1):/[^\d]/.test(s)?(v(i.join("")),n=st,e):(i.push(s),r=s,e+1)}function W(){if(/[^\d\w_]/.test(s)){var $=i.join("");return M[$]?n=
|
|
529
|
+
`:h=0,++c;break;default:++h;break}}return t+=e,p=p.slice(e),a}function O($){return i.length&&v(i.join("")),n=ju,v("(eof)"),a}function S(){return i=i.length?[]:i,r==="/"&&s==="*"?(d=t+e-1,n=Ns,r=s,e+1):r==="/"&&s==="/"?(d=t+e-1,n=zs,r=s,e+1):s==="#"?(n=Bi,d=t+e,e):/\s/.test(s)?(n=Ui,d=t+e,e):(f=/\d/.test(s),g=/[^\w_]/.test(s),d=t+e,n=f?Fi:g?ki:Li,e)}function A(){return/[^\s]/g.test(s)?(v(i.join("")),n=st,e):(i.push(s),r=s,e+1)}function b(){return(s==="\r"||s===`
|
|
530
|
+
`)&&r!=="\\"?(v(i.join("")),n=st,e):(i.push(s),r=s,e+1)}function P(){return b()}function w(){return s==="/"&&r==="*"?(i.push(s),v(i.join("")),n=st,e+1):(i.push(s),r=s,e+1)}function D(){if(r==="."&&/\d/.test(s))return n=pn,e;if(r==="/"&&s==="*")return n=Ns,e;if(r==="/"&&s==="/")return n=zs,e;if(s==="."&&i.length){for(;L(i););return n=pn,e}if(s===";"||s===")"||s==="("){if(i.length)for(;L(i););return v(s),n=st,e+1}var $=i.length===2&&s!=="=";if(/[\w_\d\s]/.test(s)||$){for(;L(i););return n=st,e}return i.push(s),r=s,e+1}function L($){var q=0,ne,te;do{if(ne=Di.indexOf($.slice(0,$.length+q).join("")),te=Di[ne],ne===-1){if(q--+$.length>0)continue;te=$.slice(0,1).join("")}return v(te),d+=te.length,i=i.slice(te.length),i.length}while(!0)}function V(){return/[^a-fA-F0-9]/.test(s)?(v(i.join("")),n=st,e):(i.push(s),r=s,e+1)}function R(){return s==="."||/[eE]/.test(s)?(i.push(s),n=pn,r=s,e+1):s==="x"&&i.length===1&&i[0]==="0"?(n=Ni,i.push(s),r=s,e+1):/[^\d]/.test(s)?(v(i.join("")),n=st,e):(i.push(s),r=s,e+1)}function Y(){return s==="f"&&(i.push(s),r=s,e+=1),/[eE]/.test(s)||(s==="-"||s==="+")&&/[eE]/.test(r)?(i.push(s),r=s,e+1):/[^\d]/.test(s)?(v(i.join("")),n=st,e):(i.push(s),r=s,e+1)}function W(){if(/[^\d\w_]/.test(s)){var $=i.join("");return M[$]?n=Gu:m[$]?n=Ru:n=Vu,v(i.join("")),n=st,e}return i.push(s),r=s,e+1}}var Wu=ku,Xu=Zu;function Zu(o,e){var t=Wu(e),n=[];return n=n.concat(t(o)),n=n.concat(t(null)),n}const Ku=dn(Xu);var qu=Qu;function Qu(o){for(var e=[],t=0;t<o.length;t++)o[t].type!=="eof"&&e.push(o[t].data);return e.join("")}const zi=dn(qu);var Ju=Hu;function Hu(o){var e=null,t=null,n=0,s=0,r=0,i=0,a=0,c=[],h,d,f;for(h=0,d;h<o.length;h++)if(f=o[h],f.data==="{"){if(n&&n++||(d=p(h,Pt(")"),Pt()),d<0)||(i=d,d=p(d,Pt("("),Pt(")")),d<0)||(a=d,d=p(d,mn),d<0)||o[d].type!=="ident"||(t=o[d].data,d=p(d,mn),d<0))continue;n=1,s=h,e=o[d].data,r=d;var g=p(d,mn);switch(o[g]&&o[g].data){case"lowp":case"highp":case"mediump":r=g}}else if(n&&f.data==="}"){if(--n)continue;c.push({name:t,type:e,body:[s+1,h],args:[a,i+1],outer:[r,h+1]})}for(h=0;h<o.length;h++)if(f=o[h],f.data===";"){if(d=p(h,Pt(")"),Pt()),d<0||(i=d,d=p(d,Pt("("),Pt(")")),d<0)||(a=d,d=p(d,mn),d<0)||o[d].type!=="ident"||(t=o[d].data,d=p(d,mn),d<0)||o[d].type==="operator"||o[d].data==="return")continue;e=o[d].data,c.push({name:t,type:e,body:!1,args:[a,i+1],outer:[d,h+1]})}return c.sort(function(_,y){return _.outer[0]-y.outer[0]});function p(_,y,x){for(var m=_-1;m>=0;m--){if(y(o[m]))return m;if(x&&x(o[m]))return-1}return-1}}function Pt(o){return function(e){return e.type==="operator"&&(!o||e.data===o)}}function mn(o){return o.type!=="whitespace"}const $u=dn(Ju);function eh(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 Vi(o){var e=eh(o,"string");return typeof e=="symbol"?e:String(e)}function Ae(o,e,t){return e=Vi(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function Ri(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(o);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(o,s).enumerable})),t.push.apply(t,n)}return t}function Zt(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ri(Object(t),!0).forEach(function(n){Ae(o,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):Ri(Object(t)).forEach(function(n){Object.defineProperty(o,n,Object.getOwnPropertyDescriptor(t,n))})}return o}function th(o,e){if(o==null)return{};var t={},n=Object.keys(o),s,r;for(r=0;r<n.length;r++)s=n[r],!(e.indexOf(s)>=0)&&(t[s]=o[s]);return t}function nh(o,e){if(o==null)return{};var t=th(o,e),n,s;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);for(s=0;s<r.length;s++)n=r[s],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(o,n)&&(t[n]=o[n])}return t}function sh(o,e){if(!(o instanceof e))throw new TypeError("Cannot call a class as a function")}function rh(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,Vi(n.key),n)}}function ih(o,e,t){return e&&rh(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),o}function Gi(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function Vs(o,e){return Vs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},Vs(o,e)}function oh(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&&Vs(o,e)}function Vn(o){return Vn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vn(o)}function ah(){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 lh(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 Gi(o)}function ch(o){var e=ah();return function(){var n=Vn(o),s;if(e){var r=Vn(this).constructor;s=Reflect.construct(n,arguments,r)}else s=n.apply(this,arguments);return lh(this,s)}}var pe={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"},Ye,Kt,uh=(Ye={},Ae(Ye,"".concat(pe.normal),{"#include <beginnormal_vertex>":`
|
|
531
531
|
vec3 objectNormal = `.concat(pe.normal,`;
|
|
532
532
|
#ifdef USE_TANGENT
|
|
533
533
|
vec3 objectTangent = vec3( tangent.xyz );
|
|
@@ -572,7 +572,7 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
572
572
|
`),"gl_FragColor = packDepthToRGBA( fragCoordZ );":`
|
|
573
573
|
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
574
574
|
gl_FragColor.a *= `.concat(pe.depthAlpha,`;
|
|
575
|
-
`)}),Ye),
|
|
575
|
+
`)}),Ye),hh=(Kt={},Ae(Kt,"".concat(pe.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":`
|
|
576
576
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(pe.position,`, 1.0 );
|
|
577
577
|
`)}),Ae(Kt,"".concat(pe.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":`
|
|
578
578
|
gl_Position = `.concat(pe.position,`;
|
|
@@ -580,7 +580,7 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
580
580
|
gl_FragColor = `.concat(pe.diffuseColor,`;
|
|
581
581
|
`)}),Ae(Kt,"".concat(pe.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":`
|
|
582
582
|
gl_FragColor = `.concat(pe.fragColor,`;
|
|
583
|
-
`)}),Kt),
|
|
583
|
+
`)}),Kt),fh=`
|
|
584
584
|
|
|
585
585
|
#ifdef IS_VERTEX
|
|
586
586
|
// csm_Position & csm_PositionRaw
|
|
@@ -639,18 +639,18 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
639
639
|
|
|
640
640
|
float csm_DepthAlpha = 1.0;
|
|
641
641
|
#endif
|
|
642
|
-
`,
|
|
642
|
+
`,dh=`
|
|
643
643
|
varying mat4 csm_internal_vModelViewMatrix;
|
|
644
|
-
`,
|
|
644
|
+
`,ph=`
|
|
645
645
|
csm_internal_vModelViewMatrix = modelViewMatrix;
|
|
646
|
-
`,
|
|
646
|
+
`,mh=`
|
|
647
647
|
varying mat4 csm_internal_vModelViewMatrix;
|
|
648
|
-
`,
|
|
648
|
+
`,gh=`
|
|
649
649
|
|
|
650
|
-
`,We,
|
|
651
|
-
`+
|
|
650
|
+
`,We,yh=(We={},Ae(We,"".concat(pe.position),"*"),Ae(We,"".concat(pe.positionRaw),"*"),Ae(We,"".concat(pe.normal),"*"),Ae(We,"".concat(pe.pointSize),["PointsMaterial"]),Ae(We,"".concat(pe.diffuseColor),"*"),Ae(We,"".concat(pe.fragColor),"*"),Ae(We,"".concat(pe.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),Ae(We,"".concat(pe.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Ae(We,"".concat(pe.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Ae(We,"".concat(pe.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),Ae(We,"".concat(pe.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),Ae(We,"".concat(pe.depthAlpha),"*"),We),_h=["baseMaterial","fragmentShader","vertexShader","uniforms","patchMap","cacheKey","silent"],xh=function(e,t,n){return e.split(t).join(n)},vh=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},wh=function(e,t){return new RegExp("\\b".concat(vh(t),"\\b")).test(e)};function bh(o){try{new o}catch(e){if(e.message.indexOf("is not a constructor")>=0)return!1}return!0}function Mh(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(s){var r=typeof s[1].get=="function",i=typeof s[1].set=="function",a=typeof s[1].value=="function",c=s[0]==="constructor";return(r||i||a)&&!c}).forEach(function(s){if(typeof o[s[0]]=="function"){t||console.warn("Function ".concat(s[0]," already exists on CSM, renaming to base_").concat(s[0]));var r="base_".concat(s[0]);o[r]=s[1].value.bind(o);return}Object.defineProperty(o,s[0],s[1])})}function Sh(o){var e=o.toString().trim(),t=e.substring(e.indexOf("{")+1,e.lastIndexOf("}"));return t.trim().length===0}function ji(o){return o.replace(/\s/g,"")}function Ah(o,e,t){var n=o.lastIndexOf(e);return n===-1?o:o.substring(0,n)+t+o.substring(n+e.length)}var Ch=function(o){oh(t,o);var e=ch(t);function t(n){var s,r=n.baseMaterial,i=n.fragmentShader,a=n.vertexShader,c=n.uniforms,h=n.patchMap,d=n.cacheKey,f=n.silent,g=nh(n,_h);sh(this,t);var p;if(bh(r)?p=new r(g):(p=r,Object.assign(p,g)),p.type==="RawShaderMaterial")throw new Error("CustomShaderMaterial does not support RawShaderMaterial");s=e.call(this),Mh(Gi(s),p,f),s.__csm={patchMap:h||{},fragmentShader:i||"",vertexShader:a||"",cacheKey:d,baseMaterial:r,instanceID:Qs.MathUtils.generateUUID(),type:p.type,isAlreadyExtended:!Sh(p.onBeforeCompile),cacheHash:"",silent:f},s.uniforms=Zt(Zt({},s.uniforms||{}),c||{});{var _=s.__csm,y=_.fragmentShader,x=_.vertexShader,m=s.uniforms;s.__csm.cacheHash=s.getCacheHash(),s.generateMaterial(y,x,m)}return s}return ih(t,[{key:"update",value:function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.uniforms=s.uniforms||this.uniforms,Object.assign(this.__csm,s);var r=this.__csm,i=r.fragmentShader,a=r.vertexShader,c=this.uniforms,h=this.getCacheHash();this.__csm.cacheHash=h,this.generateMaterial(i,a,c)}},{key:"clone",value:function(){var s={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(s);return Object.assign(this,r),r}},{key:"getCacheHash",value:function(){var s=this.__csm,r=s.fragmentShader,i=s.vertexShader,a=this.uniforms,c=Object.values(a).reduce(function(d,f){var g=f.value;return d+JSON.stringify(g)},""),h=ji(r)+ji(i)+c;return h.trim().length>0?Iu(h):this.customProgramCacheKey()}},{key:"generateMaterial",value:function(s,r,i){var a=this,c=this.parseShader(s),h=this.parseShader(r);this.uniforms=i||{},this.customProgramCacheKey=function(){return a.__csm.cacheHash};var d=function(p){try{if(c){var _=a.patchShader(c,p.fragmentShader,!0);p.fragmentShader=a.getMaterialDefine()+_}if(h){var y=a.patchShader(h,p.vertexShader);p.vertexShader=`#define IS_VERTEX;
|
|
651
|
+
`+y,p.vertexShader=a.getMaterialDefine()+p.vertexShader}p.uniforms=Zt(Zt({},p.uniforms),a.uniforms),a.uniforms=p.uniforms}catch(x){console.error(x)}};if(this.__csm.isAlreadyExtended){var f=this.onBeforeCompile;this.onBeforeCompile=function(g,p){f(g,p),d(g)}}else this.onBeforeCompile=d;this.needsUpdate=!0}},{key:"patchShader",value:function(s,r,i){var a=this,c=r,h=Zt(Zt({},this.getPatchMapForMaterial()),this.__csm.patchMap);Object.keys(h).forEach(function(g){Object.keys(h[g]).forEach(function(p){var _=yh[g],y=a.__csm.type;if(g==="*"||wh(s.main,g))if(!_||Array.isArray(_)&&_.includes(y)||_==="*")c=xh(c,p,h[g][p]);else throw new Error("CSM: ".concat(g," is not available in ").concat(y,". Shader cannot compile."))})}),c=c.replace("void main() {",`
|
|
652
652
|
#ifndef CSM_IS_HEAD_DEFAULTS_DEFINED
|
|
653
|
-
`.concat(i?
|
|
653
|
+
`.concat(i?mh:dh,`
|
|
654
654
|
#define CSM_IS_HEAD_DEFAULTS_DEFINED 1
|
|
655
655
|
#endif
|
|
656
656
|
|
|
@@ -658,17 +658,17 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
658
658
|
|
|
659
659
|
void main() {
|
|
660
660
|
#ifndef CSM_IS_DEFAULTS_DEFINED
|
|
661
|
-
`).concat(
|
|
661
|
+
`).concat(fh,`
|
|
662
662
|
#define CSM_IS_DEFAULTS_DEFINED 1
|
|
663
663
|
#endif
|
|
664
664
|
|
|
665
665
|
#ifndef CSM_IS_MAIN_DEFAULTS_DEFINED
|
|
666
|
-
`).concat(i?
|
|
666
|
+
`).concat(i?gh:ph,`
|
|
667
667
|
#define CSM_IS_MAIN_DEFAULTS_DEFINED 1
|
|
668
668
|
#endif
|
|
669
669
|
|
|
670
670
|
// CSM_START
|
|
671
|
-
`));var d=this.__csm.isAlreadyExtended,f=c.includes("// CSM_END");return d&&f?c=
|
|
671
|
+
`));var d=this.__csm.isAlreadyExtended,f=c.includes("// CSM_END");return d&&f?c=Ah(c,"// CSM_END",`
|
|
672
672
|
// CSM_END
|
|
673
673
|
`.concat(s.main,`
|
|
674
674
|
// CSM_END
|
|
@@ -676,9 +676,9 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
676
676
|
// CSM_START
|
|
677
677
|
`.concat(s.main,`
|
|
678
678
|
// CSM_END
|
|
679
|
-
`)),c=s.defines+c,c}},{key:"parseShader",value:function(s){if(s){var r=s.replace(/\/\*\*(.*?)\*\/|\/\/(.*?)\n/gm,""),i=
|
|
679
|
+
`)),c=s.defines+c,c}},{key:"parseShader",value:function(s){if(s){var r=s.replace(/\/\*\*(.*?)\*\/|\/\/(.*?)\n/gm,""),i=Ku(r),a=$u(i),c=a.map(function(f){return f.name}).indexOf("main"),h=zi(i.slice(0,c>=0?a[c].outer[0]:void 0)),d=c>=0?this.getShaderFromIndex(i,a[c].body):"";return{defines:"",header:h,main:d}}}},{key:"getMaterialDefine",value:function(){var s=this.__csm.type;return s?"#define IS_".concat(s.toUpperCase(),`;
|
|
680
680
|
`):`#define IS_UNKNOWN;
|
|
681
|
-
`}},{key:"getPatchMapForMaterial",value:function(){switch(this.__csm.type){case"ShaderMaterial":return
|
|
681
|
+
`}},{key:"getPatchMapForMaterial",value:function(){switch(this.__csm.type){case"ShaderMaterial":return hh;default:return uh}}},{key:"getShaderFromIndex",value:function(s,r){return zi(s.slice(r[0],r[1]))}}]),t}(Qs.Material);const Ph=["args"],Th=u.defineComponent({__name:"index",props:{baseMaterial:{},vertexShader:{},fragmentShader:{},silent:{type:Boolean},uniforms:{}},setup(o,{expose:e}){const t=o,n=u.shallowRef(null),{extend:s,invalidate:r}=ee.useTresContext();return s({CustomShaderMaterial:Ch}),u.watch(t,()=>r()),e({instance:n}),(i,a)=>(u.openBlock(),u.createElementBlock("TresCustomShaderMaterial",{ref_key:"customShaderMaterialClass",ref:n,args:[t]},null,8,Ph))}}),Ih=Number.parseInt(l.REVISION.replace(/\D+/g,""));class Oh extends l.ShaderMaterial{constructor(t=new l.Vector2){super({uniforms:{inputBuffer:new l.Uniform(null),depthBuffer:new l.Uniform(null),resolution:new l.Uniform(new l.Vector2),texelSize:new l.Uniform(new l.Vector2),halfTexelSize:new l.Uniform(new l.Vector2),kernel:new l.Uniform(0),scale:new l.Uniform(1),cameraNear:new l.Uniform(0),cameraFar:new l.Uniform(1),depthEdge0:new l.Uniform(0),depthEdge1:new l.Uniform(1),depthScale:new l.Uniform(0),depthBias:new l.Uniform(.25)},fragmentShader:`#include <common>
|
|
682
682
|
#include <dithering_pars_fragment>
|
|
683
683
|
uniform sampler2D inputBuffer;
|
|
684
684
|
uniform sampler2D depthBuffer;
|
|
@@ -715,7 +715,7 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
715
715
|
|
|
716
716
|
#include <dithering_fragment>
|
|
717
717
|
#include <tonemapping_fragment>
|
|
718
|
-
#include <${
|
|
718
|
+
#include <${Ih>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
719
719
|
}`,vertexShader:`uniform vec2 texelSize;
|
|
720
720
|
uniform vec2 halfTexelSize;
|
|
721
721
|
uniform float kernel;
|
|
@@ -737,7 +737,7 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
737
737
|
vUv3 = vec2(uv.x - dUv.x, uv.y - dUv.y);
|
|
738
738
|
|
|
739
739
|
gl_Position = vec4(position.xy, 1.0, 1.0);
|
|
740
|
-
}`,blending:l.NoBlending,depthWrite:!1,depthTest:!1});ue(this,"kernel");this.toneMapped=!1,this.setTexelSize(t.x,t.y),this.kernel=new Float32Array([0,1,2,2,3])}setTexelSize(t,n){this.uniforms.texelSize.value.set(t,n),this.uniforms.halfTexelSize.value.set(t,n).multiplyScalar(.5)}setResolution(t){this.uniforms.resolution.value.copy(t)}}class
|
|
740
|
+
}`,blending:l.NoBlending,depthWrite:!1,depthTest:!1});ue(this,"kernel");this.toneMapped=!1,this.setTexelSize(t.x,t.y),this.kernel=new Float32Array([0,1,2,2,3])}setTexelSize(t,n){this.uniforms.texelSize.value.set(t,n),this.uniforms.halfTexelSize.value.set(t,n).multiplyScalar(.5)}setResolution(t){this.uniforms.resolution.value.copy(t)}}class Dh{constructor({resolution:e,width:t=500,height:n=500,depthEdge0:s=0,depthEdge1:r=1,depthScale:i=0,depthBias:a=.25}){ue(this,"renderTargetA");ue(this,"renderTargetB");ue(this,"convolutionMaterial");ue(this,"scene");ue(this,"camera");ue(this,"screen");ue(this,"renderToScreen",!1);this.renderTargetA=new l.WebGLRenderTarget(e,e,{minFilter:l.LinearFilter,magFilter:l.LinearFilter,stencilBuffer:!1,depthBuffer:!1,type:l.HalfFloatType}),this.renderTargetB=this.renderTargetA.clone(),this.convolutionMaterial=new Oh,this.convolutionMaterial.setTexelSize(1/t,1/n),this.convolutionMaterial.setResolution(new l.Vector2(t,n)),this.scene=new l.Scene,this.camera=new l.Camera,this.convolutionMaterial.uniforms.depthEdge0.value=s,this.convolutionMaterial.uniforms.depthEdge1.value=r,this.convolutionMaterial.uniforms.depthScale.value=i,this.convolutionMaterial.uniforms.depthBias.value=a,this.convolutionMaterial.defines.USE_DEPTH=i>0;const c=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),h=new Float32Array([0,0,2,0,0,2]),d=new l.BufferGeometry;d.setAttribute("position",new l.BufferAttribute(c,3)),d.setAttribute("uv",new l.BufferAttribute(h,2)),this.screen=new l.Mesh(d,this.convolutionMaterial),this.screen.frustumCulled=!1,this.scene.add(this.screen)}render(e,t,n){const s=this.scene,r=this.camera,i=this.renderTargetA,a=this.renderTargetB,c=this.convolutionMaterial,h=c.uniforms;h.depthBuffer.value=t.depthTexture;const d=c.kernel;let f=t,g,p,_;for(p=0,_=d.length-1;p<_;++p)g=p&1?a:i,h.kernel.value=d[p],h.inputBuffer.value=f.texture,e.setRenderTarget(g),e.render(s,r),f=g;h.kernel.value=d[p],h.inputBuffer.value=f.texture,e.setRenderTarget(this.renderToScreen?null:n),e.render(s,r)}dispose(){this.screen.material.dispose(),this.screen.geometry.dispose(),this.renderTargetA.dispose(),this.renderTargetB.dispose(),this.convolutionMaterial.dispose()}}class Lh extends l.MeshStandardMaterial{constructor(t={}){super(t);ue(this,"_tDepth",{value:null});ue(this,"_distortionMap",{value:null});ue(this,"_tSharp",{value:null});ue(this,"_tBlur",{value:null});ue(this,"_textureMatrix",{value:null});ue(this,"_mix",{value:.5});ue(this,"_sharpMix",{value:0});ue(this,"_blurMixSmooth",{value:0});ue(this,"_blurMixRough",{value:0});ue(this,"_sharpDepthEdgeMin",{value:.9});ue(this,"_sharpDepthEdgeMax",{value:1});ue(this,"_sharpDepthScale",{value:0});ue(this,"_sharpDepthBias",{value:0});ue(this,"_distortion",{value:1});this.setValues(t)}onBeforeCompile(t){var n;(n=t.defines)!=null&&n.USE_UV||(t.defines.USE_UV="");for(const s of Object.keys(t.defines))t.defines[s.toUpperCase()]=t.defines[s];t.uniforms.tSharp=this._tSharp,t.uniforms.tDepth=this._tDepth,t.uniforms.tBlur=this._tBlur,t.uniforms.distortionMap=this._distortionMap,t.uniforms.textureMatrix=this._textureMatrix,t.uniforms.mixMain=this._mix,t.uniforms.sharpMix=this._sharpMix,t.uniforms.sharpDepthScale=this._sharpDepthScale,t.uniforms.sharpDepthEdgeMin=this._sharpDepthEdgeMin,t.uniforms.sharpDepthEdgeMax=this._sharpDepthEdgeMax,t.uniforms.sharpDepthBias=this._sharpDepthBias,t.uniforms.blurMixSmooth=this._blurMixSmooth,t.uniforms.blurMixRough=this._blurMixRough,t.uniforms.distortion=this._distortion,t.vertexShader=`
|
|
741
741
|
uniform mat4 textureMatrix;
|
|
742
742
|
varying vec4 my_vUv;
|
|
743
743
|
${t.vertexShader}`,t.vertexShader=t.vertexShader.replace("#include <project_vertex>",`#include <project_vertex>
|
|
@@ -823,7 +823,7 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
823
823
|
#endif
|
|
824
824
|
|
|
825
825
|
#include <opaque_fragment>
|
|
826
|
-
`)}get tSharp(){return this._tSharp.value}set tSharp(t){this._tSharp.value=t}get tDepth(){return this._tDepth.value}set tDepth(t){this._tDepth.value=t}get distortionMap(){return this._distortionMap.value}set distortionMap(t){this._distortionMap.value=t}get tBlur(){return this._tBlur.value}set tBlur(t){this._tBlur.value=t}get textureMatrix(){return this._textureMatrix.value}set textureMatrix(t){this._textureMatrix.value=t}get sharpMix(){return this._sharpMix.value}set sharpMix(t){this._sharpMix.value=t}get blurMixSmooth(){return this._blurMixSmooth.value}set blurMixSmooth(t){this._blurMixSmooth.value=t}get blurMixRough(){return this._blurMixRough.value}set blurMixRough(t){this._blurMixRough.value=t}get mix(){return this._mix.value}set mix(t){this._mix.value=t}get sharpDepthScale(){return this._sharpDepthScale.value}set sharpDepthScale(t){this._sharpDepthScale.value=t}get sharpDepthBias(){return this._sharpDepthBias.value}set sharpDepthBias(t){this._sharpDepthBias.value=t}get sharpDepthEdgeMin(){return this._sharpDepthEdgeMin.value}set sharpDepthEdgeMin(t){this._sharpDepthEdgeMin.value=t}get sharpDepthEdgeMax(){return this._sharpDepthEdgeMax.value}set sharpDepthEdgeMax(t){this._sharpDepthEdgeMax.value=t}get distortion(){return this._distortion.value}set distortion(t){this._distortion.value=t}}const
|
|
826
|
+
`)}get tSharp(){return this._tSharp.value}set tSharp(t){this._tSharp.value=t}get tDepth(){return this._tDepth.value}set tDepth(t){this._tDepth.value=t}get distortionMap(){return this._distortionMap.value}set distortionMap(t){this._distortionMap.value=t}get tBlur(){return this._tBlur.value}set tBlur(t){this._tBlur.value=t}get textureMatrix(){return this._textureMatrix.value}set textureMatrix(t){this._textureMatrix.value=t}get sharpMix(){return this._sharpMix.value}set sharpMix(t){this._sharpMix.value=t}get blurMixSmooth(){return this._blurMixSmooth.value}set blurMixSmooth(t){this._blurMixSmooth.value=t}get blurMixRough(){return this._blurMixRough.value}set blurMixRough(t){this._blurMixRough.value=t}get mix(){return this._mix.value}set mix(t){this._mix.value=t}get sharpDepthScale(){return this._sharpDepthScale.value}set sharpDepthScale(t){this._sharpDepthScale.value=t}get sharpDepthBias(){return this._sharpDepthBias.value}set sharpDepthBias(t){this._sharpDepthBias.value=t}get sharpDepthEdgeMin(){return this._sharpDepthEdgeMin.value}set sharpDepthEdgeMin(t){this._sharpDepthEdgeMin.value=t}get sharpDepthEdgeMax(){return this._sharpDepthEdgeMax.value}set sharpDepthEdgeMax(t){this._sharpDepthEdgeMax.value=t}get distortion(){return this._distortion.value}set distortion(t){this._distortion.value=t}}const Bh=["texture-matrix","t-sharp","t-depth","t-blur","defines-USE_BLUR","defines-USE_DEPTH","defines-USE_DISTORTION"],kh=u.defineComponent({__name:"index",props:{resolution:{default:256},mix:{default:1},sharpMix:{default:1},sharpDepthScale:{default:1},sharpDepthBias:{default:0},sharpDepthEdgeMin:{default:0},sharpDepthEdgeMax:{default:.2},blurMixSmooth:{default:1},blurMixRough:{default:1},blurDepthScale:{default:1},blurDepthBias:{default:0},blurDepthEdgeMin:{default:0},blurDepthEdgeMax:{default:.2},blurSize:{default:()=>[0,0]},distortionMap:{},distortion:{default:0},reflectorOffset:{default:0},color:{default:()=>new l.Color(3355443)},roughness:{default:1},metalness:{default:0},map:{},lightMap:{},lightMapIntensity:{default:1},aoMap:{},aoMapIntensity:{default:1},emissive:{default:()=>new l.Color(0)},emissiveIntensity:{default:1},emissiveMap:{},bumpMap:{},bumpScale:{default:1},normalMap:{},normalMapType:{default:l.TangentSpaceNormalMap},normalScale:{default:()=>new l.Vector2(1,1)},displacementMap:{},displacementScale:{default:1},displacementBias:{default:0},roughnessMap:{default:null},metalnessMap:{},alphaMap:{},envMap:{},envMapRotation:{default:()=>new l.Euler},envMapIntensity:{default:1},wireframe:{type:Boolean,default:!1},wireframeLinewidth:{default:1},wireframeLinecap:{default:"round"},wireframeLinejoin:{default:"round"},flatShading:{type:Boolean,default:!1},fog:{type:Boolean,default:!0}},setup(o,{expose:e}){const t=o,{extend:n,invalidate:s}=ee.useTresContext();n({MeshReflectionMaterial:Lh});const r=u.computed(()=>500-(Array.isArray(t.blurSize)?t.blurSize[0]:t.blurSize)),i=u.computed(()=>500-(Array.isArray(t.blurSize)?t.blurSize[1]:t.blurSize)),a=u.computed(()=>r.value>0||i.value>0),c=u.computed(()=>t.sharpDepthScale>0||t.blurDepthScale>0),h=u.computed(()=>!!t.distortionMap),d=u.computed(()=>!!t.roughnessMap),f=u.shallowRef();let g;const p={reflectorPlane:new l.Plane,normal:new l.Vector3,reflectorWorldPosition:new l.Vector3,cameraWorldPosition:new l.Vector3,rotationMatrix:new l.Matrix4,lookAtPosition:new l.Vector3(0,0,-1),clipPlane:new l.Vector4,view:new l.Vector3,target:new l.Vector3,q:new l.Vector4,virtualCamera:new l.PerspectiveCamera,textureMatrix:new l.Matrix4},_=new l.WebGLRenderTarget(t.resolution,t.resolution,{minFilter:l.LinearFilter,magFilter:l.LinearFilter,type:l.HalfFloatType,depthBuffer:!0,depthTexture:new l.DepthTexture(t.resolution,t.resolution)}),y=new l.WebGLRenderTarget(t.resolution,t.resolution,{minFilter:l.LinearFilter,magFilter:l.LinearFilter,type:l.HalfFloatType});function x(m,M,v,C){s();const O=m.xr.enabled,S=m.shadowMap.autoUpdate;if(p.reflectorWorldPosition.setFromMatrixPosition(C.matrixWorld),p.cameraWorldPosition.setFromMatrixPosition(v.matrixWorld),p.rotationMatrix.extractRotation(C.matrixWorld),p.normal.set(0,0,1),p.normal.applyMatrix4(p.rotationMatrix),p.reflectorWorldPosition.addScaledVector(p.normal,t.reflectorOffset),p.view.subVectors(p.reflectorWorldPosition,p.cameraWorldPosition),p.view.dot(p.normal)>0)return;C.visible=!1,p.view.reflect(p.normal).negate(),p.view.add(p.reflectorWorldPosition),p.rotationMatrix.extractRotation(v.matrixWorld),p.lookAtPosition.set(0,0,-1),p.lookAtPosition.applyMatrix4(p.rotationMatrix),p.lookAtPosition.add(p.cameraWorldPosition),p.target.subVectors(p.reflectorWorldPosition,p.lookAtPosition),p.target.reflect(p.normal).negate(),p.target.add(p.reflectorWorldPosition),p.virtualCamera.position.copy(p.view),p.virtualCamera.up.set(0,1,0),p.virtualCamera.up.applyMatrix4(p.rotationMatrix),p.virtualCamera.up.reflect(p.normal),p.virtualCamera.lookAt(p.target),p.virtualCamera.far=v.far,p.virtualCamera.updateMatrixWorld(),p.virtualCamera.projectionMatrix.copy(v.projectionMatrix),p.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),p.textureMatrix.multiply(p.virtualCamera.projectionMatrix),p.textureMatrix.multiply(p.virtualCamera.matrixWorldInverse),p.textureMatrix.multiply(C.matrixWorld),p.reflectorPlane.setFromNormalAndCoplanarPoint(p.normal,p.reflectorWorldPosition),p.reflectorPlane.applyMatrix4(p.virtualCamera.matrixWorldInverse),p.clipPlane.set(p.reflectorPlane.normal.x,p.reflectorPlane.normal.y,p.reflectorPlane.normal.z,p.reflectorPlane.constant);const A=p.virtualCamera.projectionMatrix;p.q.x=(Math.sign(p.clipPlane.x)+A.elements[8])/A.elements[0],p.q.y=(Math.sign(p.clipPlane.y)+A.elements[9])/A.elements[5],p.q.z=-1,p.q.w=(1+A.elements[10])/A.elements[14],p.clipPlane.multiplyScalar(2/p.clipPlane.dot(p.q)),A.elements[2]=p.clipPlane.x,A.elements[6]=p.clipPlane.y,A.elements[10]=p.clipPlane.z+1,A.elements[14]=p.clipPlane.w,m.shadowMap.autoUpdate=!1,m.setRenderTarget(_),m.autoClear||m.clear(),m.render(M,p.virtualCamera),g.render(m,_,y),m.xr.enabled=O,m.shadowMap.autoUpdate=S,C.visible=!0,m.setRenderTarget(null)}return u.watch(()=>[t.resolution],()=>{_.setSize(t.resolution,t.resolution),y.setSize(t.resolution,t.resolution)}),u.watch(()=>[t.resolution,r.value,i.value,t.blurDepthEdgeMin,t.blurDepthEdgeMax,t.blurDepthScale,t.blurDepthBias],()=>{g==null||g.dispose(),g=new Dh({resolution:t.resolution,width:r.value,height:i.value,depthEdge0:t.blurDepthEdgeMin,depthEdge1:t.blurDepthEdgeMax,depthScale:t.blurDepthScale,depthBias:t.blurDepthBias})},{immediate:!0}),u.watch(f,()=>{f.value&&(f.value.onBeforeRender=x)}),u.watch(()=>[a.value],()=>{ee.useLogger().logWarning("MeshReflectionMaterial: Setting blurMixRough or blurMixSmooth to 0, then non-zero triggers a recompile.The TresJS core cannot currently handle recompiled materials.")}),u.watch(c,()=>{ee.useLogger().logWarning("MeshReflectionMaterial: Setting depthScale to 0, then non-zero triggers a recompile.The TresJS core cannot currently handle recompiled materials.")}),u.watch(h,()=>{ee.useLogger().logWarning("MeshReflectionMaterial: Toggling distortionMap triggers a recompile.The TresJS core cannot currently handle recompiled materials.")}),u.watch(d,()=>{ee.useLogger().logWarning("MeshReflectionMaterial: Toggling roughnessMap triggers a recompile.The TresJS core cannot currently handle recompiled materials.")}),u.watch(()=>[t.normalMap],()=>{ee.useLogger().logWarning("MeshReflectionMaterial: Toggling normalMap triggers a recompile.The TresJS core cannot currently handle recompiled materials.")}),u.onBeforeUnmount(()=>{_.dispose(),y.dispose(),g.dispose()}),ee.useLoop().onBeforeRender(({renderer:m,scene:M,camera:v,invalidate:C})=>{var S,A;const O=(A=(S=f.value)==null?void 0:S.__tres)==null?void 0:A.parent;O&&(x(m,M,v,O),C())}),e({instance:f}),(m,M)=>{var v,C,O;return u.openBlock(),u.createElementBlock("TresMeshReflectionMaterial",u.mergeProps({key:`key${a.value?"0":"1"}${c.value?"0":"1"}${h.value?"0":"1"}${d.value?"0":"1"}`,ref_key:"materialRef",ref:f},t,{"texture-matrix":p.textureMatrix,"t-sharp":(v=u.unref(_))==null?void 0:v.texture,"t-depth":(C=u.unref(_))==null?void 0:C.depthTexture,"t-blur":(O=u.unref(y))==null?void 0:O.texture,"defines-USE_BLUR":a.value?"":void 0,"defines-USE_DEPTH":c.value?"":void 0,"defines-USE_DISTORTION":h.value?"":void 0}),null,16,Bh)}}});class Ei extends l.ShaderMaterial{constructor(t={}){super();ue(this,"clock");this.vertexShader=`
|
|
827
827
|
#define STANDARD
|
|
828
828
|
varying vec3 vViewPosition;
|
|
829
829
|
#ifdef USE_TRANSMISSION
|
|
@@ -946,7 +946,7 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
946
946
|
|
|
947
947
|
gl_FragColor = vec4( finalColor, hologramOpacity);
|
|
948
948
|
|
|
949
|
-
}`,this.uniforms={time:new l.Uniform(0),fresnelOpacity:new l.Uniform(t.fresnelOpacity!==void 0?t.fresnelOpacity:1),fresnelAmount:new l.Uniform(t.fresnelAmount!==void 0?t.fresnelAmount:.45),scanlineSize:new l.Uniform(t.scanlineSize!==void 0?t.scanlineSize:8),hologramBrightness:new l.Uniform(t.hologramBrightness!==void 0?t.hologramBrightness:1),signalSpeed:new l.Uniform(t.signalSpeed!==void 0?t.signalSpeed:1),hologramColor:new l.Uniform(t.hologramColor!==void 0?new l.Color(t.hologramColor):new l.Color("#00d5ff")),enableBlinking:new l.Uniform(t.enableBlinking!==void 0?t.enableBlinking:!0),blinkFresnelOnly:new l.Uniform(t.blinkFresnelOnly!==void 0?t.blinkFresnelOnly:!0),hologramOpacity:new l.Uniform(t.hologramOpacity!==void 0?t.hologramOpacity:1)},this.clock=new l.Clock,this.setValues(t),this.depthTest=t.depthTest!==void 0?t.depthTest:!1,this.blending=t.blendMode!==void 0?t.blendMode:l.AdditiveBlending,this.transparent=!0,this.side=t.side!==void 0?t.side:l.FrontSide}update(){this.uniforms.time.value=this.clock.getElapsedTime()}}const
|
|
949
|
+
}`,this.uniforms={time:new l.Uniform(0),fresnelOpacity:new l.Uniform(t.fresnelOpacity!==void 0?t.fresnelOpacity:1),fresnelAmount:new l.Uniform(t.fresnelAmount!==void 0?t.fresnelAmount:.45),scanlineSize:new l.Uniform(t.scanlineSize!==void 0?t.scanlineSize:8),hologramBrightness:new l.Uniform(t.hologramBrightness!==void 0?t.hologramBrightness:1),signalSpeed:new l.Uniform(t.signalSpeed!==void 0?t.signalSpeed:1),hologramColor:new l.Uniform(t.hologramColor!==void 0?new l.Color(t.hologramColor):new l.Color("#00d5ff")),enableBlinking:new l.Uniform(t.enableBlinking!==void 0?t.enableBlinking:!0),blinkFresnelOnly:new l.Uniform(t.blinkFresnelOnly!==void 0?t.blinkFresnelOnly:!0),hologramOpacity:new l.Uniform(t.hologramOpacity!==void 0?t.hologramOpacity:1)},this.clock=new l.Clock,this.setValues(t),this.depthTest=t.depthTest!==void 0?t.depthTest:!1,this.blending=t.blendMode!==void 0?t.blendMode:l.AdditiveBlending,this.transparent=!0,this.side=t.side!==void 0?t.side:l.FrontSide}update(){this.uniforms.time.value=this.clock.getElapsedTime()}}const Fh=["uniforms-fresnelAmount-value","uniforms-enableBlinking-value","uniforms-fresnelOpacity-value","uniforms-hologramBrightness-value","uniforms-scanlineSize-value","uniforms-signalSpeed-value","uniforms-hologramColor-value","uniforms-hologramOpacity-value","uniforms-blinkFresnelOnly-value","enableAdditive","side"],Uh=u.defineComponent({__name:"index",props:{fresnelAmount:{default:.45},fresnelOpacity:{default:1},blinkFresnelOnly:{type:Boolean,default:!0},enableBlinking:{type:Boolean,default:!0},enableAdditive:{type:Boolean,default:!0},hologramBrightness:{default:.7},scanlineSize:{default:8},signalSpeed:{default:.45},hologramOpacity:{default:1},hologramColor:{default:"#00d5ff"},side:{default:l.FrontSide}},setup(o,{expose:e}){const t=o,n=u.shallowRef(),{extend:s}=ee.useTresContext();s({HolographicMaterial:Ei}),e({root:n,constructor:Ei});const{onBeforeRender:r}=ee.useLoop();return r(({invalidate:i})=>{var a;(a=n.value)==null||a.update(),i()}),(i,a)=>(u.openBlock(),u.createElementBlock("TresHolographicMaterial",{ref_key:"MeshHolographicMaterialClass",ref:n,"uniforms-fresnelAmount-value":t.fresnelAmount,"uniforms-enableBlinking-value":t.enableBlinking,"uniforms-fresnelOpacity-value":t.fresnelOpacity,"uniforms-hologramBrightness-value":t.hologramBrightness,"uniforms-scanlineSize-value":t.scanlineSize,"uniforms-signalSpeed-value":t.signalSpeed,"uniforms-hologramColor-value":t.hologramColor,"uniforms-hologramOpacity-value":t.hologramOpacity,"uniforms-blinkFresnelOnly-value":t.blinkFresnelOnly,enableAdditive:t.enableAdditive,side:t.side},null,8,Fh))}}),Nh=["args"],zh=["color"],Vh=u.defineComponent({__name:"Box",props:{args:{default:()=>[1,1,1]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{invalidate:n}=ee.useTresContext(),{args:s,color:r}=u.toRefs(t);u.watch(s,()=>n());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"boxRef",ref:i},a.$attrs),[u.createElementVNode("TresBoxGeometry",{args:u.unref(s)},null,8,Nh),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(r)},null,8,zh)])],16))}}),Yi=new l.Box3,Rn=new l.Vector3;class Wi extends l.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 l.Float32BufferAttribute(e,3)),this.setAttribute("uv",new l.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 l.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new l.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new l.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 l.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new l.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new l.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 l.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 l.Box3);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Yi.setFromBufferAttribute(t),this.boundingBox.union(Yi))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new l.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 r=0,i=e.count;r<i;r++)Rn.fromBufferAttribute(e,r),s=Math.max(s,n.distanceToSquared(Rn)),Rn.fromBufferAttribute(t,r),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)}}l.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new l.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},l.ShaderLib.line={uniforms:l.UniformsUtils.merge([l.UniformsLib.common,l.UniformsLib.fog,l.UniformsLib.line]),vertexShader:`
|
|
950
950
|
#include <common>
|
|
951
951
|
#include <color_pars_vertex>
|
|
952
952
|
#include <fog_pars_vertex>
|
|
@@ -1316,9 +1316,9 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
1316
1316
|
#include <premultiplied_alpha_fragment>
|
|
1317
1317
|
|
|
1318
1318
|
}
|
|
1319
|
-
`};class Rs extends l.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:l.UniformsUtils.clone(l.ShaderLib.line.uniforms),vertexShader:l.ShaderLib.line.vertexShader,fragmentShader:l.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="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const Gs=new l.Vector4,Xi=new l.Vector3,Zi=new l.Vector3,Ne=new l.Vector4,ze=new l.Vector4,ot=new l.Vector4,js=new l.Vector3,Es=new l.Matrix4,Ve=new l.Line3,Ki=new l.Vector3,Gn=new l.Box3,jn=new l.Sphere,at=new l.Vector4;let lt,Ut;function qi(o,e,t){return at.set(0,0,-e,1).applyMatrix4(o.projectionMatrix),at.multiplyScalar(1/at.w),at.x=Ut/t.width,at.y=Ut/t.height,at.applyMatrix4(o.projectionMatrixInverse),at.multiplyScalar(1/at.w),Math.abs(Math.max(at.x,at.y))}function Nh(o,e){const t=o.matrixWorld,n=o.geometry,s=n.attributes.instanceStart,r=n.attributes.instanceEnd,i=Math.min(n.instanceCount,s.count);for(let a=0,c=i;a<c;a++){Ve.start.fromBufferAttribute(s,a),Ve.end.fromBufferAttribute(r,a),Ve.applyMatrix4(t);const h=new l.Vector3,d=new l.Vector3;lt.distanceSqToSegment(Ve.start,Ve.end,d,h),d.distanceTo(h)<Ut*.5&&e.push({point:d,pointOnLine:h,distance:lt.origin.distanceTo(d),object:o,face:null,faceIndex:a,uv:null,uv1:null})}}function zh(o,e,t){const n=e.projectionMatrix,r=o.material.resolution,i=o.matrixWorld,a=o.geometry,c=a.attributes.instanceStart,h=a.attributes.instanceEnd,d=Math.min(a.instanceCount,c.count),f=-e.near;lt.at(1,ot),ot.w=1,ot.applyMatrix4(e.matrixWorldInverse),ot.applyMatrix4(n),ot.multiplyScalar(1/ot.w),ot.x*=r.x/2,ot.y*=r.y/2,ot.z=0,js.copy(ot),Es.multiplyMatrices(e.matrixWorldInverse,i);for(let y=0,p=d;y<p;y++){if(Ne.fromBufferAttribute(c,y),ze.fromBufferAttribute(h,y),Ne.w=1,ze.w=1,Ne.applyMatrix4(Es),ze.applyMatrix4(Es),Ne.z>f&&ze.z>f)continue;if(Ne.z>f){const v=Ne.z-ze.z,C=(Ne.z-f)/v;Ne.lerp(ze,C)}else if(ze.z>f){const v=ze.z-Ne.z,C=(ze.z-f)/v;ze.lerp(Ne,C)}Ne.applyMatrix4(n),ze.applyMatrix4(n),Ne.multiplyScalar(1/Ne.w),ze.multiplyScalar(1/ze.w),Ne.x*=r.x/2,Ne.y*=r.y/2,ze.x*=r.x/2,ze.y*=r.y/2,Ve.start.copy(Ne),Ve.start.z=0,Ve.end.copy(ze),Ve.end.z=0;const g=Ve.closestPointToPointParameter(js,!0);Ve.at(g,Ki);const x=l.MathUtils.lerp(Ne.z,ze.z,g),m=x>=-1&&x<=1,M=js.distanceTo(Ki)<Ut*.5;if(m&&M){Ve.start.fromBufferAttribute(c,y),Ve.end.fromBufferAttribute(h,y),Ve.start.applyMatrix4(i),Ve.end.applyMatrix4(i);const v=new l.Vector3,C=new l.Vector3;lt.distanceSqToSegment(Ve.start,Ve.end,C,v),t.push({point:C,pointOnLine:v,distance:lt.origin.distanceTo(C),object:o,face:null,faceIndex:y,uv:null,uv1:null})}}}class Vh extends l.Mesh{constructor(e=new Wi,t=new Rs({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 i=0,a=0,c=t.count;i<c;i++,a+=2)Xi.fromBufferAttribute(t,i),Zi.fromBufferAttribute(n,i),s[a]=a===0?0:s[a-1],s[a+1]=s[a]+Xi.distanceTo(Zi);const r=new l.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new l.InterleavedBufferAttribute(r,1,0)),e.setAttribute("instanceDistanceEnd",new l.InterleavedBufferAttribute(r,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 r=e.params.Line2!==void 0&&e.params.Line2.threshold||0;lt=e.ray;const i=this.matrixWorld,a=this.geometry,c=this.material;Ut=c.linewidth+r,a.boundingSphere===null&&a.computeBoundingSphere(),jn.copy(a.boundingSphere).applyMatrix4(i);let h;if(n)h=Ut*.5;else{const f=Math.max(s.near,jn.distanceToPoint(lt.origin));h=qi(s,f,c.resolution)}if(jn.radius+=h,lt.intersectsSphere(jn)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),Gn.copy(a.boundingBox).applyMatrix4(i);let d;if(n)d=Ut*.5;else{const f=Math.max(s.near,Gn.distanceToPoint(lt.origin));d=qi(s,f,c.resolution)}Gn.expandByScalar(d),lt.intersectsBox(Gn)!==!1&&(n?Nh(this,t):zh(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Gs),this.material.uniforms.resolution.value.set(Gs.z,Gs.w))}}class Qi extends Wi{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 Rh extends Vh{constructor(e=new Qi,t=new Rs({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const Gh=["object"],Ji=u.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,{expose:e}){const t=o;function n(p,_){if(!p||p.length===0)return Array.from({length:_}).fill(ee.normalizeColor(t.color));if(p.length===1)return Array.from({length:_}).fill(ee.normalizeColor(p[0]));if(p.length===_)return p.map(ee.normalizeColor);const g=_-1,x=p.map(ee.normalizeColor);closed&&x.push(x[0].clone());const m=[x[0]],M=g/(x.length-1);for(let v=1;v<g;v++){const C=v%M/M,O=Math.floor(v/M);m.push(x[O].clone().lerp(x[O+1],C))}return m.push(x[x.length-1]),m}const s=new Rs,r=new Qi,i=new Rh(r,s),{sizes:a,invalidate:c}=ee.useTresContext(),h=u.computed(()=>Array.isArray(t.vertexColors));function d(p,_){p.color=ee.normalizeColor(_.color),p.linewidth=_.lineWidth,p.alphaToCoverage=_.alphaToCoverage,p.worldUnits=_.worldUnits,p.vertexColors=Array.isArray(_.vertexColors),p.dashed=_.dashed,p.dashScale=_.dashScale,p.dashSize=_.dashSize,p.dashOffset=_.dashOffset,p.gapSize=_.gapSize,p.needsUpdate=!0}function f(p,_,g){const x=_.map(M=>M instanceof l.Vector3?[M.x,M.y,M.z]:M instanceof l.Vector2?[M.x,M.y,0]:Array.isArray(M)&&M.length===2?[M[0],M[1],0]:M).flat();p.setPositions(x.flat());const m=n(g,_.length).map(M=>M.toArray()).flat();p.setColors(m),i.computeLineDistances()}d(s,t),f(r,t.points,t.vertexColors),i.computeLineDistances(),u.watch(()=>[t.color,t.lineWidth,t.alphaToCoverage,t.worldUnits,h,t.dashed,t.dashScale,t.dashSize,t.dashOffset],()=>{d(s,t),c()}),u.watch(()=>[t.points,t.vertexColors],()=>{f(r,t.points,t.vertexColors),c()}),u.watch(()=>[a.height,a.width],()=>{s.resolution=new l.Vector2(a.width.value,a.height.value),c()}),u.onUnmounted(()=>{r.dispose(),s.dispose()});const y=u.shallowRef();return e({instance:y}),(p,_)=>(u.openBlock(),u.createElementBlock("primitive",{ref:y.value,object:u.unref(i)},null,8,Gh))}}),jh=u.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,{expose:e}){const t=o;function n(c,h,d,f){const y=c.map(p=>p instanceof l.Vector3?p:new l.Vector3(...p));return new l.CatmullRomCurve3(y,h,d,f)}function s(c,h){return c.getPoints(h)}const r=u.computed(()=>n(t.points,t.closed,t.curveType,t.tension)),i=u.computed(()=>s(r.value,t.segments)),a=u.shallowRef();return e({instance:a}),(c,h)=>(u.openBlock(),u.createBlock(Ji,{ref:a.value,points:i.value,"vertex-colors":t.vertexColors,color:t.color,"line-width":t.lineWidth,"alpha-to-coverage":t.alphaToCoverage,dashed:t.dashed,"dash-size":t.dashSize,"dash-scale":t.dashScale,"dash-offset":t.dashOffset,"gap-size":t.gapSize,"world-units":t.worldUnits},null,8,["points","vertex-colors","color","line-width","alpha-to-coverage","dashed","dash-size","dash-scale","dash-offset","gap-size","world-units"]))}}),Eh=["args"],Yh=["color"],Wh=u.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:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"circleRef",ref:i},a.$attrs),[u.createElementVNode("TresCircleGeometry",{args:u.unref(n)},null,8,Eh),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,Yh)])],16))}}),Xh=["args"],Zh=["color"],Kh=u.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:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"coneRef",ref:i},a.$attrs),[u.createElementVNode("TresConeGeometry",{args:u.unref(n)},null,8,Xh),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,Zh)])],16))}}),qh=["args"],Qh=["color"],Jh=u.defineComponent({__name:"Cylinder",props:{args:{default:()=>[1,1,1,32,1,!1,0,Math.PI*2]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"cylinderRef",ref:i},a.$attrs),[u.createElementVNode("TresCylinderGeometry",{args:u.unref(n)},null,8,qh),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,Qh)])],16))}}),Hh=["args"],$h=["color"],ef=u.defineComponent({__name:"Dodecahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),r=u.shallowRef(),{invalidate:i}=ee.useTresContext();return u.watch(n,()=>i()),e({instance:r}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"dodecahedronRef",ref:r},a.$attrs),[u.createElementVNode("TresDodecahedronGeometry",{args:u.unref(n)},null,8,Hh),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,$h)])],16))}}),tf=["args"],nf=["color"],sf=u.defineComponent({__name:"Icosahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"icosahedronRef",ref:i},a.$attrs),[u.createElementVNode("TresIcosahedronGeometry",{args:u.unref(n)},null,8,tf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,nf)])],16))}}),rf=["args"],of=["color"],af=u.defineComponent({__name:"Octahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"octahedronRef",ref:i},a.$attrs),[u.createElementVNode("TresOctahedronGeometry",{args:u.unref(n)},null,8,rf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,of)])],16))}}),lf=["rotation"],cf=["args"],uf=["color"],hf=u.defineComponent({__name:"Plane",props:{args:{default:()=>[1,1]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"planeRef",ref:i,rotation:[-Math.PI/2,0,0]},a.$attrs),[u.createElementVNode("TresPlaneGeometry",{args:u.unref(n)},null,8,cf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,uf)])],16,lf))}}),ff=["args"],df=["color"],pf=u.defineComponent({__name:"Ring",props:{args:{default:()=>[.5,1,32]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"ringRef",ref:i},a.$attrs),[u.createElementVNode("TresRingGeometry",{args:u.unref(n)},null,8,ff),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,df)])],16))}}),mf=["args"],gf=["color"],yf=u.defineComponent({__name:"RoundedBox",props:{args:{default:()=>[1,1,1,2,.1]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r,extend:i}=ee.useTresContext();i({RoundedBoxGeometry:qa}),u.watch(n,()=>r());const a=u.shallowRef();return e({instance:a}),(c,h)=>(u.openBlock(),u.createElementBlock("TresMesh",{ref_key:"roundedBoxRef",ref:a},[u.createElementVNode("TresRoundedBoxGeometry",{args:u.unref(n)},null,8,mf),u.renderSlot(c.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,gf)])],512))}}),_f=["args"],xf=["color"],vf=u.defineComponent({__name:"Sphere",props:{args:{default:()=>[2,32,16]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"sphereRef",ref:i},a.$attrs),[u.createElementVNode("TresSphereGeometry",{args:u.unref(n)},null,8,_f),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,xf)])],16))}}),wf=["geometry"],bf=["color"],Mf=u.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,{invalidate:n}=ee.useTresContext(),{cos:s,sin:r,abs:i}=Math,a=u.shallowRef(),c=u.shallowRef(t.color);function h(p,_){const g=new l.BufferGeometry,x=p*_,m=new Float32Array(Array.from({length:3*x}).fill(0)),M=new Float32Array(Array.from({length:3*x}).fill(0)),v=[];for(let C=0;C<_-1;C++){for(let P=0;P<p-1;P++){const w=C*p+P,D=w+1,L=w+p,V=D+p;v.push(w,L,D),v.push(L,V,D)}const O=C*p+p-1,S=C*p,A=O+p,b=S+p;v.push(O,A,S),v.push(A,b,S)}return g.setIndex(v),g.setAttribute("position",new l.BufferAttribute(m,3)),g.setAttribute("normal",new l.BufferAttribute(M,3)),g}function d(p,_,g,x,m){return(i(s(_*p*.25))**x+i(r(_*p*.25))**m)**(-1/g)}function f(p,_,g,x,m,M,v,C,O,S,A){const b=2*Math.PI/S,P=-Math.PI,w=Math.PI/(A-1),D=-.5*Math.PI,L=p.getAttribute("position");let V=0,R=0,Y=D;for(let W=0;W<A;W++){R=P;for(let $=0;$<S;$++){const q=d(R,_,g,x,m),ne=d(Y,M,v,C,O);L.setXYZ(V,q*s(R)*ne*s(Y),ne*r(Y),q*r(R)*ne*s(Y)),V++,R+=b}Y+=w}L.needsUpdate=!0,p.computeVertexNormals()}u.watch(()=>t.color,()=>c.value=t.color),u.watch(()=>[t.widthSegments,t.heightSegments],()=>{a.value&&a.value.dispose(),a.value=h(t.widthSegments,t.heightSegments),n()},{immediate:!0}),u.watch(()=>[t.numArmsA,t.expA[0],t.expA[1],t.expA[2],t.numArmsB,t.expB[0],t.expB[1],t.expB[2]],()=>{f(a.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),n()},{immediate:!0}),u.onUnmounted(()=>{a.value&&a.value.dispose()});const y=u.shallowRef();return e({instance:y}),(p,_)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"superformulaRef",ref:y},p.$attrs,{geometry:a.value}),[u.renderSlot(p.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:c.value},null,8,bf)])],16,wf))}}),Sf=["rotation"],Af=["args"],Cf=["color"],Pf=u.defineComponent({__name:"Tetrahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),r=u.shallowRef();return e({instance:r}),(i,a)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"tetrahedronRef",ref:r,rotation:[-Math.PI/2,0,0]},i.$attrs),[u.createElementVNode("TresTetrahedronGeometry",{args:u.unref(n)},null,8,Af),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,Cf)])],16,Sf))}}),Tf=["args"],If=["color"],Of=u.defineComponent({__name:"Torus",props:{args:{default:()=>[1,1,16,80]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"torusRef",ref:i},a.$attrs),[u.createElementVNode("TresTorusGeometry",{args:u.unref(n)},null,8,Tf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,If)])],16))}}),Df=["args"],Lf=["color"],Bf=u.defineComponent({__name:"TorusKnot",props:{args:{default:()=>[1,.4,64,8]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"torusKnotRef",ref:i},a.$attrs),[u.createElementVNode("TresTorusKnotGeometry",{args:u.unref(n)},null,8,Df),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,Lf)])],16))}}),kf=["args"],Ff=["color"],Uf=u.defineComponent({__name:"Tube",props:{args:{default:()=>[new l.QuadraticBezierCurve3(new l.Vector3(-1,0,0),new l.Vector3(0,1,0),new l.Vector3(1,0,0)),20,.2,8,!1]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"tubeRef",ref:i},a.$attrs),[u.createElementVNode("TresTubeGeometry",{args:u.unref(n)},null,8,kf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,Ff)])],16))}});class Nf extends l.Object3D{constructor(){super();ue(this,"virtualScene",null);this.virtualScene=new l.Scene}add(...t){return this.virtualScene.add(...t),this}destructor(){this.virtualScene.traverse(t=>{t instanceof l.Mesh&&(t.geometry.dispose(),t.material.dispose(),t.material.map&&t.material.map.dispose(),this.virtualScene.remove(t))}),this.virtualScene=null}}const zf=u.defineComponent({__name:"component",props:{background:{type:[Boolean,String],default:!1},blur:{default:0},files:{default:()=>[]},path:{default:""},preset:{default:void 0},resolution:{default:256},near:{default:1},far:{default:1e3},frames:{default:Number.POSITIVE_INFINITY}},async setup(o,{expose:e}){let t,n;const s=o,r=u.ref(null);e({texture:r});const{extend:i,renderer:a,scene:c}=ee.useTresContext();let h=null;const d=u.ref(null);let f=null;const y=u.ref(null),{onBeforeRender:p}=ee.useLoop();let _=1;p(()=>{f&&y.value&&d.value&&(s.frames===Number.POSITIVE_INFINITY||_<s.frames)&&(f.update(a.value,u.toRaw(y.value.virtualScene)),_++)},-1);const g=([t,n]=u.withAsyncContext(()=>ni(s,d)),t=await t,n(),t),x=m=>{m?(c.value.environment=m.texture,s.background&&(c.value.background=m.texture)):(c.value.environment=g.value,s.background&&(c.value.background=g.value))};return u.watch(g,()=>{d.value&&x(d.value)},{immediate:!0,deep:!0}),u.watch(()=>u.useSlots().default,m=>{var M,v;if(m&&(h=m,Array.isArray(h)&&h.length>0&&typeof((M=h[0])==null?void 0:M.type)!="symbol")){i({EnvSence:Nf}),d.value=new l.WebGLCubeRenderTarget(s.resolution),d.value.texture.type=l.HalfFloatType,f=new l.CubeCamera(s.near,s.far,d.value),x(d.value);return}(v=d.value)==null||v.dispose(),d.value=null,x()},{immediate:!0,deep:!0}),r.value=g.value,u.onUnmounted(()=>{var m,M;(m=y.value)==null||m.destructor(),(M=d.value)==null||M.dispose()}),(m,M)=>d.value?(u.openBlock(),u.createElementBlock("TresEnvSence",{key:0,ref_key:"envSence",ref:y},[u.renderSlot(m.$slots,"default")],512)):u.createCommentVNode("",!0)}}),Vf={key:0,args:[0,1,64]},Rf={key:1,args:[.5,1,64]},Gf={key:2},jf=["tone-mapped","map","side","color"],Ef=u.defineComponent({__name:"index",props:{args:{default:null},from:{default:"rect"},toneMapped:{type:Boolean,default:!1},map:{default:null},intensity:{default:1},color:{default:new l.Color(16777215)}},setup(o){const e=o,t=u.ref();return u.watchEffect(()=>{t.value&&(t.value.color.multiplyScalar(e.intensity),t.value.needsUpdate=!0)}),(n,s)=>(u.openBlock(),u.createElementBlock("TresMesh",null,[n.from==="circle"?(u.openBlock(),u.createElementBlock("TresRingGeometry",Vf)):n.from==="ring"?(u.openBlock(),u.createElementBlock("TresRingGeometry",Rf)):n.from==="rect"?(u.openBlock(),u.createElementBlock("TresPlaneGeometry",Gf)):(u.openBlock(),u.createBlock(e.from,{key:3,args:e})),u.createElementVNode("TresMeshBasicMaterial",{ref_key:"material",ref:t,"tone-mapped":n.toneMapped,map:n.map,side:u.unref(l.DoubleSide),color:n.color},null,8,jf)]))}}),Yf=["receive-shadow","rotation"],Wf=["args"],Xf=u.createElementVNode("TresMeshStandardMaterial",{color:8421504,side:2},null,-1),Zf=u.defineComponent({__name:"Backdrop",props:{floor:{default:.25},segments:{default:20},receiveShadow:{type:Boolean,default:!1}},setup(o,{expose:e}){const t=o,n=h=>h===0?0:2**(10*h-10),{floor:s,segments:r,receiveShadow:i}=u.toRefs(t),a=u.ref(null);u.watch([r,s,a],([h,d,f])=>{if(!f||h===null)return;let y=0;const p=h/h/2,_=f.attributes.position;for(let g=0;g<h+1;g++)for(let x=0;x<h+1;x++)_.setXYZ(y++,g/h-p+(g===0?-d:0),x/h-p,n(g/h));_.needsUpdate=!0,f.computeVertexNormals()});const c=u.shallowRef();return e({instance:c}),(h,d)=>(u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps({ref_key:"backdropRef",ref:c},h.$attrs),[u.createElementVNode("TresMesh",{"receive-shadow":u.unref(i),rotation:[-Math.PI/2,0,Math.PI/2]},[u.createElementVNode("TresPlaneGeometry",{ref_key:"planeRef",ref:a,args:[1,1,u.unref(r),u.unref(r)]},null,8,Wf),u.renderSlot(h.$slots,"default",{},()=>[Xf])],8,Yf)],16))}}),Kf=["object"],qf=u.defineComponent({__name:"ContactShadows",props:{opacity:{default:1},blur:{default:1},color:{default:"#000000"},tint:{default:void 0},scale:{default:10},width:{default:1},height:{default:1},far:{default:10},smooth:{type:Boolean,default:!0},resolution:{default:512},frames:{default:Number.POSITIVE_INFINITY},depthWrite:{type:Boolean,default:!1}},setup(o,{expose:e}){const t=o;function n(p,_,g){g.blurPlane.visible=!0,g.blurPlane.material=g.horizontalBlurMaterial,g.horizontalBlurMaterial.uniforms.tDiffuse.value=g.renderTarget.texture,g.horizontalBlurMaterial.uniforms.h.value=p/256,_.setRenderTarget(g.renderTargetBlur),_.render(g.blurPlane,g.shadowCamera),g.blurPlane.material=g.verticalBlurMaterial,g.verticalBlurMaterial.uniforms.tDiffuse.value=g.renderTargetBlur.texture,g.verticalBlurMaterial.uniforms.v.value=p/256,_.setRenderTarget(g.renderTarget),_.render(g.blurPlane,g.shadowCamera),g.blurPlane.visible=!1}function s(p,_,g,x){const{renderTarget:m,shadowCamera:M,depthMaterial:v}=x,C=_.background;_.background=null,_.overrideMaterial=v;const O=g.getClearAlpha();g.setClearAlpha(0),g.setRenderTarget(m),g.render(_,M),_.overrideMaterial=null,n(p.blur,g,x),p.smooth&&n(p.blur*.4,g,x),g.setRenderTarget(null),g.setClearAlpha(O),_.background=C}function r(p){const _=new l.Group,g=new l.WebGLRenderTarget(p.resolution,p.resolution);g.texture.generateMipmaps=!1;const x=new l.WebGLRenderTarget(p.resolution,p.resolution);x.texture.generateMipmaps=!1;const m=new l.PlaneGeometry(p.width,p.height).rotateX(Math.PI/2),M=new l.MeshBasicMaterial({map:g.texture,opacity:p.opacity,transparent:!0,depthWrite:p.depthWrite,color:new l.Color(p.color??"black")}),v=new l.Mesh(m,M);_.add(v),v.scale.y=-1;const C=new l.Mesh(m);C.visible=!1,_.add(C);const O=new l.OrthographicCamera(-p.width/2,p.width/2,p.height/2,-p.height/2,0,.3);O.rotation.x=Math.PI/2,_.add(O);const S=new l.MeshDepthMaterial,A=new l.ShaderMaterial(Qa);A.depthTest=!1;const b=new l.ShaderMaterial(Ja);return b.depthTest=!1,{renderTarget:g,renderTargetBlur:x,shadowCamera:O,depthMaterial:S,horizontalBlurMaterial:A,verticalBlurMaterial:b,shadowGroup:_,plane:v,blurPlane:C}}function i(p,_){const g=_.shadowCamera;g.left=-p.width/2,g.right=p.width/2,g.top=p.height/2,g.bottom=-p.height/2,g.far=p.far;const x=p.width*(Array.isArray(p.scale)?p.scale[0]:p.scale||1),m=p.height*(Array.isArray(p.scale)?p.scale[1]:p.scale||1);_.shadowGroup.scale.set(x,p.far,m)}function a(p,_){_.renderTarget.dispose(),_.renderTargetBlur.dispose(),_.renderTarget=new l.WebGLRenderTarget(p,p),_.renderTarget.texture.generateMipmaps=!1,_.renderTargetBlur=new l.WebGLRenderTarget(p,p),_.renderTargetBlur.texture.generateMipmaps=!1,_.plane.material.map=_.renderTarget.texture}function c(p,_){_.plane.material.color=new l.Color(p.color??"black"),_.depthMaterial.dispose(),_.depthMaterial=new l.MeshDepthMaterial,_.depthMaterial.onBeforeCompile=function(g){const x=p.tint?new l.Color(p.tint):new l.Color("white"),{r:m,g:M,b:v}=x;g.fragmentShader=`
|
|
1320
|
-
${
|
|
1321
|
-
`}}const{onBeforeRender:h}=ee.useLoop(),d=r(t);let f=0;const y=()=>f=f>=t.frames?t.frames-1:f;return h(({renderer:p,scene:_,invalidate:g})=>{f<t.frames&&(f++,s(t,_,p,d),g())}),u.watch(()=>[t.opacity,t.depthWrite,t.blur,t.smooth],()=>{d.plane.material.opacity=t.opacity??1,d.plane.material.depthWrite=t.depthWrite??!1,y()},{immediate:!0}),u.watch(()=>[t.color,t.tint],()=>{c(t,d),y()},{immediate:!0}),u.watch(()=>[t.resolution],()=>{a(t.resolution,d),y()}),u.watch(()=>[t.width,t.height,t.scale,t.far],()=>{i(t,d),y()},{immediate:!0}),u.onUnmounted(()=>{for(const p of Object.values(d))p&&"dispose"in p&&typeof p.dispose=="function"&&p.dispose()}),e({instance:d.shadowGroup}),(p,_)=>(u.openBlock(),u.createElementBlock("primitive",{object:u.unref(d).shadowGroup},null,8,Kf))}}),Qf=u.defineComponent({__name:"Fit",props:{into:{default:()=>new l.Box3(new l.Vector3(-.5,-.5,-.5),new l.Vector3(.5,.5,.5))},precise:{type:Boolean,default:!1}},setup(o,{expose:e}){const t=o,{invalidate:n}=ee.useTresContext(),s=u.shallowRef(new l.Group),r=u.shallowRef(new l.Group);function i(h,d){if(s.value.position.set(0,0,0),s.value.updateMatrixWorld(),r.value.scale.set(1,1,1),r.value.updateMatrixWorld(),!r.value.children.length||h===null)return;const{box3:f,use:y}=a(h,d),p=new l.Box3;r.value.children.forEach(M=>p.expandByObject(M,d));const _=p.getSize(new l.Vector3),g=f.getSize(new l.Vector3),x=Math.min(g.x/_.x,g.y/_.y,g.z/_.z);r.value.scale.setScalar(x===Number.POSITIVE_INFINITY?1:x),r.value.updateMatrixWorld();const m=s.value.worldToLocal(p.getCenter(new l.Vector3));if(y.position){const M=s.value.worldToLocal(f.getCenter(new l.Vector3));s.value.position.copy(M.sub(m.multiplyScalar(x)))}else s.value.position.copy(m.sub(m.multiplyScalar(x)));n()}function a(h,d){return typeof h=="number"?h=new l.Vector3(h,h,h):Array.isArray(h)&&(h=new l.Vector3(...h)),h&&"isVector3"in h&&h.isVector3?{box3:new l.Box3(new l.Vector3(0,0,0),h),use:{position:!1}}:h&&"isBox3"in h&&h.isBox3?{box3:h,use:{position:!0}}:h&&"isObject3D"in h&&h.isObject3D?{box3:new l.Box3().setFromObject(h,d??!1),use:{position:!0}}:{box3:new l.Box3(new l.Vector3(-.5,-.5,-.5),new l.Vector3(.5,.5,.5)),use:{position:!0}}}u.watch(()=>[t.into,t.precise],()=>i(t.into,t.precise)),u.onMounted(()=>{i(t.into,t.precise),u.nextTick().then(()=>{i(t.into,t.precise)})});const c=u.shallowRef();return e({instance:c,fit:(h=new l.Box3(new l.Vector3(-.5,-.5,-.5),new l.Vector3(.5,.5,.5)),d=!1)=>{i(h,d)},update:()=>i(t.into,t.precise)}),(h,d)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"outer",ref:c},[u.createElementVNode("TresGroup",{ref_key:"middle",ref:s},[u.createElementVNode("TresGroup",{ref_key:"inner",ref:r},[u.renderSlot(h.$slots,"default")],512)],512)],512))}}),Jf=["size","color","alpha-map","map","opacity","alpha-test","depth-write","transparent","size-attenuation"],Hf=["position","velocity"],$f=u.defineComponent({__name:"Precipitation",props:{size:{default:.1},area:{default:()=>[10,10,20]},color:{default:16777215},map:{},alphaMap:{},alphaTest:{default:.01},opacity:{default:.8},count:{default:5e3},speed:{default:.1},randomness:{default:.5},depthWrite:{type:Boolean,default:!1},transparent:{type:Boolean,default:!0},sizeAttenuation:{type:Boolean,default:!0}},setup(o,{expose:e}){const t=o,{size:n,area:s,color:r,alphaMap:i,map:a,opacity:c,alphaTest:h,depthWrite:d,transparent:f,sizeAttenuation:y,count:p,speed:_,randomness:g}=u.toRefs(t),x=u.shallowRef();let m=[],M=[];const v=()=>{m=new Float32Array(p.value*3);for(let A=0;A<p.value;A++){const b=A*3;m[b]=(Math.random()-.5)*s.value[0],m[b+1]=(Math.random()-.5)*s.value[1],m[b+2]=(Math.random()-.5)*s.value[2]}},C=()=>{M=new Float32Array(p.value*2);for(let A=0;A<p.value*2;A+=2)M[A]=(Math.random()-.5)/5*_.value*g.value,M[A+1]=Math.random()/5*_.value};C(),v(),u.watchEffect(()=>{C(),v()});const{onBeforeRender:O}=ee.useLoop();O(({invalidate:A})=>{var b,P;if((b=x.value)!=null&&b.attributes.position.array&&((P=x.value)!=null&&P.attributes.position.count)){const w=x.value.attributes.position.array;for(let D=0;D<x.value.attributes.position.count;D++){const L=M[D*2],V=M[D*2+1];w[D*3]+=L,w[D*3+1]-=V,(w[D*3]<=-s.value[0]/2||w[D*3]>=s.value[0]/2)&&(w[D*3]=w[D*3]*-1),(w[D*3+1]<=-s.value[1]/2||w[D*3+1]>=s.value[1]/2)&&(w[D*3+1]=w[D*3+1]*-1)}x.value.attributes.position.needsUpdate=!0,A()}});const S=u.shallowRef();return e({instance:S}),(A,b)=>(u.openBlock(),u.createElementBlock("TresPoints",{ref_key:"pointsRef",ref:S},[u.createElementVNode("TresPointsMaterial",{size:u.unref(n),color:u.unref(r),"alpha-map":u.unref(i),map:u.unref(a),opacity:u.unref(c),"alpha-test":u.unref(h),"depth-write":u.unref(d),transparent:u.unref(f),"size-attenuation":u.unref(y)},null,8,Jf),u.createElementVNode("TresBufferGeometry",{ref_key:"geometryRef",ref:x,position:[u.unref(m),3],velocity:[u.unref(M)]},null,8,Hf)],512))}}),ed=["object","material-uniforms-turbidity-value","material-uniforms-rayleigh-value","material-uniforms-mieCoefficient-value","material-uniforms-mieDirectionalG-value","material-uniforms-sunPosition-value","scale"],td=u.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,{expose:e}){const t=o,{invalidate:n}=ee.useTresContext();u.watch(t,()=>n());const s=u.shallowRef(),r=new ss,i=u.computed(()=>a(t.azimuth,t.elevation));function a(c,h){const d=l.MathUtils.degToRad(90-h),f=l.MathUtils.degToRad(c);return new l.Vector3().setFromSphericalCoords(1,d,f)}return e({instance:s,sunPosition:i.value}),(c,h)=>(u.openBlock(),u.createElementBlock("primitive",{ref_key:"skyRef",ref:s,object:u.unref(r),"material-uniforms-turbidity-value":t.turbidity,"material-uniforms-rayleigh-value":t.rayleigh,"material-uniforms-mieCoefficient-value":t.mieCoefficient,"material-uniforms-mieDirectionalG-value":t.mieDirectionalG,"material-uniforms-sunPosition-value":i.value,scale:t.distance},null,8,ed))}}),nd=["position"],sd=["position"],rd=["scale"],id=["map","depth-test","color-space","color","opacity"],od=u.defineComponent({__name:"Smoke",props:{color:{default:"#ffffff"},opacity:{default:.5},speed:{default:.4},width:{default:10},depth:{default:1.5},segments:{default:20},texture:{default:"https://raw.githubusercontent.com/Tresjs/assets/main/textures/clouds/defaultCloud.png"},depthTest:{type:Boolean,default:!0}},async setup(o,{expose:e}){let t,n;const s=o,{width:r,depth:i,segments:a,texture:c,color:h,depthTest:d,opacity:f,speed:y}=u.toRefs(s),p=u.shallowRef(),_=u.shallowRef();e({instance:p});const g=[a].map((S,A)=>({x:r.value/2-Math.random()*r.value,y:r.value/2-Math.random()*r.value,scale:.4+Math.sin((A+1)/a.value*Math.PI)*((.2+Math.random())*10),density:Math.max(.2,Math.random()),rotation:Math.max(.002,.005*Math.random())*y.value})),x=(S,A)=>S/6*A*f.value,{map:m}=([t,n]=u.withAsyncContext(()=>ee.useTexture({map:c.value})),t=await t,n(),t),{renderer:M,camera:v}=ee.useTresContext(),C=u.computed(()=>{var S;return(S=M.value)==null?void 0:S.outputColorSpace}),{onBeforeRender:O}=ee.useLoop();return O(({invalidate:S})=>{var A,b;p.value&&v.value&&_.value&&((A=_.value)==null||A.children.forEach((P,w)=>{P.rotation.z+=g[w].rotation}),p.value.lookAt((b=v.value)==null?void 0:b.position),S())}),(S,A)=>(u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps({ref_key:"smokeRef",ref:p},S.$attrs),[u.createElementVNode("TresGroup",{ref_key:"groupRef",ref:_,position:[0,0,u.unref(a)/2*u.unref(i)]},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(u.unref(g),({scale:b,x:P,y:w,density:D},L)=>(u.openBlock(),u.createElementBlock("TresMesh",{key:`${L}`,position:[P,w,-L*u.unref(i)]},[u.createElementVNode("TresPlaneGeometry",{scale:[b,b,b],rotation:[0,0,0]},null,8,rd),u.createElementVNode("TresMeshStandardMaterial",{map:u.unref(m),"depth-test":u.unref(d),"color-space":C.value,color:u.unref(h),"depth-write":!1,transparent:"",opacity:x(b,D)},null,8,id)],8,sd))),128))],8,nd)],16))}});function ad(o){return Ws(o,{normalizeValue:e=>ee.normalizeColor(e),getDefaultValue:()=>new l.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 Ys(o){return"isVector3"in o||Array.isArray(o)&&o.length>0&&o.every(e=>typeof e=="number")}function ld(o){return Ws(o,{normalizeValue:e=>ee.normalizeVectorFlexibleParam(e),getDefaultValue:()=>[0,0,0],isSingleValue:e=>Ys(e),isMultipleValues:e=>Array.isArray(e)&&e.length>0&&Ys(e[0]),isMultipleValuesWithStops:e=>Array.isArray(e)&&e.length>0&&Array.isArray(e[0])&&e[0].length===2&&Ys(e[0][1]),isEmpty:e=>Array.isArray(e)&&e.length===0})}function cd(o){return Ws(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 Ws(o,e){const{normalizeValue:t,getDefaultValue:n,isEmpty:s}=e,r=c=>e.isSingleValue(c),i=c=>e.isMultipleValues(c),a=c=>e.isMultipleValuesWithStops(c);if(s(o))return[[0,n()]];if(r(o))return[[0,t(o)]];if(i(o)){const c=o.length>1?1/(o.length-1):1;return o.map((h,d)=>[c*d,t(h)])}else if(a(o))return o.map(([c,h],d)=>[c,t(h)]);return[[0,n()]]}class ud{constructor(e,t){ue(this,"entries");ue(this,"resolution");this.entries=e,this.resolution=t}useTexture(){return new dd(this.entries,this.resolution).use()}}class Xs{constructor(e,t,n,s,r,i){ue(this,"data");ue(this,"ref");ue(this,"name");ue(this,"valueMin");ue(this,"valueMax");ue(this,"suffix");ue(this,"renderToCanvasGradient");this.data=u.isRef(e)?e.value:e,this.ref=u.isRef(e)?e:null,this.name=t,this.valueMin=n,this.valueMax=s,this.suffix=r,this.renderToCanvasGradient=i}}class hd extends Xs{constructor(e,t="color",n=0,s=1,r="rgba",i=pd){super(e,t,n,s,r,i)}}class Hi extends Xs{constructor(e,t="scalar",n=0,s=1,r="x",i=md){super(e,t,n,s,r,i)}}class fd extends Xs{constructor(e,t="scalar3",n=0,s=1,r="xyz",i=gd){super(e,t,n,s,r,i)}}class dd{constructor(e,t){ue(this,"entries");ue(this,"size");ue(this,"dirty",u.shallowRef(0));ue(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=u.shallowRef(e);for(const n of this.entries)n.ref&&u.watch(n.ref,()=>{var s;n.data=(s=n.ref)==null?void 0:s.value,u.triggerRef(this.dirty)});return Gl(this.dirty,()=>{this.build(e),t.value=e},{throttle:1e3/60}),{texture:t,dispose:()=>e.dispose(),yFor:this.entries.reduce((n,s,r)=>(n[s.name]=(r+.5)/this.size,n),{})}}build(e){this.entries.forEach((n,s)=>{const r=this.context.createLinearGradient(0,s,this.size,s);n.renderToCanvasGradient(r,n),this.context.fillStyle=r,this.context.fillRect(0,s,this.size,1)}),e&&(e.source.data=this.context.getImageData(0,0,this.size,this.size));const t=e??new l.DataTexture(this.context.getImageData(0,0,this.size,this.size).data,this.size,this.size,l.RGBAFormat,l.UnsignedByteType,l.UVMapping,l.ClampToEdgeWrapping,l.ClampToEdgeWrapping);return t.needsUpdate=!0,t}}function $i(o,e,t,n,s){return _u(St(o,e,t),e,t,n,s)}function pd(o,e){return ad(e.data).forEach(([t,n])=>o.addColorStop(t,`rgb(${n.r*255}, ${n.g*255}, ${n.b*255})`))}function md(o,e){return cd(e.data).forEach(([t,n])=>{o.addColorStop(t,`rgb(${$i(n,e.valueMin,e.valueMax,0,255)}, 0, 0)`)})}function gd(o,e){return ld(e.data).forEach(([t,n])=>o.addColorStop(t,`rgb(${n.map(s=>$i(s,e.valueMin,e.valueMax,0,255))})`))}class yd{constructor(e=256){ue(this,"entries");ue(this,"resolution");this.resolution=e,this.entries=[]}withResolution(e){return this.resolution=e,this}get add(){return new xd(e=>this.onAdd(e))}build(){return new ud(this.entries,this.resolution)}onAdd(e){return this.entries.push(e),new _d(e,this)}}class _d{constructor(e,t){ue(this,"entry");ue(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 xd{constructor(e){ue(this,"onAdd");this.onAdd=e}GradientTresColor(e){return this.onAdd(new hd(e))}Gradient01(e){return this.onAdd(new Hi(e,"zeroOne",0,1))}GradientScalar(e,t,n){return this.onAdd(new Hi(e,"scalar",t,n))}GradientXyz(e,t,n){return this.onAdd(new fd(e,"position",t,n))}}let Zs=null;function vd(){return Zs===null&&(Zs=new l.DataTexture(new Uint8Array([0,0,0,0]),1,1)),Zs}const wd=["object"],bd=u.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:l.AdditiveBlending},transparent:{type:Boolean,default:!0},depthWrite:{type:Boolean,default:!1}},setup(o,{expose:e}){const t=o,n=Number.parseInt(l.REVISION.replace(/\D+/g,"")),s=u.toRefs(t),r=typeof t.map=="string"?vd():t.map,{texture:i,yFor:a}=new yd(256).add.GradientTresColor(s.sequenceColor).id("sequenceColor").add.Gradient01(s.sequenceAlpha).id("sequenceAlpha").add.Gradient01(s.sequenceSurfaceDistance).id("sequenceSurfaceDistance").add.Gradient01(s.sequenceSize).id("sequenceSize").add.GradientXyz(s.sequenceOffset,-1,1).id("sequenceOffset").add.GradientXyz(s.sequenceNoise,0,1).id("sequenceNoise").build().useTexture(),c={blending:t.blending,transparent:t.transparent,depthWrite:t.depthWrite,uniforms:{uMap:new l.Uniform(r),uPixelRatio:new l.Uniform(1),uNormal:new l.Uniform(l.Object3D.DEFAULT_UP),uNormalThreshold:new l.Uniform(t.normalThreshold),uTime:new l.Uniform(0),uCooldownRatio:new l.Uniform(1),uSize:new l.Uniform(t.size),uAlpha:new l.Uniform(t.alpha),uOffset:new l.Uniform(t.offset),uSurfaceDistance:new l.Uniform(t.surfaceDistance),uNoiseScale:new l.Uniform(t.noiseScale),uScaleNoise:new l.Uniform(t.scaleNoise),uOffsetNoise:new l.Uniform(t.offsetNoise),uLifetimeNoise:new l.Uniform(t.lifetimeNoise),uMixColor:new l.Uniform(t.mixColor),uMixAlpha:new l.Uniform(t.mixAlpha),uMixOffset:new l.Uniform(t.mixOffset),uMixSize:new l.Uniform(t.mixSize),uMixSurfaceDistance:new l.Uniform(t.mixSurfaceDistance),uMixNoise:new l.Uniform(t.mixNoise),uInfoTexture:new l.Uniform(i.value)},vertexShader:`
|
|
1319
|
+
`};class Rs extends l.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:l.UniformsUtils.clone(l.ShaderLib.line.uniforms),vertexShader:l.ShaderLib.line.vertexShader,fragmentShader:l.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="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const Gs=new l.Vector4,Xi=new l.Vector3,Zi=new l.Vector3,Ne=new l.Vector4,ze=new l.Vector4,ot=new l.Vector4,js=new l.Vector3,Es=new l.Matrix4,Ve=new l.Line3,Ki=new l.Vector3,Gn=new l.Box3,jn=new l.Sphere,at=new l.Vector4;let lt,Ut;function qi(o,e,t){return at.set(0,0,-e,1).applyMatrix4(o.projectionMatrix),at.multiplyScalar(1/at.w),at.x=Ut/t.width,at.y=Ut/t.height,at.applyMatrix4(o.projectionMatrixInverse),at.multiplyScalar(1/at.w),Math.abs(Math.max(at.x,at.y))}function Rh(o,e){const t=o.matrixWorld,n=o.geometry,s=n.attributes.instanceStart,r=n.attributes.instanceEnd,i=Math.min(n.instanceCount,s.count);for(let a=0,c=i;a<c;a++){Ve.start.fromBufferAttribute(s,a),Ve.end.fromBufferAttribute(r,a),Ve.applyMatrix4(t);const h=new l.Vector3,d=new l.Vector3;lt.distanceSqToSegment(Ve.start,Ve.end,d,h),d.distanceTo(h)<Ut*.5&&e.push({point:d,pointOnLine:h,distance:lt.origin.distanceTo(d),object:o,face:null,faceIndex:a,uv:null,uv1:null})}}function Gh(o,e,t){const n=e.projectionMatrix,r=o.material.resolution,i=o.matrixWorld,a=o.geometry,c=a.attributes.instanceStart,h=a.attributes.instanceEnd,d=Math.min(a.instanceCount,c.count),f=-e.near;lt.at(1,ot),ot.w=1,ot.applyMatrix4(e.matrixWorldInverse),ot.applyMatrix4(n),ot.multiplyScalar(1/ot.w),ot.x*=r.x/2,ot.y*=r.y/2,ot.z=0,js.copy(ot),Es.multiplyMatrices(e.matrixWorldInverse,i);for(let g=0,p=d;g<p;g++){if(Ne.fromBufferAttribute(c,g),ze.fromBufferAttribute(h,g),Ne.w=1,ze.w=1,Ne.applyMatrix4(Es),ze.applyMatrix4(Es),Ne.z>f&&ze.z>f)continue;if(Ne.z>f){const v=Ne.z-ze.z,C=(Ne.z-f)/v;Ne.lerp(ze,C)}else if(ze.z>f){const v=ze.z-Ne.z,C=(ze.z-f)/v;ze.lerp(Ne,C)}Ne.applyMatrix4(n),ze.applyMatrix4(n),Ne.multiplyScalar(1/Ne.w),ze.multiplyScalar(1/ze.w),Ne.x*=r.x/2,Ne.y*=r.y/2,ze.x*=r.x/2,ze.y*=r.y/2,Ve.start.copy(Ne),Ve.start.z=0,Ve.end.copy(ze),Ve.end.z=0;const y=Ve.closestPointToPointParameter(js,!0);Ve.at(y,Ki);const x=l.MathUtils.lerp(Ne.z,ze.z,y),m=x>=-1&&x<=1,M=js.distanceTo(Ki)<Ut*.5;if(m&&M){Ve.start.fromBufferAttribute(c,g),Ve.end.fromBufferAttribute(h,g),Ve.start.applyMatrix4(i),Ve.end.applyMatrix4(i);const v=new l.Vector3,C=new l.Vector3;lt.distanceSqToSegment(Ve.start,Ve.end,C,v),t.push({point:C,pointOnLine:v,distance:lt.origin.distanceTo(C),object:o,face:null,faceIndex:g,uv:null,uv1:null})}}}class jh extends l.Mesh{constructor(e=new Wi,t=new Rs({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 i=0,a=0,c=t.count;i<c;i++,a+=2)Xi.fromBufferAttribute(t,i),Zi.fromBufferAttribute(n,i),s[a]=a===0?0:s[a-1],s[a+1]=s[a]+Xi.distanceTo(Zi);const r=new l.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new l.InterleavedBufferAttribute(r,1,0)),e.setAttribute("instanceDistanceEnd",new l.InterleavedBufferAttribute(r,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 r=e.params.Line2!==void 0&&e.params.Line2.threshold||0;lt=e.ray;const i=this.matrixWorld,a=this.geometry,c=this.material;Ut=c.linewidth+r,a.boundingSphere===null&&a.computeBoundingSphere(),jn.copy(a.boundingSphere).applyMatrix4(i);let h;if(n)h=Ut*.5;else{const f=Math.max(s.near,jn.distanceToPoint(lt.origin));h=qi(s,f,c.resolution)}if(jn.radius+=h,lt.intersectsSphere(jn)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),Gn.copy(a.boundingBox).applyMatrix4(i);let d;if(n)d=Ut*.5;else{const f=Math.max(s.near,Gn.distanceToPoint(lt.origin));d=qi(s,f,c.resolution)}Gn.expandByScalar(d),lt.intersectsBox(Gn)!==!1&&(n?Rh(this,t):Gh(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Gs),this.material.uniforms.resolution.value.set(Gs.z,Gs.w))}}class Qi extends Wi{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 Eh extends jh{constructor(e=new Qi,t=new Rs({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const Yh=["object"],Ji=u.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,{expose:e}){const t=o;function n(p,_){if(!p||p.length===0)return Array.from({length:_}).fill(ee.normalizeColor(t.color));if(p.length===1)return Array.from({length:_}).fill(ee.normalizeColor(p[0]));if(p.length===_)return p.map(ee.normalizeColor);const y=_-1,x=p.map(ee.normalizeColor);closed&&x.push(x[0].clone());const m=[x[0]],M=y/(x.length-1);for(let v=1;v<y;v++){const C=v%M/M,O=Math.floor(v/M);m.push(x[O].clone().lerp(x[O+1],C))}return m.push(x[x.length-1]),m}const s=new Rs,r=new Qi,i=new Eh(r,s),{sizes:a,invalidate:c}=ee.useTresContext(),h=u.computed(()=>Array.isArray(t.vertexColors));function d(p,_){p.color=ee.normalizeColor(_.color),p.linewidth=_.lineWidth,p.alphaToCoverage=_.alphaToCoverage,p.worldUnits=_.worldUnits,p.vertexColors=Array.isArray(_.vertexColors),p.dashed=_.dashed,p.dashScale=_.dashScale,p.dashSize=_.dashSize,p.dashOffset=_.dashOffset,p.gapSize=_.gapSize,p.needsUpdate=!0}function f(p,_,y){const x=_.map(M=>M instanceof l.Vector3?[M.x,M.y,M.z]:M instanceof l.Vector2?[M.x,M.y,0]:Array.isArray(M)&&M.length===2?[M[0],M[1],0]:M).flat();p.setPositions(x.flat());const m=n(y,_.length).map(M=>M.toArray()).flat();p.setColors(m),i.computeLineDistances()}d(s,t),f(r,t.points,t.vertexColors),i.computeLineDistances(),u.watch(()=>[t.color,t.lineWidth,t.alphaToCoverage,t.worldUnits,h,t.dashed,t.dashScale,t.dashSize,t.dashOffset],()=>{d(s,t),c()}),u.watch(()=>[t.points,t.vertexColors],()=>{f(r,t.points,t.vertexColors),c()}),u.watch(()=>[a.height,a.width],()=>{s.resolution=new l.Vector2(a.width.value,a.height.value),c()}),u.onUnmounted(()=>{r.dispose(),s.dispose()});const g=u.shallowRef();return e({instance:g}),(p,_)=>(u.openBlock(),u.createElementBlock("primitive",{ref:g.value,object:u.unref(i)},null,8,Yh))}}),Wh=u.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,{expose:e}){const t=o;function n(c,h,d,f){const g=c.map(p=>p instanceof l.Vector3?p:new l.Vector3(...p));return new l.CatmullRomCurve3(g,h,d,f)}function s(c,h){return c.getPoints(h)}const r=u.computed(()=>n(t.points,t.closed,t.curveType,t.tension)),i=u.computed(()=>s(r.value,t.segments)),a=u.shallowRef();return e({instance:a}),(c,h)=>(u.openBlock(),u.createBlock(Ji,{ref:a.value,points:i.value,"vertex-colors":t.vertexColors,color:t.color,"line-width":t.lineWidth,"alpha-to-coverage":t.alphaToCoverage,dashed:t.dashed,"dash-size":t.dashSize,"dash-scale":t.dashScale,"dash-offset":t.dashOffset,"gap-size":t.gapSize,"world-units":t.worldUnits},null,8,["points","vertex-colors","color","line-width","alpha-to-coverage","dashed","dash-size","dash-scale","dash-offset","gap-size","world-units"]))}}),Xh=["args"],Zh=["color"],Kh=u.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:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"circleRef",ref:i},a.$attrs),[u.createElementVNode("TresCircleGeometry",{args:u.unref(n)},null,8,Xh),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,Zh)])],16))}}),qh=["args"],Qh=["color"],Jh=u.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:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"coneRef",ref:i},a.$attrs),[u.createElementVNode("TresConeGeometry",{args:u.unref(n)},null,8,qh),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,Qh)])],16))}}),Hh=["args"],$h=["color"],ef=u.defineComponent({__name:"Cylinder",props:{args:{default:()=>[1,1,1,32,1,!1,0,Math.PI*2]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"cylinderRef",ref:i},a.$attrs),[u.createElementVNode("TresCylinderGeometry",{args:u.unref(n)},null,8,Hh),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,$h)])],16))}}),tf=["args"],nf=["color"],sf=u.defineComponent({__name:"Dodecahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),r=u.shallowRef(),{invalidate:i}=ee.useTresContext();return u.watch(n,()=>i()),e({instance:r}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"dodecahedronRef",ref:r},a.$attrs),[u.createElementVNode("TresDodecahedronGeometry",{args:u.unref(n)},null,8,tf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,nf)])],16))}}),rf=["args"],of=["color"],af=u.defineComponent({__name:"Icosahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"icosahedronRef",ref:i},a.$attrs),[u.createElementVNode("TresIcosahedronGeometry",{args:u.unref(n)},null,8,rf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,of)])],16))}}),lf=["args"],cf=["color"],uf=u.defineComponent({__name:"Octahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"octahedronRef",ref:i},a.$attrs),[u.createElementVNode("TresOctahedronGeometry",{args:u.unref(n)},null,8,lf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,cf)])],16))}}),hf=["rotation"],ff=["args"],df=["color"],pf=u.defineComponent({__name:"Plane",props:{args:{default:()=>[1,1]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"planeRef",ref:i,rotation:[-Math.PI/2,0,0]},a.$attrs),[u.createElementVNode("TresPlaneGeometry",{args:u.unref(n)},null,8,ff),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,df)])],16,hf))}}),mf=["args"],gf=["color"],yf=u.defineComponent({__name:"Ring",props:{args:{default:()=>[.5,1,32]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"ringRef",ref:i},a.$attrs),[u.createElementVNode("TresRingGeometry",{args:u.unref(n)},null,8,mf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,gf)])],16))}}),_f=["args"],xf=["color"],vf=u.defineComponent({__name:"RoundedBox",props:{args:{default:()=>[1,1,1,2,.1]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r,extend:i}=ee.useTresContext();i({RoundedBoxGeometry:qa}),u.watch(n,()=>r());const a=u.shallowRef();return e({instance:a}),(c,h)=>(u.openBlock(),u.createElementBlock("TresMesh",{ref_key:"roundedBoxRef",ref:a},[u.createElementVNode("TresRoundedBoxGeometry",{args:u.unref(n)},null,8,_f),u.renderSlot(c.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,xf)])],512))}}),wf=["args"],bf=["color"],Mf=u.defineComponent({__name:"Sphere",props:{args:{default:()=>[2,32,16]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"sphereRef",ref:i},a.$attrs),[u.createElementVNode("TresSphereGeometry",{args:u.unref(n)},null,8,wf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,bf)])],16))}}),Sf=["geometry"],Af=["color"],Cf=u.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,{invalidate:n}=ee.useTresContext(),{cos:s,sin:r,abs:i}=Math,a=u.shallowRef(),c=u.shallowRef(t.color);function h(p,_){const y=new l.BufferGeometry,x=p*_,m=new Float32Array(Array.from({length:3*x}).fill(0)),M=new Float32Array(Array.from({length:3*x}).fill(0)),v=[];for(let C=0;C<_-1;C++){for(let P=0;P<p-1;P++){const w=C*p+P,D=w+1,L=w+p,V=D+p;v.push(w,L,D),v.push(L,V,D)}const O=C*p+p-1,S=C*p,A=O+p,b=S+p;v.push(O,A,S),v.push(A,b,S)}return y.setIndex(v),y.setAttribute("position",new l.BufferAttribute(m,3)),y.setAttribute("normal",new l.BufferAttribute(M,3)),y}function d(p,_,y,x,m){return(i(s(_*p*.25))**x+i(r(_*p*.25))**m)**(-1/y)}function f(p,_,y,x,m,M,v,C,O,S,A){const b=2*Math.PI/S,P=-Math.PI,w=Math.PI/(A-1),D=-.5*Math.PI,L=p.getAttribute("position");let V=0,R=0,Y=D;for(let W=0;W<A;W++){R=P;for(let $=0;$<S;$++){const q=d(R,_,y,x,m),ne=d(Y,M,v,C,O);L.setXYZ(V,q*s(R)*ne*s(Y),ne*r(Y),q*r(R)*ne*s(Y)),V++,R+=b}Y+=w}L.needsUpdate=!0,p.computeVertexNormals()}u.watch(()=>t.color,()=>c.value=t.color),u.watch(()=>[t.widthSegments,t.heightSegments],()=>{a.value&&a.value.dispose(),a.value=h(t.widthSegments,t.heightSegments),n()},{immediate:!0}),u.watch(()=>[t.numArmsA,t.expA[0],t.expA[1],t.expA[2],t.numArmsB,t.expB[0],t.expB[1],t.expB[2]],()=>{f(a.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),n()},{immediate:!0}),u.onUnmounted(()=>{a.value&&a.value.dispose()});const g=u.shallowRef();return e({instance:g}),(p,_)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"superformulaRef",ref:g},p.$attrs,{geometry:a.value}),[u.renderSlot(p.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:c.value},null,8,Af)])],16,Sf))}}),Pf=["rotation"],Tf=["args"],If=["color"],Of=u.defineComponent({__name:"Tetrahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),r=u.shallowRef();return e({instance:r}),(i,a)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"tetrahedronRef",ref:r,rotation:[-Math.PI/2,0,0]},i.$attrs),[u.createElementVNode("TresTetrahedronGeometry",{args:u.unref(n)},null,8,Tf),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,If)])],16,Pf))}}),Df=["args"],Lf=["color"],Bf=u.defineComponent({__name:"Torus",props:{args:{default:()=>[1,1,16,80]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"torusRef",ref:i},a.$attrs),[u.createElementVNode("TresTorusGeometry",{args:u.unref(n)},null,8,Df),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,Lf)])],16))}}),kf=["args"],Ff=["color"],Uf=u.defineComponent({__name:"TorusKnot",props:{args:{default:()=>[1,.4,64,8]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"torusKnotRef",ref:i},a.$attrs),[u.createElementVNode("TresTorusKnotGeometry",{args:u.unref(n)},null,8,kf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,Ff)])],16))}}),Nf=["args"],zf=["color"],Vf=u.defineComponent({__name:"Tube",props:{args:{default:()=>[new l.QuadraticBezierCurve3(new l.Vector3(-1,0,0),new l.Vector3(0,1,0),new l.Vector3(1,0,0)),20,.2,8,!1]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:s}=u.toRefs(t),{invalidate:r}=ee.useTresContext();u.watch(n,()=>r());const i=u.shallowRef();return e({instance:i}),(a,c)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"tubeRef",ref:i},a.$attrs),[u.createElementVNode("TresTubeGeometry",{args:u.unref(n)},null,8,Nf),u.renderSlot(a.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(s)},null,8,zf)])],16))}});class Rf extends l.Object3D{constructor(){super();ue(this,"virtualScene",null);this.virtualScene=new l.Scene}add(...t){return this.virtualScene.add(...t),this}destructor(){this.virtualScene.traverse(t=>{t instanceof l.Mesh&&(t.geometry.dispose(),t.material.dispose(),t.material.map&&t.material.map.dispose(),this.virtualScene.remove(t))}),this.virtualScene=null}}const Gf=u.defineComponent({__name:"component",props:{background:{type:[Boolean,String],default:!1},blur:{default:0},files:{default:()=>[]},path:{default:""},preset:{default:void 0},resolution:{default:256},near:{default:1},far:{default:1e3},frames:{default:Number.POSITIVE_INFINITY}},async setup(o,{expose:e}){let t,n;const s=o,r=u.ref(null);e({texture:r});const{extend:i,renderer:a,scene:c}=ee.useTresContext();let h=null;const d=u.ref(null);let f=null;const g=u.ref(null),{onBeforeRender:p}=ee.useLoop();let _=1;p(()=>{f&&g.value&&d.value&&(s.frames===Number.POSITIVE_INFINITY||_<s.frames)&&(f.update(a.value,u.toRaw(g.value.virtualScene)),_++)},-1);const y=([t,n]=u.withAsyncContext(()=>ni(s,d)),t=await t,n(),t),x=m=>{m?(c.value.environment=m.texture,s.background&&(c.value.background=m.texture)):(c.value.environment=y.value,s.background&&(c.value.background=y.value))};return u.watch(y,()=>{d.value&&x(d.value)},{immediate:!0,deep:!0}),u.watch(()=>u.useSlots().default,m=>{var M,v;if(m&&(h=m,Array.isArray(h)&&h.length>0&&typeof((M=h[0])==null?void 0:M.type)!="symbol")){i({EnvSence:Rf}),d.value=new l.WebGLCubeRenderTarget(s.resolution),d.value.texture.type=l.HalfFloatType,f=new l.CubeCamera(s.near,s.far,d.value),x(d.value);return}(v=d.value)==null||v.dispose(),d.value=null,x()},{immediate:!0,deep:!0}),r.value=y.value,u.onUnmounted(()=>{var m,M;(m=g.value)==null||m.destructor(),(M=d.value)==null||M.dispose()}),(m,M)=>d.value?(u.openBlock(),u.createElementBlock("TresEnvSence",{key:0,ref_key:"envSence",ref:g},[u.renderSlot(m.$slots,"default")],512)):u.createCommentVNode("",!0)}}),jf={key:0,args:[0,1,64]},Ef={key:1,args:[.5,1,64]},Yf={key:2},Wf=["tone-mapped","map","side","color"],Xf=u.defineComponent({__name:"index",props:{args:{default:null},from:{default:"rect"},toneMapped:{type:Boolean,default:!1},map:{default:null},intensity:{default:1},color:{default:new l.Color(16777215)}},setup(o){const e=o,t=u.ref();return u.watchEffect(()=>{t.value&&(t.value.color.multiplyScalar(e.intensity),t.value.needsUpdate=!0)}),(n,s)=>(u.openBlock(),u.createElementBlock("TresMesh",null,[n.from==="circle"?(u.openBlock(),u.createElementBlock("TresRingGeometry",jf)):n.from==="ring"?(u.openBlock(),u.createElementBlock("TresRingGeometry",Ef)):n.from==="rect"?(u.openBlock(),u.createElementBlock("TresPlaneGeometry",Yf)):(u.openBlock(),u.createBlock(e.from,{key:3,args:e})),u.createElementVNode("TresMeshBasicMaterial",{ref_key:"material",ref:t,"tone-mapped":n.toneMapped,map:n.map,side:u.unref(l.DoubleSide),color:n.color},null,8,Wf)]))}}),Zf=["receive-shadow","rotation"],Kf=["args"],qf=u.createElementVNode("TresMeshStandardMaterial",{color:8421504,side:2},null,-1),Qf=u.defineComponent({__name:"Backdrop",props:{floor:{default:.25},segments:{default:20},receiveShadow:{type:Boolean,default:!1}},setup(o,{expose:e}){const t=o,n=h=>h===0?0:2**(10*h-10),{floor:s,segments:r,receiveShadow:i}=u.toRefs(t),a=u.ref(null);u.watch([r,s,a],([h,d,f])=>{if(!f||h===null)return;let g=0;const p=h/h/2,_=f.attributes.position;for(let y=0;y<h+1;y++)for(let x=0;x<h+1;x++)_.setXYZ(g++,y/h-p+(y===0?-d:0),x/h-p,n(y/h));_.needsUpdate=!0,f.computeVertexNormals()});const c=u.shallowRef();return e({instance:c}),(h,d)=>(u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps({ref_key:"backdropRef",ref:c},h.$attrs),[u.createElementVNode("TresMesh",{"receive-shadow":u.unref(i),rotation:[-Math.PI/2,0,Math.PI/2]},[u.createElementVNode("TresPlaneGeometry",{ref_key:"planeRef",ref:a,args:[1,1,u.unref(r),u.unref(r)]},null,8,Kf),u.renderSlot(h.$slots,"default",{},()=>[qf])],8,Zf)],16))}}),Jf=["object"],Hf=u.defineComponent({__name:"ContactShadows",props:{opacity:{default:1},blur:{default:1},color:{default:"#000000"},tint:{default:void 0},scale:{default:10},width:{default:1},height:{default:1},far:{default:10},smooth:{type:Boolean,default:!0},resolution:{default:512},frames:{default:Number.POSITIVE_INFINITY},depthWrite:{type:Boolean,default:!1}},setup(o,{expose:e}){const t=o;function n(p,_,y){y.blurPlane.visible=!0,y.blurPlane.material=y.horizontalBlurMaterial,y.horizontalBlurMaterial.uniforms.tDiffuse.value=y.renderTarget.texture,y.horizontalBlurMaterial.uniforms.h.value=p/256,_.setRenderTarget(y.renderTargetBlur),_.render(y.blurPlane,y.shadowCamera),y.blurPlane.material=y.verticalBlurMaterial,y.verticalBlurMaterial.uniforms.tDiffuse.value=y.renderTargetBlur.texture,y.verticalBlurMaterial.uniforms.v.value=p/256,_.setRenderTarget(y.renderTarget),_.render(y.blurPlane,y.shadowCamera),y.blurPlane.visible=!1}function s(p,_,y,x){const{renderTarget:m,shadowCamera:M,depthMaterial:v}=x,C=_.background;_.background=null,_.overrideMaterial=v;const O=y.getClearAlpha();y.setClearAlpha(0),y.setRenderTarget(m),y.render(_,M),_.overrideMaterial=null,n(p.blur,y,x),p.smooth&&n(p.blur*.4,y,x),y.setRenderTarget(null),y.setClearAlpha(O),_.background=C}function r(p){const _=new l.Group,y=new l.WebGLRenderTarget(p.resolution,p.resolution);y.texture.generateMipmaps=!1;const x=new l.WebGLRenderTarget(p.resolution,p.resolution);x.texture.generateMipmaps=!1;const m=new l.PlaneGeometry(p.width,p.height).rotateX(Math.PI/2),M=new l.MeshBasicMaterial({map:y.texture,opacity:p.opacity,transparent:!0,depthWrite:p.depthWrite,color:new l.Color(p.color??"black")}),v=new l.Mesh(m,M);_.add(v),v.scale.y=-1;const C=new l.Mesh(m);C.visible=!1,_.add(C);const O=new l.OrthographicCamera(-p.width/2,p.width/2,p.height/2,-p.height/2,0,.3);O.rotation.x=Math.PI/2,_.add(O);const S=new l.MeshDepthMaterial,A=new l.ShaderMaterial(Qa);A.depthTest=!1;const b=new l.ShaderMaterial(Ja);return b.depthTest=!1,{renderTarget:y,renderTargetBlur:x,shadowCamera:O,depthMaterial:S,horizontalBlurMaterial:A,verticalBlurMaterial:b,shadowGroup:_,plane:v,blurPlane:C}}function i(p,_){const y=_.shadowCamera;y.left=-p.width/2,y.right=p.width/2,y.top=p.height/2,y.bottom=-p.height/2,y.far=p.far;const x=p.width*(Array.isArray(p.scale)?p.scale[0]:p.scale||1),m=p.height*(Array.isArray(p.scale)?p.scale[1]:p.scale||1);_.shadowGroup.scale.set(x,p.far,m)}function a(p,_){_.renderTarget.dispose(),_.renderTargetBlur.dispose(),_.renderTarget=new l.WebGLRenderTarget(p,p),_.renderTarget.texture.generateMipmaps=!1,_.renderTargetBlur=new l.WebGLRenderTarget(p,p),_.renderTargetBlur.texture.generateMipmaps=!1,_.plane.material.map=_.renderTarget.texture}function c(p,_){_.plane.material.color=new l.Color(p.color??"black"),_.depthMaterial.dispose(),_.depthMaterial=new l.MeshDepthMaterial,_.depthMaterial.onBeforeCompile=function(y){const x=p.tint?new l.Color(p.tint):new l.Color("white"),{r:m,g:M,b:v}=x;y.fragmentShader=`
|
|
1320
|
+
${y.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );",`gl_FragColor = vec4( ${m}, ${M}, ${v}, ( 1.0 - fragCoordZ ) * opacity);`)}
|
|
1321
|
+
`}}const{onBeforeRender:h}=ee.useLoop(),d=r(t);let f=0;const g=()=>f=f>=t.frames?t.frames-1:f;return h(({renderer:p,scene:_,invalidate:y})=>{f<t.frames&&(f++,s(t,_,p,d),y())}),u.watch(()=>[t.opacity,t.depthWrite,t.blur,t.smooth],()=>{d.plane.material.opacity=t.opacity??1,d.plane.material.depthWrite=t.depthWrite??!1,g()},{immediate:!0}),u.watch(()=>[t.color,t.tint],()=>{c(t,d),g()},{immediate:!0}),u.watch(()=>[t.resolution],()=>{a(t.resolution,d),g()}),u.watch(()=>[t.width,t.height,t.scale,t.far],()=>{i(t,d),g()},{immediate:!0}),u.onUnmounted(()=>{for(const p of Object.values(d))p&&"dispose"in p&&typeof p.dispose=="function"&&p.dispose()}),e({instance:d.shadowGroup}),(p,_)=>(u.openBlock(),u.createElementBlock("primitive",{object:u.unref(d).shadowGroup},null,8,Jf))}}),$f=u.defineComponent({__name:"Fit",props:{into:{default:()=>new l.Box3(new l.Vector3(-.5,-.5,-.5),new l.Vector3(.5,.5,.5))},precise:{type:Boolean,default:!1}},setup(o,{expose:e}){const t=o,{invalidate:n}=ee.useTresContext(),s=u.shallowRef(new l.Group),r=u.shallowRef(new l.Group);function i(h,d){if(s.value.position.set(0,0,0),s.value.updateMatrixWorld(),r.value.scale.set(1,1,1),r.value.updateMatrixWorld(),!r.value.children.length||h===null)return;const{box3:f,use:g}=a(h,d),p=new l.Box3;r.value.children.forEach(M=>p.expandByObject(M,d));const _=p.getSize(new l.Vector3),y=f.getSize(new l.Vector3),x=Math.min(y.x/_.x,y.y/_.y,y.z/_.z);r.value.scale.setScalar(x===Number.POSITIVE_INFINITY?1:x),r.value.updateMatrixWorld();const m=s.value.worldToLocal(p.getCenter(new l.Vector3));if(g.position){const M=s.value.worldToLocal(f.getCenter(new l.Vector3));s.value.position.copy(M.sub(m.multiplyScalar(x)))}else s.value.position.copy(m.sub(m.multiplyScalar(x)));n()}function a(h,d){return typeof h=="number"?h=new l.Vector3(h,h,h):Array.isArray(h)&&(h=new l.Vector3(...h)),h&&"isVector3"in h&&h.isVector3?{box3:new l.Box3(new l.Vector3(0,0,0),h),use:{position:!1}}:h&&"isBox3"in h&&h.isBox3?{box3:h,use:{position:!0}}:h&&"isObject3D"in h&&h.isObject3D?{box3:new l.Box3().setFromObject(h,d??!1),use:{position:!0}}:{box3:new l.Box3(new l.Vector3(-.5,-.5,-.5),new l.Vector3(.5,.5,.5)),use:{position:!0}}}u.watch(()=>[t.into,t.precise],()=>i(t.into,t.precise)),u.onMounted(()=>{i(t.into,t.precise),u.nextTick().then(()=>{i(t.into,t.precise)})});const c=u.shallowRef();return e({instance:c,fit:(h=new l.Box3(new l.Vector3(-.5,-.5,-.5),new l.Vector3(.5,.5,.5)),d=!1)=>{i(h,d)},update:()=>i(t.into,t.precise)}),(h,d)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"outer",ref:c},[u.createElementVNode("TresGroup",{ref_key:"middle",ref:s},[u.createElementVNode("TresGroup",{ref_key:"inner",ref:r},[u.renderSlot(h.$slots,"default")],512)],512)],512))}}),ed=["size","color","alpha-map","map","opacity","alpha-test","depth-write","transparent","size-attenuation"],td=["position","velocity"],nd=u.defineComponent({__name:"Precipitation",props:{size:{default:.1},area:{default:()=>[10,10,20]},color:{default:16777215},map:{},alphaMap:{},alphaTest:{default:.01},opacity:{default:.8},count:{default:5e3},speed:{default:.1},randomness:{default:.5},depthWrite:{type:Boolean,default:!1},transparent:{type:Boolean,default:!0},sizeAttenuation:{type:Boolean,default:!0}},setup(o,{expose:e}){const t=o,{size:n,area:s,color:r,alphaMap:i,map:a,opacity:c,alphaTest:h,depthWrite:d,transparent:f,sizeAttenuation:g,count:p,speed:_,randomness:y}=u.toRefs(t),x=u.shallowRef();let m=[],M=[];const v=()=>{m=new Float32Array(p.value*3);for(let A=0;A<p.value;A++){const b=A*3;m[b]=(Math.random()-.5)*s.value[0],m[b+1]=(Math.random()-.5)*s.value[1],m[b+2]=(Math.random()-.5)*s.value[2]}},C=()=>{M=new Float32Array(p.value*2);for(let A=0;A<p.value*2;A+=2)M[A]=(Math.random()-.5)/5*_.value*y.value,M[A+1]=Math.random()/5*_.value};C(),v(),u.watchEffect(()=>{C(),v()});const{onBeforeRender:O}=ee.useLoop();O(({invalidate:A})=>{var b,P;if((b=x.value)!=null&&b.attributes.position.array&&((P=x.value)!=null&&P.attributes.position.count)){const w=x.value.attributes.position.array;for(let D=0;D<x.value.attributes.position.count;D++){const L=M[D*2],V=M[D*2+1];w[D*3]+=L,w[D*3+1]-=V,(w[D*3]<=-s.value[0]/2||w[D*3]>=s.value[0]/2)&&(w[D*3]=w[D*3]*-1),(w[D*3+1]<=-s.value[1]/2||w[D*3+1]>=s.value[1]/2)&&(w[D*3+1]=w[D*3+1]*-1)}x.value.attributes.position.needsUpdate=!0,A()}});const S=u.shallowRef();return e({instance:S}),(A,b)=>(u.openBlock(),u.createElementBlock("TresPoints",{ref_key:"pointsRef",ref:S},[u.createElementVNode("TresPointsMaterial",{size:u.unref(n),color:u.unref(r),"alpha-map":u.unref(i),map:u.unref(a),opacity:u.unref(c),"alpha-test":u.unref(h),"depth-write":u.unref(d),transparent:u.unref(f),"size-attenuation":u.unref(g)},null,8,ed),u.createElementVNode("TresBufferGeometry",{ref_key:"geometryRef",ref:x,position:[u.unref(m),3],velocity:[u.unref(M)]},null,8,td)],512))}}),sd=["object","material-uniforms-turbidity-value","material-uniforms-rayleigh-value","material-uniforms-mieCoefficient-value","material-uniforms-mieDirectionalG-value","material-uniforms-sunPosition-value","scale"],rd=u.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,{expose:e}){const t=o,{invalidate:n}=ee.useTresContext();u.watch(t,()=>n());const s=u.shallowRef(),r=new ss,i=u.computed(()=>a(t.azimuth,t.elevation));function a(c,h){const d=l.MathUtils.degToRad(90-h),f=l.MathUtils.degToRad(c);return new l.Vector3().setFromSphericalCoords(1,d,f)}return e({instance:s,sunPosition:i.value}),(c,h)=>(u.openBlock(),u.createElementBlock("primitive",{ref_key:"skyRef",ref:s,object:u.unref(r),"material-uniforms-turbidity-value":t.turbidity,"material-uniforms-rayleigh-value":t.rayleigh,"material-uniforms-mieCoefficient-value":t.mieCoefficient,"material-uniforms-mieDirectionalG-value":t.mieDirectionalG,"material-uniforms-sunPosition-value":i.value,scale:t.distance},null,8,sd))}}),id=["position"],od=["position"],ad=["scale"],ld=["map","depth-test","color-space","color","opacity"],cd=u.defineComponent({__name:"Smoke",props:{color:{default:"#ffffff"},opacity:{default:.5},speed:{default:.4},width:{default:10},depth:{default:1.5},segments:{default:20},texture:{default:"https://raw.githubusercontent.com/Tresjs/assets/main/textures/clouds/defaultCloud.png"},depthTest:{type:Boolean,default:!0}},async setup(o,{expose:e}){let t,n;const s=o,{width:r,depth:i,segments:a,texture:c,color:h,depthTest:d,opacity:f,speed:g}=u.toRefs(s),p=u.shallowRef(),_=u.shallowRef();e({instance:p});const y=[a].map((S,A)=>({x:r.value/2-Math.random()*r.value,y:r.value/2-Math.random()*r.value,scale:.4+Math.sin((A+1)/a.value*Math.PI)*((.2+Math.random())*10),density:Math.max(.2,Math.random()),rotation:Math.max(.002,.005*Math.random())*g.value})),x=(S,A)=>S/6*A*f.value,{map:m}=([t,n]=u.withAsyncContext(()=>ee.useTexture({map:c.value})),t=await t,n(),t),{renderer:M,camera:v}=ee.useTresContext(),C=u.computed(()=>{var S;return(S=M.value)==null?void 0:S.outputColorSpace}),{onBeforeRender:O}=ee.useLoop();return O(({invalidate:S})=>{var A,b;p.value&&v.value&&_.value&&((A=_.value)==null||A.children.forEach((P,w)=>{P.rotation.z+=y[w].rotation}),p.value.lookAt((b=v.value)==null?void 0:b.position),S())}),(S,A)=>(u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps({ref_key:"smokeRef",ref:p},S.$attrs),[u.createElementVNode("TresGroup",{ref_key:"groupRef",ref:_,position:[0,0,u.unref(a)/2*u.unref(i)]},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(u.unref(y),({scale:b,x:P,y:w,density:D},L)=>(u.openBlock(),u.createElementBlock("TresMesh",{key:`${L}`,position:[P,w,-L*u.unref(i)]},[u.createElementVNode("TresPlaneGeometry",{scale:[b,b,b],rotation:[0,0,0]},null,8,ad),u.createElementVNode("TresMeshStandardMaterial",{map:u.unref(m),"depth-test":u.unref(d),"color-space":C.value,color:u.unref(h),"depth-write":!1,transparent:"",opacity:x(b,D)},null,8,ld)],8,od))),128))],8,id)],16))}});function ud(o){return Ws(o,{normalizeValue:e=>ee.normalizeColor(e),getDefaultValue:()=>new l.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 Ys(o){return"isVector3"in o||Array.isArray(o)&&o.length>0&&o.every(e=>typeof e=="number")}function hd(o){return Ws(o,{normalizeValue:e=>ee.normalizeVectorFlexibleParam(e),getDefaultValue:()=>[0,0,0],isSingleValue:e=>Ys(e),isMultipleValues:e=>Array.isArray(e)&&e.length>0&&Ys(e[0]),isMultipleValuesWithStops:e=>Array.isArray(e)&&e.length>0&&Array.isArray(e[0])&&e[0].length===2&&Ys(e[0][1]),isEmpty:e=>Array.isArray(e)&&e.length===0})}function fd(o){return Ws(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 Ws(o,e){const{normalizeValue:t,getDefaultValue:n,isEmpty:s}=e,r=c=>e.isSingleValue(c),i=c=>e.isMultipleValues(c),a=c=>e.isMultipleValuesWithStops(c);if(s(o))return[[0,n()]];if(r(o))return[[0,t(o)]];if(i(o)){const c=o.length>1?1/(o.length-1):1;return o.map((h,d)=>[c*d,t(h)])}else if(a(o))return o.map(([c,h],d)=>[c,t(h)]);return[[0,n()]]}class dd{constructor(e,t){ue(this,"entries");ue(this,"resolution");this.entries=e,this.resolution=t}useTexture(){return new gd(this.entries,this.resolution).use()}}class Xs{constructor(e,t,n,s,r,i){ue(this,"data");ue(this,"ref");ue(this,"name");ue(this,"valueMin");ue(this,"valueMax");ue(this,"suffix");ue(this,"renderToCanvasGradient");this.data=u.isRef(e)?e.value:e,this.ref=u.isRef(e)?e:null,this.name=t,this.valueMin=n,this.valueMax=s,this.suffix=r,this.renderToCanvasGradient=i}}class pd extends Xs{constructor(e,t="color",n=0,s=1,r="rgba",i=yd){super(e,t,n,s,r,i)}}class Hi extends Xs{constructor(e,t="scalar",n=0,s=1,r="x",i=_d){super(e,t,n,s,r,i)}}class md extends Xs{constructor(e,t="scalar3",n=0,s=1,r="xyz",i=xd){super(e,t,n,s,r,i)}}class gd{constructor(e,t){ue(this,"entries");ue(this,"size");ue(this,"dirty",u.shallowRef(0));ue(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=u.shallowRef(e);for(const n of this.entries)n.ref&&u.watch(n.ref,()=>{var s;n.data=(s=n.ref)==null?void 0:s.value,u.triggerRef(this.dirty)});return Gl(this.dirty,()=>{this.build(e),t.value=e},{throttle:1e3/60}),{texture:t,dispose:()=>e.dispose(),yFor:this.entries.reduce((n,s,r)=>(n[s.name]=(r+.5)/this.size,n),{})}}build(e){this.entries.forEach((n,s)=>{const r=this.context.createLinearGradient(0,s,this.size,s);n.renderToCanvasGradient(r,n),this.context.fillStyle=r,this.context.fillRect(0,s,this.size,1)}),e&&(e.source.data=this.context.getImageData(0,0,this.size,this.size));const t=e??new l.DataTexture(this.context.getImageData(0,0,this.size,this.size).data,this.size,this.size,l.RGBAFormat,l.UnsignedByteType,l.UVMapping,l.ClampToEdgeWrapping,l.ClampToEdgeWrapping);return t.needsUpdate=!0,t}}function $i(o,e,t,n,s){return wu(St(o,e,t),e,t,n,s)}function yd(o,e){return ud(e.data).forEach(([t,n])=>o.addColorStop(t,`rgb(${n.r*255}, ${n.g*255}, ${n.b*255})`))}function _d(o,e){return fd(e.data).forEach(([t,n])=>{o.addColorStop(t,`rgb(${$i(n,e.valueMin,e.valueMax,0,255)}, 0, 0)`)})}function xd(o,e){return hd(e.data).forEach(([t,n])=>o.addColorStop(t,`rgb(${n.map(s=>$i(s,e.valueMin,e.valueMax,0,255))})`))}class vd{constructor(e=256){ue(this,"entries");ue(this,"resolution");this.resolution=e,this.entries=[]}withResolution(e){return this.resolution=e,this}get add(){return new bd(e=>this.onAdd(e))}build(){return new dd(this.entries,this.resolution)}onAdd(e){return this.entries.push(e),new wd(e,this)}}class wd{constructor(e,t){ue(this,"entry");ue(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 bd{constructor(e){ue(this,"onAdd");this.onAdd=e}GradientTresColor(e){return this.onAdd(new pd(e))}Gradient01(e){return this.onAdd(new Hi(e,"zeroOne",0,1))}GradientScalar(e,t,n){return this.onAdd(new Hi(e,"scalar",t,n))}GradientXyz(e,t,n){return this.onAdd(new md(e,"position",t,n))}}let Zs=null;function Md(){return Zs===null&&(Zs=new l.DataTexture(new Uint8Array([0,0,0,0]),1,1)),Zs}const Sd=["object"],Ad=u.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:l.AdditiveBlending},transparent:{type:Boolean,default:!0},depthWrite:{type:Boolean,default:!1}},setup(o,{expose:e}){const t=o,n=Number.parseInt(l.REVISION.replace(/\D+/g,"")),s=u.toRefs(t),r=typeof t.map=="string"?Md():t.map,{texture:i,yFor:a}=new vd(256).add.GradientTresColor(s.sequenceColor).id("sequenceColor").add.Gradient01(s.sequenceAlpha).id("sequenceAlpha").add.Gradient01(s.sequenceSurfaceDistance).id("sequenceSurfaceDistance").add.Gradient01(s.sequenceSize).id("sequenceSize").add.GradientXyz(s.sequenceOffset,-1,1).id("sequenceOffset").add.GradientXyz(s.sequenceNoise,0,1).id("sequenceNoise").build().useTexture(),c={blending:t.blending,transparent:t.transparent,depthWrite:t.depthWrite,uniforms:{uMap:new l.Uniform(r),uPixelRatio:new l.Uniform(1),uNormal:new l.Uniform(l.Object3D.DEFAULT_UP),uNormalThreshold:new l.Uniform(t.normalThreshold),uTime:new l.Uniform(0),uCooldownRatio:new l.Uniform(1),uSize:new l.Uniform(t.size),uAlpha:new l.Uniform(t.alpha),uOffset:new l.Uniform(t.offset),uSurfaceDistance:new l.Uniform(t.surfaceDistance),uNoiseScale:new l.Uniform(t.noiseScale),uScaleNoise:new l.Uniform(t.scaleNoise),uOffsetNoise:new l.Uniform(t.offsetNoise),uLifetimeNoise:new l.Uniform(t.lifetimeNoise),uMixColor:new l.Uniform(t.mixColor),uMixAlpha:new l.Uniform(t.mixAlpha),uMixOffset:new l.Uniform(t.mixOffset),uMixSize:new l.Uniform(t.mixSize),uMixSurfaceDistance:new l.Uniform(t.mixSurfaceDistance),uMixNoise:new l.Uniform(t.mixNoise),uInfoTexture:new l.Uniform(i.value)},vertexShader:`
|
|
1322
1322
|
uniform float uPixelRatio;
|
|
1323
1323
|
uniform vec3 uNormal;
|
|
1324
1324
|
uniform float uNormalThreshold;
|
|
@@ -1389,7 +1389,7 @@ list should be an Array.`),T.length===0)return new x(0);if(T.length===1)return T
|
|
|
1389
1389
|
gl_FragColor = vColor * texture2D(uMap, gl_PointCoord);
|
|
1390
1390
|
#include <tonemapping_fragment>
|
|
1391
1391
|
#include <${n>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
1392
|
-
}`},h=new l.ShaderMaterial(c),d=new l.Points(void 0,h),f=h.uniforms,y={immediate:!0};[[f.uPixelRatio,ee.useTresContext().sizes.aspectRatio],[f.uSize,s.size],[f.uNormalThreshold,s.normalThreshold],[f.uAlpha,s.alpha],[f.uOffset,s.offset],[f.uOffsetNoise,s.offsetNoise],[f.uMixColor,s.mixColor],[f.uMixAlpha,s.mixAlpha],[f.uMixOffset,s.mixOffset],[f.uMixSize,s.mixSize],[f.uMixSurfaceDistance,s.mixSurfaceDistance],[f.uMixNoise,s.mixNoise],[f.uInfoTexture,i]].forEach(([v,C])=>u.watch(C,()=>{v.value=C.value},y)),u.watch([s.noiseScale,s.lifetimeSec],()=>{f.uNoiseScale.value=s.noiseScale.value*s.lifetimeSec.value},y),u.watch([s.lifetimeSec,s.cooldownSec],()=>{f.uCooldownRatio.value=s.cooldownSec.value/s.lifetimeSec.value},y),u.watch(s.map,()=>{typeof s.map.value=="string"?ee.useTexture([s.map.value]).then(v=>h.uniforms.uMap.value=v):h.uniforms.uMap.value=s.map.value});const _=new l.Quaternion,g=new l.Vector3;ee.useLoop().onBeforeRender(({elapsed:v,invalidate:C})=>{d.getWorldQuaternion(_),g.copy(t.directionalLight?t.directionalLight.position:l.Object3D.DEFAULT_UP).normalize(),g.applyQuaternion(_.invert()),h.uniforms.uNormal.value=g,h.uniforms.uTime.value=v/(t.cooldownSec+t.lifetimeSec),C()});function x(v){return v&&"isObject3D"in v}function m(v){return v&&"isBufferGeometry"in v}u.onMounted(()=>{t.geometry?m(t.geometry)?d.geometry.copy(t.geometry):x(t.geometry)&&"geometry"in t.geometry&&m(t.geometry.geometry)&&d.geometry.copy(t.geometry.geometry):x(d.parent)&&"geometry"in d.parent&&m(d.parent.geometry)?d.geometry.copy(d.parent.geometry):d.geometry=new l.IcosahedronGeometry(1,16),typeof t.map=="string"&&ee.useTexture([t.map]).then(v=>h.uniforms.uMap.value=v)}),u.onUnmounted(()=>{var v;(v=h.uniforms.uMap.value)==null||v.dispose(),i.value.dispose(),h.dispose()});const M=u.shallowRef();return e({instance:d}),(v,C)=>(u.openBlock(),u.createElementBlock("primitive",{ref_key:"sparkleRef",ref:M,object:u.unref(d)},null,8,wd))}}),Md=["position","a-scale"],Sd=["size","size-attenuation","transparent","alpha-test","alpha-map"],Ad=u.defineComponent({__name:"Stars",props:{size:{default:.1},sizeAttenuation:{type:Boolean,default:!0},transparent:{type:Boolean,default:!0},alphaTest:{default:.01},count:{default:5e3},depth:{default:50},radius:{default:100},alphaMap:{default:null}},setup(o,{expose:e}){const t=o,n=u.ref(),s=u.ref(),{radius:r,depth:i,count:a,size:c,sizeAttenuation:h,transparent:d,alphaMap:f,alphaTest:y}=u.toRefs(t),{invalidate:p}=ee.useTresContext();u.watch(t,()=>{p()});const _=()=>{let x=r.value+i.value;const m=u.computed(()=>i.value/a.value),M=[],v=Array.from({length:a.value},()=>(.5+.5*Math.random())*4),C=O=>new l.Vector3().setFromSpherical(new l.Spherical(O,Math.acos(1-Math.random()*2),Math.random()*2*Math.PI)).toArray();for(let O=0;O<a.value;O++)x-=m.value*Math.random(),M.push(...C(x));n.value=new Float32Array(M),s.value=new Float32Array(v)};u.watchEffect(()=>{_()});const g=u.shallowRef();return e({instance:g}),(x,m)=>(u.openBlock(),u.createElementBlock("TresPoints",{ref_key:"starsRef",ref:g},[u.createElementVNode("TresBufferGeometry",{position:[n.value,3],"a-scale":[s.value,1]},null,8,Md),u.createElementVNode("TresPointsMaterial",{size:u.unref(c),"size-attenuation":u.unref(h),transparent:u.unref(d),"alpha-test":u.unref(y),"alpha-map":u.unref(f)},null,8,Sd)],512))}}),Cd=["rotation-x","args"],Pd=u.createElementVNode("TresPlaneGeometry",{args:[1e4,1e4]},null,-1),Td=u.defineComponent({__name:"Ocean",props:{textureWidth:{default:512},textureHeight:{default:512},waterNormals:{default:"https://raw.githubusercontent.com/Tresjs/assets/main/textures/water-normals/Water_1_M_Normal.jpg"},sunDirection:{default:()=>new l.Vector3},sunColor:{default:16777215},waterColor:{default:7695},distortionScale:{default:3.7},size:{default:1},clipBias:{default:0},alpha:{default:1},side:{default:l.FrontSide}},async setup(o,{expose:e}){let t,n;const s=o,{textureWidth:r,textureHeight:i,waterNormals:a,sunDirection:c,sunColor:h,waterColor:d,distortionScale:f,size:y,clipBias:p,alpha:_,side:g}=u.toRefs(s),{extend:x,scene:m}=ee.useTresContext();x({Water:qo});const M=u.shallowRef(),v=u.shallowRef(),C=m.value.fog!==void 0;e({instance:M}),m.value.traverse(A=>{Object.prototype.hasOwnProperty.call(A,"isSky")&&(v.value=A)}),u.onMounted(async()=>{if(await u.nextTick(),v.value){const A=v.value.material.uniforms.sunPosition.value;M.value.material.uniforms.sunDirection.value.copy(A)}});const{normalMap:O}=([t,n]=u.withAsyncContext(()=>ee.useTexture({normalMap:a.value})),t=await t,n(),t);O.wrapS=O.wrapT=l.RepeatWrapping;const{onBeforeRender:S}=ee.useLoop();return S(({delta:A,invalidate:b})=>{M.value.material.uniforms.time.value+=A,b()}),(A,b)=>(u.openBlock(),u.createElementBlock("TresWater",{ref_key:"waterRef",ref:M,"rotation-x":-Math.PI/2,args:[void 0,{textureWidth:u.unref(r),textureHeight:u.unref(i),waterNormals:u.unref(O),sunDirection:u.unref(c),sunColor:u.unref(h),waterColor:u.unref(d),distortionScale:u.unref(f),fog:C,size:u.unref(y),clipBias:u.unref(p),alpha:u.unref(_),side:u.unref(g)}]},[u.renderSlot(A.$slots,"default",{},()=>[Pd])],8,Cd))}});var eo={exports:{}};(function(o,e){(function(t,n){o.exports=n()})(Su,function(){var t=function(){function n(p){return i.appendChild(p.dom),p}function s(p){for(var _=0;_<i.children.length;_++)i.children[_].style.display=_===p?"block":"none";r=p}var r=0,i=document.createElement("div");i.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",i.addEventListener("click",function(p){p.preventDefault(),s(++r%i.children.length)},!1);var a=(performance||Date).now(),c=a,h=0,d=n(new t.Panel("FPS","#0ff","#002")),f=n(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var y=n(new t.Panel("MB","#f08","#201"));return s(0),{REVISION:16,dom:i,addPanel:n,showPanel:s,begin:function(){a=(performance||Date).now()},end:function(){h++;var p=(performance||Date).now();if(f.update(p-a,200),p>c+1e3&&(d.update(1e3*h/(p-c),100),c=p,h=0,y)){var _=performance.memory;y.update(_.usedJSHeapSize/1048576,_.jsHeapSizeLimit/1048576)}return p},update:function(){a=this.end()},domElement:i,setMode:s}};return t.Panel=function(n,s,r){var i=1/0,a=0,c=Math.round,h=c(window.devicePixelRatio||1),d=80*h,f=48*h,y=3*h,p=2*h,_=3*h,g=15*h,x=74*h,m=30*h,M=document.createElement("canvas");M.width=d,M.height=f,M.style.cssText="width:80px;height:48px";var v=M.getContext("2d");return v.font="bold "+9*h+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=r,v.fillRect(0,0,d,f),v.fillStyle=s,v.fillText(n,y,p),v.fillRect(_,g,x,m),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(_,g,x,m),{dom:M,update:function(C,O){i=Math.min(i,C),a=Math.max(a,C),v.fillStyle=r,v.globalAlpha=1,v.fillRect(0,0,d,g),v.fillStyle=s,v.fillText(c(C)+" "+n+" ("+c(i)+"-"+c(a)+")",y,p),v.drawImage(M,_+h,g,x-h,m,_,g,x-h,m),v.fillRect(_+x-h,g,h,m),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(_+x-h,g,h,c((1-C/O)*m))}}},t})})(eo);var Id=eo.exports;const Od=dn(Id),Dd=u.defineComponent({name:"Stats",props:{showPanel:{type:Number,default:0}},setup(o,{expose:e}){const t=new Od;e({instance:t});const n=document.body;t.showPanel(o.showPanel||0),n==null||n.appendChild(t.dom);const{onBeforeRender:s,onAfterRender:r}=ee.useLoop();s(()=>t.begin(),Number.NEGATIVE_INFINITY),r(()=>t.end(),Number.POSITIVE_INFINITY),u.onUnmounted(()=>{n==null||n.removeChild(t.dom)})}});class Ld{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,r=0){let i=1/0,a=0;this.context&&(i=Math.min(i,e),a=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(r)+" "+this.name+" ("+i.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/s)*this.GRAPH_HEIGHT))}}const to=class qt{constructor({logsPerSecond:e=20,samplesLog:t=100,samplesGraph:n=10,precision:s=2,minimal:r=!1,horizontal:i=!0,mode:a=0}={}){this.totalCpuDuration=0,this.totalGpuDuration=0,this.totalGpuDurationCompute=0,this.totalFps=0,this.activeQuery=null,this.gpuQueries=[],this.renderCount=0,this.mode=a,this.horizontal=i,this.dom=document.createElement("div"),this.dom.style.cssText="position:fixed;top:0;left:0;opacity:0.9;z-index:10000;",r&&(this.dom.style.cssText+="cursor:pointer"),this.gl=null,this.query=null,this.isRunningCPUProfiling=!1,this.minimal=r,this.beginTime=(performance||Date).now(),this.prevTime=this.beginTime,this.prevCpuTime=this.beginTime,this.frames=0,this.renderCount=0,this.threeRendererPatched=!1,this.averageCpu={logs:[],graph:[]},this.averageGpu={logs:[],graph:[]},this.averageGpuCompute={logs:[],graph:[]},this.queryCreated=!1,this.fpsPanel=this.addPanel(new qt.Panel("FPS","#0ff","#002"),0),this.msPanel=this.addPanel(new qt.Panel("CPU","#0f0","#020"),1),this.gpuPanel=null,this.gpuPanelCompute=null,this.samplesLog=t,this.samplesGraph=n,this.precision=s,this.logsPerSecond=e,this.minimal?(this.dom.addEventListener("click",c=>{c.preventDefault(),this.showPanel(++this.mode%this.dom.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),this.gpuPanelCompute&&this.resizePanel(this.gpuPanelCompute,3)})}patchThreeRenderer(e){const t=e.render,n=this;e.render=function(s,r){n.begin(),t.call(this,s,r),n.end()},this.threeRendererPatched=!0}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.dom.appendChild(e.canvas),this.resizePanel(e,t)),e}showPanel(e){for(let t=0;t<this.dom.children.length;t++){const n=this.dom.children[t];n.style.display=t===e?"block":"none"}this.mode=e}async init(e){if(!e){console.error('Stats: The "canvas" parameter is undefined.');return}if(e.isWebGLRenderer&&!this.threeRendererPatched){const t=e;this.patchThreeRenderer(t),this.gl=t.getContext()}else!this.gl&&e instanceof WebGL2RenderingContext&&(this.gl=e);if(e.isWebGPURenderer){e.backend.trackTimestamp=!0,await e.hasFeatureAsync("timestamp-query")&&(this.gpuPanel=this.addPanel(new qt.Panel("GPU","#ff0","#220"),2),this.gpuPanelCompute=this.addPanel(new qt.Panel("CPT","#e1e1e1","#212121"),3),this.info=e.info);return}else if(!this.gl&&e instanceof HTMLCanvasElement||e instanceof OffscreenCanvas){if(this.gl=e.getContext("webgl2"),!this.gl){console.error("Stats: Unable to obtain WebGL2 context.");return}}else if(!this.gl){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 qt.Panel("GPU","#ff0","#220"),2))}begin(){this.isRunningCPUProfiling||this.beginProfiling("cpu-started"),!(!this.gl||!this.ext)&&this.gl&&this.ext&&(this.activeQuery&&this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.activeQuery=this.gl.createQuery(),this.activeQuery!==null&&this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,this.activeQuery))}end(){this.renderCount++,this.gl&&this.ext&&this.activeQuery&&(this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.gpuQueries.push({query:this.activeQuery}),this.activeQuery=null)}processGpuQueries(){!this.gl||!this.ext||(this.totalGpuDuration=0,this.gpuQueries.forEach((e,t)=>{if(this.gl){const n=this.gl.getQueryParameter(e.query,this.gl.QUERY_RESULT_AVAILABLE),s=this.gl.getParameter(this.ext.GPU_DISJOINT_EXT);if(n&&!s){const i=this.gl.getQueryParameter(e.query,this.gl.QUERY_RESULT)*1e-6;this.totalGpuDuration+=i,this.gl.deleteQuery(e.query),this.gpuQueries.splice(t,1)}}}))}update(){this.info===void 0?this.processGpuQueries():(this.totalGpuDuration=this.info.render.timestamp,this.totalGpuDurationCompute=this.info.compute.timestamp,this.addToAverage(this.totalGpuDurationCompute,this.averageGpuCompute)),this.endProfiling("cpu-started","cpu-finished","cpu-duration"),this.addToAverage(this.totalCpuDuration,this.averageCpu),this.addToAverage(this.totalGpuDuration,this.averageGpu),this.renderCount=0,this.totalCpuDuration===0&&this.beginProfiling("cpu-started"),this.totalCpuDuration=0,this.totalFps=0,this.beginTime=this.endInternal()}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.gpuPanelCompute&&this.updatePanel(this.gpuPanelCompute,this.averageGpuCompute),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),this.isRunningCPUProfiling=!0)}endProfiling(e,t,n){if(window.performance&&t&&this.isRunningCPUProfiling){window.performance.mark(t);const s=performance.measure(n,e,t);this.totalCpuDuration+=s.duration,this.isRunningCPUProfiling=!1}}updatePanel(e,t){if(t.logs.length>0){let n=0,s=.01;for(let a=0;a<t.logs.length;a++)n+=t.logs[a],t.logs[a]>s&&(s=t.logs[a]);let r=0,i=.01;for(let a=0;a<t.graph.length;a++)r+=t.graph[a],t.graph[a]>i&&(i=t.graph[a]);e&&e.update(n/Math.min(t.logs.length,this.samplesLog),r/Math.min(t.graph.length,this.samplesGraph),s,i,this.precision)}}get domElement(){return this.dom}get container(){return console.warn("Stats: Deprecated! this.container as been replaced to this.dom "),this.dom}};to.Panel=Ld;let Bd=to;const kd=u.defineComponent({name:"StatsGl",props:["logsPerSecond","samplesLog","samplesGraph","precision","horizontal","minimal","mode"],setup(o,{expose:e}){const t=new Bd({logsPerSecond:o.logsPerSecond,samplesLog:o.samplesLog,samplesGraph:o.samplesGraph,precision:o.precision,horizontal:o.horizontal,minimal:o.minimal,mode:o.mode});e({instance:t});const n=document.body,s=t.dom||t.container;n==null||n.appendChild(s);const{renderer:r}=ee.useTresContext(),{onAfterRender:i}=ee.useLoop();t.init(r.value),i(()=>t.update(),Number.POSITIVE_INFINITY),u.onUnmounted(()=>{n==null||n.removeChild(s)})}}),Fd=u.defineComponent({name:"BakeShadows",setup(){const{renderer:o}=ee.useTresContext();u.watchEffect(()=>{o.value.shadowMap.autoUpdate=!1,o.value.shadowMap.needsUpdate=!0})}});var Ud=`#include <common>
|
|
1392
|
+
}`},h=new l.ShaderMaterial(c),d=new l.Points(void 0,h),f=h.uniforms,g={immediate:!0};[[f.uPixelRatio,ee.useTresContext().sizes.aspectRatio],[f.uSize,s.size],[f.uNormalThreshold,s.normalThreshold],[f.uAlpha,s.alpha],[f.uOffset,s.offset],[f.uOffsetNoise,s.offsetNoise],[f.uMixColor,s.mixColor],[f.uMixAlpha,s.mixAlpha],[f.uMixOffset,s.mixOffset],[f.uMixSize,s.mixSize],[f.uMixSurfaceDistance,s.mixSurfaceDistance],[f.uMixNoise,s.mixNoise],[f.uInfoTexture,i]].forEach(([v,C])=>u.watch(C,()=>{v.value=C.value},g)),u.watch([s.noiseScale,s.lifetimeSec],()=>{f.uNoiseScale.value=s.noiseScale.value*s.lifetimeSec.value},g),u.watch([s.lifetimeSec,s.cooldownSec],()=>{f.uCooldownRatio.value=s.cooldownSec.value/s.lifetimeSec.value},g),u.watch(s.map,()=>{typeof s.map.value=="string"?ee.useTexture([s.map.value]).then(v=>h.uniforms.uMap.value=v):h.uniforms.uMap.value=s.map.value});const _=new l.Quaternion,y=new l.Vector3;ee.useLoop().onBeforeRender(({elapsed:v,invalidate:C})=>{d.getWorldQuaternion(_),y.copy(t.directionalLight?t.directionalLight.position:l.Object3D.DEFAULT_UP).normalize(),y.applyQuaternion(_.invert()),h.uniforms.uNormal.value=y,h.uniforms.uTime.value=v/(t.cooldownSec+t.lifetimeSec),C()});function x(v){return v&&"isObject3D"in v}function m(v){return v&&"isBufferGeometry"in v}u.onMounted(()=>{t.geometry?m(t.geometry)?d.geometry.copy(t.geometry):x(t.geometry)&&"geometry"in t.geometry&&m(t.geometry.geometry)&&d.geometry.copy(t.geometry.geometry):x(d.parent)&&"geometry"in d.parent&&m(d.parent.geometry)?d.geometry.copy(d.parent.geometry):d.geometry=new l.IcosahedronGeometry(1,16),typeof t.map=="string"&&ee.useTexture([t.map]).then(v=>h.uniforms.uMap.value=v)}),u.onUnmounted(()=>{var v;(v=h.uniforms.uMap.value)==null||v.dispose(),i.value.dispose(),h.dispose()});const M=u.shallowRef();return e({instance:d}),(v,C)=>(u.openBlock(),u.createElementBlock("primitive",{ref_key:"sparkleRef",ref:M,object:u.unref(d)},null,8,Sd))}}),Cd=["position","a-scale"],Pd=["size","size-attenuation","transparent","alpha-test","alpha-map"],Td=u.defineComponent({__name:"Stars",props:{size:{default:.1},sizeAttenuation:{type:Boolean,default:!0},transparent:{type:Boolean,default:!0},alphaTest:{default:.01},count:{default:5e3},depth:{default:50},radius:{default:100},alphaMap:{default:null}},setup(o,{expose:e}){const t=o,n=u.ref(),s=u.ref(),{radius:r,depth:i,count:a,size:c,sizeAttenuation:h,transparent:d,alphaMap:f,alphaTest:g}=u.toRefs(t),{invalidate:p}=ee.useTresContext();u.watch(t,()=>{p()});const _=()=>{let x=r.value+i.value;const m=u.computed(()=>i.value/a.value),M=[],v=Array.from({length:a.value},()=>(.5+.5*Math.random())*4),C=O=>new l.Vector3().setFromSpherical(new l.Spherical(O,Math.acos(1-Math.random()*2),Math.random()*2*Math.PI)).toArray();for(let O=0;O<a.value;O++)x-=m.value*Math.random(),M.push(...C(x));n.value=new Float32Array(M),s.value=new Float32Array(v)};u.watchEffect(()=>{_()});const y=u.shallowRef();return e({instance:y}),(x,m)=>(u.openBlock(),u.createElementBlock("TresPoints",{ref_key:"starsRef",ref:y},[u.createElementVNode("TresBufferGeometry",{position:[n.value,3],"a-scale":[s.value,1]},null,8,Cd),u.createElementVNode("TresPointsMaterial",{size:u.unref(c),"size-attenuation":u.unref(h),transparent:u.unref(d),"alpha-test":u.unref(g),"alpha-map":u.unref(f)},null,8,Pd)],512))}}),Id=["rotation-x","args"],Od=u.createElementVNode("TresPlaneGeometry",{args:[1e4,1e4]},null,-1),Dd=u.defineComponent({__name:"Ocean",props:{textureWidth:{default:512},textureHeight:{default:512},waterNormals:{default:"https://raw.githubusercontent.com/Tresjs/assets/main/textures/water-normals/Water_1_M_Normal.jpg"},sunDirection:{default:()=>new l.Vector3},sunColor:{default:16777215},waterColor:{default:7695},distortionScale:{default:3.7},size:{default:1},clipBias:{default:0},alpha:{default:1},side:{default:l.FrontSide}},async setup(o,{expose:e}){let t,n;const s=o,{textureWidth:r,textureHeight:i,waterNormals:a,sunDirection:c,sunColor:h,waterColor:d,distortionScale:f,size:g,clipBias:p,alpha:_,side:y}=u.toRefs(s),{extend:x,scene:m}=ee.useTresContext();x({Water:qo});const M=u.shallowRef(),v=u.shallowRef(),C=m.value.fog!==void 0;e({instance:M}),m.value.traverse(A=>{Object.prototype.hasOwnProperty.call(A,"isSky")&&(v.value=A)}),u.onMounted(async()=>{if(await u.nextTick(),v.value){const A=v.value.material.uniforms.sunPosition.value;M.value.material.uniforms.sunDirection.value.copy(A)}});const{normalMap:O}=([t,n]=u.withAsyncContext(()=>ee.useTexture({normalMap:a.value})),t=await t,n(),t);O.wrapS=O.wrapT=l.RepeatWrapping;const{onBeforeRender:S}=ee.useLoop();return S(({delta:A,invalidate:b})=>{M.value.material.uniforms.time.value+=A,b()}),(A,b)=>(u.openBlock(),u.createElementBlock("TresWater",{ref_key:"waterRef",ref:M,"rotation-x":-Math.PI/2,args:[void 0,{textureWidth:u.unref(r),textureHeight:u.unref(i),waterNormals:u.unref(O),sunDirection:u.unref(c),sunColor:u.unref(h),waterColor:u.unref(d),distortionScale:u.unref(f),fog:C,size:u.unref(g),clipBias:u.unref(p),alpha:u.unref(_),side:u.unref(y)}]},[u.renderSlot(A.$slots,"default",{},()=>[Od])],8,Id))}});var eo={exports:{}};(function(o,e){(function(t,n){o.exports=n()})(Pu,function(){var t=function(){function n(p){return i.appendChild(p.dom),p}function s(p){for(var _=0;_<i.children.length;_++)i.children[_].style.display=_===p?"block":"none";r=p}var r=0,i=document.createElement("div");i.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",i.addEventListener("click",function(p){p.preventDefault(),s(++r%i.children.length)},!1);var a=(performance||Date).now(),c=a,h=0,d=n(new t.Panel("FPS","#0ff","#002")),f=n(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var g=n(new t.Panel("MB","#f08","#201"));return s(0),{REVISION:16,dom:i,addPanel:n,showPanel:s,begin:function(){a=(performance||Date).now()},end:function(){h++;var p=(performance||Date).now();if(f.update(p-a,200),p>c+1e3&&(d.update(1e3*h/(p-c),100),c=p,h=0,g)){var _=performance.memory;g.update(_.usedJSHeapSize/1048576,_.jsHeapSizeLimit/1048576)}return p},update:function(){a=this.end()},domElement:i,setMode:s}};return t.Panel=function(n,s,r){var i=1/0,a=0,c=Math.round,h=c(window.devicePixelRatio||1),d=80*h,f=48*h,g=3*h,p=2*h,_=3*h,y=15*h,x=74*h,m=30*h,M=document.createElement("canvas");M.width=d,M.height=f,M.style.cssText="width:80px;height:48px";var v=M.getContext("2d");return v.font="bold "+9*h+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=r,v.fillRect(0,0,d,f),v.fillStyle=s,v.fillText(n,g,p),v.fillRect(_,y,x,m),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(_,y,x,m),{dom:M,update:function(C,O){i=Math.min(i,C),a=Math.max(a,C),v.fillStyle=r,v.globalAlpha=1,v.fillRect(0,0,d,y),v.fillStyle=s,v.fillText(c(C)+" "+n+" ("+c(i)+"-"+c(a)+")",g,p),v.drawImage(M,_+h,y,x-h,m,_,y,x-h,m),v.fillRect(_+x-h,y,h,m),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(_+x-h,y,h,c((1-C/O)*m))}}},t})})(eo);var Ld=eo.exports;const Bd=dn(Ld),kd=u.defineComponent({name:"Stats",props:{showPanel:{type:Number,default:0}},setup(o,{expose:e}){const t=new Bd;e({instance:t});const n=document.body;t.showPanel(o.showPanel||0),n==null||n.appendChild(t.dom);const{onBeforeRender:s,onAfterRender:r}=ee.useLoop();s(()=>t.begin(),Number.NEGATIVE_INFINITY),r(()=>t.end(),Number.POSITIVE_INFINITY),u.onUnmounted(()=>{n==null||n.removeChild(t.dom)})}});class Fd{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,r=0){let i=1/0,a=0;this.context&&(i=Math.min(i,e),a=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(r)+" "+this.name+" ("+i.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/s)*this.GRAPH_HEIGHT))}}const to=class qt{constructor({logsPerSecond:e=20,samplesLog:t=100,samplesGraph:n=10,precision:s=2,minimal:r=!1,horizontal:i=!0,mode:a=0}={}){this.totalCpuDuration=0,this.totalGpuDuration=0,this.totalGpuDurationCompute=0,this.totalFps=0,this.activeQuery=null,this.gpuQueries=[],this.renderCount=0,this.mode=a,this.horizontal=i,this.dom=document.createElement("div"),this.dom.style.cssText="position:fixed;top:0;left:0;opacity:0.9;z-index:10000;",r&&(this.dom.style.cssText+="cursor:pointer"),this.gl=null,this.query=null,this.isRunningCPUProfiling=!1,this.minimal=r,this.beginTime=(performance||Date).now(),this.prevTime=this.beginTime,this.prevCpuTime=this.beginTime,this.frames=0,this.renderCount=0,this.threeRendererPatched=!1,this.averageCpu={logs:[],graph:[]},this.averageGpu={logs:[],graph:[]},this.averageGpuCompute={logs:[],graph:[]},this.queryCreated=!1,this.fpsPanel=this.addPanel(new qt.Panel("FPS","#0ff","#002"),0),this.msPanel=this.addPanel(new qt.Panel("CPU","#0f0","#020"),1),this.gpuPanel=null,this.gpuPanelCompute=null,this.samplesLog=t,this.samplesGraph=n,this.precision=s,this.logsPerSecond=e,this.minimal?(this.dom.addEventListener("click",c=>{c.preventDefault(),this.showPanel(++this.mode%this.dom.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),this.gpuPanelCompute&&this.resizePanel(this.gpuPanelCompute,3)})}patchThreeRenderer(e){const t=e.render,n=this;e.render=function(s,r){n.begin(),t.call(this,s,r),n.end()},this.threeRendererPatched=!0}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.dom.appendChild(e.canvas),this.resizePanel(e,t)),e}showPanel(e){for(let t=0;t<this.dom.children.length;t++){const n=this.dom.children[t];n.style.display=t===e?"block":"none"}this.mode=e}async init(e){if(!e){console.error('Stats: The "canvas" parameter is undefined.');return}if(e.isWebGLRenderer&&!this.threeRendererPatched){const t=e;this.patchThreeRenderer(t),this.gl=t.getContext()}else!this.gl&&e instanceof WebGL2RenderingContext&&(this.gl=e);if(e.isWebGPURenderer){e.backend.trackTimestamp=!0,await e.hasFeatureAsync("timestamp-query")&&(this.gpuPanel=this.addPanel(new qt.Panel("GPU","#ff0","#220"),2),this.gpuPanelCompute=this.addPanel(new qt.Panel("CPT","#e1e1e1","#212121"),3),this.info=e.info);return}else if(!this.gl&&e instanceof HTMLCanvasElement||e instanceof OffscreenCanvas){if(this.gl=e.getContext("webgl2"),!this.gl){console.error("Stats: Unable to obtain WebGL2 context.");return}}else if(!this.gl){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 qt.Panel("GPU","#ff0","#220"),2))}begin(){this.isRunningCPUProfiling||this.beginProfiling("cpu-started"),!(!this.gl||!this.ext)&&this.gl&&this.ext&&(this.activeQuery&&this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.activeQuery=this.gl.createQuery(),this.activeQuery!==null&&this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,this.activeQuery))}end(){this.renderCount++,this.gl&&this.ext&&this.activeQuery&&(this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.gpuQueries.push({query:this.activeQuery}),this.activeQuery=null)}processGpuQueries(){!this.gl||!this.ext||(this.totalGpuDuration=0,this.gpuQueries.forEach((e,t)=>{if(this.gl){const n=this.gl.getQueryParameter(e.query,this.gl.QUERY_RESULT_AVAILABLE),s=this.gl.getParameter(this.ext.GPU_DISJOINT_EXT);if(n&&!s){const i=this.gl.getQueryParameter(e.query,this.gl.QUERY_RESULT)*1e-6;this.totalGpuDuration+=i,this.gl.deleteQuery(e.query),this.gpuQueries.splice(t,1)}}}))}update(){this.info===void 0?this.processGpuQueries():(this.totalGpuDuration=this.info.render.timestamp,this.totalGpuDurationCompute=this.info.compute.timestamp,this.addToAverage(this.totalGpuDurationCompute,this.averageGpuCompute)),this.endProfiling("cpu-started","cpu-finished","cpu-duration"),this.addToAverage(this.totalCpuDuration,this.averageCpu),this.addToAverage(this.totalGpuDuration,this.averageGpu),this.renderCount=0,this.totalCpuDuration===0&&this.beginProfiling("cpu-started"),this.totalCpuDuration=0,this.totalFps=0,this.beginTime=this.endInternal()}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.gpuPanelCompute&&this.updatePanel(this.gpuPanelCompute,this.averageGpuCompute),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),this.isRunningCPUProfiling=!0)}endProfiling(e,t,n){if(window.performance&&t&&this.isRunningCPUProfiling){window.performance.mark(t);const s=performance.measure(n,e,t);this.totalCpuDuration+=s.duration,this.isRunningCPUProfiling=!1}}updatePanel(e,t){if(t.logs.length>0){let n=0,s=.01;for(let a=0;a<t.logs.length;a++)n+=t.logs[a],t.logs[a]>s&&(s=t.logs[a]);let r=0,i=.01;for(let a=0;a<t.graph.length;a++)r+=t.graph[a],t.graph[a]>i&&(i=t.graph[a]);e&&e.update(n/Math.min(t.logs.length,this.samplesLog),r/Math.min(t.graph.length,this.samplesGraph),s,i,this.precision)}}get domElement(){return this.dom}get container(){return console.warn("Stats: Deprecated! this.container as been replaced to this.dom "),this.dom}};to.Panel=Fd;let Ud=to;const Nd=u.defineComponent({name:"StatsGl",props:["logsPerSecond","samplesLog","samplesGraph","precision","horizontal","minimal","mode"],setup(o,{expose:e}){const t=new Ud({logsPerSecond:o.logsPerSecond,samplesLog:o.samplesLog,samplesGraph:o.samplesGraph,precision:o.precision,horizontal:o.horizontal,minimal:o.minimal,mode:o.mode});e({instance:t});const n=document.body,s=t.dom||t.container;n==null||n.appendChild(s);const{renderer:r}=ee.useTresContext(),{onAfterRender:i}=ee.useLoop();t.init(r.value),i(()=>t.update(),Number.POSITIVE_INFINITY),u.onUnmounted(()=>{n==null||n.removeChild(s)})}}),zd=u.defineComponent({name:"BakeShadows",setup(){const{renderer:o}=ee.useTresContext();u.watchEffect(()=>{o.value.shadowMap.autoUpdate=!1,o.value.shadowMap.needsUpdate=!0})}});var Vd=`#include <common>
|
|
1393
1393
|
|
|
1394
1394
|
void main() {
|
|
1395
1395
|
vec2 center = vec2(0., 1.);
|
|
@@ -1414,6 +1414,6 @@ void main() {
|
|
|
1414
1414
|
mvPosition.xy += rotatedPosition;
|
|
1415
1415
|
|
|
1416
1416
|
gl_Position = projectionMatrix * mvPosition;
|
|
1417
|
-
}`,
|
|
1417
|
+
}`,Rd=`void main() {
|
|
1418
1418
|
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
1419
|
-
}`;const gn=new l.Vector3(0,0,0),Ks=new l.Vector3(0,0,0),zd=new l.Vector3(0,0,0);function no(o,e,t){const n=gn.setFromMatrixPosition(o.matrixWorld);n.project(e);const s=t.width/2,r=t.height/2;return[(Number.isNaN(n.x)?0:n.x)*s+s,-(n.y*r)+r]}function Vd(o,e){const t=gn.setFromMatrixPosition(o.matrixWorld),n=Ks.setFromMatrixPosition(e.matrixWorld),s=t.sub(n),r=e.getWorldDirection(zd);return s.angleTo(r)>Math.PI/2}function Rd(o,e,t,n){const s=gn.setFromMatrixPosition(o.matrixWorld),r=s.clone();r.project(e),t.setFromCamera(new l.Vector2(r.x,r.y),e);const i=t.intersectObjects(n,!0);if(i.length>0){const a=i[0].distance;return s.distanceTo(t.ray.origin)<a}return!0}function Gd(o,e){if(e instanceof l.OrthographicCamera)return e.zoom;if(e instanceof l.PerspectiveCamera){const t=gn.setFromMatrixPosition(o.matrixWorld),n=Ks.setFromMatrixPosition(e.matrixWorld),s=e.fov*Math.PI/180,r=t.distanceTo(n);return 1/(2*Math.tan(s/2)*r)}else return 1}function jd(o,e,t){if(e instanceof l.PerspectiveCamera||e instanceof l.OrthographicCamera){const n=gn.setFromMatrixPosition(o.matrixWorld),s=Ks.setFromMatrixPosition(e.matrixWorld),r=n.distanceTo(s),i=(t[1]-t[0])/(e.far-e.near),a=t[1]-i*e.far;return Math.round(i*r+a)}}const qs=o=>Math.abs(o)<1e-10?0:o;function so(o,e,t=""){let n="matrix3d(";for(let s=0;s!==16;s++)n+=qs(e[s]*o.elements[s])+(s!==15?",":")");return t+n}const Ed=(o=>e=>so(e,o))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Yd=(o=>(e,t)=>so(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]),Wd=["geometry","material"],Xd=u.defineComponent({__name:"HTML",props:{geometry:{default:new l.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:[Object,null,Array,Boolean,String]}},emits:["onOcclude"],setup(o,{expose:e,emit:t}){const n=o,s=t,r=u.useSlots(),i=u.useAttrs(),a=u.ref(),c=u.ref(),{geometry:h,material:d,as:f,transform:y,portal:p,wrapperClass:_,eps:g,distanceFactor:x,fullscreen:m,center:M,pointerEvents:v,sprite:C,occlude:O,zIndexRange:S}=u.toRefs(n),{renderer:A,scene:b,camera:P,raycaster:w,sizes:D}=ee.useTresContext(),L=u.computed(()=>document.createElement(f.value)),V=u.ref([0,0]),R=u.ref(0),Y=u.ref(),W=u.computed(()=>y.value?{position:"absolute",top:0,left:0,width:`${D.width.value}px`,height:`${D.height.value}px`,transformStyle:"preserve-3d",pointerEvents:"none",zIndex:2,willChange:"transform"}:{position:"absolute",transform:M.value?"translate3d(-50%,-50%,0)":"none",...m.value&&{top:-D.height.value/2,left:-D.width.value/2,width:`${D.width.value}px`,height:`${D.height.value}px`},zIndex:2,...Object.assign({},i.style),willChange:"transform"}),$=u.computed(()=>({position:"absolute",pointerEvents:v.value})),q=u.ref(null),ne=u.ref(!1),te=u.computed(()=>(O==null?void 0:O.value)&&(O==null?void 0:O.value)!=="blending"||Array.isArray(O==null?void 0:O.value)&&(O==null?void 0:O.value.length)&&u.isRef(O.value[0]));u.watch(()=>O,({value:z})=>{z==="blending"?(L.value.style.zIndex=`${Math.floor(S.value[0]/2)}`,L.value.style.position="absolute",L.value.style.pointerEvents="none"):(L.value.style.zIndex=null,L.value.style.position=null,L.value.style.pointerEvents=null)}),u.watch(()=>{var z;return[a.value,A.value,D.width.value,D.height.value,(z=r.default)==null?void 0:z.call(r)]},([z,F])=>{var k,G,T,I,U,Z;if(z&&F){const j=(p==null?void 0:p.value)||F.domElement;if((k=b.value)==null||k.updateMatrixWorld(),y.value)L.value.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const E=no(z,P.value,{width:D.width.value,height:D.height.value});L.value.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${E[0]}px,${E[1]}px,0);transform-origin:0 0;`}j&&!L.value.parentNode&&((G=j.parentNode)==null||G.appendChild(L.value)),y.value?Y.value=u.createVNode("div",{id:"outer",style:W.value},[u.createVNode("div",{id:"inner",style:$.value},[u.createVNode("div",{key:(T=c.value)==null?void 0:T.uuid,id:b==null?void 0:b.value.uuid,class:i.class,style:i.style},(I=r.default)==null?void 0:I.call(r))])]):Y.value=u.createVNode("div",{key:(U=c.value)==null?void 0:U.uuid,id:b==null?void 0:b.value.uuid,style:W.value},(Z=r.default)==null?void 0:Z.call(r)),u.render(Y.value,L.value)}}),u.watchEffect(()=>{_!=null&&_.value&&(L.value.className=_.value)});const ce=u.ref(!0),{onBeforeRender:le}=ee.useLoop();le(({invalidate:z})=>{var F,k,G,T,I,U,Z;if(z(),a.value&&P.value&&A.value){(F=P.value)==null||F.updateMatrixWorld(),a.value.updateWorldMatrix(!0,!1);const j=y.value?V.value:no(a.value,P.value,{width:D.width.value||0,height:D.height.value||0});if(y.value||Math.abs(R.value-P.value.zoom)>g.value||Math.abs(V.value[0]-j[0])>g.value||Math.abs(V.value[1]-j[1])>g.value){const E=Vd(a.value,P.value);let J=!1;te.value&&(Array.isArray(O==null?void 0:O.value)?J=O==null?void 0:O.value:(O==null?void 0:O.value)!=="blending"&&(J=[b.value]));const se=ce.value;if(J){const N=Rd(a.value,P.value,w.value,J);ce.value=N&&!E}else ce.value=!E;se!==ce.value&&(s("onOcclude",!ce.value),L.value.style.display=ce.value?"block":"none");const ie=Math.floor(S.value[0]/2),X=O!=null&&O.value?te.value?[S.value[0],ie]:[ie-1,0]:S.value;if(L.value.style.zIndex=`${jd(a.value,P.value,X)}`,L.value.style.willChange="transform",y.value){const[N,ae]=[D.width.value/2,D.height.value/2],he=P.value.projectionMatrix.elements[5]*ae,{isOrthographicCamera:_e,top:Ie,left:Oe,bottom:He,right:dt}=P.value,Tt=Ed(P.value.matrixWorldInverse),It=_e?`scale(${he})translate(${qs(-(dt+Oe)/2)}px,${qs((Ie+He)/2)}px)`:`translateZ(${he}px)`;let Ze=a.value.matrixWorld;if(C.value&&(Ze=P.value.matrixWorldInverse.clone().transpose().copyPosition(Ze).scale(a.value.scale),Ze.elements[3]=Ze.elements[7]=Ze.elements[11]=0,Ze.elements[15]=1),L.value.style.width=`${D.width.value}px`,L.value.style.height=`${D.height.value}px`,L.value.style.perspective=_e?"":`${he}px`,(k=Y.value)!=null&&k.el&&((G=Y.value)!=null&&G.children)&&Array.isArray(Y.value.children)){Y.value.el.style.willChange="transform",Y.value.el.style.transform=`${It}${Tt}translate(${N}px,${ae}px)`;const $e=Y.value.children[0];$e&&$e.el&&($e.el.style.willChange="transform",$e.el.style.transform=Yd(Ze,1/(((x==null?void 0:x.value)||10)/400)))}}else{const N=(x==null?void 0:x.value)===void 0?1:Gd(a.value,P.value)*(x==null?void 0:x.value);L.value.style.transform=`translate3d(${j[0]}px,${j[1]}px,0) scale(${N})`}}V.value=j,R.value=P.value.zoom}if(!te.value&&c.value&&!ne.value)if(y.value){if((T=Y.value)!=null&&T.el&&((I=Y.value)!=null&&I.children)){const j=((U=Y.value)==null?void 0:U.children)[0];if(j!=null&&j.clientWidth&&(j!=null&&j.clientHeight)){const{isOrthographicCamera:E}=P.value;if(E||h)i.scale&&(Array.isArray(i.scale)?i.scale instanceof l.Vector3?c.value.scale.copy(i.scale.clone().divideScalar(1)):c.value.scale.set(1/i.scale[0],1/i.scale[1],1/i.scale[2]):c.value.scale.setScalar(1/i.scale));else{const J=((x==null?void 0:x.value)||10)/400,se=j.clientWidth*J,ie=j.clientHeight*J;c.value.scale.set(se,ie,1)}ne.value=!0}}}else{const j=L.value.children[0];if(j!=null&&j.clientWidth&&(j!=null&&j.clientHeight)){const J=j.clientWidth*1,se=j.clientHeight*1;c.value.scale.set(J,se,1),ne.value=!0}q.value.lookAt((Z=P.value)==null?void 0:Z.position)}});const me=u.computed(()=>({vertexShader:y.value?void 0:Ud,fragmentShader:Nd})),B=u.computed(()=>{const z=me.value;return d.value||new l.ShaderMaterial({vertexShader:z.vertexShader,fragmentShader:z.fragmentShader,side:l.DoubleSide})});return u.onUnmounted(()=>{B.value&&B.value.dispose(),L.value.remove()}),e({instance:a}),(z,F)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"groupRef",ref:a},[u.unref(O)&&!te.value?(u.openBlock(),u.createElementBlock("TresMesh",{key:0,ref_key:"meshRef",ref:c,geometry:u.unref(h),material:B.value},null,8,Wd)):u.createCommentVNode("",!0)],512))}}),{logError:Zd}=ee.useLogger();async function Kd(o,e){const t=new qn,n=(e==null?void 0:e.fileName)||"scene";t.parse(o,s=>{if(s instanceof ArrayBuffer)Qd(s,`${n}.glb`);else{const r=JSON.stringify(s,null,2);qd(r,`${n}.gltf`)}},s=>{Zd("An error happened while exporting the GLTF",s)},e)}function qd(o,e){ro(new Blob([o],{type:"text/plain"}),e)}function Qd(o,e){ro(new Blob([o],{type:"application/octet-stream"}),e)}function ro(o,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(o),t.download=e,t.click(),t.remove()}function Jd(o,e){const t={};for(const n of e)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n]);return t}function Hd(o,e){const t=`set${e[0].toUpperCase()}${e.slice(1)}`;return o[t]!==void 0}function $d(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 l.Vector3(...e)),e}re.AnimatedSprite=Rc,re.Backdrop=Zf,re.BakeShadows=Fd,re.BaseCameraControls=Ue,re.Box=Uh,re.CameraControls=du,re.CatmullRomCurve3=jh,re.Circle=Wh,re.Cone=Kh,re.ContactShadows=qf,re.CustomShaderMaterial=Ah,re.Cylinder=Jh,re.Dodecahedron=ef,re.Environment=zf,re.FBXModel=qc,re.Fbo=yc,re.Fit=Qf,re.GLTFModel=Zc,re.GlobalAudio=$l,re.HolographicMaterial=Bh,re.Html=Xd,re.Icosahedron=sf,re.KeyboardControls=nu,re.Lensflare=gc,re.Levioso=Tl,re.Lightformer=Ef,re.Line2=Ji,re.MapControls=au,re.MeshGlassMaterial=Mu,re.MeshReflectionMaterial=Dh,re.MeshWobbleMaterial=gu,re.MouseParallax=Hl,re.Ocean=Td,re.Octahedron=af,re.OrbitControls=tu,re.Plane=hf,re.PointerLockControls=ai,re.PositionalAudio=Ec,re.Precipitation=$f,re.Reflector=Dl,re.Ring=pf,re.RoundedBox=yf,re.SVG=Jc,re.Sampler=_c,re.ScrollControls=lu,re.Sky=td,re.Smoke=od,re.Sparkles=bd,re.Sphere=vf,re.Stars=Ad,re.Stats=Dd,re.StatsGl=kd,re.Superformula=Mf,re.Tetrahedron=Pf,re.Text3D=Cl,re.Torus=Of,re.TorusKnot=Bf,re.TransformControls=ru,re.Tube=Uf,re.extractBindingPosition=$d,re.hasSetter=Hd,re.pick=Jd,re.useAnimations=Pl,re.useEnvironment=ni,re.useFBO=Hr,re.useFBX=ri,re.useGLTF=si,re.useGLTFExporter=Kd,re.useProgress=Hc,re.useSurfaceSampler=$r,re.useVideoTexture=$c,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
|
|
1419
|
+
}`;const gn=new l.Vector3(0,0,0),Ks=new l.Vector3(0,0,0),Gd=new l.Vector3(0,0,0);function no(o,e,t){const n=gn.setFromMatrixPosition(o.matrixWorld);n.project(e);const s=t.width/2,r=t.height/2;return[(Number.isNaN(n.x)?0:n.x)*s+s,-(n.y*r)+r]}function jd(o,e){const t=gn.setFromMatrixPosition(o.matrixWorld),n=Ks.setFromMatrixPosition(e.matrixWorld),s=t.sub(n),r=e.getWorldDirection(Gd);return s.angleTo(r)>Math.PI/2}function Ed(o,e,t,n){const s=gn.setFromMatrixPosition(o.matrixWorld),r=s.clone();r.project(e),t.setFromCamera(new l.Vector2(r.x,r.y),e);const i=t.intersectObjects(n,!0);if(i.length>0){const a=i[0].distance;return s.distanceTo(t.ray.origin)<a}return!0}function Yd(o,e){if(e instanceof l.OrthographicCamera)return e.zoom;if(e instanceof l.PerspectiveCamera){const t=gn.setFromMatrixPosition(o.matrixWorld),n=Ks.setFromMatrixPosition(e.matrixWorld),s=e.fov*Math.PI/180,r=t.distanceTo(n);return 1/(2*Math.tan(s/2)*r)}else return 1}function Wd(o,e,t){if(e instanceof l.PerspectiveCamera||e instanceof l.OrthographicCamera){const n=gn.setFromMatrixPosition(o.matrixWorld),s=Ks.setFromMatrixPosition(e.matrixWorld),r=n.distanceTo(s),i=(t[1]-t[0])/(e.far-e.near),a=t[1]-i*e.far;return Math.round(i*r+a)}}const qs=o=>Math.abs(o)<1e-10?0:o;function so(o,e,t=""){let n="matrix3d(";for(let s=0;s!==16;s++)n+=qs(e[s]*o.elements[s])+(s!==15?",":")");return t+n}const Xd=(o=>e=>so(e,o))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Zd=(o=>(e,t)=>so(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]),Kd=["geometry","material"],qd=u.defineComponent({__name:"HTML",props:{geometry:{default:new l.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:[Object,null,Array,Boolean,String]}},emits:["onOcclude"],setup(o,{expose:e,emit:t}){const n=o,s=t,r=u.useSlots(),i=u.useAttrs(),a=u.ref(),c=u.ref(),{geometry:h,material:d,as:f,transform:g,portal:p,wrapperClass:_,eps:y,distanceFactor:x,fullscreen:m,center:M,pointerEvents:v,sprite:C,occlude:O,zIndexRange:S}=u.toRefs(n),{renderer:A,scene:b,camera:P,raycaster:w,sizes:D}=ee.useTresContext(),L=u.computed(()=>document.createElement(f.value)),V=u.ref([0,0]),R=u.ref(0),Y=u.ref(),W=u.computed(()=>g.value?{position:"absolute",top:0,left:0,width:`${D.width.value}px`,height:`${D.height.value}px`,transformStyle:"preserve-3d",pointerEvents:"none",zIndex:2,willChange:"transform"}:{position:"absolute",transform:M.value?"translate3d(-50%,-50%,0)":"none",...m.value&&{top:-D.height.value/2,left:-D.width.value/2,width:`${D.width.value}px`,height:`${D.height.value}px`},zIndex:2,...Object.assign({},i.style),willChange:"transform"}),$=u.computed(()=>({position:"absolute",pointerEvents:v.value})),q=u.ref(null),ne=u.ref(!1),te=u.computed(()=>(O==null?void 0:O.value)&&(O==null?void 0:O.value)!=="blending"||Array.isArray(O==null?void 0:O.value)&&(O==null?void 0:O.value.length)&&u.isRef(O.value[0]));u.watch(()=>O,({value:z})=>{z==="blending"?(L.value.style.zIndex=`${Math.floor(S.value[0]/2)}`,L.value.style.position="absolute",L.value.style.pointerEvents="none"):(L.value.style.zIndex=null,L.value.style.position=null,L.value.style.pointerEvents=null)}),u.watch(()=>{var z;return[a.value,A.value,D.width.value,D.height.value,(z=r.default)==null?void 0:z.call(r)]},([z,F])=>{var k,G,T,I,U,Z;if(z&&F){const j=(p==null?void 0:p.value)||F.domElement;if((k=b.value)==null||k.updateMatrixWorld(),g.value)L.value.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const E=no(z,P.value,{width:D.width.value,height:D.height.value});L.value.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${E[0]}px,${E[1]}px,0);transform-origin:0 0;`}j&&!L.value.parentNode&&((G=j.parentNode)==null||G.appendChild(L.value)),g.value?Y.value=u.createVNode("div",{id:"outer",style:W.value},[u.createVNode("div",{id:"inner",style:$.value},[u.createVNode("div",{key:(T=c.value)==null?void 0:T.uuid,id:b==null?void 0:b.value.uuid,class:i.class,style:i.style},(I=r.default)==null?void 0:I.call(r))])]):Y.value=u.createVNode("div",{key:(U=c.value)==null?void 0:U.uuid,id:b==null?void 0:b.value.uuid,style:W.value},(Z=r.default)==null?void 0:Z.call(r)),u.render(Y.value,L.value)}}),u.watchEffect(()=>{_!=null&&_.value&&(L.value.className=_.value)});const ce=u.ref(!0),{onBeforeRender:le}=ee.useLoop();le(({invalidate:z})=>{var F,k,G,T,I,U,Z;if(z(),a.value&&P.value&&A.value){(F=P.value)==null||F.updateMatrixWorld(),a.value.updateWorldMatrix(!0,!1);const j=g.value?V.value:no(a.value,P.value,{width:D.width.value||0,height:D.height.value||0});if(g.value||Math.abs(R.value-P.value.zoom)>y.value||Math.abs(V.value[0]-j[0])>y.value||Math.abs(V.value[1]-j[1])>y.value){const E=jd(a.value,P.value);let J=!1;te.value&&(Array.isArray(O==null?void 0:O.value)?J=O==null?void 0:O.value:(O==null?void 0:O.value)!=="blending"&&(J=[b.value]));const se=ce.value;if(J){const N=Ed(a.value,P.value,w.value,J);ce.value=N&&!E}else ce.value=!E;se!==ce.value&&(s("onOcclude",!ce.value),L.value.style.display=ce.value?"block":"none");const ie=Math.floor(S.value[0]/2),X=O!=null&&O.value?te.value?[S.value[0],ie]:[ie-1,0]:S.value;if(L.value.style.zIndex=`${Wd(a.value,P.value,X)}`,L.value.style.willChange="transform",g.value){const[N,ae]=[D.width.value/2,D.height.value/2],he=P.value.projectionMatrix.elements[5]*ae,{isOrthographicCamera:_e,top:Ie,left:Oe,bottom:He,right:dt}=P.value,Tt=Xd(P.value.matrixWorldInverse),It=_e?`scale(${he})translate(${qs(-(dt+Oe)/2)}px,${qs((Ie+He)/2)}px)`:`translateZ(${he}px)`;let Ze=a.value.matrixWorld;if(C.value&&(Ze=P.value.matrixWorldInverse.clone().transpose().copyPosition(Ze).scale(a.value.scale),Ze.elements[3]=Ze.elements[7]=Ze.elements[11]=0,Ze.elements[15]=1),L.value.style.width=`${D.width.value}px`,L.value.style.height=`${D.height.value}px`,L.value.style.perspective=_e?"":`${he}px`,(k=Y.value)!=null&&k.el&&((G=Y.value)!=null&&G.children)&&Array.isArray(Y.value.children)){Y.value.el.style.willChange="transform",Y.value.el.style.transform=`${It}${Tt}translate(${N}px,${ae}px)`;const $e=Y.value.children[0];$e&&$e.el&&($e.el.style.willChange="transform",$e.el.style.transform=Zd(Ze,1/(((x==null?void 0:x.value)||10)/400)))}}else{const N=(x==null?void 0:x.value)===void 0?1:Yd(a.value,P.value)*(x==null?void 0:x.value);L.value.style.transform=`translate3d(${j[0]}px,${j[1]}px,0) scale(${N})`}}V.value=j,R.value=P.value.zoom}if(!te.value&&c.value&&!ne.value)if(g.value){if((T=Y.value)!=null&&T.el&&((I=Y.value)!=null&&I.children)){const j=((U=Y.value)==null?void 0:U.children)[0];if(j!=null&&j.clientWidth&&(j!=null&&j.clientHeight)){const{isOrthographicCamera:E}=P.value;if(E||h)i.scale&&(Array.isArray(i.scale)?i.scale instanceof l.Vector3?c.value.scale.copy(i.scale.clone().divideScalar(1)):c.value.scale.set(1/i.scale[0],1/i.scale[1],1/i.scale[2]):c.value.scale.setScalar(1/i.scale));else{const J=((x==null?void 0:x.value)||10)/400,se=j.clientWidth*J,ie=j.clientHeight*J;c.value.scale.set(se,ie,1)}ne.value=!0}}}else{const j=L.value.children[0];if(j!=null&&j.clientWidth&&(j!=null&&j.clientHeight)){const J=j.clientWidth*1,se=j.clientHeight*1;c.value.scale.set(J,se,1),ne.value=!0}q.value.lookAt((Z=P.value)==null?void 0:Z.position)}});const me=u.computed(()=>({vertexShader:g.value?void 0:Vd,fragmentShader:Rd})),B=u.computed(()=>{const z=me.value;return d.value||new l.ShaderMaterial({vertexShader:z.vertexShader,fragmentShader:z.fragmentShader,side:l.DoubleSide})});return u.onUnmounted(()=>{B.value&&B.value.dispose(),L.value.remove()}),e({instance:a}),(z,F)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"groupRef",ref:a},[u.unref(O)&&!te.value?(u.openBlock(),u.createElementBlock("TresMesh",{key:0,ref_key:"meshRef",ref:c,geometry:u.unref(h),material:B.value},null,8,Kd)):u.createCommentVNode("",!0)],512))}}),{logError:Qd}=ee.useLogger();async function Jd(o,e){const t=new qn,n=(e==null?void 0:e.fileName)||"scene";t.parse(o,s=>{if(s instanceof ArrayBuffer)$d(s,`${n}.glb`);else{const r=JSON.stringify(s,null,2);Hd(r,`${n}.gltf`)}},s=>{Qd("An error happened while exporting the GLTF",s)},e)}function Hd(o,e){ro(new Blob([o],{type:"text/plain"}),e)}function $d(o,e){ro(new Blob([o],{type:"application/octet-stream"}),e)}function ro(o,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(o),t.download=e,t.click(),t.remove()}function ep(o,e){const t={};for(const n of e)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n]);return t}function tp(o,e){const t=`set${e[0].toUpperCase()}${e.slice(1)}`;return o[t]!==void 0}function np(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 l.Vector3(...e)),e}re.AnimatedSprite=Rc,re.Backdrop=Qf,re.BakeShadows=zd,re.BaseCameraControls=Ue,re.Box=Vh,re.CameraControls=gu,re.CatmullRomCurve3=Wh,re.Circle=Kh,re.Cone=Jh,re.ContactShadows=Hf,re.CustomShaderMaterial=Th,re.Cylinder=ef,re.Dodecahedron=sf,re.Environment=Gf,re.FBXModel=qc,re.Fbo=yc,re.Fit=$f,re.GLTFModel=Zc,re.GlobalAudio=$l,re.HolographicMaterial=Uh,re.Html=qd,re.Icosahedron=af,re.KeyboardControls=iu,re.Lensflare=gc,re.Levioso=Tl,re.Lightformer=Xf,re.Line2=Ji,re.MapControls=uu,re.MeshGlassMaterial=Cu,re.MeshReflectionMaterial=kh,re.MeshWobbleMaterial=xu,re.MouseParallax=Hl,re.Ocean=Dd,re.Octahedron=uf,re.OrbitControls=ru,re.Plane=pf,re.PointerLockControls=ai,re.PositionalAudio=Ec,re.Precipitation=nd,re.Reflector=Dl,re.Ring=yf,re.RoundedBox=vf,re.SVG=Jc,re.Sampler=_c,re.ScrollControls=hu,re.Sky=rd,re.Smoke=cd,re.Sparkles=Ad,re.Sphere=Mf,re.Stars=Td,re.Stats=kd,re.StatsGl=Nd,re.Superformula=Cf,re.Tetrahedron=Of,re.Text3D=Cl,re.Torus=Bf,re.TorusKnot=Uf,re.TransformControls=au,re.Tube=Vf,re.extractBindingPosition=np,re.hasSetter=tp,re.pick=ep,re.useAnimations=Pl,re.useEnvironment=ni,re.useFBO=Hr,re.useFBX=ri,re.useGLTF=si,re.useGLTFExporter=Jd,re.useProgress=tu,re.useSurfaceSampler=$r,re.useVideoTexture=nu,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
|