@needle-tools/engine 4.6.1 → 4.6.2
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 +6 -0
- package/dist/generateMeshBVH.worker-BaNp_Xtp.js +25 -0
- package/dist/{gltf-progressive-Bm9eEfgu.min.js → gltf-progressive-Bl4okF1b.min.js} +1 -1
- package/dist/{gltf-progressive-GjIqwSG3.js → gltf-progressive-DSpdn0QT.js} +2 -2
- package/dist/{gltf-progressive-Dn6o99rH.umd.cjs → gltf-progressive-P8b8a0qY.umd.cjs} +1 -1
- package/dist/needle-engine.bundle-D0XWaCQs.min.js +1575 -0
- package/dist/{needle-engine.bundle-BVg46UWZ.js → needle-engine.bundle-DGcStTA7.js} +9715 -9555
- package/dist/needle-engine.bundle-DmYMLdWP.umd.cjs +1575 -0
- package/dist/needle-engine.js +352 -351
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-CRQa6Qxn.umd.cjs → postprocessing-CjW23fio.umd.cjs} +18 -18
- package/dist/{postprocessing-D6W1EyZ-.js → postprocessing-DYLNOL3W.js} +4 -3
- package/dist/{postprocessing-DF8AlRgW.min.js → postprocessing-xYQWCHFu.min.js} +26 -26
- package/dist/{three-DMrv-4ar.umd.cjs → three-B_hneGZr.umd.cjs} +4 -4
- package/dist/{three-Bz6X1mrw.js → three-DrqIzZTH.js} +4198 -4198
- package/dist/{three-Boa-jOq-.min.js → three-DuDKwKB8.min.js} +33 -33
- package/dist/{three-examples-GggCDHv0.js → three-examples-B50TT3Iu.js} +5 -5
- package/dist/{three-examples-DuVhxqft.min.js → three-examples-DaDLBuy6.min.js} +14 -14
- package/dist/{three-examples-C7ryg8vN.umd.cjs → three-examples-X3OadjXB.umd.cjs} +3 -3
- package/dist/{three-mesh-ui-CY6Izc7C.min.js → three-mesh-ui-B3p3gyUz.min.js} +1 -1
- package/dist/{three-mesh-ui-CwlN0FUC.umd.cjs → three-mesh-ui-CQiIQIlA.umd.cjs} +1 -1
- package/dist/{three-mesh-ui-CLNOfsWn.js → three-mesh-ui-CxuWt7m-.js} +1 -1
- package/dist/{vendor-zxXa3Dmr.min.js → vendor-BlSxe9JJ.min.js} +3 -3
- package/dist/{vendor-BSD1RQIh.js → vendor-BmYIgaS1.js} +3 -3
- package/dist/{vendor-DHr4aqIZ.umd.cjs → vendor-Cavtu3CP.umd.cjs} +3 -3
- package/lib/engine/engine_context.d.ts +4 -1
- package/lib/engine/engine_context.js +9 -2
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_three_utils.d.ts +17 -14
- package/lib/engine/engine_three_utils.js +106 -53
- package/lib/engine/engine_three_utils.js.map +1 -1
- package/lib/engine/engine_tonemapping.d.ts +4 -0
- package/lib/engine/engine_tonemapping.js +21 -18
- package/lib/engine/engine_tonemapping.js.map +1 -1
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/engine_utils_screenshot.d.ts +1 -1
- package/lib/engine/engine_utils_screenshot.js +11 -2
- package/lib/engine/engine_utils_screenshot.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +4 -1
- package/lib/engine/webcomponents/needle-engine.extras.js +3 -3
- package/lib/engine/webcomponents/needle-engine.extras.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +11 -21
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js +3 -1
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +2 -2
- package/lib/engine-components/postprocessing/Effects/BloomEffect.js +5 -2
- package/lib/engine-components/postprocessing/Effects/BloomEffect.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +8 -0
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +27 -8
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js +1 -0
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +1 -0
- package/lib/engine-components/postprocessing/Effects/Sharpening.js +4 -0
- package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +2 -9
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js +23 -71
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +13 -0
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.js +52 -0
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.js.map +1 -0
- package/lib/engine-components/postprocessing/PostProcessingEffect.d.ts +18 -0
- package/lib/engine-components/postprocessing/PostProcessingEffect.js +22 -3
- package/lib/engine-components/postprocessing/PostProcessingEffect.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +20 -4
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +209 -112
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/lib/engine-components/postprocessing/Volume.d.ts +2 -1
- package/lib/engine-components/postprocessing/Volume.js +51 -33
- package/lib/engine-components/postprocessing/Volume.js.map +1 -1
- package/lib/engine-components/postprocessing/index.d.ts +1 -0
- package/lib/engine-components/postprocessing/index.js +1 -0
- package/lib/engine-components/postprocessing/index.js.map +1 -1
- package/lib/engine-components/postprocessing/utils.d.ts +43 -0
- package/lib/engine-components/postprocessing/utils.js +82 -0
- package/lib/engine-components/postprocessing/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/engine_context.ts +13 -4
- package/src/engine/engine_three_utils.ts +134 -58
- package/src/engine/engine_tonemapping.ts +23 -24
- package/src/engine/engine_utils.ts +2 -2
- package/src/engine/engine_utils_screenshot.ts +13 -3
- package/src/engine/webcomponents/needle-engine.extras.ts +3 -3
- package/src/engine/webcomponents/needle-engine.ts +14 -25
- package/src/engine-components/CameraUtils.ts +3 -3
- package/src/engine-components/postprocessing/Effects/Antialiasing.ts +3 -1
- package/src/engine-components/postprocessing/Effects/BloomEffect.ts +6 -4
- package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +24 -13
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +1 -0
- package/src/engine-components/postprocessing/Effects/Sharpening.ts +5 -0
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +26 -80
- package/src/engine-components/postprocessing/Effects/Tonemapping.utils.ts +60 -0
- package/src/engine-components/postprocessing/PostProcessingEffect.ts +23 -3
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +239 -119
- package/src/engine-components/postprocessing/Volume.ts +54 -38
- package/src/engine-components/postprocessing/index.ts +2 -1
- package/src/engine-components/postprocessing/utils.ts +102 -2
- package/dist/generateMeshBVH.worker-Cdfpaq5W.js +0 -25
- package/dist/needle-engine.bundle-AOXFIsYk.umd.cjs +0 -1563
- package/dist/needle-engine.bundle-Dt52m2jf.min.js +0 -1563
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const a=require("./three-
|
|
1
|
+
"use strict";const a=require("./three-B_hneGZr.umd.cjs");class Qo extends a.Mesh{constructor(e,t,s,n=128){if(t<=0||s<=0||n<=0)throw new Error("GroundedSkybox height, radius, and resolution must be positive.");const i=new a.SphereGeometry(s,2*n,n);i.scale(1,1,-1);const o=i.getAttribute("position"),r=new a.Vector3;for(let A=0;A<o.count;++A)if(r.fromBufferAttribute(o,A),r.y<0){const l=-t*3/2,h=r.y<l?-t/r.y:1-r.y*r.y/(3*l*l);r.multiplyScalar(h),r.toArray(o.array,3*A)}o.needsUpdate=!0,super(i,new a.MeshBasicMaterial({map:e,depthWrite:!1}))}}class Ie extends a.Node{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 Ue=new a.NodeFrame;Ue.camera=new a.PerspectiveCamera;const ds={LineBasicNodeMaterial:a.ShaderLib.basic,MeshBasicNodeMaterial:a.ShaderLib.basic,PointsNodeMaterial:a.ShaderLib.points,MeshStandardNodeMaterial:a.ShaderLib.standard,MeshPhysicalNodeMaterial:a.ShaderLib.physical,MeshPhongNodeMaterial:a.ShaderLib.phong},xo={atan2:"atan"},So={low:"lowp",medium:"mediump",high:"highp"};function dt(c){return`#include <${c}>`}function Lt(c){return`${c}Shader`}class To extends a.NodeBuilder{constructor(e,t,s,n=null){super(e,t,new a.GLSLNodeParser,null,n),this.shader=s,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 xo[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"),ds[t]!==void 0){const s=ds[t],n=this.shader;n.vertexShader=s.vertexShader,n.fragmentShader=s.fragmentShader,n.uniforms=a.UniformsUtils.merge([s.uniforms,a.UniformsLib.lights])}}_parseObject(){const{material:e,renderer:t}=this;this.addSlot("fragment",new Ie({node:a.normalView,nodeType:"vec3",source:"void main() {",target:"vec3 TransformedNormalView = %RESULT%;",inclusionType:"append"})),t.toneMappingNode&&t.toneMappingNode.isNode===!0&&this.addSlot("fragment",new Ie({node:e.colorNode,nodeType:"vec4",source:dt("tonemapping_fragment"),target:""})),e.colorNode&&e.colorNode.isNode&&this.addSlot("fragment",new Ie({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 Ie({node:e.opacityNode,nodeType:"float",source:dt("alphatest_fragment"),target:"diffuseColor.a = %RESULT%;",inclusionType:"append"})),e.normalNode&&e.normalNode.isNode&&this.addSlot("fragment",new Ie({node:e.normalNode,nodeType:"vec3",source:dt("normal_fragment_begin"),target:"normal = %RESULT%;",inclusionType:"append"})),e.emissiveNode&&e.emissiveNode.isNode&&this.addSlot("fragment",new Ie({node:e.emissiveNode,nodeType:"vec3",source:dt("emissivemap_fragment"),target:"totalEmissiveRadiance = %RESULT%;",inclusionType:"append"})),e.isMeshStandardNodeMaterial&&(e.metalnessNode&&e.metalnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.metalnessNode,nodeType:"float",source:dt("metalnessmap_fragment"),target:"metalnessFactor = %RESULT%;",inclusionType:"append"})),e.roughnessNode&&e.roughnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.roughnessNode,nodeType:"float",source:dt("roughnessmap_fragment"),target:"roughnessFactor = %RESULT%;",inclusionType:"append"})),e.isMeshPhysicalNodeMaterial&&(e.clearcoatNode&&e.clearcoatNode.isNode?(this.addSlot("fragment",new Ie({node:e.clearcoatNode,nodeType:"float",source:"material.clearcoat = clearcoat;",target:"material.clearcoat = %RESULT%;"})),e.clearcoatRoughnessNode&&e.clearcoatRoughnessNode.isNode&&this.addSlot("fragment",new Ie({node:e.clearcoatRoughnessNode,nodeType:"float",source:"material.clearcoatRoughness = clearcoatRoughness;",target:"material.clearcoatRoughness = %RESULT%;"})),e.clearcoatNormalNode&&e.clearcoatNormalNode.isNode&&this.addSlot("fragment",new Ie({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 Ie({node:e.sheenNode,nodeType:"vec3",source:"material.sheenColor = sheenColor;",target:"material.sheenColor = %RESULT%;"})),e.sheenRoughnessNode&&e.sheenRoughnessNode.isNode&&this.addSlot("fragment",new Ie({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 Ie({node:e.iridescenceNode,nodeType:"float",source:"material.iridescence = iridescence;",target:"material.iridescence = %RESULT%;"})),e.iridescenceIORNode&&e.iridescenceIORNode.isNode&&this.addSlot("fragment",new Ie({node:e.iridescenceIORNode,nodeType:"float",source:"material.iridescenceIOR = iridescenceIOR;",target:"material.iridescenceIOR = %RESULT%;"})),e.iridescenceThicknessNode&&e.iridescenceThicknessNode.isNode&&this.addSlot("fragment",new Ie({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 Ie({node:e.iorNode,nodeType:"float",source:"material.ior = ior;",target:"material.ior = %RESULT%;"})),e.specularColorNode&&e.specularColorNode.isNode&&this.addSlot("fragment",new Ie({node:e.specularColorNode,nodeType:"vec3",source:"vec3 specularColorFactor = specularColor;",target:"vec3 specularColorFactor = %RESULT%;"})),e.specularIntensityNode&&e.specularIntensityNode.isNode&&this.addSlot("fragment",new Ie({node:e.specularIntensityNode,nodeType:"float",source:"float specularIntensityFactor = specularIntensity;",target:"float specularIntensityFactor = %RESULT%;"})),e.transmissionNode&&e.transmissionNode.isNode?(this.addSlot("fragment",new Ie({node:e.transmissionNode,nodeType:"float",source:"material.transmission = transmission;",target:"material.transmission = %RESULT%;"})),e.thicknessNode&&e.thicknessNode.isNode&&this.addSlot("fragment",new Ie({node:e.thicknessNode,nodeType:"float",source:"material.thickness = thickness;",target:"material.thickness = %RESULT%;"})),e.attenuationDistanceNode&&e.attenuationDistanceNode.isNode&&this.addSlot("fragment",new Ie({node:e.attenuationDistanceNode,nodeType:"float",source:"material.attenuationDistance = attenuationDistance;",target:"material.attenuationDistance = %RESULT%;"})),e.attenuationColorNode&&e.attenuationColorNode.isNode&&this.addSlot("fragment",new Ie({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 Ie({node:e.positionNode,nodeType:"vec3",source:dt("begin_vertex"),target:"transformed = %RESULT%;",inclusionType:"append"})),e.sizeNode&&e.sizeNode.isNode&&this.addSlot("vertex",new Ie({node:e.sizeNode,nodeType:"float",source:"gl_PointSize = size;",target:"gl_PointSize = %RESULT%;"}))}generateTexture(e,t,s){return e.isTextureCube?`textureCube( ${t}, ${s} )`:`texture2D( ${t}, ${s} )`}generateTextureLevel(e,t,s,n){return`textureLod( ${t}, ${s}, ${n} )`}buildFunctionCode(e){const t=e.layout,s=this.flowShaderNode(e),n=[];for(const o of t.inputs)n.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${n.join(", ")} ) {
|
|
2
2
|
|
|
3
3
|
${s.vars}
|
|
4
4
|
|
|
@@ -38,8 +38,8 @@ fflate - fast JavaScript compression/decompression
|
|
|
38
38
|
<https://101arrowz.github.io/fflate>
|
|
39
39
|
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
|
40
40
|
version 0.8.2
|
|
41
|
-
*/var Qe=Uint8Array,qe=Uint16Array,ts=Int32Array,dn=new Qe([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]),gn=new Qe([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]),Yn=new Qe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Si=function(c,e){for(var t=new qe(31),s=0;s<31;++s)t[s]=e+=1<<c[s-1];for(var n=new ts(t[30]),s=1;s<30;++s)for(var i=t[s];i<t[s+1];++i)n[i]=i-t[s]<<5|s;return{b:t,r:n}},Ti=Si(dn,2),vi=Ti.b,Vn=Ti.r;vi[28]=258,Vn[258]=28;var Mi=Si(gn,0),Nr=Mi.b,Ms=Mi.r,Jn=new qe(32768);for(var be=0;be<32768;++be){var ft=(be&43690)>>1|(be&21845)<<1;ft=(ft&52428)>>2|(ft&13107)<<2,ft=(ft&61680)>>4|(ft&3855)<<4,Jn[be]=((ft&65280)>>8|(ft&255)<<8)>>1}var ot=function(c,e,t){for(var s=c.length,n=0,i=new qe(e);n<s;++n)c[n]&&++i[c[n]-1];var o=new qe(e);for(n=1;n<e;++n)o[n]=o[n-1]+i[n-1]<<1;var r;if(t){r=new qe(1<<e);var A=15-e;for(n=0;n<s;++n)if(c[n])for(var l=n<<4|c[n],h=e-c[n],u=o[c[n]-1]++<<h,g=u|(1<<h)-1;u<=g;++u)r[Jn[u]>>A]=l}else for(r=new qe(s),n=0;n<s;++n)c[n]&&(r[n]=Jn[o[c[n]-1]++]>>15-c[n]);return r},mt=new Qe(288);for(var be=0;be<144;++be)mt[be]=8;for(var be=144;be<256;++be)mt[be]=9;for(var be=256;be<280;++be)mt[be]=7;for(var be=280;be<288;++be)mt[be]=8;var Wt=new Qe(32);for(var be=0;be<32;++be)Wt[be]=5;var Gr=ot(mt,9,0),Ur=ot(mt,9,1),Pr=ot(Wt,5,0),Or=ot(Wt,5,1),Mn=function(c){for(var e=c[0],t=1;t<c.length;++t)c[t]>e&&(e=c[t]);return e},Ze=function(c,e,t){var s=e/8|0;return(c[s]|c[s+1]<<8)>>(e&7)&t},Rn=function(c,e){var t=e/8|0;return(c[t]|c[t+1]<<8|c[t+2]<<16)>>(e&7)},ns=function(c){return(c+7)/8|0},ss=function(c,e,t){return(t==null||t>c.length)&&(t=c.length),new Qe(c.subarray(e,t))},Hr=["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"],Ge=function(c,e,t){var s=new Error(e||Hr[c]);if(s.code=c,Error.captureStackTrace&&Error.captureStackTrace(s,Ge),!t)throw s;return s},jr=function(c,e,t,s){var n=c.length,i=0;if(!n||e.f&&!e.l)return t||new Qe(0);var o=!t,r=o||e.i!=2,A=e.i;o&&(t=new Qe(n*3));var l=function(ht){var It=t.length;if(ht>It){var rt=new Qe(Math.max(It*2,ht));rt.set(t),t=rt}},h=e.f||0,u=e.p||0,g=e.b||0,p=e.l,f=e.d,I=e.m,b=e.n,E=n*8;do{if(!p){h=Ze(c,u,1);var y=Ze(c,u+1,3);if(u+=3,y)if(y==1)p=Ur,f=Or,I=9,b=5;else if(y==2){var R=Ze(c,u,31)+257,D=Ze(c,u+10,15)+4,S=R+Ze(c,u+5,31)+1;u+=14;for(var v=new Qe(S),N=new Qe(19),G=0;G<D;++G)N[Yn[G]]=Ze(c,u+G*3,7);u+=D*3;for(var O=Mn(N),X=(1<<O)-1,U=ot(N,O,1),G=0;G<S;){var q=U[Ze(c,u,X)];u+=q&15;var C=q>>4;if(C<16)v[G++]=C;else{var H=0,z=0;for(C==16?(z=3+Ze(c,u,3),u+=2,H=v[G-1]):C==17?(z=3+Ze(c,u,7),u+=3):C==18&&(z=11+Ze(c,u,127),u+=7);z--;)v[G++]=H}}var $=v.subarray(0,R),ee=v.subarray(R);I=Mn($),b=Mn(ee),p=ot($,I,1),f=ot(ee,b,1)}else Ge(1);else{var C=ns(u)+4,w=c[C-4]|c[C-3]<<8,x=C+w;if(x>n){A&&Ge(0);break}r&&l(g+w),t.set(c.subarray(C,x),g),e.b=g+=w,e.p=u=x*8,e.f=h;continue}if(u>E){A&&Ge(0);break}}r&&l(g+131072);for(var se=(1<<I)-1,ce=(1<<b)-1,re=u;;re=u){var H=p[Rn(c,u)&se],le=H>>4;if(u+=H&15,u>E){A&&Ge(0);break}if(H||Ge(2),le<256)t[g++]=le;else if(le==256){re=u,p=null;break}else{var Ce=le-254;if(le>264){var G=le-257,fe=dn[G];Ce=Ze(c,u,(1<<fe)-1)+vi[G],u+=fe}var ae=f[Rn(c,u)&ce],Pe=ae>>4;ae||Ge(3),u+=ae&15;var ee=Nr[Pe];if(Pe>3){var fe=gn[Pe];ee+=Rn(c,u)&(1<<fe)-1,u+=fe}if(u>E){A&&Ge(0);break}r&&l(g+131072);var Oe=g+Ce;if(g<ee){var Qt=i-ee,xt=Math.min(ee,Oe);for(Qt+g<0&&Ge(3);g<xt;++g)t[g]=s[Qt+g]}for(;g<Oe;++g)t[g]=t[g-ee]}}e.l=p,e.p=re,e.b=g,e.f=h,p&&(h=1,e.m=I,e.d=f,e.n=b)}while(!h);return g!=t.length&&o?ss(t,0,g):t.subarray(0,g)},At=function(c,e,t){t<<=e&7;var s=e/8|0;c[s]|=t,c[s+1]|=t>>8},Pt=function(c,e,t){t<<=e&7;var s=e/8|0;c[s]|=t,c[s+1]|=t>>8,c[s+2]|=t>>16},Dn=function(c,e){for(var t=[],s=0;s<c.length;++s)c[s]&&t.push({s,f:c[s]});var n=t.length,i=t.slice();if(!n)return{t:Di,l:0};if(n==1){var o=new Qe(t[0].s+1);return o[t[0].s]=1,{t:o,l:1}}t.sort(function(x,R){return x.f-R.f}),t.push({s:-1,f:25001});var r=t[0],A=t[1],l=0,h=1,u=2;for(t[0]={s:-1,f:r.f+A.f,l:r,r:A};h!=n-1;)r=t[t[l].f<t[u].f?l++:u++],A=t[l!=h&&t[l].f<t[u].f?l++:u++],t[h++]={s:-1,f:r.f+A.f,l:r,r:A};for(var g=i[0].s,s=1;s<n;++s)i[s].s>g&&(g=i[s].s);var p=new qe(g+1),f=Wn(t[h-1],p,0);if(f>e){var s=0,I=0,b=f-e,E=1<<b;for(i.sort(function(R,D){return p[D.s]-p[R.s]||R.f-D.f});s<n;++s){var y=i[s].s;if(p[y]>e)I+=E-(1<<f-p[y]),p[y]=e;else break}for(I>>=b;I>0;){var C=i[s].s;p[C]<e?I-=1<<e-p[C]++-1:++s}for(;s>=0&&I;--s){var w=i[s].s;p[w]==e&&(--p[w],++I)}f=e}return{t:new Qe(p),l:f}},Wn=function(c,e,t){return c.s==-1?Math.max(Wn(c.l,e,t+1),Wn(c.r,e,t+1)):e[c.s]=t},Rs=function(c){for(var e=c.length;e&&!c[--e];);for(var t=new qe(++e),s=0,n=c[0],i=1,o=function(A){t[s++]=A},r=1;r<=e;++r)if(c[r]==n&&r!=e)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=c[r]}return{c:t.subarray(0,s),n:e}},Ot=function(c,e){for(var t=0,s=0;s<e.length;++s)t+=c[s]*e[s];return t},Ri=function(c,e,t){var s=t.length,n=ns(e+2);c[n]=s&255,c[n+1]=s>>8,c[n+2]=c[n]^255,c[n+3]=c[n+1]^255;for(var i=0;i<s;++i)c[n+i+4]=t[i];return(n+4+s)*8},Ds=function(c,e,t,s,n,i,o,r,A,l,h){At(e,h++,t),++n[256];for(var u=Dn(n,15),g=u.t,p=u.l,f=Dn(i,15),I=f.t,b=f.l,E=Rs(g),y=E.c,C=E.n,w=Rs(I),x=w.c,R=w.n,D=new qe(19),S=0;S<y.length;++S)++D[y[S]&31];for(var S=0;S<x.length;++S)++D[x[S]&31];for(var v=Dn(D,7),N=v.t,G=v.l,O=19;O>4&&!N[Yn[O-1]];--O);var X=l+5<<3,U=Ot(n,mt)+Ot(i,Wt)+o,q=Ot(n,g)+Ot(i,I)+o+14+3*O+Ot(D,N)+2*D[16]+3*D[17]+7*D[18];if(A>=0&&X<=U&&X<=q)return Ri(e,h,c.subarray(A,A+l));var H,z,$,ee;if(At(e,h,1+(q<U)),h+=2,q<U){H=ot(g,p,0),z=g,$=ot(I,b,0),ee=I;var se=ot(N,G,0);At(e,h,C-257),At(e,h+5,R-1),At(e,h+10,O-4),h+=14;for(var S=0;S<O;++S)At(e,h+3*S,N[Yn[S]]);h+=3*O;for(var ce=[y,x],re=0;re<2;++re)for(var le=ce[re],S=0;S<le.length;++S){var Ce=le[S]&31;At(e,h,se[Ce]),h+=N[Ce],Ce>15&&(At(e,h,le[S]>>5&127),h+=le[S]>>12)}}else H=Gr,z=mt,$=Pr,ee=Wt;for(var S=0;S<r;++S){var fe=s[S];if(fe>255){var Ce=fe>>18&31;Pt(e,h,H[Ce+257]),h+=z[Ce+257],Ce>7&&(At(e,h,fe>>23&31),h+=dn[Ce]);var ae=fe&31;Pt(e,h,$[ae]),h+=ee[ae],ae>3&&(Pt(e,h,fe>>5&8191),h+=gn[ae])}else Pt(e,h,H[fe]),h+=z[fe]}return Pt(e,h,H[256]),h+z[256]},qr=new ts([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Di=new Qe(0),zr=function(c,e,t,s,n,i){var o=i.z||c.length,r=new Qe(s+o+5*(1+Math.ceil(o/7e3))+n),A=r.subarray(s,r.length-n),l=i.l,h=(i.r||0)&7;if(e){h&&(A[0]=i.r>>3);for(var u=qr[e-1],g=u>>13,p=u&8191,f=(1<<t)-1,I=i.p||new qe(32768),b=i.h||new qe(f+1),E=Math.ceil(t/3),y=2*E,C=function(St){return(c[St]^c[St+1]<<E^c[St+2]<<y)&f},w=new ts(25e3),x=new qe(288),R=new qe(32),D=0,S=0,v=i.i||0,N=0,G=i.w||0,O=0;v+2<o;++v){var X=C(v),U=v&32767,q=b[X];if(I[U]=q,b[X]=U,G<=v){var H=o-v;if((D>7e3||N>24576)&&(H>423||!l)){h=Ds(c,A,0,w,x,R,S,N,O,v-O,h),N=D=S=0,O=v;for(var z=0;z<286;++z)x[z]=0;for(var z=0;z<30;++z)R[z]=0}var $=2,ee=0,se=p,ce=U-q&32767;if(H>2&&X==C(v-ce))for(var re=Math.min(g,H)-1,le=Math.min(32767,v),Ce=Math.min(258,H);ce<=le&&--se&&U!=q;){if(c[v+$]==c[v+$-ce]){for(var fe=0;fe<Ce&&c[v+fe]==c[v+fe-ce];++fe);if(fe>$){if($=fe,ee=ce,fe>re)break;for(var ae=Math.min(ce,fe-2),Pe=0,z=0;z<ae;++z){var Oe=v-ce+z&32767,Qt=I[Oe],xt=Oe-Qt&32767;xt>Pe&&(Pe=xt,q=Oe)}}}U=q,q=I[U],ce+=U-q&32767}if(ee){w[N++]=268435456|Vn[$]<<18|Ms[ee];var ht=Vn[$]&31,It=Ms[ee]&31;S+=dn[ht]+gn[It],++x[257+ht],++R[It],G=v+$,++D}else w[N++]=c[v],++x[c[v]]}}for(v=Math.max(v,G);v<o;++v)w[N++]=c[v],++x[c[v]];h=Ds(c,A,l,w,x,R,S,N,O,v-O,h),l||(i.r=h&7|A[h/8|0]<<3,h-=7,i.h=b,i.p=I,i.i=v,i.w=G)}else{for(var v=i.w||0;v<o+l;v+=65535){var rt=v+65535;rt>=o&&(A[h/8|0]=l,rt=o),h=Ri(A,h+1,c.subarray(v,rt))}i.i=o}return ss(r,0,s+ns(h)+n)},Kr=function(){for(var c=new Int32Array(256),e=0;e<256;++e){for(var t=e,s=9;--s;)t=(t&1&&-306674912)^t>>>1;c[e]=t}return c}(),Yr=function(){var c=-1;return{p:function(e){for(var t=c,s=0;s<e.length;++s)t=Kr[t&255^e[s]]^t>>>8;c=t},d:function(){return~c}}},Vr=function(c,e,t,s,n){if(!n&&(n={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),o=new Qe(i.length+c.length);o.set(i),o.set(c,i.length),c=o,n.w=i.length}return zr(c,e.level==null?6:e.level,e.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(c.length)))*1.5):20:12+e.mem,t,s,n)},_i=function(c,e){var t={};for(var s in c)t[s]=c[s];for(var s in e)t[s]=e[s];return t},Re=function(c,e,t){for(;t;++e)c[e]=t,t>>>=8},Jr=function(c,e){return((c[0]&15)!=8||c[0]>>4>7||(c[0]<<8|c[1])%31)&&Ge(6,"invalid zlib data"),(c[1]>>5&1)==1&&Ge(6,"invalid zlib data: "+(c[1]&32?"need":"unexpected")+" dictionary"),(c[1]>>3&4)+2};function Wr(c,e){return Vr(c,e||{},0,0)}function Yt(c,e){return jr(c.subarray(Jr(c),-4),{i:2},e,e)}var Fi=function(c,e,t,s){for(var n in c){var i=c[n],o=e+n,r=s;Array.isArray(i)&&(r=_i(s,i[1]),i=i[0]),i instanceof Qe?t[o]=[i,r]:(t[o+="/"]=[new Qe(0),r],Fi(i,o,t,s))}},_s=typeof TextEncoder<"u"&&new TextEncoder,Xr=typeof TextDecoder<"u"&&new TextDecoder,Zr=0;try{Xr.decode(Di,{stream:!0}),Zr=1}catch{}function Xn(c,e){var t;if(_s)return _s.encode(c);for(var s=c.length,n=new Qe(c.length+(c.length>>1)),i=0,o=function(l){n[i++]=l},t=0;t<s;++t){if(i+5>n.length){var r=new Qe(i+8+(s-t<<1));r.set(n),n=r}var A=c.charCodeAt(t);A<128||e?o(A):A<2048?(o(192|A>>6),o(128|A&63)):A>55295&&A<57344?(A=65536+(A&1047552)|c.charCodeAt(++t)&1023,o(240|A>>18),o(128|A>>12&63),o(128|A>>6&63),o(128|A&63)):(o(224|A>>12),o(128|A>>6&63),o(128|A&63))}return ss(n,0,i)}var Zn=function(c){var e=0;if(c)for(var t in c){var s=c[t].length;s>65535&&Ge(9),e+=s+4}return e},Fs=function(c,e,t,s,n,i,o,r){var A=s.length,l=t.extra,h=r&&r.length,u=Zn(l);Re(c,e,o!=null?33639248:67324752),e+=4,o!=null&&(c[e++]=20,c[e++]=t.os),c[e]=20,e+=2,c[e++]=t.flag<<1|(i<0&&8),c[e++]=n&&8,c[e++]=t.compression&255,c[e++]=t.compression>>8;var g=new Date(t.mtime==null?Date.now():t.mtime),p=g.getFullYear()-1980;if((p<0||p>119)&&Ge(10),Re(c,e,p<<25|g.getMonth()+1<<21|g.getDate()<<16|g.getHours()<<11|g.getMinutes()<<5|g.getSeconds()>>1),e+=4,i!=-1&&(Re(c,e,t.crc),Re(c,e+4,i<0?-i-2:i),Re(c,e+8,t.size)),Re(c,e+12,A),Re(c,e+14,u),e+=16,o!=null&&(Re(c,e,h),Re(c,e+6,t.attrs),Re(c,e+10,o),e+=14),c.set(s,e),e+=A,u)for(var f in l){var I=l[f],b=I.length;Re(c,e,+f),Re(c,e+2,b),c.set(I,e+4),e+=4+b}return h&&(c.set(r,e),e+=h),e},$r=function(c,e,t,s,n){Re(c,e,101010256),Re(c,e+8,t),Re(c,e+10,t),Re(c,e+12,s),Re(c,e+16,n)};function ea(c,e){e||(e={});var t={},s=[];Fi(c,"",t,e);var n=0,i=0;for(var o in t){var r=t[o],A=r[0],l=r[1],h=l.level==0?0:8,u=Xn(o),g=u.length,p=l.comment,f=p&&Xn(p),I=f&&f.length,b=Zn(l.extra);g>65535&&Ge(11);var E=h?Wr(A,l):A,y=E.length,C=Yr();C.p(A),s.push(_i(l,{size:A.length,crc:C.d(),c:E,f:u,m:f,u:g!=o.length||f&&p.length!=I,o:n,compression:h})),n+=30+g+b+y,i+=76+2*(g+b)+(I||0)+y}for(var w=new Qe(i+22),x=n,R=i-n,D=0;D<s.length;++D){var u=s[D];Fs(w,u.o,u,u.f,u.u,u.c.length);var S=30+u.f.length+Zn(u.extra);w.set(u.c,u.o+S),Fs(w,n,u,u.f,u.u,u.c.length,u.o,u.m),n+=16+S+(u.m?u.m.length:0)}return $r(w,n,s.length,R,x),w}class Li extends a.DataTextureLoader{constructor(e){super(e),this.type=a.HalfFloatType}parse(e){const v=Math.pow(2.7182818,2.2);function N(d,m){let B=0;for(let M=0;M<65536;++M)(M==0||d[M>>3]&1<<(M&7))&&(m[B++]=M);const Q=B-1;for(;B<65536;)m[B++]=0;return Q}function G(d){for(let m=0;m<16384;m++)d[m]={},d[m].len=0,d[m].lit=0,d[m].p=null}const O={l:0,c:0,lc:0};function X(d,m,B,Q,M){for(;B<d;)m=m<<8|cs(Q,M),B+=8;B-=d,O.l=m>>B&(1<<d)-1,O.c=m,O.lc=B}const U=new Array(59);function q(d){for(let B=0;B<=58;++B)U[B]=0;for(let B=0;B<65537;++B)U[d[B]]+=1;let m=0;for(let B=58;B>0;--B){const Q=m+U[B]>>1;U[B]=m,m=Q}for(let B=0;B<65537;++B){const Q=d[B];Q>0&&(d[B]=Q|U[Q]++<<6)}}function H(d,m,B,Q,M,T){const L=m;let P=0,k=0;for(;Q<=M;Q++){if(L.value-m.value>B)return!1;X(6,P,k,d,L);const F=O.l;if(P=O.c,k=O.lc,T[Q]=F,F==63){if(L.value-m.value>B)throw new Error("Something wrong with hufUnpackEncTable");X(8,P,k,d,L);let _=O.l+6;if(P=O.c,k=O.lc,Q+_>M+1)throw new Error("Something wrong with hufUnpackEncTable");for(;_--;)T[Q++]=0;Q--}else if(F>=59){let _=F-59+2;if(Q+_>M+1)throw new Error("Something wrong with hufUnpackEncTable");for(;_--;)T[Q++]=0;Q--}}q(T)}function z(d){return d&63}function $(d){return d>>6}function ee(d,m,B,Q){for(;m<=B;m++){const M=$(d[m]),T=z(d[m]);if(M>>T)throw new Error("Invalid table entry");if(T>14){const L=Q[M>>T-14];if(L.len)throw new Error("Invalid table entry");if(L.lit++,L.p){const P=L.p;L.p=new Array(L.lit);for(let k=0;k<L.lit-1;++k)L.p[k]=P[k]}else L.p=new Array(1);L.p[L.lit-1]=m}else if(T){let L=0;for(let P=1<<14-T;P>0;P--){const k=Q[(M<<14-T)+L];if(k.len||k.p)throw new Error("Invalid table entry");k.len=T,k.lit=m,L++}}}return!0}const se={c:0,lc:0};function ce(d,m,B,Q){d=d<<8|cs(B,Q),m+=8,se.c=d,se.lc=m}const re={c:0,lc:0};function le(d,m,B,Q,M,T,L,P,k){if(d==m){Q<8&&(ce(B,Q,M,T),B=se.c,Q=se.lc),Q-=8;let F=B>>Q;if(F=new Uint8Array([F])[0],P.value+F>k)return!1;const _=L[P.value-1];for(;F-- >0;)L[P.value++]=_}else if(P.value<k)L[P.value++]=d;else return!1;re.c=B,re.lc=Q}function Ce(d){return d&65535}function fe(d){const m=Ce(d);return m>32767?m-65536:m}const ae={a:0,b:0};function Pe(d,m){const B=fe(d),M=fe(m),T=B+(M&1)+(M>>1),L=T,P=T-M;ae.a=L,ae.b=P}function Oe(d,m){const B=Ce(d),Q=Ce(m),M=B-(Q>>1)&65535,T=Q+M-32768&65535;ae.a=T,ae.b=M}function Qt(d,m,B,Q,M,T,L){const P=L<16384,k=B>M?M:B;let F=1,_,j;for(;F<=k;)F<<=1;for(F>>=1,_=F,F>>=1;F>=1;){j=0;const J=j+T*(M-_),K=T*F,Z=T*_,Y=Q*F,W=Q*_;let te,ue,Be,je;for(;j<=J;j+=Z){let me=j;const Ae=j+Q*(B-_);for(;me<=Ae;me+=W){const xe=me+Y,Ve=me+K,Te=Ve+Y;P?(Pe(d[me+m],d[Ve+m]),te=ae.a,Be=ae.b,Pe(d[xe+m],d[Te+m]),ue=ae.a,je=ae.b,Pe(te,ue),d[me+m]=ae.a,d[xe+m]=ae.b,Pe(Be,je),d[Ve+m]=ae.a,d[Te+m]=ae.b):(Oe(d[me+m],d[Ve+m]),te=ae.a,Be=ae.b,Oe(d[xe+m],d[Te+m]),ue=ae.a,je=ae.b,Oe(te,ue),d[me+m]=ae.a,d[xe+m]=ae.b,Oe(Be,je),d[Ve+m]=ae.a,d[Te+m]=ae.b)}if(B&F){const xe=me+K;P?Pe(d[me+m],d[xe+m]):Oe(d[me+m],d[xe+m]),te=ae.a,d[xe+m]=ae.b,d[me+m]=te}}if(M&F){let me=j;const Ae=j+Q*(B-_);for(;me<=Ae;me+=W){const xe=me+Y;P?Pe(d[me+m],d[xe+m]):Oe(d[me+m],d[xe+m]),te=ae.a,d[xe+m]=ae.b,d[me+m]=te}}_=F,F>>=1}return j}function xt(d,m,B,Q,M,T,L,P,k){let F=0,_=0;const j=L,J=Math.trunc(Q.value+(M+7)/8);for(;Q.value<J;)for(ce(F,_,B,Q),F=se.c,_=se.lc;_>=14;){const Z=F>>_-14&16383,Y=m[Z];if(Y.len)_-=Y.len,le(Y.lit,T,F,_,B,Q,P,k,j),F=re.c,_=re.lc;else{if(!Y.p)throw new Error("hufDecode issues");let W;for(W=0;W<Y.lit;W++){const te=z(d[Y.p[W]]);for(;_<te&&Q.value<J;)ce(F,_,B,Q),F=se.c,_=se.lc;if(_>=te&&$(d[Y.p[W]])==(F>>_-te&(1<<te)-1)){_-=te,le(Y.p[W],T,F,_,B,Q,P,k,j),F=re.c,_=re.lc;break}}if(W==Y.lit)throw new Error("hufDecode issues")}}const K=8-M&7;for(F>>=K,_-=K;_>0;){const Z=m[F<<14-_&16383];if(Z.len)_-=Z.len,le(Z.lit,T,F,_,B,Q,P,k,j),F=re.c,_=re.lc;else throw new Error("hufDecode issues")}return!0}function ht(d,m,B,Q,M,T){const L={value:0},P=B.value,k=Ye(m,B),F=Ye(m,B);B.value+=4;const _=Ye(m,B);if(B.value+=4,k<0||k>=65537||F<0||F>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const j=new Array(65537),J=new Array(16384);G(J);const K=Q-(B.value-P);if(H(d,B,K,k,F,j),_>8*(Q-(B.value-P)))throw new Error("Something wrong with hufUncompress");ee(j,k,F,J),xt(j,J,d,B,_,F,T,M,L)}function It(d,m,B){for(let Q=0;Q<B;++Q)m[Q]=d[m[Q]]}function rt(d){for(let m=1;m<d.length;m++){const B=d[m-1]+d[m]-128;d[m]=B}}function St(d,m){let B=0,Q=Math.floor((d.length+1)/2),M=0;const T=d.length-1;for(;!(M>T||(m[M++]=d[B++],M>T));)m[M++]=d[Q++]}function as(d){let m=d.byteLength;const B=new Array;let Q=0;const M=new DataView(d);for(;m>0;){const T=M.getInt8(Q++);if(T<0){const L=-T;m-=L+1;for(let P=0;P<L;P++)B.push(M.getUint8(Q++))}else{const L=T;m-=2;const P=M.getUint8(Q++);for(let k=0;k<L+1;k++)B.push(P)}}return B}function Ki(d,m,B,Q,M,T){let L=new DataView(T.buffer);const P=B[d.idx[0]].width,k=B[d.idx[0]].height,F=3,_=Math.floor(P/8),j=Math.ceil(P/8),J=Math.ceil(k/8),K=P-(j-1)*8,Z=k-(J-1)*8,Y={value:0},W=new Array(F),te=new Array(F),ue=new Array(F),Be=new Array(F),je=new Array(F);for(let Ae=0;Ae<F;++Ae)je[Ae]=m[d.idx[Ae]],W[Ae]=Ae<1?0:W[Ae-1]+j*J,te[Ae]=new Float32Array(64),ue[Ae]=new Uint16Array(64),Be[Ae]=new Uint16Array(j*64);for(let Ae=0;Ae<J;++Ae){let xe=8;Ae==J-1&&(xe=Z);let Ve=8;for(let he=0;he<j;++he){he==j-1&&(Ve=K);for(let pe=0;pe<F;++pe)ue[pe].fill(0),ue[pe][0]=M[W[pe]++],Yi(Y,Q,ue[pe]),Vi(ue[pe],te[pe]),Ji(te[pe]);Wi(te);for(let pe=0;pe<F;++pe)Xi(te[pe],Be[pe],he*64)}let Te=0;for(let he=0;he<F;++he){const pe=B[d.idx[he]].type;for(let at=8*Ae;at<8*Ae+xe;++at){Te=je[he][at];for(let Ft=0;Ft<_;++Ft){const $e=Ft*64+(at&7)*8;L.setUint16(Te+0*2*pe,Be[he][$e+0],!0),L.setUint16(Te+1*2*pe,Be[he][$e+1],!0),L.setUint16(Te+2*2*pe,Be[he][$e+2],!0),L.setUint16(Te+3*2*pe,Be[he][$e+3],!0),L.setUint16(Te+4*2*pe,Be[he][$e+4],!0),L.setUint16(Te+5*2*pe,Be[he][$e+5],!0),L.setUint16(Te+6*2*pe,Be[he][$e+6],!0),L.setUint16(Te+7*2*pe,Be[he][$e+7],!0),Te+=8*2*pe}}if(_!=j)for(let at=8*Ae;at<8*Ae+xe;++at){const Ft=je[he][at]+8*_*2*pe,$e=_*64+(at&7)*8;for(let $t=0;$t<Ve;++$t)L.setUint16(Ft+$t*2*pe,Be[he][$e+$t],!0)}}}const me=new Uint16Array(P);L=new DataView(T.buffer);for(let Ae=0;Ae<F;++Ae){B[d.idx[Ae]].decoded=!0;const xe=B[d.idx[Ae]].type;if(B[Ae].type==2)for(let Ve=0;Ve<k;++Ve){const Te=je[Ae][Ve];for(let he=0;he<P;++he)me[he]=L.getUint16(Te+he*2*xe,!0);for(let he=0;he<P;++he)L.setFloat32(Te+he*2*xe,V(me[he]),!0)}}}function Yi(d,m,B){let Q,M=1;for(;M<64;)Q=m[d.value],Q==65280?M=64:Q>>8==255?M+=Q&255:(B[M]=Q,M++),d.value++}function Vi(d,m){m[0]=V(d[0]),m[1]=V(d[1]),m[2]=V(d[5]),m[3]=V(d[6]),m[4]=V(d[14]),m[5]=V(d[15]),m[6]=V(d[27]),m[7]=V(d[28]),m[8]=V(d[2]),m[9]=V(d[4]),m[10]=V(d[7]),m[11]=V(d[13]),m[12]=V(d[16]),m[13]=V(d[26]),m[14]=V(d[29]),m[15]=V(d[42]),m[16]=V(d[3]),m[17]=V(d[8]),m[18]=V(d[12]),m[19]=V(d[17]),m[20]=V(d[25]),m[21]=V(d[30]),m[22]=V(d[41]),m[23]=V(d[43]),m[24]=V(d[9]),m[25]=V(d[11]),m[26]=V(d[18]),m[27]=V(d[24]),m[28]=V(d[31]),m[29]=V(d[40]),m[30]=V(d[44]),m[31]=V(d[53]),m[32]=V(d[10]),m[33]=V(d[19]),m[34]=V(d[23]),m[35]=V(d[32]),m[36]=V(d[39]),m[37]=V(d[45]),m[38]=V(d[52]),m[39]=V(d[54]),m[40]=V(d[20]),m[41]=V(d[22]),m[42]=V(d[33]),m[43]=V(d[38]),m[44]=V(d[46]),m[45]=V(d[51]),m[46]=V(d[55]),m[47]=V(d[60]),m[48]=V(d[21]),m[49]=V(d[34]),m[50]=V(d[37]),m[51]=V(d[47]),m[52]=V(d[50]),m[53]=V(d[56]),m[54]=V(d[59]),m[55]=V(d[61]),m[56]=V(d[35]),m[57]=V(d[36]),m[58]=V(d[48]),m[59]=V(d[49]),m[60]=V(d[57]),m[61]=V(d[58]),m[62]=V(d[62]),m[63]=V(d[63])}function Ji(d){const m=.5*Math.cos(.7853975),B=.5*Math.cos(3.14159/16),Q=.5*Math.cos(3.14159/8),M=.5*Math.cos(3*3.14159/16),T=.5*Math.cos(5*3.14159/16),L=.5*Math.cos(3*3.14159/8),P=.5*Math.cos(7*3.14159/16),k=new Array(4),F=new Array(4),_=new Array(4),j=new Array(4);for(let J=0;J<8;++J){const K=J*8;k[0]=Q*d[K+2],k[1]=L*d[K+2],k[2]=Q*d[K+6],k[3]=L*d[K+6],F[0]=B*d[K+1]+M*d[K+3]+T*d[K+5]+P*d[K+7],F[1]=M*d[K+1]-P*d[K+3]-B*d[K+5]-T*d[K+7],F[2]=T*d[K+1]-B*d[K+3]+P*d[K+5]+M*d[K+7],F[3]=P*d[K+1]-T*d[K+3]+M*d[K+5]-B*d[K+7],_[0]=m*(d[K+0]+d[K+4]),_[3]=m*(d[K+0]-d[K+4]),_[1]=k[0]+k[3],_[2]=k[1]-k[2],j[0]=_[0]+_[1],j[1]=_[3]+_[2],j[2]=_[3]-_[2],j[3]=_[0]-_[1],d[K+0]=j[0]+F[0],d[K+1]=j[1]+F[1],d[K+2]=j[2]+F[2],d[K+3]=j[3]+F[3],d[K+4]=j[3]-F[3],d[K+5]=j[2]-F[2],d[K+6]=j[1]-F[1],d[K+7]=j[0]-F[0]}for(let J=0;J<8;++J)k[0]=Q*d[16+J],k[1]=L*d[16+J],k[2]=Q*d[48+J],k[3]=L*d[48+J],F[0]=B*d[8+J]+M*d[24+J]+T*d[40+J]+P*d[56+J],F[1]=M*d[8+J]-P*d[24+J]-B*d[40+J]-T*d[56+J],F[2]=T*d[8+J]-B*d[24+J]+P*d[40+J]+M*d[56+J],F[3]=P*d[8+J]-T*d[24+J]+M*d[40+J]-B*d[56+J],_[0]=m*(d[J]+d[32+J]),_[3]=m*(d[J]-d[32+J]),_[1]=k[0]+k[3],_[2]=k[1]-k[2],j[0]=_[0]+_[1],j[1]=_[3]+_[2],j[2]=_[3]-_[2],j[3]=_[0]-_[1],d[0+J]=j[0]+F[0],d[8+J]=j[1]+F[1],d[16+J]=j[2]+F[2],d[24+J]=j[3]+F[3],d[32+J]=j[3]-F[3],d[40+J]=j[2]-F[2],d[48+J]=j[1]-F[1],d[56+J]=j[0]-F[0]}function Wi(d){for(let m=0;m<64;++m){const B=d[0][m],Q=d[1][m],M=d[2][m];d[0][m]=B+1.5747*M,d[1][m]=B-.1873*Q-.4682*M,d[2][m]=B+1.8556*Q}}function Xi(d,m,B){for(let Q=0;Q<64;++Q)m[B+Q]=a.DataUtils.toHalfFloat(Zi(d[Q]))}function Zi(d){return d<=1?Math.sign(d)*Math.pow(Math.abs(d),2.2):Math.sign(d)*Math.pow(v,Math.abs(d)-1)}function pn(d){return new DataView(d.array.buffer,d.offset.value,d.size)}function $i(d){const m=d.viewer.buffer.slice(d.offset.value,d.offset.value+d.size),B=new Uint8Array(as(m)),Q=new Uint8Array(B.length);return rt(B),St(B,Q),new DataView(Q.buffer)}function fn(d){const m=d.array.slice(d.offset.value,d.offset.value+d.size),B=Yt(m),Q=new Uint8Array(B.length);return rt(B),St(B,Q),new DataView(Q.buffer)}function eo(d){const m=d.viewer,B={value:d.offset.value},Q=new Uint16Array(d.columns*d.lines*(d.inputChannels.length*d.type)),M=new Uint8Array(8192);let T=0;const L=new Array(d.inputChannels.length);for(let Z=0,Y=d.inputChannels.length;Z<Y;Z++)L[Z]={},L[Z].start=T,L[Z].end=L[Z].start,L[Z].nx=d.columns,L[Z].ny=d.lines,L[Z].size=d.type,T+=L[Z].nx*L[Z].ny*L[Z].size;const P=_t(m,B),k=_t(m,B);if(k>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(P<=k)for(let Z=0;Z<k-P+1;Z++)M[Z+P]=ut(m,B);const F=new Uint16Array(65536),_=N(M,F),j=Ye(m,B);ht(d.array,m,B,j,Q,T);for(let Z=0;Z<d.inputChannels.length;++Z){const Y=L[Z];for(let W=0;W<L[Z].size;++W)Qt(Q,Y.start+W,Y.nx,Y.size,Y.ny,Y.nx*Y.size,_)}It(F,Q,T);let J=0;const K=new Uint8Array(Q.buffer.byteLength);for(let Z=0;Z<d.lines;Z++)for(let Y=0;Y<d.inputChannels.length;Y++){const W=L[Y],te=W.nx*W.size,ue=new Uint8Array(Q.buffer,W.end*2,te*2);K.set(ue,J),J+=te*2,W.end+=te}return new DataView(K.buffer)}function to(d){const m=d.array.slice(d.offset.value,d.offset.value+d.size),B=Yt(m),Q=d.inputChannels.length*d.lines*d.columns*d.totalBytes,M=new ArrayBuffer(Q),T=new DataView(M);let L=0,P=0;const k=new Array(4);for(let F=0;F<d.lines;F++)for(let _=0;_<d.inputChannels.length;_++){let j=0;switch(d.inputChannels[_].pixelType){case 1:k[0]=L,k[1]=k[0]+d.columns,L=k[1]+d.columns;for(let K=0;K<d.columns;++K){const Z=B[k[0]++]<<8|B[k[1]++];j+=Z,T.setUint16(P,j,!0),P+=2}break;case 2:k[0]=L,k[1]=k[0]+d.columns,k[2]=k[1]+d.columns,L=k[2]+d.columns;for(let K=0;K<d.columns;++K){const Z=B[k[0]++]<<24|B[k[1]++]<<16|B[k[2]++]<<8;j+=Z,T.setUint32(P,j,!0),P+=4}break}}return T}function As(d){const m=d.viewer,B={value:d.offset.value},Q=new Uint8Array(d.columns*d.lines*(d.inputChannels.length*d.type*2)),M={version:He(m,B),unknownUncompressedSize:He(m,B),unknownCompressedSize:He(m,B),acCompressedSize:He(m,B),dcCompressedSize:He(m,B),rleCompressedSize:He(m,B),rleUncompressedSize:He(m,B),rleRawSize:He(m,B),totalAcUncompressedCount:He(m,B),totalDcUncompressedCount:He(m,B),acCompression:He(m,B)};if(M.version<2)throw new Error("EXRLoader.parse: "+bt.compression+" version "+M.version+" is unsupported");const T=new Array;let L=_t(m,B)-2;for(;L>0;){const Y=Zt(m.buffer,B),W=ut(m,B),te=W>>2&3,ue=(W>>4)-1,Be=new Int8Array([ue])[0],je=ut(m,B);T.push({name:Y,index:Be,type:je,compression:te}),L-=Y.length+3}const P=bt.channels,k=new Array(d.inputChannels.length);for(let Y=0;Y<d.inputChannels.length;++Y){const W=k[Y]={},te=P[Y];W.name=te.name,W.compression=0,W.decoded=!1,W.type=te.pixelType,W.pLinear=te.pLinear,W.width=d.columns,W.height=d.lines}const F={idx:new Array(3)};for(let Y=0;Y<d.inputChannels.length;++Y){const W=k[Y];for(let te=0;te<T.length;++te){const ue=T[te];W.name==ue.name&&(W.compression=ue.compression,ue.index>=0&&(F.idx[ue.index]=Y),W.offset=Y)}}let _,j,J;if(M.acCompressedSize>0)switch(M.acCompression){case 0:_=new Uint16Array(M.totalAcUncompressedCount),ht(d.array,m,B,M.acCompressedSize,_,M.totalAcUncompressedCount);break;case 1:const Y=d.array.slice(B.value,B.value+M.totalAcUncompressedCount),W=Yt(Y);_=new Uint16Array(W.buffer),B.value+=M.totalAcUncompressedCount;break}if(M.dcCompressedSize>0){const Y={array:d.array,offset:B,size:M.dcCompressedSize};j=new Uint16Array(fn(Y).buffer),B.value+=M.dcCompressedSize}if(M.rleRawSize>0){const Y=d.array.slice(B.value,B.value+M.rleCompressedSize),W=Yt(Y);J=as(W.buffer),B.value+=M.rleCompressedSize}let K=0;const Z=new Array(k.length);for(let Y=0;Y<Z.length;++Y)Z[Y]=new Array;for(let Y=0;Y<d.lines;++Y)for(let W=0;W<k.length;++W)Z[W].push(K),K+=k[W].width*d.type*2;Ki(F,Z,k,_,j,Q);for(let Y=0;Y<k.length;++Y){const W=k[Y];if(!W.decoded)switch(W.compression){case 2:let te=0,ue=0;for(let Be=0;Be<d.lines;++Be){let je=Z[Y][te];for(let me=0;me<W.width;++me){for(let Ae=0;Ae<2*W.type;++Ae)Q[je++]=J[ue+Ae*W.width*W.height];ue++}te++}break;case 1:default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(Q.buffer)}function Zt(d,m){const B=new Uint8Array(d);let Q=0;for(;B[m.value+Q]!=0;)Q+=1;const M=new TextDecoder().decode(B.slice(m.value,m.value+Q));return m.value=m.value+Q+1,M}function no(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 so(d,m){const B=Ke(d,m),Q=Ye(d,m);return[B,Q]}function io(d,m){const B=Ye(d,m),Q=Ye(d,m);return[B,Q]}function Ke(d,m){const B=d.getInt32(m.value,!0);return m.value=m.value+4,B}function Ye(d,m){const B=d.getUint32(m.value,!0);return m.value=m.value+4,B}function cs(d,m){const B=d[m.value];return m.value=m.value+1,B}function ut(d,m){const B=d.getUint8(m.value);return m.value=m.value+1,B}const He=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 _e(d,m){const B=d.getFloat32(m.value,!0);return m.value+=4,B}function oo(d,m){return a.DataUtils.toHalfFloat(_e(d,m))}function V(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 _t(d,m){const B=d.getUint16(m.value,!0);return m.value+=2,B}function ro(d,m){return V(_t(d,m))}function ao(d,m,B,Q){const M=B.value,T=[];for(;B.value<M+Q-1;){const L=Zt(m,B),P=Ke(d,B),k=ut(d,B);B.value+=3;const F=Ke(d,B),_=Ke(d,B);T.push({name:L,pixelType:P,pLinear:k,xSampling:F,ySampling:_})}return B.value+=1,T}function Ao(d,m){const B=_e(d,m),Q=_e(d,m),M=_e(d,m),T=_e(d,m),L=_e(d,m),P=_e(d,m),k=_e(d,m),F=_e(d,m);return{redX:B,redY:Q,greenX:M,greenY:T,blueX:L,blueY:P,whiteX:k,whiteY:F}}function co(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=ut(d,m);return B[Q]}function lo(d,m){const B=Ke(d,m),Q=Ke(d,m),M=Ke(d,m),T=Ke(d,m);return{xMin:B,yMin:Q,xMax:M,yMax:T}}function ho(d,m){const B=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],Q=ut(d,m);return B[Q]}function uo(d,m){const B=["ENVMAP_LATLONG","ENVMAP_CUBE"],Q=ut(d,m);return B[Q]}function go(d,m){const B=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],Q=["ROUND_DOWN","ROUND_UP"],M=Ye(d,m),T=Ye(d,m),L=ut(d,m);return{xSize:M,ySize:T,levelMode:B[L&15],roundingMode:Q[L>>4]}}function po(d,m){const B=_e(d,m),Q=_e(d,m);return[B,Q]}function fo(d,m){const B=_e(d,m),Q=_e(d,m),M=_e(d,m);return[B,Q,M]}function mo(d,m,B,Q,M){if(Q==="string"||Q==="stringvector"||Q==="iccProfile")return no(m,B,M);if(Q==="chlist")return ao(d,m,B,M);if(Q==="chromaticities")return Ao(d,B);if(Q==="compression")return co(d,B);if(Q==="box2i")return lo(d,B);if(Q==="envmap")return uo(d,B);if(Q==="tiledesc")return go(d,B);if(Q==="lineOrder")return ho(d,B);if(Q==="float")return _e(d,B);if(Q==="v2f")return po(d,B);if(Q==="v3f")return fo(d,B);if(Q==="int")return Ke(d,B);if(Q==="rational")return so(d,B);if(Q==="timecode")return io(d,B);if(Q==="preview")return B.value+=M,"skipped";B.value+=M}function Io(d,m){const B=Math.log2(d);return m=="ROUND_DOWN"?Math.floor(B):Math.ceil(B)}function bo(d,m,B){let Q=0;switch(d.levelMode){case"ONE_LEVEL":Q=1;break;case"MIPMAP_LEVELS":Q=Io(Math.max(m,B),d.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return Q}function ls(d,m,B,Q){const M=new Array(d);for(let T=0;T<d;T++){const L=1<<T;let P=m/L|0;Q=="ROUND_UP"&&P*L<m&&(P+=1);const k=Math.max(P,1);M[T]=(k+B-1)/B|0}return M}function Eo(){const d=this,m=d.offset,B={value:0};for(let Q=0;Q<d.tileCount;Q++){const M=Ke(d.viewer,m),T=Ke(d.viewer,m);m.value+=8,d.size=Ye(d.viewer,m);const L=M*d.blockWidth,P=T*d.blockHeight;d.columns=L+d.blockWidth>d.width?d.width-L:d.blockWidth,d.lines=P+d.blockHeight>d.height?d.height-P:d.blockHeight;const k=d.columns*d.totalBytes,_=d.size<d.lines*k?d.uncompress(d):pn(d);m.value+=d.size;for(let j=0;j<d.lines;j++){const J=j*d.columns*d.totalBytes;for(let K=0;K<d.inputChannels.length;K++){const Z=bt.channels[K].name,Y=d.channelByteOffsets[Z]*d.columns,W=d.decodeChannels[Z];if(W===void 0)continue;B.value=J+Y;const te=(d.height-(1+P+j))*d.outLineWidth;for(let ue=0;ue<d.columns;ue++){const Be=te+(ue+L)*d.outputChannels+W;d.byteArray[Be]=d.getter(_,B)}}}}}function Co(){const d=this,m=d.offset,B={value:0};for(let Q=0;Q<d.height/d.blockHeight;Q++){const M=Ke(d.viewer,m)-bt.dataWindow.yMin;d.size=Ye(d.viewer,m),d.lines=M+d.blockHeight>d.height?d.height-M:d.blockHeight;const T=d.columns*d.totalBytes,P=d.size<d.lines*T?d.uncompress(d):pn(d);m.value+=d.size;for(let k=0;k<d.blockHeight;k++){const F=Q*d.blockHeight,_=k+d.scanOrder(F);if(_>=d.height)continue;const j=k*T,J=(d.height-1-_)*d.outLineWidth;for(let K=0;K<d.inputChannels.length;K++){const Z=bt.channels[K].name,Y=d.channelByteOffsets[Z]*d.columns,W=d.decodeChannels[Z];if(W!==void 0){B.value=j+Y;for(let te=0;te<d.columns;te++){const ue=J+te*d.outputChannels+W;d.byteArray[ue]=d.getter(P,B)}}}}}}function Bo(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 M=d.getUint8(5);Q.spec={singleTile:!!(M&2),longName:!!(M&4),deepFormat:!!(M&8),multiPart:!!(M&16)},B.value=8;let T=!0;for(;T;){const L=Zt(m,B);if(L==0)T=!1;else{const P=Zt(m,B),k=Ye(d,B),F=mo(d,m,B,P,k);F===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${P}'.`):Q[L]=F}}if((M&-7)!=0)throw console.error("THREE.EXRHeader:",Q),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return Q}function yo(d,m,B,Q,M){const T={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:a.LinearSRGBColorSpace};switch(d.compression){case"NO_COMPRESSION":T.blockHeight=1,T.uncompress=pn;break;case"RLE_COMPRESSION":T.blockHeight=1,T.uncompress=$i;break;case"ZIPS_COMPRESSION":T.blockHeight=1,T.uncompress=fn;break;case"ZIP_COMPRESSION":T.blockHeight=16,T.uncompress=fn;break;case"PIZ_COMPRESSION":T.blockHeight=32,T.uncompress=eo;break;case"PXR24_COMPRESSION":T.blockHeight=16,T.uncompress=to;break;case"DWAA_COMPRESSION":T.blockHeight=32,T.uncompress=As;break;case"DWAB_COMPRESSION":T.blockHeight=256,T.uncompress=As;break;default:throw new Error("EXRLoader.parse: "+d.compression+" is unsupported")}const L={};for(const _ of d.channels)switch(_.name){case"Y":case"R":case"G":case"B":case"A":L[_.name]=!0,T.type=_.pixelType}let P=!1;if(L.R&&L.G&&L.B)P=!L.A,T.outputChannels=4,T.decodeChannels={R:0,G:1,B:2,A:3};else if(L.Y)T.outputChannels=1,T.decodeChannels={Y:0};else throw new Error("EXRLoader.parse: file contains unsupported data channels.");if(T.type==1)switch(M){case a.FloatType:T.getter=ro;break;case a.HalfFloatType:T.getter=_t;break}else if(T.type==2)switch(M){case a.FloatType:T.getter=_e;break;case a.HalfFloatType:T.getter=oo}else throw new Error("EXRLoader.parse: unsupported pixelType "+T.type+" for "+d.compression+".");T.columns=T.width;const k=T.width*T.height*T.outputChannels;switch(M){case a.FloatType:T.byteArray=new Float32Array(k),P&&T.byteArray.fill(1,0,k);break;case a.HalfFloatType:T.byteArray=new Uint16Array(k),P&&T.byteArray.fill(15360,0,k);break;default:console.error("THREE.EXRLoader: unsupported type: ",M);break}let F=0;for(const _ of d.channels)T.decodeChannels[_.name]!==void 0&&(T.channelByteOffsets[_.name]=F),F+=_.pixelType*2;if(T.totalBytes=F,T.outLineWidth=T.width*T.outputChannels,d.lineOrder==="INCREASING_Y"?T.scanOrder=_=>_:T.scanOrder=_=>T.height-1-_,T.outputChannels==4?(T.format=a.RGBAFormat,T.colorSpace=a.LinearSRGBColorSpace):(T.format=a.RedFormat,T.colorSpace=a.NoColorSpace),d.spec.singleTile){T.blockHeight=d.tiles.ySize,T.blockWidth=d.tiles.xSize;const _=bo(d.tiles,T.width,T.height),j=ls(_,T.width,d.tiles.xSize,d.tiles.roundingMode),J=ls(_,T.height,d.tiles.ySize,d.tiles.roundingMode);T.tileCount=j[0]*J[0];for(let K=0;K<_;K++)for(let Z=0;Z<J[K];Z++)for(let Y=0;Y<j[K];Y++)He(m,Q);T.decode=Eo.bind(T)}else{T.blockWidth=T.width;const _=Math.ceil(T.height/T.blockHeight);for(let j=0;j<_;j++)He(m,Q);T.decode=Co.bind(T)}return T}const hs={value:0},us=new DataView(e),wo=new Uint8Array(e),bt=Bo(us,e,hs),Tt=yo(bt,us,wo,hs,this.type);return Tt.decode(),{header:bt,width:Tt.width,height:Tt.height,data:Tt.byteArray,format:Tt.format,colorSpace:Tt.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,s,n){function i(o,r){o.colorSpace=r.colorSpace,o.minFilter=a.LinearFilter,o.magFilter=a.LinearFilter,o.generateMipmaps=!1,o.flipY=!1,t&&t(o,r)}return super.load(e,i,s,n)}}const ta=Object.freeze(Object.defineProperty({__proto__:null,EXRLoader:Li},Symbol.toStringTag,{value:"Module"}));class ki extends a.DataTextureLoader{constructor(e){super(e),this.type=a.HalfFloatType}parse(e){const o=function(S,v){switch(S){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(v||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(v||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(v||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(v||""))}},h=`
|
|
42
|
-
|
|
41
|
+
*/var Qe=Uint8Array,qe=Uint16Array,ts=Int32Array,dn=new Qe([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]),gn=new Qe([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]),Yn=new Qe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Si=function(c,e){for(var t=new qe(31),s=0;s<31;++s)t[s]=e+=1<<c[s-1];for(var n=new ts(t[30]),s=1;s<30;++s)for(var i=t[s];i<t[s+1];++i)n[i]=i-t[s]<<5|s;return{b:t,r:n}},Ti=Si(dn,2),vi=Ti.b,Vn=Ti.r;vi[28]=258,Vn[258]=28;var Mi=Si(gn,0),Nr=Mi.b,Ms=Mi.r,Jn=new qe(32768);for(var be=0;be<32768;++be){var ft=(be&43690)>>1|(be&21845)<<1;ft=(ft&52428)>>2|(ft&13107)<<2,ft=(ft&61680)>>4|(ft&3855)<<4,Jn[be]=((ft&65280)>>8|(ft&255)<<8)>>1}var ot=function(c,e,t){for(var s=c.length,n=0,i=new qe(e);n<s;++n)c[n]&&++i[c[n]-1];var o=new qe(e);for(n=1;n<e;++n)o[n]=o[n-1]+i[n-1]<<1;var r;if(t){r=new qe(1<<e);var A=15-e;for(n=0;n<s;++n)if(c[n])for(var l=n<<4|c[n],h=e-c[n],u=o[c[n]-1]++<<h,g=u|(1<<h)-1;u<=g;++u)r[Jn[u]>>A]=l}else for(r=new qe(s),n=0;n<s;++n)c[n]&&(r[n]=Jn[o[c[n]-1]++]>>15-c[n]);return r},mt=new Qe(288);for(var be=0;be<144;++be)mt[be]=8;for(var be=144;be<256;++be)mt[be]=9;for(var be=256;be<280;++be)mt[be]=7;for(var be=280;be<288;++be)mt[be]=8;var Wt=new Qe(32);for(var be=0;be<32;++be)Wt[be]=5;var Gr=ot(mt,9,0),Ur=ot(mt,9,1),Pr=ot(Wt,5,0),Or=ot(Wt,5,1),Mn=function(c){for(var e=c[0],t=1;t<c.length;++t)c[t]>e&&(e=c[t]);return e},Ze=function(c,e,t){var s=e/8|0;return(c[s]|c[s+1]<<8)>>(e&7)&t},Rn=function(c,e){var t=e/8|0;return(c[t]|c[t+1]<<8|c[t+2]<<16)>>(e&7)},ns=function(c){return(c+7)/8|0},ss=function(c,e,t){return(t==null||t>c.length)&&(t=c.length),new Qe(c.subarray(e,t))},Hr=["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"],Ge=function(c,e,t){var s=new Error(e||Hr[c]);if(s.code=c,Error.captureStackTrace&&Error.captureStackTrace(s,Ge),!t)throw s;return s},jr=function(c,e,t,s){var n=c.length,i=0;if(!n||e.f&&!e.l)return t||new Qe(0);var o=!t,r=o||e.i!=2,A=e.i;o&&(t=new Qe(n*3));var l=function(ht){var It=t.length;if(ht>It){var rt=new Qe(Math.max(It*2,ht));rt.set(t),t=rt}},h=e.f||0,u=e.p||0,g=e.b||0,p=e.l,f=e.d,I=e.m,b=e.n,E=n*8;do{if(!p){h=Ze(c,u,1);var y=Ze(c,u+1,3);if(u+=3,y)if(y==1)p=Ur,f=Or,I=9,b=5;else if(y==2){var R=Ze(c,u,31)+257,D=Ze(c,u+10,15)+4,S=R+Ze(c,u+5,31)+1;u+=14;for(var v=new Qe(S),N=new Qe(19),G=0;G<D;++G)N[Yn[G]]=Ze(c,u+G*3,7);u+=D*3;for(var O=Mn(N),X=(1<<O)-1,U=ot(N,O,1),G=0;G<S;){var q=U[Ze(c,u,X)];u+=q&15;var C=q>>4;if(C<16)v[G++]=C;else{var H=0,z=0;for(C==16?(z=3+Ze(c,u,3),u+=2,H=v[G-1]):C==17?(z=3+Ze(c,u,7),u+=3):C==18&&(z=11+Ze(c,u,127),u+=7);z--;)v[G++]=H}}var $=v.subarray(0,R),ee=v.subarray(R);I=Mn($),b=Mn(ee),p=ot($,I,1),f=ot(ee,b,1)}else Ge(1);else{var C=ns(u)+4,w=c[C-4]|c[C-3]<<8,x=C+w;if(x>n){A&&Ge(0);break}r&&l(g+w),t.set(c.subarray(C,x),g),e.b=g+=w,e.p=u=x*8,e.f=h;continue}if(u>E){A&&Ge(0);break}}r&&l(g+131072);for(var se=(1<<I)-1,ce=(1<<b)-1,re=u;;re=u){var H=p[Rn(c,u)&se],le=H>>4;if(u+=H&15,u>E){A&&Ge(0);break}if(H||Ge(2),le<256)t[g++]=le;else if(le==256){re=u,p=null;break}else{var Ce=le-254;if(le>264){var G=le-257,fe=dn[G];Ce=Ze(c,u,(1<<fe)-1)+vi[G],u+=fe}var ae=f[Rn(c,u)&ce],Pe=ae>>4;ae||Ge(3),u+=ae&15;var ee=Nr[Pe];if(Pe>3){var fe=gn[Pe];ee+=Rn(c,u)&(1<<fe)-1,u+=fe}if(u>E){A&&Ge(0);break}r&&l(g+131072);var Oe=g+Ce;if(g<ee){var Qt=i-ee,xt=Math.min(ee,Oe);for(Qt+g<0&&Ge(3);g<xt;++g)t[g]=s[Qt+g]}for(;g<Oe;++g)t[g]=t[g-ee]}}e.l=p,e.p=re,e.b=g,e.f=h,p&&(h=1,e.m=I,e.d=f,e.n=b)}while(!h);return g!=t.length&&o?ss(t,0,g):t.subarray(0,g)},At=function(c,e,t){t<<=e&7;var s=e/8|0;c[s]|=t,c[s+1]|=t>>8},Pt=function(c,e,t){t<<=e&7;var s=e/8|0;c[s]|=t,c[s+1]|=t>>8,c[s+2]|=t>>16},Dn=function(c,e){for(var t=[],s=0;s<c.length;++s)c[s]&&t.push({s,f:c[s]});var n=t.length,i=t.slice();if(!n)return{t:Di,l:0};if(n==1){var o=new Qe(t[0].s+1);return o[t[0].s]=1,{t:o,l:1}}t.sort(function(x,R){return x.f-R.f}),t.push({s:-1,f:25001});var r=t[0],A=t[1],l=0,h=1,u=2;for(t[0]={s:-1,f:r.f+A.f,l:r,r:A};h!=n-1;)r=t[t[l].f<t[u].f?l++:u++],A=t[l!=h&&t[l].f<t[u].f?l++:u++],t[h++]={s:-1,f:r.f+A.f,l:r,r:A};for(var g=i[0].s,s=1;s<n;++s)i[s].s>g&&(g=i[s].s);var p=new qe(g+1),f=Wn(t[h-1],p,0);if(f>e){var s=0,I=0,b=f-e,E=1<<b;for(i.sort(function(R,D){return p[D.s]-p[R.s]||R.f-D.f});s<n;++s){var y=i[s].s;if(p[y]>e)I+=E-(1<<f-p[y]),p[y]=e;else break}for(I>>=b;I>0;){var C=i[s].s;p[C]<e?I-=1<<e-p[C]++-1:++s}for(;s>=0&&I;--s){var w=i[s].s;p[w]==e&&(--p[w],++I)}f=e}return{t:new Qe(p),l:f}},Wn=function(c,e,t){return c.s==-1?Math.max(Wn(c.l,e,t+1),Wn(c.r,e,t+1)):e[c.s]=t},Rs=function(c){for(var e=c.length;e&&!c[--e];);for(var t=new qe(++e),s=0,n=c[0],i=1,o=function(A){t[s++]=A},r=1;r<=e;++r)if(c[r]==n&&r!=e)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=c[r]}return{c:t.subarray(0,s),n:e}},Ot=function(c,e){for(var t=0,s=0;s<e.length;++s)t+=c[s]*e[s];return t},Ri=function(c,e,t){var s=t.length,n=ns(e+2);c[n]=s&255,c[n+1]=s>>8,c[n+2]=c[n]^255,c[n+3]=c[n+1]^255;for(var i=0;i<s;++i)c[n+i+4]=t[i];return(n+4+s)*8},Ds=function(c,e,t,s,n,i,o,r,A,l,h){At(e,h++,t),++n[256];for(var u=Dn(n,15),g=u.t,p=u.l,f=Dn(i,15),I=f.t,b=f.l,E=Rs(g),y=E.c,C=E.n,w=Rs(I),x=w.c,R=w.n,D=new qe(19),S=0;S<y.length;++S)++D[y[S]&31];for(var S=0;S<x.length;++S)++D[x[S]&31];for(var v=Dn(D,7),N=v.t,G=v.l,O=19;O>4&&!N[Yn[O-1]];--O);var X=l+5<<3,U=Ot(n,mt)+Ot(i,Wt)+o,q=Ot(n,g)+Ot(i,I)+o+14+3*O+Ot(D,N)+2*D[16]+3*D[17]+7*D[18];if(A>=0&&X<=U&&X<=q)return Ri(e,h,c.subarray(A,A+l));var H,z,$,ee;if(At(e,h,1+(q<U)),h+=2,q<U){H=ot(g,p,0),z=g,$=ot(I,b,0),ee=I;var se=ot(N,G,0);At(e,h,C-257),At(e,h+5,R-1),At(e,h+10,O-4),h+=14;for(var S=0;S<O;++S)At(e,h+3*S,N[Yn[S]]);h+=3*O;for(var ce=[y,x],re=0;re<2;++re)for(var le=ce[re],S=0;S<le.length;++S){var Ce=le[S]&31;At(e,h,se[Ce]),h+=N[Ce],Ce>15&&(At(e,h,le[S]>>5&127),h+=le[S]>>12)}}else H=Gr,z=mt,$=Pr,ee=Wt;for(var S=0;S<r;++S){var fe=s[S];if(fe>255){var Ce=fe>>18&31;Pt(e,h,H[Ce+257]),h+=z[Ce+257],Ce>7&&(At(e,h,fe>>23&31),h+=dn[Ce]);var ae=fe&31;Pt(e,h,$[ae]),h+=ee[ae],ae>3&&(Pt(e,h,fe>>5&8191),h+=gn[ae])}else Pt(e,h,H[fe]),h+=z[fe]}return Pt(e,h,H[256]),h+z[256]},qr=new ts([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Di=new Qe(0),zr=function(c,e,t,s,n,i){var o=i.z||c.length,r=new Qe(s+o+5*(1+Math.ceil(o/7e3))+n),A=r.subarray(s,r.length-n),l=i.l,h=(i.r||0)&7;if(e){h&&(A[0]=i.r>>3);for(var u=qr[e-1],g=u>>13,p=u&8191,f=(1<<t)-1,I=i.p||new qe(32768),b=i.h||new qe(f+1),E=Math.ceil(t/3),y=2*E,C=function(St){return(c[St]^c[St+1]<<E^c[St+2]<<y)&f},w=new ts(25e3),x=new qe(288),R=new qe(32),D=0,S=0,v=i.i||0,N=0,G=i.w||0,O=0;v+2<o;++v){var X=C(v),U=v&32767,q=b[X];if(I[U]=q,b[X]=U,G<=v){var H=o-v;if((D>7e3||N>24576)&&(H>423||!l)){h=Ds(c,A,0,w,x,R,S,N,O,v-O,h),N=D=S=0,O=v;for(var z=0;z<286;++z)x[z]=0;for(var z=0;z<30;++z)R[z]=0}var $=2,ee=0,se=p,ce=U-q&32767;if(H>2&&X==C(v-ce))for(var re=Math.min(g,H)-1,le=Math.min(32767,v),Ce=Math.min(258,H);ce<=le&&--se&&U!=q;){if(c[v+$]==c[v+$-ce]){for(var fe=0;fe<Ce&&c[v+fe]==c[v+fe-ce];++fe);if(fe>$){if($=fe,ee=ce,fe>re)break;for(var ae=Math.min(ce,fe-2),Pe=0,z=0;z<ae;++z){var Oe=v-ce+z&32767,Qt=I[Oe],xt=Oe-Qt&32767;xt>Pe&&(Pe=xt,q=Oe)}}}U=q,q=I[U],ce+=U-q&32767}if(ee){w[N++]=268435456|Vn[$]<<18|Ms[ee];var ht=Vn[$]&31,It=Ms[ee]&31;S+=dn[ht]+gn[It],++x[257+ht],++R[It],G=v+$,++D}else w[N++]=c[v],++x[c[v]]}}for(v=Math.max(v,G);v<o;++v)w[N++]=c[v],++x[c[v]];h=Ds(c,A,l,w,x,R,S,N,O,v-O,h),l||(i.r=h&7|A[h/8|0]<<3,h-=7,i.h=b,i.p=I,i.i=v,i.w=G)}else{for(var v=i.w||0;v<o+l;v+=65535){var rt=v+65535;rt>=o&&(A[h/8|0]=l,rt=o),h=Ri(A,h+1,c.subarray(v,rt))}i.i=o}return ss(r,0,s+ns(h)+n)},Kr=function(){for(var c=new Int32Array(256),e=0;e<256;++e){for(var t=e,s=9;--s;)t=(t&1&&-306674912)^t>>>1;c[e]=t}return c}(),Yr=function(){var c=-1;return{p:function(e){for(var t=c,s=0;s<e.length;++s)t=Kr[t&255^e[s]]^t>>>8;c=t},d:function(){return~c}}},Vr=function(c,e,t,s,n){if(!n&&(n={l:1},e.dictionary)){var i=e.dictionary.subarray(-32768),o=new Qe(i.length+c.length);o.set(i),o.set(c,i.length),c=o,n.w=i.length}return zr(c,e.level==null?6:e.level,e.mem==null?n.l?Math.ceil(Math.max(8,Math.min(13,Math.log(c.length)))*1.5):20:12+e.mem,t,s,n)},_i=function(c,e){var t={};for(var s in c)t[s]=c[s];for(var s in e)t[s]=e[s];return t},Re=function(c,e,t){for(;t;++e)c[e]=t,t>>>=8},Jr=function(c,e){return((c[0]&15)!=8||c[0]>>4>7||(c[0]<<8|c[1])%31)&&Ge(6,"invalid zlib data"),(c[1]>>5&1)==1&&Ge(6,"invalid zlib data: "+(c[1]&32?"need":"unexpected")+" dictionary"),(c[1]>>3&4)+2};function Wr(c,e){return Vr(c,e||{},0,0)}function Yt(c,e){return jr(c.subarray(Jr(c),-4),{i:2},e,e)}var Fi=function(c,e,t,s){for(var n in c){var i=c[n],o=e+n,r=s;Array.isArray(i)&&(r=_i(s,i[1]),i=i[0]),i instanceof Qe?t[o]=[i,r]:(t[o+="/"]=[new Qe(0),r],Fi(i,o,t,s))}},_s=typeof TextEncoder<"u"&&new TextEncoder,Xr=typeof TextDecoder<"u"&&new TextDecoder,Zr=0;try{Xr.decode(Di,{stream:!0}),Zr=1}catch{}function Xn(c,e){var t;if(_s)return _s.encode(c);for(var s=c.length,n=new Qe(c.length+(c.length>>1)),i=0,o=function(l){n[i++]=l},t=0;t<s;++t){if(i+5>n.length){var r=new Qe(i+8+(s-t<<1));r.set(n),n=r}var A=c.charCodeAt(t);A<128||e?o(A):A<2048?(o(192|A>>6),o(128|A&63)):A>55295&&A<57344?(A=65536+(A&1047552)|c.charCodeAt(++t)&1023,o(240|A>>18),o(128|A>>12&63),o(128|A>>6&63),o(128|A&63)):(o(224|A>>12),o(128|A>>6&63),o(128|A&63))}return ss(n,0,i)}var Zn=function(c){var e=0;if(c)for(var t in c){var s=c[t].length;s>65535&&Ge(9),e+=s+4}return e},Fs=function(c,e,t,s,n,i,o,r){var A=s.length,l=t.extra,h=r&&r.length,u=Zn(l);Re(c,e,o!=null?33639248:67324752),e+=4,o!=null&&(c[e++]=20,c[e++]=t.os),c[e]=20,e+=2,c[e++]=t.flag<<1|(i<0&&8),c[e++]=n&&8,c[e++]=t.compression&255,c[e++]=t.compression>>8;var g=new Date(t.mtime==null?Date.now():t.mtime),p=g.getFullYear()-1980;if((p<0||p>119)&&Ge(10),Re(c,e,p<<25|g.getMonth()+1<<21|g.getDate()<<16|g.getHours()<<11|g.getMinutes()<<5|g.getSeconds()>>1),e+=4,i!=-1&&(Re(c,e,t.crc),Re(c,e+4,i<0?-i-2:i),Re(c,e+8,t.size)),Re(c,e+12,A),Re(c,e+14,u),e+=16,o!=null&&(Re(c,e,h),Re(c,e+6,t.attrs),Re(c,e+10,o),e+=14),c.set(s,e),e+=A,u)for(var f in l){var I=l[f],b=I.length;Re(c,e,+f),Re(c,e+2,b),c.set(I,e+4),e+=4+b}return h&&(c.set(r,e),e+=h),e},$r=function(c,e,t,s,n){Re(c,e,101010256),Re(c,e+8,t),Re(c,e+10,t),Re(c,e+12,s),Re(c,e+16,n)};function ea(c,e){e||(e={});var t={},s=[];Fi(c,"",t,e);var n=0,i=0;for(var o in t){var r=t[o],A=r[0],l=r[1],h=l.level==0?0:8,u=Xn(o),g=u.length,p=l.comment,f=p&&Xn(p),I=f&&f.length,b=Zn(l.extra);g>65535&&Ge(11);var E=h?Wr(A,l):A,y=E.length,C=Yr();C.p(A),s.push(_i(l,{size:A.length,crc:C.d(),c:E,f:u,m:f,u:g!=o.length||f&&p.length!=I,o:n,compression:h})),n+=30+g+b+y,i+=76+2*(g+b)+(I||0)+y}for(var w=new Qe(i+22),x=n,R=i-n,D=0;D<s.length;++D){var u=s[D];Fs(w,u.o,u,u.f,u.u,u.c.length);var S=30+u.f.length+Zn(u.extra);w.set(u.c,u.o+S),Fs(w,n,u,u.f,u.u,u.c.length,u.o,u.m),n+=16+S+(u.m?u.m.length:0)}return $r(w,n,s.length,R,x),w}class Li extends a.DataTextureLoader{constructor(e){super(e),this.type=a.HalfFloatType}parse(e){const v=Math.pow(2.7182818,2.2);function N(d,m){let B=0;for(let M=0;M<65536;++M)(M==0||d[M>>3]&1<<(M&7))&&(m[B++]=M);const Q=B-1;for(;B<65536;)m[B++]=0;return Q}function G(d){for(let m=0;m<16384;m++)d[m]={},d[m].len=0,d[m].lit=0,d[m].p=null}const O={l:0,c:0,lc:0};function X(d,m,B,Q,M){for(;B<d;)m=m<<8|cs(Q,M),B+=8;B-=d,O.l=m>>B&(1<<d)-1,O.c=m,O.lc=B}const U=new Array(59);function q(d){for(let B=0;B<=58;++B)U[B]=0;for(let B=0;B<65537;++B)U[d[B]]+=1;let m=0;for(let B=58;B>0;--B){const Q=m+U[B]>>1;U[B]=m,m=Q}for(let B=0;B<65537;++B){const Q=d[B];Q>0&&(d[B]=Q|U[Q]++<<6)}}function H(d,m,B,Q,M,T){const L=m;let P=0,k=0;for(;Q<=M;Q++){if(L.value-m.value>B)return!1;X(6,P,k,d,L);const F=O.l;if(P=O.c,k=O.lc,T[Q]=F,F==63){if(L.value-m.value>B)throw new Error("Something wrong with hufUnpackEncTable");X(8,P,k,d,L);let _=O.l+6;if(P=O.c,k=O.lc,Q+_>M+1)throw new Error("Something wrong with hufUnpackEncTable");for(;_--;)T[Q++]=0;Q--}else if(F>=59){let _=F-59+2;if(Q+_>M+1)throw new Error("Something wrong with hufUnpackEncTable");for(;_--;)T[Q++]=0;Q--}}q(T)}function z(d){return d&63}function $(d){return d>>6}function ee(d,m,B,Q){for(;m<=B;m++){const M=$(d[m]),T=z(d[m]);if(M>>T)throw new Error("Invalid table entry");if(T>14){const L=Q[M>>T-14];if(L.len)throw new Error("Invalid table entry");if(L.lit++,L.p){const P=L.p;L.p=new Array(L.lit);for(let k=0;k<L.lit-1;++k)L.p[k]=P[k]}else L.p=new Array(1);L.p[L.lit-1]=m}else if(T){let L=0;for(let P=1<<14-T;P>0;P--){const k=Q[(M<<14-T)+L];if(k.len||k.p)throw new Error("Invalid table entry");k.len=T,k.lit=m,L++}}}return!0}const se={c:0,lc:0};function ce(d,m,B,Q){d=d<<8|cs(B,Q),m+=8,se.c=d,se.lc=m}const re={c:0,lc:0};function le(d,m,B,Q,M,T,L,P,k){if(d==m){Q<8&&(ce(B,Q,M,T),B=se.c,Q=se.lc),Q-=8;let F=B>>Q;if(F=new Uint8Array([F])[0],P.value+F>k)return!1;const _=L[P.value-1];for(;F-- >0;)L[P.value++]=_}else if(P.value<k)L[P.value++]=d;else return!1;re.c=B,re.lc=Q}function Ce(d){return d&65535}function fe(d){const m=Ce(d);return m>32767?m-65536:m}const ae={a:0,b:0};function Pe(d,m){const B=fe(d),M=fe(m),T=B+(M&1)+(M>>1),L=T,P=T-M;ae.a=L,ae.b=P}function Oe(d,m){const B=Ce(d),Q=Ce(m),M=B-(Q>>1)&65535,T=Q+M-32768&65535;ae.a=T,ae.b=M}function Qt(d,m,B,Q,M,T,L){const P=L<16384,k=B>M?M:B;let F=1,_,j;for(;F<=k;)F<<=1;for(F>>=1,_=F,F>>=1;F>=1;){j=0;const J=j+T*(M-_),K=T*F,Z=T*_,Y=Q*F,W=Q*_;let te,ue,Be,je;for(;j<=J;j+=Z){let me=j;const Ae=j+Q*(B-_);for(;me<=Ae;me+=W){const xe=me+Y,Ve=me+K,Te=Ve+Y;P?(Pe(d[me+m],d[Ve+m]),te=ae.a,Be=ae.b,Pe(d[xe+m],d[Te+m]),ue=ae.a,je=ae.b,Pe(te,ue),d[me+m]=ae.a,d[xe+m]=ae.b,Pe(Be,je),d[Ve+m]=ae.a,d[Te+m]=ae.b):(Oe(d[me+m],d[Ve+m]),te=ae.a,Be=ae.b,Oe(d[xe+m],d[Te+m]),ue=ae.a,je=ae.b,Oe(te,ue),d[me+m]=ae.a,d[xe+m]=ae.b,Oe(Be,je),d[Ve+m]=ae.a,d[Te+m]=ae.b)}if(B&F){const xe=me+K;P?Pe(d[me+m],d[xe+m]):Oe(d[me+m],d[xe+m]),te=ae.a,d[xe+m]=ae.b,d[me+m]=te}}if(M&F){let me=j;const Ae=j+Q*(B-_);for(;me<=Ae;me+=W){const xe=me+Y;P?Pe(d[me+m],d[xe+m]):Oe(d[me+m],d[xe+m]),te=ae.a,d[xe+m]=ae.b,d[me+m]=te}}_=F,F>>=1}return j}function xt(d,m,B,Q,M,T,L,P,k){let F=0,_=0;const j=L,J=Math.trunc(Q.value+(M+7)/8);for(;Q.value<J;)for(ce(F,_,B,Q),F=se.c,_=se.lc;_>=14;){const Z=F>>_-14&16383,Y=m[Z];if(Y.len)_-=Y.len,le(Y.lit,T,F,_,B,Q,P,k,j),F=re.c,_=re.lc;else{if(!Y.p)throw new Error("hufDecode issues");let W;for(W=0;W<Y.lit;W++){const te=z(d[Y.p[W]]);for(;_<te&&Q.value<J;)ce(F,_,B,Q),F=se.c,_=se.lc;if(_>=te&&$(d[Y.p[W]])==(F>>_-te&(1<<te)-1)){_-=te,le(Y.p[W],T,F,_,B,Q,P,k,j),F=re.c,_=re.lc;break}}if(W==Y.lit)throw new Error("hufDecode issues")}}const K=8-M&7;for(F>>=K,_-=K;_>0;){const Z=m[F<<14-_&16383];if(Z.len)_-=Z.len,le(Z.lit,T,F,_,B,Q,P,k,j),F=re.c,_=re.lc;else throw new Error("hufDecode issues")}return!0}function ht(d,m,B,Q,M,T){const L={value:0},P=B.value,k=Ye(m,B),F=Ye(m,B);B.value+=4;const _=Ye(m,B);if(B.value+=4,k<0||k>=65537||F<0||F>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const j=new Array(65537),J=new Array(16384);G(J);const K=Q-(B.value-P);if(H(d,B,K,k,F,j),_>8*(Q-(B.value-P)))throw new Error("Something wrong with hufUncompress");ee(j,k,F,J),xt(j,J,d,B,_,F,T,M,L)}function It(d,m,B){for(let Q=0;Q<B;++Q)m[Q]=d[m[Q]]}function rt(d){for(let m=1;m<d.length;m++){const B=d[m-1]+d[m]-128;d[m]=B}}function St(d,m){let B=0,Q=Math.floor((d.length+1)/2),M=0;const T=d.length-1;for(;!(M>T||(m[M++]=d[B++],M>T));)m[M++]=d[Q++]}function as(d){let m=d.byteLength;const B=new Array;let Q=0;const M=new DataView(d);for(;m>0;){const T=M.getInt8(Q++);if(T<0){const L=-T;m-=L+1;for(let P=0;P<L;P++)B.push(M.getUint8(Q++))}else{const L=T;m-=2;const P=M.getUint8(Q++);for(let k=0;k<L+1;k++)B.push(P)}}return B}function Ki(d,m,B,Q,M,T){let L=new DataView(T.buffer);const P=B[d.idx[0]].width,k=B[d.idx[0]].height,F=3,_=Math.floor(P/8),j=Math.ceil(P/8),J=Math.ceil(k/8),K=P-(j-1)*8,Z=k-(J-1)*8,Y={value:0},W=new Array(F),te=new Array(F),ue=new Array(F),Be=new Array(F),je=new Array(F);for(let Ae=0;Ae<F;++Ae)je[Ae]=m[d.idx[Ae]],W[Ae]=Ae<1?0:W[Ae-1]+j*J,te[Ae]=new Float32Array(64),ue[Ae]=new Uint16Array(64),Be[Ae]=new Uint16Array(j*64);for(let Ae=0;Ae<J;++Ae){let xe=8;Ae==J-1&&(xe=Z);let Ve=8;for(let he=0;he<j;++he){he==j-1&&(Ve=K);for(let pe=0;pe<F;++pe)ue[pe].fill(0),ue[pe][0]=M[W[pe]++],Yi(Y,Q,ue[pe]),Vi(ue[pe],te[pe]),Ji(te[pe]);Wi(te);for(let pe=0;pe<F;++pe)Xi(te[pe],Be[pe],he*64)}let Te=0;for(let he=0;he<F;++he){const pe=B[d.idx[he]].type;for(let at=8*Ae;at<8*Ae+xe;++at){Te=je[he][at];for(let Ft=0;Ft<_;++Ft){const $e=Ft*64+(at&7)*8;L.setUint16(Te+0*pe,Be[he][$e+0],!0),L.setUint16(Te+2*pe,Be[he][$e+1],!0),L.setUint16(Te+4*pe,Be[he][$e+2],!0),L.setUint16(Te+6*pe,Be[he][$e+3],!0),L.setUint16(Te+8*pe,Be[he][$e+4],!0),L.setUint16(Te+10*pe,Be[he][$e+5],!0),L.setUint16(Te+12*pe,Be[he][$e+6],!0),L.setUint16(Te+14*pe,Be[he][$e+7],!0),Te+=16*pe}}if(_!=j)for(let at=8*Ae;at<8*Ae+xe;++at){const Ft=je[he][at]+8*_*2*pe,$e=_*64+(at&7)*8;for(let $t=0;$t<Ve;++$t)L.setUint16(Ft+$t*2*pe,Be[he][$e+$t],!0)}}}const me=new Uint16Array(P);L=new DataView(T.buffer);for(let Ae=0;Ae<F;++Ae){B[d.idx[Ae]].decoded=!0;const xe=B[d.idx[Ae]].type;if(B[Ae].type==2)for(let Ve=0;Ve<k;++Ve){const Te=je[Ae][Ve];for(let he=0;he<P;++he)me[he]=L.getUint16(Te+he*2*xe,!0);for(let he=0;he<P;++he)L.setFloat32(Te+he*2*xe,V(me[he]),!0)}}}function Yi(d,m,B){let Q,M=1;for(;M<64;)Q=m[d.value],Q==65280?M=64:Q>>8==255?M+=Q&255:(B[M]=Q,M++),d.value++}function Vi(d,m){m[0]=V(d[0]),m[1]=V(d[1]),m[2]=V(d[5]),m[3]=V(d[6]),m[4]=V(d[14]),m[5]=V(d[15]),m[6]=V(d[27]),m[7]=V(d[28]),m[8]=V(d[2]),m[9]=V(d[4]),m[10]=V(d[7]),m[11]=V(d[13]),m[12]=V(d[16]),m[13]=V(d[26]),m[14]=V(d[29]),m[15]=V(d[42]),m[16]=V(d[3]),m[17]=V(d[8]),m[18]=V(d[12]),m[19]=V(d[17]),m[20]=V(d[25]),m[21]=V(d[30]),m[22]=V(d[41]),m[23]=V(d[43]),m[24]=V(d[9]),m[25]=V(d[11]),m[26]=V(d[18]),m[27]=V(d[24]),m[28]=V(d[31]),m[29]=V(d[40]),m[30]=V(d[44]),m[31]=V(d[53]),m[32]=V(d[10]),m[33]=V(d[19]),m[34]=V(d[23]),m[35]=V(d[32]),m[36]=V(d[39]),m[37]=V(d[45]),m[38]=V(d[52]),m[39]=V(d[54]),m[40]=V(d[20]),m[41]=V(d[22]),m[42]=V(d[33]),m[43]=V(d[38]),m[44]=V(d[46]),m[45]=V(d[51]),m[46]=V(d[55]),m[47]=V(d[60]),m[48]=V(d[21]),m[49]=V(d[34]),m[50]=V(d[37]),m[51]=V(d[47]),m[52]=V(d[50]),m[53]=V(d[56]),m[54]=V(d[59]),m[55]=V(d[61]),m[56]=V(d[35]),m[57]=V(d[36]),m[58]=V(d[48]),m[59]=V(d[49]),m[60]=V(d[57]),m[61]=V(d[58]),m[62]=V(d[62]),m[63]=V(d[63])}function Ji(d){const m=.5*Math.cos(.7853975),B=.5*Math.cos(3.14159/16),Q=.5*Math.cos(3.14159/8),M=.5*Math.cos(3*3.14159/16),T=.5*Math.cos(5*3.14159/16),L=.5*Math.cos(3*3.14159/8),P=.5*Math.cos(7*3.14159/16),k=new Array(4),F=new Array(4),_=new Array(4),j=new Array(4);for(let J=0;J<8;++J){const K=J*8;k[0]=Q*d[K+2],k[1]=L*d[K+2],k[2]=Q*d[K+6],k[3]=L*d[K+6],F[0]=B*d[K+1]+M*d[K+3]+T*d[K+5]+P*d[K+7],F[1]=M*d[K+1]-P*d[K+3]-B*d[K+5]-T*d[K+7],F[2]=T*d[K+1]-B*d[K+3]+P*d[K+5]+M*d[K+7],F[3]=P*d[K+1]-T*d[K+3]+M*d[K+5]-B*d[K+7],_[0]=m*(d[K+0]+d[K+4]),_[3]=m*(d[K+0]-d[K+4]),_[1]=k[0]+k[3],_[2]=k[1]-k[2],j[0]=_[0]+_[1],j[1]=_[3]+_[2],j[2]=_[3]-_[2],j[3]=_[0]-_[1],d[K+0]=j[0]+F[0],d[K+1]=j[1]+F[1],d[K+2]=j[2]+F[2],d[K+3]=j[3]+F[3],d[K+4]=j[3]-F[3],d[K+5]=j[2]-F[2],d[K+6]=j[1]-F[1],d[K+7]=j[0]-F[0]}for(let J=0;J<8;++J)k[0]=Q*d[16+J],k[1]=L*d[16+J],k[2]=Q*d[48+J],k[3]=L*d[48+J],F[0]=B*d[8+J]+M*d[24+J]+T*d[40+J]+P*d[56+J],F[1]=M*d[8+J]-P*d[24+J]-B*d[40+J]-T*d[56+J],F[2]=T*d[8+J]-B*d[24+J]+P*d[40+J]+M*d[56+J],F[3]=P*d[8+J]-T*d[24+J]+M*d[40+J]-B*d[56+J],_[0]=m*(d[J]+d[32+J]),_[3]=m*(d[J]-d[32+J]),_[1]=k[0]+k[3],_[2]=k[1]-k[2],j[0]=_[0]+_[1],j[1]=_[3]+_[2],j[2]=_[3]-_[2],j[3]=_[0]-_[1],d[0+J]=j[0]+F[0],d[8+J]=j[1]+F[1],d[16+J]=j[2]+F[2],d[24+J]=j[3]+F[3],d[32+J]=j[3]-F[3],d[40+J]=j[2]-F[2],d[48+J]=j[1]-F[1],d[56+J]=j[0]-F[0]}function Wi(d){for(let m=0;m<64;++m){const B=d[0][m],Q=d[1][m],M=d[2][m];d[0][m]=B+1.5747*M,d[1][m]=B-.1873*Q-.4682*M,d[2][m]=B+1.8556*Q}}function Xi(d,m,B){for(let Q=0;Q<64;++Q)m[B+Q]=a.DataUtils.toHalfFloat(Zi(d[Q]))}function Zi(d){return d<=1?Math.sign(d)*Math.pow(Math.abs(d),2.2):Math.sign(d)*Math.pow(v,Math.abs(d)-1)}function pn(d){return new DataView(d.array.buffer,d.offset.value,d.size)}function $i(d){const m=d.viewer.buffer.slice(d.offset.value,d.offset.value+d.size),B=new Uint8Array(as(m)),Q=new Uint8Array(B.length);return rt(B),St(B,Q),new DataView(Q.buffer)}function fn(d){const m=d.array.slice(d.offset.value,d.offset.value+d.size),B=Yt(m),Q=new Uint8Array(B.length);return rt(B),St(B,Q),new DataView(Q.buffer)}function eo(d){const m=d.viewer,B={value:d.offset.value},Q=new Uint16Array(d.columns*d.lines*(d.inputChannels.length*d.type)),M=new Uint8Array(8192);let T=0;const L=new Array(d.inputChannels.length);for(let Z=0,Y=d.inputChannels.length;Z<Y;Z++)L[Z]={},L[Z].start=T,L[Z].end=L[Z].start,L[Z].nx=d.columns,L[Z].ny=d.lines,L[Z].size=d.type,T+=L[Z].nx*L[Z].ny*L[Z].size;const P=_t(m,B),k=_t(m,B);if(k>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(P<=k)for(let Z=0;Z<k-P+1;Z++)M[Z+P]=ut(m,B);const F=new Uint16Array(65536),_=N(M,F),j=Ye(m,B);ht(d.array,m,B,j,Q,T);for(let Z=0;Z<d.inputChannels.length;++Z){const Y=L[Z];for(let W=0;W<L[Z].size;++W)Qt(Q,Y.start+W,Y.nx,Y.size,Y.ny,Y.nx*Y.size,_)}It(F,Q,T);let J=0;const K=new Uint8Array(Q.buffer.byteLength);for(let Z=0;Z<d.lines;Z++)for(let Y=0;Y<d.inputChannels.length;Y++){const W=L[Y],te=W.nx*W.size,ue=new Uint8Array(Q.buffer,W.end*2,te*2);K.set(ue,J),J+=te*2,W.end+=te}return new DataView(K.buffer)}function to(d){const m=d.array.slice(d.offset.value,d.offset.value+d.size),B=Yt(m),Q=d.inputChannels.length*d.lines*d.columns*d.totalBytes,M=new ArrayBuffer(Q),T=new DataView(M);let L=0,P=0;const k=new Array(4);for(let F=0;F<d.lines;F++)for(let _=0;_<d.inputChannels.length;_++){let j=0;switch(d.inputChannels[_].pixelType){case 1:k[0]=L,k[1]=k[0]+d.columns,L=k[1]+d.columns;for(let K=0;K<d.columns;++K){const Z=B[k[0]++]<<8|B[k[1]++];j+=Z,T.setUint16(P,j,!0),P+=2}break;case 2:k[0]=L,k[1]=k[0]+d.columns,k[2]=k[1]+d.columns,L=k[2]+d.columns;for(let K=0;K<d.columns;++K){const Z=B[k[0]++]<<24|B[k[1]++]<<16|B[k[2]++]<<8;j+=Z,T.setUint32(P,j,!0),P+=4}break}}return T}function As(d){const m=d.viewer,B={value:d.offset.value},Q=new Uint8Array(d.columns*d.lines*(d.inputChannels.length*d.type*2)),M={version:He(m,B),unknownUncompressedSize:He(m,B),unknownCompressedSize:He(m,B),acCompressedSize:He(m,B),dcCompressedSize:He(m,B),rleCompressedSize:He(m,B),rleUncompressedSize:He(m,B),rleRawSize:He(m,B),totalAcUncompressedCount:He(m,B),totalDcUncompressedCount:He(m,B),acCompression:He(m,B)};if(M.version<2)throw new Error("EXRLoader.parse: "+bt.compression+" version "+M.version+" is unsupported");const T=new Array;let L=_t(m,B)-2;for(;L>0;){const Y=Zt(m.buffer,B),W=ut(m,B),te=W>>2&3,ue=(W>>4)-1,Be=new Int8Array([ue])[0],je=ut(m,B);T.push({name:Y,index:Be,type:je,compression:te}),L-=Y.length+3}const P=bt.channels,k=new Array(d.inputChannels.length);for(let Y=0;Y<d.inputChannels.length;++Y){const W=k[Y]={},te=P[Y];W.name=te.name,W.compression=0,W.decoded=!1,W.type=te.pixelType,W.pLinear=te.pLinear,W.width=d.columns,W.height=d.lines}const F={idx:new Array(3)};for(let Y=0;Y<d.inputChannels.length;++Y){const W=k[Y];for(let te=0;te<T.length;++te){const ue=T[te];W.name==ue.name&&(W.compression=ue.compression,ue.index>=0&&(F.idx[ue.index]=Y),W.offset=Y)}}let _,j,J;if(M.acCompressedSize>0)switch(M.acCompression){case 0:_=new Uint16Array(M.totalAcUncompressedCount),ht(d.array,m,B,M.acCompressedSize,_,M.totalAcUncompressedCount);break;case 1:const Y=d.array.slice(B.value,B.value+M.totalAcUncompressedCount),W=Yt(Y);_=new Uint16Array(W.buffer),B.value+=M.totalAcUncompressedCount;break}if(M.dcCompressedSize>0){const Y={array:d.array,offset:B,size:M.dcCompressedSize};j=new Uint16Array(fn(Y).buffer),B.value+=M.dcCompressedSize}if(M.rleRawSize>0){const Y=d.array.slice(B.value,B.value+M.rleCompressedSize),W=Yt(Y);J=as(W.buffer),B.value+=M.rleCompressedSize}let K=0;const Z=new Array(k.length);for(let Y=0;Y<Z.length;++Y)Z[Y]=new Array;for(let Y=0;Y<d.lines;++Y)for(let W=0;W<k.length;++W)Z[W].push(K),K+=k[W].width*d.type*2;Ki(F,Z,k,_,j,Q);for(let Y=0;Y<k.length;++Y){const W=k[Y];if(!W.decoded)switch(W.compression){case 2:let te=0,ue=0;for(let Be=0;Be<d.lines;++Be){let je=Z[Y][te];for(let me=0;me<W.width;++me){for(let Ae=0;Ae<2*W.type;++Ae)Q[je++]=J[ue+Ae*W.width*W.height];ue++}te++}break;case 1:default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(Q.buffer)}function Zt(d,m){const B=new Uint8Array(d);let Q=0;for(;B[m.value+Q]!=0;)Q+=1;const M=new TextDecoder().decode(B.slice(m.value,m.value+Q));return m.value=m.value+Q+1,M}function no(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 so(d,m){const B=Ke(d,m),Q=Ye(d,m);return[B,Q]}function io(d,m){const B=Ye(d,m),Q=Ye(d,m);return[B,Q]}function Ke(d,m){const B=d.getInt32(m.value,!0);return m.value=m.value+4,B}function Ye(d,m){const B=d.getUint32(m.value,!0);return m.value=m.value+4,B}function cs(d,m){const B=d[m.value];return m.value=m.value+1,B}function ut(d,m){const B=d.getUint8(m.value);return m.value=m.value+1,B}const He=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 _e(d,m){const B=d.getFloat32(m.value,!0);return m.value+=4,B}function oo(d,m){return a.DataUtils.toHalfFloat(_e(d,m))}function V(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 _t(d,m){const B=d.getUint16(m.value,!0);return m.value+=2,B}function ro(d,m){return V(_t(d,m))}function ao(d,m,B,Q){const M=B.value,T=[];for(;B.value<M+Q-1;){const L=Zt(m,B),P=Ke(d,B),k=ut(d,B);B.value+=3;const F=Ke(d,B),_=Ke(d,B);T.push({name:L,pixelType:P,pLinear:k,xSampling:F,ySampling:_})}return B.value+=1,T}function Ao(d,m){const B=_e(d,m),Q=_e(d,m),M=_e(d,m),T=_e(d,m),L=_e(d,m),P=_e(d,m),k=_e(d,m),F=_e(d,m);return{redX:B,redY:Q,greenX:M,greenY:T,blueX:L,blueY:P,whiteX:k,whiteY:F}}function co(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=ut(d,m);return B[Q]}function lo(d,m){const B=Ke(d,m),Q=Ke(d,m),M=Ke(d,m),T=Ke(d,m);return{xMin:B,yMin:Q,xMax:M,yMax:T}}function ho(d,m){const B=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],Q=ut(d,m);return B[Q]}function uo(d,m){const B=["ENVMAP_LATLONG","ENVMAP_CUBE"],Q=ut(d,m);return B[Q]}function go(d,m){const B=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],Q=["ROUND_DOWN","ROUND_UP"],M=Ye(d,m),T=Ye(d,m),L=ut(d,m);return{xSize:M,ySize:T,levelMode:B[L&15],roundingMode:Q[L>>4]}}function po(d,m){const B=_e(d,m),Q=_e(d,m);return[B,Q]}function fo(d,m){const B=_e(d,m),Q=_e(d,m),M=_e(d,m);return[B,Q,M]}function mo(d,m,B,Q,M){if(Q==="string"||Q==="stringvector"||Q==="iccProfile")return no(m,B,M);if(Q==="chlist")return ao(d,m,B,M);if(Q==="chromaticities")return Ao(d,B);if(Q==="compression")return co(d,B);if(Q==="box2i")return lo(d,B);if(Q==="envmap")return uo(d,B);if(Q==="tiledesc")return go(d,B);if(Q==="lineOrder")return ho(d,B);if(Q==="float")return _e(d,B);if(Q==="v2f")return po(d,B);if(Q==="v3f")return fo(d,B);if(Q==="int")return Ke(d,B);if(Q==="rational")return so(d,B);if(Q==="timecode")return io(d,B);if(Q==="preview")return B.value+=M,"skipped";B.value+=M}function Io(d,m){const B=Math.log2(d);return m=="ROUND_DOWN"?Math.floor(B):Math.ceil(B)}function bo(d,m,B){let Q=0;switch(d.levelMode){case"ONE_LEVEL":Q=1;break;case"MIPMAP_LEVELS":Q=Io(Math.max(m,B),d.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return Q}function ls(d,m,B,Q){const M=new Array(d);for(let T=0;T<d;T++){const L=1<<T;let P=m/L|0;Q=="ROUND_UP"&&P*L<m&&(P+=1);const k=Math.max(P,1);M[T]=(k+B-1)/B|0}return M}function Eo(){const d=this,m=d.offset,B={value:0};for(let Q=0;Q<d.tileCount;Q++){const M=Ke(d.viewer,m),T=Ke(d.viewer,m);m.value+=8,d.size=Ye(d.viewer,m);const L=M*d.blockWidth,P=T*d.blockHeight;d.columns=L+d.blockWidth>d.width?d.width-L:d.blockWidth,d.lines=P+d.blockHeight>d.height?d.height-P:d.blockHeight;const k=d.columns*d.totalBytes,_=d.size<d.lines*k?d.uncompress(d):pn(d);m.value+=d.size;for(let j=0;j<d.lines;j++){const J=j*d.columns*d.totalBytes;for(let K=0;K<d.inputChannels.length;K++){const Z=bt.channels[K].name,Y=d.channelByteOffsets[Z]*d.columns,W=d.decodeChannels[Z];if(W===void 0)continue;B.value=J+Y;const te=(d.height-(1+P+j))*d.outLineWidth;for(let ue=0;ue<d.columns;ue++){const Be=te+(ue+L)*d.outputChannels+W;d.byteArray[Be]=d.getter(_,B)}}}}}function Co(){const d=this,m=d.offset,B={value:0};for(let Q=0;Q<d.height/d.blockHeight;Q++){const M=Ke(d.viewer,m)-bt.dataWindow.yMin;d.size=Ye(d.viewer,m),d.lines=M+d.blockHeight>d.height?d.height-M:d.blockHeight;const T=d.columns*d.totalBytes,P=d.size<d.lines*T?d.uncompress(d):pn(d);m.value+=d.size;for(let k=0;k<d.blockHeight;k++){const F=Q*d.blockHeight,_=k+d.scanOrder(F);if(_>=d.height)continue;const j=k*T,J=(d.height-1-_)*d.outLineWidth;for(let K=0;K<d.inputChannels.length;K++){const Z=bt.channels[K].name,Y=d.channelByteOffsets[Z]*d.columns,W=d.decodeChannels[Z];if(W!==void 0){B.value=j+Y;for(let te=0;te<d.columns;te++){const ue=J+te*d.outputChannels+W;d.byteArray[ue]=d.getter(P,B)}}}}}}function Bo(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 M=d.getUint8(5);Q.spec={singleTile:!!(M&2),longName:!!(M&4),deepFormat:!!(M&8),multiPart:!!(M&16)},B.value=8;let T=!0;for(;T;){const L=Zt(m,B);if(L==0)T=!1;else{const P=Zt(m,B),k=Ye(d,B),F=mo(d,m,B,P,k);F===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${P}'.`):Q[L]=F}}if((M&-7)!=0)throw console.error("THREE.EXRHeader:",Q),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return Q}function yo(d,m,B,Q,M){const T={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:a.LinearSRGBColorSpace};switch(d.compression){case"NO_COMPRESSION":T.blockHeight=1,T.uncompress=pn;break;case"RLE_COMPRESSION":T.blockHeight=1,T.uncompress=$i;break;case"ZIPS_COMPRESSION":T.blockHeight=1,T.uncompress=fn;break;case"ZIP_COMPRESSION":T.blockHeight=16,T.uncompress=fn;break;case"PIZ_COMPRESSION":T.blockHeight=32,T.uncompress=eo;break;case"PXR24_COMPRESSION":T.blockHeight=16,T.uncompress=to;break;case"DWAA_COMPRESSION":T.blockHeight=32,T.uncompress=As;break;case"DWAB_COMPRESSION":T.blockHeight=256,T.uncompress=As;break;default:throw new Error("EXRLoader.parse: "+d.compression+" is unsupported")}const L={};for(const _ of d.channels)switch(_.name){case"Y":case"R":case"G":case"B":case"A":L[_.name]=!0,T.type=_.pixelType}let P=!1;if(L.R&&L.G&&L.B)P=!L.A,T.outputChannels=4,T.decodeChannels={R:0,G:1,B:2,A:3};else if(L.Y)T.outputChannels=1,T.decodeChannels={Y:0};else throw new Error("EXRLoader.parse: file contains unsupported data channels.");if(T.type==1)switch(M){case a.FloatType:T.getter=ro;break;case a.HalfFloatType:T.getter=_t;break}else if(T.type==2)switch(M){case a.FloatType:T.getter=_e;break;case a.HalfFloatType:T.getter=oo}else throw new Error("EXRLoader.parse: unsupported pixelType "+T.type+" for "+d.compression+".");T.columns=T.width;const k=T.width*T.height*T.outputChannels;switch(M){case a.FloatType:T.byteArray=new Float32Array(k),P&&T.byteArray.fill(1,0,k);break;case a.HalfFloatType:T.byteArray=new Uint16Array(k),P&&T.byteArray.fill(15360,0,k);break;default:console.error("THREE.EXRLoader: unsupported type: ",M);break}let F=0;for(const _ of d.channels)T.decodeChannels[_.name]!==void 0&&(T.channelByteOffsets[_.name]=F),F+=_.pixelType*2;if(T.totalBytes=F,T.outLineWidth=T.width*T.outputChannels,d.lineOrder==="INCREASING_Y"?T.scanOrder=_=>_:T.scanOrder=_=>T.height-1-_,T.outputChannels==4?(T.format=a.RGBAFormat,T.colorSpace=a.LinearSRGBColorSpace):(T.format=a.RedFormat,T.colorSpace=a.NoColorSpace),d.spec.singleTile){T.blockHeight=d.tiles.ySize,T.blockWidth=d.tiles.xSize;const _=bo(d.tiles,T.width,T.height),j=ls(_,T.width,d.tiles.xSize,d.tiles.roundingMode),J=ls(_,T.height,d.tiles.ySize,d.tiles.roundingMode);T.tileCount=j[0]*J[0];for(let K=0;K<_;K++)for(let Z=0;Z<J[K];Z++)for(let Y=0;Y<j[K];Y++)He(m,Q);T.decode=Eo.bind(T)}else{T.blockWidth=T.width;const _=Math.ceil(T.height/T.blockHeight);for(let j=0;j<_;j++)He(m,Q);T.decode=Co.bind(T)}return T}const hs={value:0},us=new DataView(e),wo=new Uint8Array(e),bt=Bo(us,e,hs),Tt=yo(bt,us,wo,hs,this.type);return Tt.decode(),{header:bt,width:Tt.width,height:Tt.height,data:Tt.byteArray,format:Tt.format,colorSpace:Tt.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,s,n){function i(o,r){o.colorSpace=r.colorSpace,o.minFilter=a.LinearFilter,o.magFilter=a.LinearFilter,o.generateMipmaps=!1,o.flipY=!1,t&&t(o,r)}return super.load(e,i,s,n)}}const ta=Object.freeze(Object.defineProperty({__proto__:null,EXRLoader:Li},Symbol.toStringTag,{value:"Module"}));class ki extends a.DataTextureLoader{constructor(e){super(e),this.type=a.HalfFloatType}parse(e){const o=function(S,v){switch(S){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(v||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(v||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(v||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(v||""))}},u=function(S,v,N){v=v||1024;let O=S.pos,X=-1,U=0,q="",H=String.fromCharCode.apply(null,new Uint16Array(S.subarray(O,O+128)));for(;0>(X=H.indexOf(`
|
|
42
|
+
`))&&U<v&&O<S.byteLength;)q+=H,U+=H.length,O+=128,H+=String.fromCharCode.apply(null,new Uint16Array(S.subarray(O,O+128)));return-1<X?(S.pos+=U+X+1,q+H.slice(0,X)):!1},g=function(S){const v=/^#\?(\S+)/,N=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,G=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,O=/^\s*FORMAT=(\S+)\s*$/,X=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,U={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let q,H;for((S.pos>=S.byteLength||!(q=u(S)))&&o(1,"no header found"),(H=q.match(v))||o(3,"bad initial token"),U.valid|=1,U.programtype=H[1],U.string+=q+`
|
|
43
43
|
`;q=u(S),q!==!1;){if(U.string+=q+`
|
|
44
44
|
`,q.charAt(0)==="#"){U.comments+=q+`
|
|
45
45
|
`;continue}if((H=q.match(N))&&(U.gamma=parseFloat(H[1])),(H=q.match(G))&&(U.exposure=parseFloat(H[1])),(H=q.match(O))&&(U.valid|=2,U.format=H[1]),(H=q.match(X))&&(U.valid|=4,U.height=parseInt(H[1],10),U.width=parseInt(H[2],10)),U.valid&2&&U.valid&4)break}return U.valid&2||o(3,"missing format specifier"),U.valid&4||o(3,"missing image size specifier"),U},p=function(S,v,N){const G=v;if(G<8||G>32767||S[0]!==2||S[1]!==2||S[2]&128)return new Uint8Array(S);G!==(S[2]<<8|S[3])&&o(3,"wrong scanline width");const O=new Uint8Array(4*v*N);O.length||o(4,"unable to allocate buffer space");let X=0,U=0;const q=4*G,H=new Uint8Array(4),z=new Uint8Array(q);let $=N;for(;$>0&&U<S.byteLength;){U+4>S.byteLength&&o(1),H[0]=S[U++],H[1]=S[U++],H[2]=S[U++],H[3]=S[U++],(H[0]!=2||H[1]!=2||(H[2]<<8|H[3])!=G)&&o(3,"bad rgbe scanline format");let ee=0,se;for(;ee<q&&U<S.byteLength;){se=S[U++];const re=se>128;if(re&&(se-=128),(se===0||ee+se>q)&&o(3,"bad scanline data"),re){const le=S[U++];for(let Ce=0;Ce<se;Ce++)z[ee++]=le}else z.set(S.subarray(U,U+se),ee),ee+=se,U+=se}const ce=G;for(let re=0;re<ce;re++){let le=0;O[X]=z[re+le],le+=G,O[X+1]=z[re+le],le+=G,O[X+2]=z[re+le],le+=G,O[X+3]=z[re+le],X+=4}$--}return O},f=function(S,v,N,G){const O=S[v+3],X=Math.pow(2,O-128)/255;N[G+0]=S[v+0]*X,N[G+1]=S[v+1]*X,N[G+2]=S[v+2]*X,N[G+3]=1},I=function(S,v,N,G){const O=S[v+3],X=Math.pow(2,O-128)/255;N[G+0]=a.DataUtils.toHalfFloat(Math.min(S[v+0]*X,65504)),N[G+1]=a.DataUtils.toHalfFloat(Math.min(S[v+1]*X,65504)),N[G+2]=a.DataUtils.toHalfFloat(Math.min(S[v+2]*X,65504)),N[G+3]=a.DataUtils.toHalfFloat(1)},b=new Uint8Array(e);b.pos=0;const E=g(b),y=E.width,C=E.height,w=p(b.subarray(b.pos),y,C);let x,R,D;switch(this.type){case a.FloatType:D=w.length/4;const S=new Float32Array(D*4);for(let N=0;N<D;N++)f(w,N*4,S,N*4);x=S,R=a.FloatType;break;case a.HalfFloatType:D=w.length/4;const v=new Uint16Array(D*4);for(let N=0;N<D;N++)I(w,N*4,v,N*4);x=v,R=a.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:y,height:C,data:x,header:E.string,gamma:E.gamma,exposure:E.exposure,type:R}}setDataType(e){return this.type=e,this}load(e,t,s,n){function i(o,r){switch(o.type){case a.FloatType:case a.HalfFloatType:o.colorSpace=a.LinearSRGBColorSpace,o.minFilter=a.LinearFilter,o.magFilter=a.LinearFilter,o.generateMipmaps=!1,o.flipY=!0;break}t&&t(o,r)}return super.load(e,i,s,n)}}const na=Object.freeze(Object.defineProperty({__proto__:null,RGBELoader:ki},Symbol.toStringTag,{value:"Module"}));function Ni(c,e,t){const s=t.length-c-1;if(e>=t[s])return s-1;if(e<=t[c])return c;let n=c,i=s,o=Math.floor((n+i)/2);for(;e<t[o]||e>=t[o+1];)e<t[o]?i=o:n=o,o=Math.floor((n+i)/2);return o}function sa(c,e,t,s){const n=[],i=[],o=[];n[0]=1;for(let r=1;r<=t;++r){i[r]=e-s[c+1-r],o[r]=s[c+r]-e;let A=0;for(let l=0;l<r;++l){const h=o[l+1],u=i[r-l],g=n[l]/(h+u);n[l]=A+h*g,A=u*g}n[r]=A}return n}function ia(c,e,t,s){const n=Ni(c,s,e),i=sa(n,s,c,e),o=new a.Vector4(0,0,0,0);for(let r=0;r<=c;++r){const A=t[n-c+r],l=i[r],h=A.w*l;o.x+=A.x*h,o.y+=A.y*h,o.z+=A.z*h,o.w+=A.w*l}return o}function oa(c,e,t,s,n){const i=[];for(let u=0;u<=t;++u)i[u]=0;const o=[];for(let u=0;u<=s;++u)o[u]=i.slice(0);const r=[];for(let u=0;u<=t;++u)r[u]=i.slice(0);r[0][0]=1;const A=i.slice(0),l=i.slice(0);for(let u=1;u<=t;++u){A[u]=e-n[c+1-u],l[u]=n[c+u]-e;let g=0;for(let p=0;p<u;++p){const f=l[p+1],I=A[u-p];r[u][p]=f+I;const b=r[p][u-1]/r[u][p];r[p][u]=g+f*b,g=I*b}r[u][u]=g}for(let u=0;u<=t;++u)o[0][u]=r[u][t];for(let u=0;u<=t;++u){let g=0,p=1;const f=[];for(let I=0;I<=t;++I)f[I]=i.slice(0);f[0][0]=1;for(let I=1;I<=s;++I){let b=0;const E=u-I,y=t-I;u>=I&&(f[p][0]=f[g][0]/r[y+1][E],b=f[p][0]*r[E][y]);const C=E>=-1?1:-E,w=u-1<=y?I-1:t-u;for(let R=C;R<=w;++R)f[p][R]=(f[g][R]-f[g][R-1])/r[y+1][E+R],b+=f[p][R]*r[E+R][y];u<=y&&(f[p][I]=-f[g][I-1]/r[y+1][u],b+=f[p][I]*r[u][y]),o[I][u]=b;const x=g;g=p,p=x}}let h=t;for(let u=1;u<=s;++u){for(let g=0;g<=t;++g)o[u][g]*=h;h*=t-u}return o}function ra(c,e,t,s,n){const i=n<c?n:c,o=[],r=Ni(c,s,e),A=oa(r,s,c,i,e),l=[];for(let h=0;h<t.length;++h){const u=t[h].clone(),g=u.w;u.x*=g,u.y*=g,u.z*=g,l[h]=u}for(let h=0;h<=i;++h){const u=l[r-c].clone().multiplyScalar(A[h][0]);for(let g=1;g<=c;++g)u.add(l[r-c+g].clone().multiplyScalar(A[h][g]));o[h]=u}for(let h=i+1;h<=n+1;++h)o[h]=new a.Vector4(0,0,0);return o}function aa(c,e){let t=1;for(let n=2;n<=c;++n)t*=n;let s=1;for(let n=2;n<=e;++n)s*=n;for(let n=2;n<=c-e;++n)s*=n;return t/s}function Aa(c){const e=c.length,t=[],s=[];for(let i=0;i<e;++i){const o=c[i];t[i]=new a.Vector3(o.x,o.y,o.z),s[i]=o.w}const n=[];for(let i=0;i<e;++i){const o=t[i].clone();for(let r=1;r<=i;++r)o.sub(n[i-r].clone().multiplyScalar(aa(i,r)*s[r]));n[i]=o.divideScalar(s[0])}return n}function ca(c,e,t,s,n){const i=ra(c,e,t,s,n);return Aa(i)}class la extends a.Curve{constructor(e,t,s,n,i){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=n||0,this.endKnot=i||this.knots.length-1;for(let o=0;o<s.length;++o){const r=s[o];this.controlPoints[o]=new a.Vector4(r.x,r.y,r.z,r.w)}}getPoint(e,t=new a.Vector3){const s=t,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=ia(this.degree,this.knots,this.controlPoints,n);return i.w!==1&&i.divideScalar(i.w),s.set(i.x,i.y,i.z)}getTangent(e,t=new a.Vector3){const s=t,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=ca(this.degree,this.knots,this.controlPoints,n,1);return s.copy(i[1]).normalize(),s}}let ne,we,ke;class ha extends a.Loader{constructor(e){super(e)}load(e,t,s,n){const i=this,o=i.path===""?a.LoaderUtils.extractUrlBase(e):i.path,r=new a.FileLoader(this.manager);r.setPath(i.path),r.setResponseType("arraybuffer"),r.setRequestHeader(i.requestHeader),r.setWithCredentials(i.withCredentials),r.load(e,function(A){try{t(i.parse(A,o))}catch(l){n?n(l):console.error(l),i.manager.itemError(e)}},s,n)}parse(e,t){if(ma(e))ne=new fa().parse(e);else{const n=Pi(e);if(!Ia(n))throw new Error("THREE.FBXLoader: Unknown format.");if(ks(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+ks(n));ne=new pa().parse(n)}const s=new a.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new ua(s,this.manager).parse(ne)}getFbxTree(){return ne}}class ua{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){we=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),s=this.parseMaterials(t),n=this.parseDeformers(),i=new da().parse(n);return this.parseScene(n,i,s),ke}parseConnections(){const e=new Map;return"Connections"in ne&&ne.Connections.connections.forEach(function(s){const n=s[0],i=s[1],o=s[2];e.has(n)||e.set(n,{parents:[],children:[]});const r={ID:i,relationship:o};e.get(n).parents.push(r),e.has(i)||e.set(i,{parents:[],children:[]});const A={ID:n,relationship:o};e.get(i).children.push(A)}),e}parseImages(){const e={},t={};if("Video"in ne.Objects){const s=ne.Objects.Video;for(const n in s){const i=s[n],o=parseInt(n);if(e[o]=i.RelativeFilename||i.Filename,"Content"in i){const r=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,A=typeof i.Content=="string"&&i.Content!=="";if(r||A){const l=this.parseImage(s[n]);t[i.RelativeFilename||i.Filename]=l}}}}for(const s in e){const n=e[s];t[n]!==void 0?e[s]=t[n]:e[s]=e[s].split("\\").pop()}return e}parseImage(e){const t=e.Content,s=e.RelativeFilename||e.Filename,n=s.slice(s.lastIndexOf(".")+1).toLowerCase();let i;switch(n){case"bmp":i="image/bmp";break;case"jpg":case"jpeg":i="image/jpeg";break;case"png":i="image/png";break;case"tif":i="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",s),i="image/tga";break;default:console.warn('FBXLoader: Image type "'+n+'" is not supported.');return}if(typeof t=="string")return"data:"+i+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:i}))}}parseTextures(e){const t=new Map;if("Texture"in ne.Objects){const s=ne.Objects.Texture;for(const n in s){const i=this.parseTexture(s[n],e);t.set(parseInt(n),i)}}return t}parseTexture(e,t){const s=this.loadTexture(e,t);s.ID=e.id,s.name=e.attrName;const n=e.WrapModeU,i=e.WrapModeV,o=n!==void 0?n.value:0,r=i!==void 0?i.value:0;if(s.wrapS=o===0?a.RepeatWrapping:a.ClampToEdgeWrapping,s.wrapT=r===0?a.RepeatWrapping:a.ClampToEdgeWrapping,"Scaling"in e){const A=e.Scaling.value;s.repeat.x=A[0],s.repeat.y=A[1]}if("Translation"in e){const A=e.Translation.value;s.offset.x=A[0],s.offset.y=A[1]}return s}loadTexture(e,t){const s=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),n=e.FileName.split(".").pop().toLowerCase(),i=s.has(n)?this.manager.getHandler(`.${n}`):this.textureLoader;if(!i)return console.warn(`FBXLoader: ${n.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new a.Texture;const o=i.path;o||i.setPath(this.textureLoader.path);const r=we.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 l=i.load(A);return i.setPath(o),l}parseMaterials(e){const t=new Map;if("Material"in ne.Objects){const s=ne.Objects.Material;for(const n in s){const i=this.parseMaterial(s[n],e);i!==null&&t.set(parseInt(n),i)}}return t}parseMaterial(e,t){const s=e.id,n=e.attrName;let i=e.ShadingModel;if(typeof i=="object"&&(i=i.value),!we.has(s))return null;const o=this.parseParameters(e,t,s);let r;switch(i.toLowerCase()){case"phong":r=new a.MeshPhongMaterial;break;case"lambert":r=new a.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),r=new a.MeshPhongMaterial;break}return r.setValues(o),r.name=n,r}parseParameters(e,t,s){const n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=a.ColorManagement.toWorkingColorSpace(new a.Color().fromArray(e.Diffuse.value),a.SRGBColorSpace):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=a.ColorManagement.toWorkingColorSpace(new a.Color().fromArray(e.DiffuseColor.value),a.SRGBColorSpace)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=a.ColorManagement.toWorkingColorSpace(new a.Color().fromArray(e.Emissive.value),a.SRGBColorSpace):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=a.ColorManagement.toWorkingColorSpace(new a.Color().fromArray(e.EmissiveColor.value),a.SRGBColorSpace)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=a.ColorManagement.toWorkingColorSpace(new a.Color().fromArray(e.Specular.value),a.SRGBColorSpace):e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=a.ColorManagement.toWorkingColorSpace(new a.Color().fromArray(e.SpecularColor.value),a.SRGBColorSpace));const i=this;return we.get(s).children.forEach(function(o){const r=o.relationship;switch(r){case"Bump":n.bumpMap=i.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":n.aoMap=i.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=i.getTexture(t,o.ID),n.map!==void 0&&(n.map.colorSpace=a.SRGBColorSpace);break;case"DisplacementColor":n.displacementMap=i.getTexture(t,o.ID);break;case"EmissiveColor":n.emissiveMap=i.getTexture(t,o.ID),n.emissiveMap!==void 0&&(n.emissiveMap.colorSpace=a.SRGBColorSpace);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=i.getTexture(t,o.ID);break;case"ReflectionColor":n.envMap=i.getTexture(t,o.ID),n.envMap!==void 0&&(n.envMap.mapping=a.EquirectangularReflectionMapping,n.envMap.colorSpace=a.SRGBColorSpace);break;case"SpecularColor":n.specularMap=i.getTexture(t,o.ID),n.specularMap!==void 0&&(n.specularMap.colorSpace=a.SRGBColorSpace);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=i.getTexture(t,o.ID),n.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r);break}}),n}getTexture(e,t){return"LayeredTexture"in 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=we.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in ne.Objects){const s=ne.Objects.Deformer;for(const n in s){const i=s[n],o=we.get(parseInt(n));if(i.attrType==="Skin"){const r=this.parseSkeleton(o,s);r.ID=n,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),r.geometryID=o.parents[0].ID,e[n]=r}else if(i.attrType==="BlendShape"){const r={id:n};r.rawTargets=this.parseMorphTargets(o,s),r.id=n,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=r}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const s=[];return e.children.forEach(function(n){const i=t[n.ID];if(i.attrType!=="Cluster")return;const o={ID:n.ID,indices:[],weights:[],transformLink:new a.Matrix4().fromArray(i.TransformLink.a)};"Indexes"in i&&(o.indices=i.Indexes.a,o.weights=i.Weights.a),s.push(o)}),{rawBones:s,bones:[]}}parseMorphTargets(e,t){const s=[];for(let n=0;n<e.children.length;n++){const i=e.children[n],o=t[i.ID],r={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;r.geoID=we.get(parseInt(i.ID)).children.filter(function(A){return A.relationship===void 0})[0].ID,s.push(r)}return s}parseScene(e,t,s){ke=new a.Group;const n=this.parseModels(e.skeletons,t,s),i=ne.Objects.Model,o=this;n.forEach(function(A){var u;const l=i[A.ID];o.setLookAtProperties(A,l);const h=(u=we.get(A.ID))==null?void 0:u.parents;h==null||h.forEach(function(g){const p=n.get(g.ID);p!==void 0&&p.add(A)}),A.parent===null&&ke.add(A)}),this.bindSkeleton(e.skeletons,t,n),this.addGlobalSceneSettings(),ke.traverse(function(A){if(A.userData.transformData){A.parent&&(A.userData.transformData.parentMatrix=A.parent.matrix,A.userData.transformData.parentMatrixWorld=A.parent.matrixWorld);const l=Ui(A.userData.transformData);A.applyMatrix4(l),A.updateWorldMatrix()}A.isSkinnedMesh&&(A.computeBoundingBox(),A.computeBoundingSphere(),A.boundingBox.expandByScalar(3),A.boundingSphere.radius*=3)});const r=new ga().parse();ke.children.length===1&&ke.children[0].isGroup&&(ke.children[0].animations=r,ke=ke.children[0]),ke.animations=r}parseModels(e,t,s){const n=new Map,i=ne.Objects.Model;for(const o in i){const r=parseInt(o),A=i[o],l=we.get(r);let h=this.buildSkeleton(l,e,r,A.attrName);if(!h){switch(A.attrType){case"Camera":h=this.createCamera(l);break;case"Light":h=this.createLight(l);break;case"Mesh":h=this.createMesh(l,t,s);break;case"NurbsCurve":h=this.createCurve(l,t);break;case"LimbNode":case"Root":h=new a.Bone;break;case"Null":default:h=new a.Group;break}h.name=A.attrName?a.PropertyBinding.sanitizeNodeName(A.attrName):"",h.userData.originalName=A.attrName,h.ID=r}this.getTransformData(h,A),n.set(r,h)}return n}buildSkeleton(e,t,s,n){let i=null;return e==null||e.parents.forEach(function(o){for(const r in t){const A=t[r];A.rawBones.forEach(function(l,h){if(l.ID===o.ID){const u=i;i=new a.Bone,i.matrixWorld.copy(l.transformLink),i.name=n?a.PropertyBinding.sanitizeNodeName(n):"",i.userData.originalName=n,i.ID=s,A.bones[h]=i,u!==null&&i.add(u)}})}}),i}createCamera(e){let t,s;if(e.children.forEach(function(n){const i=ne.Objects.NodeAttribute[n.ID];i!==void 0&&(s=i)}),s===void 0)t=new a.Object3D;else{let n=0;s.CameraProjectionType!==void 0&&s.CameraProjectionType.value===1&&(n=1);let i=1;s.NearPlane!==void 0&&(i=s.NearPlane.value/1e3);let o=1e3;s.FarPlane!==void 0&&(o=s.FarPlane.value/1e3);let r=window.innerWidth,A=window.innerHeight;s.AspectWidth!==void 0&&s.AspectHeight!==void 0&&(r=s.AspectWidth.value,A=s.AspectHeight.value);const l=r/A;let h=45;s.FieldOfView!==void 0&&(h=s.FieldOfView.value);const u=s.FocalLength?s.FocalLength.value:null;switch(n){case 0:t=new a.PerspectiveCamera(h,l,i,o),u!==null&&t.setFocalLength(u);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),t=new a.Object3D;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new a.Object3D;break}}return t}createLight(e){let t,s;if(e.children.forEach(function(n){const i=ne.Objects.NodeAttribute[n.ID];i!==void 0&&(s=i)}),s===void 0)t=new a.Object3D;else{let n;s.LightType===void 0?n=0:n=s.LightType.value;let i=16777215;s.Color!==void 0&&(i=a.ColorManagement.toWorkingColorSpace(new a.Color().fromArray(s.Color.value),a.SRGBColorSpace));let o=s.Intensity===void 0?1:s.Intensity.value/100;s.CastLightOnObject!==void 0&&s.CastLightOnObject.value===0&&(o=0);let r=0;s.FarAttenuationEnd!==void 0&&(s.EnableFarAttenuation!==void 0&&s.EnableFarAttenuation.value===0?r=0:r=s.FarAttenuationEnd.value);const A=1;switch(n){case 0:t=new a.PointLight(i,o,r,A);break;case 1:t=new a.DirectionalLight(i,o);break;case 2:let l=Math.PI/3;s.InnerAngle!==void 0&&(l=a.MathUtils.degToRad(s.InnerAngle.value));let h=0;s.OuterAngle!==void 0&&(h=a.MathUtils.degToRad(s.OuterAngle.value),h=Math.max(h,1)),t=new a.SpotLight(i,o,r,l,h,A);break;default:console.warn("THREE.FBXLoader: Unknown light type "+s.LightType.value+", defaulting to a PointLight."),t=new a.PointLight(i,o);break}s.CastShadows!==void 0&&s.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,s){let n,i=null,o=null;const r=[];if(e.children.forEach(function(A){t.has(A.ID)&&(i=t.get(A.ID)),s.has(A.ID)&&r.push(s.get(A.ID))}),r.length>1?o=r:r.length>0?o=r[0]:(o=new a.MeshPhongMaterial({name:a.Loader.DEFAULT_MATERIAL_NAME,color:13421772}),r.push(o)),"color"in i.attributes&&r.forEach(function(A){A.vertexColors=!0}),i.groups.length>0){let A=!1;for(let l=0,h=i.groups.length;l<h;l++){const u=i.groups[l];(u.materialIndex<0||u.materialIndex>=r.length)&&(u.materialIndex=r.length,A=!0)}if(A){const l=new a.MeshStandardMaterial;r.push(l)}}return i.FBX_Deformer?(n=new a.SkinnedMesh(i,o),n.normalizeSkinWeights()):n=new a.Mesh(i,o),n}createCurve(e,t){const s=e.children.reduce(function(i,o){return t.has(o.ID)&&(i=t.get(o.ID)),i},null),n=new a.LineBasicMaterial({name:a.Loader.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new a.Line(s,n)}getTransformData(e,t){const s={};"InheritType"in t&&(s.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?s.eulerOrder=Xt(t.RotationOrder.value):s.eulerOrder=Xt(0),"Lcl_Translation"in t&&(s.translation=t.Lcl_Translation.value),"PreRotation"in t&&(s.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(s.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(s.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(s.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(s.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(s.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(s.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(s.rotationPivot=t.RotationPivot.value),e.userData.transformData=s}setLookAtProperties(e,t){"LookAtProperty"in t&&we.get(e.ID).children.forEach(function(n){if(n.relationship==="LookAtProperty"){const i=ne.Objects.Model[n.ID];if("Lcl_Translation"in i){const o=i.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),ke.add(e.target)):e.lookAt(new a.Vector3().fromArray(o))}}})}bindSkeleton(e,t,s){const n=this.parsePoseNodes();for(const i in e){const o=e[i];we.get(parseInt(o.ID)).parents.forEach(function(A){if(t.has(A.ID)){const l=A.ID;we.get(l).parents.forEach(function(u){s.has(u.ID)&&s.get(u.ID).bind(new a.Skeleton(o.bones),n[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in ne.Objects){const t=ne.Objects.Pose;for(const s in t)if(t[s].attrType==="BindPose"&&t[s].NbPoseNodes>0){const n=t[s].PoseNode;Array.isArray(n)?n.forEach(function(i){e[i.Node]=new a.Matrix4().fromArray(i.Matrix.a)}):e[n.Node]=new a.Matrix4().fromArray(n.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in ne){if("AmbientColor"in ne.GlobalSettings){const e=ne.GlobalSettings.AmbientColor.value,t=e[0],s=e[1],n=e[2];if(t!==0||s!==0||n!==0){const i=new a.Color().setRGB(t,s,n,a.SRGBColorSpace);ke.add(new a.AmbientLight(i,1))}}"UnitScaleFactor"in ne.GlobalSettings&&(ke.userData.unitScaleFactor=ne.GlobalSettings.UnitScaleFactor.value)}}}class da{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in ne.Objects){const s=ne.Objects.Geometry;for(const n in s){const i=we.get(parseInt(n)),o=this.parseGeometry(i,s[n],e);t.set(parseInt(n),o)}}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,s){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,s);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,s){const n=s.skeletons,i=[],o=e.parents.map(function(u){return ne.Objects.Model[u.ID]});if(o.length===0)return;const r=e.children.reduce(function(u,g){return n[g.ID]!==void 0&&(u=n[g.ID]),u},null);e.children.forEach(function(u){s.morphTargets[u.ID]!==void 0&&i.push(s.morphTargets[u.ID])});const A=o[0],l={};"RotationOrder"in A&&(l.eulerOrder=Xt(A.RotationOrder.value)),"InheritType"in A&&(l.inheritType=parseInt(A.InheritType.value)),"GeometricTranslation"in A&&(l.translation=A.GeometricTranslation.value),"GeometricRotation"in A&&(l.rotation=A.GeometricRotation.value),"GeometricScaling"in A&&(l.scale=A.GeometricScaling.value);const h=Ui(l);return this.genGeometry(t,r,i,h)}genGeometry(e,t,s,n){const i=new a.BufferGeometry;e.attrName&&(i.name=e.attrName);const o=this.parseGeoNode(e,t),r=this.genBuffers(o),A=new a.Float32BufferAttribute(r.vertex,3);if(A.applyMatrix4(n),i.setAttribute("position",A),r.colors.length>0&&i.setAttribute("color",new a.Float32BufferAttribute(r.colors,3)),t&&(i.setAttribute("skinIndex",new a.Uint16BufferAttribute(r.weightsIndices,4)),i.setAttribute("skinWeight",new a.Float32BufferAttribute(r.vertexWeights,4)),i.FBX_Deformer=t),r.normal.length>0){const l=new a.Matrix3().getNormalMatrix(n),h=new a.Float32BufferAttribute(r.normal,3);h.applyNormalMatrix(l),i.setAttribute("normal",h)}if(r.uvs.forEach(function(l,h){const u=h===0?"uv":`uv${h}`;i.setAttribute(u,new a.Float32BufferAttribute(r.uvs[h],2))}),o.material&&o.material.mappingType!=="AllSame"){let l=r.materialIndex[0],h=0;if(r.materialIndex.forEach(function(u,g){u!==l&&(i.addGroup(h,g-h,l),l=u,h=g)}),i.groups.length>0){const u=i.groups[i.groups.length-1],g=u.start+u.count;g!==r.materialIndex.length&&i.addGroup(g,r.materialIndex.length-g,l)}i.groups.length===0&&i.addGroup(0,r.materialIndex.length,r.materialIndex[0])}return this.addMorphTargets(i,e,s,n),i}parseGeoNode(e,t){const s={};if(s.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],s.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(s.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(s.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(s.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){s.uv=[];let n=0;for(;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&s.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return s.weightTable={},t!==null&&(s.skeleton=t,t.rawBones.forEach(function(n,i){n.indices.forEach(function(o,r){s.weightTable[o]===void 0&&(s.weightTable[o]=[]),s.weightTable[o].push({id:i,weight:n.weights[r]})})})),s}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let s=0,n=0,i=!1,o=[],r=[],A=[],l=[],h=[],u=[];const g=this;return e.vertexIndices.forEach(function(p,f){let I,b=!1;p<0&&(p=p^-1,b=!0);let E=[],y=[];if(o.push(p*3,p*3+1,p*3+2),e.color){const C=sn(f,s,p,e.color);A.push(C[0],C[1],C[2])}if(e.skeleton){if(e.weightTable[p]!==void 0&&e.weightTable[p].forEach(function(C){y.push(C.weight),E.push(C.id)}),y.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);const C=[0,0,0,0],w=[0,0,0,0];y.forEach(function(x,R){let D=x,S=E[R];w.forEach(function(v,N,G){if(D>v){G[N]=D,D=v;const O=C[N];C[N]=S,S=O}})}),E=C,y=w}for(;y.length<4;)y.push(0),E.push(0);for(let C=0;C<4;++C)h.push(y[C]),u.push(E[C])}if(e.normal){const C=sn(f,s,p,e.normal);r.push(C[0],C[1],C[2])}e.material&&e.material.mappingType!=="AllSame"&&(I=sn(f,s,p,e.material)[0],I<0&&(g.negativeMaterialIndices=!0,I=0)),e.uv&&e.uv.forEach(function(C,w){const x=sn(f,s,p,C);l[w]===void 0&&(l[w]=[]),l[w].push(x[0]),l[w].push(x[1])}),n++,b&&(g.genFace(t,e,o,I,r,A,l,h,u,n),s++,n=0,o=[],r=[],A=[],l=[],h=[],u=[])}),t}getNormalNewell(e){const t=new a.Vector3(0,0,0);for(let s=0;s<e.length;s++){const n=e[s],i=e[(s+1)%e.length];t.x+=(n.y-i.y)*(n.z+i.z),t.y+=(n.z-i.z)*(n.x+i.x),t.z+=(n.x-i.x)*(n.y+i.y)}return t.normalize(),t}getNormalTangentAndBitangent(e){const t=this.getNormalNewell(e),n=(Math.abs(t.z)>.5?new a.Vector3(0,1,0):new a.Vector3(0,0,1)).cross(t).normalize(),i=t.clone().cross(n).normalize();return{normal:t,tangent:n,bitangent:i}}flattenVertex(e,t,s){return new a.Vector2(e.dot(t),e.dot(s))}genFace(e,t,s,n,i,o,r,A,l,h){let u;if(h>3){const g=[],p=t.baseVertexPositions||t.vertexPositions;for(let E=0;E<s.length;E+=3)g.push(new a.Vector3(p[s[E]],p[s[E+1]],p[s[E+2]]));const{tangent:f,bitangent:I}=this.getNormalTangentAndBitangent(g),b=[];for(const E of g)b.push(this.flattenVertex(E,f,I));u=a.ShapeUtils.triangulateShape(b,[])}else u=[[0,1,2]];for(const[g,p,f]of u)e.vertex.push(t.vertexPositions[s[g*3]]),e.vertex.push(t.vertexPositions[s[g*3+1]]),e.vertex.push(t.vertexPositions[s[g*3+2]]),e.vertex.push(t.vertexPositions[s[p*3]]),e.vertex.push(t.vertexPositions[s[p*3+1]]),e.vertex.push(t.vertexPositions[s[p*3+2]]),e.vertex.push(t.vertexPositions[s[f*3]]),e.vertex.push(t.vertexPositions[s[f*3+1]]),e.vertex.push(t.vertexPositions[s[f*3+2]]),t.skeleton&&(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[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[f*4]),e.vertexWeights.push(A[f*4+1]),e.vertexWeights.push(A[f*4+2]),e.vertexWeights.push(A[f*4+3]),e.weightsIndices.push(l[g*4]),e.weightsIndices.push(l[g*4+1]),e.weightsIndices.push(l[g*4+2]),e.weightsIndices.push(l[g*4+3]),e.weightsIndices.push(l[p*4]),e.weightsIndices.push(l[p*4+1]),e.weightsIndices.push(l[p*4+2]),e.weightsIndices.push(l[p*4+3]),e.weightsIndices.push(l[f*4]),e.weightsIndices.push(l[f*4+1]),e.weightsIndices.push(l[f*4+2]),e.weightsIndices.push(l[f*4+3])),t.color&&(e.colors.push(o[g*3]),e.colors.push(o[g*3+1]),e.colors.push(o[g*3+2]),e.colors.push(o[p*3]),e.colors.push(o[p*3+1]),e.colors.push(o[p*3+2]),e.colors.push(o[f*3]),e.colors.push(o[f*3+1]),e.colors.push(o[f*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(i[g*3]),e.normal.push(i[g*3+1]),e.normal.push(i[g*3+2]),e.normal.push(i[p*3]),e.normal.push(i[p*3+1]),e.normal.push(i[p*3+2]),e.normal.push(i[f*3]),e.normal.push(i[f*3+1]),e.normal.push(i[f*3+2])),t.uv&&t.uv.forEach(function(I,b){e.uvs[b]===void 0&&(e.uvs[b]=[]),e.uvs[b].push(r[b][g*2]),e.uvs[b].push(r[b][g*2+1]),e.uvs[b].push(r[b][p*2]),e.uvs[b].push(r[b][p*2+1]),e.uvs[b].push(r[b][f*2]),e.uvs[b].push(r[b][f*2+1])})}addMorphTargets(e,t,s,n){if(s.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const i=this;s.forEach(function(o){o.rawTargets.forEach(function(r){const A=ne.Objects.Geometry[r.geoID];A!==void 0&&i.genMorphGeometry(e,t,A,n,r.name)})})}genMorphGeometry(e,t,s,n,i){const o=t.Vertices!==void 0?t.Vertices.a:[],r=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],A=s.Vertices!==void 0?s.Vertices.a:[],l=s.Indexes!==void 0?s.Indexes.a:[],h=e.attributes.position.count*3,u=new Float32Array(h);for(let I=0;I<l.length;I++){const b=l[I]*3;u[b]=A[I*3],u[b+1]=A[I*3+1],u[b+2]=A[I*3+2]}const g={vertexIndices:r,vertexPositions:u,baseVertexPositions:o},p=this.genBuffers(g),f=new a.Float32BufferAttribute(p.vertex,3);f.name=i||s.attrName,f.applyMatrix4(n),e.morphAttributes.position.push(f)}parseNormals(e){const t=e.MappingInformationType,s=e.ReferenceInformationType,n=e.Normals.a;let i=[];return s==="IndexToDirect"&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:t,referenceType:s}}parseUVs(e){const t=e.MappingInformationType,s=e.ReferenceInformationType,n=e.UV.a;let i=[];return s==="IndexToDirect"&&(i=e.UVIndex.a),{dataSize:2,buffer:n,indices:i,mappingType:t,referenceType:s}}parseVertexColors(e){if(!e.Colors)return;const t=e.MappingInformationType,s=e.ReferenceInformationType,n=e.Colors.a;let i=[];s==="IndexToDirect"&&(i=e.ColorIndex.a);for(let o=0,r=new a.Color;o<n.length;o+=4)r.fromArray(n,o),a.ColorManagement.toWorkingColorSpace(r,a.SRGBColorSpace),r.toArray(n,o);return{dataSize:4,buffer:n,indices:i,mappingType:t,referenceType:s}}parseMaterialIndices(e){const t=e.MappingInformationType,s=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:s};const n=e.Materials.a,i=[];for(let o=0;o<n.length;++o)i.push(o);return{dataSize:1,buffer:n,indices:i,mappingType:t,referenceType:s}}parseNurbsGeometry(e){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 a.BufferGeometry;const s=t-1,n=e.KnotVector.a,i=[],o=e.Points.a;for(let u=0,g=o.length;u<g;u+=4)i.push(new a.Vector4().fromArray(o,u));let r,A;if(e.Form==="Closed")i.push(i[0]);else if(e.Form==="Periodic"){r=s,A=n.length-1-r;for(let u=0;u<s;++u)i.push(i[u])}const h=new la(s,n,i,r,A).getPoints(i.length*12);return new a.BufferGeometry().setFromPoints(h)}}class ga{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const s in t){const n=t[s],i=this.addClip(n);e.push(i)}return e}parseClips(){if(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 s in e){const n=e[s];if(n.attrName.match(/S|R|T|DeformPercent/)!==null){const i={id:n.id,attr:n.attrName,curves:{}};t.set(i.id,i)}}return t}parseAnimationCurves(e){const t=ne.Objects.AnimationCurve;for(const s in t){const n={id:t[s].id,times:t[s].KeyTime.a.map(ba),values:t[s].KeyValueFloat.a},i=we.get(n.id);if(i!==void 0){const o=i.parents[0].ID,r=i.parents[0].relationship;r.match(/X/)?e.get(o).curves.x=n:r.match(/Y/)?e.get(o).curves.y=n:r.match(/Z/)?e.get(o).curves.z=n:r.match(/DeformPercent/)&&e.has(o)&&(e.get(o).curves.morph=n)}}}parseAnimationLayers(e){const t=ne.Objects.AnimationLayer,s=new Map;for(const n in t){const i=[],o=we.get(parseInt(n));o!==void 0&&(o.children.forEach(function(A,l){if(e.has(A.ID)){const h=e.get(A.ID);if(h.curves.x!==void 0||h.curves.y!==void 0||h.curves.z!==void 0){if(i[l]===void 0){const u=we.get(A.ID).parents.filter(function(g){return g.relationship!==void 0})[0].ID;if(u!==void 0){const g=ne.Objects.Model[u.toString()];if(g===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",A);return}const p={modelName:g.attrName?a.PropertyBinding.sanitizeNodeName(g.attrName):"",ID:g.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};ke.traverse(function(f){f.ID===g.id&&(p.transform=f.matrix,f.userData.transformData&&(p.eulerOrder=f.userData.transformData.eulerOrder))}),p.transform||(p.transform=new a.Matrix4),"PreRotation"in g&&(p.preRotation=g.PreRotation.value),"PostRotation"in g&&(p.postRotation=g.PostRotation.value),i[l]=p}}i[l]&&(i[l][h.attr]=h)}else if(h.curves.morph!==void 0){if(i[l]===void 0){const u=we.get(A.ID).parents.filter(function(E){return E.relationship!==void 0})[0].ID,g=we.get(u).parents[0].ID,p=we.get(g).parents[0].ID,f=we.get(p).parents[0].ID,I=ne.Objects.Model[f],b={modelName:I.attrName?a.PropertyBinding.sanitizeNodeName(I.attrName):"",morphName:ne.Objects.Deformer[u].attrName};i[l]=b}i[l][h.attr]=h}}}),s.set(parseInt(n),i))}return s}parseAnimStacks(e){const t=ne.Objects.AnimationStack,s={};for(const n in t){const i=we.get(parseInt(n)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(i[0].ID);s[n]={name:t[n].attrName,layer:o}}return s}addClip(e){let t=[];const s=this;return e.layer.forEach(function(n){t=t.concat(s.generateTracks(n))}),new a.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let s=new a.Vector3,n=new a.Vector3;if(e.transform&&e.transform.decompose(s,new a.Quaternion,n),s=s.toArray(),n=n.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,s,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,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,n,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,s,n){const i=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(i,t,s);return new a.VectorKeyframeTrack(e+"."+n,i,o)}generateRotationTrack(e,t,s,n,i){let o,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 g=this.interpolateRotations(t.x,t.y,t.z,i);o=g[0],r=g[1]}const A=Xt(0);s!==void 0&&(s=s.map(a.MathUtils.degToRad),s.push(A),s=new a.Euler().fromArray(s),s=new a.Quaternion().setFromEuler(s)),n!==void 0&&(n=n.map(a.MathUtils.degToRad),n.push(A),n=new a.Euler().fromArray(n),n=new a.Quaternion().setFromEuler(n).invert());const l=new a.Quaternion,h=new a.Euler,u=[];if(!(!r||!o)){for(let g=0;g<r.length;g+=3)h.set(r[g],r[g+1],r[g+2],i),l.setFromEuler(h),s!==void 0&&l.premultiply(s),n!==void 0&&l.multiply(n),g>2&&new a.Quaternion().fromArray(u,(g-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(u,g/3*4);return new a.QuaternionKeyframeTrack(e+".quaternion",o,u)}}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,s=t.values.map(function(i){return i/100}),n=ke.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new a.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,s)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(s,n){return s-n}),t.length>1){let s=1,n=t[0];for(let i=1;i<t.length;i++){const o=t[i];o!==n&&(t[s]=o,n=o,s++)}t=t.slice(0,s)}return t}getKeyframeTrackValues(e,t,s){const n=s,i=[];let o=-1,r=-1,A=-1;return e.forEach(function(l){if(t.x&&(o=t.x.times.indexOf(l)),t.y&&(r=t.y.times.indexOf(l)),t.z&&(A=t.z.times.indexOf(l)),o!==-1){const h=t.x.values[o];i.push(h),n[0]=h}else i.push(n[0]);if(r!==-1){const h=t.y.values[r];i.push(h),n[1]=h}else i.push(n[1]);if(A!==-1){const h=t.z.values[A];i.push(h),n[2]=h}else i.push(n[2])}),i}interpolateRotations(e,t,s,n){const i=[],o=[];i.push(e.times[0]),o.push(a.MathUtils.degToRad(e.values[0])),o.push(a.MathUtils.degToRad(t.values[0])),o.push(a.MathUtils.degToRad(s.values[0]));for(let r=1;r<e.values.length;r++){const A=[e.values[r-1],t.values[r-1],s.values[r-1]];if(isNaN(A[0])||isNaN(A[1])||isNaN(A[2]))continue;const l=A.map(a.MathUtils.degToRad),h=[e.values[r],t.values[r],s.values[r]];if(isNaN(h[0])||isNaN(h[1])||isNaN(h[2]))continue;const u=h.map(a.MathUtils.degToRad),g=[h[0]-A[0],h[1]-A[1],h[2]-A[2]],p=[Math.abs(g[0]),Math.abs(g[1]),Math.abs(g[2])];if(p[0]>=180||p[1]>=180||p[2]>=180){const I=Math.max(...p)/180,b=new a.Euler(...l,n),E=new a.Euler(...u,n),y=new a.Quaternion().setFromEuler(b),C=new a.Quaternion().setFromEuler(E);y.dot(C)&&C.set(-C.x,-C.y,-C.z,-C.w);const w=e.times[r-1],x=e.times[r]-w,R=new a.Quaternion,D=new a.Euler;for(let S=0;S<1;S+=1/I)R.copy(y.clone().slerp(C.clone(),S)),i.push(w+S*x),D.setFromQuaternion(R,n),o.push(D.x),o.push(D.y),o.push(D.z)}else i.push(e.times[r]),o.push(a.MathUtils.degToRad(e.values[r])),o.push(a.MathUtils.degToRad(t.values[r])),o.push(a.MathUtils.degToRad(s.values[r]))}return[i,o]}}class pa{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 Gi,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,s=e.split(/[\r\n]+/);return s.forEach(function(n,i){const o=n.match(/^[\s\t]*;/),r=n.match(/^[\s\t]*$/);if(o||r)return;const A=n.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),l=n.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),h=n.match("^\\t{"+(t.currentIndent-1)+"}}");A?t.parseNodeBegin(n,A):l?t.parseNodeProperty(n,l,s[++i]):h?t.popStack():n.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(n)}),this.allNodes}parseNodeBegin(e,t){const s=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=t[2].split(",").map(function(A){return A.trim().replace(/^"/,"").replace(/"$/,"")}),i={name:s},o=this.parseNodeAttr(n),r=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(s,i):s in r?(s==="PoseNode"?r.PoseNode.push(i):r[s].id!==void 0&&(r[s]={},r[s][r[s].id]=r[s]),o.id!==""&&(r[s][o.id]=i)):typeof o.id=="number"?(r[s]={},r[s][o.id]=i):s!=="Properties70"&&(s==="PoseNode"?r[s]=[i]:r[s]=i),typeof o.id=="number"&&(i.id=o.id),o.name!==""&&(i.attrName=o.name),o.type!==""&&(i.attrType=o.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let s="",n="";return e.length>1&&(s=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:s,type:n}}parseNodeProperty(e,t,s){let n=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();n==="Content"&&i===","&&(i=s.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,n,i);return}if(n==="C"){const A=i.split(",").slice(1),l=parseInt(A[0]),h=parseInt(A[1]);let u=i.split(",").slice(3);u=u.map(function(g){return g.trim().replace(/^"/,"")}),n="connections",i=[l,h],Ca(i,u),o[n]===void 0&&(o[n]=[])}n==="Node"&&(o.id=i),n in o&&Array.isArray(o[n])?o[n].push(i):n!=="a"?o[n]=i:o.a=i,this.setCurrentProp(o,n),n==="a"&&i.slice(-1)!==","&&(o.a=Fn(i))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Fn(t.a))}parseNodeSpecialProperty(e,t,s){const n=s.split('",').map(function(h){return h.trim().replace(/^\"/,"").replace(/\s/,"_")}),i=n[0],o=n[1],r=n[2],A=n[3];let l=n[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":l=parseFloat(l);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":l=Fn(l);break}this.getPrevNode()[i]={type:o,type2:r,flag:A,value:l},this.setCurrentProp(this.getPrevNode(),i)}}class fa{parse(e){const t=new Ls(e);t.skip(23);const s=t.getUint32();if(s<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+s);const n=new Gi;for(;!this.endOfContent(t);){const i=this.parseNode(t,s);i!==null&&n.add(i.name,i)}return n}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const s={},n=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),r=e.getString(o);if(n===0)return null;const A=[];for(let g=0;g<i;g++)A.push(this.parseProperty(e));const l=A.length>0?A[0]:"",h=A.length>1?A[1]:"",u=A.length>2?A[2]:"";for(s.singleProperty=i===1&&e.getOffset()===n;n>e.getOffset();){const g=this.parseNode(e,t);g!==null&&this.parseSubNode(r,s,g)}return s.propertyList=A,typeof l=="number"&&(s.id=l),h!==""&&(s.attrName=h),u!==""&&(s.attrType=u),r!==""&&(s.name=r),s}parseSubNode(e,t,s){if(s.singleProperty===!0){const n=s.propertyList[0];Array.isArray(n)?(t[s.name]=s,s.a=n):t[s.name]=n}else if(e==="Connections"&&s.name==="C"){const n=[];s.propertyList.forEach(function(i,o){o!==0&&n.push(i)}),t.connections===void 0&&(t.connections=[]),t.connections.push(n)}else if(s.name==="Properties70")Object.keys(s).forEach(function(i){t[i]=s[i]});else if(e==="Properties70"&&s.name==="P"){let n=s.propertyList[0],i=s.propertyList[1];const o=s.propertyList[2],r=s.propertyList[3];let A;n.indexOf("Lcl ")===0&&(n=n.replace("Lcl ","Lcl_")),i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),i==="Color"||i==="ColorRGB"||i==="Vector"||i==="Vector3D"||i.indexOf("Lcl_")===0?A=[s.propertyList[4],s.propertyList[5],s.propertyList[6]]:A=s.propertyList[4],t[n]={type:i,type2:o,flag:r,value:A}}else t[s.name]===void 0?typeof s.id=="number"?(t[s.name]={},t[s.name][s.id]=s):t[s.name]=s:s.name==="PoseNode"?(Array.isArray(t[s.name])||(t[s.name]=[t[s.name]]),t[s.name].push(s)):t[s.name][s.id]===void 0&&(t[s.name][s.id]=s)}parseProperty(e){const t=e.getString(1);let s;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return s=e.getUint32(),e.getArrayBuffer(s);case"S":return s=e.getUint32(),e.getString(s);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const n=e.getUint32(),i=e.getUint32(),o=e.getUint32();if(i===0)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}const r=Yt(new Uint8Array(e.getArrayBuffer(o))),A=new Ls(r.buffer);switch(t){case"b":case"c":return A.getBooleanArray(n);case"d":return A.getFloat64Array(n);case"f":return A.getFloat32Array(n);case"i":return A.getInt32Array(n);case"l":return A.getInt64Array(n)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Ls{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 s=0;s<e;s++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){const t=this.offset;let s=new Uint8Array(this.dv.buffer,t,e);this.skip(e);const n=s.indexOf(0);return n>=0&&(s=new Uint8Array(this.dv.buffer,t,n)),this._textDecoder.decode(s)}}class Gi{add(e,t){this[e]=t}}function ma(c){const e="Kaydara FBX Binary \0";return c.byteLength>=e.length&&e===Pi(c,0,e.length)}function Ia(c){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function s(n){const i=c[n-1];return c=c.slice(t+n),t++,i}for(let n=0;n<e.length;++n)if(s(1)===e[n])return!1;return!0}function ks(c){const e=/FBXVersion: (\d+)/,t=c.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function ba(c){return c/46186158e3}const Ea=[];function sn(c,e,t,s){let n;switch(s.mappingType){case"ByPolygonVertex":n=c;break;case"ByPolygon":n=e;break;case"ByVertice":n=t;break;case"AllSame":n=s.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+s.mappingType)}s.referenceType==="IndexToDirect"&&(n=s.indices[n]);const i=n*s.dataSize,o=i+s.dataSize;return Ba(Ea,s.buffer,i,o)}const _n=new a.Euler,vt=new a.Vector3;function Ui(c){const e=new a.Matrix4,t=new a.Matrix4,s=new a.Matrix4,n=new a.Matrix4,i=new a.Matrix4,o=new a.Matrix4,r=new a.Matrix4,A=new a.Matrix4,l=new a.Matrix4,h=new a.Matrix4,u=new a.Matrix4,g=new a.Matrix4,p=c.inheritType?c.inheritType:0;c.translation&&e.setPosition(vt.fromArray(c.translation));const f=Xt(0);if(c.preRotation){const G=c.preRotation.map(a.MathUtils.degToRad);G.push(f),t.makeRotationFromEuler(_n.fromArray(G))}if(c.rotation){const G=c.rotation.map(a.MathUtils.degToRad);G.push(c.eulerOrder||f),s.makeRotationFromEuler(_n.fromArray(G))}if(c.postRotation){const G=c.postRotation.map(a.MathUtils.degToRad);G.push(f),n.makeRotationFromEuler(_n.fromArray(G)),n.invert()}c.scale&&i.scale(vt.fromArray(c.scale)),c.scalingOffset&&r.setPosition(vt.fromArray(c.scalingOffset)),c.scalingPivot&&o.setPosition(vt.fromArray(c.scalingPivot)),c.rotationOffset&&A.setPosition(vt.fromArray(c.rotationOffset)),c.rotationPivot&&l.setPosition(vt.fromArray(c.rotationPivot)),c.parentMatrixWorld&&(u.copy(c.parentMatrix),h.copy(c.parentMatrixWorld));const I=t.clone().multiply(s).multiply(n),b=new a.Matrix4;b.extractRotation(h);const E=new a.Matrix4;E.copyPosition(h);const y=E.clone().invert().multiply(h),C=b.clone().invert().multiply(y),w=i,x=new a.Matrix4;if(p===0)x.copy(b).multiply(I).multiply(C).multiply(w);else if(p===1)x.copy(b).multiply(C).multiply(I).multiply(w);else{const O=new a.Matrix4().scale(new a.Vector3().setFromMatrixScale(u)).clone().invert(),X=C.clone().multiply(O);x.copy(b).multiply(I).multiply(X).multiply(w)}const R=l.clone().invert(),D=o.clone().invert();let S=e.clone().multiply(A).multiply(l).multiply(t).multiply(s).multiply(n).multiply(R).multiply(r).multiply(o).multiply(i).multiply(D);const v=new a.Matrix4().copyPosition(S),N=h.clone().multiply(v);return g.copyPosition(N),S=g.clone().multiply(x),S.premultiply(h.invert()),S}function Xt(c){c=c||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return c===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[c]}function Fn(c){return c.split(",").map(function(t){return parseFloat(t)})}function Pi(c,e,t){return e===void 0&&(e=0),t===void 0&&(t=c.byteLength),new TextDecoder().decode(new Uint8Array(c,e,t))}function Ca(c,e){for(let t=0,s=c.length,n=e.length;t<n;t++,s++)c[s]=e[t]}function Ba(c,e,t,s){for(let n=t,i=0;n<s;n++,i++)c[i]=e[n];return c}class ya extends a.Loader{constructor(e){super(e)}load(e,t,s,n){const i=this,o=this.path===""?a.LoaderUtils.extractUrlBase(e):this.path,r=new a.FileLoader(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,function(A){try{t(i.parse(A,o))}catch(l){n?n(l):console.error(l),i.manager.itemError(e)}},s,n)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const s=e.split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Tt=Object.defineProperty,Ft=(s,e,t)=>e in s?Tt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,M=(s,e,t)=>Ft(s,typeof e!="symbol"?e+"":e,t);import{Vector4 as Ot,Vector3 as zt,Vector2 as At,TextureLoader as Wt,Texture as Dt,ShaderMaterial as Et,PlaneGeometry as Lt,Plane as Ht,Object3D as Gt,MeshBasicMaterial as $t,Mesh as jt,LinearFilter as Xt,FrontSide as Yt,FileLoader as Nt,EventDispatcher as Kt,DoubleSide as qt,Color as Jt,BufferGeometry as Qt,BufferAttribute as Zt,BackSide as es}from"./three-
|
|
1
|
+
var Tt=Object.defineProperty,Ft=(s,e,t)=>e in s?Tt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,M=(s,e,t)=>Ft(s,typeof e!="symbol"?e+"":e,t);import{Vector4 as Ot,Vector3 as zt,Vector2 as At,TextureLoader as Wt,Texture as Dt,ShaderMaterial as Et,PlaneGeometry as Lt,Plane as Ht,Object3D as Gt,MeshBasicMaterial as $t,Mesh as jt,LinearFilter as Xt,FrontSide as Yt,FileLoader as Nt,EventDispatcher as Kt,DoubleSide as qt,Color as Jt,BufferGeometry as Qt,BufferAttribute as Zt,BackSide as es}from"./three-DuDKwKB8.min.js";var k={};k.d=(s,e)=>{for(var t in e)k.o(e,t)&&!k.o(s,t)&&Object.defineProperty(s,t,{enumerable:!0,get:e[t]})},k.o=(s,e)=>Object.prototype.hasOwnProperty.call(s,e),k.r=s=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var m={};k.d(m,{ti:()=>p,nS:()=>yt,eB:()=>z,Yp:()=>Z,VB:()=>C,BC:()=>I,zN:()=>R,cV:()=>P,hW:()=>W,k2:()=>Fe,K6:()=>w,M7:()=>ee,ls:()=>F,Hi:()=>Qe,EY:()=>A,MR:()=>Ge,zf:()=>Te,Ay:()=>gn,yo:()=>xt});var Z={};k.r(Z),k.d(Z,{get:()=>Ce,set:()=>ts});var ee={};k.r(ee),k.d(ee,{alphaTestTransformer:()=>G,asPreprocessorValueTransformer:()=>$e,toPreprocessorTriggerTransformer:()=>pe,toUserDataTransformer:()=>di,uniformOrUserDataTransformer:()=>x});const te={fontFamily:null,fontSize:.05,fontKerning:"auto",fontStyle:"normal",fontWeight:"normal",offset:.005,lineHeight:1.2,lineBreak:`- ,.:?!
|
|
2
2
|
`,whiteSpace:"pre-line",flexDirection:"column",justifyContent:"start",alignItems:"start",backgroundImage:null,textAlign:"left",boxSizing:"content-box",position:"static",color:16777215,fontColor:16777215,fontOpacity:1,opacity:1,fontPXRange:4,fontSupersampling:!0,fontSmooth:"antialiased",borderRadius:0,borderWidth:0,borderColor:"black",borderOpacity:1,backgroundSize:"cover",backgroundColor:0,backgroundOpacity:0,overflow:"visible",letterSpacing:0,invertAlpha:!1,segments:1},ts=function(s){for(const e in s)te[e]=s[e]},Ce=function(s){return Object.prototype.hasOwnProperty.call(te,s)||console.warn(`ThreeMeshUI::DefaultValues is trying to retrieve non-existing property '${s}'`),te[s]};class p{constructor(e,t=null,i=!0){this._id=e,this._value=t,this._needsUpdate=!0,this._needsProcess=!1,this._needsRender=!1,this._isPrimitive=i}get id(){return this._id}get value(){return this._value}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}update(e,t){this.output(t)}output(e){}_outputValue(e){e[this._id]=this._value}process(e){}render(e){}getInheritedInput(e){if(this._value!=="inherit")return this._value;const t=e._parent._value;return t&&t[`_${this._id}`]?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return Ce(this._id)}isValid(e){return!0}emptyStrategyLogic(){throw new Error(`ThreeMeshUI::${this.constructor.name} has empty strategy. Update has not been processed.`)}requestUpdate(){this._needsUpdate=!0}requestProcess(){this._needsProcess=!1}requestRender(){this._needsRender=!1}}class ss extends p{constructor(){super("renderOrder","auto",!0),this.output=this._outputValue,this._actualValue=0}set value(e){this.isValid(e)&&(this._value=e,this._needsUpdate=!0)}update(e,t){if(this._value!=="auto")this._actualValue=this._value;else{const i=e._parent._value;if(i!==null){const r=i._renderOrder._actualValue,n=1+i._children._uis.indexOf(e);this._actualValue=r+n}}for(const i of e._children._uis)i._renderOrder._value==="auto"&&(i._renderOrder._needsUpdate=!0);this._outputValue(t)}_outputValue(e){e[this._id]=this._actualValue}get value(){return this._value}}class R extends p{constructor(e,t=null,i=!0){super(e,t,i),this.output=this._outputValue,this._notInheritedValue=null}update(e,t){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(e)),this.propagate(e),this._outputValue(t)}propagate(e){for(const t of e._children._uis){const i=t[`_${this._id}`];i!==void 0&&i._value==="inherit"&&(t[`_${this._id}`]._needsUpdate=!0)}}_outputValue(e){e[this._id]=this._notInheritedValue}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class is extends R{constructor(){super("offset","inherit",!1)}update(e,t){super.update(e,t),e._parent._value!==null&&(e.position.z=this._notInheritedValue)}}class rs extends R{constructor(){super("fontSmooth","inherit",!0),this._needsUpdate=!1,this.isValid=os,this.output=this._outputValue}}const ns=["inherit","none","antialiased"];function os(s){return ns.indexOf(s)===-1?(console.warn(`.fontSmoothing value '${s}' is not valid. Aborted`),!1):!0}var as=s=>{var e={};return k.d(e,s),e};const a=as({BackSide:()=>es,BufferAttribute:()=>Zt,BufferGeometry:()=>Qt,Color:()=>Jt,DoubleSide:()=>qt,EventDispatcher:()=>Kt,FileLoader:()=>Nt,FrontSide:()=>Yt,LinearFilter:()=>Xt,Mesh:()=>jt,MeshBasicMaterial:()=>$t,Object3D:()=>Gt,Plane:()=>Ht,PlaneGeometry:()=>Lt,ShaderMaterial:()=>Et,Texture:()=>Dt,TextureLoader:()=>Wt,Vector2:()=>At,Vector3:()=>zt,Vector4:()=>Ot});class g extends p{constructor(e,t,i=!0){super(e,"unset",i),this._input="inherit",this._allowsInherit=!0,this._inheritedInput=void 0,this._inline=void 0}update(e,t){this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis){const r=i[`_${this._id}`];(r._input?r._input:r._value)==="inherit"&&(i[`_${this._id}`]._needsUpdate=!0)}this.output(t)}computeOutputValue(e){this._value=this._input}_computeFromInherited(e){this._value=this._inheritedInput}set value(e){console.warn(".(style) sub-property cannot be directly set. It must comes from inline or computed setter.")}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._input=this._inline=e,this._needsUpdate=!0)}get inline(){return this._inline}isValidValue(e){return!0}getInheritedInput(e){if(this._input!=="inherit")return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}}class D extends g{constructor(e,t){super(e,t,!1),this._input=new a.Vector4(0,0,0,0),this._inline=null,this._value=new a.Vector4(0,0,0,0)}get value(){return this._value}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input)}set inline(e){this._vector4ValueSetter(this._input,e),!this._input.equals(this._value)&&(this._needsUpdate=!0)}set top(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get top(){return this._input.x}set right(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get right(){return this._input.y}set bottom(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottom(){return this._input.z}set left(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get left(){return this._input.w}dispose(){this._computed=null,this._inline=null,this._input=null,this._output=null}_vector4ValueSetter(e,t){if(t instanceof a.Vector4){e.copy(t);return}if((typeof t=="string"||t instanceof String)&&(t=t.split(" ")),Array.isArray(t))switch(t=t.map(i=>parseFloat(i)),t.length){case 1:e.setScalar(t[0]);return;case 2:e.x=e.z=t[0],e.y=e.w=t[1];return;case 3:e.x=t[0],e.y=t[1],e.z=t[2];return;case 4:e.x=t[0],e.y=t[1],e.z=t[2],e.w=t[3];return;default:console.error("StyleVector4Property::set() Four Dimension property had more than four values");return}isNaN(t)||e.setScalar(t)}}class ls extends D{constructor(){super("padding",new a.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._bounds._needsUpdate=!0,e._bounds._needsRender=!0,e._layouter._needsProcess=!0,e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}class hs extends D{constructor(){super("margin",new a.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._flexDirection._needsProcess=!0)}}const Me=function(s,e,t){s[e]=t},us=function(s,e,t){t!==null&&(s[e]=t)};class E{constructor(e){this._definition=e}set definition(e){this._definition=e}mediate(e,t,i,r=null){for(const n in this._definition){const o=this._definition[n];if(i[n]!==void 0){const h=o.t?o.t:Me;h(t,o.m,i[n]),r&&h(r,o.m,i[n])}}}static mediate(e,t,i,r,n=null){if(t)for(const o in r){const h=r[o];if(i[o]!==void 0){const c=h.t?h.t:Me;c(t,h.m,i[o]),n&&c(n,h.m,i[o])}}}}class cs extends p{constructor(){super("parent",null,!1)}update(e,t){e.parent&&e.parent.isUI?this._value=e.parent:this._value=null}set value(e){console.warn("ParentProperty is readonly")}get value(){return this._value}find(e){return this._value?e(this._value)?this._value:this._value._parent.find(e):null}dispose(){this._value=null}}const se=function(s,e,t=6){return s.toFixed(t)===e.toFixed(t)};class Be extends p{constructor(e,t){super(e,t,!0),this.output=this._outputValue}set value(e){this.isValid(e)&&(se(this._value,e)||(this._value=e,this._needsUpdate=!0))}get value(){return this._value}}class Pe extends R{constructor(e){super(e,"inherit",!0),this.isValid=_s}}const ds=[a.FrontSide,a.BackSide,a.DoubleSide];function _s(s){return ds.indexOf(s)===-1?(console.warn(`SideProperty value '${s}' is not valid. Abort`),!1):!0}class Ie{constructor(){this._offsetX=0,this._offsetY=0,this._lineBreak=null,this._kerning=0,this._fontFactor=1,this._fontSize=0,this._cumulativeWidth=0,this._paddingLeft=0,this._paddingRight=0,this._marginLeft=0,this._marginRight=0}resetOffsets(){this._offsetX=this._offsetY=0,this._cumulativeWidth=0}get xadvance(){return 0}get xoffset(){return 0}get yoffset(){return 0}get width(){return 0}get height(){return 0}set lineBreak(e){this._lineBreak=e}get lineBreak(){return this._lineBreak}get anchor(){return 0}get kerning(){return this._kerning*this._fontFactor}set kerning(e){this._kerning=e}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize=e}get lineHeight(){return 0}get offsetX(){return this._offsetX}set offsetX(e){this._offsetX=e}get offsetY(){return this._offsetY}set offsetY(e){this._offsetY=e}get cumulativeWidth(){return this._cumulativeWidth}set cumulativeWidth(e){this._cumulativeWidth=e}get marginLeft(){return this._marginLeft}set marginLeft(e){this._marginLeft=e}get marginRight(){return this._marginRight}set marginRight(e){this._marginRight=e}get paddingLeft(){return this._paddingLeft}set paddingLeft(e){this._paddingLeft=e}get paddingRight(){return this._paddingRight}set paddingRight(e){this._paddingRight=e}get lineBase(){return 0}set fontFactor(e){this._fontFactor=e}get fontFactor(){return this._fontFactor}}class Te{constructor(e){this._char="",this._width=1,this._heigth=1,this._xadvance=1,this._xoffset=0,this._yoffset=0,this._font=e}get font(){return this._font}get char(){return this._char}get width(){return this._width}get height(){return this._heigth}get xadvance(){return this._xadvance}get xoffset(){return this._xoffset}get yoffset(){return this._yoffset}set yoffset(e){this._yoffset=e}clone(e){throw new Error("Abstract... Need to be implemented")}asInlineGlyph(){throw new Error("Abstract... Need to be implemented")}}class Fe extends Ie{constructor(e){super(),this._typographic=e}get typographic(){return this._typographic}get xadvance(){return this._typographic.xadvance*this._fontFactor}get xoffset(){return this._typographic.xoffset*this._fontFactor}get yoffset(){return this._typographic.yoffset*this._fontFactor}get width(){return this._typographic.width*this._fontFactor}get height(){return this._typographic.height*this._fontFactor}get char(){return this._typographic.char}get anchor(){return this.yoffset}get lineHeight(){return this._typographic.font.lineHeight*this._fontFactor}get lineBase(){return this._typographic.font.lineBase*this._fontFactor}}const ps={light:"100",normal:"400",bold:"700",bolder:"900"};function ie(s){return isNaN(s)?ps[s]||s:s.toString()}class fs extends a.EventDispatcher{constructor(e,t){super(),this._isReady=!1,this._weight=ie(e),this._style=t,this._size=42,this._lineHeight=42,this._lineBase=42,this._font=null}get typographic(){return this._font}get isReady(){return this._isReady}get weight(){return this._weight}get style(){return this._style}get texture(){return this._texture}set fontMaterial(e){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get fontMaterial(){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get id(){return`${this._name}(w:${this.weight},s:${this.style})`}getTypographicGlyph(e){let t=this._chars[e];if(t)return t;if(e.match(/\s/))return this._chars[" "];const i=this._getFallbackCharacter(e);if(i&&(t=this._chars[i],t))return t;throw Error(`FontVariant('${this.id}')::getTypographicGlyph() - character('${e}') and/or fallback character were not found in provided msdf charset.`)}_getFallbackCharacter(e){throw new Error(`FontVariant(${typeof this})::_getFallbackCharacter() is abstract and should therefore be overridden.`)}getGeometricGlyph(e,t){throw new Error(`FontVariant(${typeof this})::getGeometryCharacter() is abstract and should therefore be overridden.`)}getKerningAmount(e){return this._kernings[e]?this._kernings[e]:0}adjustTypographicGlyphs(e){for(const t in e){const i=this.getTypographicGlyph(t),r=e[t];for(const n in r)i["_"+n]=e[t][n]}}_checkReadiness(){this._readyCondition()&&ms(this)}_alterElementProperties(e){throw new Error(`FontVariant(${typeof this})::_alterElementProperties() is abstract and should therefore be overridden.`)}_readyCondition(){throw new Error(`FontVariant(${typeof this})::_readyCondition() is abstract and should therefore be overridden.`)}}const gs={type:"ready"};function ms(s){s._isReady=!0,s.dispatchEvent(gs)}const I=fs;class vs extends p{constructor(e=null){super("font",e,!1),this._needsUpdate=!1,this._fontVariant=null,this._handleFontReadyClosure=null,this.isValid=bs}output(e){e[this._id]=this._fontVariant}update(e,t){if(this._fontVariant&&!this._fontVariant.isReady&&this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._value&&this._value instanceof I)this._fontVariant=this._value;else{const i=e._fontFamily._value;i&&(this._fontVariant=i.getVariant(e._fontWeight._value,e._fontStyle._value))}this._fontVariant&&(this._fontVariant._alterElementProperties(e),this._handleFontReadyClosure=ys(e,this),this._fontVariant.isReady?this._handleFontReadyClosure():this._fontVariant.addEventListener("ready",this._handleFontReadyClosure),(!e._fontMaterial._defaultMaterial||!(e._fontMaterial._defaultMaterial instanceof this._fontVariant.fontMaterial))&&(e._fontMaterial._defaultMaterial=new this._fontVariant.fontMaterial,e._fontMaterial._needsUpdate=!0))}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}get fontVariant(){return this._fontVariant}dispose(){this._handleFontReadyClosure&&(this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._handleFontReadyClosure=null),this._value=null,this._fontVariant=null}}function bs(s){return s instanceof I?!0:(console.warn(`.font value '${s}' is not valid. It requires a FontVariant instance. Aborted`),!1)}function ys(s,e){return function(){e._needsUpdate=!0,s._glyphs._needsProcess=!0,e._fontVariant.removeEventListener("ready",e._handleFontReadyClosure),e._handleFontReadyClosure=null}}class xs extends g{constructor(e){super("display",e),this._value="flex",this._allowsInherit=!1,this._needsUpdate=!1,this.isValidValue=Ss}computeOutputValue(e){e._visible._value=this._output!=="none"}}const ws=["none","flex"];function Ss(s){return ws.indexOf(s)===-1?(console.warn(`(.style) display value '${s}' is not valid. Aborted`),!1):!0}class ks extends g{constructor(e){super("boxSizing",e),this._allowsInherit=!1,this.isValidValue=Us}computeOutputValue(e){this._value=this._inheritedInput,e._bounds._needsUpdate=!0}}const Vs=["border-box","content-box"];function Us(s){return Vs.indexOf(s)===-1?(console.warn(`(.style) boxSizing value '${s}' is not valid. Aborted`),!1):!0}class T extends g{constructor(e,t){super(e,t,!1),this._value=new a.Color,this.output=this._outputValue}computeOutputValue(e){this._input!=="inherit"&&this._value.set(this._input)}set inline(e){this._input=this._inline=e,this._needsUpdate=!0}}class re extends g{constructor(e,t){super(e,t,!0),this.isValidValue=Rs,this._allowsInherit=!1,this._input=t,this._value=t,this.output=this._outputValue,this.computeOutputValue=this._computeFromInherited}_outputValue(e){e[this._id]=this._inheritedInput}}function Rs(s){return s<0&&s>1?(console.warn(`(.style) styleFactorProperty('${this.id}') value '${s}' is not valid)`),!1):!0}class Cs extends g{constructor(e){super("backgroundImage",e,!0),this._input=null,this._allowsInherit=!1,this._textureSize=new a.Vector2(1,1),this.isValidValue=Ms}get value(){return this._value}output(e){e[this._id]=this._value,e.tSize=this._textureSize}computeOutputValue(e){if(this._value=this._inheritedInput,this._value instanceof a.Texture&&!this._value.image){console.warn("ThreeMeshUI - .backgroundImage :: Please provide preloaded texture in order to have accurate sizing.");return}this._needsProcess=!0}process(e){this._value?this._textureSize.set(this._value.image.width,this._value.image.height):this._textureSize.set(1,1)}}function Ms(s){return!0}class Bs extends g{constructor(e){super("backgroundSize",e,!0),this.isValidValue=Is,this.output=this._outputValue}}const Ps=["cover","contain","stretch"];function Is(s){return Ps.indexOf(s)===-1?(console.warn(`(.style) backgroundSize value '${s}' is not valid. Aborted`),!1):!0}class Ts extends g{constructor(e){super("overflow",e,!0),this.isValidValue=Os,this._clippingPlanes=null,this._renderStrategy=this._emptyRender}update(e,t){this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0&&(this._input=this._computed),this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis)i._overflow._needsUpdate=!0;this.output(t)}output(e){e.clippingPlanes=this._clippingPlanes}computeOutputValue(e){super.computeOutputValue(e),this._value==="hidden"?this._renderStrategy=this._propagateRender:(this._renderStrategy=this._emptyRender,this._clippingPlanes=null);const t=e._parent._value;if(t!==null){const i=t._overflow;if((i._value==="hidden"||i._clippingPlanes!==null)&&!this._clippingPlanes){this._clippingPlanes=[new a.Plane(new a.Vector3(0,-1,0),1),new a.Plane(new a.Vector3(-1,0,0),1),new a.Plane(new a.Vector3(0,1,0),1),new a.Plane(new a.Vector3(1,0,0),1)];for(let r=0;r<this._clippingPlanes.length;r++)this._clippingPlanes[r].parent=t;i._clippingPlanes!==null&&this._clippingPlanes.push(...i._clippingPlanes),this._renderStrategy=this._hiddenRender,this._needsRender=!0}else(i._value==="visible"||i._clippingPlanes===null)&&this._clippingPlanes!==null&&(this._clippingPlanes=null,this._renderStrategy=this._emptyRender,this._needsRender=!0)}}render(e){this._renderStrategy(e)}_emptyRender(e){}_hiddenRender(e){const t=e._parent._value,i=t._bounds._offsetHeight,r=t._bounds._offsetWidth,n=t._padding._value,o=t._borderWidth._value;for(let h=0;h<4&&h<this._clippingPlanes.length;h++){const c=this._clippingPlanes[h];switch(h%4){case 0:c.constant=i/2-(n.x+o.x);break;case 1:c.constant=r/2-(n.y+o.y);break;case 2:c.constant=i/2-(n.z+o.z);break;case 3:c.constant=r/2-(n.w+o.w);break}c.applyMatrix4(t.matrixWorld)}for(let h=0;h<e._children._uis.length;h++){const c=e._children._uis[h];c._overflow._needsRender=!0}}_propagateRender(e){for(let t=0;t<e._children._uis.length;t++){const i=e._children._uis[t];i._overflow._needsRender=!0}}}const Fs=["visible","hidden"];function Os(s){return Fs.indexOf(s)===-1?(console.warn(`(.style) overflow value '${s}' is not valid. Aborted`),!1):!0}const B="rem",Oe="em",L="%",zs=[B,Oe,L],ze=function(s){return zs.indexOf(s)===-1?B:s};class As extends D{constructor(e){super("borderRadius",e),this._valueUV=this._value.clone(),this._input=new a.Vector4(0,0,0,0),this._mediation=!0,this._cornerTL=new a.Vector2(0,1),this._cornerTR=new a.Vector2(1,1),this._cornerBR=new a.Vector2(1,0),this._cornerBL=new a.Vector2(0,0);const t=new H(this._valueUV,["x","y"]),i=new H(this._valueUV,["z","w"]),r=new H(this._valueUV,["x","w"]),n=new H(this._valueUV,["y","z"]);t.complementaryMediation=i,i.complementaryMediation=t,r.complementaryMediation=n,n.complementaryMediation=r,this._sideMediators=[t,i,r,n],this._units=B}set units(e){this._units=ze(e),this._needsProcess=!0}get units(){return this._units}set mediation(e){e!==this._mediation&&(this._mediation=e,this._needsUpdate=!0)}get mediation(){return this._mediation}output(e){e.cornerTL=this._cornerTL,e.cornerTR=this._cornerTR,e.cornerBR=this._cornerBR,e.cornerBL=this._cornerBL}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0}process(e){this._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,i=e._bounds._offsetHeight;if(this._units===L&&this._valueUV.divideScalar(100),this._units===B&&this._valueUV.divideScalar(Math.min(t,i)),this._mediation)do this._sideMediators.forEach(o=>o.computeValue()),this._sideMediators.sort((o,h)=>o.value<h.value?1:-1),this._sideMediators[0].value>1&&this._sideMediators[0].mediate();while(this._sideMediators[0].value>1);let r=t>i?i/t:1,n=t<i?t/i:1;this._units===L&&(r=n=1),this._cornerTL.x=this._valueUV.x*r,this._cornerTL.y=1-this._valueUV.x*n,this._cornerTR.x=1-this._valueUV.y*r,this._cornerTR.y=1-this._valueUV.y*n,this._cornerBR.x=1-this._valueUV.z*r,this._cornerBR.y=this._valueUV.z*n,this._cornerBL.x=this._valueUV.w*r,this._cornerBL.y=this._valueUV.w*n}dispose(){for(const e of this._sideMediators)e.dispose();this._sideMediators=null,this._cornerTL=null,this._cornerTR=null,this._cornerBR=null,this._cornerBL=null,super.dispose()}set topLeft(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get topLeft(){return this._input.x}set topRight(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get topRight(){return this._input.y}set bottomRight(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottomRight(){return this._input.z}set bottomLeft(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get bottomLeft(){return this._input.w}set top(e){this._input.x===e&&this._input.y===e||(this._input.x=this._input.y=e,this._needsUpdate=!0)}get top(){return(this._input.x+this._input.y)/2}set right(e){this._input.y===e&&this._input.z===e||(this._input.y=this._input.z=e,this._needsUpdate=!0)}get right(){return(this._input.y+this._input.z)/2}set bottom(e){this._input.z===e&&this._input.w===e||(this._input.z=this._input.w=e,this._needsUpdate=!0)}get bottom(){return(this._input.z+this._input.w)/2}set left(e){this._input.w===e&&this._input.x===e||(this._input.w=this._input.x=e,this._needsUpdate=!0)}get left(){return(this._input.w+this._input.x)/2}}class H{constructor(e,t){this._borderRadiuses=e,this._sideProperties=t,this._complementaryMediation=null,this._value=0}get value(){return this._value}set complementaryMediation(e){this._complementaryMediation=e}computeValue(){let e=0;for(const t of this._sideProperties)e+=this._borderRadiuses[t];this._value=e}mediate(e=!0){if(!(this._value<1)){for(const t of this._sideProperties)this._borderRadiuses[t]/=this._value;e&&this._complementaryMediation.mediate(!1)}}dispose(){this._complementaryMediation=null,this._borderRadiuses=null}}class Ws extends D{constructor(e){super("borderWidth",e,!1),this._valueUV=this._value.clone(),this.output=this._outputValue,this._units=B}set units(e){this._units=ze(e),this._needsUpdate=!0}get units(){return this._units}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0,e._bounds._needsUpdate=!0,e._layouter._needsUpdate=!0}_outputValue(e){e[this._id]=this._valueUV}process(e){this._needsRender=!0,e._borderRadius._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,i=e._bounds._offsetHeight;if(this._units===L&&(console.log("Percent"),console.log(this._valueUV)),this._units===B)t!==0&&(this._valueUV.w/=t,this._valueUV.y/=t),i!==0&&(this._valueUV.x/=i,this._valueUV.z/=i);else if(this._units===Oe){if(t!==0){const r=t>i?i/t:1;this._valueUV.y*=r,this._valueUV.w*=r}if(i!==0){const r=t<i?t/i:1;this._valueUV.x*=r,this._valueUV.z*=r}}}}class Ds extends p{constructor(e,t=!0){super("visible",t,!0),this._needsUpdate=!1}update(e,t){e.visible=this._value,e._parent._value&&(e._parent._value._children._needsUpdate=!0)}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}}class Ae extends T{constructor(e){super("backgroundColor",e,!1),this._input="transparent",this._allowsInherit=!1}computeOutputValue(e){e._backgroundMesh.visible=!(this._input==="none"||this._input==="transparent"),this._input==="inherit"?this._value.set(this.getInheritedInput(e)):this._input==="transparent"||this._input==="none"||this._value.set(this._input)}}class V extends p{constructor(e="untitled"){super(e,void 0,!1)}update(e,t){}output(e){}}class Es extends p{constructor(){super("inlineJustificator",null,!1),this._value=null}update(e,t){}process(e){const t=e._bounds._innerHeight,i=e._layouter._value,r=Math.abs(i.height);let n=(()=>{switch(e._alignItems._value){case"inherit":case"start":return t/2;case"end":return r-t/2;case"stretch":case"center":return r/2}})();const o=e._padding._value,h=e._borderWidth._value;n+=(-o.x+o.z)/2+(-h.x+h.z)/2,i.forEach(c=>{c.y+=n,c.forEach(d=>{d.offsetY+=n})})}}const Ls=["start","center","end","stretch"],Hs=function(s){return Ls.indexOf(s)===-1?(console.warn(`(.style) alignItems value '${s}' is not valid. Aborted`),!1):!0};class ne extends g{constructor(){super("alignItems","inherit",!0),this.isValidValue=Hs}}class oe extends g{constructor(){super("textAlign","inherit",!0),this.isValidValue=$s}}const Gs=["left","right","center","justify","justify-left","justify-right","justify-center"],$s=function(s){return Gs.indexOf(s)===-1?(console.warn(`(.style) textAlign value '${s}' is not valid. Aborted`),!1):!0};class ae extends g{constructor(){super("flexDirection","inherit",!0),this.isValid=Xs}}const js=["row","row-reverse","column","column-reverse"];function Xs(s){return js.indexOf(s)===-1?(console.warn(`(.style) flexDirection value '${s}' is not valid. Aborted`),!1):!0}class le extends g{constructor(){super("justifyContent","inherit",!0),this.isValidValue=Ns}}const Ys=["start","center","end","space-between","space-around","space-evenly"];function Ns(s){return Ys.indexOf(s)===-1?(console.warn(`(.style) justifyContent value '${s}' is not valid. Aborted`),!1):!0}class Ks extends g{constructor(){super("order",0,!0),this._value=0,this._input=0,this._allowsInherit=!1}computeOutputValue(e){this._value=this._inheritedInput,e._parent._value&&(e._parent._value._children._needsProcess=!0)}}class We extends g{constructor(){super("position","static",!0),this._allowsInherit=!1,this._value="static",this._needsUpdate=!1,this.computeOutputValue=this._computeFromInherited,this.isValidValue=Js}_computeFromInherited(e){super._computeFromInherited(e),e._parent._value&&(e._parent._value._children._needsProcess=!0)}}const qs=["static","absolute"];function Js(s){return qs.indexOf(s)===-1?(console.warn(`(.style) position value '${s}' is not valid. Aborted`),!1):!0}class De extends g{constructor(e,t=null){super(e,t,!0),this._input="auto",this._auto=!0,this._relative=!1,this._updateRequired=!0}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._inline=e,this._input!==this._inline&&this._parseInput())}get inline(){return this._inline}_parseInput(){let e=!0;if(this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0?(this._computed===this._input&&(e=!1),this._input=this._computed):e=this._input==="inherit",e){if(this._auto=!this._input||this._input==="auto",this._auto)this._relative=!1;else if((typeof this._input=="string"||this._input instanceof String)&&this._input.endsWith("%")){this._relative=!0,this._value=0;const t=parseFloat(this._input.replace("%","").trim());isNaN(t)||(this._value=t/100)}else this._relative=!1,this._value=this._input;this._needsUpdate=this._updateRequired=e}}update(e,t){if(this._updateRequired){this._updateRequired=!1,this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const i of e._children._uis)i[`_${this._id}`]._needsUpdate=!0;this.output(t),e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}computeOutputValue(e){e._bounds._needsUpdate=!0,e._renderer._needsRender=!0}getInheritedInput(e){if(this._input!=="inherit"&&!this._auto)return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return 0}get value(){return this._value}}class Qs extends De{constructor(){super("width")}}class Zs extends De{constructor(){super("height")}computeOutputValue(e){super.computeOutputValue(e)}}class Ee extends V{constructor(){super("textContent"),this._needsUpdate=!1}set value(e){}process(e){let t="";for(let i=0;i<e.children.length;i++){const r=e.children[i];r.isUI&&(t+=r.textContent)}this._value=t}}class Le extends g{constructor(e){super("fontStyle",e,!0),this.isValidValue=ti}}const ei=["normal","italic"];function ti(s){return ei.indexOf(s)===-1?(console.warn(`(.style) fontStyle value '${s}' is not valid. Aborted`),!1):!0}class He extends g{constructor(){super("fontWeight","inherit",!0),this.isValid=ii}}const si=["100","200","300","400","500","600","700","800","900","light","normal","bold","bolder"];function ii(s){return si.indexOf(s.toString())===-1?(console.warn(`(.style) fontWeight value '${s}' is not valid. Aborted`),!1):!0}class Ge{constructor(){this._size=42,this._lineHeight=42,this._lineBase=38,this._name="-",this._charset=""}get size(){return this._size}get lineHeight(){return this._lineHeight}get lineBase(){return this._lineBase}get name(){return this._name}get charset(){return this._charset}}class ri extends Ge{constructor(e){super(),this._size=e.info.size,this._lineHeight=e.common.lineHeight,this._lineBase=e.common.base,this._name=e.info.face,this._textureWidth=e.common.scaleW,this._textureHeight=e.common.scaleH,this._charset=e.chars.map(t=>t.char).join("")}get textureWidth(){return this._textureWidth}get textureHeight(){return this._textureHeight}}class ni extends Fe{constructor(e){super(e)}get uv(){return this.typographic.uv}}class q extends Te{constructor(e,t){super(e),this._char=t.char,this._width=t.width,this._heigth=t.height,this._xadvance=t.xadvance?t.xadvance:this._width,this._xoffset=t.xoffset?t.xoffset:0,this._yoffset=t.yoffset?t.yoffset:0,this._uv=t.uv?t.uv:null,isNaN(t.x)||(this._uv={left:t.x/e.textureWidth,right:(t.x+t.width)/e.textureWidth,top:1-(t.y+t.height)/e.textureHeight,bottom:1-t.y/e.textureHeight})}get uv(){return this._uv}clone(e){return new q(this._font,{char:e,width:this._width,height:this._heigth,xadvance:this._xadvance,xoffset:this._xoffset,yoffset:this._yoffset,uv:null})}asInlineGlyph(){return new ni(this)}}class oi extends a.PlaneGeometry{constructor(e,t){let i=1,r=1;const n=e.typographic.font.size,o=t._segments.value;i=Math.ceil(e.typographic.width/n*o),r=Math.ceil(e.typographic.height/n*o),super(e.width,e.height,i,r),e.uv?(this._mapUVs(e),this._transformGeometry(e)):(this._nullifyUVs(),this.scale(0,0,1),this.translate(0,e.fontSize/2,0)),this.name="GlyphGeometry"}_mapUVs(e){const t=e.uv.right-e.uv.left,i=e.uv.bottom-e.uv.top,r=this.getAttribute("uv").array.slice(),n=[];for(let o=0;o<r.length;o+=2){const h=r[o],c=r[o+1];n.push(e.uv.left+t*h),n.push(e.uv.top+i*c)}this.setAttribute("uvG",new a.BufferAttribute(new Float32Array(n),2))}_nullifyUVs(){const e=[],t=this.getAttribute("uv").array.length;for(let i=0;i<t;i++)e.push(0);this.setAttribute("uvG",new a.BufferAttribute(new Float32Array(e),2))}_transformGeometry(e){this.translate(e.width/2,-e.height/2,0)}}const ai=`
|
|
3
3
|
attribute vec2 uvG;
|
|
4
4
|
varying vec2 vUvG;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Mt=Object.defineProperty;var Ft=(i,e,t)=>e in i?Mt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var C=(i,e,t)=>Ft(i,typeof e!="symbol"?e+"":e,t);const m=require("./three-
|
|
1
|
+
"use strict";var Mt=Object.defineProperty;var Ft=(i,e,t)=>e in i?Mt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var C=(i,e,t)=>Ft(i,typeof e!="symbol"?e+"":e,t);const m=require("./three-B_hneGZr.umd.cjs");var k={};k.d=(i,e)=>{for(var t in e)k.o(e,t)&&!k.o(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:e[t]})};k.o=(i,e)=>Object.prototype.hasOwnProperty.call(i,e);k.r=i=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})};var v={};k.d(v,{ti:()=>p,nS:()=>xt,eB:()=>F,Yp:()=>ae,VB:()=>R,BC:()=>z,zN:()=>B,cV:()=>A,hW:()=>L,k2:()=>Ee,K6:()=>S,M7:()=>ue,ls:()=>W,Hi:()=>st,EY:()=>O,MR:()=>Ke,zf:()=>We,Ay:()=>qr,yo:()=>wt});var ae={};k.r(ae);k.d(ae,{get:()=>Le,set:()=>Ot});var ue={};k.r(ue);k.d(ue,{alphaTestTransformer:()=>q,asPreprocessorValueTransformer:()=>qe,toPreprocessorTriggerTransformer:()=>ye,toUserDataTransformer:()=>ji,uniformOrUserDataTransformer:()=>w});const ne={fontFamily:null,fontSize:.05,fontKerning:"auto",fontStyle:"normal",fontWeight:"normal",offset:.005,lineHeight:1.2,lineBreak:`- ,.:?!
|
|
2
2
|
`,whiteSpace:"pre-line",flexDirection:"column",justifyContent:"start",alignItems:"start",backgroundImage:null,textAlign:"left",boxSizing:"content-box",position:"static",color:16777215,fontColor:16777215,fontOpacity:1,opacity:1,fontPXRange:4,fontSupersampling:!0,fontSmooth:"antialiased",borderRadius:0,borderWidth:0,borderColor:"black",borderOpacity:1,backgroundSize:"cover",backgroundColor:0,backgroundOpacity:0,overflow:"visible",letterSpacing:0,invertAlpha:!1,segments:1},Ot=function(i){for(const e in i)ne[e]=i[e]},Le=function(i){return Object.prototype.hasOwnProperty.call(ne,i)||console.warn(`ThreeMeshUI::DefaultValues is trying to retrieve non-existing property '${i}'`),ne[i]};class p{constructor(e,t=null,s=!0){this._id=e,this._value=t,this._needsUpdate=!0,this._needsProcess=!1,this._needsRender=!1,this._isPrimitive=s}get id(){return this._id}get value(){return this._value}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}update(e,t){this.output(t)}output(e){}_outputValue(e){e[this._id]=this._value}process(e){}render(e){}getInheritedInput(e){if(this._value!=="inherit")return this._value;const t=e._parent._value;return t&&t[`_${this._id}`]?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return Le(this._id)}isValid(e){return!0}emptyStrategyLogic(){throw new Error(`ThreeMeshUI::${this.constructor.name} has empty strategy. Update has not been processed.`)}requestUpdate(){this._needsUpdate=!0}requestProcess(){this._needsProcess=!1}requestRender(){this._needsRender=!1}}class Lt extends p{constructor(){super("renderOrder","auto",!0),this.output=this._outputValue,this._actualValue=0}set value(e){this.isValid(e)&&(this._value=e,this._needsUpdate=!0)}update(e,t){if(this._value!=="auto")this._actualValue=this._value;else{const s=e._parent._value;if(s!==null){const r=s._renderOrder._actualValue,n=1+s._children._uis.indexOf(e);this._actualValue=r+n}}for(const s of e._children._uis)s._renderOrder._value==="auto"&&(s._renderOrder._needsUpdate=!0);this._outputValue(t)}_outputValue(e){e[this._id]=this._actualValue}get value(){return this._value}}class B extends p{constructor(e,t=null,s=!0){super(e,t,s),this.output=this._outputValue,this._notInheritedValue=null}update(e,t){this._notInheritedValue=this._value,this._notInheritedValue==="inherit"&&(this._notInheritedValue=this.getInheritedInput(e)),this.propagate(e),this._outputValue(t)}propagate(e){for(const t of e._children._uis){const s=t[`_${this._id}`];s!==void 0&&s._value==="inherit"&&(t[`_${this._id}`]._needsUpdate=!0)}}_outputValue(e){e[this._id]=this._notInheritedValue}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value==="inherit"?this._notInheritedValue:this._value}}class zt extends B{constructor(){super("offset","inherit",!1)}update(e,t){super.update(e,t),e._parent._value!==null&&(e.position.z=this._notInheritedValue)}}class Wt extends B{constructor(){super("fontSmooth","inherit",!0),this._needsUpdate=!1,this.isValid=Dt,this.output=this._outputValue}}const Et=["inherit","none","antialiased"];function Dt(i){return Et.indexOf(i)===-1?(console.warn(`.fontSmoothing value '${i}' is not valid. Aborted`),!1):!0}var Ht=i=>{var e={};return k.d(e,i),e};const u=Ht({BackSide:()=>m.BackSide,BufferAttribute:()=>m.BufferAttribute,BufferGeometry:()=>m.BufferGeometry,Color:()=>m.Color,DoubleSide:()=>m.DoubleSide,EventDispatcher:()=>m.EventDispatcher,FileLoader:()=>m.FileLoader,FrontSide:()=>m.FrontSide,LinearFilter:()=>m.LinearFilter,Mesh:()=>m.Mesh,MeshBasicMaterial:()=>m.MeshBasicMaterial,Object3D:()=>m.Object3D,Plane:()=>m.Plane,PlaneGeometry:()=>m.PlaneGeometry,ShaderMaterial:()=>m.ShaderMaterial,Texture:()=>m.Texture,TextureLoader:()=>m.TextureLoader,Vector2:()=>m.Vector2,Vector3:()=>m.Vector3,Vector4:()=>m.Vector4});class g extends p{constructor(e,t,s=!0){super(e,"unset",s),this._input="inherit",this._allowsInherit=!0,this._inheritedInput=void 0,this._inline=void 0}update(e,t){this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const s of e._children._uis){const r=s[`_${this._id}`];(r._input?r._input:r._value)==="inherit"&&(s[`_${this._id}`]._needsUpdate=!0)}this.output(t)}computeOutputValue(e){this._value=this._input}_computeFromInherited(e){this._value=this._inheritedInput}set value(e){console.warn(".(style) sub-property cannot be directly set. It must comes from inline or computed setter.")}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._input=this._inline=e,this._needsUpdate=!0)}get inline(){return this._inline}isValidValue(e){return!0}getInheritedInput(e){if(this._input!=="inherit")return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}}class K extends g{constructor(e,t){super(e,t,!1),this._input=new u.Vector4(0,0,0,0),this._inline=null,this._value=new u.Vector4(0,0,0,0)}get value(){return this._value}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input)}set inline(e){this._vector4ValueSetter(this._input,e),!this._input.equals(this._value)&&(this._needsUpdate=!0)}set top(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get top(){return this._input.x}set right(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get right(){return this._input.y}set bottom(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottom(){return this._input.z}set left(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get left(){return this._input.w}dispose(){this._computed=null,this._inline=null,this._input=null,this._output=null}_vector4ValueSetter(e,t){if(t instanceof u.Vector4){e.copy(t);return}if((typeof t=="string"||t instanceof String)&&(t=t.split(" ")),Array.isArray(t))switch(t=t.map(s=>parseFloat(s)),t.length){case 1:e.setScalar(t[0]);return;case 2:e.x=e.z=t[0],e.y=e.w=t[1];return;case 3:e.x=t[0],e.y=t[1],e.z=t[2];return;case 4:e.x=t[0],e.y=t[1],e.z=t[2],e.w=t[3];return;default:console.error("StyleVector4Property::set() Four Dimension property had more than four values");return}isNaN(t)||e.setScalar(t)}}class Gt extends K{constructor(){super("padding",new u.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._bounds._needsUpdate=!0,e._bounds._needsRender=!0,e._layouter._needsProcess=!0,e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}class $t extends K{constructor(){super("margin",new u.Vector4(0,0,0,0))}computeOutputValue(e){super.computeOutputValue(e),e._renderer._needsRender=!0,e._parent._value&&(e._parent._value._flexDirection._needsProcess=!0)}}const Re=function(i,e,t){i[e]=t},Nt=function(i,e,t){t!==null&&(i[e]=t)};class E{constructor(e){this._definition=e}set definition(e){this._definition=e}mediate(e,t,s,r=null){for(const n in this._definition){const o=this._definition[n];if(s[n]!==void 0){const a=o.t?o.t:Re;a(t,o.m,s[n]),r&&a(r,o.m,s[n])}}}static mediate(e,t,s,r,n=null){if(t)for(const o in r){const a=r[o];if(s[o]!==void 0){const l=a.t?a.t:Re;l(t,a.m,s[o]),n&&l(n,a.m,s[o])}}}}class Xt extends p{constructor(){super("parent",null,!1)}update(e,t){e.parent&&e.parent.isUI?this._value=e.parent:this._value=null}set value(e){console.warn("ParentProperty is readonly")}get value(){return this._value}find(e){return this._value?e(this._value)?this._value:this._value._parent.find(e):null}dispose(){this._value=null}}const oe=function(i,e,t=6){return i.toFixed(t)===e.toFixed(t)};class Be extends p{constructor(e,t){super(e,t,!0),this.output=this._outputValue}set value(e){this.isValid(e)&&(oe(this._value,e)||(this._value=e,this._needsUpdate=!0))}get value(){return this._value}}class Ue extends B{constructor(e){super(e,"inherit",!0),this.isValid=Yt}}const jt=[u.FrontSide,u.BackSide,u.DoubleSide];function Yt(i){return jt.indexOf(i)===-1?(console.warn(`SideProperty value '${i}' is not valid. Abort`),!1):!0}class ze{constructor(){this._offsetX=0,this._offsetY=0,this._lineBreak=null,this._kerning=0,this._fontFactor=1,this._fontSize=0,this._cumulativeWidth=0,this._paddingLeft=0,this._paddingRight=0,this._marginLeft=0,this._marginRight=0}resetOffsets(){this._offsetX=this._offsetY=0,this._cumulativeWidth=0}get xadvance(){return 0}get xoffset(){return 0}get yoffset(){return 0}get width(){return 0}get height(){return 0}set lineBreak(e){this._lineBreak=e}get lineBreak(){return this._lineBreak}get anchor(){return 0}get kerning(){return this._kerning*this._fontFactor}set kerning(e){this._kerning=e}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize=e}get lineHeight(){return 0}get offsetX(){return this._offsetX}set offsetX(e){this._offsetX=e}get offsetY(){return this._offsetY}set offsetY(e){this._offsetY=e}get cumulativeWidth(){return this._cumulativeWidth}set cumulativeWidth(e){this._cumulativeWidth=e}get marginLeft(){return this._marginLeft}set marginLeft(e){this._marginLeft=e}get marginRight(){return this._marginRight}set marginRight(e){this._marginRight=e}get paddingLeft(){return this._paddingLeft}set paddingLeft(e){this._paddingLeft=e}get paddingRight(){return this._paddingRight}set paddingRight(e){this._paddingRight=e}get lineBase(){return 0}set fontFactor(e){this._fontFactor=e}get fontFactor(){return this._fontFactor}}class We{constructor(e){this._char="",this._width=1,this._heigth=1,this._xadvance=1,this._xoffset=0,this._yoffset=0,this._font=e}get font(){return this._font}get char(){return this._char}get width(){return this._width}get height(){return this._heigth}get xadvance(){return this._xadvance}get xoffset(){return this._xoffset}get yoffset(){return this._yoffset}set yoffset(e){this._yoffset=e}clone(e){throw new Error("Abstract... Need to be implemented")}asInlineGlyph(){throw new Error("Abstract... Need to be implemented")}}class Ee extends ze{constructor(e){super(),this._typographic=e}get typographic(){return this._typographic}get xadvance(){return this._typographic.xadvance*this._fontFactor}get xoffset(){return this._typographic.xoffset*this._fontFactor}get yoffset(){return this._typographic.yoffset*this._fontFactor}get width(){return this._typographic.width*this._fontFactor}get height(){return this._typographic.height*this._fontFactor}get char(){return this._typographic.char}get anchor(){return this.yoffset}get lineHeight(){return this._typographic.font.lineHeight*this._fontFactor}get lineBase(){return this._typographic.font.lineBase*this._fontFactor}}const Kt={light:"100",normal:"400",bold:"700",bolder:"900"};function he(i){if(!isNaN(i))return i.toString();const e=Kt[i];return e||i}class qt extends u.EventDispatcher{constructor(e,t){super(),this._isReady=!1,this._weight=he(e),this._style=t,this._size=42,this._lineHeight=42,this._lineBase=42,this._font=null}get typographic(){return this._font}get isReady(){return this._isReady}get weight(){return this._weight}get style(){return this._style}get texture(){return this._texture}set fontMaterial(e){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get fontMaterial(){throw Error(`FontVariant('${this.id}')::fontMaterial - is abstract.`)}get id(){return`${this._name}(w:${this.weight},s:${this.style})`}getTypographicGlyph(e){let t=this._chars[e];if(t)return t;if(e.match(/\s/))return this._chars[" "];const s=this._getFallbackCharacter(e);if(s&&(t=this._chars[s],t))return t;throw Error(`FontVariant('${this.id}')::getTypographicGlyph() - character('${e}') and/or fallback character were not found in provided msdf charset.`)}_getFallbackCharacter(e){throw new Error(`FontVariant(${typeof this})::_getFallbackCharacter() is abstract and should therefore be overridden.`)}getGeometricGlyph(e,t){throw new Error(`FontVariant(${typeof this})::getGeometryCharacter() is abstract and should therefore be overridden.`)}getKerningAmount(e){return this._kernings[e]?this._kernings[e]:0}adjustTypographicGlyphs(e){for(const t in e){const s=this.getTypographicGlyph(t),r=e[t];for(const n in r)s["_"+n]=e[t][n]}}_checkReadiness(){this._readyCondition()&&Zt(this)}_alterElementProperties(e){throw new Error(`FontVariant(${typeof this})::_alterElementProperties() is abstract and should therefore be overridden.`)}_readyCondition(){throw new Error(`FontVariant(${typeof this})::_readyCondition() is abstract and should therefore be overridden.`)}}const Jt={type:"ready"};function Zt(i){i._isReady=!0,i.dispatchEvent(Jt)}const z=qt;class Qt extends p{constructor(e=null){super("font",e,!1),this._needsUpdate=!1,this._fontVariant=null,this._handleFontReadyClosure=null,this.isValid=ei}output(e){e[this._id]=this._fontVariant}update(e,t){if(this._fontVariant&&!this._fontVariant.isReady&&this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._value&&this._value instanceof z)this._fontVariant=this._value;else{const s=e._fontFamily._value;s&&(this._fontVariant=s.getVariant(e._fontWeight._value,e._fontStyle._value))}this._fontVariant&&(this._fontVariant._alterElementProperties(e),this._handleFontReadyClosure=ti(e,this),this._fontVariant.isReady?this._handleFontReadyClosure():this._fontVariant.addEventListener("ready",this._handleFontReadyClosure),(!e._fontMaterial._defaultMaterial||!(e._fontMaterial._defaultMaterial instanceof this._fontVariant.fontMaterial))&&(e._fontMaterial._defaultMaterial=new this._fontVariant.fontMaterial,e._fontMaterial._needsUpdate=!0))}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}get fontVariant(){return this._fontVariant}dispose(){this._handleFontReadyClosure&&(this._fontVariant.removeEventListener("ready",this._handleFontReadyClosure),this._handleFontReadyClosure=null),this._value=null,this._fontVariant=null}}function ei(i){return i instanceof z?!0:(console.warn(`.font value '${i}' is not valid. It requires a FontVariant instance. Aborted`),!1)}function ti(i,e){return function(){e._needsUpdate=!0,i._glyphs._needsProcess=!0,e._fontVariant.removeEventListener("ready",e._handleFontReadyClosure),e._handleFontReadyClosure=null}}class ii extends g{constructor(e){super("display",e),this._value="flex",this._allowsInherit=!1,this._needsUpdate=!1,this.isValidValue=ri}computeOutputValue(e){e._visible._value=this._output!=="none"}}const si=["none","flex"];function ri(i){return si.indexOf(i)===-1?(console.warn(`(.style) display value '${i}' is not valid. Aborted`),!1):!0}class ni extends g{constructor(e){super("boxSizing",e),this._allowsInherit=!1,this.isValidValue=ai}computeOutputValue(e){this._value=this._inheritedInput,e._bounds._needsUpdate=!0}}const oi=["border-box","content-box"];function ai(i){return oi.indexOf(i)===-1?(console.warn(`(.style) boxSizing value '${i}' is not valid. Aborted`),!1):!0}class T extends g{constructor(e,t){super(e,t,!1),this._value=new u.Color,this.output=this._outputValue}computeOutputValue(e){this._input!=="inherit"&&this._value.set(this._input)}set inline(e){this._input=this._inline=e,this._needsUpdate=!0}}class ee extends g{constructor(e,t){super(e,t,!0),this.isValidValue=ui,this._allowsInherit=!1,this._input=t,this._value=t,this.output=this._outputValue,this.computeOutputValue=this._computeFromInherited}_outputValue(e){e[this._id]=this._inheritedInput}}function ui(i){return i<0&&i>1?(console.warn(`(.style) styleFactorProperty('${this.id}') value '${i}' is not valid)`),!1):!0}class hi extends g{constructor(e){super("backgroundImage",e,!0),this._input=null,this._allowsInherit=!1,this._textureSize=new u.Vector2(1,1),this.isValidValue=li}get value(){return this._value}output(e){e[this._id]=this._value,e.tSize=this._textureSize}computeOutputValue(e){if(this._value=this._inheritedInput,this._value instanceof u.Texture&&!this._value.image){console.warn("ThreeMeshUI - .backgroundImage :: Please provide preloaded texture in order to have accurate sizing.");return}this._needsProcess=!0}process(e){this._value?this._textureSize.set(this._value.image.width,this._value.image.height):this._textureSize.set(1,1)}}function li(i){return!0}class ci extends g{constructor(e){super("backgroundSize",e,!0),this.isValidValue=_i,this.output=this._outputValue}}const di=["cover","contain","stretch"];function _i(i){return di.indexOf(i)===-1?(console.warn(`(.style) backgroundSize value '${i}' is not valid. Aborted`),!1):!0}class fi extends g{constructor(e){super("overflow",e,!0),this.isValidValue=gi,this._clippingPlanes=null,this._renderStrategy=this._emptyRender}update(e,t){this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0&&(this._input=this._computed),this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const s of e._children._uis)s._overflow._needsUpdate=!0;this.output(t)}output(e){e.clippingPlanes=this._clippingPlanes}computeOutputValue(e){super.computeOutputValue(e),this._value==="hidden"?this._renderStrategy=this._propagateRender:(this._renderStrategy=this._emptyRender,this._clippingPlanes=null);const t=e._parent._value;if(t!==null){const s=t._overflow;if((s._value==="hidden"||s._clippingPlanes!==null)&&!this._clippingPlanes){this._clippingPlanes=[new u.Plane(new u.Vector3(0,-1,0),1),new u.Plane(new u.Vector3(-1,0,0),1),new u.Plane(new u.Vector3(0,1,0),1),new u.Plane(new u.Vector3(1,0,0),1)];for(let r=0;r<this._clippingPlanes.length;r++)this._clippingPlanes[r].parent=t;s._clippingPlanes!==null&&this._clippingPlanes.push(...s._clippingPlanes),this._renderStrategy=this._hiddenRender,this._needsRender=!0}else(s._value==="visible"||s._clippingPlanes===null)&&this._clippingPlanes!==null&&(this._clippingPlanes=null,this._renderStrategy=this._emptyRender,this._needsRender=!0)}}render(e){this._renderStrategy(e)}_emptyRender(e){}_hiddenRender(e){const t=e._parent._value,s=t._bounds._offsetHeight,r=t._bounds._offsetWidth,n=t._padding._value,o=t._borderWidth._value;for(let a=0;a<4&&a<this._clippingPlanes.length;a++){const l=this._clippingPlanes[a];switch(a%4){case 0:l.constant=s/2-(n.x+o.x);break;case 1:l.constant=r/2-(n.y+o.y);break;case 2:l.constant=s/2-(n.z+o.z);break;case 3:l.constant=r/2-(n.w+o.w);break}l.applyMatrix4(t.matrixWorld)}for(let a=0;a<e._children._uis.length;a++){const l=e._children._uis[a];l._overflow._needsRender=!0}}_propagateRender(e){for(let t=0;t<e._children._uis.length;t++){const s=e._children._uis[t];s._overflow._needsRender=!0}}}const pi=["visible","hidden"];function gi(i){return pi.indexOf(i)===-1?(console.warn(`(.style) overflow value '${i}' is not valid. Aborted`),!1):!0}const U="rem",De="em",N="%",mi=[U,De,N],He=function(i){return mi.indexOf(i)===-1?U:i};class vi extends K{constructor(e){super("borderRadius",e),this._valueUV=this._value.clone(),this._input=new u.Vector4(0,0,0,0),this._mediation=!0,this._cornerTL=new u.Vector2(0,1),this._cornerTR=new u.Vector2(1,1),this._cornerBR=new u.Vector2(1,0),this._cornerBL=new u.Vector2(0,0);const t=new D(this._valueUV,["x","y"]),s=new D(this._valueUV,["z","w"]),r=new D(this._valueUV,["x","w"]),n=new D(this._valueUV,["y","z"]);t.complementaryMediation=s,s.complementaryMediation=t,r.complementaryMediation=n,n.complementaryMediation=r,this._sideMediators=[t,s,r,n],this._units=U}set units(e){this._units=He(e),this._needsProcess=!0}get units(){return this._units}set mediation(e){e!==this._mediation&&(this._mediation=e,this._needsUpdate=!0)}get mediation(){return this._mediation}output(e){e.cornerTL=this._cornerTL,e.cornerTR=this._cornerTR,e.cornerBR=this._cornerBR,e.cornerBL=this._cornerBL}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0}process(e){this._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,s=e._bounds._offsetHeight;if(this._units===N&&this._valueUV.divideScalar(100),this._units===U&&this._valueUV.divideScalar(Math.min(t,s)),this._mediation)do this._sideMediators.forEach(o=>o.computeValue()),this._sideMediators.sort((o,a)=>o.value<a.value?1:-1),this._sideMediators[0].value>1&&this._sideMediators[0].mediate();while(this._sideMediators[0].value>1);let r=t>s?s/t:1,n=t<s?t/s:1;this._units===N&&(r=n=1),this._cornerTL.x=this._valueUV.x*r,this._cornerTL.y=1-this._valueUV.x*n,this._cornerTR.x=1-this._valueUV.y*r,this._cornerTR.y=1-this._valueUV.y*n,this._cornerBR.x=1-this._valueUV.z*r,this._cornerBR.y=this._valueUV.z*n,this._cornerBL.x=this._valueUV.w*r,this._cornerBL.y=this._valueUV.w*n}dispose(){for(const e of this._sideMediators)e.dispose();this._sideMediators=null,this._cornerTL=null,this._cornerTR=null,this._cornerBR=null,this._cornerBL=null,super.dispose()}set topLeft(e){this._input.x!==e&&(this._input.x=e,this._needsUpdate=!0)}get topLeft(){return this._input.x}set topRight(e){this._input.y!==e&&(this._input.y=e,this._needsUpdate=!0)}get topRight(){return this._input.y}set bottomRight(e){this._input.z!==e&&(this._input.z=e,this._needsUpdate=!0)}get bottomRight(){return this._input.z}set bottomLeft(e){this._input.w!==e&&(this._input.w=e,this._needsUpdate=!0)}get bottomLeft(){return this._input.w}set top(e){this._input.x===e&&this._input.y===e||(this._input.x=this._input.y=e,this._needsUpdate=!0)}get top(){return(this._input.x+this._input.y)/2}set right(e){this._input.y===e&&this._input.z===e||(this._input.y=this._input.z=e,this._needsUpdate=!0)}get right(){return(this._input.y+this._input.z)/2}set bottom(e){this._input.z===e&&this._input.w===e||(this._input.z=this._input.w=e,this._needsUpdate=!0)}get bottom(){return(this._input.z+this._input.w)/2}set left(e){this._input.w===e&&this._input.x===e||(this._input.w=this._input.x=e,this._needsUpdate=!0)}get left(){return(this._input.w+this._input.x)/2}}class D{constructor(e,t){this._borderRadiuses=e,this._sideProperties=t,this._complementaryMediation=null,this._value=0}get value(){return this._value}set complementaryMediation(e){this._complementaryMediation=e}computeValue(){let e=0;for(const t of this._sideProperties)e+=this._borderRadiuses[t];this._value=e}mediate(e=!0){if(!(this._value<1)){for(const t of this._sideProperties)this._borderRadiuses[t]/=this._value;e&&this._complementaryMediation.mediate(!1)}}dispose(){this._complementaryMediation=null,this._borderRadiuses=null}}class yi extends K{constructor(e){super("borderWidth",e,!1),this._valueUV=this._value.clone(),this.output=this._outputValue,this._units=U}set units(e){this._units=He(e),this._needsUpdate=!0}get units(){return this._units}computeOutputValue(e){this._vector4ValueSetter(this._value,this._input),this._needsProcess=!0,e._bounds._needsUpdate=!0,e._layouter._needsUpdate=!0}_outputValue(e){e[this._id]=this._valueUV}process(e){this._needsRender=!0,e._borderRadius._needsRender=!0}render(e){this._valueUV.copy(this._value);const t=e._bounds._offsetWidth,s=e._bounds._offsetHeight;if(this._units===N&&(console.log("Percent"),console.log(this._valueUV)),this._units===U)t!==0&&(this._valueUV.w/=t,this._valueUV.y/=t),s!==0&&(this._valueUV.x/=s,this._valueUV.z/=s);else if(this._units===De){if(t!==0){const r=t>s?s/t:1;this._valueUV.y*=r,this._valueUV.w*=r}if(s!==0){const r=t<s?t/s:1;this._valueUV.x*=r,this._valueUV.z*=r}}}}class bi extends p{constructor(e,t=!0){super("visible",t,!0),this._needsUpdate=!1}update(e,t){e.visible=this._value,e._parent._value&&(e._parent._value._children._needsUpdate=!0)}set value(e){this.isValid(e)&&this._value!==e&&(this._value=e,this._needsUpdate=!0)}get value(){return this._value}}class Ge extends T{constructor(e){super("backgroundColor",e,!1),this._input="transparent",this._allowsInherit=!1}computeOutputValue(e){e._backgroundMesh.visible=!(this._input==="none"||this._input==="transparent"),this._input==="inherit"?this._value.set(this.getInheritedInput(e)):this._input==="transparent"||this._input==="none"||this._value.set(this._input)}}class I extends p{constructor(e="untitled"){super(e,void 0,!1)}update(e,t){}output(e){}}class xi extends p{constructor(){super("inlineJustificator",null,!1),this._value=null}update(e,t){}process(e){const t=e._bounds._innerHeight,s=e._layouter._value,r=Math.abs(s.height);let n=(()=>{switch(e._alignItems._value){case"inherit":case"start":return t/2;case"end":return r-t/2;case"stretch":case"center":return r/2}})();const o=e._padding._value,a=e._borderWidth._value;n+=(-o.x+o.z)/2+(-a.x+a.z)/2,s.forEach(l=>{l.y+=n,l.forEach(d=>{d.offsetY+=n})})}}const wi=["start","center","end","stretch"],Si=function(i){return wi.indexOf(i)===-1?(console.warn(`(.style) alignItems value '${i}' is not valid. Aborted`),!1):!0};class le extends g{constructor(){super("alignItems","inherit",!0),this.isValidValue=Si}}class ce extends g{constructor(){super("textAlign","inherit",!0),this.isValidValue=ki}}const Vi=["left","right","center","justify","justify-left","justify-right","justify-center"],ki=function(i){return Vi.indexOf(i)===-1?(console.warn(`(.style) textAlign value '${i}' is not valid. Aborted`),!1):!0};class de extends g{constructor(){super("flexDirection","inherit",!0),this.isValid=Ii}}const Pi=["row","row-reverse","column","column-reverse"];function Ii(i){return Pi.indexOf(i)===-1?(console.warn(`(.style) flexDirection value '${i}' is not valid. Aborted`),!1):!0}class _e extends g{constructor(){super("justifyContent","inherit",!0),this.isValidValue=Ri}}const Ci=["start","center","end","space-between","space-around","space-evenly"];function Ri(i){return Ci.indexOf(i)===-1?(console.warn(`(.style) justifyContent value '${i}' is not valid. Aborted`),!1):!0}class Bi extends g{constructor(){super("order",0,!0),this._value=0,this._input=0,this._allowsInherit=!1}computeOutputValue(e){this._value=this._inheritedInput,e._parent._value&&(e._parent._value._children._needsProcess=!0)}}class $e extends g{constructor(){super("position","static",!0),this._allowsInherit=!1,this._value="static",this._needsUpdate=!1,this.computeOutputValue=this._computeFromInherited,this.isValidValue=Ai}_computeFromInherited(e){super._computeFromInherited(e),e._parent._value&&(e._parent._value._children._needsProcess=!0)}}const Ui=["static","absolute"];function Ai(i){return Ui.indexOf(i)===-1?(console.warn(`(.style) position value '${i}' is not valid. Aborted`),!1):!0}class Ne extends g{constructor(e,t=null){super(e,t,!0),this._input="auto",this._auto=!0,this._relative=!1,this._updateRequired=!0}set inline(e){this.isValidValue(e)&&e!==this._inline&&(this._inline=e,this._input!==this._inline&&this._parseInput())}get inline(){return this._inline}_parseInput(){let e=!0;if(this._inline!==void 0&&this._inline!=="unset"?this._input=this._inline:this._computed!==void 0?(this._computed===this._input&&(e=!1),this._input=this._computed):e=this._input==="inherit",e){if(this._auto=!this._input||this._input==="auto",this._auto)this._relative=!1;else if((typeof this._input=="string"||this._input instanceof String)&&this._input.endsWith("%")){this._relative=!0,this._value=0;const t=parseFloat(this._input.replace("%","").trim());isNaN(t)||(this._value=t/100)}else this._relative=!1,this._value=this._input;this._needsUpdate=this._updateRequired=e}}update(e,t){if(this._updateRequired){this._updateRequired=!1,this._allowsInherit||(this._inheritedInput=this.getInheritedInput(e)),this.computeOutputValue(e);for(const s of e._children._uis)s[`_${this._id}`]._needsUpdate=!0;this.output(t),e._parent._value&&(e._parent._value._layouter._needsProcess=!0)}}computeOutputValue(e){e._bounds._needsUpdate=!0,e._renderer._needsRender=!0}getInheritedInput(e){if(this._input!=="inherit"&&!this._auto)return this._input;const t=e._parent._value;return t?t[`_${this._id}`].getInheritedInput(t):this.getDefaultValue()}getDefaultValue(){return 0}get value(){return this._value}}class Ti extends Ne{constructor(){super("width")}}class Mi extends Ne{constructor(){super("height")}computeOutputValue(e){super.computeOutputValue(e)}}class Xe extends I{constructor(){super("textContent"),this._needsUpdate=!1}set value(e){}process(e){let t="";for(let s=0;s<e.children.length;s++){const r=e.children[s];r.isUI&&(t+=r.textContent)}this._value=t}}class je extends g{constructor(e){super("fontStyle",e,!0),this.isValidValue=Oi}}const Fi=["normal","italic"];function Oi(i){return Fi.indexOf(i)===-1?(console.warn(`(.style) fontStyle value '${i}' is not valid. Aborted`),!1):!0}class Ye extends g{constructor(){super("fontWeight","inherit",!0),this.isValid=zi}}const Li=["100","200","300","400","500","600","700","800","900","light","normal","bold","bolder"];function zi(i){return Li.indexOf(i.toString())===-1?(console.warn(`(.style) fontWeight value '${i}' is not valid. Aborted`),!1):!0}class Ke{constructor(){this._size=42,this._lineHeight=42,this._lineBase=38,this._name="-",this._charset=""}get size(){return this._size}get lineHeight(){return this._lineHeight}get lineBase(){return this._lineBase}get name(){return this._name}get charset(){return this._charset}}class Wi extends Ke{constructor(e){super(),this._size=e.info.size,this._lineHeight=e.common.lineHeight,this._lineBase=e.common.base,this._name=e.info.face,this._textureWidth=e.common.scaleW,this._textureHeight=e.common.scaleH,this._charset=e.chars.map(t=>t.char).join("")}get textureWidth(){return this._textureWidth}get textureHeight(){return this._textureHeight}}class Ei extends Ee{constructor(e){super(e)}get uv(){return this.typographic.uv}}class X extends We{constructor(e,t){super(e),this._char=t.char,this._width=t.width,this._heigth=t.height,this._xadvance=t.xadvance?t.xadvance:this._width,this._xoffset=t.xoffset?t.xoffset:0,this._yoffset=t.yoffset?t.yoffset:0,this._uv=t.uv?t.uv:null,isNaN(t.x)||(this._uv={left:t.x/e.textureWidth,right:(t.x+t.width)/e.textureWidth,top:1-(t.y+t.height)/e.textureHeight,bottom:1-t.y/e.textureHeight})}get uv(){return this._uv}clone(e){return new X(this._font,{char:e,width:this._width,height:this._heigth,xadvance:this._xadvance,xoffset:this._xoffset,yoffset:this._yoffset,uv:null})}asInlineGlyph(){return new Ei(this)}}class Di extends u.PlaneGeometry{constructor(e,t){let s=1,r=1;const n=e.typographic.font.size,o=t._segments.value;s=Math.ceil(e.typographic.width/n*o),r=Math.ceil(e.typographic.height/n*o),super(e.width,e.height,s,r),e.uv?(this._mapUVs(e),this._transformGeometry(e)):(this._nullifyUVs(),this.scale(0,0,1),this.translate(0,e.fontSize/2,0)),this.name="GlyphGeometry"}_mapUVs(e){const t=e.uv.right-e.uv.left,s=e.uv.bottom-e.uv.top,r=this.getAttribute("uv").array.slice(),n=[];for(let o=0;o<r.length;o+=2){const a=r[o],l=r[o+1];n.push(e.uv.left+t*a),n.push(e.uv.top+s*l)}this.setAttribute("uvG",new u.BufferAttribute(new Float32Array(n),2))}_nullifyUVs(){const e=[],t=this.getAttribute("uv").array.length;for(let s=0;s<t;s++)e.push(0);this.setAttribute("uvG",new u.BufferAttribute(new Float32Array(e),2))}_transformGeometry(e){this.translate(e.width/2,-e.height/2,0)}}const Hi=`
|
|
3
3
|
attribute vec2 uvG;
|
|
4
4
|
varying vec2 vUvG;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var It = Object.defineProperty;
|
|
2
2
|
var Ct = (i, e, t) => e in i ? It(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var I = (i, e, t) => Ct(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { Vector4 as Rt, Vector3 as Bt, Vector2 as Ut, TextureLoader as At, Texture as Tt, ShaderMaterial as Mt, PlaneGeometry as Ft, Plane as Ot, Object3D as Lt, MeshBasicMaterial as zt, Mesh as Wt, LinearFilter as Et, FrontSide as Dt, FileLoader as Ht, EventDispatcher as Gt, DoubleSide as $t, Color as Nt, BufferGeometry as Xt, BufferAttribute as jt, BackSide as Yt } from "./three-
|
|
4
|
+
import { Vector4 as Rt, Vector3 as Bt, Vector2 as Ut, TextureLoader as At, Texture as Tt, ShaderMaterial as Mt, PlaneGeometry as Ft, Plane as Ot, Object3D as Lt, MeshBasicMaterial as zt, Mesh as Wt, LinearFilter as Et, FrontSide as Dt, FileLoader as Ht, EventDispatcher as Gt, DoubleSide as $t, Color as Nt, BufferGeometry as Xt, BufferAttribute as jt, BackSide as Yt } from "./three-DrqIzZTH.js";
|
|
5
5
|
var V = {};
|
|
6
6
|
V.d = (i, e) => {
|
|
7
7
|
for (var t in e)
|