@needle-tools/engine 4.8.6-next.f3ce848 → 4.8.7-next.011f757
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/CHANGELOG.md +4 -0
- package/components.needle.json +1 -1
- package/dist/{gltf-progressive-DXRy9EQz.js → gltf-progressive-BcHT3Nyo.js} +1 -1
- package/dist/{gltf-progressive-C-U_onhf.umd.cjs → gltf-progressive-CH3Q4H06.umd.cjs} +1 -1
- package/dist/{gltf-progressive-DViD_J_l.min.js → gltf-progressive-DR6HqF_h.min.js} +1 -1
- package/dist/{needle-engine.bundle-CJSl-mXb.min.js → needle-engine.bundle-A4MqukqV.min.js} +137 -137
- package/dist/{needle-engine.bundle-fXDFH_oR.js → needle-engine.bundle-BcKlrcH5.js} +6504 -6429
- package/dist/{needle-engine.bundle-C4N-adas.umd.cjs → needle-engine.bundle-D4U_nRHo.umd.cjs} +138 -138
- package/dist/needle-engine.js +394 -393
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-61aXdqNz.umd.cjs → postprocessing-CVb_x9YY.umd.cjs} +1 -1
- package/dist/{postprocessing-D9jDHD0U.js → postprocessing-ORx-0eCx.js} +1 -1
- package/dist/{postprocessing-Be9Ds4NK.min.js → postprocessing-Ywv5oKkX.min.js} +1 -1
- package/dist/three-examples-BX_Sktc9.min.js +501 -0
- package/dist/{three-examples-BihZ_R96.js → three-examples-CNexix3E.js} +2436 -2781
- package/dist/{three-examples-Ce6Th3bv.umd.cjs → three-examples-DWxXVnws.umd.cjs} +21 -21
- package/dist/{vendor-BRpzuoJE.min.js → vendor-C43vobGc.min.js} +37 -37
- package/dist/{vendor-p_xp9KuJ.js → vendor-Z4SPrTcP.js} +2402 -2047
- package/dist/vendor-xfQ8tKF3.umd.cjs +1121 -0
- package/lib/engine/api.d.ts +1 -0
- package/lib/engine/api.js +1 -0
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_addressables.d.ts +12 -12
- package/lib/engine/engine_addressables.js +30 -23
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_animation.d.ts +1 -3
- package/lib/engine/engine_animation.js +15 -9
- package/lib/engine/engine_animation.js.map +1 -1
- package/lib/engine/engine_camera.d.ts +8 -1
- package/lib/engine/engine_camera.js +25 -0
- package/lib/engine/engine_camera.js.map +1 -1
- package/lib/engine/engine_context.d.ts +9 -0
- package/lib/engine/engine_context.js +15 -0
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_feature_flags.d.ts +3 -0
- package/lib/engine/engine_feature_flags.js +6 -0
- package/lib/engine/engine_feature_flags.js.map +1 -0
- package/lib/engine/engine_loaders.js +15 -11
- package/lib/engine/engine_loaders.js.map +1 -1
- package/lib/engine/engine_mainloop_utils.d.ts +2 -1
- package/lib/engine/engine_mainloop_utils.js +16 -4
- package/lib/engine/engine_mainloop_utils.js.map +1 -1
- package/lib/engine/extensions/extensions.js +2 -2
- package/lib/engine/extensions/extensions.js.map +1 -1
- package/lib/engine/js-extensions/Object3D.js +19 -0
- package/lib/engine/js-extensions/Object3D.js.map +1 -1
- package/lib/engine-components/Animation.js +2 -1
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/AnimationUtilsAutoplay.js +1 -6
- package/lib/engine-components/AnimationUtilsAutoplay.js.map +1 -1
- package/lib/engine-components/DropListener.d.ts +17 -12
- package/lib/engine-components/DropListener.js +34 -31
- package/lib/engine-components/DropListener.js.map +1 -1
- package/lib/engine-components/LookAtConstraint.d.ts +5 -1
- package/lib/engine-components/LookAtConstraint.js +8 -0
- package/lib/engine-components/LookAtConstraint.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +5 -7
- package/lib/engine-components/OrbitControls.js +12 -11
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/export/usdz/Extension.d.ts +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.d.ts +7 -0
- package/lib/engine-components/export/usdz/USDZExporter.js +8 -1
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.d.ts +4 -2
- package/lib/engine-components/webxr/WebXRImageTracking.js +117 -81
- package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
- package/package.json +3 -2
- package/plugins/vite/alias.js +45 -23
- package/src/engine/api.ts +2 -1
- package/src/engine/engine_addressables.ts +44 -33
- package/src/engine/engine_animation.ts +17 -9
- package/src/engine/engine_camera.ts +40 -1
- package/src/engine/engine_context.ts +21 -1
- package/src/engine/engine_feature_flags.ts +8 -0
- package/src/engine/engine_loaders.ts +18 -13
- package/src/engine/engine_mainloop_utils.ts +21 -6
- package/src/engine/extensions/extensions.ts +2 -2
- package/src/engine/js-extensions/Object3D.ts +25 -2
- package/src/engine-components/Animation.ts +1 -1
- package/src/engine-components/AnimationUtilsAutoplay.ts +1 -6
- package/src/engine-components/DropListener.ts +40 -31
- package/src/engine-components/LookAtConstraint.ts +9 -1
- package/src/engine-components/OrbitControls.ts +19 -16
- package/src/engine-components/export/usdz/Extension.ts +1 -1
- package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +1 -1
- package/src/engine-components/export/usdz/USDZExporter.ts +21 -12
- package/src/engine-components/webxr/WebXRImageTracking.ts +138 -90
- package/dist/three-examples-DKY9Nfge.min.js +0 -501
- package/dist/vendor-Ja-vKV-a.umd.cjs +0 -1121
|
@@ -1,501 +0,0 @@
|
|
|
1
|
-
import{Mesh as O,SphereGeometry as bn,Vector3 as N,MeshBasicMaterial as Ct,Node as sr,PerspectiveCamera as qs,NodeFrame as nr,NodeBuilder as ir,GLSLNodeParser as ar,ShaderLib as Bt,UniformsUtils as In,UniformsLib as ms,normalView as or,defaultShaderStages as zs,ShaderChunk as rr,Material as Jt,TrianglesDrawMode as Ar,TriangleFanDrawMode as En,TriangleStripDrawMode as ki,Matrix4 as ce,Loader as Dt,LoaderUtils as Wt,FileLoader as gt,MeshPhysicalMaterial as wt,Vector2 as Le,Color as we,LinearSRGBColorSpace as Ve,SRGBColorSpace as le,SpotLight as Mi,PointLight as Cn,DirectionalLight as _i,InstancedMesh as cr,Quaternion as ye,InstancedBufferAttribute as lr,Object3D as yt,TextureLoader as Bn,ImageBitmapLoader as hr,BufferAttribute as it,InterleavedBuffer as dr,LinearMipmapLinearFilter as bs,NearestMipmapLinearFilter as Fi,LinearMipmapNearestFilter as Li,NearestMipmapNearestFilter as wn,LinearFilter as at,NearestFilter as Ks,RepeatWrapping as Vt,MirroredRepeatWrapping as Ni,ClampToEdgeWrapping as Ys,PointsMaterial as Is,LineBasicMaterial as kt,MeshStandardMaterial as yn,DoubleSide as Qn,PropertyBinding as ut,BufferGeometry as ct,SkinnedMesh as vn,LineSegments as Js,Line as ft,LineLoop as pr,Points as Ws,Group as Xt,MathUtils as Ce,OrthographicCamera as Ui,Skeleton as Gi,AnimationClip as xn,Bone as Sn,InterpolateDiscrete as Tn,InterpolateLinear as Es,InterleavedBufferAttribute as Zt,Texture as Rn,VectorKeyframeTrack as Vs,NumberKeyframeTrack as Xs,QuaternionKeyframeTrack as Zs,ColorManagement as Xe,FrontSide as Pi,Interpolant as gr,Box3 as $s,Sphere as Dn,RGBA_S3TC_DXT1_Format as kn,RGB_PVRTC_4BPPV1_Format as ur,RGB_ETC2_Format as Oi,RGB_ETC1_Format as fr,RGBA_S3TC_DXT5_Format as Mn,RGBA_PVRTC_4BPPV1_Format as mr,RGBA_ETC2_EAC_Format as Hi,RGBA_BPTC_Format as _n,RGB_BPTC_UNSIGNED_Format as br,RGBA_ASTC_4x4_Format as en,RGBAFormat as Pt,FloatType as mt,HalfFloatType as Ze,UnsignedByteType as bt,CompressedCubeTexture as Ir,CompressedArrayTexture as Er,CompressedTexture as Cs,NoColorSpace as tn,RGBA_S3TC_DXT3_Format as ji,RGB_S3TC_DXT1_Format as qi,RGBA_ASTC_6x6_Format as zi,RGBFormat as Fn,RedFormat as rs,RGFormat as Bs,UnsignedInt101111Type as Ki,UnsignedInt5999Type as Yi,DataTexture as Cr,Data3DTexture as Br,ExtrudeGeometry as wr,ShapePath as yr,Raycaster as Ln,CylinderGeometry as $e,BoxGeometry as Ye,Float32BufferAttribute as ke,OctahedronGeometry as sn,TorusGeometry as ws,Euler as Ot,Controls as Ji,PlaneGeometry as Nn,DataTextureLoader as Wi,DataUtils as As,Vector4 as Mt,Curve as Qr,MeshPhongMaterial as ys,MeshLambertMaterial as vr,EquirectangularReflectionMapping as xr,AmbientLight as Sr,Uint16BufferAttribute as Tr,Matrix3 as Vi,ShapeUtils as Rr,DefaultLoadingManager as Dr,Ray as kr,Plane as Mr,MOUSE as cs,TOUCH as ls,Spherical as Xi,ShaderMaterial as Zi,Uniform$1 as _r,Scene as Un,WebGLRenderer as Fr,CanvasTexture as $i,REVISION as Lr,Source as Nr,InstancedBufferGeometry as Ur,InstancedInterleavedBuffer as Gn,WireframeGeometry as Gr,Line3 as Pr,ColorKeyframeTrack as Or}from"./three-CsmWHVn7.min.js";class Hr extends O{constructor(e,t,n,s=128){if(t<=0||n<=0||s<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const i=new bn(n,2*s,s);i.scale(1,1,-1);const a=i.getAttribute("position"),r=new N;for(let A=0;A<a.count;++A)if(r.fromBufferAttribute(a,A),r.y<0){const c=-t*3/2,l=r.y<c?-t/r.y:1-r.y*r.y/(3*c*c);r.multiplyScalar(l),r.toArray(a.array,3*A)}a.needsUpdate=!0,super(i,new Ct({map:e,depthWrite:!1}))}}class be extends sr{constructor(e){super(e.nodeType),this.node=null,this.source=null,this.target=null,this.inclusionType="replace",Object.assign(this,e)}generate(e){return this.node.build(e,this.getNodeType(e))}}const et=new nr;et.camera=new qs;const ea={LineBasicNodeMaterial:Bt.basic,MeshBasicNodeMaterial:Bt.basic,PointsNodeMaterial:Bt.points,MeshStandardNodeMaterial:Bt.standard,MeshPhysicalNodeMaterial:Bt.physical,MeshPhongNodeMaterial:Bt.phong},jr={atan2:"atan"},qr={low:"lowp",medium:"mediump",high:"highp"};function Ht(o){return`#include <${o}>`}function Qs(o){return`${o}Shader`}class zr extends ir{constructor(e,t,n,s=null){super(e,t,new ar,null,s),this.shader=n,this.slots={vertex:[],fragment:[]},this._parseShaderLib(),this._parseInclude("fragment","lights_physical_fragment","clearcoat_normal_fragment_begin","transmission_fragment"),this._parseObject(),this._sortSlotsToFlow(),this.useComparisonMethod=!0}getMethod(e){return jr[e]||e}addSlot(e,t){this.slots[e].push(t)}_parseShaderLib(){const e=this.material;let t=e.type;if(e.isMeshPhysicalNodeMaterial?t="MeshPhysicalNodeMaterial":e.isMeshStandardNodeMaterial?t="MeshStandardNodeMaterial":e.isMeshPhongNodeMaterial?t="MeshPhongNodeMaterial":e.isMeshBasicNodeMaterial?t="MeshBasicNodeMaterial":e.isPointsNodeMaterial?t="PointsNodeMaterial":e.isLineBasicNodeMaterial&&(t="LineBasicNodeMaterial"),ea[t]!==void 0){const n=ea[t],s=this.shader;s.vertexShader=n.vertexShader,s.fragmentShader=n.fragmentShader,s.uniforms=In.merge([n.uniforms,ms.lights])}}_parseObject(){const{material:e,renderer:t}=this;this.addSlot("fragment",new be({node:or,nodeType:"vec3",source:"void main() {",target:"vec3 TransformedNormalView = %RESULT%;",inclusionType:"append"})),t.toneMappingNode&&t.toneMappingNode.isNode===!0&&this.addSlot("fragment",new be({node:e.colorNode,nodeType:"vec4",source:Ht("tonemapping_fragment"),target:""})),e.colorNode&&e.colorNode.isNode&&this.addSlot("fragment",new be({node:e.colorNode,nodeType:"vec4",source:"vec4 diffuseColor = vec4( diffuse, opacity );",target:"vec4 diffuseColor = %RESULT%; diffuseColor.a *= opacity;"})),e.opacityNode&&e.opacityNode.isNode&&this.addSlot("fragment",new be({node:e.opacityNode,nodeType:"float",source:Ht("alphatest_fragment"),target:"diffuseColor.a = %RESULT%;",inclusionType:"append"})),e.normalNode&&e.normalNode.isNode&&this.addSlot("fragment",new be({node:e.normalNode,nodeType:"vec3",source:Ht("normal_fragment_begin"),target:"normal = %RESULT%;",inclusionType:"append"})),e.emissiveNode&&e.emissiveNode.isNode&&this.addSlot("fragment",new be({node:e.emissiveNode,nodeType:"vec3",source:Ht("emissivemap_fragment"),target:"totalEmissiveRadiance = %RESULT%;",inclusionType:"append"})),e.isMeshStandardNodeMaterial&&(e.metalnessNode&&e.metalnessNode.isNode&&this.addSlot("fragment",new be({node:e.metalnessNode,nodeType:"float",source:Ht("metalnessmap_fragment"),target:"metalnessFactor = %RESULT%;",inclusionType:"append"})),e.roughnessNode&&e.roughnessNode.isNode&&this.addSlot("fragment",new be({node:e.roughnessNode,nodeType:"float",source:Ht("roughnessmap_fragment"),target:"roughnessFactor = %RESULT%;",inclusionType:"append"})),e.isMeshPhysicalNodeMaterial&&(e.clearcoatNode&&e.clearcoatNode.isNode?(this.addSlot("fragment",new be({node:e.clearcoatNode,nodeType:"float",source:"material.clearcoat = clearcoat;",target:"material.clearcoat = %RESULT%;"})),e.clearcoatRoughnessNode&&e.clearcoatRoughnessNode.isNode&&this.addSlot("fragment",new be({node:e.clearcoatRoughnessNode,nodeType:"float",source:"material.clearcoatRoughness = clearcoatRoughness;",target:"material.clearcoatRoughness = %RESULT%;"})),e.clearcoatNormalNode&&e.clearcoatNormalNode.isNode&&this.addSlot("fragment",new be({node:e.clearcoatNormalNode,nodeType:"vec3",source:"vec3 clearcoatNormal = nonPerturbedNormal;",target:"vec3 clearcoatNormal = %RESULT%;"})),e.defines.USE_CLEARCOAT=""):delete e.defines.USE_CLEARCOAT,e.sheenNode&&e.sheenNode.isNode?(this.addSlot("fragment",new be({node:e.sheenNode,nodeType:"vec3",source:"material.sheenColor = sheenColor;",target:"material.sheenColor = %RESULT%;"})),e.sheenRoughnessNode&&e.sheenRoughnessNode.isNode&&this.addSlot("fragment",new be({node:e.sheenRoughnessNode,nodeType:"float",source:"material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );",target:"material.sheenRoughness = clamp( %RESULT%, 0.07, 1.0 );"})),e.defines.USE_SHEEN=""):delete e.defines.USE_SHEEN,e.iridescenceNode&&e.iridescenceNode.isNode?(this.addSlot("fragment",new be({node:e.iridescenceNode,nodeType:"float",source:"material.iridescence = iridescence;",target:"material.iridescence = %RESULT%;"})),e.iridescenceIORNode&&e.iridescenceIORNode.isNode&&this.addSlot("fragment",new be({node:e.iridescenceIORNode,nodeType:"float",source:"material.iridescenceIOR = iridescenceIOR;",target:"material.iridescenceIOR = %RESULT%;"})),e.iridescenceThicknessNode&&e.iridescenceThicknessNode.isNode&&this.addSlot("fragment",new be({node:e.iridescenceThicknessNode,nodeType:"float",source:"material.iridescenceThickness = iridescenceThicknessMaximum;",target:"material.iridescenceThickness = %RESULT%;"})),e.defines.USE_IRIDESCENCE=""):delete e.defines.USE_IRIDESCENCE,e.iorNode&&e.iorNode.isNode&&this.addSlot("fragment",new be({node:e.iorNode,nodeType:"float",source:"material.ior = ior;",target:"material.ior = %RESULT%;"})),e.specularColorNode&&e.specularColorNode.isNode&&this.addSlot("fragment",new be({node:e.specularColorNode,nodeType:"vec3",source:"vec3 specularColorFactor = specularColor;",target:"vec3 specularColorFactor = %RESULT%;"})),e.specularIntensityNode&&e.specularIntensityNode.isNode&&this.addSlot("fragment",new be({node:e.specularIntensityNode,nodeType:"float",source:"float specularIntensityFactor = specularIntensity;",target:"float specularIntensityFactor = %RESULT%;"})),e.transmissionNode&&e.transmissionNode.isNode?(this.addSlot("fragment",new be({node:e.transmissionNode,nodeType:"float",source:"material.transmission = transmission;",target:"material.transmission = %RESULT%;"})),e.thicknessNode&&e.thicknessNode.isNode&&this.addSlot("fragment",new be({node:e.thicknessNode,nodeType:"float",source:"material.thickness = thickness;",target:"material.thickness = %RESULT%;"})),e.attenuationDistanceNode&&e.attenuationDistanceNode.isNode&&this.addSlot("fragment",new be({node:e.attenuationDistanceNode,nodeType:"float",source:"material.attenuationDistance = attenuationDistance;",target:"material.attenuationDistance = %RESULT%;"})),e.attenuationColorNode&&e.attenuationColorNode.isNode&&this.addSlot("fragment",new be({node:e.attenuationColorNode,nodeType:"vec3",source:"material.attenuationColor = attenuationColor;",target:"material.attenuationColor = %RESULT%;"})),e.transmission=1,e.defines.USE_TRANSMISSION=""):(e.transmission=0,delete e.defines.USE_TRANSMISSION))),e.positionNode&&e.positionNode.isNode&&this.addSlot("vertex",new be({node:e.positionNode,nodeType:"vec3",source:Ht("begin_vertex"),target:"transformed = %RESULT%;",inclusionType:"append"})),e.sizeNode&&e.sizeNode.isNode&&this.addSlot("vertex",new be({node:e.sizeNode,nodeType:"float",source:"gl_PointSize = size;",target:"gl_PointSize = %RESULT%;"}))}generateTexture(e,t,n){return e.isTextureCube?`textureCube( ${t}, ${n} )`:`texture2D( ${t}, ${n} )`}generateTextureLevel(e,t,n,s){return`textureLod( ${t}, ${n}, ${s} )`}buildFunctionCode(e){const t=e.layout,n=this.flowShaderNode(e),s=[];for(const i of t.inputs)s.push(this.getType(i.type)+" "+i.name);return`${this.getType(t.type)} ${t.name}( ${s.join(", ")} ) {
|
|
2
|
-
|
|
3
|
-
${n.vars}
|
|
4
|
-
|
|
5
|
-
${n.code}
|
|
6
|
-
return ${n.result};
|
|
7
|
-
|
|
8
|
-
}`}getUniforms(e){const t=this.uniforms[e];let n="";for(const s of t){if(/^(modelViewMatrix|projectionMatrix)$/.test(s.name))continue;let i=null;s.type==="texture"?i=`sampler2D ${s.name}; `:s.type==="cubeTexture"?i=`samplerCube ${s.name}; `:i=`${this.getVectorType(s.type)} ${s.name}; `;const a=s.node.precision;a!==null?i="uniform "+qr[a]+" "+i:i="uniform "+i,n+=i}return n}getAttributes(e){let t="";if(e==="vertex"){const n=this.attributes;for(const s of n)/^(position|normal|uv[1-3]?)$/.test(s.name)||(t+=`attribute ${s.type} ${s.name}; `)}return t}getVaryings(e){let t="";const n=this.varyings;if(e==="vertex")for(const s of n)t+=`${s.needsInterpolation?"varying":"/*varying*/"} ${s.type} ${s.name}; `;else if(e==="fragment")for(const s of n)s.needsInterpolation&&(t+=`varying ${s.type} ${s.name}; `);return t}addCode(e,t,n,s=this){const i=Qs(e);let a=s[i];const r=a.indexOf(t);if(r!==-1){const A=a.substring(0,r+t.length),c=a.substring(r+t.length);a=`${A}
|
|
9
|
-
${n}
|
|
10
|
-
${c}`}s[i]=a}replaceCode(e,t,n,s=this){const i=Qs(e);s[i]=s[i].replaceAll(t,n)}getVertexIndex(){return"gl_VertexID"}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord"}isFlipY(){return!0}buildCode(){const e={};for(const t of zs){const n=this.getUniforms(t),s=this.getAttributes(t),i=this.getVaryings(t),a=this.getVars(t),r=this.getCodes(t);e[t]=`${this.getSignature()}
|
|
11
|
-
// <node_builder>
|
|
12
|
-
|
|
13
|
-
// uniforms
|
|
14
|
-
${n}
|
|
15
|
-
|
|
16
|
-
// attributes
|
|
17
|
-
${s}
|
|
18
|
-
|
|
19
|
-
// varyings
|
|
20
|
-
${i}
|
|
21
|
-
|
|
22
|
-
// vars
|
|
23
|
-
${a}
|
|
24
|
-
|
|
25
|
-
// codes
|
|
26
|
-
${r}
|
|
27
|
-
|
|
28
|
-
// </node_builder>
|
|
29
|
-
|
|
30
|
-
${this.shader[Qs(t)]}
|
|
31
|
-
`}this.vertexShader=e.vertex,this.fragmentShader=e.fragment}build(){return super.build(!1),this._addSnippets(),this._addUniforms(),this._updateUniforms(),this.shader.vertexShader=this.vertexShader,this.shader.fragmentShader=this.fragmentShader,this}_parseInclude(e,...t){for(const n of t){const s=Ht(n),i=rr[n],a=Qs(e);this.shader[a]=this.shader[a].replaceAll(s,i)}}_sortSlotsToFlow(){for(const e of zs){const t=this.shader[Qs(e)],n=this.slots[e].sort((s,i)=>t.indexOf(s.source)>t.indexOf(i.source)?1:-1);for(const s of n)this.addFlow(e,s)}}_addSnippets(){for(const e of zs){for(const t of this.slots[e]){const n=this.getFlowData(t),s=t.inclusionType,i=t.source,a=n.code+`
|
|
32
|
-
`+t.target.replace("%RESULT%",n.result);s==="append"?this.addCode(e,i,a):s==="replace"?this.replaceCode(e,i,a):console.warn(`Inclusion type "${s}" not compatible.`)}this.addCode(e,"main() {",`
|
|
33
|
-
`+this.flowCode[e])}}_addUniforms(){for(const e of zs)for(const t of this.uniforms[e])this.shader.uniforms[t.name]=t}_updateUniforms(){et.object=this.object,et.renderer=this.renderer,et.material=this.material,et.scene=this.scene;for(const e of this.updateNodes)et.updateNode(e)}}const ta=new WeakMap;Jt.prototype.onBuild=function(o,e,t){const n=this;if(n.isNodeMaterial===!0){let s;try{s=new zr(o,t,e,n).build(),ta.set(n,s)}catch(i){console.error("Material.prototype.onBuild: ",i)}}},Jt.prototype.onBeforeRender=function(o,e,t,n,s){const i=ta.get(this);if(i!==void 0){et.material=this,et.camera=t,et.object=s,et.renderer=o,et.scene=e,et.geometry=n;const a=i.updateNodes;if(a.length>0){o.state.useProgram(null);for(const r of a)et.updateNode(r)}}};var vs=function(){var o=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(l){l.preventDefault(),n(++o%e.children.length)},!1);function t(l){return e.appendChild(l.dom),l}function n(l){for(var h=0;h<e.children.length;h++)e.children[h].style.display=h===l?"block":"none";o=l}var s=(performance||Date).now(),i=s,a=0,r=t(new vs.Panel("FPS","#0ff","#002")),A=t(new vs.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var c=t(new vs.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:e,addPanel:t,showPanel:n,begin:function(){s=(performance||Date).now()},end:function(){a++;var l=(performance||Date).now();if(A.update(l-s,200),l>=i+1e3&&(r.update(a*1e3/(l-i),100),i=l,a=0,c)){var h=performance.memory;c.update(h.usedJSHeapSize/1048576,h.jsHeapSizeLimit/1048576)}return l},update:function(){s=this.end()},domElement:e,setMode:n}};vs.Panel=function(o,e,t){var n=1/0,s=0,i=Math.round,a=i(window.devicePixelRatio||1),r=80*a,A=48*a,c=3*a,l=2*a,h=3*a,p=15*a,g=74*a,u=30*a,b=document.createElement("canvas");b.width=r,b.height=A,b.style.cssText="width:80px;height:48px";var f=b.getContext("2d");return f.font="bold "+9*a+"px Helvetica,Arial,sans-serif",f.textBaseline="top",f.fillStyle=t,f.fillRect(0,0,r,A),f.fillStyle=e,f.fillText(o,c,l),f.fillRect(h,p,g,u),f.fillStyle=t,f.globalAlpha=.9,f.fillRect(h,p,g,u),{dom:b,update:function(E,C){n=Math.min(n,E),s=Math.max(s,E),f.fillStyle=t,f.globalAlpha=1,f.fillRect(0,0,r,p),f.fillStyle=e,f.fillText(i(E)+" "+o+" ("+i(n)+"-"+i(s)+")",c,l),f.drawImage(b,h+a,p,g-a,u,h,p,g-a,u),f.fillRect(h+g-a,p,a,u),f.fillStyle=t,f.globalAlpha=.9,f.fillRect(h+g-a,p,a,i((1-E/C)*u))}}};function Kr(o,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},n=o.getIndex(),s=o.getAttribute("position"),i=n?n.count:s.count;let a=0;const r=Object.keys(o.attributes),A={},c={},l=[],h=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"];for(let C=0,I=r.length;C<I;C++){const y=r[C],w=o.attributes[y];A[y]=new w.constructor(new w.array.constructor(w.count*w.itemSize),w.itemSize,w.normalized);const x=o.morphAttributes[y];x&&(c[y]||(c[y]=[]),x.forEach((T,S)=>{const M=new T.array.constructor(T.count*T.itemSize);c[y][S]=new T.constructor(M,T.itemSize,T.normalized)}))}const g=e*.5,u=Math.log10(1/e),b=Math.pow(10,u),f=g*b;for(let C=0;C<i;C++){const I=n?n.getX(C):C;let y="";for(let w=0,x=r.length;w<x;w++){const T=r[w],S=o.getAttribute(T),M=S.itemSize;for(let j=0;j<M;j++)y+=`${~~(S[h[j]](I)*b+f)},`}if(y in t)l.push(t[y]);else{for(let w=0,x=r.length;w<x;w++){const T=r[w],S=o.getAttribute(T),M=o.morphAttributes[T],j=S.itemSize,K=A[T],J=c[T];for(let V=0;V<j;V++){const q=h[V],X=p[V];if(K[X](a,S[q](I)),M)for(let W=0,ee=M.length;W<ee;W++)J[W][X](a,M[W][q](I))}}t[y]=a,l.push(a),a++}}const E=o.clone();for(const C in o.attributes){const I=A[C];if(E.setAttribute(C,new I.constructor(I.array.slice(0,a*I.itemSize),I.itemSize,I.normalized)),C in c)for(let y=0;y<c[C].length;y++){const w=c[C][y];E.morphAttributes[C][y]=new w.constructor(w.array.slice(0,a*w.itemSize),w.itemSize,w.normalized)}}return E.setIndex(l),E}function sa(o,e){if(e===Ar)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(e===En||e===ki){let t=o.getIndex();if(t===null){const a=[],r=o.getAttribute("position");if(r!==void 0){for(let A=0;A<r.count;A++)a.push(A);o.setIndex(a),t=o.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),o}const n=t.count-2,s=[];if(e===En)for(let a=1;a<=n;a++)s.push(t.getX(0)),s.push(t.getX(a)),s.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(s.push(t.getX(a)),s.push(t.getX(a+1)),s.push(t.getX(a+2))):(s.push(t.getX(a+2)),s.push(t.getX(a+1)),s.push(t.getX(a)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=o.clone();return i.setIndex(s),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),o}class Pn extends Dt{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Xr(t)}),this.register(function(t){return new Zr(t)}),this.register(function(t){return new rA(t)}),this.register(function(t){return new AA(t)}),this.register(function(t){return new cA(t)}),this.register(function(t){return new eA(t)}),this.register(function(t){return new tA(t)}),this.register(function(t){return new sA(t)}),this.register(function(t){return new nA(t)}),this.register(function(t){return new Vr(t)}),this.register(function(t){return new iA(t)}),this.register(function(t){return new $r(t)}),this.register(function(t){return new oA(t)}),this.register(function(t){return new aA(t)}),this.register(function(t){return new Jr(t)}),this.register(function(t){return new lA(t)}),this.register(function(t){return new hA(t)})}load(e,t,n,s){const i=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const c=Wt.extractUrlBase(e);a=Wt.resolveURL(c,this.path)}else a=Wt.extractUrlBase(e);this.manager.itemStart(e);const r=function(c){s?s(c):console.error(c),i.manager.itemError(e),i.manager.itemEnd(e)},A=new gt(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,function(c){try{i.parse(c,a,function(l){t(l),i.manager.itemEnd(e)},r)}catch(l){r(l)}},n,r)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,s){let i,a;const r={},A={},c=new TextDecoder;if(typeof e=="string")try{i=JSON.parse(e)}catch(h){a=e,s&&s(h);return}else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===na){try{r[ie.KHR_BINARY_GLTF]=new dA(e)}catch(h){s&&s(h);return}try{i=JSON.parse(r[ie.KHR_BINARY_GLTF].content)}catch(h){a=r[ie.KHR_BINARY_GLTF].content,s&&s(h);return}}else try{i=JSON.parse(c.decode(e))}catch(h){a=c.decode(e),s&&s(h);return}else i=e;if(i.asset===void 0||i.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}this.json=i,this.jsonErrorData=a;const l=new QA(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const p=this.pluginCallbacks[h](l);p.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),A[p.name]=p,r[p.name]=!0}if(i.extensionsUsed)for(let h=0;h<i.extensionsUsed.length;++h){const p=i.extensionsUsed[h],g=i.extensionsRequired||[];switch(p){case ie.KHR_MATERIALS_UNLIT:r[p]=new Wr;break;case ie.KHR_DRACO_MESH_COMPRESSION:r[p]=new pA(i,this.dracoLoader);break;case ie.KHR_TEXTURE_TRANSFORM:r[p]=new gA;break;case ie.KHR_MESH_QUANTIZATION:r[p]=new uA;break;default:g.indexOf(p)>=0&&A[p]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}l.setExtensions(r),l.setPlugins(A),l.parse(n,s)}parseAsync(e,t){const n=this;return new Promise(function(s,i){n.parse(e,t,s,i)})}}function Yr(){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 ie={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 Jr{constructor(e){this.parser=e,this.name=ie.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,s=t.length;n<s;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let s=t.cache.get(n);if(s)return s;const i=t.json,a=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let r;const A=new we(16777215);a.color!==void 0&&A.setRGB(a.color[0],a.color[1],a.color[2],Ve);const c=a.range!==void 0?a.range:0;switch(a.type){case"directional":r=new _i(A),r.target.position.set(0,0,-1),r.add(r.target);break;case"point":r=new Cn(A),r.distance=c;break;case"spot":r=new Mi(A),r.distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,r.angle=a.spot.outerConeAngle,r.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,r.target.position.set(0,0,-1),r.add(r.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return r.position.set(0,0,0),r.decay=2,_t(r,a),a.intensity!==void 0&&(r.intensity=a.intensity),r.name=t.createUniqueName(a.name||"light_"+e),s=Promise.resolve(r),t.cache.add(n,s),s}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,s=n.json.nodes[e],i=(s.extensions&&s.extensions[this.name]||{}).light;return i===void 0?null:this._loadLight(i).then(function(a){return n._getNodeRef(t.cache,i,a)})}}let Wr=class{constructor(){this.name=ie.KHR_MATERIALS_UNLIT}getMaterialType(){return Ct}extendParams(o,e,t){const n=[];o.color=new we(1,1,1),o.opacity=1;const s=e.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const i=s.baseColorFactor;o.color.setRGB(i[0],i[1],i[2],Ve),o.opacity=i[3]}s.baseColorTexture!==void 0&&n.push(t.assignTexture(o,"map",s.baseColorTexture,le))}return Promise.all(n)}},Vr=class{constructor(o){this.parser=o,this.name=ie.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(o,e){const t=this.parser.json.materials[o];if(!t.extensions||!t.extensions[this.name])return Promise.resolve();const n=t.extensions[this.name].emissiveStrength;return n!==void 0&&(e.emissiveIntensity=n),Promise.resolve()}},Xr=class{constructor(o){this.parser=o,this.name=ie.KHR_MATERIALS_CLEARCOAT}getMaterialType(o){const e=this.parser.json.materials[o];return!e.extensions||!e.extensions[this.name]?null:wt}extendMaterialParams(o,e){const t=this.parser,n=t.json.materials[o];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];if(i.clearcoatFactor!==void 0&&(e.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&s.push(t.assignTexture(e,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&s.push(t.assignTexture(e,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(s.push(t.assignTexture(e,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){const a=i.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Le(a,a)}return Promise.all(s)}},Zr=class{constructor(o){this.parser=o,this.name=ie.KHR_MATERIALS_DISPERSION}getMaterialType(o){const e=this.parser.json.materials[o];return!e.extensions||!e.extensions[this.name]?null:wt}extendMaterialParams(o,e){const t=this.parser.json.materials[o];if(!t.extensions||!t.extensions[this.name])return Promise.resolve();const n=t.extensions[this.name];return e.dispersion=n.dispersion!==void 0?n.dispersion:0,Promise.resolve()}},$r=class{constructor(o){this.parser=o,this.name=ie.KHR_MATERIALS_IRIDESCENCE}getMaterialType(o){const e=this.parser.json.materials[o];return!e.extensions||!e.extensions[this.name]?null:wt}extendMaterialParams(o,e){const t=this.parser,n=t.json.materials[o];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return i.iridescenceFactor!==void 0&&(e.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&s.push(t.assignTexture(e,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(e.iridescenceIOR=i.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&s.push(t.assignTexture(e,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(s)}},eA=class{constructor(o){this.parser=o,this.name=ie.KHR_MATERIALS_SHEEN}getMaterialType(o){const e=this.parser.json.materials[o];return!e.extensions||!e.extensions[this.name]?null:wt}extendMaterialParams(o,e){const t=this.parser,n=t.json.materials[o];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[];e.sheenColor=new we(0,0,0),e.sheenRoughness=0,e.sheen=1;const i=n.extensions[this.name];if(i.sheenColorFactor!==void 0){const a=i.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],Ve)}return i.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&s.push(t.assignTexture(e,"sheenColorMap",i.sheenColorTexture,le)),i.sheenRoughnessTexture!==void 0&&s.push(t.assignTexture(e,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(s)}},tA=class{constructor(o){this.parser=o,this.name=ie.KHR_MATERIALS_TRANSMISSION}getMaterialType(o){const e=this.parser.json.materials[o];return!e.extensions||!e.extensions[this.name]?null:wt}extendMaterialParams(o,e){const t=this.parser,n=t.json.materials[o];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return i.transmissionFactor!==void 0&&(e.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&s.push(t.assignTexture(e,"transmissionMap",i.transmissionTexture)),Promise.all(s)}},sA=class{constructor(o){this.parser=o,this.name=ie.KHR_MATERIALS_VOLUME}getMaterialType(o){const e=this.parser.json.materials[o];return!e.extensions||!e.extensions[this.name]?null:wt}extendMaterialParams(o,e){const t=this.parser,n=t.json.materials[o];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];e.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&s.push(t.assignTexture(e,"thicknessMap",i.thicknessTexture)),e.attenuationDistance=i.attenuationDistance||1/0;const a=i.attenuationColor||[1,1,1];return e.attenuationColor=new we().setRGB(a[0],a[1],a[2],Ve),Promise.all(s)}},nA=class{constructor(o){this.parser=o,this.name=ie.KHR_MATERIALS_IOR}getMaterialType(o){const e=this.parser.json.materials[o];return!e.extensions||!e.extensions[this.name]?null:wt}extendMaterialParams(o,e){const t=this.parser.json.materials[o];if(!t.extensions||!t.extensions[this.name])return Promise.resolve();const n=t.extensions[this.name];return e.ior=n.ior!==void 0?n.ior:1.5,Promise.resolve()}},iA=class{constructor(o){this.parser=o,this.name=ie.KHR_MATERIALS_SPECULAR}getMaterialType(o){const e=this.parser.json.materials[o];return!e.extensions||!e.extensions[this.name]?null:wt}extendMaterialParams(o,e){const t=this.parser,n=t.json.materials[o];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];e.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&s.push(t.assignTexture(e,"specularIntensityMap",i.specularTexture));const a=i.specularColorFactor||[1,1,1];return e.specularColor=new we().setRGB(a[0],a[1],a[2],Ve),i.specularColorTexture!==void 0&&s.push(t.assignTexture(e,"specularColorMap",i.specularColorTexture,le)),Promise.all(s)}},aA=class{constructor(o){this.parser=o,this.name=ie.EXT_MATERIALS_BUMP}getMaterialType(o){const e=this.parser.json.materials[o];return!e.extensions||!e.extensions[this.name]?null:wt}extendMaterialParams(o,e){const t=this.parser,n=t.json.materials[o];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return e.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&s.push(t.assignTexture(e,"bumpMap",i.bumpTexture)),Promise.all(s)}},oA=class{constructor(o){this.parser=o,this.name=ie.KHR_MATERIALS_ANISOTROPY}getMaterialType(o){const e=this.parser.json.materials[o];return!e.extensions||!e.extensions[this.name]?null:wt}extendMaterialParams(o,e){const t=this.parser,n=t.json.materials[o];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],i=n.extensions[this.name];return i.anisotropyStrength!==void 0&&(e.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(e.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&s.push(t.assignTexture(e,"anisotropyMap",i.anisotropyTexture)),Promise.all(s)}};class rA{constructor(e){this.parser=e,this.name=ie.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,s=n.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const i=s.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,a)}}class AA{constructor(e){this.parser=e,this.name=ie.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,i=s.textures[e];if(!i.extensions||!i.extensions[t])return null;const a=i.extensions[t],r=s.images[a.source];let A=n.textureLoader;if(r.uri){const c=n.options.manager.getHandler(r.uri);c!==null&&(A=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,a.source,A);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 cA{constructor(e){this.parser=e,this.name=ie.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,i=s.textures[e];if(!i.extensions||!i.extensions[t])return null;const a=i.extensions[t],r=s.images[a.source];let A=n.textureLoader;if(r.uri){const c=n.options.manager.getHandler(r.uri);c!==null&&(A=c)}return this.detectSupport().then(function(c){if(c)return n.loadTextureImage(e,a.source,A);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=ie.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const s=n.extensions[this.name],i=this.parser.getDependency("buffer",s.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(r){const A=s.byteOffset||0,c=s.byteLength||0,l=s.count,h=s.byteStride,p=new Uint8Array(r,A,c);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(l,h,p,s.mode,s.filter).then(function(g){return g.buffer}):a.ready.then(function(){const g=new ArrayBuffer(l*h);return a.decodeGltfBuffer(new Uint8Array(g),l,h,p,s.mode,s.filter),g})})}else return null}}let hA=class{constructor(o){this.name=ie.EXT_MESH_GPU_INSTANCING,this.parser=o}createNodeMesh(o){const e=this.parser.json,t=e.nodes[o];if(!t.extensions||!t.extensions[this.name]||t.mesh===void 0)return null;const n=e.meshes[t.mesh];for(const r of n.primitives)if(r.mode!==lt.TRIANGLES&&r.mode!==lt.TRIANGLE_STRIP&&r.mode!==lt.TRIANGLE_FAN&&r.mode!==void 0)return null;const s=t.extensions[this.name].attributes,i=[],a={};for(const r in s)i.push(this.parser.getDependency("accessor",s[r]).then(A=>(a[r]=A,a[r])));return i.length<1?null:(i.push(this.parser.createNodeMesh(o)),Promise.all(i).then(r=>{const A=r.pop(),c=A.isGroup?A.children:[A],l=r[0].count,h=[];for(const p of c){const g=new ce,u=new N,b=new ye,f=new N(1,1,1),E=new cr(p.geometry,p.material,l);for(let C=0;C<l;C++)a.TRANSLATION&&u.fromBufferAttribute(a.TRANSLATION,C),a.ROTATION&&b.fromBufferAttribute(a.ROTATION,C),a.SCALE&&f.fromBufferAttribute(a.SCALE,C),E.setMatrixAt(C,g.compose(u,b,f));for(const C in a)if(C==="_COLOR_0"){const I=a[C];E.instanceColor=new lr(I.array,I.itemSize,I.normalized)}else C!=="TRANSLATION"&&C!=="ROTATION"&&C!=="SCALE"&&p.geometry.setAttribute(C,a[C]);yt.prototype.copy.call(E,p),this.parser.assignFinalMaterial(E),h.push(E)}return A.isGroup?(A.clear(),A.add(...h),A):h[0]}))}};const na="glTF",xs=12,ia={JSON:1313821514,BIN:5130562};class dA{constructor(e){this.name=ie.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,xs),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==na)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-xs,i=new DataView(e,xs);let a=0;for(;a<s;){const r=i.getUint32(a,!0);a+=4;const A=i.getUint32(a,!0);if(a+=4,A===ia.JSON){const c=new Uint8Array(e,xs+a,r);this.content=n.decode(c)}else if(A===ia.BIN){const c=xs+a;this.body=e.slice(c,c+r)}a+=r}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class pA{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ie.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,s=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,r={},A={},c={};for(const l in a){const h=Hn[l]||l.toLowerCase();r[h]=a[l]}for(const l in e.attributes){const h=Hn[l]||l.toLowerCase();if(a[l]!==void 0){const p=n.accessors[e.attributes[l]],g=hs[p.componentType];c[h]=g.name,A[h]=p.normalized===!0}}return t.getDependency("bufferView",i).then(function(l){return new Promise(function(h,p){s.decodeDracoFile(l,function(g){for(const u in g.attributes){const b=g.attributes[u],f=A[u];f!==void 0&&(b.normalized=f)}h(g)},r,c,Ve,p)})})}}class gA{constructor(){this.name=ie.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 uA{constructor(){this.name=ie.KHR_MESH_QUANTIZATION}}class aa extends gr{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,i=e*s*3+s;for(let a=0;a!==s;a++)t[a]=n[i+a];return t}interpolate_(e,t,n,s){const i=this.resultBuffer,a=this.sampleValues,r=this.valueSize,A=r*2,c=r*3,l=s-t,h=(n-t)/l,p=h*h,g=p*h,u=e*c,b=u-c,f=-2*g+3*p,E=g-p,C=1-f,I=E-p+h;for(let y=0;y!==r;y++){const w=a[b+y+r],x=a[b+y+A]*l,T=a[u+y+r],S=a[u+y]*l;i[y]=C*w+I*x+f*T+E*S}return i}}const fA=new ye;class mA extends aa{interpolate_(e,t,n,s){const i=super.interpolate_(e,t,n,s);return fA.fromArray(i).normalize().toArray(i),i}}const lt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},hs={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},oa={9728:Ks,9729:at,9984:wn,9985:Li,9986:Fi,9987:bs},ra={33071:Ys,33648:Ni,10497:Vt},On={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Hn={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},jt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},bA={CUBICSPLINE:void 0,LINEAR:Es,STEP:Tn},jn={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function IA(o){return o.DefaultMaterial===void 0&&(o.DefaultMaterial=new yn({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Pi})),o.DefaultMaterial}function $t(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 _t(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 EA(o,e,t){let n=!1,s=!1,i=!1;for(let c=0,l=e.length;c<l;c++){const h=e[c];if(h.POSITION!==void 0&&(n=!0),h.NORMAL!==void 0&&(s=!0),h.COLOR_0!==void 0&&(i=!0),n&&s&&i)break}if(!n&&!s&&!i)return Promise.resolve(o);const a=[],r=[],A=[];for(let c=0,l=e.length;c<l;c++){const h=e[c];if(n){const p=h.POSITION!==void 0?t.getDependency("accessor",h.POSITION):o.attributes.position;a.push(p)}if(s){const p=h.NORMAL!==void 0?t.getDependency("accessor",h.NORMAL):o.attributes.normal;r.push(p)}if(i){const p=h.COLOR_0!==void 0?t.getDependency("accessor",h.COLOR_0):o.attributes.color;A.push(p)}}return Promise.all([Promise.all(a),Promise.all(r),Promise.all(A)]).then(function(c){const l=c[0],h=c[1],p=c[2];return n&&(o.morphAttributes.position=l),s&&(o.morphAttributes.normal=h),i&&(o.morphAttributes.color=p),o.morphTargetsRelative=!0,o})}function CA(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 BA(o){let e;const t=o.extensions&&o.extensions[ie.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+qn(t.attributes):e=o.indices+":"+qn(o.attributes)+":"+o.mode,o.targets!==void 0)for(let n=0,s=o.targets.length;n<s;n++)e+=":"+qn(o.targets[n]);return e}function qn(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 zn(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 yA=new ce;class QA{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Yr,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,s=-1,i=!1,a=-1;if(typeof navigator<"u"){const r=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(r)===!0;const A=r.match(/Version\/(\d+)/);s=n&&A?parseInt(A[1],10):-1,i=r.indexOf("Firefox")>-1,a=i?r.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&s<17||i&&a<98?this.textureLoader=new Bn(this.options.manager):this.textureLoader=new hr(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new gt(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,s=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const r={scene:a[0][s.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:s.asset,parser:n,userData:{}};return $t(i,r,s),_t(r,s),Promise.all(n._invokeAll(function(A){return A.afterRoot&&A.afterRoot(r)})).then(function(){for(const A of r.scenes)A.updateMatrixWorld();e(r)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,i=t.length;s<i;s++){const a=t[s].joints;for(let r=0,A=a.length;r<A;r++)e[a[r]].isBone=!0}for(let s=0,i=e.length;s<i;s++){const a=e[s];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const s=n.clone(),i=(a,r)=>{const A=this.associations.get(a);A!=null&&this.associations.set(r,A);for(const[c,l]of a.children.entries())i(l,r.children[c])};return i(n,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const s=e(t[n]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let s=0;s<t.length;s++){const i=e(t[s]);i&&n.push(i)}return n}getDependency(e,t){const n=e+":"+t;let s=this.cache.get(n);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(i){return i.loadNode&&i.loadNode(t)});break;case"mesh":s=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e);break}this.cache.add(n,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,s=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(s.map(function(i,a){return n.getDependency(e,a)})),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[ie.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(i,a){n.load(Wt.resolveURL(t.uri,s.path),i,void 0,function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const s=t.byteLength||0,i=t.byteOffset||0;return n.slice(i,i+s)})}loadAccessor(e){const t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){const a=On[s.type],r=hs[s.componentType],A=s.normalized===!0,c=new r(s.count*a);return Promise.resolve(new it(c,a,A))}const i=[];return s.bufferView!==void 0?i.push(this.getDependency("bufferView",s.bufferView)):i.push(null),s.sparse!==void 0&&(i.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(i).then(function(a){const r=a[0],A=On[s.type],c=hs[s.componentType],l=c.BYTES_PER_ELEMENT,h=l*A,p=s.byteOffset||0,g=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,u=s.normalized===!0;let b,f;if(g&&g!==h){const E=Math.floor(p/g),C="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+E+":"+s.count;let I=t.cache.get(C);I||(b=new c(r,E*g,s.count*g/l),I=new dr(b,g/l),t.cache.add(C,I)),f=new Zt(I,A,p%g/l,u)}else r===null?b=new c(s.count*A):b=new c(r,p,s.count*A),f=new it(b,A,u);if(s.sparse!==void 0){const E=On.SCALAR,C=hs[s.sparse.indices.componentType],I=s.sparse.indices.byteOffset||0,y=s.sparse.values.byteOffset||0,w=new C(a[1],I,s.sparse.count*E),x=new c(a[2],y,s.sparse.count*A);r!==null&&(f=new it(f.array.slice(),f.itemSize,f.normalized)),f.normalized=!1;for(let T=0,S=w.length;T<S;T++){const M=w[T];if(f.setX(M,x[T*A]),A>=2&&f.setY(M,x[T*A+1]),A>=3&&f.setZ(M,x[T*A+2]),A>=4&&f.setW(M,x[T*A+3]),A>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}f.normalized=u}return f})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,i=t.images[s];let a=this.textureLoader;if(i.uri){const r=n.manager.getHandler(i.uri);r!==null&&(a=r)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,n){const s=this,i=this.json,a=i.textures[e],r=i.images[t],A=(r.uri||r.bufferView)+":"+a.sampler;if(this.textureCache[A])return this.textureCache[A];const c=this.loadImageSource(t,n).then(function(l){l.flipY=!1,l.name=a.name||r.name||"",l.name===""&&typeof r.uri=="string"&&r.uri.startsWith("data:image/")===!1&&(l.name=r.uri);const h=(i.samplers||{})[a.sampler]||{};return l.magFilter=oa[h.magFilter]||at,l.minFilter=oa[h.minFilter]||bs,l.wrapS=ra[h.wrapS]||Vt,l.wrapT=ra[h.wrapT]||Vt,l.anisotropy=4,s.associations.set(l,{textures:e}),l}).catch(function(){return null});return this.textureCache[A]=c,c}loadImageSource(e,t){const n=this,s=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const a=s.images[e],r=self.URL||self.webkitURL;let A=a.uri||"",c=!1;if(a.bufferView!==void 0)A=n.getDependency("bufferView",a.bufferView).then(function(h){c=!0;const p=new Blob([h],{type:a.mimeType});return A=r.createObjectURL(p),A});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(A).then(function(h){return new Promise(function(p,g){let u=p;t.isImageBitmapLoader===!0&&(u=function(b){const f=new Rn(b);f.needsUpdate=!0,p(f)}),t.load(Wt.resolveURL(h,i.path),u,void 0,g)})}).then(function(h){return c===!0&&r.revokeObjectURL(A),_t(h,a),h.userData.mimeType=a.mimeType||wA(a.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",A),h});return this.sourceCache[e]=l,l}assignTexture(e,t,n,s){const i=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[ie.KHR_TEXTURE_TRANSFORM]){const r=n.extensions!==void 0?n.extensions[ie.KHR_TEXTURE_TRANSFORM]:void 0;if(r){const A=i.associations.get(a);a=i.extensions[ie.KHR_TEXTURE_TRANSFORM].extendTexture(a,r),i.associations.set(a,A)}}return s!==void 0&&(a.colorSpace=s),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const s=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const r="PointsMaterial:"+n.uuid;let A=this.cache.get(r);A||(A=new Is,Jt.prototype.copy.call(A,n),A.color.copy(n.color),A.map=n.map,A.sizeAttenuation=!1,this.cache.add(r,A)),n=A}else if(e.isLine){const r="LineBasicMaterial:"+n.uuid;let A=this.cache.get(r);A||(A=new kt,Jt.prototype.copy.call(A,n),A.color.copy(n.color),A.map=n.map,this.cache.add(r,A)),n=A}if(s||i||a){let r="ClonedMaterial:"+n.uuid+":";s&&(r+="derivative-tangents:"),i&&(r+="vertex-colors:"),a&&(r+="flat-shading:");let A=this.cache.get(r);A||(A=n.clone(),i&&(A.vertexColors=!0),a&&(A.flatShading=!0),s&&(A.normalScale&&(A.normalScale.y*=-1),A.clearcoatNormalScale&&(A.clearcoatNormalScale.y*=-1)),this.cache.add(r,A),this.associations.set(A,this.associations.get(n))),n=A}e.material=n}getMaterialType(){return yn}loadMaterial(e){const t=this,n=this.json,s=this.extensions,i=n.materials[e];let a;const r={},A=i.extensions||{},c=[];if(A[ie.KHR_MATERIALS_UNLIT]){const h=s[ie.KHR_MATERIALS_UNLIT];a=h.getMaterialType(),c.push(h.extendParams(r,i,t))}else{const h=i.pbrMetallicRoughness||{};if(r.color=new we(1,1,1),r.opacity=1,Array.isArray(h.baseColorFactor)){const p=h.baseColorFactor;r.color.setRGB(p[0],p[1],p[2],Ve),r.opacity=p[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(r,"map",h.baseColorTexture,le)),r.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,r.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(r,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(r,"roughnessMap",h.metallicRoughnessTexture))),a=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,r)})))}i.doubleSided===!0&&(r.side=Qn);const l=i.alphaMode||jn.OPAQUE;if(l===jn.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,l===jn.MASK&&(r.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&a!==Ct&&(c.push(t.assignTexture(r,"normalMap",i.normalTexture)),r.normalScale=new Le(1,1),i.normalTexture.scale!==void 0)){const h=i.normalTexture.scale;r.normalScale.set(h,h)}if(i.occlusionTexture!==void 0&&a!==Ct&&(c.push(t.assignTexture(r,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(r.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==Ct){const h=i.emissiveFactor;r.emissive=new we().setRGB(h[0],h[1],h[2],Ve)}return i.emissiveTexture!==void 0&&a!==Ct&&c.push(t.assignTexture(r,"emissiveMap",i.emissiveTexture,le)),Promise.all(c).then(function(){const h=new a(r);return i.name&&(h.name=i.name),_t(h,i),t.associations.set(h,{materials:e}),i.extensions&&$t(s,h,i),h})}createUniqueName(e){const t=ut.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,s=this.primitiveCache;function i(r){return n[ie.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(r,t).then(function(A){return Aa(A,r,t)})}const a=[];for(let r=0,A=e.length;r<A;r++){const c=e[r],l=BA(c),h=s[l];if(h)a.push(h.promise);else{let p;c.extensions&&c.extensions[ie.KHR_DRACO_MESH_COMPRESSION]?p=i(c):p=Aa(new ct,c,t),s[l]={primitive:c,promise:p},a.push(p)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,s=this.extensions,i=n.meshes[e],a=i.primitives,r=[];for(let A=0,c=a.length;A<c;A++){const l=a[A].material===void 0?IA(this.cache):this.getDependency("material",a[A].material);r.push(l)}return r.push(t.loadGeometries(a)),Promise.all(r).then(function(A){const c=A.slice(0,A.length-1),l=A[A.length-1],h=[];for(let g=0,u=l.length;g<u;g++){const b=l[g],f=a[g];let E;const C=c[g];if(f.mode===lt.TRIANGLES||f.mode===lt.TRIANGLE_STRIP||f.mode===lt.TRIANGLE_FAN||f.mode===void 0)E=i.isSkinnedMesh===!0?new vn(b,C):new O(b,C),E.isSkinnedMesh===!0&&E.normalizeSkinWeights(),f.mode===lt.TRIANGLE_STRIP?E.geometry=sa(E.geometry,ki):f.mode===lt.TRIANGLE_FAN&&(E.geometry=sa(E.geometry,En));else if(f.mode===lt.LINES)E=new Js(b,C);else if(f.mode===lt.LINE_STRIP)E=new ft(b,C);else if(f.mode===lt.LINE_LOOP)E=new pr(b,C);else if(f.mode===lt.POINTS)E=new Ws(b,C);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);Object.keys(E.geometry.morphAttributes).length>0&&CA(E,i),E.name=t.createUniqueName(i.name||"mesh_"+e),_t(E,i),f.extensions&&$t(s,E,f),t.assignFinalMaterial(E),h.push(E)}for(let g=0,u=h.length;g<u;g++)t.associations.set(h[g],{meshes:e,primitives:g});if(h.length===1)return i.extensions&&$t(s,h[0],i),h[0];const p=new Xt;i.extensions&&$t(s,p,i),t.associations.set(p,{meshes:e});for(let g=0,u=h.length;g<u;g++)p.add(h[g]);return p})}loadCamera(e){let t;const n=this.json.cameras[e],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new qs(Ce.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new Ui(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),_t(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let s=0,i=t.joints.length;s<i;s++)n.push(this._loadNodeShallow(t.joints[s]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){const i=s.pop(),a=s,r=[],A=[];for(let c=0,l=a.length;c<l;c++){const h=a[c];if(h){r.push(h);const p=new ce;i!==null&&p.fromArray(i.array,c*16),A.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new Gi(r,A)})}loadAnimation(e){const t=this.json,n=this,s=t.animations[e],i=s.name?s.name:"animation_"+e,a=[],r=[],A=[],c=[],l=[];let h=0,p=s.channels.length;for(h=0,p=s.channels.length;h<p;h++){const g=s.channels[h],u=s.samplers[g.sampler],b=g.target,f=b.node,E=s.parameters!==void 0?s.parameters[u.input]:u.input,C=s.parameters!==void 0?s.parameters[u.output]:u.output;b.node!==void 0&&(a.push(this.getDependency("node",f)),r.push(this.getDependency("accessor",E)),A.push(this.getDependency("accessor",C)),c.push(u),l.push(b))}return Promise.all([Promise.all(a),Promise.all(r),Promise.all(A),Promise.all(c),Promise.all(l)]).then(function(g){const u=g[0],b=g[1],f=g[2],E=g[3],C=g[4],I=[];for(h=0,p=u.length;h<p;h++){const y=u[h],w=b[h],x=f[h],T=E[h],S=C[h];if(y===void 0)continue;y.updateMatrix&&y.updateMatrix();const M=n._createAnimationTracks(y,w,x,T,S);if(M)for(let j=0;j<M.length;j++)I.push(M[j])}return new xn(i,void 0,I)})}createNodeMesh(e){const t=this.json,n=this,s=t.nodes[e];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(i){const a=n._getNodeRef(n.meshCache,s.mesh,i);return s.weights!==void 0&&a.traverse(function(r){if(r.isMesh)for(let A=0,c=s.weights.length;A<c;A++)r.morphTargetInfluences[A]=s.weights[A]}),a})}loadNode(e){const t=this.json,n=this,s=t.nodes[e],i=n._loadNodeShallow(e),a=[],r=s.children||[];for(let c=0,l=r.length;c<l;c++)a.push(n.getDependency("node",r[c]));const A=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([i,Promise.all(a),A]).then(function(c){const l=c[0],h=c[1],p=c[2];p!==null&&l.traverse(function(g){g.isSkinnedMesh&&g.bind(p,yA)});for(let g=0,u=h.length;g<u;g++)l.add(h[g]);return l})}_loadNodeShallow(e){const t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const i=t.nodes[e],a=i.name?s.createUniqueName(i.name):"",r=[],A=s._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return A&&r.push(A),i.camera!==void 0&&r.push(s.getDependency("camera",i.camera).then(function(c){return s._getNodeRef(s.cameraCache,i.camera,c)})),s._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){r.push(c)}),this.nodeCache[e]=Promise.all(r).then(function(c){let l;if(i.isBone===!0?l=new Sn:c.length>1?l=new Xt:c.length===1?l=c[0]:l=new yt,l!==c[0])for(let h=0,p=c.length;h<p;h++)l.add(c[h]);if(i.name&&(l.userData.name=i.name,l.name=a),_t(l,i),i.extensions&&$t(n,l,i),i.matrix!==void 0){const h=new ce;h.fromArray(i.matrix),l.applyMatrix4(h)}else i.translation!==void 0&&l.position.fromArray(i.translation),i.rotation!==void 0&&l.quaternion.fromArray(i.rotation),i.scale!==void 0&&l.scale.fromArray(i.scale);return s.associations.has(l)||s.associations.set(l,{}),s.associations.get(l).nodes=e,l}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],s=this,i=new Xt;n.name&&(i.name=s.createUniqueName(n.name)),_t(i,n),n.extensions&&$t(t,i,n);const a=n.nodes||[],r=[];for(let A=0,c=a.length;A<c;A++)r.push(s.getDependency("node",a[A]));return Promise.all(r).then(function(A){for(let l=0,h=A.length;l<h;l++)i.add(A[l]);const c=l=>{const h=new Map;for(const[p,g]of s.associations)(p instanceof Jt||p instanceof Rn)&&h.set(p,g);return l.traverse(p=>{const g=s.associations.get(p);g!=null&&h.set(p,g)}),h};return s.associations=c(i),i})}_createAnimationTracks(e,t,n,s,i){const a=[],r=e.name?e.name:e.uuid,A=[];jt[i.path]===jt.weights?e.traverse(function(p){p.morphTargetInfluences&&A.push(p.name?p.name:p.uuid)}):A.push(r);let c;switch(jt[i.path]){case jt.weights:c=Xs;break;case jt.rotation:c=Zs;break;case jt.position:case jt.scale:c=Vs;break;default:switch(n.itemSize){case 1:c=Xs;break;case 2:case 3:default:c=Vs;break}break}const l=s.interpolation!==void 0?bA[s.interpolation]:Es,h=this._getArrayFromAccessor(n);for(let p=0,g=A.length;p<g;p++){const u=new c(A[p]+"."+jt[i.path],t.array,h,l);s.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(u),a.push(u)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=zn(t.constructor),s=new Float32Array(t.length);for(let i=0,a=t.length;i<a;i++)s[i]=t[i]*n;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(t){const n=this instanceof Zs?mA:aa;return new n(this.times,this.values,this.getValueSize()/3,t)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function vA(o,e,t){const n=e.attributes,s=new $s;if(n.POSITION!==void 0){const r=t.json.accessors[n.POSITION],A=r.min,c=r.max;if(A!==void 0&&c!==void 0){if(s.set(new N(A[0],A[1],A[2]),new N(c[0],c[1],c[2])),r.normalized){const l=zn(hs[r.componentType]);s.min.multiplyScalar(l),s.max.multiplyScalar(l)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=e.targets;if(i!==void 0){const r=new N,A=new N;for(let c=0,l=i.length;c<l;c++){const h=i[c];if(h.POSITION!==void 0){const p=t.json.accessors[h.POSITION],g=p.min,u=p.max;if(g!==void 0&&u!==void 0){if(A.setX(Math.max(Math.abs(g[0]),Math.abs(u[0]))),A.setY(Math.max(Math.abs(g[1]),Math.abs(u[1]))),A.setZ(Math.max(Math.abs(g[2]),Math.abs(u[2]))),p.normalized){const b=zn(hs[p.componentType]);A.multiplyScalar(b)}r.max(A)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(r)}o.boundingBox=s;const a=new Dn;s.getCenter(a.center),a.radius=s.min.distanceTo(s.max)/2,o.boundingSphere=a}function Aa(o,e,t){const n=e.attributes,s=[];function i(a,r){return t.getDependency("accessor",a).then(function(A){o.setAttribute(r,A)})}for(const a in n){const r=Hn[a]||a.toLowerCase();r in o.attributes||s.push(i(n[a],r))}if(e.indices!==void 0&&!o.index){const a=t.getDependency("accessor",e.indices).then(function(r){o.setIndex(r)});s.push(a)}return Xe.workingColorSpace!==Ve&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Xe.workingColorSpace}" not supported.`),_t(o,e),vA(o,e,t),Promise.all(s).then(function(){return e.targets!==void 0?EA(o,e.targets,t):o})}var xA=function(){var o="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var s=WebAssembly.validate(t)?e:o,i,a=WebAssembly.instantiate(r(s),{}).then(function(E){i=E.instance,i.exports.__wasm_call_ctors()});function r(E){for(var C=new Uint8Array(E.length),I=0;I<E.length;++I){var y=E.charCodeAt(I);C[I]=y>96?y-97:y>64?y-39:y+4}for(var w=0,I=0;I<E.length;++I)C[w++]=C[I]<60?n[C[I]]:(C[I]-60)*64+C[++I];return C.buffer.slice(0,w)}function A(E,C,I,y,w,x){var T=i.exports.sbrk,S=I+3&-4,M=T(S*y),j=T(w.length),K=new Uint8Array(i.exports.memory.buffer);K.set(w,j);var J=E(M,I,y,j,w.length);if(J==0&&x&&x(M,S,y),C.set(K.subarray(M,M+I*y)),T(M-T(0)),J!=0)throw new Error("Malformed buffer data: "+J)}var c={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},h=[],p=0;function g(E){var C={object:new Worker(E),pending:0,requests:{}};return C.object.onmessage=function(I){var y=I.data;C.pending-=y.count,C.requests[y.id][y.action](y.value),delete C.requests[y.id]},C}function u(E){for(var C="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(r(s))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+A.toString()+f.toString(),I=new Blob([C],{type:"text/javascript"}),y=URL.createObjectURL(I),w=0;w<E;++w)h[w]=g(y);URL.revokeObjectURL(y)}function b(E,C,I,y,w){for(var x=h[0],T=1;T<h.length;++T)h[T].pending<x.pending&&(x=h[T]);return new Promise(function(S,M){var j=new Uint8Array(I),K=p++;x.pending+=E,x.requests[K]={resolve:S,reject:M},x.object.postMessage({id:K,count:E,size:C,source:j,mode:y,filter:w},[j.buffer])})}function f(E){a.then(function(){var C=E.data;try{var I=new Uint8Array(C.count*C.size);A(i.exports[C.mode],I,C.count,C.size,C.source,i.exports[C.filter]),self.postMessage({id:C.id,count:C.count,action:"resolve",value:I},[I.buffer])}catch(y){self.postMessage({id:C.id,count:C.count,action:"reject",value:y})}})}return{ready:a,supported:!0,useWorkers:function(E){u(E)},decodeVertexBuffer:function(E,C,I,y,w){A(i.exports.meshopt_decodeVertexBuffer,E,C,I,y,i.exports[c[w]])},decodeIndexBuffer:function(E,C,I,y){A(i.exports.meshopt_decodeIndexBuffer,E,C,I,y)},decodeIndexSequence:function(E,C,I,y){A(i.exports.meshopt_decodeIndexSequence,E,C,I,y)},decodeGltfBuffer:function(E,C,I,y,w,x){A(i.exports[l[w]],E,C,I,y,i.exports[c[x]])},decodeGltfBufferAsync:function(E,C,I,y,w){return h.length>0?b(E,C,I,l[y],c[w]):a.then(function(){var x=new Uint8Array(E*C);return A(i.exports[l[y]],x,E,C,I,i.exports[c[w]]),x})}}}();const Kn=new WeakMap;class SA extends Dt{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,s){const i=new gt(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,a=>{this.parse(a,t,s)},n,s)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,le,n).catch(n)}decodeDracoFile(e,t,n,s,i=Ve,a=()=>{}){const r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:i};return this.decodeGeometry(e,r).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(Kn.has(e)){const A=Kn.get(e);if(A.key===n)return A.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const i=this.workerNextTaskID++,a=e.byteLength,r=this._getWorker(i,a).then(A=>(s=A,new Promise((c,l)=>{s._callbacks[i]={resolve:c,reject:l},s.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(A=>this._createGeometry(A.geometry));return r.catch(()=>!0).then(()=>{s&&i&&this._releaseTask(s,i)}),Kn.set(e,{key:n,promise:r}),r}_createGeometry(e){const t=new ct;e.index&&t.setIndex(new it(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n],i=s.name,a=s.array,r=s.itemSize,A=new it(a,r);i==="color"&&(this._assignVertexColorSpace(A,s.vertexColorSpace),A.normalized=!(a instanceof Float32Array)),t.setAttribute(i,A)}return t}_assignVertexColorSpace(e,t){if(t!==le)return;const n=new we;for(let s=0,i=e.count;s<i;s++)n.fromBufferAttribute(e,s),Xe.toWorkingColorSpace(n,le),e.setXYZ(s,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new gt(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((s,i)=>{n.load(e,s,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const s=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const i=TA.toString(),a=["/* draco decoder */",s,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join(`
|
|
34
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(i){const a=i.data;switch(a.type){case"decode":s._callbacks[a.id].resolve(a);break;case"error":s._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,i){return s._taskLoad>i._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function TA(){let o,e;onmessage=function(a){const r=a.data;switch(r.type){case"init":o=r.decoderConfig,e=new Promise(function(l){o.onModuleLoaded=function(h){l({draco:h})},DracoDecoderModule(o)});break;case"decode":const A=r.buffer,c=r.taskConfig;e.then(l=>{const h=l.draco,p=new h.Decoder;try{const g=t(h,p,new Int8Array(A),c),u=g.attributes.map(b=>b.array.buffer);g.index&&u.push(g.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:g},u)}catch(g){console.error(g),self.postMessage({type:"error",id:r.id,error:g.message})}finally{h.destroy(p)}});break}};function t(a,r,A,c){const l=c.attributeIDs,h=c.attributeTypes;let p,g;const u=r.GetEncodedGeometryType(A);if(u===a.TRIANGULAR_MESH)p=new a.Mesh,g=r.DecodeArrayToMesh(A,A.byteLength,p);else if(u===a.POINT_CLOUD)p=new a.PointCloud,g=r.DecodeArrayToPointCloud(A,A.byteLength,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());const b={index:null,attributes:[]};for(const f in l){const E=self[h[f]];let C,I;if(c.useUniqueIDs)I=l[f],C=r.GetAttributeByUniqueId(p,I);else{if(I=r.GetAttributeId(p,a[l[f]]),I===-1)continue;C=r.GetAttribute(p,I)}const y=s(a,r,p,f,E,C);f==="color"&&(y.vertexColorSpace=c.vertexColorSpace),b.attributes.push(y)}return u===a.TRIANGULAR_MESH&&(b.index=n(a,r,p)),a.destroy(p),b}function n(a,r,A){const c=A.num_faces()*3,l=c*4,h=a._malloc(l);r.GetTrianglesUInt32Array(A,l,h);const p=new Uint32Array(a.HEAPF32.buffer,h,c).slice();return a._free(h),{array:p,itemSize:1}}function s(a,r,A,c,l,h){const p=h.num_components(),g=A.num_points()*p,u=g*l.BYTES_PER_ELEMENT,b=i(a,l),f=a._malloc(u);r.GetAttributeDataArrayForAllPoints(A,h,b,u,f);const E=new l(a.HEAPF32.buffer,f,g).slice();return a._free(f),{name:c,array:E,itemSize:p}}function i(a,r){switch(r){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}class RA{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:s,msg:i,transfer:a}=this.queue.shift();this.workersResolve[e]=s,this.workers[e].postMessage(i,a)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(n=>{const s=this._getIdleWorker();s!==-1?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=n,this.workers[s].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const DA=0,ca=2,kA=1,la=2,MA=0,_A=1,FA=10,LA=0,ha=9,da=15,pa=16,ga=22,ua=37,fa=43,ma=76,ba=83,Ia=97,Ea=100,Ca=103,Ba=109,wa=122,ya=123,NA=131,UA=132,GA=133,PA=134,OA=137,HA=138,jA=141,qA=142,zA=145,KA=146,Qa=148,va=152,YA=157,JA=158,xa=165,Sa=166,Yn=1000066e3;class Ss{constructor(e,t,n,s){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){const n=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,s)}}const Je=[171,75,84,88,32,50,48,187,13,10,26,10];function Ta(o){return new TextDecoder().decode(o)}function WA(o){const e=new Uint8Array(o.buffer,o.byteOffset,Je.length);if(e[0]!==Je[0]||e[1]!==Je[1]||e[2]!==Je[2]||e[3]!==Je[3]||e[4]!==Je[4]||e[5]!==Je[5]||e[6]!==Je[6]||e[7]!==Je[7]||e[8]!==Je[8]||e[9]!==Je[9]||e[10]!==Je[10]||e[11]!==Je[11])throw new Error("Missing KTX 2.0 identifier.");const t={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},n=17*Uint32Array.BYTES_PER_ELEMENT,s=new Ss(o,Je.length,n,!0);t.vkFormat=s._nextUint32(),t.typeSize=s._nextUint32(),t.pixelWidth=s._nextUint32(),t.pixelHeight=s._nextUint32(),t.pixelDepth=s._nextUint32(),t.layerCount=s._nextUint32(),t.faceCount=s._nextUint32(),t.levelCount=s._nextUint32(),t.supercompressionScheme=s._nextUint32();const i=s._nextUint32(),a=s._nextUint32(),r=s._nextUint32(),A=s._nextUint32(),c=s._nextUint64(),l=s._nextUint64(),h=3*Math.max(t.levelCount,1)*8,p=new Ss(o,Je.length+n,h,!0);for(let se=0,oe=Math.max(t.levelCount,1);se<oe;se++)t.levels.push({levelData:new Uint8Array(o.buffer,o.byteOffset+p._nextUint64(),p._nextUint64()),uncompressedByteLength:p._nextUint64()});const g=new Ss(o,i,a,!0);g._skip(4);const u=g._nextUint16(),b=g._nextUint16(),f=g._nextUint16(),E=g._nextUint16(),C={vendorId:u,descriptorType:b,versionNumber:f,colorModel:g._nextUint8(),colorPrimaries:g._nextUint8(),transferFunction:g._nextUint8(),flags:g._nextUint8(),texelBlockDimension:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],bytesPlane:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],samples:[]},I=(E/4-6)/4;for(let se=0;se<I;se++){const oe={bitOffset:g._nextUint16(),bitLength:g._nextUint8(),channelType:g._nextUint8(),samplePosition:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};64&oe.channelType?(oe.sampleLower=g._nextInt32(),oe.sampleUpper=g._nextInt32()):(oe.sampleLower=g._nextUint32(),oe.sampleUpper=g._nextUint32()),C.samples[se]=oe}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(C);const y=new Ss(o,r,A,!0);for(;y._offset<A;){const se=y._nextUint32(),oe=y._scan(se),Ae=Ta(oe);if(t.keyValue[Ae]=y._nextUint8Array(se-oe.byteLength-1),Ae.match(/^ktx/i)){const Te=Ta(t.keyValue[Ae]);t.keyValue[Ae]=Te.substring(0,Te.lastIndexOf("\0"))}y._skip(se%4?4-se%4:0)}if(l<=0)return t;const w=new Ss(o,c,l,!0),x=w._nextUint16(),T=w._nextUint16(),S=w._nextUint32(),M=w._nextUint32(),j=w._nextUint32(),K=w._nextUint32(),J=[];for(let se=0,oe=Math.max(t.levelCount,1);se<oe;se++)J.push({imageFlags:w._nextUint32(),rgbSliceByteOffset:w._nextUint32(),rgbSliceByteLength:w._nextUint32(),alphaSliceByteOffset:w._nextUint32(),alphaSliceByteLength:w._nextUint32()});const V=c+w._offset,q=V+S,X=q+M,W=X+j,ee=new Uint8Array(o.buffer,o.byteOffset+V,S),$=new Uint8Array(o.buffer,o.byteOffset+q,M),ue=new Uint8Array(o.buffer,o.byteOffset+X,j),Re=new Uint8Array(o.buffer,o.byteOffset+W,K);return t.globalData={endpointCount:x,selectorCount:T,imageDescs:J,endpointsData:ee,selectorsData:$,tablesData:ue,extendedData:Re},t}let Jn,Ft,Wn;const Vn={env:{emscripten_notify_memory_growth:function(o){Wn=new Uint8Array(Ft.exports.memory.buffer)}}};class VA{init(){return Jn||(Jn=typeof fetch<"u"?fetch("data:application/wasm;base64,"+Ra).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Vn)).then(this._init):WebAssembly.instantiate(Buffer.from(Ra,"base64"),Vn).then(this._init),Jn)}_init(e){Ft=e.instance,Vn.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Ft)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,s=Ft.exports.malloc(n);Wn.set(e,s),t=t||Number(Ft.exports.ZSTD_findDecompressedSize(s,n));const i=Ft.exports.malloc(t),a=Ft.exports.ZSTD_decompress(i,t,s,n),r=Wn.slice(i,i+a);return Ft.exports.free(s),Ft.exports.free(i),r}}const Ra="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWN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QCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACA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KQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAe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QFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCm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EEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyA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AAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",XA="display-p3",ZA="display-p3-linear",Xn=new WeakMap;let Zn=0,$n;class pt extends Dt{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new RA,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new gt(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new gt(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const s=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,s]).then(([i,a])=>{const r=pt.BasisWorker.toString(),A=["/* constants */","let _EngineFormat = "+JSON.stringify(pt.EngineFormat),"let _EngineType = "+JSON.stringify(pt.EngineType),"let _TranscoderFormat = "+JSON.stringify(pt.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(pt.BasisFormat),"/* basis_transcoder.js */",i,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
|
|
35
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([A])),this.transcoderBinary=a,this.workerPool.setWorkerCreator(()=>{const c=new Worker(this.workerSourceURL),l=this.transcoderBinary.slice(0);return c.postMessage({type:"init",config:this.workerConfig,transcoderBinary:l},[l]),c})}),Zn>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Zn++}return this.transcoderPending}load(e,t,n,s){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const i=new gt(this.manager);i.setPath(this.path),i.setCrossOrigin(this.crossOrigin),i.setWithCredentials(this.withCredentials),i.setResponseType("arraybuffer"),i.load(e,a=>{this.parse(a,t,s)},n,s)}parse(e,t,n){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(Xn.has(e))return Xn.get(e).promise.then(t).catch(n);this._createTexture(e).then(s=>t?t(s):null).catch(n)}_createTextureFrom(e,t){const{type:n,error:s,data:{faces:i,width:a,height:r,format:A,type:c,dfdFlags:l}}=e;if(n==="error")return Promise.reject(s);let h;if(t.faceCount===6)h=new Ir(i,A,c);else{const p=i[0].mipmaps;h=t.layerCount>1?new Er(p,a,r,t.layerCount,A,c):new Cs(p,a,r,A,c)}return h.minFilter=i[0].mipmaps.length===1?at:bs,h.magFilter=at,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace=Da(t),h.premultiplyAlpha=!!(l&kA),h}async _createTexture(e,t={}){const n=WA(new Uint8Array(e)),s=n.vkFormat===Yn&&n.dataFormatDescriptor[0].colorModel===167;if(!(n.vkFormat===LA||s&&!this.workerConfig.astcHDRSupported))return ec(n);const i=t,a=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:i},[e])).then(r=>this._createTextureFrom(r.data,n));return Xn.set(e,{promise:a}),a}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Zn--}}pt.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},pt.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},pt.EngineFormat={RGBAFormat:Pt,RGBA_ASTC_4x4_Format:en,RGB_BPTC_UNSIGNED_Format:br,RGBA_BPTC_Format:_n,RGBA_ETC2_EAC_Format:Hi,RGBA_PVRTC_4BPPV1_Format:mr,RGBA_S3TC_DXT5_Format:Mn,RGB_ETC1_Format:fr,RGB_ETC2_Format:Oi,RGB_PVRTC_4BPPV1_Format:ur,RGBA_S3TC_DXT1_Format:kn},pt.EngineType={UnsignedByteType:bt,HalfFloatType:Ze,FloatType:mt},pt.BasisWorker=function(){let o,e,t;const n=_EngineFormat,s=_EngineType,i=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(u){const b=u.data;switch(b.type){case"init":o=b.config,r(b.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:f,buffers:E,width:C,height:I,hasAlpha:y,format:w,type:x,dfdFlags:T}=A(b.buffer);self.postMessage({type:"transcode",id:b.id,data:{faces:f,width:C,height:I,hasAlpha:y,format:w,type:x,dfdFlags:T}},E)}catch(f){console.error(f),self.postMessage({type:"error",id:b.id,error:f.message})}});break}});function r(u){e=new Promise(b=>{t={wasmBinary:u,onRuntimeInitialized:b},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function A(u){const b=new t.KTX2File(new Uint8Array(u));function f(){b.close(),b.delete()}if(!b.isValid())throw f(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let E;if(b.isUASTC())E=a.UASTC;else if(b.isETC1S())E=a.ETC1S;else if(b.isHDR())E=a.UASTC_HDR;else throw new Error("THREE.KTX2Loader: Unknown Basis encoding");const C=b.getWidth(),I=b.getHeight(),y=b.getLayers()||1,w=b.getLevels(),x=b.getFaces(),T=b.getHasAlpha(),S=b.getDFDFlags(),{transcoderFormat:M,engineFormat:j,engineType:K}=h(E,C,I,T);if(!C||!I||!w)throw f(),new Error("THREE.KTX2Loader: Invalid texture");if(!b.startTranscoding())throw f(),new Error("THREE.KTX2Loader: .startTranscoding failed");const J=[],V=[];for(let q=0;q<x;q++){const X=[];for(let W=0;W<w;W++){const ee=[];let $,ue;for(let se=0;se<y;se++){const oe=b.getImageLevelInfo(W,se,q);q===0&&W===0&&se===0&&(oe.origWidth%4!==0||oe.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),w>1?($=oe.origWidth,ue=oe.origHeight):($=oe.width,ue=oe.height);let Ae=new Uint8Array(b.getImageTranscodedSizeInBytes(W,se,0,M));const Te=b.transcodeImage(Ae,W,se,q,M,0,-1,-1);if(K===s.HalfFloatType&&(Ae=new Uint16Array(Ae.buffer,Ae.byteOffset,Ae.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!Te)throw f(),new Error("THREE.KTX2Loader: .transcodeImage failed.");ee.push(Ae)}const Re=g(ee);X.push({data:Re,width:$,height:ue}),V.push(Re.buffer)}J.push({mipmaps:X,width:C,height:I,format:j,type:K})}return f(),{faces:J,buffers:V,width:C,height:I,hasAlpha:T,dfdFlags:S,format:j,type:K}}const c=[{if:"astcSupported",basisFormat:[a.UASTC],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],engineType:[s.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],engineType:[s.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[i.BC1,i.BC3],engineFormat:[n.RGBA_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],engineType:[s.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],engineType:[s.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[i.ETC1],engineFormat:[n.RGB_ETC1_Format],engineType:[s.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],engineType:[s.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[a.UASTC_HDR],transcoderFormat:[i.BC6H],engineFormat:[n.RGB_BPTC_UNSIGNED_Format],engineType:[s.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[i.RGBA32,i.RGBA32],engineFormat:[n.RGBAFormat,n.RGBAFormat],engineType:[s.UnsignedByteType,s.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[a.UASTC_HDR],transcoderFormat:[i.RGBA_HALF],engineFormat:[n.RGBAFormat],engineType:[s.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[a.ETC1S]:c.filter(u=>u.basisFormat.includes(a.ETC1S)).sort((u,b)=>u.priorityUASTC-b.priorityUASTC),[a.UASTC]:c.filter(u=>u.basisFormat.includes(a.UASTC)).sort((u,b)=>u.priorityUASTC-b.priorityUASTC),[a.UASTC_HDR]:c.filter(u=>u.basisFormat.includes(a.UASTC_HDR)).sort((u,b)=>u.priorityHDR-b.priorityHDR)};function h(u,b,f,E){const C=l[u];for(let I=0;I<C.length;I++){const y=C[I];if(y.if&&!o[y.if]||!y.basisFormat.includes(u)||E&&y.transcoderFormat.length<2||y.needsPowerOfTwo&&!(p(b)&&p(f)))continue;const w=y.transcoderFormat[E?1:0],x=y.engineFormat[E?1:0],T=y.engineType[0];return{transcoderFormat:w,engineFormat:x,engineType:T}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}function p(u){return u<=2?!0:(u&u-1)===0&&u!==0}function g(u){if(u.length===1)return u[0];let b=0;for(let C=0;C<u.length;C++){const I=u[C];b+=I.byteLength}const f=new Uint8Array(b);let E=0;for(let C=0;C<u.length;C++){const I=u[C];f.set(I,E),E+=I.byteLength}return f}};const $A=new Set([Pt,Fn,Bs,rs]),ei={[Ba]:Pt,[Ia]:Pt,[ua]:Pt,[fa]:Pt,[Ca]:Bs,[ba]:Bs,[pa]:Bs,[ga]:Bs,[Ea]:rs,[ma]:rs,[da]:rs,[ha]:rs,[ya]:Fn,[wa]:Fn,[Qa]:Oi,[va]:Hi,[Yn]:en,[JA]:en,[YA]:en,[Sa]:zi,[xa]:zi,[GA]:kn,[PA]:kn,[NA]:qi,[UA]:qi,[HA]:ji,[OA]:ji,[qA]:Mn,[jA]:Mn,[KA]:_n,[zA]:_n},Ts={[Ba]:mt,[Ia]:Ze,[ua]:bt,[fa]:bt,[Ca]:mt,[ba]:Ze,[pa]:bt,[ga]:bt,[Ea]:mt,[ma]:Ze,[da]:bt,[ha]:bt,[ya]:Yi,[wa]:Ki,[Qa]:bt,[va]:bt,[Yn]:Ze,[Sa]:bt,[xa]:bt};async function ec(o){const{vkFormat:e}=o;if(ei[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let t;o.supercompressionScheme===ca&&($n||($n=new Promise(async a=>{const r=new VA;await r.init(),a(r)})),t=await $n);const n=[];for(let a=0;a<o.levels.length;a++){const r=Math.max(1,o.pixelWidth>>a),A=Math.max(1,o.pixelHeight>>a),c=o.pixelDepth?Math.max(1,o.pixelDepth>>a):0,l=o.levels[a];let h;if(o.supercompressionScheme===DA)h=l.levelData;else if(o.supercompressionScheme===ca)h=t.decode(l.levelData,l.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let p;Ts[e]===mt?p=new Float32Array(h.buffer,h.byteOffset,h.byteLength/Float32Array.BYTES_PER_ELEMENT):Ts[e]===Ze?p=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT):Ts[e]===Yi||Ts[e]===Ki?p=new Uint32Array(h.buffer,h.byteOffset,h.byteLength/Uint32Array.BYTES_PER_ELEMENT):p=h,n.push({data:p,width:r,height:A,depth:c})}const s=o.levelCount===0||n.length>1;let i;if($A.has(ei[e]))i=o.pixelDepth===0?new Cr(n[0].data,o.pixelWidth,o.pixelHeight):new Br(n[0].data,o.pixelWidth,o.pixelHeight,o.pixelDepth),i.minFilter=s?wn:Ks,i.magFilter=Ks,i.generateMipmaps=o.levelCount===0;else{if(o.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");i=new Cs(n,o.pixelWidth,o.pixelHeight),i.minFilter=s?bs:at,i.magFilter=at}return i.mipmaps=n,i.type=Ts[e],i.format=ei[e],i.colorSpace=Da(o),i.needsUpdate=!0,Promise.resolve(i)}function Da(o){const e=o.dataFormatDescriptor[0];return e.colorPrimaries===_A?e.transferFunction===la?le:Ve:e.colorPrimaries===FA?e.transferFunction===la?XA:ZA:e.colorPrimaries===MA?tn:(console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),tn)}class tc extends wr{constructor(e,t={}){const n=t.font;if(n===void 0)super();else{const s=n.generateShapes(e,t.size);t.depth===void 0&&t.height!==void 0&&console.warn("THREE.TextGeometry: .height is now depreciated. Please use .depth instead"),t.depth=t.depth!==void 0?t.depth:t.height!==void 0?t.height:50,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(s,t)}this.type="TextGeometry"}}class sc extends Dt{constructor(e){super(e)}load(e,t,n,s){const i=this,a=new gt(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(r){const A=i.parse(JSON.parse(r));t&&t(A)},n,s)}parse(e){return new ka(e)}}class ka{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const n=[],s=nc(e,t,this.data);for(let i=0,a=s.length;i<a;i++)n.push(...s[i].toShapes());return n}}function nc(o,e,t){const n=Array.from(o),s=e/t.resolution,i=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[];let r=0,A=0;for(let c=0;c<n.length;c++){const l=n[c];if(l===`
|
|
36
|
-
`)r=0,A-=i;else{const h=ic(l,s,r,A,t);r+=h.offsetX,a.push(h.path)}}return a}function ic(o,e,t,n,s){const i=s.glyphs[o]||s.glyphs["?"];if(!i){console.error('THREE.Font: character "'+o+'" does not exists in font family '+s.familyName+".");return}const a=new yr;let r,A,c,l,h,p,g,u;if(i.o){const b=i._cachedOutline||(i._cachedOutline=i.o.split(" "));for(let f=0,E=b.length;f<E;)switch(b[f++]){case"m":r=b[f++]*e+t,A=b[f++]*e+n,a.moveTo(r,A);break;case"l":r=b[f++]*e+t,A=b[f++]*e+n,a.lineTo(r,A);break;case"q":c=b[f++]*e+t,l=b[f++]*e+n,h=b[f++]*e+t,p=b[f++]*e+n,a.quadraticCurveTo(h,p,c,l);break;case"b":c=b[f++]*e+t,l=b[f++]*e+n,h=b[f++]*e+t,p=b[f++]*e+n,g=b[f++]*e+t,u=b[f++]*e+n,a.bezierCurveTo(h,p,g,u,c,l);break}}return{offsetX:i.ha*e,path:a}}const es=new Ln,qe=new N,qt=new N,Be=new ye,Ma={X:new N(1,0,0),Y:new N(0,1,0),Z:new N(0,0,1)},ti={type:"change"},_a={type:"mouseDown",mode:null},Fa={type:"mouseUp",mode:null},La={type:"objectChange"};class ac extends Ji{constructor(e,t=null){super(void 0,t);const n=new hc(this);this._root=n;const s=new Pa;this._gizmo=s,n.add(s);const i=new dc;this._plane=i,n.add(i);const a=this;function r(I,y){let w=y;Object.defineProperty(a,I,{get:function(){return w!==void 0?w:y},set:function(x){w!==x&&(w=x,i[I]=x,s[I]=x,a.dispatchEvent({type:I+"-changed",value:x}),a.dispatchEvent(ti))}}),a[I]=y,i[I]=y,s[I]=y}r("camera",e),r("object",void 0),r("enabled",!0),r("axis",null),r("mode","translate"),r("translationSnap",null),r("rotationSnap",null),r("scaleSnap",null),r("space","world"),r("size",1),r("dragging",!1),r("showX",!0),r("showY",!0),r("showZ",!0);const A=new N,c=new N,l=new ye,h=new ye,p=new N,g=new ye,u=new N,b=new N,f=new N,E=0,C=new N;r("worldPosition",A),r("worldPositionStart",c),r("worldQuaternion",l),r("worldQuaternionStart",h),r("cameraPosition",p),r("cameraQuaternion",g),r("pointStart",u),r("pointEnd",b),r("rotationAxis",f),r("rotationAngle",E),r("eye",C),this._offset=new N,this._startNorm=new N,this._endNorm=new N,this._cameraScale=new N,this._parentPosition=new N,this._parentQuaternion=new ye,this._parentQuaternionInv=new ye,this._parentScale=new N,this._worldScaleStart=new N,this._worldQuaternionInv=new ye,this._worldScale=new N,this._positionStart=new N,this._quaternionStart=new ye,this._scaleStart=new N,this._getPointer=oc.bind(this),this._onPointerDown=Ac.bind(this),this._onPointerHover=rc.bind(this),this._onPointerMove=cc.bind(this),this._onPointerUp=lc.bind(this),t!==null&&this.connect()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="auto"}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&es.setFromCamera(e,this.camera);const t=si(this._gizmo.picker[this.mode],es);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&es.setFromCamera(e,this.camera);const t=si(this._plane,es,!0);t&&(this.object.updateMatrixWorld(),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(t.point).sub(this.worldPositionStart)),this.dragging=!0,_a.mode=this.mode,this.dispatchEvent(_a)}}pointerMove(e){const t=this.axis,n=this.mode,s=this.object;let i=this.space;if(n==="scale"?i="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(i="world"),s===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&es.setFromCamera(e,this.camera);const a=si(this._plane,es,!0);if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),n==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),i==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),i==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(i==="local"&&(s.position.applyQuaternion(Be.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),i==="world"&&(s.parent&&s.position.add(qe.setFromMatrixPosition(s.parent.matrixWorld)),t.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(qe.setFromMatrixPosition(s.parent.matrixWorld))));else if(n==="scale"){if(t.search("XYZ")!==-1){let r=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(r*=-1),qt.set(r,r,r)}else qe.copy(this.pointStart),qt.copy(this.pointEnd),qe.applyQuaternion(this._worldQuaternionInv),qt.applyQuaternion(this._worldQuaternionInv),qt.divide(qe),t.search("X")===-1&&(qt.x=1),t.search("Y")===-1&&(qt.y=1),t.search("Z")===-1&&(qt.z=1);s.scale.copy(this._scaleStart).multiply(qt),this.scaleSnap&&(t.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(n==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const r=20/this.worldPosition.distanceTo(qe.setFromMatrixPosition(this.camera.matrixWorld));let A=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(qe.copy(this.rotationAxis).cross(this.eye))*r):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Ma[t]),qe.copy(Ma[t]),i==="local"&&qe.applyQuaternion(this.worldQuaternion),qe.cross(this.eye),qe.length()===0?A=!0:this.rotationAngle=this._offset.dot(qe.normalize())*r),(t==="E"||A)&&(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),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),i==="local"&&t!=="E"&&t!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(Be.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(Be.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(ti),this.dispatchEvent(La)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(Fa.mode=this.mode,this.dispatchEvent(Fa)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(ti),this.dispatchEvent(La),this.pointStart.copy(this.pointEnd))}getRaycaster(){return es}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function oc(o){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:o.button};{const e=this.domElement.getBoundingClientRect();return{x:(o.clientX-e.left)/e.width*2-1,y:-(o.clientY-e.top)/e.height*2+1,button:o.button}}}function rc(o){if(this.enabled)switch(o.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(o));break}}function Ac(o){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(o.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(o)),this.pointerDown(this._getPointer(o)))}function cc(o){this.enabled&&this.pointerMove(this._getPointer(o))}function lc(o){this.enabled&&(this.domElement.releasePointerCapture(o.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(o)))}function si(o,e,t){const n=e.intersectObject(o,!0);for(let s=0;s<n.length;s++)if(n[s].object.visible||t)return n[s];return!1}const nn=new Ot,pe=new N(0,1,0),Na=new N(0,0,0),Ua=new ce,an=new ye,on=new ye,Qt=new N,Ga=new ce,Rs=new N(1,0,0),ts=new N(0,1,0),Ds=new N(0,0,1),rn=new N,ks=new N,Ms=new N;class hc extends yt{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){const t=this.controls;t.object!==void 0&&(t.object.updateMatrixWorld(),t.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):t.object.parent.matrixWorld.decompose(t._parentPosition,t._parentQuaternion,t._parentScale),t.object.matrixWorld.decompose(t.worldPosition,t.worldQuaternion,t._worldScale),t._parentQuaternionInv.copy(t._parentQuaternion).invert(),t._worldQuaternionInv.copy(t.worldQuaternion).invert()),t.camera.updateMatrixWorld(),t.camera.matrixWorld.decompose(t.cameraPosition,t.cameraQuaternion,t._cameraScale),t.camera.isOrthographicCamera?t.camera.getWorldDirection(t.eye).negate():t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(),super.updateMatrixWorld(e)}}class Pa extends yt{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new Ct({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new kt({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),n=e.clone();n.opacity=.15;const s=t.clone();s.opacity=.5;const i=e.clone();i.color.setHex(16711680);const a=e.clone();a.color.setHex(65280);const r=e.clone();r.color.setHex(255);const A=e.clone();A.color.setHex(16711680),A.opacity=.5;const c=e.clone();c.color.setHex(65280),c.opacity=.5;const l=e.clone();l.color.setHex(255),l.opacity=.5;const h=e.clone();h.opacity=.25;const p=e.clone();p.color.setHex(16776960),p.opacity=.25,e.clone().color.setHex(16776960);const g=e.clone();g.color.setHex(7895160);const u=new $e(0,.04,.1,12);u.translate(0,.05,0);const b=new Ye(.08,.08,.08);b.translate(0,.04,0);const f=new ct;f.setAttribute("position",new ke([0,0,0,1,0,0],3));const E=new $e(.0075,.0075,.5,3);E.translate(0,.25,0);function C(q,X){const W=new ws(q,.0075,3,64,X*Math.PI*2);return W.rotateY(Math.PI/2),W.rotateX(Math.PI/2),W}function I(){const q=new ct;return q.setAttribute("position",new ke([0,0,0,1,1,1],3)),q}const y={X:[[new O(u,i),[.5,0,0],[0,0,-Math.PI/2]],[new O(u,i),[-.5,0,0],[0,0,Math.PI/2]],[new O(E,i),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new O(u,a),[0,.5,0]],[new O(u,a),[0,-.5,0],[Math.PI,0,0]],[new O(E,a)]],Z:[[new O(u,r),[0,0,.5],[Math.PI/2,0,0]],[new O(u,r),[0,0,-.5],[-Math.PI/2,0,0]],[new O(E,r),null,[Math.PI/2,0,0]]],XYZ:[[new O(new sn(.1,0),h.clone()),[0,0,0]]],XY:[[new O(new Ye(.15,.15,.01),l.clone()),[.15,.15,0]]],YZ:[[new O(new Ye(.15,.15,.01),A.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new O(new Ye(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},w={X:[[new O(new $e(.2,0,.6,4),n),[.3,0,0],[0,0,-Math.PI/2]],[new O(new $e(.2,0,.6,4),n),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new O(new $e(.2,0,.6,4),n),[0,.3,0]],[new O(new $e(.2,0,.6,4),n),[0,-.3,0],[0,0,Math.PI]]],Z:[[new O(new $e(.2,0,.6,4),n),[0,0,.3],[Math.PI/2,0,0]],[new O(new $e(.2,0,.6,4),n),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new O(new sn(.2,0),n)]],XY:[[new O(new Ye(.2,.2,.01),n),[.15,.15,0]]],YZ:[[new O(new Ye(.2,.2,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new O(new Ye(.2,.2,.01),n),[.15,0,.15],[-Math.PI/2,0,0]]]},x={START:[[new O(new sn(.01,2),s),null,null,null,"helper"]],END:[[new O(new sn(.01,2),s),null,null,null,"helper"]],DELTA:[[new ft(I(),s),null,null,null,"helper"]],X:[[new ft(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ft(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ft(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},T={XYZE:[[new O(C(.5,1),g),null,[0,Math.PI/2,0]]],X:[[new O(C(.5,.5),i)]],Y:[[new O(C(.5,.5),a),null,[0,0,-Math.PI/2]]],Z:[[new O(C(.5,.5),r),null,[0,Math.PI/2,0]]],E:[[new O(C(.75,1),p),null,[0,Math.PI/2,0]]]},S={AXIS:[[new ft(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},M={XYZE:[[new O(new bn(.25,10,8),n)]],X:[[new O(new ws(.5,.1,4,24),n),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new O(new ws(.5,.1,4,24),n),[0,0,0],[Math.PI/2,0,0]]],Z:[[new O(new ws(.5,.1,4,24),n),[0,0,0],[0,0,-Math.PI/2]]],E:[[new O(new ws(.75,.1,2,24),n)]]},j={X:[[new O(b,i),[.5,0,0],[0,0,-Math.PI/2]],[new O(E,i),[0,0,0],[0,0,-Math.PI/2]],[new O(b,i),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new O(b,a),[0,.5,0]],[new O(E,a)],[new O(b,a),[0,-.5,0],[0,0,Math.PI]]],Z:[[new O(b,r),[0,0,.5],[Math.PI/2,0,0]],[new O(E,r),[0,0,0],[Math.PI/2,0,0]],[new O(b,r),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new O(new Ye(.15,.15,.01),l),[.15,.15,0]]],YZ:[[new O(new Ye(.15,.15,.01),A),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new O(new Ye(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new O(new Ye(.1,.1,.1),h.clone())]]},K={X:[[new O(new $e(.2,0,.6,4),n),[.3,0,0],[0,0,-Math.PI/2]],[new O(new $e(.2,0,.6,4),n),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new O(new $e(.2,0,.6,4),n),[0,.3,0]],[new O(new $e(.2,0,.6,4),n),[0,-.3,0],[0,0,Math.PI]]],Z:[[new O(new $e(.2,0,.6,4),n),[0,0,.3],[Math.PI/2,0,0]],[new O(new $e(.2,0,.6,4),n),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new O(new Ye(.2,.2,.01),n),[.15,.15,0]]],YZ:[[new O(new Ye(.2,.2,.01),n),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new O(new Ye(.2,.2,.01),n),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new O(new Ye(.2,.2,.2),n),[0,0,0]]]},J={X:[[new ft(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ft(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ft(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function V(q){const X=new yt;for(const W in q)for(let ee=q[W].length;ee--;){const $=q[W][ee][0].clone(),ue=q[W][ee][1],Re=q[W][ee][2],se=q[W][ee][3],oe=q[W][ee][4];$.name=W,$.tag=oe,ue&&$.position.set(ue[0],ue[1],ue[2]),Re&&$.rotation.set(Re[0],Re[1],Re[2]),se&&$.scale.set(se[0],se[1],se[2]),$.updateMatrix();const Ae=$.geometry.clone();Ae.applyMatrix4($.matrix),$.geometry=Ae,$.renderOrder=1/0,$.position.set(0,0,0),$.rotation.set(0,0,0),$.scale.set(1,1,1),X.add($)}return X}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=V(y)),this.add(this.gizmo.rotate=V(T)),this.add(this.gizmo.scale=V(j)),this.add(this.picker.translate=V(w)),this.add(this.picker.rotate=V(M)),this.add(this.picker.scale=V(K)),this.add(this.helper.translate=V(x)),this.add(this.helper.rotate=V(S)),this.add(this.helper.scale=V(J)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const t=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:on;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 n=[];n=n.concat(this.picker[this.mode].children),n=n.concat(this.gizmo[this.mode].children),n=n.concat(this.helper[this.mode].children);for(let s=0;s<n.length;s++){const i=n[s];i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),i.scale.set(1,1,1).multiplyScalar(a*this.size/4),i.tag==="helper"){i.visible=!1,i.name==="AXIS"?(i.visible=!!this.axis,this.axis==="X"&&(Be.setFromEuler(nn.set(0,0,0)),i.quaternion.copy(t).multiply(Be),Math.abs(pe.copy(Rs).applyQuaternion(t).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(Be.setFromEuler(nn.set(0,0,Math.PI/2)),i.quaternion.copy(t).multiply(Be),Math.abs(pe.copy(ts).applyQuaternion(t).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(Be.setFromEuler(nn.set(0,Math.PI/2,0)),i.quaternion.copy(t).multiply(Be),Math.abs(pe.copy(Ds).applyQuaternion(t).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(Be.setFromEuler(nn.set(0,Math.PI/2,0)),pe.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(Ua.lookAt(Na,pe,ts)),i.quaternion.multiply(Be),i.visible=this.dragging),this.axis==="E"&&(i.visible=!1)):i.name==="START"?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):i.name==="END"?(i.position.copy(this.worldPosition),i.visible=this.dragging):i.name==="DELTA"?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),qe.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),qe.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(qe),i.visible=this.dragging):(i.quaternion.copy(t),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=this.axis.search(i.name)!==-1));continue}i.quaternion.copy(t),this.mode==="translate"||this.mode==="scale"?(i.name==="X"&&Math.abs(pe.copy(Rs).applyQuaternion(t).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Y"&&Math.abs(pe.copy(ts).applyQuaternion(t).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Z"&&Math.abs(pe.copy(Ds).applyQuaternion(t).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XY"&&Math.abs(pe.copy(Ds).applyQuaternion(t).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="YZ"&&Math.abs(pe.copy(Rs).applyQuaternion(t).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XZ"&&Math.abs(pe.copy(ts).applyQuaternion(t).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(an.copy(t),pe.copy(this.eye).applyQuaternion(Be.copy(t).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(Ua.lookAt(this.eye,Na,ts)),i.name==="X"&&(Be.setFromAxisAngle(Rs,Math.atan2(-pe.y,pe.z)),Be.multiplyQuaternions(an,Be),i.quaternion.copy(Be)),i.name==="Y"&&(Be.setFromAxisAngle(ts,Math.atan2(pe.x,pe.z)),Be.multiplyQuaternions(an,Be),i.quaternion.copy(Be)),i.name==="Z"&&(Be.setFromAxisAngle(Ds,Math.atan2(pe.y,pe.x)),Be.multiplyQuaternions(an,Be),i.quaternion.copy(Be))),i.visible=i.visible&&(i.name.indexOf("X")===-1||this.showX),i.visible=i.visible&&(i.name.indexOf("Y")===-1||this.showY),i.visible=i.visible&&(i.name.indexOf("Z")===-1||this.showZ),i.visible=i.visible&&(i.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),i.material._color=i.material._color||i.material.color.clone(),i.material._opacity=i.material._opacity||i.material.opacity,i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled&&this.axis&&(i.name===this.axis||this.axis.split("").some(function(r){return i.name===r}))&&(i.material.color.setHex(16776960),i.material.opacity=1)}super.updateMatrixWorld(e)}}class dc extends O{constructor(){super(new Nn(1e5,1e5,2,2),new Ct({visible:!1,wireframe:!0,side:Qn,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),rn.copy(Rs).applyQuaternion(t==="local"?this.worldQuaternion:on),ks.copy(ts).applyQuaternion(t==="local"?this.worldQuaternion:on),Ms.copy(Ds).applyQuaternion(t==="local"?this.worldQuaternion:on),pe.copy(ks),this.mode){case"translate":case"scale":switch(this.axis){case"X":pe.copy(this.eye).cross(rn),Qt.copy(rn).cross(pe);break;case"Y":pe.copy(this.eye).cross(ks),Qt.copy(ks).cross(pe);break;case"Z":pe.copy(this.eye).cross(Ms),Qt.copy(Ms).cross(pe);break;case"XY":Qt.copy(Ms);break;case"YZ":Qt.copy(rn);break;case"XZ":pe.copy(Ms),Qt.copy(ks);break;case"XYZ":case"E":Qt.set(0,0,0);break}break;case"rotate":default:Qt.set(0,0,0)}Qt.length()===0?this.quaternion.copy(this.cameraQuaternion):(Ga.lookAt(qe.set(0,0,0),Qt,pe),this.quaternion.setFromRotationMatrix(Ga)),super.updateMatrixWorld(e)}}/*!
|
|
37
|
-
fflate - fast JavaScript compression/decompression
|
|
38
|
-
<https://101arrowz.github.io/fflate>
|
|
39
|
-
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
|
40
|
-
version 0.8.2
|
|
41
|
-
*/var xe=Uint8Array,ot=Uint16Array,ni=Int32Array,An=new xe([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]),cn=new xe([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]),ii=new xe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oa=function(o,e){for(var t=new ot(31),n=0;n<31;++n)t[n]=e+=1<<o[n-1];for(var s=new ni(t[30]),n=1;n<30;++n)for(var i=t[n];i<t[n+1];++i)s[i]=i-t[n]<<5|n;return{b:t,r:s}},Ha=Oa(An,2),ja=Ha.b,ai=Ha.r;ja[28]=258,ai[258]=28;for(var qa=Oa(cn,0),pc=qa.b,za=qa.r,oi=new ot(32768),Ie=0;Ie<32768;++Ie){var zt=(Ie&43690)>>1|(Ie&21845)<<1;zt=(zt&52428)>>2|(zt&13107)<<2,zt=(zt&61680)>>4|(zt&3855)<<4,oi[Ie]=((zt&65280)>>8|(zt&255)<<8)>>1}for(var vt=function(o,e,t){for(var n=o.length,s=0,i=new ot(e);s<n;++s)o[s]&&++i[o[s]-1];var a=new ot(e);for(s=1;s<e;++s)a[s]=a[s-1]+i[s-1]<<1;var r;if(t){r=new ot(1<<e);var A=15-e;for(s=0;s<n;++s)if(o[s])for(var c=s<<4|o[s],l=e-o[s],h=a[o[s]-1]++<<l,p=h|(1<<l)-1;h<=p;++h)r[oi[h]>>A]=c}else for(r=new ot(n),s=0;s<n;++s)o[s]&&(r[s]=oi[a[o[s]-1]++]>>15-o[s]);return r},Kt=new xe(288),Ie=0;Ie<144;++Ie)Kt[Ie]=8;for(var Ie=144;Ie<256;++Ie)Kt[Ie]=9;for(var Ie=256;Ie<280;++Ie)Kt[Ie]=7;for(var Ie=280;Ie<288;++Ie)Kt[Ie]=8;for(var _s=new xe(32),Ie=0;Ie<32;++Ie)_s[Ie]=5;var gc=vt(Kt,9,0),uc=vt(Kt,9,1),fc=vt(_s,5,0),mc=vt(_s,5,1),ri=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},It=function(o,e,t){var n=e/8|0;return(o[n]|o[n+1]<<8)>>(e&7)&t},Ai=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},ci=function(o){return(o+7)/8|0},li=function(o,e,t){return(t==null||t>o.length)&&(t=o.length),new xe(o.subarray(e,t))},bc=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],tt=function(o,e,t){var n=new Error(e||bc[o]);if(n.code=o,Error.captureStackTrace&&Error.captureStackTrace(n,tt),!t)throw n;return n},Ic=function(o,e,t,n){var s=o.length,i=0;if(!s||e.f&&!e.l)return t||new xe(0);var a=!t,r=a||e.i!=2,A=e.i;a&&(t=new xe(s*3));var c=function(_e){var Gt=t.length;if(_e>Gt){var Ke=new xe(Math.max(Gt*2,_e));Ke.set(t),t=Ke}},l=e.f||0,h=e.p||0,p=e.b||0,g=e.l,u=e.d,b=e.m,f=e.n,E=s*8;do{if(!g){l=It(o,h,1);var C=It(o,h+1,3);if(h+=3,C)if(C==1)g=uc,u=mc,b=9,f=5;else if(C==2){var I=It(o,h,31)+257,y=It(o,h+10,15)+4,w=I+It(o,h+5,31)+1;h+=14;for(var x=new xe(w),T=new xe(19),S=0;S<y;++S)T[ii[S]]=It(o,h+S*3,7);h+=y*3;for(var M=ri(T),j=(1<<M)-1,K=vt(T,M,1),S=0;S<w;){var J=K[It(o,h,j)];h+=J&15;var V=J>>4;if(V<16)x[S++]=V;else{var q=0,X=0;for(V==16?(X=3+It(o,h,3),h+=2,q=x[S-1]):V==17?(X=3+It(o,h,7),h+=3):V==18&&(X=11+It(o,h,127),h+=7);X--;)x[S++]=q}}var W=x.subarray(0,I),ee=x.subarray(I);b=ri(W),f=ri(ee),g=vt(W,b,1),u=vt(ee,f,1)}else tt(1);else{var V=ci(h)+4,$=o[V-4]|o[V-3]<<8,ue=V+$;if(ue>s){A&&tt(0);break}r&&c(p+$),t.set(o.subarray(V,ue),p),e.b=p+=$,e.p=h=ue*8,e.f=l;continue}if(h>E){A&&tt(0);break}}r&&c(p+131072);for(var Re=(1<<b)-1,se=(1<<f)-1,oe=h;;oe=h){var q=g[Ai(o,h)&Re],Ae=q>>4;if(h+=q&15,h>E){A&&tt(0);break}if(q||tt(2),Ae<256)t[p++]=Ae;else if(Ae==256){oe=h,g=null;break}else{var Te=Ae-254;if(Ae>264){var S=Ae-257,fe=An[S];Te=It(o,h,(1<<fe)-1)+ja[S],h+=fe}var ze=u[Ai(o,h)&se],Nt=ze>>4;ze||tt(3),h+=ze&15;var ee=pc[Nt];if(Nt>3){var fe=cn[Nt];ee+=Ai(o,h)&(1<<fe)-1,h+=fe}if(h>E){A&&tt(0);break}r&&c(p+131072);var Ut=p+Te;if(p<ee){var as=i-ee,Ne=Math.min(ee,Ut);for(as+p<0&&tt(3);p<Ne;++p)t[p]=n[as+p]}for(;p<Ut;++p)t[p]=t[p-ee]}}e.l=g,e.p=oe,e.b=p,e.f=l,g&&(l=1,e.m=b,e.d=u,e.n=f)}while(!l);return p!=t.length&&a?li(t,0,p):t.subarray(0,p)},Lt=function(o,e,t){t<<=e&7;var n=e/8|0;o[n]|=t,o[n+1]|=t>>8},Fs=function(o,e,t){t<<=e&7;var n=e/8|0;o[n]|=t,o[n+1]|=t>>8,o[n+2]|=t>>16},hi=function(o,e){for(var t=[],n=0;n<o.length;++n)o[n]&&t.push({s:n,f:o[n]});var s=t.length,i=t.slice();if(!s)return{t:Wa,l:0};if(s==1){var a=new xe(t[0].s+1);return a[t[0].s]=1,{t:a,l:1}}t.sort(function(w,x){return w.f-x.f}),t.push({s:-1,f:25001});var r=t[0],A=t[1],c=0,l=1,h=2;for(t[0]={s:-1,f:r.f+A.f,l:r,r:A};l!=s-1;)r=t[t[c].f<t[h].f?c++:h++],A=t[c!=l&&t[c].f<t[h].f?c++:h++],t[l++]={s:-1,f:r.f+A.f,l:r,r:A};for(var p=i[0].s,n=1;n<s;++n)i[n].s>p&&(p=i[n].s);var g=new ot(p+1),u=di(t[l-1],g,0);if(u>e){var n=0,b=0,f=u-e,E=1<<f;for(i.sort(function(x,T){return g[T.s]-g[x.s]||x.f-T.f});n<s;++n){var C=i[n].s;if(g[C]>e)b+=E-(1<<u-g[C]),g[C]=e;else break}for(b>>=f;b>0;){var I=i[n].s;g[I]<e?b-=1<<e-g[I]++-1:++n}for(;n>=0&&b;--n){var y=i[n].s;g[y]==e&&(--g[y],++b)}u=e}return{t:new xe(g),l:u}},di=function(o,e,t){return o.s==-1?Math.max(di(o.l,e,t+1),di(o.r,e,t+1)):e[o.s]=t},Ka=function(o){for(var e=o.length;e&&!o[--e];);for(var t=new ot(++e),n=0,s=o[0],i=1,a=function(A){t[n++]=A},r=1;r<=e;++r)if(o[r]==s&&r!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(s),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(s);i=1,s=o[r]}return{c:t.subarray(0,n),n:e}},Ls=function(o,e){for(var t=0,n=0;n<e.length;++n)t+=o[n]*e[n];return t},Ya=function(o,e,t){var n=t.length,s=ci(e+2);o[s]=n&255,o[s+1]=n>>8,o[s+2]=o[s]^255,o[s+3]=o[s+1]^255;for(var i=0;i<n;++i)o[s+i+4]=t[i];return(s+4+n)*8},Ja=function(o,e,t,n,s,i,a,r,A,c,l){Lt(e,l++,t),++s[256];for(var h=hi(s,15),p=h.t,g=h.l,u=hi(i,15),b=u.t,f=u.l,E=Ka(p),C=E.c,I=E.n,y=Ka(b),w=y.c,x=y.n,T=new ot(19),S=0;S<C.length;++S)++T[C[S]&31];for(var S=0;S<w.length;++S)++T[w[S]&31];for(var M=hi(T,7),j=M.t,K=M.l,J=19;J>4&&!j[ii[J-1]];--J);var V=c+5<<3,q=Ls(s,Kt)+Ls(i,_s)+a,X=Ls(s,p)+Ls(i,b)+a+14+3*J+Ls(T,j)+2*T[16]+3*T[17]+7*T[18];if(A>=0&&V<=q&&V<=X)return Ya(e,l,o.subarray(A,A+c));var W,ee,$,ue;if(Lt(e,l,1+(X<q)),l+=2,X<q){W=vt(p,g,0),ee=p,$=vt(b,f,0),ue=b;var Re=vt(j,K,0);Lt(e,l,I-257),Lt(e,l+5,x-1),Lt(e,l+10,J-4),l+=14;for(var S=0;S<J;++S)Lt(e,l+3*S,j[ii[S]]);l+=3*J;for(var se=[C,w],oe=0;oe<2;++oe)for(var Ae=se[oe],S=0;S<Ae.length;++S){var Te=Ae[S]&31;Lt(e,l,Re[Te]),l+=j[Te],Te>15&&(Lt(e,l,Ae[S]>>5&127),l+=Ae[S]>>12)}}else W=gc,ee=Kt,$=fc,ue=_s;for(var S=0;S<r;++S){var fe=n[S];if(fe>255){var Te=fe>>18&31;Fs(e,l,W[Te+257]),l+=ee[Te+257],Te>7&&(Lt(e,l,fe>>23&31),l+=An[Te]);var ze=fe&31;Fs(e,l,$[ze]),l+=ue[ze],ze>3&&(Fs(e,l,fe>>5&8191),l+=cn[ze])}else Fs(e,l,W[fe]),l+=ee[fe]}return Fs(e,l,W[256]),l+ee[256]},Ec=new ni([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Wa=new xe(0),Cc=function(o,e,t,n,s,i){var a=i.z||o.length,r=new xe(n+a+5*(1+Math.ceil(a/7e3))+s),A=r.subarray(n,r.length-s),c=i.l,l=(i.r||0)&7;if(e){l&&(A[0]=i.r>>3);for(var h=Ec[e-1],p=h>>13,g=h&8191,u=(1<<t)-1,b=i.p||new ot(32768),f=i.h||new ot(u+1),E=Math.ceil(t/3),C=2*E,I=function(Ue){return(o[Ue]^o[Ue+1]<<E^o[Ue+2]<<C)&u},y=new ni(25e3),w=new ot(288),x=new ot(32),T=0,S=0,M=i.i||0,j=0,K=i.w||0,J=0;M+2<a;++M){var V=I(M),q=M&32767,X=f[V];if(b[q]=X,f[V]=q,K<=M){var W=a-M;if((T>7e3||j>24576)&&(W>423||!c)){l=Ja(o,A,0,y,w,x,S,j,J,M-J,l),j=T=S=0,J=M;for(var ee=0;ee<286;++ee)w[ee]=0;for(var ee=0;ee<30;++ee)x[ee]=0}var $=2,ue=0,Re=g,se=q-X&32767;if(W>2&&V==I(M-se))for(var oe=Math.min(p,W)-1,Ae=Math.min(32767,M),Te=Math.min(258,W);se<=Ae&&--Re&&q!=X;){if(o[M+$]==o[M+$-se]){for(var fe=0;fe<Te&&o[M+fe]==o[M+fe-se];++fe);if(fe>$){if($=fe,ue=se,fe>oe)break;for(var ze=Math.min(se,fe-2),Nt=0,ee=0;ee<ze;++ee){var Ut=M-se+ee&32767,as=b[Ut],Ne=Ut-as&32767;Ne>Nt&&(Nt=Ne,X=Ut)}}}q=X,X=b[q],se+=q-X&32767}if(ue){y[j++]=268435456|ai[$]<<18|za[ue];var _e=ai[$]&31,Gt=za[ue]&31;S+=An[_e]+cn[Gt],++w[257+_e],++x[Gt],K=M+$,++T}else y[j++]=o[M],++w[o[M]]}}for(M=Math.max(M,K);M<a;++M)y[j++]=o[M],++w[o[M]];l=Ja(o,A,c,y,w,x,S,j,J,M-J,l),c||(i.r=l&7|A[l/8|0]<<3,l-=7,i.h=f,i.p=b,i.i=M,i.w=K)}else{for(var M=i.w||0;M<a+c;M+=65535){var Ke=M+65535;Ke>=a&&(A[l/8|0]=c,Ke=a),l=Ya(A,l+1,o.subarray(M,Ke))}i.i=a}return li(r,0,n+ci(l)+s)},Bc=function(){for(var o=new Int32Array(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(t&1&&-306674912)^t>>>1;o[e]=t}return o}(),wc=function(){var o=-1;return{p:function(e){for(var t=o,n=0;n<e.length;++n)t=Bc[t&255^e[n]]^t>>>8;o=t},d:function(){return~o}}},yc=function(o,e,t,n,s){if(!s&&(s={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),a=new xe(i.length+o.length);a.set(i),a.set(o,i.length),o=a,s.w=i.length}return Cc(o,e.level==null?6:e.level,e.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(o.length)))*1.5):20:12+e.mem,t,n,s)},Va=function(o,e){var t={};for(var n in o)t[n]=o[n];for(var n in e)t[n]=e[n];return t},Ge=function(o,e,t){for(;t;++e)o[e]=t,t>>>=8},Qc=function(o,e){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&tt(6,"invalid zlib data"),(o[1]>>5&1)==1&&tt(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function vc(o,e){return yc(o,e||{},0,0)}function Ns(o,e){return Ic(o.subarray(Qc(o),-4),{i:2},e,e)}var Xa=function(o,e,t,n){for(var s in o){var i=o[s],a=e+s,r=n;Array.isArray(i)&&(r=Va(n,i[1]),i=i[0]),i instanceof xe?t[a]=[i,r]:(t[a+="/"]=[new xe(0),r],Xa(i,a,t,n))}},Za=typeof TextEncoder<"u"&&new TextEncoder,xc=typeof TextDecoder<"u"&&new TextDecoder,Sc=0;try{xc.decode(Wa,{stream:!0}),Sc=1}catch{}function pi(o,e){var t;if(Za)return Za.encode(o);for(var n=o.length,s=new xe(o.length+(o.length>>1)),i=0,a=function(l){s[i++]=l},t=0;t<n;++t){if(i+5>s.length){var r=new xe(i+8+(n-t<<1));r.set(s),s=r}var A=o.charCodeAt(t);A<128||e?a(A):A<2048?(a(192|A>>6),a(128|A&63)):A>55295&&A<57344?(A=65536+(A&1047552)|o.charCodeAt(++t)&1023,a(240|A>>18),a(128|A>>12&63),a(128|A>>6&63),a(128|A&63)):(a(224|A>>12),a(128|A>>6&63),a(128|A&63))}return li(s,0,i)}var gi=function(o){var e=0;if(o)for(var t in o){var n=o[t].length;n>65535&&tt(9),e+=n+4}return e},$a=function(o,e,t,n,s,i,a,r){var A=n.length,c=t.extra,l=r&&r.length,h=gi(c);Ge(o,e,a!=null?33639248:67324752),e+=4,a!=null&&(o[e++]=20,o[e++]=t.os),o[e]=20,e+=2,o[e++]=t.flag<<1|(i<0&&8),o[e++]=s&&8,o[e++]=t.compression&255,o[e++]=t.compression>>8;var p=new Date(t.mtime==null?Date.now():t.mtime),g=p.getFullYear()-1980;if((g<0||g>119)&&tt(10),Ge(o,e,g<<25|p.getMonth()+1<<21|p.getDate()<<16|p.getHours()<<11|p.getMinutes()<<5|p.getSeconds()>>1),e+=4,i!=-1&&(Ge(o,e,t.crc),Ge(o,e+4,i<0?-i-2:i),Ge(o,e+8,t.size)),Ge(o,e+12,A),Ge(o,e+14,h),e+=16,a!=null&&(Ge(o,e,l),Ge(o,e+6,t.attrs),Ge(o,e+10,a),e+=14),o.set(n,e),e+=A,h)for(var u in c){var b=c[u],f=b.length;Ge(o,e,+u),Ge(o,e+2,f),o.set(b,e+4),e+=4+f}return l&&(o.set(r,e),e+=l),e},Tc=function(o,e,t,n,s){Ge(o,e,101010256),Ge(o,e+8,t),Ge(o,e+10,t),Ge(o,e+12,n),Ge(o,e+16,s)};function Rc(o,e){e||(e={});var t={},n=[];Xa(o,"",t,e);var s=0,i=0;for(var a in t){var r=t[a],A=r[0],c=r[1],l=c.level==0?0:8,h=pi(a),p=h.length,g=c.comment,u=g&&pi(g),b=u&&u.length,f=gi(c.extra);p>65535&&tt(11);var E=l?vc(A,c):A,C=E.length,I=wc();I.p(A),n.push(Va(c,{size:A.length,crc:I.d(),c:E,f:h,m:u,u:p!=a.length||u&&g.length!=b,o:s,compression:l})),s+=30+p+f+C,i+=76+2*(p+f)+(b||0)+C}for(var y=new xe(i+22),w=s,x=i-s,T=0;T<n.length;++T){var h=n[T];$a(y,h.o,h,h.f,h.u,h.c.length);var S=30+h.f.length+gi(h.extra);y.set(h.c,h.o+S),$a(y,s,h,h.f,h.u,h.c.length,h.o,h.m),s+=16+S+(h.m?h.m.length:0)}return Tc(y,s,n.length,x,w),y}class eo extends Wi{constructor(e){super(e),this.type=Ze}parse(e){const t=Math.pow(2.7182818,2.2);function n(d,m){let B=0;for(let R=0;R<65536;++R)(R==0||d[R>>3]&1<<(R&7))&&(m[B++]=R);const Q=B-1;for(;B<65536;)m[B++]=0;return Q}function s(d){for(let m=0;m<16384;m++)d[m]={},d[m].len=0,d[m].lit=0,d[m].p=null}const i={l:0,c:0,lc:0};function a(d,m,B,Q,R){for(;B<d;)m=m<<8|Gt(Q,R),B+=8;B-=d,i.l=m>>B&(1<<d)-1,i.c=m,i.lc=B}const r=new Array(59);function A(d){for(let B=0;B<=58;++B)r[B]=0;for(let B=0;B<65537;++B)r[d[B]]+=1;let m=0;for(let B=58;B>0;--B){const Q=m+r[B]>>1;r[B]=m,m=Q}for(let B=0;B<65537;++B){const Q=d[B];Q>0&&(d[B]=Q|r[Q]++<<6)}}function c(d,m,B,Q,R,v){const _=m;let L=0,F=0;for(;Q<=R;Q++){if(_.value-m.value>B)return!1;a(6,L,F,d,_);const k=i.l;if(L=i.c,F=i.lc,v[Q]=k,k==63){if(_.value-m.value>B)throw new Error("Something wrong with hufUnpackEncTable");a(8,L,F,d,_);let D=i.l+6;if(L=i.c,F=i.lc,Q+D>R+1)throw new Error("Something wrong with hufUnpackEncTable");for(;D--;)v[Q++]=0;Q--}else if(k>=59){let D=k-59+2;if(Q+D>R+1)throw new Error("Something wrong with hufUnpackEncTable");for(;D--;)v[Q++]=0;Q--}}A(v)}function l(d){return d&63}function h(d){return d>>6}function p(d,m,B,Q){for(;m<=B;m++){const R=h(d[m]),v=l(d[m]);if(R>>v)throw new Error("Invalid table entry");if(v>14){const _=Q[R>>v-14];if(_.len)throw new Error("Invalid table entry");if(_.lit++,_.p){const L=_.p;_.p=new Array(_.lit);for(let F=0;F<_.lit-1;++F)_.p[F]=L[F]}else _.p=new Array(1);_.p[_.lit-1]=m}else if(v){let _=0;for(let L=1<<14-v;L>0;L--){const F=Q[(R<<14-v)+_];if(F.len||F.p)throw new Error("Invalid table entry");F.len=v,F.lit=m,_++}}}return!0}const g={c:0,lc:0};function u(d,m,B,Q){d=d<<8|Gt(B,Q),m+=8,g.c=d,g.lc=m}const b={c:0,lc:0};function f(d,m,B,Q,R,v,_,L,F){if(d==m){Q<8&&(u(B,Q,R,v),B=g.c,Q=g.lc),Q-=8;let k=B>>Q;if(k=new Uint8Array([k])[0],L.value+k>F)return!1;const D=_[L.value-1];for(;k-- >0;)_[L.value++]=D}else if(L.value<F)_[L.value++]=d;else return!1;b.c=B,b.lc=Q}function E(d){return d&65535}function C(d){const m=E(d);return m>32767?m-65536:m}const I={a:0,b:0};function y(d,m){const B=C(d),Q=C(m),R=B+(Q&1)+(Q>>1),v=R,_=R-Q;I.a=v,I.b=_}function w(d,m){const B=E(d),Q=E(m),R=B-(Q>>1)&65535,v=Q+R-32768&65535;I.a=v,I.b=R}function x(d,m,B,Q,R,v,_){const L=_<16384,F=B>R?R:B;let k=1,D,G;for(;k<=F;)k<<=1;for(k>>=1,D=k,k>>=1;k>=1;){G=0;const U=G+v*(R-D),z=v*k,Z=v*D,P=Q*k,Y=Q*D;let te,Ee,ve,nt;for(;G<=U;G+=Z){let me=G;const re=G+Q*(B-D);for(;me<=re;me+=Y){const De=me+P,At=me+z,Fe=At+P;L?(y(d[me+m],d[At+m]),te=I.a,ve=I.b,y(d[De+m],d[Fe+m]),Ee=I.a,nt=I.b,y(te,Ee),d[me+m]=I.a,d[De+m]=I.b,y(ve,nt),d[At+m]=I.a,d[Fe+m]=I.b):(w(d[me+m],d[At+m]),te=I.a,ve=I.b,w(d[De+m],d[Fe+m]),Ee=I.a,nt=I.b,w(te,Ee),d[me+m]=I.a,d[De+m]=I.b,w(ve,nt),d[At+m]=I.a,d[Fe+m]=I.b)}if(B&k){const De=me+z;L?y(d[me+m],d[De+m]):w(d[me+m],d[De+m]),te=I.a,d[De+m]=I.b,d[me+m]=te}}if(R&k){let me=G;const re=G+Q*(B-D);for(;me<=re;me+=Y){const De=me+P;L?y(d[me+m],d[De+m]):w(d[me+m],d[De+m]),te=I.a,d[De+m]=I.b,d[me+m]=te}}D=k,k>>=1}return G}function T(d,m,B,Q,R,v,_,L,F){let k=0,D=0;const G=_,U=Math.trunc(Q.value+(R+7)/8);for(;Q.value<U;)for(u(k,D,B,Q),k=g.c,D=g.lc;D>=14;){const Z=k>>D-14&16383,P=m[Z];if(P.len)D-=P.len,f(P.lit,v,k,D,B,Q,L,F,G),k=b.c,D=b.lc;else{if(!P.p)throw new Error("hufDecode issues");let Y;for(Y=0;Y<P.lit;Y++){const te=l(d[P.p[Y]]);for(;D<te&&Q.value<U;)u(k,D,B,Q),k=g.c,D=g.lc;if(D>=te&&h(d[P.p[Y]])==(k>>D-te&(1<<te)-1)){D-=te,f(P.p[Y],v,k,D,B,Q,L,F,G),k=b.c,D=b.lc;break}}if(Y==P.lit)throw new Error("hufDecode issues")}}const z=8-R&7;for(k>>=z,D-=z;D>0;){const Z=m[k<<14-D&16383];if(Z.len)D-=Z.len,f(Z.lit,v,k,D,B,Q,L,F,G),k=b.c,D=b.lc;else throw new Error("hufDecode issues")}return!0}function S(d,m,B,Q,R,v){const _={value:0},L=B.value,F=_e(m,B),k=_e(m,B);B.value+=4;const D=_e(m,B);if(B.value+=4,F<0||F>=65537||k<0||k>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const G=new Array(65537),U=new Array(16384);s(U);const z=Q-(B.value-L);if(c(d,B,z,F,k,G),D>8*(Q-(B.value-L)))throw new Error("Something wrong with hufUncompress");p(G,F,k,U),T(G,U,d,B,D,k,v,R,_)}function M(d,m,B){for(let Q=0;Q<B;++Q)m[Q]=d[m[Q]]}function j(d){for(let m=1;m<d.length;m++){const B=d[m-1]+d[m]-128;d[m]=B}}function K(d,m){let B=0,Q=Math.floor((d.length+1)/2),R=0;const v=d.length-1;for(;!(R>v||(m[R++]=d[B++],R>v));)m[R++]=d[Q++]}function J(d){let m=d.byteLength;const B=new Array;let Q=0;const R=new DataView(d);for(;m>0;){const v=R.getInt8(Q++);if(v<0){const _=-v;m-=_+1;for(let L=0;L<_;L++)B.push(R.getUint8(Q++))}else{const _=v;m-=2;const L=R.getUint8(Q++);for(let F=0;F<_+1;F++)B.push(L)}}return B}function V(d,m,B,Q,R,v){let _=new DataView(v.buffer);const L=B[d.idx[0]].width,F=B[d.idx[0]].height,k=3,D=Math.floor(L/8),G=Math.ceil(L/8),U=Math.ceil(F/8),z=L-(G-1)*8,Z=F-(U-1)*8,P={value:0},Y=new Array(k),te=new Array(k),Ee=new Array(k),ve=new Array(k),nt=new Array(k);for(let re=0;re<k;++re)nt[re]=m[d.idx[re]],Y[re]=re<1?0:Y[re-1]+G*U,te[re]=new Float32Array(64),Ee[re]=new Uint16Array(64),ve[re]=new Uint16Array(G*64);for(let re=0;re<U;++re){let De=8;re==U-1&&(De=Z);let At=8;for(let de=0;de<G;++de){de==G-1&&(At=z);for(let ge=0;ge<k;++ge)Ee[ge].fill(0),Ee[ge][0]=R[Y[ge]++],q(P,Q,Ee[ge]),X(Ee[ge],te[ge]),W(te[ge]);ee(te);for(let ge=0;ge<k;++ge)$(te[ge],ve[ge],de*64)}let Fe=0;for(let de=0;de<k;++de){const ge=B[d.idx[de]].type;for(let Rt=8*re;Rt<8*re+De;++Rt){Fe=nt[de][Rt];for(let fs=0;fs<D;++fs){const Et=fs*64+(Rt&7)*8;_.setUint16(Fe+0*ge,ve[de][Et+0],!0),_.setUint16(Fe+2*ge,ve[de][Et+1],!0),_.setUint16(Fe+4*ge,ve[de][Et+2],!0),_.setUint16(Fe+6*ge,ve[de][Et+3],!0),_.setUint16(Fe+8*ge,ve[de][Et+4],!0),_.setUint16(Fe+10*ge,ve[de][Et+5],!0),_.setUint16(Fe+12*ge,ve[de][Et+6],!0),_.setUint16(Fe+14*ge,ve[de][Et+7],!0),Fe+=16*ge}}if(D!=G)for(let Rt=8*re;Rt<8*re+De;++Rt){const fs=nt[de][Rt]+8*D*2*ge,Et=D*64+(Rt&7)*8;for(let js=0;js<At;++js)_.setUint16(fs+js*2*ge,ve[de][Et+js],!0)}}}const me=new Uint16Array(L);_=new DataView(v.buffer);for(let re=0;re<k;++re){B[d.idx[re]].decoded=!0;const De=B[d.idx[re]].type;if(B[re].type==2)for(let At=0;At<F;++At){const Fe=nt[re][At];for(let de=0;de<L;++de)me[de]=_.getUint16(Fe+de*2*De,!0);for(let de=0;de<L;++de)_.setFloat32(Fe+de*2*De,H(me[de]),!0)}}}function q(d,m,B){let Q,R=1;for(;R<64;)Q=m[d.value],Q==65280?R=64:Q>>8==255?R+=Q&255:(B[R]=Q,R++),d.value++}function X(d,m){m[0]=H(d[0]),m[1]=H(d[1]),m[2]=H(d[5]),m[3]=H(d[6]),m[4]=H(d[14]),m[5]=H(d[15]),m[6]=H(d[27]),m[7]=H(d[28]),m[8]=H(d[2]),m[9]=H(d[4]),m[10]=H(d[7]),m[11]=H(d[13]),m[12]=H(d[16]),m[13]=H(d[26]),m[14]=H(d[29]),m[15]=H(d[42]),m[16]=H(d[3]),m[17]=H(d[8]),m[18]=H(d[12]),m[19]=H(d[17]),m[20]=H(d[25]),m[21]=H(d[30]),m[22]=H(d[41]),m[23]=H(d[43]),m[24]=H(d[9]),m[25]=H(d[11]),m[26]=H(d[18]),m[27]=H(d[24]),m[28]=H(d[31]),m[29]=H(d[40]),m[30]=H(d[44]),m[31]=H(d[53]),m[32]=H(d[10]),m[33]=H(d[19]),m[34]=H(d[23]),m[35]=H(d[32]),m[36]=H(d[39]),m[37]=H(d[45]),m[38]=H(d[52]),m[39]=H(d[54]),m[40]=H(d[20]),m[41]=H(d[22]),m[42]=H(d[33]),m[43]=H(d[38]),m[44]=H(d[46]),m[45]=H(d[51]),m[46]=H(d[55]),m[47]=H(d[60]),m[48]=H(d[21]),m[49]=H(d[34]),m[50]=H(d[37]),m[51]=H(d[47]),m[52]=H(d[50]),m[53]=H(d[56]),m[54]=H(d[59]),m[55]=H(d[61]),m[56]=H(d[35]),m[57]=H(d[36]),m[58]=H(d[48]),m[59]=H(d[49]),m[60]=H(d[57]),m[61]=H(d[58]),m[62]=H(d[62]),m[63]=H(d[63])}function W(d){const m=.5*Math.cos(.7853975),B=.5*Math.cos(3.14159/16),Q=.5*Math.cos(3.14159/8),R=.5*Math.cos(3*3.14159/16),v=.5*Math.cos(5*3.14159/16),_=.5*Math.cos(3*3.14159/8),L=.5*Math.cos(7*3.14159/16),F=new Array(4),k=new Array(4),D=new Array(4),G=new Array(4);for(let U=0;U<8;++U){const z=U*8;F[0]=Q*d[z+2],F[1]=_*d[z+2],F[2]=Q*d[z+6],F[3]=_*d[z+6],k[0]=B*d[z+1]+R*d[z+3]+v*d[z+5]+L*d[z+7],k[1]=R*d[z+1]-L*d[z+3]-B*d[z+5]-v*d[z+7],k[2]=v*d[z+1]-B*d[z+3]+L*d[z+5]+R*d[z+7],k[3]=L*d[z+1]-v*d[z+3]+R*d[z+5]-B*d[z+7],D[0]=m*(d[z+0]+d[z+4]),D[3]=m*(d[z+0]-d[z+4]),D[1]=F[0]+F[3],D[2]=F[1]-F[2],G[0]=D[0]+D[1],G[1]=D[3]+D[2],G[2]=D[3]-D[2],G[3]=D[0]-D[1],d[z+0]=G[0]+k[0],d[z+1]=G[1]+k[1],d[z+2]=G[2]+k[2],d[z+3]=G[3]+k[3],d[z+4]=G[3]-k[3],d[z+5]=G[2]-k[2],d[z+6]=G[1]-k[1],d[z+7]=G[0]-k[0]}for(let U=0;U<8;++U)F[0]=Q*d[16+U],F[1]=_*d[16+U],F[2]=Q*d[48+U],F[3]=_*d[48+U],k[0]=B*d[8+U]+R*d[24+U]+v*d[40+U]+L*d[56+U],k[1]=R*d[8+U]-L*d[24+U]-B*d[40+U]-v*d[56+U],k[2]=v*d[8+U]-B*d[24+U]+L*d[40+U]+R*d[56+U],k[3]=L*d[8+U]-v*d[24+U]+R*d[40+U]-B*d[56+U],D[0]=m*(d[U]+d[32+U]),D[3]=m*(d[U]-d[32+U]),D[1]=F[0]+F[3],D[2]=F[1]-F[2],G[0]=D[0]+D[1],G[1]=D[3]+D[2],G[2]=D[3]-D[2],G[3]=D[0]-D[1],d[0+U]=G[0]+k[0],d[8+U]=G[1]+k[1],d[16+U]=G[2]+k[2],d[24+U]=G[3]+k[3],d[32+U]=G[3]-k[3],d[40+U]=G[2]-k[2],d[48+U]=G[1]-k[1],d[56+U]=G[0]-k[0]}function ee(d){for(let m=0;m<64;++m){const B=d[0][m],Q=d[1][m],R=d[2][m];d[0][m]=B+1.5747*R,d[1][m]=B-.1873*Q-.4682*R,d[2][m]=B+1.8556*Q}}function $(d,m,B){for(let Q=0;Q<64;++Q)m[B+Q]=As.toHalfFloat(ue(d[Q]))}function ue(d){return d<=1?Math.sign(d)*Math.pow(Math.abs(d),2.2):Math.sign(d)*Math.pow(t,Math.abs(d)-1)}function Re(d){return new DataView(d.array.buffer,d.offset.value,d.size)}function se(d){const m=d.viewer.buffer.slice(d.offset.value,d.offset.value+d.size),B=new Uint8Array(J(m)),Q=new Uint8Array(B.length);return j(B),K(B,Q),new DataView(Q.buffer)}function oe(d){const m=d.array.slice(d.offset.value,d.offset.value+d.size),B=Ns(m),Q=new Uint8Array(B.length);return j(B),K(B,Q),new DataView(Q.buffer)}function Ae(d){const m=d.viewer,B={value:d.offset.value},Q=new Uint16Array(d.columns*d.lines*(d.inputChannels.length*d.type)),R=new Uint8Array(8192);let v=0;const _=new Array(d.inputChannels.length);for(let Z=0,P=d.inputChannels.length;Z<P;Z++)_[Z]={},_[Z].start=v,_[Z].end=_[Z].start,_[Z].nx=d.columns,_[Z].ny=d.lines,_[Z].size=d.type,v+=_[Z].nx*_[Z].ny*_[Z].size;const L=us(m,B),F=us(m,B);if(F>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(L<=F)for(let Z=0;Z<F-L+1;Z++)R[Z+L]=Ke(m,B);const k=new Uint16Array(65536),D=n(R,k),G=_e(m,B);S(d.array,m,B,G,Q,v);for(let Z=0;Z<d.inputChannels.length;++Z){const P=_[Z];for(let Y=0;Y<_[Z].size;++Y)x(Q,P.start+Y,P.nx,P.size,P.ny,P.nx*P.size,D)}M(k,Q,v);let U=0;const z=new Uint8Array(Q.buffer.byteLength);for(let Z=0;Z<d.lines;Z++)for(let P=0;P<d.inputChannels.length;P++){const Y=_[P],te=Y.nx*Y.size,Ee=new Uint8Array(Q.buffer,Y.end*2,te*2);z.set(Ee,U),U+=te*2,Y.end+=te}return new DataView(z.buffer)}function Te(d){const m=d.array.slice(d.offset.value,d.offset.value+d.size),B=Ns(m),Q=d.inputChannels.length*d.lines*d.columns*d.totalBytes,R=new ArrayBuffer(Q),v=new DataView(R);let _=0,L=0;const F=new Array(4);for(let k=0;k<d.lines;k++)for(let D=0;D<d.inputChannels.length;D++){let G=0;switch(d.inputChannels[D].pixelType){case 1:F[0]=_,F[1]=F[0]+d.columns,_=F[1]+d.columns;for(let U=0;U<d.columns;++U){const z=B[F[0]++]<<8|B[F[1]++];G+=z,v.setUint16(L,G,!0),L+=2}break;case 2:F[0]=_,F[1]=F[0]+d.columns,F[2]=F[1]+d.columns,_=F[2]+d.columns;for(let U=0;U<d.columns;++U){const z=B[F[0]++]<<24|B[F[1]++]<<16|B[F[2]++]<<8;G+=z,v.setUint32(L,G,!0),L+=4}break}}return v}function fe(d){const m=d.viewer,B={value:d.offset.value},Q=new Uint8Array(d.columns*d.lines*(d.inputChannels.length*d.type*2)),R={version:Ue(m,B),unknownUncompressedSize:Ue(m,B),unknownCompressedSize:Ue(m,B),acCompressedSize:Ue(m,B),dcCompressedSize:Ue(m,B),rleCompressedSize:Ue(m,B),rleUncompressedSize:Ue(m,B),rleRawSize:Ue(m,B),totalAcUncompressedCount:Ue(m,B),totalDcUncompressedCount:Ue(m,B),acCompression:Ue(m,B)};if(R.version<2)throw new Error("EXRLoader.parse: "+Yt.compression+" version "+R.version+" is unsupported");const v=new Array;let _=us(m,B)-2;for(;_>0;){const P=ze(m.buffer,B),Y=Ke(m,B),te=Y>>2&3,Ee=(Y>>4)-1,ve=new Int8Array([Ee])[0],nt=Ke(m,B);v.push({name:P,index:ve,type:nt,compression:te}),_-=P.length+3}const L=Yt.channels,F=new Array(d.inputChannels.length);for(let P=0;P<d.inputChannels.length;++P){const Y=F[P]={},te=L[P];Y.name=te.name,Y.compression=0,Y.decoded=!1,Y.type=te.pixelType,Y.pLinear=te.pLinear,Y.width=d.columns,Y.height=d.lines}const k={idx:new Array(3)};for(let P=0;P<d.inputChannels.length;++P){const Y=F[P];for(let te=0;te<v.length;++te){const Ee=v[te];Y.name==Ee.name&&(Y.compression=Ee.compression,Ee.index>=0&&(k.idx[Ee.index]=P),Y.offset=P)}}let D,G,U;if(R.acCompressedSize>0)switch(R.acCompression){case 0:D=new Uint16Array(R.totalAcUncompressedCount),S(d.array,m,B,R.acCompressedSize,D,R.totalAcUncompressedCount);break;case 1:const P=d.array.slice(B.value,B.value+R.totalAcUncompressedCount),Y=Ns(P);D=new Uint16Array(Y.buffer),B.value+=R.totalAcUncompressedCount;break}if(R.dcCompressedSize>0){const P={array:d.array,offset:B,size:R.dcCompressedSize};G=new Uint16Array(oe(P).buffer),B.value+=R.dcCompressedSize}if(R.rleRawSize>0){const P=d.array.slice(B.value,B.value+R.rleCompressedSize),Y=Ns(P);U=J(Y.buffer),B.value+=R.rleCompressedSize}let z=0;const Z=new Array(F.length);for(let P=0;P<Z.length;++P)Z[P]=new Array;for(let P=0;P<d.lines;++P)for(let Y=0;Y<F.length;++Y)Z[Y].push(z),z+=F[Y].width*d.type*2;V(k,Z,F,D,G,Q);for(let P=0;P<F.length;++P){const Y=F[P];if(!Y.decoded)switch(Y.compression){case 2:let te=0,Ee=0;for(let ve=0;ve<d.lines;++ve){let nt=Z[P][te];for(let me=0;me<Y.width;++me){for(let re=0;re<2*Y.type;++re)Q[nt++]=U[Ee+re*Y.width*Y.height];Ee++}te++}break;case 1:default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(Q.buffer)}function ze(d,m){const B=new Uint8Array(d);let Q=0;for(;B[m.value+Q]!=0;)Q+=1;const R=new TextDecoder().decode(B.slice(m.value,m.value+Q));return m.value=m.value+Q+1,R}function Nt(d,m,B){const Q=new TextDecoder().decode(new Uint8Array(d).slice(m.value,m.value+B));return m.value=m.value+B,Q}function Ut(d,m){const B=Ne(d,m),Q=_e(d,m);return[B,Q]}function as(d,m){const B=_e(d,m),Q=_e(d,m);return[B,Q]}function Ne(d,m){const B=d.getInt32(m.value,!0);return m.value=m.value+4,B}function _e(d,m){const B=d.getUint32(m.value,!0);return m.value=m.value+4,B}function Gt(d,m){const B=d[m.value];return m.value=m.value+1,B}function Ke(d,m){const B=d.getUint8(m.value);return m.value=m.value+1,B}const Ue=function(d,m){let B;return"getBigInt64"in DataView.prototype?B=Number(d.getBigInt64(m.value,!0)):B=d.getUint32(m.value+4,!0)+Number(d.getUint32(m.value,!0)<<32),m.value+=8,B};function je(d,m){const B=d.getFloat32(m.value,!0);return m.value+=4,B}function No(d,m){return As.toHalfFloat(je(d,m))}function H(d){const m=(d&31744)>>10,B=d&1023;return(d>>15?-1:1)*(m?m===31?B?NaN:1/0:Math.pow(2,m-15)*(1+B/1024):6103515625e-14*(B/1024))}function us(d,m){const B=d.getUint16(m.value,!0);return m.value+=2,B}function Uo(d,m){return H(us(d,m))}function Go(d,m,B,Q){const R=B.value,v=[];for(;B.value<R+Q-1;){const _=ze(m,B),L=Ne(d,B),F=Ke(d,B);B.value+=3;const k=Ne(d,B),D=Ne(d,B);v.push({name:_,pixelType:L,pLinear:F,xSampling:k,ySampling:D})}return B.value+=1,v}function Po(d,m){const B=je(d,m),Q=je(d,m),R=je(d,m),v=je(d,m),_=je(d,m),L=je(d,m),F=je(d,m),k=je(d,m);return{redX:B,redY:Q,greenX:R,greenY:v,blueX:_,blueY:L,whiteX:F,whiteY:k}}function Oo(d,m){const B=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],Q=Ke(d,m);return B[Q]}function Ho(d,m){const B=Ne(d,m),Q=Ne(d,m),R=Ne(d,m),v=Ne(d,m);return{xMin:B,yMin:Q,xMax:R,yMax:v}}function jo(d,m){const B=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],Q=Ke(d,m);return B[Q]}function qo(d,m){const B=["ENVMAP_LATLONG","ENVMAP_CUBE"],Q=Ke(d,m);return B[Q]}function zo(d,m){const B=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],Q=["ROUND_DOWN","ROUND_UP"],R=_e(d,m),v=_e(d,m),_=Ke(d,m);return{xSize:R,ySize:v,levelMode:B[_&15],roundingMode:Q[_>>4]}}function Ko(d,m){const B=je(d,m),Q=je(d,m);return[B,Q]}function Yo(d,m){const B=je(d,m),Q=je(d,m),R=je(d,m);return[B,Q,R]}function Jo(d,m,B,Q,R){if(Q==="string"||Q==="stringvector"||Q==="iccProfile")return Nt(m,B,R);if(Q==="chlist")return Go(d,m,B,R);if(Q==="chromaticities")return Po(d,B);if(Q==="compression")return Oo(d,B);if(Q==="box2i")return Ho(d,B);if(Q==="envmap")return qo(d,B);if(Q==="tiledesc")return zo(d,B);if(Q==="lineOrder")return jo(d,B);if(Q==="float")return je(d,B);if(Q==="v2f")return Ko(d,B);if(Q==="v3f")return Yo(d,B);if(Q==="int")return Ne(d,B);if(Q==="rational")return Ut(d,B);if(Q==="timecode")return as(d,B);if(Q==="preview")return B.value+=R,"skipped";B.value+=R}function Wo(d,m){const B=Math.log2(d);return m=="ROUND_DOWN"?Math.floor(B):Math.ceil(B)}function Vo(d,m,B){let Q=0;switch(d.levelMode){case"ONE_LEVEL":Q=1;break;case"MIPMAP_LEVELS":Q=Wo(Math.max(m,B),d.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return Q}function Ti(d,m,B,Q){const R=new Array(d);for(let v=0;v<d;v++){const _=1<<v;let L=m/_|0;Q=="ROUND_UP"&&L*_<m&&(L+=1);const F=Math.max(L,1);R[v]=(F+B-1)/B|0}return R}function Xo(){const d=this,m=d.offset,B={value:0};for(let Q=0;Q<d.tileCount;Q++){const R=Ne(d.viewer,m),v=Ne(d.viewer,m);m.value+=8,d.size=_e(d.viewer,m);const _=R*d.blockWidth,L=v*d.blockHeight;d.columns=_+d.blockWidth>d.width?d.width-_:d.blockWidth,d.lines=L+d.blockHeight>d.height?d.height-L:d.blockHeight;const F=d.columns*d.totalBytes,k=d.size<d.lines*F?d.uncompress(d):Re(d);m.value+=d.size;for(let D=0;D<d.lines;D++){const G=D*d.columns*d.totalBytes;for(let U=0;U<d.inputChannels.length;U++){const z=Yt.channels[U].name,Z=d.channelByteOffsets[z]*d.columns,P=d.decodeChannels[z];if(P===void 0)continue;B.value=G+Z;const Y=(d.height-(1+L+D))*d.outLineWidth;for(let te=0;te<d.columns;te++){const Ee=Y+(te+_)*d.outputChannels+P;d.byteArray[Ee]=d.getter(k,B)}}}}}function Zo(){const d=this,m=d.offset,B={value:0};for(let Q=0;Q<d.height/d.blockHeight;Q++){const R=Ne(d.viewer,m)-Yt.dataWindow.yMin;d.size=_e(d.viewer,m),d.lines=R+d.blockHeight>d.height?d.height-R:d.blockHeight;const v=d.columns*d.totalBytes,_=d.size<d.lines*v?d.uncompress(d):Re(d);m.value+=d.size;for(let L=0;L<d.blockHeight;L++){const F=Q*d.blockHeight,k=L+d.scanOrder(F);if(k>=d.height)continue;const D=L*v,G=(d.height-1-k)*d.outLineWidth;for(let U=0;U<d.inputChannels.length;U++){const z=Yt.channels[U].name,Z=d.channelByteOffsets[z]*d.columns,P=d.decodeChannels[z];if(P!==void 0){B.value=D+Z;for(let Y=0;Y<d.columns;Y++){const te=G+Y*d.outputChannels+P;d.byteArray[te]=d.getter(_,B)}}}}}}function $o(d,m,B){const Q={};if(d.getUint32(0,!0)!=20000630)throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");Q.version=d.getUint8(4);const R=d.getUint8(5);Q.spec={singleTile:!!(R&2),longName:!!(R&4),deepFormat:!!(R&8),multiPart:!!(R&16)},B.value=8;let v=!0;for(;v;){const _=ze(m,B);if(_==0)v=!1;else{const L=ze(m,B),F=_e(d,B),k=Jo(d,m,B,L,F);k===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${L}'.`):Q[_]=k}}if((R&-7)!=0)throw console.error("THREE.EXRHeader:",Q),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return Q}function er(d,m,B,Q,R){const v={size:0,viewer:m,array:B,offset:Q,width:d.dataWindow.xMax-d.dataWindow.xMin+1,height:d.dataWindow.yMax-d.dataWindow.yMin+1,inputChannels:d.channels,channelByteOffsets:{},scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:Ve};switch(d.compression){case"NO_COMPRESSION":v.blockHeight=1,v.uncompress=Re;break;case"RLE_COMPRESSION":v.blockHeight=1,v.uncompress=se;break;case"ZIPS_COMPRESSION":v.blockHeight=1,v.uncompress=oe;break;case"ZIP_COMPRESSION":v.blockHeight=16,v.uncompress=oe;break;case"PIZ_COMPRESSION":v.blockHeight=32,v.uncompress=Ae;break;case"PXR24_COMPRESSION":v.blockHeight=16,v.uncompress=Te;break;case"DWAA_COMPRESSION":v.blockHeight=32,v.uncompress=fe;break;case"DWAB_COMPRESSION":v.blockHeight=256,v.uncompress=fe;break;default:throw new Error("EXRLoader.parse: "+d.compression+" is unsupported")}const _={};for(const D of d.channels)switch(D.name){case"Y":case"R":case"G":case"B":case"A":_[D.name]=!0,v.type=D.pixelType}let L=!1;if(_.R&&_.G&&_.B)L=!_.A,v.outputChannels=4,v.decodeChannels={R:0,G:1,B:2,A:3};else if(_.Y)v.outputChannels=1,v.decodeChannels={Y:0};else throw new Error("EXRLoader.parse: file contains unsupported data channels.");if(v.type==1)switch(R){case mt:v.getter=Uo;break;case Ze:v.getter=us;break}else if(v.type==2)switch(R){case mt:v.getter=je;break;case Ze:v.getter=No}else throw new Error("EXRLoader.parse: unsupported pixelType "+v.type+" for "+d.compression+".");v.columns=v.width;const F=v.width*v.height*v.outputChannels;switch(R){case mt:v.byteArray=new Float32Array(F),L&&v.byteArray.fill(1,0,F);break;case Ze:v.byteArray=new Uint16Array(F),L&&v.byteArray.fill(15360,0,F);break;default:console.error("THREE.EXRLoader: unsupported type: ",R);break}let k=0;for(const D of d.channels)v.decodeChannels[D.name]!==void 0&&(v.channelByteOffsets[D.name]=k),k+=D.pixelType*2;if(v.totalBytes=k,v.outLineWidth=v.width*v.outputChannels,d.lineOrder==="INCREASING_Y"?v.scanOrder=D=>D:v.scanOrder=D=>v.height-1-D,v.outputChannels==4?(v.format=Pt,v.colorSpace=Ve):(v.format=rs,v.colorSpace=tn),d.spec.singleTile){v.blockHeight=d.tiles.ySize,v.blockWidth=d.tiles.xSize;const D=Vo(d.tiles,v.width,v.height),G=Ti(D,v.width,d.tiles.xSize,d.tiles.roundingMode),U=Ti(D,v.height,d.tiles.ySize,d.tiles.roundingMode);v.tileCount=G[0]*U[0];for(let z=0;z<D;z++)for(let Z=0;Z<U[z];Z++)for(let P=0;P<G[z];P++)Ue(m,Q);v.decode=Xo.bind(v)}else{v.blockWidth=v.width;const D=Math.ceil(v.height/v.blockHeight);for(let G=0;G<D;G++)Ue(m,Q);v.decode=Zo.bind(v)}return v}const Ri={value:0},Di=new DataView(e),tr=new Uint8Array(e),Yt=$o(Di,e,Ri),os=er(Yt,Di,tr,Ri,this.type);return os.decode(),{header:Yt,width:os.width,height:os.height,data:os.byteArray,format:os.format,colorSpace:os.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,n,s){function i(a,r){a.colorSpace=r.colorSpace,a.minFilter=at,a.magFilter=at,a.generateMipmaps=!1,a.flipY=!1,t&&t(a,r)}return super.load(e,i,n,s)}}const Dc=Object.freeze(Object.defineProperty({__proto__:null,EXRLoader:eo},Symbol.toStringTag,{value:"Module"}));class to extends Wi{constructor(e){super(e),this.type=Ze}parse(e){const t=function(f,E){switch(f){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(E||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(E||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(E||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(E||""))}},n=function(f,E,C){E=E||1024;let I=f.pos,y=-1,w=0,x="",T=String.fromCharCode.apply(null,new Uint16Array(f.subarray(I,I+128)));for(;0>(y=T.indexOf(`
|
|
42
|
-
`))&&w<E&&I<f.byteLength;)x+=T,w+=T.length,I+=128,T+=String.fromCharCode.apply(null,new Uint16Array(f.subarray(I,I+128)));return-1<y?(f.pos+=w+y+1,x+T.slice(0,y)):!1},s=function(f){const E=/^#\?(\S+)/,C=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,I=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,y=/^\s*FORMAT=(\S+)\s*$/,w=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,x={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let T,S;for((f.pos>=f.byteLength||!(T=n(f)))&&t(1,"no header found"),(S=T.match(E))||t(3,"bad initial token"),x.valid|=1,x.programtype=S[1],x.string+=T+`
|
|
43
|
-
`;T=n(f),T!==!1;){if(x.string+=T+`
|
|
44
|
-
`,T.charAt(0)==="#"){x.comments+=T+`
|
|
45
|
-
`;continue}if((S=T.match(C))&&(x.gamma=parseFloat(S[1])),(S=T.match(I))&&(x.exposure=parseFloat(S[1])),(S=T.match(y))&&(x.valid|=2,x.format=S[1]),(S=T.match(w))&&(x.valid|=4,x.height=parseInt(S[1],10),x.width=parseInt(S[2],10)),x.valid&2&&x.valid&4)break}return x.valid&2||t(3,"missing format specifier"),x.valid&4||t(3,"missing image size specifier"),x},i=function(f,E,C){const I=E;if(I<8||I>32767||f[0]!==2||f[1]!==2||f[2]&128)return new Uint8Array(f);I!==(f[2]<<8|f[3])&&t(3,"wrong scanline width");const y=new Uint8Array(4*E*C);y.length||t(4,"unable to allocate buffer space");let w=0,x=0;const T=4*I,S=new Uint8Array(4),M=new Uint8Array(T);let j=C;for(;j>0&&x<f.byteLength;){x+4>f.byteLength&&t(1),S[0]=f[x++],S[1]=f[x++],S[2]=f[x++],S[3]=f[x++],(S[0]!=2||S[1]!=2||(S[2]<<8|S[3])!=I)&&t(3,"bad rgbe scanline format");let K=0,J;for(;K<T&&x<f.byteLength;){J=f[x++];const q=J>128;if(q&&(J-=128),(J===0||K+J>T)&&t(3,"bad scanline data"),q){const X=f[x++];for(let W=0;W<J;W++)M[K++]=X}else M.set(f.subarray(x,x+J),K),K+=J,x+=J}const V=I;for(let q=0;q<V;q++){let X=0;y[w]=M[q+X],X+=I,y[w+1]=M[q+X],X+=I,y[w+2]=M[q+X],X+=I,y[w+3]=M[q+X],w+=4}j--}return y},a=function(f,E,C,I){const y=f[E+3],w=Math.pow(2,y-128)/255;C[I+0]=f[E+0]*w,C[I+1]=f[E+1]*w,C[I+2]=f[E+2]*w,C[I+3]=1},r=function(f,E,C,I){const y=f[E+3],w=Math.pow(2,y-128)/255;C[I+0]=As.toHalfFloat(Math.min(f[E+0]*w,65504)),C[I+1]=As.toHalfFloat(Math.min(f[E+1]*w,65504)),C[I+2]=As.toHalfFloat(Math.min(f[E+2]*w,65504)),C[I+3]=As.toHalfFloat(1)},A=new Uint8Array(e);A.pos=0;const c=s(A),l=c.width,h=c.height,p=i(A.subarray(A.pos),l,h);let g,u,b;switch(this.type){case mt:b=p.length/4;const f=new Float32Array(b*4);for(let C=0;C<b;C++)a(p,C*4,f,C*4);g=f,u=mt;break;case Ze:b=p.length/4;const E=new Uint16Array(b*4);for(let C=0;C<b;C++)r(p,C*4,E,C*4);g=E,u=Ze;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:l,height:h,data:g,header:c.string,gamma:c.gamma,exposure:c.exposure,type:u}}setDataType(e){return this.type=e,this}load(e,t,n,s){function i(a,r){switch(a.type){case mt:case Ze:a.colorSpace=Ve,a.minFilter=at,a.magFilter=at,a.generateMipmaps=!1,a.flipY=!0;break}t&&t(a,r)}return super.load(e,i,n,s)}}const kc=Object.freeze(Object.defineProperty({__proto__:null,RGBELoader:to},Symbol.toStringTag,{value:"Module"}));function so(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,i=n,a=Math.floor((s+i)/2);for(;e<t[a]||e>=t[a+1];)e<t[a]?i=a:s=a,a=Math.floor((s+i)/2);return a}function Mc(o,e,t,n){const s=[],i=[],a=[];s[0]=1;for(let r=1;r<=t;++r){i[r]=e-n[o+1-r],a[r]=n[o+r]-e;let A=0;for(let c=0;c<r;++c){const l=a[c+1],h=i[r-c],p=s[c]/(l+h);s[c]=A+l*p,A=h*p}s[r]=A}return s}function _c(o,e,t,n){const s=so(o,n,e),i=Mc(s,n,o,e),a=new Mt(0,0,0,0);for(let r=0;r<=o;++r){const A=t[s-o+r],c=i[r],l=A.w*c;a.x+=A.x*l,a.y+=A.y*l,a.z+=A.z*l,a.w+=A.w*c}return a}function Fc(o,e,t,n,s){const i=[];for(let h=0;h<=t;++h)i[h]=0;const a=[];for(let h=0;h<=n;++h)a[h]=i.slice(0);const r=[];for(let h=0;h<=t;++h)r[h]=i.slice(0);r[0][0]=1;const A=i.slice(0),c=i.slice(0);for(let h=1;h<=t;++h){A[h]=e-s[o+1-h],c[h]=s[o+h]-e;let p=0;for(let g=0;g<h;++g){const u=c[g+1],b=A[h-g];r[h][g]=u+b;const f=r[g][h-1]/r[h][g];r[g][h]=p+u*f,p=b*f}r[h][h]=p}for(let h=0;h<=t;++h)a[0][h]=r[h][t];for(let h=0;h<=t;++h){let p=0,g=1;const u=[];for(let b=0;b<=t;++b)u[b]=i.slice(0);u[0][0]=1;for(let b=1;b<=n;++b){let f=0;const E=h-b,C=t-b;h>=b&&(u[g][0]=u[p][0]/r[C+1][E],f=u[g][0]*r[E][C]);const I=E>=-1?1:-E,y=h-1<=C?b-1:t-h;for(let x=I;x<=y;++x)u[g][x]=(u[p][x]-u[p][x-1])/r[C+1][E+x],f+=u[g][x]*r[E+x][C];h<=C&&(u[g][b]=-u[p][b-1]/r[C+1][h],f+=u[g][b]*r[h][C]),a[b][h]=f;const w=p;p=g,g=w}}let l=t;for(let h=1;h<=n;++h){for(let p=0;p<=t;++p)a[h][p]*=l;l*=t-h}return a}function Lc(o,e,t,n,s){const i=s<o?s:o,a=[],r=so(o,n,e),A=Fc(r,n,o,i,e),c=[];for(let l=0;l<t.length;++l){const h=t[l].clone(),p=h.w;h.x*=p,h.y*=p,h.z*=p,c[l]=h}for(let l=0;l<=i;++l){const h=c[r-o].clone().multiplyScalar(A[l][0]);for(let p=1;p<=o;++p)h.add(c[r-o+p].clone().multiplyScalar(A[l][p]));a[l]=h}for(let l=i+1;l<=s+1;++l)a[l]=new Mt(0,0,0);return a}function Nc(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 Uc(o){const e=o.length,t=[],n=[];for(let i=0;i<e;++i){const a=o[i];t[i]=new N(a.x,a.y,a.z),n[i]=a.w}const s=[];for(let i=0;i<e;++i){const a=t[i].clone();for(let r=1;r<=i;++r)a.sub(s[i-r].clone().multiplyScalar(Nc(i,r)*n[r]));s[i]=a.divideScalar(n[0])}return s}function Gc(o,e,t,n,s){const i=Lc(o,e,t,n,s);return Uc(i)}class Pc extends Qr{constructor(e,t,n,s,i){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=s||0,this.endKnot=i||this.knots.length-1;for(let a=0;a<n.length;++a){const r=n[a];this.controlPoints[a]=new Mt(r.x,r.y,r.z,r.w)}}getPoint(e,t=new N){const n=t,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=_c(this.degree,this.knots,this.controlPoints,s);return i.w!==1&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}getTangent(e,t=new N){const n=t,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Gc(this.degree,this.knots,this.controlPoints,s,1);return n.copy(i[1]).normalize(),n}}let ne,Se,We;class Oc extends Dt{constructor(e){super(e)}load(e,t,n,s){const i=this,a=i.path===""?Wt.extractUrlBase(e):i.path,r=new gt(this.manager);r.setPath(i.path),r.setResponseType("arraybuffer"),r.setRequestHeader(i.requestHeader),r.setWithCredentials(i.withCredentials),r.load(e,function(A){try{t(i.parse(A,a))}catch(c){s?s(c):console.error(c),i.manager.itemError(e)}},n,s)}parse(e,t){if(Yc(e))ne=new Kc().parse(e);else{const s=ro(e);if(!Jc(s))throw new Error("THREE.FBXLoader: Unknown format.");if(ao(s)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+ao(s));ne=new zc().parse(s)}const n=new Bn(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Hc(n,this.manager).parse(ne)}getFbxTree(){return ne}}class Hc{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Se=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),s=this.parseDeformers(),i=new jc().parse(s);return this.parseScene(s,i,n),We}parseConnections(){const e=new Map;return"Connections"in ne&&ne.Connections.connections.forEach(function(t){const n=t[0],s=t[1],i=t[2];e.has(n)||e.set(n,{parents:[],children:[]});const a={ID:s,relationship:i};e.get(n).parents.push(a),e.has(s)||e.set(s,{parents:[],children:[]});const r={ID:n,relationship:i};e.get(s).children.push(r)}),e}parseImages(){const e={},t={};if("Video"in ne.Objects){const n=ne.Objects.Video;for(const s in n){const i=n[s],a=parseInt(s);if(e[a]=i.RelativeFilename||i.Filename,"Content"in i){const r=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,A=typeof i.Content=="string"&&i.Content!=="";if(r||A){const c=this.parseImage(n[s]);t[i.RelativeFilename||i.Filename]=c}}}}for(const n in e){const s=e[n];t[s]!==void 0?e[n]=t[s]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,s=n.slice(n.lastIndexOf(".")+1).toLowerCase();let i;switch(s){case"bmp":i="image/bmp";break;case"jpg":case"jpeg":i="image/jpeg";break;case"png":i="image/png";break;case"tif":i="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),i="image/tga";break;default:console.warn('FBXLoader: Image type "'+s+'" is not supported.');return}if(typeof t=="string")return"data:"+i+";base64,"+t;{const a=new Uint8Array(t);return window.URL.createObjectURL(new Blob([a],{type:i}))}}parseTextures(e){const t=new Map;if("Texture"in ne.Objects){const n=ne.Objects.Texture;for(const s in n){const i=this.parseTexture(n[s],e);t.set(parseInt(s),i)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const s=e.WrapModeU,i=e.WrapModeV,a=s!==void 0?s.value:0,r=i!==void 0?i.value:0;if(n.wrapS=a===0?Vt:Ys,n.wrapT=r===0?Vt:Ys,"Scaling"in e){const A=e.Scaling.value;n.repeat.x=A[0],n.repeat.y=A[1]}if("Translation"in e){const A=e.Translation.value;n.offset.x=A[0],n.offset.y=A[1]}return n}loadTexture(e,t){const n=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),s=e.FileName.split(".").pop().toLowerCase(),i=n.has(s)?this.manager.getHandler(`.${s}`):this.textureLoader;if(!i)return console.warn(`FBXLoader: ${s.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new Rn;const a=i.path;a||i.setPath(this.textureLoader.path);const r=Se.get(e.id).children;let A;r!==void 0&&r.length>0&&t[r[0].ID]!==void 0&&(A=t[r[0].ID],(A.indexOf("blob:")===0||A.indexOf("data:")===0)&&i.setPath(void 0));const c=i.load(A);return i.setPath(a),c}parseMaterials(e){const t=new Map;if("Material"in ne.Objects){const n=ne.Objects.Material;for(const s in n){const i=this.parseMaterial(n[s],e);i!==null&&t.set(parseInt(s),i)}}return t}parseMaterial(e,t){const n=e.id,s=e.attrName;let i=e.ShadingModel;if(typeof i=="object"&&(i=i.value),!Se.has(n))return null;const a=this.parseParameters(e,t,n);let r;switch(i.toLowerCase()){case"phong":r=new ys;break;case"lambert":r=new vr;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),r=new ys;break}return r.setValues(a),r.name=s,r}parseParameters(e,t,n){const s={};e.BumpFactor&&(s.bumpScale=e.BumpFactor.value),e.Diffuse?s.color=Xe.toWorkingColorSpace(new we().fromArray(e.Diffuse.value),le):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(s.color=Xe.toWorkingColorSpace(new we().fromArray(e.DiffuseColor.value),le)),e.DisplacementFactor&&(s.displacementScale=e.DisplacementFactor.value),e.Emissive?s.emissive=Xe.toWorkingColorSpace(new we().fromArray(e.Emissive.value),le):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(s.emissive=Xe.toWorkingColorSpace(new we().fromArray(e.EmissiveColor.value),le)),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=Xe.toWorkingColorSpace(new we().fromArray(e.Specular.value),le):e.SpecularColor&&e.SpecularColor.type==="Color"&&(s.specular=Xe.toWorkingColorSpace(new we().fromArray(e.SpecularColor.value),le));const i=this;return Se.get(n).children.forEach(function(a){const r=a.relationship;switch(r){case"Bump":s.bumpMap=i.getTexture(t,a.ID);break;case"Maya|TEX_ao_map":s.aoMap=i.getTexture(t,a.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":s.map=i.getTexture(t,a.ID),s.map!==void 0&&(s.map.colorSpace=le);break;case"DisplacementColor":s.displacementMap=i.getTexture(t,a.ID);break;case"EmissiveColor":s.emissiveMap=i.getTexture(t,a.ID),s.emissiveMap!==void 0&&(s.emissiveMap.colorSpace=le);break;case"NormalMap":case"Maya|TEX_normal_map":s.normalMap=i.getTexture(t,a.ID);break;case"ReflectionColor":s.envMap=i.getTexture(t,a.ID),s.envMap!==void 0&&(s.envMap.mapping=xr,s.envMap.colorSpace=le);break;case"SpecularColor":s.specularMap=i.getTexture(t,a.ID),s.specularMap!==void 0&&(s.specularMap.colorSpace=le);break;case"TransparentColor":case"TransparencyFactor":s.alphaMap=i.getTexture(t,a.ID),s.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r);break}}),s}getTexture(e,t){return"LayeredTexture"in ne.Objects&&t in ne.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Se.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in ne.Objects){const n=ne.Objects.Deformer;for(const s in n){const i=n[s],a=Se.get(parseInt(s));if(i.attrType==="Skin"){const r=this.parseSkeleton(a,n);r.ID=s,a.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),r.geometryID=a.parents[0].ID,e[s]=r}else if(i.attrType==="BlendShape"){const r={id:s};r.rawTargets=this.parseMorphTargets(a,n),r.id=s,a.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[s]=r}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(s){const i=t[s.ID];if(i.attrType!=="Cluster")return;const a={ID:s.ID,indices:[],weights:[],transformLink:new ce().fromArray(i.TransformLink.a)};"Indexes"in i&&(a.indices=i.Indexes.a,a.weights=i.Weights.a),n.push(a)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let s=0;s<e.children.length;s++){const i=e.children[s],a=t[i.ID],r={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if(a.attrType!=="BlendShapeChannel")return;r.geoID=Se.get(parseInt(i.ID)).children.filter(function(A){return A.relationship===void 0})[0].ID,n.push(r)}return n}parseScene(e,t,n){We=new Xt;const s=this.parseModels(e.skeletons,t,n),i=ne.Objects.Model,a=this;s.forEach(function(A){const c=i[A.ID];a.setLookAtProperties(A,c),Se.get(A.ID)?.parents?.forEach(function(l){const h=s.get(l.ID);h!==void 0&&h.add(A)}),A.parent===null&&We.add(A)}),this.bindSkeleton(e.skeletons,t,s),this.addGlobalSceneSettings(),We.traverse(function(A){if(A.userData.transformData){A.parent&&(A.userData.transformData.parentMatrix=A.parent.matrix,A.userData.transformData.parentMatrixWorld=A.parent.matrixWorld);const c=oo(A.userData.transformData);A.applyMatrix4(c),A.updateWorldMatrix()}A.isSkinnedMesh&&(A.computeBoundingBox(),A.computeBoundingSphere(),A.boundingBox.expandByScalar(3),A.boundingSphere.radius*=3)});const r=new qc().parse();We.children.length===1&&We.children[0].isGroup&&(We.children[0].animations=r,We=We.children[0]),We.animations=r}parseModels(e,t,n){const s=new Map,i=ne.Objects.Model;for(const a in i){const r=parseInt(a),A=i[a],c=Se.get(r);let l=this.buildSkeleton(c,e,r,A.attrName);if(!l){switch(A.attrType){case"Camera":l=this.createCamera(c);break;case"Light":l=this.createLight(c);break;case"Mesh":l=this.createMesh(c,t,n);break;case"NurbsCurve":l=this.createCurve(c,t);break;case"LimbNode":case"Root":l=new Sn;break;case"Null":default:l=new Xt;break}l.name=A.attrName?ut.sanitizeNodeName(A.attrName):"",l.userData.originalName=A.attrName,l.ID=r}this.getTransformData(l,A),s.set(r,l)}return s}buildSkeleton(e,t,n,s){let i=null;return e?.parents.forEach(function(a){for(const r in t){const A=t[r];A.rawBones.forEach(function(c,l){if(c.ID===a.ID){const h=i;i=new Sn,i.matrixWorld.copy(c.transformLink),i.name=s?ut.sanitizeNodeName(s):"",i.userData.originalName=s,i.ID=n,A.bones[l]=i,h!==null&&i.add(h)}})}}),i}createCamera(e){let t,n;if(e.children.forEach(function(s){const i=ne.Objects.NodeAttribute[s.ID];i!==void 0&&(n=i)}),n===void 0)t=new yt;else{let s=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(s=1);let i=1;n.NearPlane!==void 0&&(i=n.NearPlane.value/1e3);let a=1e3;n.FarPlane!==void 0&&(a=n.FarPlane.value/1e3);let r=window.innerWidth,A=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(r=n.AspectWidth.value,A=n.AspectHeight.value);const c=r/A;let l=45;n.FieldOfView!==void 0&&(l=n.FieldOfView.value);const h=n.FocalLength?n.FocalLength.value:null;switch(s){case 0:t=new qs(l,c,i,a),h!==null&&t.setFocalLength(h);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),t=new yt;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),t=new yt;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(s){const i=ne.Objects.NodeAttribute[s.ID];i!==void 0&&(n=i)}),n===void 0)t=new yt;else{let s;n.LightType===void 0?s=0:s=n.LightType.value;let i=16777215;n.Color!==void 0&&(i=Xe.toWorkingColorSpace(new we().fromArray(n.Color.value),le));let a=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(a=0);let r=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?r=0:r=n.FarAttenuationEnd.value);const A=1;switch(s){case 0:t=new Cn(i,a,r,A);break;case 1:t=new _i(i,a);break;case 2:let c=Math.PI/3;n.InnerAngle!==void 0&&(c=Ce.degToRad(n.InnerAngle.value));let l=0;n.OuterAngle!==void 0&&(l=Ce.degToRad(n.OuterAngle.value),l=Math.max(l,1)),t=new Mi(i,a,r,c,l,A);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new Cn(i,a);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let s,i=null,a=null;const r=[];if(e.children.forEach(function(A){t.has(A.ID)&&(i=t.get(A.ID)),n.has(A.ID)&&r.push(n.get(A.ID))}),r.length>1?a=r:r.length>0?a=r[0]:(a=new ys({name:Dt.DEFAULT_MATERIAL_NAME,color:13421772}),r.push(a)),"color"in i.attributes&&r.forEach(function(A){A.vertexColors=!0}),i.groups.length>0){let A=!1;for(let c=0,l=i.groups.length;c<l;c++){const h=i.groups[c];(h.materialIndex<0||h.materialIndex>=r.length)&&(h.materialIndex=r.length,A=!0)}if(A){const c=new yn;r.push(c)}}return i.FBX_Deformer?(s=new vn(i,a),s.normalizeSkinWeights()):s=new O(i,a),s}createCurve(e,t){const n=e.children.reduce(function(i,a){return t.has(a.ID)&&(i=t.get(a.ID)),i},null),s=new kt({name:Dt.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new ft(n,s)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Us(t.RotationOrder.value):n.eulerOrder=Us(0),"Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Se.get(e.ID).children.forEach(function(n){if(n.relationship==="LookAtProperty"){const s=ne.Objects.Model[n.ID];if("Lcl_Translation"in s){const i=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),We.add(e.target)):e.lookAt(new N().fromArray(i))}}})}bindSkeleton(e,t,n){const s=this.parsePoseNodes();for(const i in e){const a=e[i];Se.get(parseInt(a.ID)).parents.forEach(function(r){if(t.has(r.ID)){const A=r.ID;Se.get(A).parents.forEach(function(c){n.has(c.ID)&&n.get(c.ID).bind(new Gi(a.bones),s[c.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in ne.Objects){const t=ne.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const s=t[n].PoseNode;Array.isArray(s)?s.forEach(function(i){e[i.Node]=new ce().fromArray(i.Matrix.a)}):e[s.Node]=new ce().fromArray(s.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in ne){if("AmbientColor"in ne.GlobalSettings){const e=ne.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],s=e[2];if(t!==0||n!==0||s!==0){const i=new we().setRGB(t,n,s,le);We.add(new Sr(i,1))}}"UnitScaleFactor"in ne.GlobalSettings&&(We.userData.unitScaleFactor=ne.GlobalSettings.UnitScaleFactor.value)}}}class jc{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in ne.Objects){const n=ne.Objects.Geometry;for(const s in n){const i=Se.get(parseInt(s)),a=this.parseGeometry(i,n[s],e);t.set(parseInt(s),a)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const s=n.skeletons,i=[],a=e.parents.map(function(h){return ne.Objects.Model[h.ID]});if(a.length===0)return;const r=e.children.reduce(function(h,p){return s[p.ID]!==void 0&&(h=s[p.ID]),h},null);e.children.forEach(function(h){n.morphTargets[h.ID]!==void 0&&i.push(n.morphTargets[h.ID])});const A=a[0],c={};"RotationOrder"in A&&(c.eulerOrder=Us(A.RotationOrder.value)),"InheritType"in A&&(c.inheritType=parseInt(A.InheritType.value)),"GeometricTranslation"in A&&(c.translation=A.GeometricTranslation.value),"GeometricRotation"in A&&(c.rotation=A.GeometricRotation.value),"GeometricScaling"in A&&(c.scale=A.GeometricScaling.value);const l=oo(c);return this.genGeometry(t,r,i,l)}genGeometry(e,t,n,s){const i=new ct;e.attrName&&(i.name=e.attrName);const a=this.parseGeoNode(e,t),r=this.genBuffers(a),A=new ke(r.vertex,3);if(A.applyMatrix4(s),i.setAttribute("position",A),r.colors.length>0&&i.setAttribute("color",new ke(r.colors,3)),t&&(i.setAttribute("skinIndex",new Tr(r.weightsIndices,4)),i.setAttribute("skinWeight",new ke(r.vertexWeights,4)),i.FBX_Deformer=t),r.normal.length>0){const c=new Vi().getNormalMatrix(s),l=new ke(r.normal,3);l.applyNormalMatrix(c),i.setAttribute("normal",l)}if(r.uvs.forEach(function(c,l){const h=l===0?"uv":`uv${l}`;i.setAttribute(h,new ke(r.uvs[l],2))}),a.material&&a.material.mappingType!=="AllSame"){let c=r.materialIndex[0],l=0;if(r.materialIndex.forEach(function(h,p){h!==c&&(i.addGroup(l,p-l,c),c=h,l=p)}),i.groups.length>0){const h=i.groups[i.groups.length-1],p=h.start+h.count;p!==r.materialIndex.length&&i.addGroup(p,r.materialIndex.length-p,c)}i.groups.length===0&&i.addGroup(0,r.materialIndex.length,r.materialIndex[0])}return this.addMorphTargets(i,e,n,s),i}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let s=0;for(;e.LayerElementUV[s];)e.LayerElementUV[s].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[s])),s++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(s,i){s.indices.forEach(function(a,r){n.weightTable[a]===void 0&&(n.weightTable[a]=[]),n.weightTable[a].push({id:i,weight:s.weights[r]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,s=0,i=!1,a=[],r=[],A=[],c=[],l=[],h=[];const p=this;return e.vertexIndices.forEach(function(g,u){let b,f=!1;g<0&&(g=g^-1,f=!0);let E=[],C=[];if(a.push(g*3,g*3+1,g*3+2),e.color){const I=ln(u,n,g,e.color);A.push(I[0],I[1],I[2])}if(e.skeleton){if(e.weightTable[g]!==void 0&&e.weightTable[g].forEach(function(I){C.push(I.weight),E.push(I.id)}),C.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);const I=[0,0,0,0],y=[0,0,0,0];C.forEach(function(w,x){let T=w,S=E[x];y.forEach(function(M,j,K){if(T>M){K[j]=T,T=M;const J=I[j];I[j]=S,S=J}})}),E=I,C=y}for(;C.length<4;)C.push(0),E.push(0);for(let I=0;I<4;++I)l.push(C[I]),h.push(E[I])}if(e.normal){const I=ln(u,n,g,e.normal);r.push(I[0],I[1],I[2])}e.material&&e.material.mappingType!=="AllSame"&&(b=ln(u,n,g,e.material)[0],b<0&&(p.negativeMaterialIndices=!0,b=0)),e.uv&&e.uv.forEach(function(I,y){const w=ln(u,n,g,I);c[y]===void 0&&(c[y]=[]),c[y].push(w[0]),c[y].push(w[1])}),s++,f&&(p.genFace(t,e,a,b,r,A,c,l,h,s),n++,s=0,a=[],r=[],A=[],c=[],l=[],h=[])}),t}getNormalNewell(e){const t=new N(0,0,0);for(let n=0;n<e.length;n++){const s=e[n],i=e[(n+1)%e.length];t.x+=(s.y-i.y)*(s.z+i.z),t.y+=(s.z-i.z)*(s.x+i.x),t.z+=(s.x-i.x)*(s.y+i.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){const t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new N(0,1,0):new N(0,0,1)).cross(t).normalize(),s=t.clone().cross(n).normalize();return{normal:t,tangent:n,bitangent:s}}flattenVertex(e,t,n){return new Le(e.dot(t),e.dot(n))}genFace(e,t,n,s,i,a,r,A,c,l){let h;if(l>3){const p=[],g=t.baseVertexPositions||t.vertexPositions;for(let E=0;E<n.length;E+=3)p.push(new N(g[n[E]],g[n[E+1]],g[n[E+2]]));const{tangent:u,bitangent:b}=this.getNormalTangentAndBitangent(p),f=[];for(const E of p)f.push(this.flattenVertex(E,u,b));h=Rr.triangulateShape(f,[])}else l===2?(console.warn("THREE.FBXLoader: Edge topology detected. This is currently not supported. The resulting mesh will not be correct."),h=[[0,1,2]]):h=[[0,1,2]];for(const[p,g,u]of h)e.vertex.push(t.vertexPositions[n[p*3]]),e.vertex.push(t.vertexPositions[n[p*3+1]]),e.vertex.push(t.vertexPositions[n[p*3+2]]),e.vertex.push(t.vertexPositions[n[g*3]]),e.vertex.push(t.vertexPositions[n[g*3+1]]),e.vertex.push(t.vertexPositions[n[g*3+2]]),e.vertex.push(t.vertexPositions[n[u*3]]),e.vertex.push(t.vertexPositions[n[u*3+1]]),e.vertex.push(t.vertexPositions[n[u*3+2]]),t.skeleton&&(e.vertexWeights.push(A[p*4]),e.vertexWeights.push(A[p*4+1]),e.vertexWeights.push(A[p*4+2]),e.vertexWeights.push(A[p*4+3]),e.vertexWeights.push(A[g*4]),e.vertexWeights.push(A[g*4+1]),e.vertexWeights.push(A[g*4+2]),e.vertexWeights.push(A[g*4+3]),e.vertexWeights.push(A[u*4]),e.vertexWeights.push(A[u*4+1]),e.vertexWeights.push(A[u*4+2]),e.vertexWeights.push(A[u*4+3]),e.weightsIndices.push(c[p*4]),e.weightsIndices.push(c[p*4+1]),e.weightsIndices.push(c[p*4+2]),e.weightsIndices.push(c[p*4+3]),e.weightsIndices.push(c[g*4]),e.weightsIndices.push(c[g*4+1]),e.weightsIndices.push(c[g*4+2]),e.weightsIndices.push(c[g*4+3]),e.weightsIndices.push(c[u*4]),e.weightsIndices.push(c[u*4+1]),e.weightsIndices.push(c[u*4+2]),e.weightsIndices.push(c[u*4+3])),t.color&&(e.colors.push(a[p*3]),e.colors.push(a[p*3+1]),e.colors.push(a[p*3+2]),e.colors.push(a[g*3]),e.colors.push(a[g*3+1]),e.colors.push(a[g*3+2]),e.colors.push(a[u*3]),e.colors.push(a[u*3+1]),e.colors.push(a[u*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(s),e.materialIndex.push(s),e.materialIndex.push(s)),t.normal&&(e.normal.push(i[p*3]),e.normal.push(i[p*3+1]),e.normal.push(i[p*3+2]),e.normal.push(i[g*3]),e.normal.push(i[g*3+1]),e.normal.push(i[g*3+2]),e.normal.push(i[u*3]),e.normal.push(i[u*3+1]),e.normal.push(i[u*3+2])),t.uv&&t.uv.forEach(function(b,f){e.uvs[f]===void 0&&(e.uvs[f]=[]),e.uvs[f].push(r[f][p*2]),e.uvs[f].push(r[f][p*2+1]),e.uvs[f].push(r[f][g*2]),e.uvs[f].push(r[f][g*2+1]),e.uvs[f].push(r[f][u*2]),e.uvs[f].push(r[f][u*2+1])})}addMorphTargets(e,t,n,s){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const i=this;n.forEach(function(a){a.rawTargets.forEach(function(r){const A=ne.Objects.Geometry[r.geoID];A!==void 0&&i.genMorphGeometry(e,t,A,s,r.name)})})}genMorphGeometry(e,t,n,s,i){const a=t.Vertices!==void 0?t.Vertices.a:[],r=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],A=n.Vertices!==void 0?n.Vertices.a:[],c=n.Indexes!==void 0?n.Indexes.a:[],l=e.attributes.position.count*3,h=new Float32Array(l);for(let b=0;b<c.length;b++){const f=c[b]*3;h[f]=A[b*3],h[f+1]=A[b*3+1],h[f+2]=A[b*3+2]}const p={vertexIndices:r,vertexPositions:h,baseVertexPositions:a},g=this.genBuffers(p),u=new ke(g.vertex,3);u.name=i||n.attrName,u.applyMatrix4(s),e.morphAttributes.position.push(u)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.Normals.a;let i=[];return n==="IndexToDirect"&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:s,indices:i,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.UV.a;let i=[];return n==="IndexToDirect"&&(i=e.UVIndex.a),{dataSize:2,buffer:s,indices:i,mappingType:t,referenceType:n}}parseVertexColors(e){if(!e.Colors)return;const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.Colors.a;let i=[];n==="IndexToDirect"&&(i=e.ColorIndex.a);for(let a=0,r=new we;a<s.length;a+=4)r.fromArray(s,a),Xe.toWorkingColorSpace(r,le),r.toArray(s,a);return{dataSize:4,buffer:s,indices:i,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const s=e.Materials.a,i=[];for(let a=0;a<s.length;++a)i.push(a);return{dataSize:1,buffer:s,indices:i,mappingType:t,referenceType:n}}parseNurbsGeometry(e){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 ct;const n=t-1,s=e.KnotVector.a,i=[],a=e.Points.a;for(let l=0,h=a.length;l<h;l+=4)i.push(new Mt().fromArray(a,l));let r,A;if(e.Form==="Closed")i.push(i[0]);else if(e.Form==="Periodic"){r=n,A=s.length-1-r;for(let l=0;l<n;++l)i.push(i[l])}const c=new Pc(n,s,i,r,A).getPoints(i.length*12);return new ct().setFromPoints(c)}}class qc{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const s=t[n],i=this.addClip(s);e.push(i)}return e}parseClips(){if(ne.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=ne.Objects.AnimationCurveNode,t=new Map;for(const n in e){const s=e[n];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){const i={id:s.id,attr:s.attrName,curves:{}};t.set(i.id,i)}}return t}parseAnimationCurves(e){const t=ne.Objects.AnimationCurve;for(const n in t){const s={id:t[n].id,times:t[n].KeyTime.a.map(Wc),values:t[n].KeyValueFloat.a},i=Se.get(s.id);if(i!==void 0){const a=i.parents[0].ID,r=i.parents[0].relationship;r.match(/X/)?e.get(a).curves.x=s:r.match(/Y/)?e.get(a).curves.y=s:r.match(/Z/)?e.get(a).curves.z=s:r.match(/DeformPercent/)&&e.has(a)&&(e.get(a).curves.morph=s)}}}parseAnimationLayers(e){const t=ne.Objects.AnimationLayer,n=new Map;for(const s in t){const i=[],a=Se.get(parseInt(s));a!==void 0&&(a.children.forEach(function(r,A){if(e.has(r.ID)){const c=e.get(r.ID);if(c.curves.x!==void 0||c.curves.y!==void 0||c.curves.z!==void 0){if(i[A]===void 0){const l=Se.get(r.ID).parents.filter(function(h){return h.relationship!==void 0})[0].ID;if(l!==void 0){const h=ne.Objects.Model[l.toString()];if(h===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",r);return}const p={modelName:h.attrName?ut.sanitizeNodeName(h.attrName):"",ID:h.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};We.traverse(function(g){g.ID===h.id&&(p.transform=g.matrix,g.userData.transformData&&(p.eulerOrder=g.userData.transformData.eulerOrder))}),p.transform||(p.transform=new ce),"PreRotation"in h&&(p.preRotation=h.PreRotation.value),"PostRotation"in h&&(p.postRotation=h.PostRotation.value),i[A]=p}}i[A]&&(i[A][c.attr]=c)}else if(c.curves.morph!==void 0){if(i[A]===void 0){const l=Se.get(r.ID).parents.filter(function(f){return f.relationship!==void 0})[0].ID,h=Se.get(l).parents[0].ID,p=Se.get(h).parents[0].ID,g=Se.get(p).parents[0].ID,u=ne.Objects.Model[g],b={modelName:u.attrName?ut.sanitizeNodeName(u.attrName):"",morphName:ne.Objects.Deformer[l].attrName};i[A]=b}i[A][c.attr]=c}}}),n.set(parseInt(s),i))}return n}parseAnimStacks(e){const t=ne.Objects.AnimationStack,n={};for(const s in t){const i=Se.get(parseInt(s)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const a=e.get(i[0].ID);n[s]={name:t[s].attrName,layer:a}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(s){t=t.concat(n.generateTracks(s))}),new xn(e.name,-1,t)}generateTracks(e){const t=[];let n=new N,s=new N;if(e.transform&&e.transform.decompose(n,new ye,s),n=n.toArray(),s=s.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,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,s,"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 i=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(i,t,n);return new Vs(e+"."+s,i,a)}generateRotationTrack(e,t,n,s,i){let a,r;if(t.x===void 0||t.y===void 0||t.z===void 0){console.warn("THREE.FBXLoader: Missing rotation curves "+(t.x===void 0?"x ":"")+(t.y===void 0?"y ":"")+(t.z===void 0?"z ":"")+" for animation of "+e+". This is currently not supported.");return}if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const p=this.interpolateRotations(t.x,t.y,t.z,i);a=p[0],r=p[1]}const A=Us(0);n!==void 0&&(n=n.map(Ce.degToRad),n.push(A),n=new Ot().fromArray(n),n=new ye().setFromEuler(n)),s!==void 0&&(s=s.map(Ce.degToRad),s.push(A),s=new Ot().fromArray(s),s=new ye().setFromEuler(s).invert());const c=new ye,l=new Ot,h=[];if(!(!r||!a)){for(let p=0;p<r.length;p+=3)l.set(r[p],r[p+1],r[p+2],i),c.setFromEuler(l),n!==void 0&&c.premultiply(n),s!==void 0&&c.multiply(s),p>2&&new ye().fromArray(h,(p-3)/3*4).dot(c)<0&&c.set(-c.x,-c.y,-c.z,-c.w),c.toArray(h,p/3*4);return new Zs(e+".quaternion",a,h)}}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(i){return i/100}),s=We.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Xs(e.modelName+".morphTargetInfluences["+s+"]",t.times,n)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(n,s){return n-s}),t.length>1){let n=1,s=t[0];for(let i=1;i<t.length;i++){const a=t[i];a!==s&&(t[n]=a,s=a,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const s=n,i=[];let a=-1,r=-1,A=-1;return e.forEach(function(c){if(t.x&&(a=t.x.times.indexOf(c)),t.y&&(r=t.y.times.indexOf(c)),t.z&&(A=t.z.times.indexOf(c)),a!==-1){const l=t.x.values[a];i.push(l),s[0]=l}else i.push(s[0]);if(r!==-1){const l=t.y.values[r];i.push(l),s[1]=l}else i.push(s[1]);if(A!==-1){const l=t.z.values[A];i.push(l),s[2]=l}else i.push(s[2])}),i}interpolateRotations(e,t,n,s){const i=[],a=[];i.push(e.times[0]),a.push(Ce.degToRad(e.values[0])),a.push(Ce.degToRad(t.values[0])),a.push(Ce.degToRad(n.values[0]));for(let r=1;r<e.values.length;r++){const A=[e.values[r-1],t.values[r-1],n.values[r-1]];if(isNaN(A[0])||isNaN(A[1])||isNaN(A[2]))continue;const c=A.map(Ce.degToRad),l=[e.values[r],t.values[r],n.values[r]];if(isNaN(l[0])||isNaN(l[1])||isNaN(l[2]))continue;const h=l.map(Ce.degToRad),p=[l[0]-A[0],l[1]-A[1],l[2]-A[2]],g=[Math.abs(p[0]),Math.abs(p[1]),Math.abs(p[2])];if(g[0]>=180||g[1]>=180||g[2]>=180){const u=Math.max(...g)/180,b=new Ot(...c,s),f=new Ot(...h,s),E=new ye().setFromEuler(b),C=new ye().setFromEuler(f);E.dot(C)&&C.set(-C.x,-C.y,-C.z,-C.w);const I=e.times[r-1],y=e.times[r]-I,w=new ye,x=new Ot;for(let T=0;T<1;T+=1/u)w.copy(E.clone().slerp(C.clone(),T)),i.push(I+T*y),x.setFromQuaternion(w,s),a.push(x.x),a.push(x.y),a.push(x.z)}else i.push(e.times[r]),a.push(Ce.degToRad(e.values[r])),a.push(Ce.degToRad(t.values[r])),a.push(Ce.degToRad(n.values[r]))}return[i,a]}}class zc{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 io,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(s,i){const a=s.match(/^[\s\t]*;/),r=s.match(/^[\s\t]*$/);if(a||r)return;const A=s.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),c=s.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),l=s.match("^\\t{"+(t.currentIndent-1)+"}}");A?t.parseNodeBegin(s,A):c?t.parseNodeProperty(s,c,n[++i]):l?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(A){return A.trim().replace(/^"/,"").replace(/"$/,"")}),i={name:n},a=this.parseNodeAttr(s),r=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,i):n in r?(n==="PoseNode"?r.PoseNode.push(i):r[n].id!==void 0&&(r[n]={},r[n][r[n].id]=r[n]),a.id!==""&&(r[n][a.id]=i)):typeof a.id=="number"?(r[n]={},r[n][a.id]=i):n!=="Properties70"&&(n==="PoseNode"?r[n]=[i]:r[n]=i),typeof a.id=="number"&&(i.id=a.id),a.name!==""&&(i.attrName=a.name),a.type!==""&&(i.attrType=a.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",s="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),s=e[2]),{id:t,name:n,type:s}}parseNodeProperty(e,t,n){let s=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();s==="Content"&&i===","&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());const a=this.getCurrentNode();if(a.name==="Properties70"){this.parseNodeSpecialProperty(e,s,i);return}if(s==="C"){const r=i.split(",").slice(1),A=parseInt(r[0]),c=parseInt(r[1]);let l=i.split(",").slice(3);l=l.map(function(h){return h.trim().replace(/^"/,"")}),s="connections",i=[A,c],Xc(i,l),a[s]===void 0&&(a[s]=[])}s==="Node"&&(a.id=i),s in a&&Array.isArray(a[s])?a[s].push(i):s!=="a"?a[s]=i:a.a=i,this.setCurrentProp(a,s),s==="a"&&i.slice(-1)!==","&&(a.a=fi(i))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=fi(t.a))}parseNodeSpecialProperty(e,t,n){const s=n.split('",').map(function(l){return l.trim().replace(/^\"/,"").replace(/\s/,"_")}),i=s[0],a=s[1],r=s[2],A=s[3];let c=s[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=fi(c);break}this.getPrevNode()[i]={type:a,type2:r,flag:A,value:c},this.setCurrentProp(this.getPrevNode(),i)}}class Kc{parse(e){const t=new no(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 io;for(;!this.endOfContent(t);){const i=this.parseNode(t,n);i!==null&&s.add(i.name,i)}return s}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},s=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const a=e.getUint8(),r=e.getString(a);if(s===0)return null;const A=[];for(let p=0;p<i;p++)A.push(this.parseProperty(e));const c=A.length>0?A[0]:"",l=A.length>1?A[1]:"",h=A.length>2?A[2]:"";for(n.singleProperty=i===1&&e.getOffset()===s;s>e.getOffset();){const p=this.parseNode(e,t);p!==null&&this.parseSubNode(r,n,p)}return n.propertyList=A,typeof c=="number"&&(n.id=c),l!==""&&(n.attrName=l),h!==""&&(n.attrType=h),r!==""&&(n.name=r),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const s=n.propertyList[0];Array.isArray(s)?(t[n.name]=n,n.a=s):t[n.name]=s}else if(e==="Connections"&&n.name==="C"){const s=[];n.propertyList.forEach(function(i,a){a!==0&&s.push(i)}),t.connections===void 0&&(t.connections=[]),t.connections.push(s)}else if(n.name==="Properties70")Object.keys(n).forEach(function(s){t[s]=n[s]});else if(e==="Properties70"&&n.name==="P"){let s=n.propertyList[0],i=n.propertyList[1];const a=n.propertyList[2],r=n.propertyList[3];let A;s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),i==="Color"||i==="ColorRGB"||i==="Vector"||i==="Vector3D"||i.indexOf("Lcl_")===0?A=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:A=n.propertyList[4],t[s]={type:i,type2:a,flag:r,value:A}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const s=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(i===0)switch(t){case"b":case"c":return e.getBooleanArray(s);case"d":return e.getFloat64Array(s);case"f":return e.getFloat32Array(s);case"i":return e.getInt32Array(s);case"l":return e.getInt64Array(s)}const r=Ns(new Uint8Array(e.getArrayBuffer(a))),A=new no(r.buffer);switch(t){case"b":case"c":return A.getBooleanArray(s);case"d":return A.getFloat64Array(s);case"f":return A.getFloat32Array(s);case"i":return A.getInt32Array(s);case"l":return A.getInt64Array(s)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class no{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}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){const t=this.offset;let n=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const s=n.indexOf(0);return s>=0&&(n=new Uint8Array(this.dv.buffer,t,s)),this._textDecoder.decode(n)}}class io{add(e,t){this[e]=t}}function Yc(o){const e="Kaydara FBX Binary \0";return o.byteLength>=e.length&&e===ro(o,0,e.length)}function Jc(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 i=o[s-1];return o=o.slice(t+s),t++,i}for(let s=0;s<e.length;++s)if(n(1)===e[s])return!1;return!0}function ao(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 Wc(o){return o/46186158e3}const Vc=[];function ln(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 i=s*n.dataSize,a=i+n.dataSize;return Zc(Vc,n.buffer,i,a)}const ui=new Ot,ds=new N;function oo(o){const e=new ce,t=new ce,n=new ce,s=new ce,i=new ce,a=new ce,r=new ce,A=new ce,c=new ce,l=new ce,h=new ce,p=new ce,g=o.inheritType?o.inheritType:0;o.translation&&e.setPosition(ds.fromArray(o.translation));const u=Us(0);if(o.preRotation){const K=o.preRotation.map(Ce.degToRad);K.push(u),t.makeRotationFromEuler(ui.fromArray(K))}if(o.rotation){const K=o.rotation.map(Ce.degToRad);K.push(o.eulerOrder||u),n.makeRotationFromEuler(ui.fromArray(K))}if(o.postRotation){const K=o.postRotation.map(Ce.degToRad);K.push(u),s.makeRotationFromEuler(ui.fromArray(K)),s.invert()}o.scale&&i.scale(ds.fromArray(o.scale)),o.scalingOffset&&r.setPosition(ds.fromArray(o.scalingOffset)),o.scalingPivot&&a.setPosition(ds.fromArray(o.scalingPivot)),o.rotationOffset&&A.setPosition(ds.fromArray(o.rotationOffset)),o.rotationPivot&&c.setPosition(ds.fromArray(o.rotationPivot)),o.parentMatrixWorld&&(h.copy(o.parentMatrix),l.copy(o.parentMatrixWorld));const b=t.clone().multiply(n).multiply(s),f=new ce;f.extractRotation(l);const E=new ce;E.copyPosition(l);const C=E.clone().invert().multiply(l),I=f.clone().invert().multiply(C),y=i,w=new ce;if(g===0)w.copy(f).multiply(b).multiply(I).multiply(y);else if(g===1)w.copy(f).multiply(I).multiply(b).multiply(y);else{const K=new ce().scale(new N().setFromMatrixScale(h)).clone().invert(),J=I.clone().multiply(K);w.copy(f).multiply(b).multiply(J).multiply(y)}const x=c.clone().invert(),T=a.clone().invert();let S=e.clone().multiply(A).multiply(c).multiply(t).multiply(n).multiply(s).multiply(x).multiply(r).multiply(a).multiply(i).multiply(T);const M=new ce().copyPosition(S),j=l.clone().multiply(M);return p.copyPosition(j),S=p.clone().multiply(w),S.premultiply(l.invert()),S}function Us(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 fi(o){return o.split(",").map(function(e){return parseFloat(e)})}function ro(o,e,t){return e===void 0&&(e=0),t===void 0&&(t=o.byteLength),new TextDecoder().decode(new Uint8Array(o,e,t))}function Xc(o,e){for(let t=0,n=o.length,s=e.length;t<s;t++,n++)o[n]=e[t]}function Zc(o,e,t,n){for(let s=t,i=0;s<n;s++,i++)o[i]=e[s];return o}class $c extends Dt{constructor(e){super(e)}load(e,t,n,s){const i=this,a=this.path===""?Wt.extractUrlBase(e):this.path,r=new gt(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,function(A){try{t(i.parse(A,a))}catch(c){s?s(c):console.error(c),i.manager.itemError(e)}},n,s)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split(`
|
|
46
|
-
`);let s={};const i=/\s+/,a={};for(let A=0;A<n.length;A++){let c=n[A];if(c=c.trim(),c.length===0||c.charAt(0)==="#")continue;const l=c.indexOf(" ");let h=l>=0?c.substring(0,l):c;h=h.toLowerCase();let p=l>=0?c.substring(l+1):"";if(p=p.trim(),h==="newmtl")s={name:p},a[p]=s;else if(h==="ka"||h==="kd"||h==="ks"||h==="ke"){const g=p.split(i,3);s[h]=[parseFloat(g[0]),parseFloat(g[1]),parseFloat(g[2])]}else s[h]=p}const r=new el(this.resourcePath||t,this.materialOptions);return r.setCrossOrigin(this.crossOrigin),r.setManager(this.manager),r.setMaterials(a),r}}class el{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:Pi,this.wrap=this.options.wrap!==void 0?this.options.wrap:Vt}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const n in e){const s=e[n],i={};t[n]=i;for(const a in s){let r=!0,A=s[a];const c=a.toLowerCase();switch(c){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(A=[A[0]/255,A[1]/255,A[2]/255]),this.options&&this.options.ignoreZeroRGBs&&A[0]===0&&A[1]===0&&A[2]===0&&(r=!1);break}r&&(i[c]=A)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return this.materials[e]===void 0&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const t=this,n=this.materialsInfo[e],s={name:e,side:this.side};function i(r,A){return typeof A!="string"||A===""?"":/^https?:\/\//i.test(A)?A:r+A}function a(r,A){if(s[r])return;const c=t.getTextureParams(A,s),l=t.loadTexture(i(t.baseUrl,c.url));l.repeat.copy(c.scale),l.offset.copy(c.offset),l.wrapS=t.wrap,l.wrapT=t.wrap,(r==="map"||r==="emissiveMap")&&(l.colorSpace=le),s[r]=l}for(const r in n){const A=n[r];let c;if(A!=="")switch(r.toLowerCase()){case"kd":s.color=Xe.toWorkingColorSpace(new we().fromArray(A),le);break;case"ks":s.specular=Xe.toWorkingColorSpace(new we().fromArray(A),le);break;case"ke":s.emissive=Xe.toWorkingColorSpace(new we().fromArray(A),le);break;case"map_kd":a("map",A);break;case"map_ks":a("specularMap",A);break;case"map_ke":a("emissiveMap",A);break;case"norm":a("normalMap",A);break;case"map_bump":case"bump":a("bumpMap",A);break;case"map_d":a("alphaMap",A),s.transparent=!0;break;case"ns":s.shininess=parseFloat(A);break;case"d":c=parseFloat(A),c<1&&(s.opacity=c,s.transparent=!0);break;case"tr":c=parseFloat(A),this.options&&this.options.invertTrProperty&&(c=1-c),c>0&&(s.opacity=1-c,s.transparent=!0);break}}return this.materials[e]=new ys(s),this.materials[e]}getTextureParams(e,t){const n={scale:new Le(1,1),offset:new Le(0,0)},s=e.split(/\s+/);let i;return i=s.indexOf("-bm"),i>=0&&(t.bumpScale=parseFloat(s[i+1]),s.splice(i,2)),i=s.indexOf("-s"),i>=0&&(n.scale.set(parseFloat(s[i+1]),parseFloat(s[i+2])),s.splice(i,4)),i=s.indexOf("-o"),i>=0&&(n.offset.set(parseFloat(s[i+1]),parseFloat(s[i+2])),s.splice(i,4)),n.url=s.join(" ").trim(),n}loadTexture(e,t,n,s,i){const a=this.manager!==void 0?this.manager:Dr;let r=a.getHandler(e);r===null&&(r=new Bn(a)),r.setCrossOrigin&&r.setCrossOrigin(this.crossOrigin);const A=r.load(e,n,s,i);return t!==void 0&&(A.mapping=t),A}}const tl=/^[og]\s*(.+)?/,sl=/^mtllib /,nl=/^usemtl /,il=/^usemap /,Ao=/\s+/,co=new N,mi=new N,lo=new N,ho=new N,ht=new N,hn=new we;function al(){const o={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(s,i){const a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);const r={index:this.materials.length,name:s||"",mtllib:Array.isArray(i)&&i.length>0?i[i.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(A){const c={index:typeof A=="number"?A:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return c.clone=this.clone.bind(c),c}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(s){const i=this.currentMaterial();if(i&&i.groupEnd===-1&&(i.groupEnd=this.geometry.vertices.length/3,i.groupCount=i.groupEnd-i.groupStart,i.inherited=!1),s&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return s&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),i}},n&&n.name&&typeof n.clone=="function"){const s=n.clone(0);s.inherited=!0,this.object.materials.push(s)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){const n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){const s=this.vertices,i=this.object.geometry.vertices;i.push(s[e+0],s[e+1],s[e+2]),i.push(s[t+0],s[t+1],s[t+2]),i.push(s[n+0],s[n+1],s[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const s=this.normals,i=this.object.geometry.normals;i.push(s[e+0],s[e+1],s[e+2]),i.push(s[t+0],s[t+1],s[t+2]),i.push(s[n+0],s[n+1],s[n+2])},addFaceNormal:function(e,t,n){const s=this.vertices,i=this.object.geometry.normals;co.fromArray(s,e),mi.fromArray(s,t),lo.fromArray(s,n),ht.subVectors(lo,mi),ho.subVectors(co,mi),ht.cross(ho),ht.normalize(),i.push(ht.x,ht.y,ht.z),i.push(ht.x,ht.y,ht.z),i.push(ht.x,ht.y,ht.z)},addColor:function(e,t,n){const s=this.colors,i=this.object.geometry.colors;s[e]!==void 0&&i.push(s[e+0],s[e+1],s[e+2]),s[t]!==void 0&&i.push(s[t+0],s[t+1],s[t+2]),s[n]!==void 0&&i.push(s[n+0],s[n+1],s[n+2])},addUV:function(e,t,n){const s=this.uvs,i=this.object.geometry.uvs;i.push(s[e+0],s[e+1]),i.push(s[t+0],s[t+1]),i.push(s[n+0],s[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,s,i,a,r,A,c){const l=this.vertices.length;let h=this.parseVertexIndex(e,l),p=this.parseVertexIndex(t,l),g=this.parseVertexIndex(n,l);if(this.addVertex(h,p,g),this.addColor(h,p,g),r!==void 0&&r!==""){const u=this.normals.length;h=this.parseNormalIndex(r,u),p=this.parseNormalIndex(A,u),g=this.parseNormalIndex(c,u),this.addNormal(h,p,g)}else this.addFaceNormal(h,p,g);if(s!==void 0&&s!==""){const u=this.uvs.length;h=this.parseUVIndex(s,u),p=this.parseUVIndex(i,u),g=this.parseUVIndex(a,u),this.addUV(h,p,g),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,s=e.length;n<s;n++){const i=this.parseVertexIndex(e[n],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const n=this.vertices.length,s=this.uvs.length;for(let i=0,a=e.length;i<a;i++)this.addVertexLine(this.parseVertexIndex(e[i],n));for(let i=0,a=t.length;i<a;i++)this.addUVLine(this.parseUVIndex(t[i],s))}};return o.startObject("",!1),o}class ol extends Dt{constructor(e){super(e),this.materials=null,this.materialsLoader=new $c(e)}load(e,t,n,s){const i=this,a=new gt(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,async function(r){try{const A=i.parse(r,!0);for(let c=0,l=A.materialLibraries.length;c<l;c++){const h=A.materialLibraries[c],p=e.startsWith("blob:")?e+"/"+h:new URL(h,e);console.debug("Loading MTL file: "+p),await new Promise((g,u)=>{i.materialsLoader.load(p.toString(),b=>{i.setMaterials(b),g()},null,u)})}t(i.createObjects(A))}catch(A){s?s(A):console.error(A),i.manager.itemError(e)}},n,s)}setMTLLoader(e){return this.materialsLoader=e,this}setMaterials(e){return this.materials=e,this}parse(e,t=!1){const n=new al;e.indexOf(`\r
|
|
47
|
-
`)!==-1&&(e=e.replace(/\r\n/g,`
|
|
48
|
-
`)),e.indexOf(`\\
|
|
49
|
-
`)!==-1&&(e=e.replace(/\\\n/g,""));const s=e.split(`
|
|
50
|
-
`);let i=[];for(let a=0,r=s.length;a<r;a++){const A=s[a].trimStart();if(A.length===0)continue;const c=A.charAt(0);if(c!=="#")if(c==="v"){const l=A.split(Ao);switch(l[0]){case"v":n.vertices.push(parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3])),l.length>=7?(hn.setRGB(parseFloat(l[4]),parseFloat(l[5]),parseFloat(l[6]),le),n.colors.push(hn.r,hn.g,hn.b)):n.colors.push(void 0,void 0,void 0);break;case"vn":n.normals.push(parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3]));break;case"vt":n.uvs.push(parseFloat(l[1]),parseFloat(l[2]));break}}else if(c==="f"){const l=A.slice(1).trim().split(Ao),h=[];for(let g=0,u=l.length;g<u;g++){const b=l[g];if(b.length>0){const f=b.split("/");h.push(f)}}const p=h[0];for(let g=1,u=h.length-1;g<u;g++){const b=h[g],f=h[g+1];n.addFace(p[0],b[0],f[0],p[1],b[1],f[1],p[2],b[2],f[2])}}else if(c==="l"){const l=A.substring(1).trim().split(" ");let h=[];const p=[];if(A.indexOf("/")===-1)h=l;else for(let g=0,u=l.length;g<u;g++){const b=l[g].split("/");b[0]!==""&&h.push(b[0]),b[1]!==""&&p.push(b[1])}n.addLineGeometry(h,p)}else if(c==="p"){const l=A.slice(1).trim().split(" ");n.addPointGeometry(l)}else if((i=tl.exec(A))!==null){const l=(" "+i[0].slice(1).trim()).slice(1);n.startObject(l)}else if(nl.test(A))n.object.startMaterial(A.substring(7).trim(),n.materialLibraries);else if(sl.test(A))n.materialLibraries.push(A.substring(7).trim());else if(il.test(A))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(c==="s"){if(i=A.split(" "),i.length>1){const h=i[1].trim().toLowerCase();n.object.smooth=h!=="0"&&h!=="off"}else n.object.smooth=!0;const l=n.object.currentMaterial();l&&(l.smooth=n.object.smooth)}else{if(A==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+A+'"')}}return n.finalize(),t?n:this.createObjects(n)}createObjects(e){const t=new Xt;if(t.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0))for(let n=0,s=e.objects.length;n<s;n++){const i=e.objects[n],a=i.geometry,r=i.materials,A=a.type==="Line",c=a.type==="Points";let l=!1;if(a.vertices.length===0)continue;const h=new ct;h.setAttribute("position",new ke(a.vertices,3)),a.normals.length>0&&h.setAttribute("normal",new ke(a.normals,3)),a.colors.length>0&&(l=!0,h.setAttribute("color",new ke(a.colors,3))),a.hasUVIndices===!0&&h.setAttribute("uv",new ke(a.uvs,2));const p=[];for(let u=0,b=r.length;u<b;u++){const f=r[u],E=f.name+"_"+f.smooth+"_"+l;let C=e.materials[E];if(this.materials!==null){if(C=this.materials.create(f.name),A&&C&&!(C instanceof kt)){const I=new kt;Jt.prototype.copy.call(I,C),I.color.copy(C.color),C=I}else if(c&&C&&!(C instanceof Is)){const I=new Is({size:10,sizeAttenuation:!1});Jt.prototype.copy.call(I,C),I.color.copy(C.color),I.map=C.map,C=I}}C===void 0&&(A?C=new kt:c?C=new Is({size:1,sizeAttenuation:!1}):C=new ys,C.name=f.name,C.flatShading=!f.smooth,C.vertexColors=l,e.materials[E]=C),p.push(C)}let g;if(p.length>1){for(let u=0,b=r.length;u<b;u++){const f=r[u];h.addGroup(f.groupStart,f.groupCount,u)}A?g=new Js(h,p):c?g=new Ws(h,p):g=new O(h,p)}else A?g=new Js(h,p[0]):c?g=new Ws(h,p[0]):g=new O(h,p[0]);g.name=i.name,t.add(g)}else if(e.vertices.length>0){const n=new Is({size:1,sizeAttenuation:!1}),s=new ct;s.setAttribute("position",new ke(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(s.setAttribute("color",new ke(e.colors,3)),n.vertexColors=!0);const i=new Ws(s,n);t.add(i)}return t}}const po={type:"change"},bi={type:"start"},go={type:"end"},rl={type:"endMovement"},dn=new kr,uo=new Mr,Al=Math.cos(70*Ce.DEG2RAD),Me=new N;new N;const st=2*Math.PI,he={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},ss=1e-6;let cl=class extends Ji{constructor(o,e=null){super(o,e),this.state=he.NONE,this.enabled=!0,this.target=new N,this.cursor=new N,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:cs.ROTATE,MIDDLE:cs.DOLLY,RIGHT:cs.PAN},this.touches={ONE:ls.ROTATE,TWO:ls.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new N,this._lastQuaternion=new ye,this._lastTargetPosition=new N,this._quat=new ye().setFromUnitVectors(o.up,new N(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new Xi,this._sphericalDelta=new Xi,this._scale=1,this._currentScale=1,this._panOffset=new N,this._rotateStart=new Le,this._rotateEnd=new Le,this._rotateDelta=new Le,this._panStart=new Le,this._panEnd=new Le,this._panDelta=new Le,this._dollyStart=new Le,this._dollyEnd=new Le,this._dollyDelta=new Le,this._dollyDirection=new N,this._mouse=new Le,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._lastIsDamping=!1,this._isDamping=!1,this._onPointerMove=hl.bind(this),this._onPointerDown=ll.bind(this),this._onPointerUp=dl.bind(this),this._onContextMenu=Il.bind(this),this._onMouseWheel=ul.bind(this),this._onKeyDown=fl.bind(this),this._onTouchStart=ml.bind(this),this._onTouchMove=bl.bind(this),this._onMouseDown=pl.bind(this),this._onMouseMove=gl.bind(this),this._interceptControlDown=El.bind(this),this._interceptControlUp=Cl.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(o){o.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=o}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(po),this.update(),this.state=he.NONE,this._isDamping=!1}update(o=null){if(this.enableDamping&&o===null)return;const e=this.object.getWorldPosition(this.object.position);Me.copy(e).sub(this.target),Me.applyQuaternion(this._quat),this._spherical.setFromVector3(Me),this.autoRotate&&this.state===he.NONE&&this._rotateLeft(this._getAutoRotationAngle(o)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let t=this.minAzimuthAngle,n=this.maxAzimuthAngle;isFinite(t)&&isFinite(n)&&(t<-Math.PI?t+=st:t>Math.PI&&(t-=st),n<-Math.PI?n+=st:n>Math.PI&&(n-=st),t<=n?this._spherical.theta=Math.max(t,Math.min(n,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(t+n)/2?Math.max(t,this._spherical.theta):Math.min(n,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.enableDamping?this._currentScale=Ce.lerp(this._currentScale,this._scale,this.dampingFactor):this._currentScale=this._scale,this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const i=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._currentScale),s=Math.abs(i-this._spherical.radius)>ss*100}if(Me.setFromSpherical(this._spherical),Me.applyQuaternion(this._quatInverse),e.copy(this.target).add(Me),this.object.parent?this.object.parent.worldToLocal(e):this.object.position.copy(e),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let i=null;if(this.object.isPerspectiveCamera){const a=Me.length();i=this._clampDistance(a*this._currentScale);const r=a-i;this.object.position.addScaledVector(this._dollyDirection,r),this.object.updateMatrixWorld(),s=Math.abs(r)>ss}else if(this.object.isOrthographicCamera){const a=new N(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const r=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._currentScale)),this.object.updateProjectionMatrix(),s=Math.abs(r-this.object.zoom)>ss;const A=new N(this._mouse.x,this._mouse.y,0);A.unproject(this.object),this.object.position.sub(A).add(a),this.object.updateMatrixWorld(),i=Me.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;i!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(i).add(this.object.position):(dn.origin.copy(this.object.position),dn.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(dn.direction))<Al?this.object.lookAt(this.target):(uo.setFromNormalAndCoplanarPoint(this.object.up,this.target),dn.intersectPlane(uo,this.target))))}else if(this.object.isOrthographicCamera){const i=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),Math.abs(i-this.object.zoom)>ss&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,s||this._lastPosition.distanceToSquared(this.object.position)>ss||8*(1-this._lastQuaternion.dot(this.object.quaternion))>ss||this._lastTargetPosition.distanceToSquared(this.target)>ss?(this.dispatchEvent(po),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),this._lastIsDamping=!0,this._isDamping=!0,!0):(this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),this.state===he.NONE&&(this._lastIsDamping=this._isDamping,this._isDamping=!1),this._lastIsDamping&&!this._isDamping&&this.state===he.NONE&&(this._isDamping=!1,this._lastIsDamping=!1,this.dispatchEvent(rl)),this._performCursorZoom=!1,!1)}_getAutoRotationAngle(o){return o!==null?st/60*this.autoRotateSpeed*o:st/60/60*this.autoRotateSpeed}_getZoomScale(o){const e=Math.abs(o*.01);return Math.pow(.95,this.zoomSpeed*e)}_rotateLeft(o){this._sphericalDelta.theta-=o}_rotateUp(o){this._sphericalDelta.phi-=o}_panLeft(o,e){Me.setFromMatrixColumn(e,0),Me.multiplyScalar(-o),this._panOffset.add(Me)}_panUp(o,e){this.screenSpacePanning===!0?Me.setFromMatrixColumn(e,1):(Me.setFromMatrixColumn(e,0),Me.crossVectors(this.object.up,Me)),Me.multiplyScalar(o),this._panOffset.add(Me)}_pan(o,e){const t=this.domElement;if(this.object.isPerspectiveCamera){this.object.getWorldPosition(Me).sub(this.target);let n=Me.length();n*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*o*n/t.clientHeight,this.object.matrixWorld),this._panUp(2*e*n/t.clientHeight,this.object.matrixWorld)}else this.object.isOrthographicCamera?(this._panLeft(o*(this.object.right-this.object.left)/this.object.zoom/t.clientWidth,this.object.matrixWorld),this._panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/t.clientHeight,this.object.matrixWorld)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(o){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(o){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=o:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(o,e){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const t=this.domElement.getBoundingClientRect(),n=o-t.left,s=e-t.top,i=t.width,a=t.height;this._mouse.x=n/i*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(o){return Math.max(this.minDistance,Math.min(this.maxDistance,o))}_handleMouseDownRotate(o){this._rotateStart.set(o.clientX,o.clientY)}_handleMouseDownDolly(o){this._updateZoomParameters(o.clientX,o.clientX),this._dollyStart.set(o.clientX,o.clientY)}_handleMouseDownPan(o){this._panStart.set(o.clientX,o.clientY)}_handleMouseMoveRotate(o){this._rotateEnd.set(o.clientX,o.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(st*this._rotateDelta.x/e.clientHeight),this._rotateUp(st*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(o){this._dollyEnd.set(o.clientX,o.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(o){this._panEnd.set(o.clientX,o.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(o){this._updateZoomParameters(o.clientX,o.clientY),o.deltaY<0?this._dollyIn(this._getZoomScale(o.deltaY)):o.deltaY>0&&this._dollyOut(this._getZoomScale(o.deltaY)),this.update()}_handleKeyDown(o){let e=!1;switch(o.code){case this.keys.UP:o.ctrlKey||o.metaKey||o.shiftKey?this._rotateUp(st*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,this.keyPanSpeed),e=!0;break;case this.keys.BOTTOM:o.ctrlKey||o.metaKey||o.shiftKey?this._rotateUp(-st*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,-this.keyPanSpeed),e=!0;break;case this.keys.LEFT:o.ctrlKey||o.metaKey||o.shiftKey?this._rotateLeft(st*this.rotateSpeed/this.domElement.clientHeight):this._pan(this.keyPanSpeed,0),e=!0;break;case this.keys.RIGHT:o.ctrlKey||o.metaKey||o.shiftKey?this._rotateLeft(-st*this.rotateSpeed/this.domElement.clientHeight):this._pan(-this.keyPanSpeed,0),e=!0;break}e&&(o.preventDefault(),this.update())}_handleTouchStartRotate(o){if(this._pointers.length===1)this._rotateStart.set(o.pageX,o.pageY);else{const e=this._getSecondPointerPosition(o),t=.5*(o.pageX+e.x),n=.5*(o.pageY+e.y);this._rotateStart.set(t,n)}}_handleTouchStartPan(o){if(this._pointers.length===1)this._panStart.set(o.pageX,o.pageY);else{const e=this._getSecondPointerPosition(o),t=.5*(o.pageX+e.x),n=.5*(o.pageY+e.y);this._panStart.set(t,n)}}_handleTouchStartDolly(o){const e=this._getSecondPointerPosition(o),t=o.pageX-e.x,n=o.pageY-e.y,s=Math.sqrt(t*t+n*n);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(o){this.enableZoom&&this._handleTouchStartDolly(o),this.enablePan&&this._handleTouchStartPan(o)}_handleTouchStartDollyRotate(o){this.enableZoom&&this._handleTouchStartDolly(o),this.enableRotate&&this._handleTouchStartRotate(o)}_handleTouchMoveRotate(o){if(this._pointers.length==1)this._rotateEnd.set(o.pageX,o.pageY);else{const t=this._getSecondPointerPosition(o),n=.5*(o.pageX+t.x),s=.5*(o.pageY+t.y);this._rotateEnd.set(n,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const e=this.domElement;this._rotateLeft(st*this._rotateDelta.x/e.clientHeight),this._rotateUp(st*this._rotateDelta.y/e.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(o){if(this._pointers.length===1)this._panEnd.set(o.pageX,o.pageY);else{const e=this._getSecondPointerPosition(o),t=.5*(o.pageX+e.x),n=.5*(o.pageY+e.y);this._panEnd.set(t,n)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(o){const e=this._getSecondPointerPosition(o),t=o.pageX-e.x,n=o.pageY-e.y,s=Math.sqrt(t*t+n*n);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const i=(o.pageX+e.x)*.5,a=(o.pageY+e.y)*.5;this._updateZoomParameters(i,a)}_handleTouchMoveDollyPan(o){this.enableZoom&&this._handleTouchMoveDolly(o),this.enablePan&&this._handleTouchMovePan(o)}_handleTouchMoveDollyRotate(o){this.enableZoom&&this._handleTouchMoveDolly(o),this.enableRotate&&this._handleTouchMoveRotate(o)}_addPointer(o){this._pointers.push(o.pointerId)}_removePointer(o){delete this._pointerPositions[o.pointerId];for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==o.pointerId){this._pointers.splice(e,1);return}}_isTrackingPointer(o){for(let e=0;e<this._pointers.length;e++)if(this._pointers[e]==o.pointerId)return!0;return!1}_trackPointer(o){let e=this._pointerPositions[o.pointerId];e===void 0&&(e=new Le,this._pointerPositions[o.pointerId]=e),e.set(o.pageX,o.pageY)}_getSecondPointerPosition(o){const e=o.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[e]}_customWheelEvent(o){const e=o.deltaMode,t={clientX:o.clientX,clientY:o.clientY,deltaY:o.deltaY};switch(e){case 1:t.deltaY*=16;break;case 2:t.deltaY*=100;break}return o.ctrlKey&&!this._controlActive&&(t.deltaY*=10),t}};function ll(o){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(o.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),window.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(o)&&(this._addPointer(o),o.pointerType==="touch"?this._onTouchStart(o):this._onMouseDown(o)))}function hl(o){this.enabled!==!1&&(o.pointerType==="touch"?this._onTouchMove(o):this._onMouseMove(o))}function dl(o){switch(this._removePointer(o),this._pointers.length){case 0:this.domElement.releasePointerCapture(o.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),window.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(go),this.state=he.NONE;break;case 1:const e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function pl(o){let e;switch(o.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case cs.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(o),this.state=he.DOLLY;break;case cs.ROTATE:if(o.ctrlKey||o.metaKey||o.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(o),this.state=he.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(o),this.state=he.ROTATE}break;case cs.PAN:if(o.ctrlKey||o.metaKey||o.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(o),this.state=he.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(o),this.state=he.PAN}break;default:this.state=he.NONE}this.state!==he.NONE&&this.dispatchEvent(bi)}function gl(o){switch(this.state){case he.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(o);break;case he.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(o);break;case he.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(o);break}}function ul(o){this.enabled===!1||this.enableZoom===!1||this.state!==he.NONE||(o.preventDefault(),this.dispatchEvent(bi),this._handleMouseWheel(this._customWheelEvent(o)),this.dispatchEvent(go))}function fl(o){this.enabled===!1||this.enablePan===!1||this._handleKeyDown(o)}function ml(o){switch(this._trackPointer(o),this._pointers.length){case 1:switch(this.touches.ONE){case ls.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(o),this.state=he.TOUCH_ROTATE;break;case ls.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(o),this.state=he.TOUCH_PAN;break;default:this.state=he.NONE}break;case 2:switch(this.touches.TWO){case ls.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(o),this.state=he.TOUCH_DOLLY_PAN;break;case ls.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(o),this.state=he.TOUCH_DOLLY_ROTATE;break;default:this.state=he.NONE}break;default:this.state=he.NONE}this.state!==he.NONE&&this.dispatchEvent(bi)}function bl(o){switch(this._trackPointer(o),this.state){case he.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(o),this.update();break;case he.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(o),this.update();break;case he.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(o),this.update();break;case he.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(o),this.update();break;default:this.state=he.NONE}}function Il(o){this.enabled!==!1&&o.preventDefault()}function El(o){o.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function Cl(o){o.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}class Bl extends ft{constructor(e,t=1,n=16,s=2){const i=new ct,a=n+s*2,r=new Float32Array((a*3+3)*3);i.setAttribute("position",new it(r,3));const A=new kt({color:65280}),c=new kt({color:16776960});super(i,[c,A]),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,i=Ce.degToRad(e.panner.coneInnerAngle),a=Ce.degToRad(e.panner.coneOuterAngle),r=i/2,A=a/2;let c=0,l=0,h,p;const g=this.geometry,u=g.attributes.position;g.clearGroups();function b(f,E,C,I){const y=(E-f)/C;for(u.setXYZ(c,0,0,0),l++,h=f;h<E;h+=y)p=c+l,u.setXYZ(p,Math.sin(h)*t,0,Math.cos(h)*t),u.setXYZ(p+1,Math.sin(Math.min(h+y,E))*t,0,Math.cos(Math.min(h+y,E))*t),u.setXYZ(p+2,0,0,0),l+=3;g.addGroup(c,l,I),c+=l,l=0}b(-A,-r,s,0),b(-r,r,n,1),b(r,A,s,0),u.needsUpdate=!0,i===a&&(this.material[0].visible=!1)}dispose(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()}}const wl={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
|
51
|
-
|
|
52
|
-
varying vec2 vUv;
|
|
53
|
-
|
|
54
|
-
void main() {
|
|
55
|
-
|
|
56
|
-
vUv = uv;
|
|
57
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
58
|
-
|
|
59
|
-
}`,fragmentShader:`
|
|
60
|
-
|
|
61
|
-
uniform sampler2D tDiffuse;
|
|
62
|
-
uniform float h;
|
|
63
|
-
|
|
64
|
-
varying vec2 vUv;
|
|
65
|
-
|
|
66
|
-
void main() {
|
|
67
|
-
|
|
68
|
-
vec4 sum = vec4( 0.0 );
|
|
69
|
-
|
|
70
|
-
sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
|
|
71
|
-
sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
|
|
72
|
-
sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
|
|
73
|
-
sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
|
|
74
|
-
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
75
|
-
sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
|
|
76
|
-
sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
|
|
77
|
-
sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
|
|
78
|
-
sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;
|
|
79
|
-
|
|
80
|
-
gl_FragColor = sum;
|
|
81
|
-
|
|
82
|
-
}`},yl={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
|
|
83
|
-
|
|
84
|
-
varying vec2 vUv;
|
|
85
|
-
|
|
86
|
-
void main() {
|
|
87
|
-
|
|
88
|
-
vUv = uv;
|
|
89
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
90
|
-
|
|
91
|
-
}`,fragmentShader:`
|
|
92
|
-
|
|
93
|
-
uniform sampler2D tDiffuse;
|
|
94
|
-
uniform float v;
|
|
95
|
-
|
|
96
|
-
varying vec2 vUv;
|
|
97
|
-
|
|
98
|
-
void main() {
|
|
99
|
-
|
|
100
|
-
vec4 sum = vec4( 0.0 );
|
|
101
|
-
|
|
102
|
-
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
|
|
103
|
-
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
|
|
104
|
-
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
|
|
105
|
-
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
|
|
106
|
-
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
107
|
-
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
|
|
108
|
-
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
|
|
109
|
-
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
|
|
110
|
-
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;
|
|
111
|
-
|
|
112
|
-
gl_FragColor = sum;
|
|
113
|
-
|
|
114
|
-
}`};let Gs,Ii,ps,pn;function Ei(o,e=1/0,t=null){Ii||(Ii=new Nn(2,2,1,1)),ps||(ps=new Zi({uniforms:{blitTexture:new _r(o)},vertexShader:`
|
|
115
|
-
varying vec2 vUv;
|
|
116
|
-
void main(){
|
|
117
|
-
vUv = uv;
|
|
118
|
-
gl_Position = vec4(position.xy * 1.0,0.,.999999);
|
|
119
|
-
}`,fragmentShader:`
|
|
120
|
-
uniform sampler2D blitTexture;
|
|
121
|
-
varying vec2 vUv;
|
|
122
|
-
|
|
123
|
-
void main(){
|
|
124
|
-
gl_FragColor = vec4(vUv.xy, 0, 1);
|
|
125
|
-
|
|
126
|
-
#ifdef IS_SRGB
|
|
127
|
-
gl_FragColor = sRGBTransferOETF( texture2D( blitTexture, vUv) );
|
|
128
|
-
#else
|
|
129
|
-
gl_FragColor = texture2D( blitTexture, vUv);
|
|
130
|
-
#endif
|
|
131
|
-
}`})),ps.uniforms.blitTexture.value=o,ps.defines.IS_SRGB=o.colorSpace==le,ps.needsUpdate=!0,pn||(pn=new O(Ii,ps),pn.frustumCulled=!1);const n=new qs,s=new Un;s.add(pn),t===null&&(t=Gs=new Fr({antialias:!1}));const i=Math.min(o.image.width,e),a=Math.min(o.image.height,e);t.setSize(i,a),t.clear(),t.render(s,n);const r=document.createElement("canvas"),A=r.getContext("2d");r.width=i,r.height=a,A.drawImage(t.domElement,0,0,i,a);const c=new $i(r);return c.minFilter=o.minFilter,c.magFilter=o.magFilter,c.wrapS=o.wrapS,c.wrapT=o.wrapT,c.colorSpace=o.colorSpace,c.name=o.name,Gs&&(Gs.forceContextLoss(),Gs.dispose(),Gs=null),c}const fo={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 Ci{constructor(){this.pluginCallbacks=[],this.register(function(e){return new _l(e)}),this.register(function(e){return new Fl(e)}),this.register(function(e){return new Gl(e)}),this.register(function(e){return new Pl(e)}),this.register(function(e){return new Ol(e)}),this.register(function(e){return new Hl(e)}),this.register(function(e){return new Ll(e)}),this.register(function(e){return new Nl(e)}),this.register(function(e){return new Ul(e)}),this.register(function(e){return new jl(e)}),this.register(function(e){return new ql(e)}),this.register(function(e){return new zl(e)}),this.register(function(e){return new Kl(e)}),this.register(function(e){return new Yl(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 i=new Ml,a=[];for(let r=0,A=this.pluginCallbacks.length;r<A;r++)a.push(this.pluginCallbacks[r](i));i.setPlugins(a),i.write(e,t,s).catch(n)}parseAsync(e,t){const n=this;return new Promise(function(s,i){n.parse(e,s,i,t)})}}const ae={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,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},Bi="KHR_mesh_quantization",rt={};rt[Ks]=ae.NEAREST,rt[wn]=ae.NEAREST_MIPMAP_NEAREST,rt[Fi]=ae.NEAREST_MIPMAP_LINEAR,rt[at]=ae.LINEAR,rt[Li]=ae.LINEAR_MIPMAP_NEAREST,rt[bs]=ae.LINEAR_MIPMAP_LINEAR,rt[Ys]=ae.CLAMP_TO_EDGE,rt[Vt]=ae.REPEAT,rt[Ni]=ae.MIRRORED_REPEAT;const mo={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},Ql=new we,bo=12,vl=1179937895,xl=2,Io=8,Sl=1313821514,Tl=5130562;function Ps(o,e){return o.length===e.length&&o.every(function(t,n){return t===e[n]})}function Rl(o){return new TextEncoder().encode(o).buffer}function Dl(o){return Ps(o.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function kl(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 i=0;i<o.itemSize;i++){let a;o.itemSize>4?a=o.array[s*o.itemSize+i]:(i===0?a=o.getX(s):i===1?a=o.getY(s):i===2?a=o.getZ(s):i===3&&(a=o.getW(s)),o.normalized===!0&&(a=Ce.normalize(a,o.array))),n.min[i]=Math.min(n.min[i],a),n.max[i]=Math.max(n.max[i],a)}return n}function Eo(o){return Math.ceil(o/4)*4}function wi(o,e=0){const t=Eo(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 Co(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function Bo(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 Ml{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 r"+Lr}},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,i=s.buffers,a=s.json;n=s.options;const r=s.extensionsUsed,A=s.extensionsRequired,c=new Blob(i,{type:"application/octet-stream"}),l=Object.keys(r),h=Object.keys(A);if(l.length>0&&(a.extensionsUsed=l),h.length>0&&(a.extensionsRequired=h),a.buffers&&a.buffers.length>0&&(a.buffers[0].byteLength=c.size),n.binary===!0){const p=new FileReader;p.readAsArrayBuffer(c),p.onloadend=function(){const g=wi(p.result),u=new DataView(new ArrayBuffer(Io));u.setUint32(0,g.byteLength,!0),u.setUint32(4,Tl,!0);const b=wi(Rl(JSON.stringify(a)),32),f=new DataView(new ArrayBuffer(Io));f.setUint32(0,b.byteLength,!0),f.setUint32(4,Sl,!0);const E=new ArrayBuffer(bo),C=new DataView(E);C.setUint32(0,vl,!0),C.setUint32(4,xl,!0);const I=bo+f.byteLength+b.byteLength+u.byteLength+g.byteLength;C.setUint32(8,I,!0);const y=new Blob([E,f,b,u,g],{type:"application/octet-stream"}),w=new FileReader;w.readAsArrayBuffer(y),w.onloadend=function(){t(w.result)}}}else if(a.buffers&&a.buffers.length>0){const p=new FileReader;p.readAsDataURL(c),p.onloadend=function(){const g=p.result;a.buffers[0].uri=g,t(a)}}else t(a)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const n=this.options,s=this.extensionsUsed;try{const i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const a in i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],s[a]=!0;delete i.gltfExtensions}Object.keys(i).length>0&&(t.extras=i)}catch(i){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+i.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const n=new Map;n.set(!0,this.uid++),n.set(!1,this.uid++),this.uids.set(e,n)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new N;for(let n=0,s=e.count;n<s;n++)if(Math.abs(t.fromBufferAttribute(e,n).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 N;for(let i=0,a=n.count;i<a;i++)s.fromBufferAttribute(n,i),s.x===0&&s.y===0&&s.z===0?s.setX(1):s.normalize(),n.setXYZ(i,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 p.colorSpace===le?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 Cs&&(e=Ei(e)),t instanceof Cs&&(t=Ei(t));const s=e?e.image:null,i=t?t.image:null,a=Math.max(s?s.width:0,i?i.width:0),r=Math.max(s?s.height:0,i?i.height:0),A=Co();A.width=a,A.height=r;const c=A.getContext("2d",{willReadFrequently:!0});c.fillStyle="#00ffff",c.fillRect(0,0,a,r);const l=c.getImageData(0,0,a,r);if(s){c.drawImage(s,0,0,a,r);const p=n(e),g=c.getImageData(0,0,a,r).data;for(let u=2;u<g.length;u+=4)l.data[u]=p(g[u]/256)*256}if(i){c.drawImage(i,0,0,a,r);const p=n(t),g=c.getImageData(0,0,a,r).data;for(let u=1;u<g.length;u+=4)l.data[u]=p(g[u]/256)*256}c.putImageData(l,0,0);const h=(e||t).clone();return h.source=new Nr(A),h.colorSpace=tn,h.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),h}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,i){const a=this.json;a.bufferViews||(a.bufferViews=[]);let r;switch(t){case ae.BYTE:case ae.UNSIGNED_BYTE:r=1;break;case ae.SHORT:case ae.UNSIGNED_SHORT:r=2;break;default:r=4}let A=e.itemSize*r;i===ae.ARRAY_BUFFER&&(A=Math.ceil(A/4)*4);const c=Eo(s*A),l=new DataView(new ArrayBuffer(c));let h=0;for(let g=n;g<n+s;g++){for(let u=0;u<e.itemSize;u++){let b;e.itemSize>4?b=e.array[g*e.itemSize+u]:(u===0?b=e.getX(g):u===1?b=e.getY(g):u===2?b=e.getZ(g):u===3&&(b=e.getW(g)),e.normalized===!0&&(b=Ce.normalize(b,e.array))),t===ae.FLOAT?l.setFloat32(h,b,!0):t===ae.INT?l.setInt32(h,b,!0):t===ae.UNSIGNED_INT?l.setUint32(h,b,!0):t===ae.SHORT?l.setInt16(h,b,!0):t===ae.UNSIGNED_SHORT?l.setUint16(h,b,!0):t===ae.BYTE?l.setInt8(h,b):t===ae.UNSIGNED_BYTE&&l.setUint8(h,b),h+=r}h%A!==0&&(h+=A-h%A)}const p={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:c};return i!==void 0&&(p.target=i),i===ae.ARRAY_BUFFER&&(p.byteStride=A),this.byteOffset+=c,a.bufferViews.push(p),{id:a.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise(function(s){const i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){const a=wi(i.result),r={buffer:t.processBuffer(a),byteOffset:t.byteOffset,byteLength:a.byteLength};t.byteOffset+=a.byteLength,s(n.bufferViews.push(r)-1)}})}processAccessor(e,t,n,s){const i=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let r;if(e.array.constructor===Float32Array)r=ae.FLOAT;else if(e.array.constructor===Int32Array)r=ae.INT;else if(e.array.constructor===Uint32Array)r=ae.UNSIGNED_INT;else if(e.array.constructor===Int16Array)r=ae.SHORT;else if(e.array.constructor===Uint16Array)r=ae.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)r=ae.BYTE;else if(e.array.constructor===Uint8Array)r=ae.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===1/0)&&(s=e.count),s===0)return null;const A=kl(e,n,s);let c;t!==void 0&&(c=e===t.index?ae.ELEMENT_ARRAY_BUFFER:ae.ARRAY_BUFFER);const l=this.processBufferView(e,r,n,s,c),h={bufferView:l.id,byteOffset:l.byteOffset,componentType:r,count:s,max:A.max,min:A.min,type:a[e.itemSize]};return e.normalized===!0&&(h.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(h)-1}processImage(e,t,n,s="image/png"){if(e!==null){const i=this,a=i.cache,r=i.json,A=i.options,c=i.pending;a.images.has(e)||a.images.set(e,{});const l=a.images.get(e),h=s+":flipY/"+n.toString();if(l[h]!==void 0)return l[h];r.images||(r.images=[]);const p={mimeType:s},g=Co();g.width=Math.min(e.width,A.maxTextureSize),g.height=Math.min(e.height,A.maxTextureSize);const u=g.getContext("2d",{willReadFrequently:!0});if(n===!0&&(u.translate(0,g.height),u.scale(1,-1)),e.data!==void 0){t!==Pt&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>A.maxTextureSize||e.height>A.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const f=new Uint8ClampedArray(e.height*e.width*4);for(let E=0;E<f.length;E+=4)f[E+0]=e.data[E+0],f[E+1]=e.data[E+1],f[E+2]=e.data[E+2],f[E+3]=e.data[E+3];u.putImageData(new ImageData(f,e.width,e.height),0,0)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)u.drawImage(e,0,0,g.width,g.height);else throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");A.binary===!0?c.push(Bo(g,s).then(f=>i.processBufferViewImage(f)).then(f=>{p.bufferView=f})):g.toDataURL!==void 0?p.uri=g.toDataURL(s):c.push(Bo(g,s).then(f=>new FileReader().readAsDataURL(f)).then(f=>{p.uri=f}));const b=r.images.push(p)-1;return l[h]=b,b}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:rt[e.magFilter],minFilter:rt[e.minFilter],wrapS:rt[e.wrapS],wrapT:rt[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){const t=this.options,n=this.cache,s=this.json;if(n.textures.has(e))return n.textures.get(e);const i={keep:!0,newTexture:null};if(this._invokeAll(function(c){c.beforeWriteTexture&&c.beforeWriteTexture(e,i)}),i.keep===!1)return null;i.newTexture!=null&&(e=i.newTexture),s.textures||(s.textures=[]),e instanceof Cs&&(e=Ei(e,t.maxTextureSize));let a=e.userData.mimeType;a==="image/webp"&&(a="image/png");const r={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)};e.name&&(r.name=e.name),this._invokeAll(function(c){c.writeTexture&&c.writeTexture(e,r)});const A=s.textures.push(r)-1;return n.textures.set(e,A),A}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 i=e.color.toArray().concat([e.opacity]);Ps(i,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=i),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=.5,s.pbrMetallicRoughness.roughnessFactor=.5);const a=e.metalnessMap?.image?e.metalnessMap:void 0,r=e.roughnessMap?.image?e.roughnessMap:void 0;if(a||r){const c=this.buildMetalRoughTexture(a,r),l={index:this.processTexture(c),channel:c.channel};this.applyTextureTransform(l,c),s.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const c={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(c,e.map),s.pbrMetallicRoughness.baseColorTexture=c}if(e.emissive){const c=e.emissive;if(Math.max(c.r,c.g,c.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap?.image){const l={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(l,e.emissiveMap),s.emissiveTexture=l}}if(e.normalMap?.image){const c={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(c.scale=e.normalScale.x),this.applyTextureTransform(c,e.normalMap),s.normalTexture=c}if(e.aoMap?.image){const c={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(c.strength=e.aoMapIntensity),this.applyTextureTransform(c,e.aoMap),s.occlusionTexture=c}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),e.side===Qn&&(s.doubleSided=!0),e.name!==""&&(s.name=e.name),this.serializeUserData(e,s),this._invokeAll(function(c){c.writeMaterial&&c.writeMaterial(e,s)});const A=n.materials.push(s)-1;return t.materials.set(e,A),A}processMesh(e){const t={keep:!0};if(this._invokeAll(function(w){w.beforeWriteMesh&&w.beforeWriteMesh(e,t)}),t.keep!=!0)return null;const n=this.cache,s=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let w=0,x=e.material.length;w<x;w++)i.push(e.material[w].uuid);else i.push(e.material.uuid);const a=i.join(":");if(n.meshes.has(a))return n.meshes.get(a);const r=e.geometry;let A;e.isLineSegments?A=ae.LINES:e.isLineLoop?A=ae.LINE_LOOP:e.isLine?A=ae.LINE_STRIP:e.isPoints?A=ae.POINTS:A=e.material.wireframe?ae.LINES:ae.TRIANGLES;const c={},l={},h=[],p=[],g={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},u=r.getAttribute("normal");u!==void 0&&!this.isNormalizedNormalAttribute(u)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),r.setAttribute("normal",this.createNormalizedNormalAttribute(u)));let b=null;for(let w in r.attributes){if(w.slice(0,5)==="morph")continue;const x=r.attributes[w];if(w=g[w]||w.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(w)||(w="_"+w),n.attributes.has(this.getUID(x))){l[w]=n.attributes.get(this.getUID(x));continue}b=null;const T=x.array;w==="JOINTS_0"&&!(T instanceof Uint16Array)&&!(T instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new it(new Uint16Array(T),x.itemSize,x.normalized));const S=this.processAccessor(b||x,r);S!==null&&(w.startsWith("_")||this.detectMeshQuantization(w,x),l[w]=S,n.attributes.set(this.getUID(x),S))}if(u!==void 0&&r.setAttribute("normal",u),Object.keys(l).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const w=[],x=[],T={};if(e.morphTargetDictionary!==void 0)for(const S in e.morphTargetDictionary)T[e.morphTargetDictionary[S]]=S;for(let S=0;S<e.morphTargetInfluences.length;++S){const M={};let j=!1;for(const K in r.morphAttributes){if(K!=="position"&&K!=="normal"&&K!=="color"){j||(console.warn("GLTFExporter: Only POSITION, NORMAL and COLOR morph are supported."),j=!0);continue}const J=r.morphAttributes[K][S],V=K.toUpperCase()+(K==="color"?"_0":""),q=r.attributes[K];if(n.attributes.has(this.getUID(J,!0))){M[V]=n.attributes.get(this.getUID(J,!0));continue}const X=J.clone();if(!r.morphTargetsRelative)for(let W=0,ee=J.count;W<ee;W++)for(let $=0;$<J.itemSize;$++)$===0&&X.setX(W,J.getX(W)-q.getX(W)),$===1&&X.setY(W,J.getY(W)-q.getY(W)),$===2&&X.setZ(W,J.getZ(W)-q.getZ(W)),$===3&&X.setW(W,J.getW(W)-q.getW(W));M[V]=this.processAccessor(X,r),n.attributes.set(this.getUID(q,!0),M[V])}p.push(M),w.push(e.morphTargetInfluences[S]),e.morphTargetDictionary!==void 0&&x.push(T[S])}c.weights=w,x.length>0&&(c.extras={},c.extras.targetNames=x)}const f=Array.isArray(e.material);if(f&&r.groups.length===0)return null;let E=!1;if(f&&r.index===null){const w=[];for(let x=0,T=r.attributes.position.count;x<T;x++)w[x]=x;r.setIndex(w),E=!0}const C=f?e.material:[e.material],I=f?r.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let w=0,x=I.length;w<x;w++){const T={mode:A,attributes:l};if(this.serializeUserData(r,T),p.length>0&&(T.targets=p),r.index!==null){let M=this.getUID(r.index);(I[w].start!==void 0||I[w].count!==void 0)&&(M+=":"+I[w].start+":"+I[w].count),n.attributes.has(M)?T.indices=n.attributes.get(M):(T.indices=this.processAccessor(r.index,r,I[w].start,I[w].count),n.attributes.set(M,T.indices)),T.indices===null&&delete T.indices}const S=this.processMaterial(C[I[w].materialIndex]);S!==null&&(T.material=S),h.push(T)}E===!0&&r.setIndex(null),c.primitives=h,s.meshes||(s.meshes=[]),this._invokeAll(function(w){w.writeMesh&&w.writeMesh(e,c)});const y=s.meshes.push(c)-1;return n.meshes.set(a,y),y}detectMeshQuantization(e,t){if(this.extensionsUsed[Bi])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];fo[s]&&fo[s].includes(n)&&(this.extensionsUsed[Bi]=!0,this.extensionsRequired[Bi]=!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:Ce.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=Ci.Utils.mergeMorphTargetTracks(e.clone(),t);const i=e.tracks,a=[],r=[];for(let A=0;A<i.length;++A){const c=i[A],l=ut.parseTrackName(c.name);let h=ut.findNode(t,l.nodeName);const p=mo[l.propertyName];if(l.objectName==="bones"&&(h.isSkinnedMesh===!0?h=h.skeleton.getBoneByName(l.objectIndex):h=void 0),!h||!p){console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name);continue}const g=1;let u=c.values.length/c.times.length;p===mo.morphTargetInfluences&&(u/=h.morphTargetInfluences.length);let b;c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(b="CUBICSPLINE",u/=3):c.getInterpolation()===Tn?b="STEP":b="LINEAR",r.push({input:this.processAccessor(new it(c.times,g)),output:this.processAccessor(new it(c.values,u)),interpolation:b}),a.push({sampler:r.length-1,target:{node:s.get(h),path:p}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:r,channels:a}),n.animations.length-1}processSkin(e){const t=this.json,n=this.nodeMap,s=t.nodes[n.get(e)],i=e.skeleton;if(i===void 0)return null;const a=e.skeleton.bones[0];if(a===void 0)return null;const r=[],A=new Float32Array(i.bones.length*16),c=new ce;for(let l=0;l<i.bones.length;++l)r.push(n.get(i.bones[l])),c.copy(i.boneInverses[l]),c.multiply(e.bindMatrix).toArray(A,l*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new it(A,16)),joints:r,skeleton:n.get(a)}),s.skin=t.skins.length-1}processNode(e){const t={keep:!0};if(this._invokeAll(function(A){A.beforeWriteNode&&A.beforeWriteNode(e,t)}),t.keep!=!0)return null;const n=this.json,s=this.options,i=this.nodeMap;n.nodes||(n.nodes=[]);const a={};if(s.trs){const A=e.quaternion.toArray(),c=e.position.toArray(),l=e.scale.toArray();Ps(A,[0,0,0,1])||(a.rotation=A),Ps(c,[0,0,0])||(a.translation=c),Ps(l,[1,1,1])||(a.scale=l)}else e.matrixAutoUpdate&&e.updateMatrix(),Dl(e.matrix)===!1&&(a.matrix=e.matrix.elements);if(e.name!==""&&(a.name=String(e.name)),this.serializeUserData(e,a),e.isMesh||e.isLine||e.isPoints){const A=this.processMesh(e);A!==null&&(a.mesh=A)}else e.isCamera&&(a.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const A=[];for(let c=0,l=e.children.length;c<l;c++){const h=e.children[c];if(h.visible||s.onlyVisible===!1){const p=this.processNode(h);p!==null&&A.push(p)}}A.length>0&&(a.children=A)}this._invokeAll(function(A){A.writeNode&&A.writeNode(e,a)});const r=n.nodes.push(a)-1;return i.set(e,r),r}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 i=[];for(let a=0,r=e.children.length;a<r;a++){const A=e.children[a];if(A.visible||n.onlyVisible===!1){const c=this.processNode(A);c!==null&&i.push(c)}}i.length>0&&(s.nodes=i),this.serializeUserData(e,s)}processObjects(e){const t=new Un;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 Un?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 _l{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,i=n.extensionsUsed,a={};e.name&&(a.name=e.name),a.color=e.color.toArray(),a.intensity=e.intensity,e.isDirectionalLight?a.type="directional":e.isPointLight?(a.type="point",e.distance>0&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(1-e.penumbra)*e.angle,a.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."),i[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},i[this.name]=!0);const r=s.extensions[this.name].lights;r.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:r.length-1}}}class Fl{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const n=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},n[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class Ll{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,i={};if(i.clearcoatFactor=e.clearcoat,e.clearcoatMap){const a={index:n.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};n.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a}if(i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const a={index:n.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};n.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a}if(e.clearcoatNormalMap){const a={index:n.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(a.scale=e.clearcoatNormalScale.x),n.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=i,s[this.name]=!0}}class Nl{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;const n=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,n[this.name]=!0}}class Ul{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,i={};if(i.iridescenceFactor=e.iridescence,e.iridescenceMap){const a={index:n.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};n.applyTextureTransform(a,e.iridescenceMap),i.iridescenceTexture=a}if(i.iridescenceIor=e.iridescenceIOR,i.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const a={index:n.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};n.applyTextureTransform(a,e.iridescenceThicknessMap),i.iridescenceThicknessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=i,s[this.name]=!0}}class Gl{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,i={};if(i.transmissionFactor=e.transmission,e.transmissionMap){const a={index:n.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=i,s[this.name]=!0}}class Pl{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,i={};if(i.thicknessFactor=e.thickness,e.thicknessMap){const a={index:n.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};n.applyTextureTransform(a,e.thicknessMap),i.thicknessTexture=a}e.attenuationDistance!==1/0&&(i.attenuationDistance=e.attenuationDistance),i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,s[this.name]=!0}}class Ol{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const n=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,n[this.name]=!0}}class Hl{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(Ql)&&!e.specularIntensityMap&&!e.specularColorMap)return;const n=this.writer,s=n.extensionsUsed,i={};if(e.specularIntensityMap){const a={index:n.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};n.applyTextureTransform(a,e.specularIntensityMap),i.specularTexture=a}if(e.specularColorMap){const a={index:n.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};n.applyTextureTransform(a,e.specularColorMap),i.specularColorTexture=a}i.specularFactor=e.specularIntensity,i.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,s[this.name]=!0}}class jl{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,i={};if(e.sheenRoughnessMap){const a={index:n.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(a,e.sheenRoughnessMap),i.sheenRoughnessTexture=a}if(e.sheenColorMap){const a={index:n.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(a,e.sheenColorMap),i.sheenColorTexture=a}i.sheenRoughnessFactor=e.sheenRoughness,i.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,s[this.name]=!0}}class ql{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,i={};if(e.anisotropyMap){const a={index:n.processTexture(e.anisotropyMap)};n.applyTextureTransform(a,e.anisotropyMap),i.anisotropyTexture=a}i.anisotropyStrength=e.anisotropy,i.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=i,s[this.name]=!0}}class zl{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const n=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,n[this.name]=!0}}class Kl{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const n=this.writer,s=n.extensionsUsed,i={};if(e.bumpMap){const a={index:n.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};n.applyTextureTransform(a,e.bumpMap),i.bumpTexture=a}i.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=i,s[this.name]=!0}}class Yl{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const n=this.writer,s=e,i=new Float32Array(s.count*3),a=new Float32Array(s.count*4),r=new Float32Array(s.count*3),A=new ce,c=new N,l=new ye,h=new N;for(let g=0;g<s.count;g++)s.getMatrixAt(g,A),A.decompose(c,l,h),c.toArray(i,g*3),l.toArray(a,g*4),h.toArray(r,g*3);const p={TRANSLATION:n.processAccessor(new it(i,3)),ROTATION:n.processAccessor(new it(a,4)),SCALE:n.processAccessor(new it(r,3))};s.instanceColor&&(p._COLOR_0=n.processAccessor(s.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:p},n.extensionsUsed[this.name]=!0,n.extensionsRequired[this.name]=!0}}Ci.Utils={insertKeyframe:function(o,e){const t=o.getValueSize(),n=new o.TimeBufferType(o.times.length+1),s=new o.ValueBufferType(o.values.length+t),i=o.createInterpolant(new o.ValueBufferType(t));let a;if(o.times.length===0){n[0]=e;for(let r=0;r<t;r++)s[r]=0;a=0}else if(e<o.times[0]){if(Math.abs(o.times[0]-e)<.001)return 0;n[0]=e,n.set(o.times,1),s.set(i.evaluate(e),0),s.set(o.values,t),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;n[n.length-1]=e,n.set(o.times,0),s.set(o.values,0),s.set(i.evaluate(e),o.values.length),a=n.length-1}else for(let r=0;r<o.times.length;r++){if(Math.abs(o.times[r]-e)<.001)return r;if(o.times[r]<e&&o.times[r+1]>e){n.set(o.times.slice(0,r+1),0),n[r+1]=e,n.set(o.times.slice(r+1),r+2),s.set(o.values.slice(0,(r+1)*t),0),s.set(i.evaluate(e),(r+1)*t),s.set(o.values.slice((r+1)*t),(r+2)*t),a=r+1;break}}return o.times=n,o.values=s,a},mergeMorphTargetTracks:function(o,e){const t=[],n={},s=o.tracks;for(let i=0;i<s.length;++i){let a=s[i];const r=ut.parseTrackName(a.name),A=ut.findNode(e,r.nodeName);if(r.propertyName!=="morphTargetInfluences"||r.propertyIndex===void 0){t.push(a);continue}if(a.createInterpolant!==a.InterpolantFactoryMethodDiscrete&&a.createInterpolant!==a.InterpolantFactoryMethodLinear){if(a.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."),a=a.clone(),a.setInterpolation(Es)}const c=A.morphTargetInfluences.length,l=A.morphTargetDictionary[r.propertyIndex];if(l===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+r.propertyIndex);let h;if(n[A.uuid]===void 0){h=a.clone();const g=new h.ValueBufferType(c*h.times.length);for(let u=0;u<h.times.length;u++)g[u*c+l]=h.values[u];h.name=(r.nodeName||"")+".morphTargetInfluences",h.values=g,n[A.uuid]=h,t.push(h);continue}const p=a.createInterpolant(new a.ValueBufferType(1));h=n[A.uuid];for(let g=0;g<h.times.length;g++)h.values[g*c+l]=p.evaluate(h.times[g]);for(let g=0;g<a.times.length;g++){const u=this.insertKeyframe(h,a.times[g]);h.values[u*c+l]=a.values[g]}}return o.tracks=t,o}};const Qe={ComponentState:Object.freeze({DEFAULT:"default",TOUCHED:"touched",PRESSED:"pressed"}),ComponentProperty:Object.freeze({BUTTON:"button",X_AXIS:"xAxis",Y_AXIS:"yAxis",STATE:"state"}),ComponentType:Object.freeze({TRIGGER:"trigger",SQUEEZE:"squeeze",TOUCHPAD:"touchpad",THUMBSTICK:"thumbstick",BUTTON:"button"}),ButtonTouchThreshold:.05,AxisTouchThreshold:.1,VisualResponseProperty:Object.freeze({TRANSFORM:"transform",VISIBILITY:"visibility"})};async function wo(o){const e=await fetch(o);if(e.ok)return e.json();throw new Error(e.statusText)}async function Jl(o){if(!o)throw new Error("No basePath supplied");return await wo(`${o}/profilesList.json`)}async function Wl(o,e,t=null,n=!0){if(!o)throw new Error("No xrInputSource supplied");if(!e)throw new Error("No basePath supplied");const s=await Jl(e);let i;if(o.profiles.some(A=>{const c=s[A];return c&&(i={profileId:A,profilePath:`${e}/${c.path}`,deprecated:!!c.deprecated}),!!i}),!i){if(!t)throw new Error("No matching profile name found");const A=s[t];if(!A)throw new Error(`No matching profile name found and default profile "${t}" missing.`);i={profileId:t,profilePath:`${e}/${A.path}`,deprecated:!!A.deprecated}}const a=await wo(i.profilePath);let r;if(n){let A;if(o.handedness==="any"?A=a.layouts[Object.keys(a.layouts)[0]]:A=a.layouts[o.handedness],!A)throw new Error(`No matching handedness, ${o.handedness}, in profile ${i.profileId}`);A.assetPath&&(r=i.profilePath.replace("profile.json",A.assetPath))}return{profile:a,assetPath:r}}const Vl={xAxis:0,yAxis:0,button:0,state:Qe.ComponentState.DEFAULT};function Xl(o=0,e=0){let t=o,n=e;if(Math.sqrt(o*o+e*e)>1){const s=Math.atan2(e,o);t=Math.cos(s),n=Math.sin(s)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:n*.5+.5}}class Zl{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===Qe.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(Vl)}updateFromComponent({xAxis:e,yAxis:t,button:n,state:s}){const{normalizedXAxis:i,normalizedYAxis:a}=Xl(e,t);switch(this.componentProperty){case Qe.ComponentProperty.X_AXIS:this.value=this.states.includes(s)?i:.5;break;case Qe.ComponentProperty.Y_AXIS:this.value=this.states.includes(s)?a:.5;break;case Qe.ComponentProperty.BUTTON:this.value=this.states.includes(s)?n:0;break;case Qe.ComponentProperty.STATE:this.valueNodeProperty===Qe.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(s):this.value=this.states.includes(s)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class $l{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(n=>{const s=new Zl(t.visualResponses[n]);this.visualResponses[n]=s}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:Qe.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=Qe.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=Qe.ComponentState.PRESSED:(t.touched||this.values.button>Qe.ButtonTouchThreshold)&&(this.values.state=Qe.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===Qe.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>Qe.AxisTouchThreshold&&(this.values.state=Qe.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===Qe.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>Qe.AxisTouchThreshold&&(this.values.state=Qe.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class eh{constructor(e,t,n){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(s=>{const i=this.layoutDescription.components[s];this.components[s]=new $l(s,i)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const th="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",sh="generic-trigger";class nh extends yt{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(t=>{t.isMesh&&(t.material.envMap=this.envMap,t.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(t=>{Object.values(t.visualResponses).forEach(n=>{const{valueNode:s,minNode:i,maxNode:a,value:r,valueNodeProperty:A}=n;s&&(A===Qe.VisualResponseProperty.VISIBILITY?s.visible=r:A===Qe.VisualResponseProperty.TRANSFORM&&(s.quaternion.slerpQuaternions(i.quaternion,a.quaternion,r),s.position.lerpVectors(i.position,a.position,r)))})}))}}function ih(o,e){Object.values(o.components).forEach(t=>{const{type:n,touchPointNodeName:s,visualResponses:i}=t;if(n===Qe.ComponentType.TOUCHPAD)if(t.touchPointNode=e.getObjectByName(s),t.touchPointNode){const a=new bn(.001),r=new Ct({color:255}),A=new O(a,r);t.touchPointNode.add(A)}else console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);Object.values(i).forEach(a=>{const{valueNodeName:r,minNodeName:A,maxNodeName:c,valueNodeProperty:l}=a;if(l===Qe.VisualResponseProperty.TRANSFORM){if(a.minNode=e.getObjectByName(A),a.maxNode=e.getObjectByName(c),!a.minNode){console.warn(`Could not find ${A} in the model`);return}if(!a.maxNode){console.warn(`Could not find ${c} in the model`);return}}a.valueNode=e.getObjectByName(r),a.valueNode||console.warn(`Could not find ${r} in the model`)})})}function yo(o,e){ih(o.motionController,e),o.envMap&&e.traverse(t=>{t.isMesh&&(t.material.envMap=o.envMap,t.material.needsUpdate=!0)}),o.layers.mask!=0&&e.traverse(t=>{t.layers.mask=o.layers.mask}),o.add(e)}class ah{constructor(e=null,t=null){this.gltfLoader=e,this.path=th,this._assetCache={},this.onLoad=t,this.gltfLoader||(this.gltfLoader=new Pn)}setPath(e){return this.path=e,this}createControllerModel(e){const t=new nh;let n=null;return e.addEventListener("connected",s=>{const i=s.data;i.targetRayMode!=="tracked-pointer"||!i.gamepad||i.hand||Wl(i,this.path,sh).then(({profile:a,assetPath:r})=>{t.motionController=new eh(i,a,r);const A=this._assetCache[t.motionController.assetUrl];if(A)n=A.scene.clone(),yo(t,n),this.onLoad&&this.onLoad(n);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(t.motionController.assetUrl,c=>{this._assetCache[t.motionController.assetUrl]=c,n=c.scene.clone(),yo(t,n),this.onLoad&&this.onLoad(n)},null,()=>{throw new Error(`Asset ${t.motionController.assetUrl} missing or malformed.`)})}}).catch(a=>{console.warn(a)})}),e.addEventListener("disconnected",()=>{t.motionController=null,t.remove(n),n=null}),t}}const oh="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles/generic-hand/";class rh{constructor(e,t,n,s,i=null,a=null){this.controller=t,this.handModel=e,this.bones=[],i===null&&(i=new Pn,i.setPath(n||oh)),i.load(`${s}.glb`,r=>{const A=r.scene.children[0];this.handModel.add(A),A.layers.mask=this.handModel.layers.mask;const c=A.getObjectByProperty("type","SkinnedMesh");c.frustumCulled=!1,c.castShadow=!0,c.receiveShadow=!0,["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"].forEach(l=>{const h=A.getObjectByName(l);h!==void 0?h.jointName=l:console.warn(`Couldn't find ${l} in ${s} hand mesh`),this.bones.push(h)}),a&&a(A)})}updateMesh(){const e=this.controller.joints;for(let t=0;t<this.bones.length;t++){const n=this.bones[t];if(n){const s=e[n.jointName];if(s.visible){const i=s.position;n.position.copy(i),n.quaternion.copy(s.quaternion)}}}}}const Qo=new $s,gn=new N;class vo extends Ur{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 ke(e,3)),this.setAttribute("uv",new ke(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 Gn(t,6,1);return this.setAttribute("instanceStart",new Zt(n,3,0)),this.setAttribute("instanceEnd",new Zt(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 Gn(t,6,1);return this.setAttribute("instanceColorStart",new Zt(n,3,0)),this.setAttribute("instanceColorEnd",new Zt(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 Gr(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new $s);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Qo.setFromBufferAttribute(t),this.boundingBox.union(Qo))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Dn),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let s=0;for(let i=0,a=e.count;i<a;i++)gn.fromBufferAttribute(e,i),s=Math.max(s,n.distanceToSquared(gn)),gn.fromBufferAttribute(t,i),s=Math.max(s,n.distanceToSquared(gn));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)}}ms.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Le(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Bt.line={uniforms:In.merge([ms.common,ms.fog,ms.line]),vertexShader:`
|
|
132
|
-
#include <common>
|
|
133
|
-
#include <color_pars_vertex>
|
|
134
|
-
#include <fog_pars_vertex>
|
|
135
|
-
#include <logdepthbuf_pars_vertex>
|
|
136
|
-
#include <clipping_planes_pars_vertex>
|
|
137
|
-
|
|
138
|
-
uniform float linewidth;
|
|
139
|
-
uniform vec2 resolution;
|
|
140
|
-
|
|
141
|
-
attribute vec3 instanceStart;
|
|
142
|
-
attribute vec3 instanceEnd;
|
|
143
|
-
|
|
144
|
-
attribute vec3 instanceColorStart;
|
|
145
|
-
attribute vec3 instanceColorEnd;
|
|
146
|
-
|
|
147
|
-
#ifdef WORLD_UNITS
|
|
148
|
-
|
|
149
|
-
varying vec4 worldPos;
|
|
150
|
-
varying vec3 worldStart;
|
|
151
|
-
varying vec3 worldEnd;
|
|
152
|
-
|
|
153
|
-
#ifdef USE_DASH
|
|
154
|
-
|
|
155
|
-
varying vec2 vUv;
|
|
156
|
-
|
|
157
|
-
#endif
|
|
158
|
-
|
|
159
|
-
#else
|
|
160
|
-
|
|
161
|
-
varying vec2 vUv;
|
|
162
|
-
|
|
163
|
-
#endif
|
|
164
|
-
|
|
165
|
-
#ifdef USE_DASH
|
|
166
|
-
|
|
167
|
-
uniform float dashScale;
|
|
168
|
-
attribute float instanceDistanceStart;
|
|
169
|
-
attribute float instanceDistanceEnd;
|
|
170
|
-
varying float vLineDistance;
|
|
171
|
-
|
|
172
|
-
#endif
|
|
173
|
-
|
|
174
|
-
void trimSegment( const in vec4 start, inout vec4 end ) {
|
|
175
|
-
|
|
176
|
-
// trim end segment so it terminates between the camera plane and the near plane
|
|
177
|
-
|
|
178
|
-
// conservative estimate of the near plane
|
|
179
|
-
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
180
|
-
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
181
|
-
float nearEstimate = - 0.5 * b / a;
|
|
182
|
-
|
|
183
|
-
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
184
|
-
|
|
185
|
-
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
void main() {
|
|
190
|
-
|
|
191
|
-
#ifdef USE_COLOR
|
|
192
|
-
|
|
193
|
-
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
194
|
-
|
|
195
|
-
#endif
|
|
196
|
-
|
|
197
|
-
#ifdef USE_DASH
|
|
198
|
-
|
|
199
|
-
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
|
200
|
-
vUv = uv;
|
|
201
|
-
|
|
202
|
-
#endif
|
|
203
|
-
|
|
204
|
-
float aspect = resolution.x / resolution.y;
|
|
205
|
-
|
|
206
|
-
// camera space
|
|
207
|
-
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
208
|
-
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
209
|
-
|
|
210
|
-
#ifdef WORLD_UNITS
|
|
211
|
-
|
|
212
|
-
worldStart = start.xyz;
|
|
213
|
-
worldEnd = end.xyz;
|
|
214
|
-
|
|
215
|
-
#else
|
|
216
|
-
|
|
217
|
-
vUv = uv;
|
|
218
|
-
|
|
219
|
-
#endif
|
|
220
|
-
|
|
221
|
-
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
222
|
-
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
223
|
-
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
224
|
-
// perhaps there is a more elegant solution -- WestLangley
|
|
225
|
-
|
|
226
|
-
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
227
|
-
|
|
228
|
-
if ( perspective ) {
|
|
229
|
-
|
|
230
|
-
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
231
|
-
|
|
232
|
-
trimSegment( start, end );
|
|
233
|
-
|
|
234
|
-
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
235
|
-
|
|
236
|
-
trimSegment( end, start );
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// clip space
|
|
243
|
-
vec4 clipStart = projectionMatrix * start;
|
|
244
|
-
vec4 clipEnd = projectionMatrix * end;
|
|
245
|
-
|
|
246
|
-
// ndc space
|
|
247
|
-
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
248
|
-
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
249
|
-
|
|
250
|
-
// direction
|
|
251
|
-
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
252
|
-
|
|
253
|
-
// account for clip-space aspect ratio
|
|
254
|
-
dir.x *= aspect;
|
|
255
|
-
dir = normalize( dir );
|
|
256
|
-
|
|
257
|
-
#ifdef WORLD_UNITS
|
|
258
|
-
|
|
259
|
-
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
260
|
-
vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
|
|
261
|
-
vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
|
|
262
|
-
vec3 worldFwd = cross( worldDir, worldUp );
|
|
263
|
-
worldPos = position.y < 0.5 ? start: end;
|
|
264
|
-
|
|
265
|
-
// height offset
|
|
266
|
-
float hw = linewidth * 0.5;
|
|
267
|
-
worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
|
|
268
|
-
|
|
269
|
-
// don't extend the line if we're rendering dashes because we
|
|
270
|
-
// won't be rendering the endcaps
|
|
271
|
-
#ifndef USE_DASH
|
|
272
|
-
|
|
273
|
-
// cap extension
|
|
274
|
-
worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
|
|
275
|
-
|
|
276
|
-
// add width to the box
|
|
277
|
-
worldPos.xyz += worldFwd * hw;
|
|
278
|
-
|
|
279
|
-
// endcaps
|
|
280
|
-
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
281
|
-
|
|
282
|
-
worldPos.xyz -= worldFwd * 2.0 * hw;
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
#endif
|
|
287
|
-
|
|
288
|
-
// project the worldpos
|
|
289
|
-
vec4 clip = projectionMatrix * worldPos;
|
|
290
|
-
|
|
291
|
-
// shift the depth of the projected points so the line
|
|
292
|
-
// segments overlap neatly
|
|
293
|
-
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
294
|
-
clip.z = clipPose.z * clip.w;
|
|
295
|
-
|
|
296
|
-
#else
|
|
297
|
-
|
|
298
|
-
vec2 offset = vec2( dir.y, - dir.x );
|
|
299
|
-
// undo aspect ratio adjustment
|
|
300
|
-
dir.x /= aspect;
|
|
301
|
-
offset.x /= aspect;
|
|
302
|
-
|
|
303
|
-
// sign flip
|
|
304
|
-
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
305
|
-
|
|
306
|
-
// endcaps
|
|
307
|
-
if ( position.y < 0.0 ) {
|
|
308
|
-
|
|
309
|
-
offset += - dir;
|
|
310
|
-
|
|
311
|
-
} else if ( position.y > 1.0 ) {
|
|
312
|
-
|
|
313
|
-
offset += dir;
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// adjust for linewidth
|
|
318
|
-
offset *= linewidth;
|
|
319
|
-
|
|
320
|
-
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
321
|
-
offset /= resolution.y;
|
|
322
|
-
|
|
323
|
-
// select end
|
|
324
|
-
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
325
|
-
|
|
326
|
-
// back to clip space
|
|
327
|
-
offset *= clip.w;
|
|
328
|
-
|
|
329
|
-
clip.xy += offset;
|
|
330
|
-
|
|
331
|
-
#endif
|
|
332
|
-
|
|
333
|
-
gl_Position = clip;
|
|
334
|
-
|
|
335
|
-
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
336
|
-
|
|
337
|
-
#include <logdepthbuf_vertex>
|
|
338
|
-
#include <clipping_planes_vertex>
|
|
339
|
-
#include <fog_vertex>
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
`,fragmentShader:`
|
|
343
|
-
uniform vec3 diffuse;
|
|
344
|
-
uniform float opacity;
|
|
345
|
-
uniform float linewidth;
|
|
346
|
-
|
|
347
|
-
#ifdef USE_DASH
|
|
348
|
-
|
|
349
|
-
uniform float dashOffset;
|
|
350
|
-
uniform float dashSize;
|
|
351
|
-
uniform float gapSize;
|
|
352
|
-
|
|
353
|
-
#endif
|
|
354
|
-
|
|
355
|
-
varying float vLineDistance;
|
|
356
|
-
|
|
357
|
-
#ifdef WORLD_UNITS
|
|
358
|
-
|
|
359
|
-
varying vec4 worldPos;
|
|
360
|
-
varying vec3 worldStart;
|
|
361
|
-
varying vec3 worldEnd;
|
|
362
|
-
|
|
363
|
-
#ifdef USE_DASH
|
|
364
|
-
|
|
365
|
-
varying vec2 vUv;
|
|
366
|
-
|
|
367
|
-
#endif
|
|
368
|
-
|
|
369
|
-
#else
|
|
370
|
-
|
|
371
|
-
varying vec2 vUv;
|
|
372
|
-
|
|
373
|
-
#endif
|
|
374
|
-
|
|
375
|
-
#include <common>
|
|
376
|
-
#include <color_pars_fragment>
|
|
377
|
-
#include <fog_pars_fragment>
|
|
378
|
-
#include <logdepthbuf_pars_fragment>
|
|
379
|
-
#include <clipping_planes_pars_fragment>
|
|
380
|
-
|
|
381
|
-
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
382
|
-
|
|
383
|
-
float mua;
|
|
384
|
-
float mub;
|
|
385
|
-
|
|
386
|
-
vec3 p13 = p1 - p3;
|
|
387
|
-
vec3 p43 = p4 - p3;
|
|
388
|
-
|
|
389
|
-
vec3 p21 = p2 - p1;
|
|
390
|
-
|
|
391
|
-
float d1343 = dot( p13, p43 );
|
|
392
|
-
float d4321 = dot( p43, p21 );
|
|
393
|
-
float d1321 = dot( p13, p21 );
|
|
394
|
-
float d4343 = dot( p43, p43 );
|
|
395
|
-
float d2121 = dot( p21, p21 );
|
|
396
|
-
|
|
397
|
-
float denom = d2121 * d4343 - d4321 * d4321;
|
|
398
|
-
|
|
399
|
-
float numer = d1343 * d4321 - d1321 * d4343;
|
|
400
|
-
|
|
401
|
-
mua = numer / denom;
|
|
402
|
-
mua = clamp( mua, 0.0, 1.0 );
|
|
403
|
-
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
404
|
-
mub = clamp( mub, 0.0, 1.0 );
|
|
405
|
-
|
|
406
|
-
return vec2( mua, mub );
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
void main() {
|
|
411
|
-
|
|
412
|
-
#include <clipping_planes_fragment>
|
|
413
|
-
|
|
414
|
-
#ifdef USE_DASH
|
|
415
|
-
|
|
416
|
-
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
417
|
-
|
|
418
|
-
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
419
|
-
|
|
420
|
-
#endif
|
|
421
|
-
|
|
422
|
-
float alpha = opacity;
|
|
423
|
-
|
|
424
|
-
#ifdef WORLD_UNITS
|
|
425
|
-
|
|
426
|
-
// Find the closest points on the view ray and the line segment
|
|
427
|
-
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
428
|
-
vec3 lineDir = worldEnd - worldStart;
|
|
429
|
-
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
430
|
-
|
|
431
|
-
vec3 p1 = worldStart + lineDir * params.x;
|
|
432
|
-
vec3 p2 = rayEnd * params.y;
|
|
433
|
-
vec3 delta = p1 - p2;
|
|
434
|
-
float len = length( delta );
|
|
435
|
-
float norm = len / linewidth;
|
|
436
|
-
|
|
437
|
-
#ifndef USE_DASH
|
|
438
|
-
|
|
439
|
-
#ifdef USE_ALPHA_TO_COVERAGE
|
|
440
|
-
|
|
441
|
-
float dnorm = fwidth( norm );
|
|
442
|
-
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
443
|
-
|
|
444
|
-
#else
|
|
445
|
-
|
|
446
|
-
if ( norm > 0.5 ) {
|
|
447
|
-
|
|
448
|
-
discard;
|
|
449
|
-
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
#endif
|
|
453
|
-
|
|
454
|
-
#endif
|
|
455
|
-
|
|
456
|
-
#else
|
|
457
|
-
|
|
458
|
-
#ifdef USE_ALPHA_TO_COVERAGE
|
|
459
|
-
|
|
460
|
-
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
461
|
-
float a = vUv.x;
|
|
462
|
-
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
463
|
-
float len2 = a * a + b * b;
|
|
464
|
-
float dlen = fwidth( len2 );
|
|
465
|
-
|
|
466
|
-
if ( abs( vUv.y ) > 1.0 ) {
|
|
467
|
-
|
|
468
|
-
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
#else
|
|
473
|
-
|
|
474
|
-
if ( abs( vUv.y ) > 1.0 ) {
|
|
475
|
-
|
|
476
|
-
float a = vUv.x;
|
|
477
|
-
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
478
|
-
float len2 = a * a + b * b;
|
|
479
|
-
|
|
480
|
-
if ( len2 > 1.0 ) discard;
|
|
481
|
-
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
#endif
|
|
485
|
-
|
|
486
|
-
#endif
|
|
487
|
-
|
|
488
|
-
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
489
|
-
|
|
490
|
-
#include <logdepthbuf_fragment>
|
|
491
|
-
#include <color_fragment>
|
|
492
|
-
|
|
493
|
-
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
494
|
-
|
|
495
|
-
#include <tonemapping_fragment>
|
|
496
|
-
#include <colorspace_fragment>
|
|
497
|
-
#include <fog_fragment>
|
|
498
|
-
#include <premultiplied_alpha_fragment>
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
`};class yi extends Zi{constructor(e){super({type:"LineMaterial",uniforms:In.clone(Bt.line.uniforms),vertexShader:Bt.line.vertexShader,fragmentShader:Bt.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 Qi=new Mt,xo=new N,So=new N,Pe=new Mt,Oe=new Mt,xt=new Mt,vi=new N,xi=new ce,He=new Pr,To=new N,un=new $s,fn=new Dn,St=new Mt;let Tt,ns;function Ro(o,e,t){return St.set(0,0,-e,1).applyMatrix4(o.projectionMatrix),St.multiplyScalar(1/St.w),St.x=ns/t.width,St.y=ns/t.height,St.applyMatrix4(o.projectionMatrixInverse),St.multiplyScalar(1/St.w),Math.abs(Math.max(St.x,St.y))}function Ah(o,e){const t=o.matrixWorld,n=o.geometry,s=n.attributes.instanceStart,i=n.attributes.instanceEnd,a=Math.min(n.instanceCount,s.count);for(let r=0,A=a;r<A;r++){He.start.fromBufferAttribute(s,r),He.end.fromBufferAttribute(i,r),He.applyMatrix4(t);const c=new N,l=new N;Tt.distanceSqToSegment(He.start,He.end,l,c),l.distanceTo(c)<ns*.5&&e.push({point:l,pointOnLine:c,distance:Tt.origin.distanceTo(l),object:o,face:null,faceIndex:r,uv:null,uv1:null})}}function ch(o,e,t){const n=e.projectionMatrix,s=o.material.resolution,i=o.matrixWorld,a=o.geometry,r=a.attributes.instanceStart,A=a.attributes.instanceEnd,c=Math.min(a.instanceCount,r.count),l=-e.near;Tt.at(1,xt),xt.w=1,xt.applyMatrix4(e.matrixWorldInverse),xt.applyMatrix4(n),xt.multiplyScalar(1/xt.w),xt.x*=s.x/2,xt.y*=s.y/2,xt.z=0,vi.copy(xt),xi.multiplyMatrices(e.matrixWorldInverse,i);for(let h=0,p=c;h<p;h++){if(Pe.fromBufferAttribute(r,h),Oe.fromBufferAttribute(A,h),Pe.w=1,Oe.w=1,Pe.applyMatrix4(xi),Oe.applyMatrix4(xi),Pe.z>l&&Oe.z>l)continue;if(Pe.z>l){const E=Pe.z-Oe.z,C=(Pe.z-l)/E;Pe.lerp(Oe,C)}else if(Oe.z>l){const E=Oe.z-Pe.z,C=(Oe.z-l)/E;Oe.lerp(Pe,C)}Pe.applyMatrix4(n),Oe.applyMatrix4(n),Pe.multiplyScalar(1/Pe.w),Oe.multiplyScalar(1/Oe.w),Pe.x*=s.x/2,Pe.y*=s.y/2,Oe.x*=s.x/2,Oe.y*=s.y/2,He.start.copy(Pe),He.start.z=0,He.end.copy(Oe),He.end.z=0;const g=He.closestPointToPointParameter(vi,!0);He.at(g,To);const u=Ce.lerp(Pe.z,Oe.z,g),b=u>=-1&&u<=1,f=vi.distanceTo(To)<ns*.5;if(b&&f){He.start.fromBufferAttribute(r,h),He.end.fromBufferAttribute(A,h),He.start.applyMatrix4(i),He.end.applyMatrix4(i);const E=new N,C=new N;Tt.distanceSqToSegment(He.start,He.end,C,E),t.push({point:C,pointOnLine:E,distance:Tt.origin.distanceTo(C),object:o,face:null,faceIndex:h,uv:null,uv1:null})}}}class lh extends O{constructor(e=new vo,t=new yi({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 a=0,r=0,A=t.count;a<A;a++,r+=2)xo.fromBufferAttribute(t,a),So.fromBufferAttribute(n,a),s[r]=r===0?0:s[r-1],s[r+1]=s[r]+xo.distanceTo(So);const i=new Gn(s,2,1);return e.setAttribute("instanceDistanceStart",new Zt(i,1,0)),e.setAttribute("instanceDistanceEnd",new Zt(i,1,1)),this}raycast(e,t){const n=this.material.worldUnits,s=e.camera;s===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const i=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Tt=e.ray;const a=this.matrixWorld,r=this.geometry,A=this.material;ns=A.linewidth+i,r.boundingSphere===null&&r.computeBoundingSphere(),fn.copy(r.boundingSphere).applyMatrix4(a);let c;if(n)c=ns*.5;else{const h=Math.max(s.near,fn.distanceToPoint(Tt.origin));c=Ro(s,h,A.resolution)}if(fn.radius+=c,Tt.intersectsSphere(fn)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),un.copy(r.boundingBox).applyMatrix4(a);let l;if(n)l=ns*.5;else{const h=Math.max(s.near,un.distanceToPoint(Tt.origin));l=Ro(s,h,A.resolution)}un.expandByScalar(l),Tt.intersectsBox(un)!==!1&&(n?Ah(this,t):ch(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(Qi),this.material.uniforms.resolution.value.set(Qi.z,Qi.w))}}class Do extends vo{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 hh extends lh{constructor(e=new Do,t=new yi({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}class dh extends O{constructor(e){const t=new ph(e),n=new Nn(t.image.width*.001,t.image.height*.001),s=new Ct({map:t,toneMapped:!1,transparent:!0});super(n,s);function i(a){s.map.dispatchDOMEvent(a)}this.addEventListener("mousedown",i),this.addEventListener("mousemove",i),this.addEventListener("mouseup",i),this.addEventListener("click",i),this.dispose=function(){n.dispose(),s.dispose(),s.map.dispose(),Si.delete(e),this.removeEventListener("mousedown",i),this.removeEventListener("mousemove",i),this.removeEventListener("mouseup",i),this.removeEventListener("click",i)}}}class ph extends $i{constructor(e){super(ko(e)),this.dom=e,this.anisotropy=16,this.colorSpace=le,this.minFilter=at,this.magFilter=at;const t=new MutationObserver(()=>{this.scheduleUpdate||(this.scheduleUpdate=setTimeout(()=>this.update(),16))}),n={attributes:!0,childList:!0,subtree:!0,characterData:!0};t.observe(e,n),this.observer=t}dispatchDOMEvent(e){e.data&&gh(this.dom,e.type,e.data.x,e.data.y)}update(){this.image=ko(this.dom),this.needsUpdate=!0,this.scheduleUpdate=null}dispose(){this.observer&&this.observer.disconnect(),this.scheduleUpdate=clearTimeout(this.scheduleUpdate),super.dispose()}}const Si=new WeakMap;function ko(o){const e=document.createRange(),t=new we;function n(p){const g=[];let u=!1;function b(){if(u&&(u=!1,p.restore()),g.length===0)return;let f=-1/0,E=-1/0,C=1/0,I=1/0;for(let y=0;y<g.length;y++){const w=g[y];f=Math.max(f,w.x),E=Math.max(E,w.y),C=Math.min(C,w.x+w.width),I=Math.min(I,w.y+w.height)}p.save(),p.beginPath(),p.rect(f,E,C-f,I-E),p.clip(),u=!0}return{add:function(f){g.push(f),b()},remove:function(){g.pop(),b()}}}function s(p,g,u,b){b!==""&&(p.textTransform==="uppercase"&&(b=b.toUpperCase()),l.font=p.fontWeight+" "+p.fontSize+" "+p.fontFamily,l.textBaseline="top",l.fillStyle=p.color,l.fillText(b,g,u+parseFloat(p.fontSize)*.1))}function i(p,g,u,b,f){u<2*f&&(f=u/2),b<2*f&&(f=b/2),l.beginPath(),l.moveTo(p+f,g),l.arcTo(p+u,g,p+u,g+b,f),l.arcTo(p+u,g+b,p,g+b,f),l.arcTo(p,g+b,p,g,f),l.arcTo(p,g,p+u,g,f),l.closePath()}function a(p,g,u,b,f,E){const C=p[g+"Width"],I=p[g+"Style"],y=p[g+"Color"];C!=="0px"&&I!=="none"&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)"&&(l.strokeStyle=y,l.lineWidth=parseFloat(C),l.beginPath(),l.moveTo(u,b),l.lineTo(u+f,b+E),l.stroke())}function r(p,g){if(p.nodeType===Node.COMMENT_NODE||p.nodeName==="SCRIPT"||p.style&&p.style.display==="none")return;let u=0,b=0,f=0,E=0;if(p.nodeType===Node.TEXT_NODE){e.selectNode(p);const I=e.getBoundingClientRect();u=I.left-A.left-.5,b=I.top-A.top-.5,f=I.width,E=I.height,s(g,u,b,p.nodeValue.trim())}else if(p instanceof HTMLCanvasElement){const I=p.getBoundingClientRect();u=I.left-A.left-.5,b=I.top-A.top-.5,l.save();const y=window.devicePixelRatio;l.scale(1/y,1/y),l.drawImage(p,u,b),l.restore()}else if(p instanceof HTMLImageElement){const I=p.getBoundingClientRect();u=I.left-A.left-.5,b=I.top-A.top-.5,f=I.width,E=I.height,l.drawImage(p,u,b,f,E)}else{const I=p.getBoundingClientRect();u=I.left-A.left-.5,b=I.top-A.top-.5,f=I.width,E=I.height,g=window.getComputedStyle(p),i(u,b,f,E,parseFloat(g.borderRadius));const y=g.backgroundColor;y!=="transparent"&&y!=="rgba(0, 0, 0, 0)"&&(l.fillStyle=y,l.fill());const w=["borderTop","borderLeft","borderBottom","borderRight"];let x=!0,T=null;for(const S of w){if(T!==null&&(x=g[S+"Width"]===g[T+"Width"]&&g[S+"Color"]===g[T+"Color"]&&g[S+"Style"]===g[T+"Style"]),x===!1)break;T=S}if(x===!0){const S=parseFloat(g.borderTopWidth);g.borderTopWidth!=="0px"&&g.borderTopStyle!=="none"&&g.borderTopColor!=="transparent"&&g.borderTopColor!=="rgba(0, 0, 0, 0)"&&(l.strokeStyle=g.borderTopColor,l.lineWidth=S,l.stroke())}else a(g,"borderTop",u,b,f,0),a(g,"borderLeft",u,b,0,E),a(g,"borderBottom",u,b+E,f,0),a(g,"borderRight",u+f,b,0,E);if(p instanceof HTMLInputElement){let S=g.accentColor;(S===void 0||S==="auto")&&(S=g.color),t.set(S);const M=Math.sqrt(.299*t.r**2+.587*t.g**2+.114*t.b**2)<.5?"white":"#111111";if(p.type==="radio"&&(i(u,b,f,E,E),l.fillStyle="white",l.strokeStyle=S,l.lineWidth=1,l.fill(),l.stroke(),p.checked&&(i(u+2,b+2,f-4,E-4,E),l.fillStyle=S,l.strokeStyle=M,l.lineWidth=2,l.fill(),l.stroke())),p.type==="checkbox"&&(i(u,b,f,E,2),l.fillStyle=p.checked?S:"white",l.strokeStyle=p.checked?M:S,l.lineWidth=1,l.stroke(),l.fill(),p.checked)){const j=l.textAlign;l.textAlign="center";const K={color:M,fontFamily:g.fontFamily,fontSize:E+"px",fontWeight:"bold"};s(K,u+f/2,b,"\u2714"),l.textAlign=j}if(p.type==="range"){const[j,K,J]=["min","max","value"].map(q=>parseFloat(p[q])),V=(J-j)/(K-j)*(f-E);i(u,b+E/4,f,E/2,E/4),l.fillStyle=M,l.strokeStyle=S,l.lineWidth=1,l.fill(),l.stroke(),i(u,b+E/4,V+E/2,E/2,E/4),l.fillStyle=S,l.fill(),i(u+V,b,E,E,E/2),l.fillStyle=S,l.fill()}(p.type==="color"||p.type==="text"||p.type==="number")&&(h.add({x:u,y:b,width:f,height:E}),s(g,u+parseInt(g.paddingLeft),b+parseInt(g.paddingTop),p.value),h.remove())}}const C=g.overflow==="auto"||g.overflow==="hidden";C&&h.add({x:u,y:b,width:f,height:E});for(let I=0;I<p.childNodes.length;I++)r(p.childNodes[I],g);C&&h.remove()}const A=o.getBoundingClientRect();let c=Si.get(o);c===void 0&&(c=document.createElement("canvas"),c.width=A.width,c.height=A.height,Si.set(o,c));const l=c.getContext("2d"),h=new n(l);return l.clearRect(0,0,c.width,c.height),r(o),c}function gh(o,e,t,n){const s={clientX:t*o.offsetWidth+o.offsetLeft,clientY:n*o.offsetHeight+o.offsetTop,view:o.ownerDocument.defaultView};window.dispatchEvent(new MouseEvent(e,s));const i=o.getBoundingClientRect();t=t*i.width+i.left,n=n*i.height+i.top;function a(r){if(r.nodeType!==Node.TEXT_NODE&&r.nodeType!==Node.COMMENT_NODE){const A=r.getBoundingClientRect();if(t>A.left&&t<A.right&&n>A.top&&n<A.bottom&&(r.dispatchEvent(new MouseEvent(e,s)),r instanceof HTMLInputElement&&r.type==="range"&&(e==="mousedown"||e==="click"))){const[c,l]=["min","max"].map(g=>parseFloat(r[g])),h=A.width,p=(t-A.x)/h;r.value=c+(l-c)*p,r.dispatchEvent(new InputEvent("input",{bubbles:!0}))}for(let c=0;c<r.childNodes.length;c++)a(r.childNodes[c])}}a(o)}const mn=new Le,gs={type:"",data:mn},Mo=new Ln;class uh extends Xt{listenToPointerEvents(e,t){const n=this,s=new Ln,i=e.domElement;function a(r){r.stopPropagation();const A=e.domElement.getBoundingClientRect();mn.x=(r.clientX-A.left)/A.width*2-1,mn.y=-(r.clientY-A.top)/A.height*2+1,s.setFromCamera(mn,t);const c=s.intersectObjects(n.children,!1);if(c.length>0){const l=c[0],h=l.object,p=l.uv;gs.type=r.type,gs.data.set(p.x,1-p.y),h.dispatchEvent(gs)}}i.addEventListener("pointerdown",a),i.addEventListener("pointerup",a),i.addEventListener("pointermove",a),i.addEventListener("mousedown",a),i.addEventListener("mouseup",a),i.addEventListener("mousemove",a),i.addEventListener("click",a)}listenToXRControllerEvents(e){const t=this,n={move:"mousemove",select:"click",selectstart:"mousedown",selectend:"mouseup"};function s(i){const a=i.target;Mo.setFromXRController(a);const r=Mo.intersectObjects(t.children,!1);if(r.length>0){const A=r[0],c=A.object,l=A.uv;gs.type=n[i.type],gs.data.set(l.x,1-l.y),c.dispatchEvent(gs)}}e.addEventListener("move",s),e.addEventListener("select",s),e.addEventListener("selectstart",s),e.addEventListener("selectend",s)}}const Os=new N,Hs=new N,_o=new Vi;class fh extends Js{constructor(e,t=1,n=16711680){const s=new ct,i=e.geometry.attributes.normal.count,a=new ke(i*2*3,3);s.setAttribute("position",a),super(s,new kt({color:n,toneMapped:!1})),this.object=e,this.size=t,this.type="VertexNormalsHelper",this.matrixAutoUpdate=!1,this.update()}update(){this.object.updateMatrixWorld(!0),_o.getNormalMatrix(this.object.matrixWorld);const e=this.object.matrixWorld,t=this.geometry.attributes.position,n=this.object.geometry;if(n){const s=n.attributes.position,i=n.attributes.normal;let a=0;for(let r=0,A=s.count;r<A;r++)Os.fromBufferAttribute(s,r).applyMatrix4(e),Hs.fromBufferAttribute(i,r),Hs.applyMatrix3(_o).normalize().multiplyScalar(this.size).add(Os),t.setXYZ(a,Os.x,Os.y,Os.z),a=a+1,t.setXYZ(a,Hs.x,Hs.y,Hs.z),a=a+1}t.needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}class mh{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}new Ui(-1,1,1,-1,0,1);class bh extends ct{constructor(){super(),this.setAttribute("position",new ke([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new ke([0,2,0,0,2,0],2))}}new bh;const dt={node:"node",material:"material",camera:"camera",light:"light"},is="KHR_animation_pointer",Ih={CUBICSPLINE:void 0,LINEAR:Es,STEP:Tn},Fo=ut.findNode;let Lo=!1;class Eh{constructor(e){this.parser=e,this.name=is,this.animationPointerResolver=null}setAnimationPointerResolver(e){return this.animationPointerResolver=e,this}_patchPropertyBindingFindNode(){Lo||(Lo=!0,ut.findNode=function(e,t){if(t.startsWith(".materials.")){const n=t.substring(11).substring(t.indexOf(".")),s=n.indexOf("."),i=s<0?n:n.substring(0,s);let a=null;return e.traverse(r=>{a!==null||r.type!=="Mesh"&&r.type!=="SkinnedMesh"||r.material&&(r.material.uuid===i||r.material.name===i)&&(a=r.material,a!==null&&(n.endsWith(".map")?a=a.map:n.endsWith(".emissiveMap")&&(a=a.emissiveMap)))}),a}else if(t.startsWith(".nodes.")||t.startsWith(".lights.")||t.startsWith(".cameras.")){const n=t.split(".");let s;for(let i=1;i<n.length;i++){const a=n[i];if(a.length==36)s=e.getObjectByProperty("uuid",a);else if(s&&s[a]){const r=Number.parseInt(a);let A=a;r>=0&&(A=r),s=s[A]}else{const r=e.getObjectByName(a);r&&(s=r)}}if(!s){const i=Fo(e,n[2]);return i||console.warn(is+": Property binding not found",t,e,e.name,n),i}return s}return Fo(e,t)})}loadAnimationTargetFromChannel(e){const t=e.target,n=t.node!==void 0?t.node:t.id;return this.parser.getDependency("node",n)}loadAnimationTargetFromChannelWithAnimationPointer(e){this._havePatchedPropertyBindings||this._patchPropertyBindingFindNode();const t=e.target,n=t.extensions&&t.extensions[is]&&t.path&&t.path==="pointer";if(!n)return null;let s,i=dt.node,a;if(n){const A=t.extensions[is];let c=A.pointer;if(!c){console.warn("Invalid path",A,t);return}if(c.startsWith("/materials/")?i=dt.material:c.startsWith("/extensions/KHR_lights_punctual/lights/")?i=dt.light:c.startsWith("/cameras/")&&(i=dt.camera),a=this._tryResolveTargetId(c,i),a===null||isNaN(a)){console.warn("Failed resolving animation node id: "+a,c);return}switch(i){case dt.material:const h=("/materials/"+a.toString()+"/").length,p=c.substring(0,h);switch(s=c.substring(h),s){case"pbrMetallicRoughness/baseColorFactor":s="color";break;case"pbrMetallicRoughness/roughnessFactor":s="roughness";break;case"pbrMetallicRoughness/metallicFactor":s="metalness";break;case"emissiveFactor":s="emissive";break;case"alphaCutoff":s="alphaTest";break;case"occlusionTexture/strength":s="aoMapIntensity";break;case"normalTexture/scale":s="normalScale";break;case"pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/scale":s="map/repeat";break;case"pbrMetallicRoughness/baseColorTexture/extensions/KHR_texture_transform/offset":s="map/offset";break;case"emissiveTexture/extensions/KHR_texture_transform/scale":s="emissiveMap/repeat";break;case"emissiveTexture/extensions/KHR_texture_transform/offset":s="emissiveMap/offset";break;case"extensions/KHR_materials_emissive_strength/emissiveStrength":s="emissiveIntensity";break;case"extensions/KHR_materials_transmission/transmissionFactor":s="transmission";break;case"extensions/KHR_materials_ior/ior":s="ior";break;case"extensions/KHR_materials_volume/thicknessFactor":s="thickness";break;case"extensions/KHR_materials_volume/attenuationColor":s="attenuationColor";break;case"extensions/KHR_materials_volume/attenuationDistance":s="attenuationDistance";break;case"extensions/KHR_materials_iridescence/iridescenceFactor":s="iridescence";break;case"extensions/KHR_materials_iridescence/iridescenceIor":s="iridescenceIOR";break;case"extensions/KHR_materials_iridescence/iridescenceThicknessMinimum":s="iridescenceThicknessRange[0]";break;case"extensions/KHR_materials_iridescence/iridescenceThicknessMaximum":s="iridescenceThicknessRange[1]";break;case"extensions/KHR_materials_clearcoat/clearcoatFactor":s="clearcoat";break;case"extensions/KHR_materials_clearcoat/clearcoatRoughnessFactor":s="clearcoatRoughness";break;case"extensions/KHR_materials_sheen/sheenColorFactor":s="sheenColor";break;case"extensions/KHR_materials_sheen/sheenRoughnessFactor":s="sheenRoughness";break;case"extensions/KHR_materials_specular/specularFactor":s="specularIntensity";break;case"extensions/KHR_materials_specular/specularColorFactor":s="specularColor";break}c=p+s;break;case dt.node:const g=("/nodes/"+a.toString()+"/").length,u=c.substring(0,g);switch(s=c.substring(g),s){case"translation":s="position";break;case"rotation":s="quaternion";break;case"scale":s="scale";break;case"weights":s="morphTargetInfluences";break}c=u+s;break;case dt.light:const b=("/extensions/KHR_lights_punctual/lights/"+a.toString()+"/").length;switch(s=c.substring(b),s){case"color":break;case"intensity":break;case"spot/innerConeAngle":s="penumbra";break;case"spot/outerConeAngle":s="angle";break;case"range":s="distance";break}c="/lights/"+a.toString()+"/"+s;break;case dt.camera:const f=("/cameras/"+a.toString()+"/").length,E=c.substring(0,f);switch(s=c.substring(f),s){case"perspective/yfov":s="fov";break;case"perspective/znear":case"orthographic/znear":s="near";break;case"perspective/zfar":case"orthographic/zfar":s="far";break;case"perspective/aspect":s="aspect";break;case"orthographic/xmag":s="zoom";break;case"orthographic/ymag":s="zoom";break}c=E+s;break}const l=this.animationPointerResolver;l&&l.resolvePath&&(c=l.resolvePath(c)),t.extensions[is].pointer=c}if(a===null||isNaN(a)){console.warn("Failed resolving animation node id: "+a,t);return}let r;return i===dt.node?r=this.parser.getDependency("node",a):i===dt.material?r=this.parser.getDependency("material",a):i===dt.light?r=this.parser.getDependency("light",a):i===dt.camera?r=this.parser.getDependency("camera",a):console.error("Unhandled type",i),r}createAnimationTracksWithAnimationPointer(e,t,n,s,i){if(!(i.extensions&&i.extensions[is]&&i.path&&i.path==="pointer"))return null;let a=i.extensions[is].pointer;if(!a)return null;const r=[];a=a.replaceAll("/",".");const A=a.split(".");var c=e.name!==void 0&&e.name!==null?e.name:e.uuid;if(A[2]=c,A[3]==="morphTargetInfluences"&&e.type==="Group"){for(const h of e.children)h instanceof vn&&h.morphTargetInfluences&&(A[3]=h.name,A[4]="morphTargetInfluences",l(this.parser));return r}l(this.parser);function l(h){a=A.join(".");let p;switch(n.itemSize){case 1:p=Xs;break;case 2:case 3:p=Vs;break;case 4:a.endsWith(".quaternion")?p=Zs:p=Or;break}const g=s.interpolation!==void 0?Ih[s.interpolation]:Es;let u=h._getArrayFromAccessor(n);a.endsWith(".fov")&&(u=u.map(f=>f/Math.PI*180));const b=new p(a,t.array,u,g);if(g==="CUBICSPLINE"&&h._createCubicSplineTrackInterpolant(b),r.push(b),a&&n.itemSize===4&&a.startsWith(".materials.")&&a.endsWith(".color")){const f=new Float32Array(u.length/4);for(let C=0,I=u.length/4;C<I;C+=1)f[C]=u[C*4+3];const E=new p(a.replace(".color",".opacity"),t.array,f,g);g==="CUBICSPLINE"&&h._createCubicSplineTrackInterpolant(b),r.push(E)}}return r}_tryResolveTargetId(e,t){let n="";return t==="node"?n=e.substring(7):t==="material"?n=e.substring(11):t==="light"?n=e.substring(39):t==="camera"&&(n=e.substring(9)),n=n.substring(0,n.indexOf("/")),Number.parseInt(n)}loadAnimation(e){const t=this,n=this.parser.json,s=this.parser,i=n.animations[e],a=i.name?i.name:"animation_"+e,r=[],A=[],c=[],l=[],h=[];for(let p=0,g=i.channels.length;p<g;p++){const u=i.channels[p],b=i.samplers[u.sampler],f=u.target,E=i.parameters!==void 0?i.parameters[b.input]:b.input,C=i.parameters!==void 0?i.parameters[b.output]:b.output;let I=t.loadAnimationTargetFromChannelWithAnimationPointer(u);I||(I=t.loadAnimationTargetFromChannel(u)),r.push(I),A.push(s.getDependency("accessor",E)),c.push(s.getDependency("accessor",C)),l.push(b),h.push(f)}return Promise.all([Promise.all(r),Promise.all(A),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(p){const g=p[0],u=p[1],b=p[2],f=p[3],E=p[4],C=[];for(let I=0,y=g.length;I<y;I++){const w=g[I],x=u[I],T=b[I],S=f[I],M=E[I];if(w===void 0)continue;w.updateMatrix&&(w.updateMatrix(),w.matrixAutoUpdate=!0);let j=t.createAnimationTracksWithAnimationPointer(w,x,T,S,M);if(j||(j=s._createAnimationTracks(w,x,T,S,M)),j)for(let K=0;K<j.length;K++)C.push(j[K])}return new xn(a,void 0,C)})}}const Ch=Object.freeze(Object.defineProperty({__proto__:null,GLTFAnimationPointerExtension:Eh},Symbol.toStringTag,{value:"Module"}));export{SA as DRACOLoader,eo as EXRLoader,Dc as EXRLoader$1,Oc as FBXLoader,ka as Font,sc as FontLoader,Ci as GLTFExporter,Pn as GLTFLoader,Ch as GLTFLoaderAnimationPointer,Hr as GroundedSkybox,dh as HTMLMesh,wl as HorizontalBlurShader,uh as InteractiveGroup,pt as KTX2Loader,hh as Line2,Do as LineGeometry,yi as LineMaterial,xA as MeshoptDecoder,ol as OBJLoader,cl as OrbitControls,mh as Pass,Bl as PositionalAudioHelper,to as RGBELoader,kc as RGBELoader$1,vs as Stats,tc as TextGeometry,ac as TransformControls,Pa as TransformControlsGizmo,fh as VertexNormalsHelper,yl as VerticalBlurShader,ah as XRControllerModelFactory,rh as XRHandMeshModel,Kr as mergeVertices,et as nodeFrame,pi as strToU8,Rc as zipSync};
|