@needle-tools/engine 4.12.0-beta.1 → 4.12.0-next.c6c0281

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.
Files changed (129) hide show
  1. package/components.needle.json +1 -1
  2. package/dist/{generateMeshBVH.worker-mO20N_b8.js → generateMeshBVH.worker-BvGEI0r7.js} +4 -4
  3. package/dist/{gltf-progressive-DZrY8VT6.min.js → gltf-progressive-BmSygnAC.min.js} +2 -2
  4. package/dist/{gltf-progressive-DgYz5BYa.js → gltf-progressive-DnLBuGK5.js} +24 -24
  5. package/dist/{gltf-progressive-DWcmTMCh.umd.cjs → gltf-progressive-Rs-ojtXy.umd.cjs} +1 -1
  6. package/dist/{loader.worker-Dip-PthR.js → loader.worker-DWzfDpAl.js} +4 -4
  7. package/dist/{needle-engine.bundle-BxG30KEV.js → needle-engine.bundle-BVdPECIB.js} +1106 -1167
  8. package/dist/{needle-engine.bundle-C08Ag6_H.umd.cjs → needle-engine.bundle-Dk2U2sIu.umd.cjs} +76 -77
  9. package/dist/{needle-engine.bundle-BeTUOBiO.min.js → needle-engine.bundle-ThW_g39D.min.js} +80 -81
  10. package/dist/needle-engine.d.ts +96 -40
  11. package/dist/needle-engine.js +4 -4
  12. package/dist/needle-engine.min.js +1 -1
  13. package/dist/needle-engine.umd.cjs +1 -1
  14. package/dist/{postprocessing-DYDtB188.min.js → postprocessing-B5ksn9-G.min.js} +54 -54
  15. package/dist/{postprocessing-CMgoN5t5.umd.cjs → postprocessing-DZtb9Nnn.umd.cjs} +81 -81
  16. package/dist/{postprocessing-BTW9pD_s.js → postprocessing-__7s9wON.js} +450 -441
  17. package/dist/{three-DfMvBzXi.js → three-BCCkyCA5.js} +1 -7
  18. package/dist/{three-qj71I7J3.umd.cjs → three-Bf2NBxAw.umd.cjs} +2 -2
  19. package/dist/{three-B7CT31Bt.min.js → three-W7zWTcfP.min.js} +1 -1
  20. package/dist/{three-examples-CsW4_6LI.umd.cjs → three-examples-Dho7cuu4.umd.cjs} +4 -4
  21. package/dist/{three-examples-D1P7eEhn.min.js → three-examples-MsJjauyk.min.js} +10 -10
  22. package/dist/{three-examples-D1SK93ek.js → three-examples-y2GeYlze.js} +2 -20
  23. package/dist/{three-mesh-ui-C_uSB5dD.js → three-mesh-ui-3nSSizT4.js} +1 -1
  24. package/dist/{three-mesh-ui-LQ44s0AL.min.js → three-mesh-ui-CIez6qJQ.min.js} +1 -1
  25. package/dist/{three-mesh-ui-DpATDXwU.umd.cjs → three-mesh-ui-zsOOA5Pq.umd.cjs} +1 -1
  26. package/dist/vendor-BiJQtqow.min.js +1116 -0
  27. package/dist/{vendor-D0zoswDa.js → vendor-C_oHRUjX.js} +2686 -2663
  28. package/dist/{vendor-UCpFAwt1.umd.cjs → vendor-DN-NsXVB.umd.cjs} +30 -30
  29. package/lib/engine/codegen/register_types.js +0 -2
  30. package/lib/engine/codegen/register_types.js.map +1 -1
  31. package/lib/engine/engine_license.js +3 -9
  32. package/lib/engine/engine_license.js.map +1 -1
  33. package/lib/engine/engine_physics_rapier.js +1 -1
  34. package/lib/engine/engine_physics_rapier.js.map +1 -1
  35. package/lib/engine/extensions/extensions.d.ts +29 -7
  36. package/lib/engine/extensions/extensions.js.map +1 -1
  37. package/lib/engine/webcomponents/needle menu/needle-menu.js +4 -5
  38. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  39. package/lib/engine/webcomponents/needle-engine.js +1 -1
  40. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  41. package/lib/engine-components/AlignmentConstraint.d.ts +1 -1
  42. package/lib/engine-components/AlignmentConstraint.js +1 -1
  43. package/lib/engine-components/Animation.d.ts +1 -1
  44. package/lib/engine-components/Animation.js +1 -1
  45. package/lib/engine-components/Animator.d.ts +1 -1
  46. package/lib/engine-components/Animator.js +1 -1
  47. package/lib/engine-components/AudioListener.d.ts +1 -1
  48. package/lib/engine-components/AudioListener.js +1 -1
  49. package/lib/engine-components/AudioSource.d.ts +1 -1
  50. package/lib/engine-components/AudioSource.js +1 -1
  51. package/lib/engine-components/Camera.d.ts +1 -1
  52. package/lib/engine-components/Camera.js +1 -1
  53. package/lib/engine-components/CharacterController.d.ts +6 -2
  54. package/lib/engine-components/CharacterController.js +6 -2
  55. package/lib/engine-components/CharacterController.js.map +1 -1
  56. package/lib/engine-components/Collider.d.ts +1 -1
  57. package/lib/engine-components/Collider.js.map +1 -1
  58. package/lib/engine-components/Joints.d.ts +14 -0
  59. package/lib/engine-components/Joints.js +14 -0
  60. package/lib/engine-components/Joints.js.map +1 -1
  61. package/lib/engine-components/LookAtConstraint.d.ts +1 -1
  62. package/lib/engine-components/LookAtConstraint.js +1 -1
  63. package/lib/engine-components/OrbitControls.d.ts +1 -1
  64. package/lib/engine-components/OrbitControls.js +1 -1
  65. package/lib/engine-components/Renderer.d.ts +6 -0
  66. package/lib/engine-components/Renderer.js +6 -0
  67. package/lib/engine-components/Renderer.js.map +1 -1
  68. package/lib/engine-components/RendererInstancing.js +5 -3
  69. package/lib/engine-components/RendererInstancing.js.map +1 -1
  70. package/lib/engine-components/SceneSwitcher.js +18 -14
  71. package/lib/engine-components/SceneSwitcher.js.map +1 -1
  72. package/lib/engine-components/SpriteRenderer.d.ts +2 -1
  73. package/lib/engine-components/SpriteRenderer.js +2 -1
  74. package/lib/engine-components/SpriteRenderer.js.map +1 -1
  75. package/lib/engine-components/api.d.ts +1 -0
  76. package/lib/engine-components/api.js +1 -0
  77. package/lib/engine-components/api.js.map +1 -1
  78. package/lib/engine-components/codegen/components.d.ts +0 -1
  79. package/lib/engine-components/codegen/components.js +0 -1
  80. package/lib/engine-components/codegen/components.js.map +1 -1
  81. package/lib/engine-components/timeline/SignalAsset.d.ts +1 -1
  82. package/lib/engine-components/timeline/SignalAsset.js +1 -1
  83. package/lib/engine-components/ui/Raycaster.d.ts +3 -2
  84. package/lib/engine-components/ui/Raycaster.js +3 -2
  85. package/lib/engine-components/ui/Raycaster.js.map +1 -1
  86. package/lib/engine-components/ui/RectTransform.d.ts +6 -0
  87. package/lib/engine-components/ui/RectTransform.js +6 -0
  88. package/lib/engine-components/ui/RectTransform.js.map +1 -1
  89. package/lib/engine-components/utils/LookAt.d.ts +2 -1
  90. package/lib/engine-components/utils/LookAt.js +2 -1
  91. package/lib/engine-components/utils/LookAt.js.map +1 -1
  92. package/lib/engine-components/web/CursorFollow.d.ts +1 -1
  93. package/lib/engine-components/web/CursorFollow.js +1 -1
  94. package/lib/engine-components/web/HoverAnimation.d.ts +1 -1
  95. package/lib/engine-components/web/HoverAnimation.js +1 -1
  96. package/lib/engine-components/web/ViewBox.d.ts +1 -1
  97. package/lib/engine-components/web/ViewBox.js +1 -1
  98. package/package.json +2 -2
  99. package/src/engine/codegen/register_types.ts +0 -2
  100. package/src/engine/engine_license.ts +3 -8
  101. package/src/engine/engine_physics_rapier.ts +1 -1
  102. package/src/engine/extensions/extensions.ts +30 -6
  103. package/src/engine/webcomponents/needle menu/needle-menu.ts +4 -5
  104. package/src/engine/webcomponents/needle-engine.ts +2 -2
  105. package/src/engine-components/AlignmentConstraint.ts +1 -1
  106. package/src/engine-components/Animation.ts +1 -1
  107. package/src/engine-components/Animator.ts +1 -1
  108. package/src/engine-components/AudioListener.ts +1 -1
  109. package/src/engine-components/AudioSource.ts +1 -1
  110. package/src/engine-components/Camera.ts +1 -1
  111. package/src/engine-components/CharacterController.ts +6 -2
  112. package/src/engine-components/Collider.ts +1 -1
  113. package/src/engine-components/Joints.ts +14 -0
  114. package/src/engine-components/LookAtConstraint.ts +1 -1
  115. package/src/engine-components/OrbitControls.ts +1 -1
  116. package/src/engine-components/Renderer.ts +6 -0
  117. package/src/engine-components/RendererInstancing.ts +6 -3
  118. package/src/engine-components/SceneSwitcher.ts +17 -17
  119. package/src/engine-components/SpriteRenderer.ts +2 -1
  120. package/src/engine-components/api.ts +2 -1
  121. package/src/engine-components/codegen/components.ts +0 -1
  122. package/src/engine-components/timeline/SignalAsset.ts +1 -1
  123. package/src/engine-components/ui/Raycaster.ts +3 -2
  124. package/src/engine-components/ui/RectTransform.ts +6 -0
  125. package/src/engine-components/utils/LookAt.ts +2 -1
  126. package/src/engine-components/web/CursorFollow.ts +1 -1
  127. package/src/engine-components/web/HoverAnimation.ts +1 -1
  128. package/src/engine-components/web/ViewBox.ts +1 -1
  129. package/dist/vendor-BKGa4GE0.min.js +0 -1116
@@ -1,4 +1,4 @@
1
- "use strict";const r=require("./three-qj71I7J3.umd.cjs");class Qo extends r.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 r.SphereGeometry(s,2*n,n);i.scale(1,1,-1);const o=i.getAttribute("position"),a=new r.Vector3;for(let A=0;A<o.count;++A)if(a.fromBufferAttribute(o,A),a.y<0){const l=-t*3/2,h=a.y<l?-t/a.y:1-a.y*a.y/(3*l*l);a.multiplyScalar(h),a.toArray(o.array,3*A)}o.needsUpdate=!0,super(i,new r.MeshBasicMaterial({map:e,depthWrite:!1}))}}class be extends r.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 r.NodeFrame;Ue.camera=new r.PerspectiveCamera;const us={LineBasicNodeMaterial:r.ShaderLib.basic,MeshBasicNodeMaterial:r.ShaderLib.basic,PointsNodeMaterial:r.ShaderLib.points,MeshStandardNodeMaterial:r.ShaderLib.standard,MeshPhysicalNodeMaterial:r.ShaderLib.physical,MeshPhongNodeMaterial:r.ShaderLib.phong},xo={atan2:"atan"},So={low:"lowp",medium:"mediump",high:"highp"};function ut(c){return`#include <${c}>`}function Ft(c){return`${c}Shader`}class To extends r.NodeBuilder{constructor(e,t,s,n=null){super(e,t,new r.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"),us[t]!==void 0){const s=us[t],n=this.shader;n.vertexShader=s.vertexShader,n.fragmentShader=s.fragmentShader,n.uniforms=r.UniformsUtils.merge([s.uniforms,r.UniformsLib.lights])}}_parseObject(){const{material:e,renderer:t}=this;this.addSlot("fragment",new be({node:r.normalView,nodeType:"vec3",source:"void main() {",target:"vec3 TransformedNormalView = %RESULT%;",inclusionType:"append"})),t.toneMappingNode&&t.toneMappingNode.isNode===!0&&this.addSlot("fragment",new be({node:e.colorNode,nodeType:"vec4",source:ut("tonemapping_fragment"),target:""})),e.colorNode&&e.colorNode.isNode&&this.addSlot("fragment",new be({node:e.colorNode,nodeType:"vec4",source:"vec4 diffuseColor = vec4( diffuse, opacity );",target:"vec4 diffuseColor = %RESULT%; diffuseColor.a *= opacity;"})),e.opacityNode&&e.opacityNode.isNode&&this.addSlot("fragment",new be({node:e.opacityNode,nodeType:"float",source:ut("alphatest_fragment"),target:"diffuseColor.a = %RESULT%;",inclusionType:"append"})),e.normalNode&&e.normalNode.isNode&&this.addSlot("fragment",new be({node:e.normalNode,nodeType:"vec3",source:ut("normal_fragment_begin"),target:"normal = %RESULT%;",inclusionType:"append"})),e.emissiveNode&&e.emissiveNode.isNode&&this.addSlot("fragment",new be({node:e.emissiveNode,nodeType:"vec3",source:ut("emissivemap_fragment"),target:"totalEmissiveRadiance = %RESULT%;",inclusionType:"append"})),e.isMeshStandardNodeMaterial&&(e.metalnessNode&&e.metalnessNode.isNode&&this.addSlot("fragment",new be({node:e.metalnessNode,nodeType:"float",source:ut("metalnessmap_fragment"),target:"metalnessFactor = %RESULT%;",inclusionType:"append"})),e.roughnessNode&&e.roughnessNode.isNode&&this.addSlot("fragment",new be({node:e.roughnessNode,nodeType:"float",source:ut("roughnessmap_fragment"),target:"roughnessFactor = %RESULT%;",inclusionType:"append"})),e.isMeshPhysicalNodeMaterial&&(e.clearcoatNode&&e.clearcoatNode.isNode?(this.addSlot("fragment",new be({node:e.clearcoatNode,nodeType:"float",source:"material.clearcoat = clearcoat;",target:"material.clearcoat = %RESULT%;"})),e.clearcoatRoughnessNode&&e.clearcoatRoughnessNode.isNode&&this.addSlot("fragment",new be({node:e.clearcoatRoughnessNode,nodeType:"float",source:"material.clearcoatRoughness = clearcoatRoughness;",target:"material.clearcoatRoughness = %RESULT%;"})),e.clearcoatNormalNode&&e.clearcoatNormalNode.isNode&&this.addSlot("fragment",new be({node:e.clearcoatNormalNode,nodeType:"vec3",source:"vec3 clearcoatNormal = nonPerturbedNormal;",target:"vec3 clearcoatNormal = %RESULT%;"})),e.defines.USE_CLEARCOAT=""):delete e.defines.USE_CLEARCOAT,e.sheenNode&&e.sheenNode.isNode?(this.addSlot("fragment",new be({node:e.sheenNode,nodeType:"vec3",source:"material.sheenColor = sheenColor;",target:"material.sheenColor = %RESULT%;"})),e.sheenRoughnessNode&&e.sheenRoughnessNode.isNode&&this.addSlot("fragment",new be({node:e.sheenRoughnessNode,nodeType:"float",source:"material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );",target:"material.sheenRoughness = clamp( %RESULT%, 0.07, 1.0 );"})),e.defines.USE_SHEEN=""):delete e.defines.USE_SHEEN,e.iridescenceNode&&e.iridescenceNode.isNode?(this.addSlot("fragment",new be({node:e.iridescenceNode,nodeType:"float",source:"material.iridescence = iridescence;",target:"material.iridescence = %RESULT%;"})),e.iridescenceIORNode&&e.iridescenceIORNode.isNode&&this.addSlot("fragment",new be({node:e.iridescenceIORNode,nodeType:"float",source:"material.iridescenceIOR = iridescenceIOR;",target:"material.iridescenceIOR = %RESULT%;"})),e.iridescenceThicknessNode&&e.iridescenceThicknessNode.isNode&&this.addSlot("fragment",new be({node:e.iridescenceThicknessNode,nodeType:"float",source:"material.iridescenceThickness = iridescenceThicknessMaximum;",target:"material.iridescenceThickness = %RESULT%;"})),e.defines.USE_IRIDESCENCE=""):delete e.defines.USE_IRIDESCENCE,e.iorNode&&e.iorNode.isNode&&this.addSlot("fragment",new be({node:e.iorNode,nodeType:"float",source:"material.ior = ior;",target:"material.ior = %RESULT%;"})),e.specularColorNode&&e.specularColorNode.isNode&&this.addSlot("fragment",new be({node:e.specularColorNode,nodeType:"vec3",source:"vec3 specularColorFactor = specularColor;",target:"vec3 specularColorFactor = %RESULT%;"})),e.specularIntensityNode&&e.specularIntensityNode.isNode&&this.addSlot("fragment",new be({node:e.specularIntensityNode,nodeType:"float",source:"float specularIntensityFactor = specularIntensity;",target:"float specularIntensityFactor = %RESULT%;"})),e.transmissionNode&&e.transmissionNode.isNode?(this.addSlot("fragment",new be({node:e.transmissionNode,nodeType:"float",source:"material.transmission = transmission;",target:"material.transmission = %RESULT%;"})),e.thicknessNode&&e.thicknessNode.isNode&&this.addSlot("fragment",new be({node:e.thicknessNode,nodeType:"float",source:"material.thickness = thickness;",target:"material.thickness = %RESULT%;"})),e.attenuationDistanceNode&&e.attenuationDistanceNode.isNode&&this.addSlot("fragment",new be({node:e.attenuationDistanceNode,nodeType:"float",source:"material.attenuationDistance = attenuationDistance;",target:"material.attenuationDistance = %RESULT%;"})),e.attenuationColorNode&&e.attenuationColorNode.isNode&&this.addSlot("fragment",new be({node:e.attenuationColorNode,nodeType:"vec3",source:"material.attenuationColor = attenuationColor;",target:"material.attenuationColor = %RESULT%;"})),e.transmission=1,e.defines.USE_TRANSMISSION=""):(e.transmission=0,delete e.defines.USE_TRANSMISSION))),e.positionNode&&e.positionNode.isNode&&this.addSlot("vertex",new be({node:e.positionNode,nodeType:"vec3",source:ut("begin_vertex"),target:"transformed = %RESULT%;",inclusionType:"append"})),e.sizeNode&&e.sizeNode.isNode&&this.addSlot("vertex",new be({node:e.sizeNode,nodeType:"float",source:"gl_PointSize = size;",target:"gl_PointSize = %RESULT%;"}))}generateTexture(e,t,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(", ")} ) {
1
+ "use strict";const r=require("./three-Bf2NBxAw.umd.cjs");class Qo extends r.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 r.SphereGeometry(s,2*n,n);i.scale(1,1,-1);const o=i.getAttribute("position"),a=new r.Vector3;for(let A=0;A<o.count;++A)if(a.fromBufferAttribute(o,A),a.y<0){const l=-t*3/2,h=a.y<l?-t/a.y:1-a.y*a.y/(3*l*l);a.multiplyScalar(h),a.toArray(o.array,3*A)}o.needsUpdate=!0,super(i,new r.MeshBasicMaterial({map:e,depthWrite:!1}))}}class be extends r.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 r.NodeFrame;Ue.camera=new r.PerspectiveCamera;const us={LineBasicNodeMaterial:r.ShaderLib.basic,MeshBasicNodeMaterial:r.ShaderLib.basic,PointsNodeMaterial:r.ShaderLib.points,MeshStandardNodeMaterial:r.ShaderLib.standard,MeshPhysicalNodeMaterial:r.ShaderLib.physical,MeshPhongNodeMaterial:r.ShaderLib.phong},xo={atan2:"atan"},So={low:"lowp",medium:"mediump",high:"highp"};function ut(c){return`#include <${c}>`}function Ft(c){return`${c}Shader`}class To extends r.NodeBuilder{constructor(e,t,s,n=null){super(e,t,new r.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"),us[t]!==void 0){const s=us[t],n=this.shader;n.vertexShader=s.vertexShader,n.fragmentShader=s.fragmentShader,n.uniforms=r.UniformsUtils.merge([s.uniforms,r.UniformsLib.lights])}}_parseObject(){const{material:e,renderer:t}=this;this.addSlot("fragment",new be({node:r.normalView,nodeType:"vec3",source:"void main() {",target:"vec3 TransformedNormalView = %RESULT%;",inclusionType:"append"})),t.toneMappingNode&&t.toneMappingNode.isNode===!0&&this.addSlot("fragment",new be({node:e.colorNode,nodeType:"vec4",source:ut("tonemapping_fragment"),target:""})),e.colorNode&&e.colorNode.isNode&&this.addSlot("fragment",new be({node:e.colorNode,nodeType:"vec4",source:"vec4 diffuseColor = vec4( diffuse, opacity );",target:"vec4 diffuseColor = %RESULT%; diffuseColor.a *= opacity;"})),e.opacityNode&&e.opacityNode.isNode&&this.addSlot("fragment",new be({node:e.opacityNode,nodeType:"float",source:ut("alphatest_fragment"),target:"diffuseColor.a = %RESULT%;",inclusionType:"append"})),e.normalNode&&e.normalNode.isNode&&this.addSlot("fragment",new be({node:e.normalNode,nodeType:"vec3",source:ut("normal_fragment_begin"),target:"normal = %RESULT%;",inclusionType:"append"})),e.emissiveNode&&e.emissiveNode.isNode&&this.addSlot("fragment",new be({node:e.emissiveNode,nodeType:"vec3",source:ut("emissivemap_fragment"),target:"totalEmissiveRadiance = %RESULT%;",inclusionType:"append"})),e.isMeshStandardNodeMaterial&&(e.metalnessNode&&e.metalnessNode.isNode&&this.addSlot("fragment",new be({node:e.metalnessNode,nodeType:"float",source:ut("metalnessmap_fragment"),target:"metalnessFactor = %RESULT%;",inclusionType:"append"})),e.roughnessNode&&e.roughnessNode.isNode&&this.addSlot("fragment",new be({node:e.roughnessNode,nodeType:"float",source:ut("roughnessmap_fragment"),target:"roughnessFactor = %RESULT%;",inclusionType:"append"})),e.isMeshPhysicalNodeMaterial&&(e.clearcoatNode&&e.clearcoatNode.isNode?(this.addSlot("fragment",new be({node:e.clearcoatNode,nodeType:"float",source:"material.clearcoat = clearcoat;",target:"material.clearcoat = %RESULT%;"})),e.clearcoatRoughnessNode&&e.clearcoatRoughnessNode.isNode&&this.addSlot("fragment",new be({node:e.clearcoatRoughnessNode,nodeType:"float",source:"material.clearcoatRoughness = clearcoatRoughness;",target:"material.clearcoatRoughness = %RESULT%;"})),e.clearcoatNormalNode&&e.clearcoatNormalNode.isNode&&this.addSlot("fragment",new be({node:e.clearcoatNormalNode,nodeType:"vec3",source:"vec3 clearcoatNormal = nonPerturbedNormal;",target:"vec3 clearcoatNormal = %RESULT%;"})),e.defines.USE_CLEARCOAT=""):delete e.defines.USE_CLEARCOAT,e.sheenNode&&e.sheenNode.isNode?(this.addSlot("fragment",new be({node:e.sheenNode,nodeType:"vec3",source:"material.sheenColor = sheenColor;",target:"material.sheenColor = %RESULT%;"})),e.sheenRoughnessNode&&e.sheenRoughnessNode.isNode&&this.addSlot("fragment",new be({node:e.sheenRoughnessNode,nodeType:"float",source:"material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );",target:"material.sheenRoughness = clamp( %RESULT%, 0.07, 1.0 );"})),e.defines.USE_SHEEN=""):delete e.defines.USE_SHEEN,e.iridescenceNode&&e.iridescenceNode.isNode?(this.addSlot("fragment",new be({node:e.iridescenceNode,nodeType:"float",source:"material.iridescence = iridescence;",target:"material.iridescence = %RESULT%;"})),e.iridescenceIORNode&&e.iridescenceIORNode.isNode&&this.addSlot("fragment",new be({node:e.iridescenceIORNode,nodeType:"float",source:"material.iridescenceIOR = iridescenceIOR;",target:"material.iridescenceIOR = %RESULT%;"})),e.iridescenceThicknessNode&&e.iridescenceThicknessNode.isNode&&this.addSlot("fragment",new be({node:e.iridescenceThicknessNode,nodeType:"float",source:"material.iridescenceThickness = iridescenceThicknessMaximum;",target:"material.iridescenceThickness = %RESULT%;"})),e.defines.USE_IRIDESCENCE=""):delete e.defines.USE_IRIDESCENCE,e.iorNode&&e.iorNode.isNode&&this.addSlot("fragment",new be({node:e.iorNode,nodeType:"float",source:"material.ior = ior;",target:"material.ior = %RESULT%;"})),e.specularColorNode&&e.specularColorNode.isNode&&this.addSlot("fragment",new be({node:e.specularColorNode,nodeType:"vec3",source:"vec3 specularColorFactor = specularColor;",target:"vec3 specularColorFactor = %RESULT%;"})),e.specularIntensityNode&&e.specularIntensityNode.isNode&&this.addSlot("fragment",new be({node:e.specularIntensityNode,nodeType:"float",source:"float specularIntensityFactor = specularIntensity;",target:"float specularIntensityFactor = %RESULT%;"})),e.transmissionNode&&e.transmissionNode.isNode?(this.addSlot("fragment",new be({node:e.transmissionNode,nodeType:"float",source:"material.transmission = transmission;",target:"material.transmission = %RESULT%;"})),e.thicknessNode&&e.thicknessNode.isNode&&this.addSlot("fragment",new be({node:e.thicknessNode,nodeType:"float",source:"material.thickness = thickness;",target:"material.thickness = %RESULT%;"})),e.attenuationDistanceNode&&e.attenuationDistanceNode.isNode&&this.addSlot("fragment",new be({node:e.attenuationDistanceNode,nodeType:"float",source:"material.attenuationDistance = attenuationDistance;",target:"material.attenuationDistance = %RESULT%;"})),e.attenuationColorNode&&e.attenuationColorNode.isNode&&this.addSlot("fragment",new be({node:e.attenuationColorNode,nodeType:"vec3",source:"material.attenuationColor = attenuationColor;",target:"material.attenuationColor = %RESULT%;"})),e.transmission=1,e.defines.USE_TRANSMISSION=""):(e.transmission=0,delete e.defines.USE_TRANSMISSION))),e.positionNode&&e.positionNode.isNode&&this.addSlot("vertex",new be({node:e.positionNode,nodeType:"vec3",source:ut("begin_vertex"),target:"transformed = %RESULT%;",inclusionType:"append"})),e.sizeNode&&e.sizeNode.isNode&&this.addSlot("vertex",new be({node:e.sizeNode,nodeType:"float",source:"gl_PointSize = size;",target:"gl_PointSize = %RESULT%;"}))}generateTexture(e,t,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
 
@@ -30,14 +30,14 @@ ${a}
30
30
  ${this.shader[Ft(t)]}
31
31
  `}this.vertexShader=e.vertex,this.fragmentShader=e.fragment}build(){return super.build(!1),this._addSnippets(),this._addUniforms(),this._updateUniforms(),this.shader.vertexShader=this.vertexShader,this.shader.fragmentShader=this.fragmentShader,this}_parseInclude(e,...t){for(const s of t){const n=ut(s),i=r.ShaderChunk[s],o=Ft(e);this.shader[o]=this.shader[o].replaceAll(n,i)}}_sortSlotsToFlow(){for(const e of r.defaultShaderStages){const t=this.shader[Ft(e)],s=this.slots[e].sort((n,i)=>t.indexOf(n.source)>t.indexOf(i.source)?1:-1);for(const n of s)this.addFlow(e,n)}}_addSnippets(){for(const e of r.defaultShaderStages){for(const t of this.slots[e]){const s=this.getFlowData(t),n=t.inclusionType,i=t.source,o=s.code+`
32
32
  `+t.target.replace("%RESULT%",s.result);n==="append"?this.addCode(e,i,o):n==="replace"?this.replaceCode(e,i,o):console.warn(`Inclusion type "${n}" not compatible.`)}this.addCode(e,"main() {",`
33
- `+this.flowCode[e])}}_addUniforms(){for(const e of r.defaultShaderStages)for(const t of this.uniforms[e])this.shader.uniforms[t.name]=t}_updateUniforms(){Ue.object=this.object,Ue.renderer=this.renderer,Ue.material=this.material,Ue.scene=this.scene;for(const e of this.updateNodes)Ue.updateNode(e)}}const si=new WeakMap;r.Material.prototype.onBuild=function(c,e,t){const s=this;if(s.isNodeMaterial===!0){let n;try{n=new To(c,t,e,s).build(),si.set(s,n)}catch(i){console.error("Material.prototype.onBuild: ",i)}}};r.Material.prototype.onBeforeRender=function(c,e,t,s,n){const i=si.get(this);if(i!==void 0){Ue.material=this,Ue.camera=t,Ue.object=n,Ue.renderer=c,Ue.scene=e,Ue.geometry=s;const o=i.updateNodes;if(o.length>0){c.state.useProgram(null);for(const a of o)Ue.updateNode(a)}}};var Jt=function(){var c=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(h){h.preventDefault(),s(++c%e.children.length)},!1);function t(h){return e.appendChild(h.dom),h}function s(h){for(var u=0;u<e.children.length;u++)e.children[u].style.display=u===h?"block":"none";c=h}var n=(performance||Date).now(),i=n,o=0,a=t(new Jt.Panel("FPS","#0ff","#002")),A=t(new Jt.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var l=t(new Jt.Panel("MB","#f08","#201"));return s(0),{REVISION:16,dom:e,addPanel:t,showPanel:s,begin:function(){n=(performance||Date).now()},end:function(){o++;var h=(performance||Date).now();if(A.update(h-n,200),h>=i+1e3&&(a.update(o*1e3/(h-i),100),i=h,o=0,l)){var u=performance.memory;l.update(u.usedJSHeapSize/1048576,u.jsHeapSizeLimit/1048576)}return h},update:function(){n=this.end()},domElement:e,setMode:s}};Jt.Panel=function(c,e,t){var s=1/0,n=0,i=Math.round,o=i(window.devicePixelRatio||1),a=80*o,A=48*o,l=3*o,h=2*o,u=3*o,p=15*o,g=74*o,m=30*o,I=document.createElement("canvas");I.width=a,I.height=A,I.style.cssText="width:80px;height:48px";var b=I.getContext("2d");return b.font="bold "+9*o+"px Helvetica,Arial,sans-serif",b.textBaseline="top",b.fillStyle=t,b.fillRect(0,0,a,A),b.fillStyle=e,b.fillText(c,l,h),b.fillRect(u,p,g,m),b.fillStyle=t,b.globalAlpha=.9,b.fillRect(u,p,g,m),{dom:I,update:function(B,w){s=Math.min(s,B),n=Math.max(n,B),b.fillStyle=t,b.globalAlpha=1,b.fillRect(0,0,a,p),b.fillStyle=e,b.fillText(i(B)+" "+c+" ("+i(s)+"-"+i(n)+")",l,h),b.drawImage(I,u+o,p,g-o,m,u,p,g-o,m),b.fillRect(u+g-o,p,o,m),b.fillStyle=t,b.globalAlpha=.9,b.fillRect(u+g-o,p,o,i((1-B/w)*m))}}};function vo(c,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},s=c.getIndex(),n=c.getAttribute("position"),i=s?s.count:n.count;let o=0;const a=Object.keys(c.attributes),A={},l={},h=[],u=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"];for(let w=0,C=a.length;w<C;w++){const y=a[w],x=c.attributes[y];A[y]=new x.constructor(new x.array.constructor(x.count*x.itemSize),x.itemSize,x.normalized);const R=c.morphAttributes[y];R&&(l[y]||(l[y]=[]),R.forEach((D,S)=>{const v=new D.array.constructor(D.count*D.itemSize);l[y][S]=new D.constructor(v,D.itemSize,D.normalized)}))}const g=e*.5,m=Math.log10(1/e),I=Math.pow(10,m),b=g*I;for(let w=0;w<i;w++){const C=s?s.getX(w):w;let y="";for(let x=0,R=a.length;x<R;x++){const D=a[x],S=c.getAttribute(D),v=S.itemSize;for(let U=0;U<v;U++)y+=`${~~(S[u[U]](C)*I+b)},`}if(y in t)h.push(t[y]);else{for(let x=0,R=a.length;x<R;x++){const D=a[x],S=c.getAttribute(D),v=c.morphAttributes[D],U=S.itemSize,G=A[D],H=l[D];for(let X=0;X<U;X++){const N=u[X],Y=p[X];if(G[Y](o,S[N](C)),v)for(let O=0,Z=v.length;O<Z;O++)H[O][Y](o,v[O][N](C))}}t[y]=o,h.push(o),o++}}const B=c.clone();for(const w in c.attributes){const C=A[w];if(B.setAttribute(w,new C.constructor(C.array.slice(0,o*C.itemSize),C.itemSize,C.normalized)),w in l)for(let y=0;y<l[w].length;y++){const x=l[w][y];B.morphAttributes[w][y]=new x.constructor(x.array.slice(0,o*x.itemSize),x.itemSize,x.normalized)}}return B.setIndex(h),B}function ds(c,e){if(e===r.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),c;if(e===r.TriangleFanDrawMode||e===r.TriangleStripDrawMode){let t=c.getIndex();if(t===null){const o=[],a=c.getAttribute("position");if(a!==void 0){for(let A=0;A<a.count;A++)o.push(A);c.setIndex(o),t=c.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),c}const s=t.count-2,n=[];if(e===r.TriangleFanDrawMode)for(let o=1;o<=s;o++)n.push(t.getX(0)),n.push(t.getX(o)),n.push(t.getX(o+1));else for(let o=0;o<s;o++)o%2===0?(n.push(t.getX(o)),n.push(t.getX(o+1)),n.push(t.getX(o+2))):(n.push(t.getX(o+2)),n.push(t.getX(o+1)),n.push(t.getX(o)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=c.clone();return i.setIndex(n),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),c}class Zn extends r.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Fo(t)}),this.register(function(t){return new Lo(t)}),this.register(function(t){return new qo(t)}),this.register(function(t){return new zo(t)}),this.register(function(t){return new Yo(t)}),this.register(function(t){return new Go(t)}),this.register(function(t){return new No(t)}),this.register(function(t){return new Uo(t)}),this.register(function(t){return new Po(t)}),this.register(function(t){return new _o(t)}),this.register(function(t){return new Oo(t)}),this.register(function(t){return new ko(t)}),this.register(function(t){return new jo(t)}),this.register(function(t){return new Ho(t)}),this.register(function(t){return new Ro(t)}),this.register(function(t){return new Vo(t)}),this.register(function(t){return new Ko(t)})}load(e,t,s,n){const i=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const l=r.LoaderUtils.extractUrlBase(e);o=r.LoaderUtils.resolveURL(l,this.path)}else o=r.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(l){n?n(l):console.error(l),i.manager.itemError(e),i.manager.itemEnd(e)},A=new r.FileLoader(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,function(l){try{i.parse(l,o,function(h){t(h),i.manager.itemEnd(e)},a)}catch(h){a(h)}},s,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,n){let i,o;const a={},A={},l=new TextDecoder;if(typeof e=="string")try{i=JSON.parse(e)}catch(u){o=e,n&&n(u);return}else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===ii){try{a[re.KHR_BINARY_GLTF]=new Jo(e)}catch(p){n&&n(p);return}try{i=JSON.parse(a[re.KHR_BINARY_GLTF].content)}catch(p){o=a[re.KHR_BINARY_GLTF].content,n&&n(p);return}}else try{i=JSON.parse(l.decode(e))}catch(p){o=l.decode(e),n&&n(p);return}else i=e;if(i.asset===void 0||i.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}this.json=i,this.jsonErrorData=o;const h=new Ar(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const p=this.pluginCallbacks[u](h);p.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),A[p.name]=p,a[p.name]=!0}if(i.extensionsUsed)for(let u=0;u<i.extensionsUsed.length;++u){const p=i.extensionsUsed[u],g=i.extensionsRequired||[];switch(p){case re.KHR_MATERIALS_UNLIT:a[p]=new Do;break;case re.KHR_DRACO_MESH_COMPRESSION:a[p]=new Wo(i,this.dracoLoader);break;case re.KHR_TEXTURE_TRANSFORM:a[p]=new Xo;break;case re.KHR_MESH_QUANTIZATION:a[p]=new Zo;break;default:g.indexOf(p)>=0&&A[p]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}h.setExtensions(a),h.setPlugins(A),h.parse(s,n)}parseAsync(e,t){const s=this;return new Promise(function(n,i){s.parse(e,t,n,i)})}}function Mo(){let c={};return{get:function(e){return c[e]},add:function(e,t){c[e]=t},remove:function(e){delete c[e]},removeAll:function(){c={}}}}const re={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Ro{constructor(e){this.parser=e,this.name=re.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,n=t.length;s<n;s++){const i=t[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let n=t.cache.get(s);if(n)return n;const i=t.json,A=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let l;const h=new r.Color(16777215);A.color!==void 0&&h.setRGB(A.color[0],A.color[1],A.color[2],r.LinearSRGBColorSpace);const u=A.range!==void 0?A.range:0;switch(A.type){case"directional":l=new r.DirectionalLight(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new r.PointLight(h),l.distance=u;break;case"spot":l=new r.SpotLight(h),l.distance=u,A.spot=A.spot||{},A.spot.innerConeAngle=A.spot.innerConeAngle!==void 0?A.spot.innerConeAngle:0,A.spot.outerConeAngle=A.spot.outerConeAngle!==void 0?A.spot.outerConeAngle:Math.PI/4,l.angle=A.spot.outerConeAngle,l.penumbra=1-A.spot.innerConeAngle/A.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+A.type)}return l.position.set(0,0,0),l.decay=2,ct(l,A),A.intensity!==void 0&&(l.intensity=A.intensity),l.name=t.createUniqueName(A.name||"light_"+e),n=Promise.resolve(l),t.cache.add(s,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,i=s.json.nodes[e],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(A){return s._getNodeRef(t.cache,a,A)})}}let Do=class{constructor(){this.name=re.KHR_MATERIALS_UNLIT}getMaterialType(){return r.MeshBasicMaterial}extendParams(e,t,s){const n=[];e.color=new r.Color(1,1,1),e.opacity=1;const i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const o=i.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],r.LinearSRGBColorSpace),e.opacity=o[3]}i.baseColorTexture!==void 0&&n.push(s.assignTexture(e,"map",i.baseColorTexture,r.SRGBColorSpace))}return Promise.all(n)}},_o=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return i!==void 0&&(t.emissiveIntensity=i),Promise.resolve()}},Fo=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&i.push(s.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&i.push(s.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(i.push(s.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new r.Vector2(a,a)}return Promise.all(i)}},Lo=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_DISPERSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=i.dispersion!==void 0?i.dispersion:0,Promise.resolve()}},ko=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&i.push(s.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&i.push(s.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}},Go=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[];t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=n.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],r.LinearSRGBColorSpace)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&i.push(s.assignTexture(t,"sheenColorMap",o.sheenColorTexture,r.SRGBColorSpace)),o.sheenRoughnessTexture!==void 0&&i.push(s.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}},No=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&i.push(s.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(i)}},Uo=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&i.push(s.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new r.Color().setRGB(a[0],a[1],a[2],r.LinearSRGBColorSpace),Promise.all(i)}},Po=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}},Oo=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&i.push(s.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new r.Color().setRGB(a[0],a[1],a[2],r.LinearSRGBColorSpace),o.specularColorTexture!==void 0&&i.push(s.assignTexture(t,"specularColorMap",o.specularColorTexture,r.SRGBColorSpace)),Promise.all(i)}},Ho=class{constructor(e){this.parser=e,this.name=re.EXT_MATERIALS_BUMP}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&i.push(s.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(i)}},jo=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&i.push(s.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(i)}};class qo{constructor(e){this.parser=e,this.name=re.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,n=s.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const i=n.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,o)}}class zo{constructor(e){this.parser=e,this.name=re.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],a=n.images[o.source];let A=s.textureLoader;if(a.uri){const l=s.options.manager.getHandler(a.uri);l!==null&&(A=l)}return this.detectSupport().then(function(l){if(l)return s.loadTextureImage(e,o.source,A);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Yo{constructor(e){this.parser=e,this.name=re.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],a=n.images[o.source];let A=s.textureLoader;if(a.uri){const l=s.options.manager.getHandler(a.uri);l!==null&&(A=l)}return this.detectSupport().then(function(l){if(l)return s.loadTextureImage(e,o.source,A);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Vo{constructor(e){this.name=re.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const A=n.byteOffset||0,l=n.byteLength||0,h=n.count,u=n.byteStride,p=new Uint8Array(a,A,l);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,u,p,n.mode,n.filter).then(function(g){return g.buffer}):o.ready.then(function(){const g=new ArrayBuffer(h*u);return o.decodeGltfBuffer(new Uint8Array(g),h,u,p,n.mode,n.filter),g})})}else return null}}let Ko=class{constructor(e){this.name=re.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=t.meshes[s.mesh];for(const l of n.primitives)if(l.mode!==We.TRIANGLES&&l.mode!==We.TRIANGLE_STRIP&&l.mode!==We.TRIANGLE_FAN&&l.mode!==void 0)return null;const o=s.extensions[this.name].attributes,a=[],A={};for(const l in o)a.push(this.parser.getDependency("accessor",o[l]).then(h=>(A[l]=h,A[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(l=>{const h=l.pop(),u=h.isGroup?h.children:[h],p=l[0].count,g=[];for(const m of u){const I=new r.Matrix4,b=new r.Vector3,B=new r.Quaternion,w=new r.Vector3(1,1,1),C=new r.InstancedMesh(m.geometry,m.material,p);for(let y=0;y<p;y++)A.TRANSLATION&&b.fromBufferAttribute(A.TRANSLATION,y),A.ROTATION&&B.fromBufferAttribute(A.ROTATION,y),A.SCALE&&w.fromBufferAttribute(A.SCALE,y),C.setMatrixAt(y,I.compose(b,B,w));for(const y in A)if(y==="_COLOR_0"){const x=A[y];C.instanceColor=new r.InstancedBufferAttribute(x.array,x.itemSize,x.normalized)}else y!=="TRANSLATION"&&y!=="ROTATION"&&y!=="SCALE"&&m.geometry.setAttribute(y,A[y]);r.Object3D.prototype.copy.call(C,m),this.parser.assignFinalMaterial(C),g.push(C)}return h.isGroup?(h.clear(),h.add(...g),h):g[0]}))}};const ii="glTF",Lt=12,ps={JSON:1313821514,BIN:5130562};class Jo{constructor(e){this.name=re.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Lt),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==ii)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-Lt,i=new DataView(e,Lt);let o=0;for(;o<n;){const a=i.getUint32(o,!0);o+=4;const A=i.getUint32(o,!0);if(o+=4,A===ps.JSON){const l=new Uint8Array(e,Lt+o,a);this.content=s.decode(l)}else if(A===ps.BIN){const l=Lt+o;this.body=e.slice(l,l+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Wo{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=re.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},A={},l={};for(const h in o){const u=Hn[h]||h.toLowerCase();a[u]=o[h]}for(const h in e.attributes){const u=Hn[h]||h.toLowerCase();if(o[h]!==void 0){const p=s.accessors[e.attributes[h]],g=Rt[p.componentType];l[u]=g.name,A[u]=p.normalized===!0}}return t.getDependency("bufferView",i).then(function(h){return new Promise(function(u,p){n.decodeDracoFile(h,function(g){for(const m in g.attributes){const I=g.attributes[m],b=A[m];b!==void 0&&(I.normalized=b)}u(g)},a,l,r.LinearSRGBColorSpace,p)})})}}class Xo{constructor(){this.name=re.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Zo{constructor(){this.name=re.KHR_MESH_QUANTIZATION}}class oi extends r.Interpolant{constructor(e,t,s,n){super(e,t,s,n)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,n=this.valueSize,i=e*n*3+n;for(let o=0;o!==n;o++)t[o]=s[i+o];return t}interpolate_(e,t,s,n){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,A=a*2,l=a*3,h=n-t,u=(s-t)/h,p=u*u,g=p*u,m=e*l,I=m-l,b=-2*g+3*p,B=g-p,w=1-b,C=B-p+u;for(let y=0;y!==a;y++){const x=o[I+y+a],R=o[I+y+A]*h,D=o[m+y+a],S=o[m+y]*h;i[y]=w*x+C*R+b*D+B*S}return i}}const $o=new r.Quaternion;class er extends oi{interpolate_(e,t,s,n){const i=super.interpolate_(e,t,s,n);return $o.fromArray(i).normalize().toArray(i),i}}const We={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Rt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},gs={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},fs={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},mn={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Hn={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},dt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},tr={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete},In={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function nr(c){return c.DefaultMaterial===void 0&&(c.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),c.DefaultMaterial}function bt(c,e,t){for(const s in t.extensions)c[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function ct(c,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(c.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function sr(c,e,t){let s=!1,n=!1,i=!1;for(let l=0,h=e.length;l<h;l++){const u=e[l];if(u.POSITION!==void 0&&(s=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(i=!0),s&&n&&i)break}if(!s&&!n&&!i)return Promise.resolve(c);const o=[],a=[],A=[];for(let l=0,h=e.length;l<h;l++){const u=e[l];if(s){const p=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):c.attributes.position;o.push(p)}if(n){const p=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):c.attributes.normal;a.push(p)}if(i){const p=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):c.attributes.color;A.push(p)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(A)]).then(function(l){const h=l[0],u=l[1],p=l[2];return s&&(c.morphAttributes.position=h),n&&(c.morphAttributes.normal=u),i&&(c.morphAttributes.color=p),c.morphTargetsRelative=!0,c})}function ir(c,e){if(c.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)c.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(c.morphTargetInfluences.length===t.length){c.morphTargetDictionary={};for(let s=0,n=t.length;s<n;s++)c.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function or(c){let e;const t=c.extensions&&c.extensions[re.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+bn(t.attributes):e=c.indices+":"+bn(c.attributes)+":"+c.mode,c.targets!==void 0)for(let s=0,n=c.targets.length;s<n;s++)e+=":"+bn(c.targets[s]);return e}function bn(c){let e="";const t=Object.keys(c).sort();for(let s=0,n=t.length;s<n;s++)e+=t[s]+":"+c[t[s]]+";";return e}function jn(c){switch(c){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function rr(c){return c.search(/\.jpe?g($|\?)/i)>0||c.search(/^data\:image\/jpeg/)===0?"image/jpeg":c.search(/\.webp($|\?)/i)>0||c.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const ar=new r.Matrix4;class Ar{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Mo,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,n=-1,i=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const A=a.match(/Version\/(\d+)/);n=s&&A?parseInt(A[1],10):-1,i=a.indexOf("Firefox")>-1,o=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&n<17||i&&o<98?this.textureLoader=new r.TextureLoader(this.options.manager):this.textureLoader=new r.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(o){const a={scene:o[0][n.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:n.asset,parser:s,userData:{}};return bt(i,a,n),ct(a,n),Promise.all(s._invokeAll(function(A){return A.afterRoot&&A.afterRoot(a)})).then(function(){for(const A of a.scenes)A.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n].joints;for(let a=0,A=o.length;a<A;a++)e[o[a]].isBone=!0}for(let n=0,i=e.length;n<i;n++){const o=e[n];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(s[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const n=s.clone(),i=(o,a)=>{const A=this.associations.get(o);A!=null&&this.associations.set(a,A);for(const[l,h]of o.children.entries())i(h,a.children[l])};return i(s,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const n=e(t[s]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let n=0;n<t.length;n++){const i=e(t[n]);i&&s.push(i)}return s}getDependency(e,t){const s=e+":"+t;let n=this.cache.get(s);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(i){return i.loadNode&&i.loadNode(t)});break;case"mesh":n=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(s,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(i,o){return s.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[re.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(i,o){s.load(r.LoaderUtils.resolveURL(t.uri,n.path),i,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const n=t.byteLength||0,i=t.byteOffset||0;return s.slice(i,i+n)})}loadAccessor(e){const t=this,s=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const o=mn[n.type],a=Rt[n.componentType],A=n.normalized===!0,l=new a(n.count*o);return Promise.resolve(new r.BufferAttribute(l,o,A))}const i=[];return n.bufferView!==void 0?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),n.sparse!==void 0&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(o){const a=o[0],A=mn[n.type],l=Rt[n.componentType],h=l.BYTES_PER_ELEMENT,u=h*A,p=n.byteOffset||0,g=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,m=n.normalized===!0;let I,b;if(g&&g!==u){const B=Math.floor(p/g),w="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+B+":"+n.count;let C=t.cache.get(w);C||(I=new l(a,B*g,n.count*g/h),C=new r.InterleavedBuffer(I,g/h),t.cache.add(w,C)),b=new r.InterleavedBufferAttribute(C,A,p%g/h,m)}else a===null?I=new l(n.count*A):I=new l(a,p,n.count*A),b=new r.BufferAttribute(I,A,m);if(n.sparse!==void 0){const B=mn.SCALAR,w=Rt[n.sparse.indices.componentType],C=n.sparse.indices.byteOffset||0,y=n.sparse.values.byteOffset||0,x=new w(o[1],C,n.sparse.count*B),R=new l(o[2],y,n.sparse.count*A);a!==null&&(b=new r.BufferAttribute(b.array.slice(),b.itemSize,b.normalized)),b.normalized=!1;for(let D=0,S=x.length;D<S;D++){const v=x[D];if(b.setX(v,R[D*A]),A>=2&&b.setY(v,R[D*A+1]),A>=3&&b.setZ(v,R[D*A+2]),A>=4&&b.setW(v,R[D*A+3]),A>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}b.normalized=m}return b})}loadTexture(e){const t=this.json,s=this.options,i=t.textures[e].source,o=t.images[i];let a=this.textureLoader;if(o.uri){const A=s.manager.getHandler(o.uri);A!==null&&(a=A)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,s){const n=this,i=this.json,o=i.textures[e],a=i.images[t],A=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[A])return this.textureCache[A];const l=this.loadImageSource(t,s).then(function(h){h.flipY=!1,h.name=o.name||a.name||"",h.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(h.name=a.uri);const p=(i.samplers||{})[o.sampler]||{};return h.magFilter=gs[p.magFilter]||r.LinearFilter,h.minFilter=gs[p.minFilter]||r.LinearMipmapLinearFilter,h.wrapS=fs[p.wrapS]||r.RepeatWrapping,h.wrapT=fs[p.wrapT]||r.RepeatWrapping,h.anisotropy=4,n.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[A]=l,l}loadImageSource(e,t){const s=this,n=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=n.images[e],a=self.URL||self.webkitURL;let A=o.uri||"",l=!1;if(o.bufferView!==void 0)A=s.getDependency("bufferView",o.bufferView).then(function(u){l=!0;const p=new Blob([u],{type:o.mimeType});return A=a.createObjectURL(p),A});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(A).then(function(u){return new Promise(function(p,g){let m=p;t.isImageBitmapLoader===!0&&(m=function(I){const b=new r.Texture(I);b.needsUpdate=!0,p(b)}),t.load(r.LoaderUtils.resolveURL(u,i.path),m,void 0,g)})}).then(function(u){return l===!0&&a.revokeObjectURL(A),ct(u,o),u.userData.mimeType=o.mimeType||rr(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",A),u});return this.sourceCache[e]=h,h}assignTexture(e,t,s,n){const i=this;return this.getDependency("texture",s.index).then(function(o){if(!o)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(o=o.clone(),o.channel=s.texCoord),i.extensions[re.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[re.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const A=i.associations.get(o);o=i.extensions[re.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),i.associations.set(o,A)}}return n!==void 0&&(o.colorSpace=n),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const n=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+s.uuid;let A=this.cache.get(a);A||(A=new r.PointsMaterial,r.Material.prototype.copy.call(A,s),A.color.copy(s.color),A.map=s.map,A.sizeAttenuation=!1,this.cache.add(a,A)),s=A}else if(e.isLine){const a="LineBasicMaterial:"+s.uuid;let A=this.cache.get(a);A||(A=new r.LineBasicMaterial,r.Material.prototype.copy.call(A,s),A.color.copy(s.color),A.map=s.map,this.cache.add(a,A)),s=A}if(n||i||o){let a="ClonedMaterial:"+s.uuid+":";n&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let A=this.cache.get(a);A||(A=s.clone(),i&&(A.vertexColors=!0),o&&(A.flatShading=!0),n&&(A.normalScale&&(A.normalScale.y*=-1),A.clearcoatNormalScale&&(A.clearcoatNormalScale.y*=-1)),this.cache.add(a,A),this.associations.set(A,this.associations.get(s))),s=A}e.material=s}getMaterialType(){return r.MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,n=this.extensions,i=s.materials[e];let o;const a={},A=i.extensions||{},l=[];if(A[re.KHR_MATERIALS_UNLIT]){const u=n[re.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),l.push(u.extendParams(a,i,t))}else{const u=i.pbrMetallicRoughness||{};if(a.color=new r.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const p=u.baseColorFactor;a.color.setRGB(p[0],p[1],p[2],r.LinearSRGBColorSpace),a.opacity=p[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(a,"map",u.baseColorTexture,r.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}i.doubleSided===!0&&(a.side=r.DoubleSide);const h=i.alphaMode||In.OPAQUE;if(h===In.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===In.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&o!==r.MeshBasicMaterial&&(l.push(t.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new r.Vector2(1,1),i.normalTexture.scale!==void 0)){const u=i.normalTexture.scale;a.normalScale.set(u,u)}if(i.occlusionTexture!==void 0&&o!==r.MeshBasicMaterial&&(l.push(t.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&o!==r.MeshBasicMaterial){const u=i.emissiveFactor;a.emissive=new r.Color().setRGB(u[0],u[1],u[2],r.LinearSRGBColorSpace)}return i.emissiveTexture!==void 0&&o!==r.MeshBasicMaterial&&l.push(t.assignTexture(a,"emissiveMap",i.emissiveTexture,r.SRGBColorSpace)),Promise.all(l).then(function(){const u=new o(a);return i.name&&(u.name=i.name),ct(u,i),t.associations.set(u,{materials:e}),i.extensions&&bt(n,u,i),u})}createUniqueName(e){const t=r.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,n=this.primitiveCache;function i(a){return s[re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(A){return ms(A,a,t)})}const o=[];for(let a=0,A=e.length;a<A;a++){const l=e[a],h=or(l),u=n[h];if(u)o.push(u.promise);else{let p;l.extensions&&l.extensions[re.KHR_DRACO_MESH_COMPRESSION]?p=i(l):p=ms(new r.BufferGeometry,l,t),n[h]={primitive:l,promise:p},o.push(p)}}return Promise.all(o)}loadMesh(e){const t=this,s=this.json,n=this.extensions,i=s.meshes[e],o=i.primitives,a=[];for(let A=0,l=o.length;A<l;A++){const h=o[A].material===void 0?nr(this.cache):this.getDependency("material",o[A].material);a.push(h)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(A){const l=A.slice(0,A.length-1),h=A[A.length-1],u=[];for(let g=0,m=h.length;g<m;g++){const I=h[g],b=o[g];let B;const w=l[g];if(b.mode===We.TRIANGLES||b.mode===We.TRIANGLE_STRIP||b.mode===We.TRIANGLE_FAN||b.mode===void 0)B=i.isSkinnedMesh===!0?new r.SkinnedMesh(I,w):new r.Mesh(I,w),B.isSkinnedMesh===!0&&B.normalizeSkinWeights(),b.mode===We.TRIANGLE_STRIP?B.geometry=ds(B.geometry,r.TriangleStripDrawMode):b.mode===We.TRIANGLE_FAN&&(B.geometry=ds(B.geometry,r.TriangleFanDrawMode));else if(b.mode===We.LINES)B=new r.LineSegments(I,w);else if(b.mode===We.LINE_STRIP)B=new r.Line(I,w);else if(b.mode===We.LINE_LOOP)B=new r.LineLoop(I,w);else if(b.mode===We.POINTS)B=new r.Points(I,w);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+b.mode);Object.keys(B.geometry.morphAttributes).length>0&&ir(B,i),B.name=t.createUniqueName(i.name||"mesh_"+e),ct(B,i),b.extensions&&bt(n,B,b),t.assignFinalMaterial(B),u.push(B)}for(let g=0,m=u.length;g<m;g++)t.associations.set(u[g],{meshes:e,primitives:g});if(u.length===1)return i.extensions&&bt(n,u[0],i),u[0];const p=new r.Group;i.extensions&&bt(n,p,i),t.associations.set(p,{meshes:e});for(let g=0,m=u.length;g<m;g++)p.add(u[g]);return p})}loadCamera(e){let t;const s=this.json.cameras[e],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),ct(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let n=0,i=t.joints.length;n<i;n++)s.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const i=n.pop(),o=n,a=[],A=[];for(let l=0,h=o.length;l<h;l++){const u=o[l];if(u){a.push(u);const p=new r.Matrix4;i!==null&&p.fromArray(i.array,l*16),A.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new r.Skeleton(a,A)})}loadAnimation(e){const t=this.json,s=this,n=t.animations[e],i=n.name?n.name:"animation_"+e,o=[],a=[],A=[],l=[],h=[];let u=0,p=n.channels.length;for(u=0,p=n.channels.length;u<p;u++){const g=n.channels[u],m=n.samplers[g.sampler],I=g.target,b=I.node,B=n.parameters!==void 0?n.parameters[m.input]:m.input,w=n.parameters!==void 0?n.parameters[m.output]:m.output;I.node!==void 0&&(o.push(this.getDependency("node",b)),a.push(this.getDependency("accessor",B)),A.push(this.getDependency("accessor",w)),l.push(m),h.push(I))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(A),Promise.all(l),Promise.all(h)]).then(function(g){const m=g[0],I=g[1],b=g[2],B=g[3],w=g[4],C=[];for(u=0,p=m.length;u<p;u++){const y=m[u],x=I[u],R=b[u],D=B[u],S=w[u];if(y===void 0)continue;y.updateMatrix&&y.updateMatrix();const v=s._createAnimationTracks(y,x,R,D,S);if(v)for(let U=0;U<v.length;U++)C.push(v[U])}return new r.AnimationClip(i,void 0,C)})}createNodeMesh(e){const t=this.json,s=this,n=t.nodes[e];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(i){const o=s._getNodeRef(s.meshCache,n.mesh,i);return n.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let A=0,l=n.weights.length;A<l;A++)a.morphTargetInfluences[A]=n.weights[A]}),o})}loadNode(e){const t=this.json,s=this,n=t.nodes[e],i=s._loadNodeShallow(e),o=[],a=n.children||[];for(let l=0,h=a.length;l<h;l++)o.push(s.getDependency("node",a[l]));const A=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([i,Promise.all(o),A]).then(function(l){const h=l[0],u=l[1],p=l[2];p!==null&&h.traverse(function(g){g.isSkinnedMesh&&g.bind(p,ar)});for(let g=0,m=u.length;g<m;g++)h.add(u[g]);return h})}_loadNodeShallow(e){const t=this.json,s=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const i=t.nodes[e],o=i.name?n.createUniqueName(i.name):"",a=[],A=n._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return A&&a.push(A),i.camera!==void 0&&a.push(n.getDependency("camera",i.camera).then(function(l){return n._getNodeRef(n.cameraCache,i.camera,l)})),n._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){a.push(l)}),this.nodeCache[e]=Promise.all(a).then(function(l){let h;if(i.isBone===!0?h=new r.Bone:l.length>1?h=new r.Group:l.length===1?h=l[0]:h=new r.Object3D,h!==l[0])for(let u=0,p=l.length;u<p;u++)h.add(l[u]);if(i.name&&(h.userData.name=i.name,h.name=o),ct(h,i),i.extensions&&bt(s,h,i),i.matrix!==void 0){const u=new r.Matrix4;u.fromArray(i.matrix),h.applyMatrix4(u)}else i.translation!==void 0&&h.position.fromArray(i.translation),i.rotation!==void 0&&h.quaternion.fromArray(i.rotation),i.scale!==void 0&&h.scale.fromArray(i.scale);return n.associations.has(h)||n.associations.set(h,{}),n.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],n=this,i=new r.Group;s.name&&(i.name=n.createUniqueName(s.name)),ct(i,s),s.extensions&&bt(t,i,s);const o=s.nodes||[],a=[];for(let A=0,l=o.length;A<l;A++)a.push(n.getDependency("node",o[A]));return Promise.all(a).then(function(A){for(let h=0,u=A.length;h<u;h++)i.add(A[h]);const l=h=>{const u=new Map;for(const[p,g]of n.associations)(p instanceof r.Material||p instanceof r.Texture)&&u.set(p,g);return h.traverse(p=>{const g=n.associations.get(p);g!=null&&u.set(p,g)}),u};return n.associations=l(i),i})}_createAnimationTracks(e,t,s,n,i){const o=[],a=e.name?e.name:e.uuid,A=[];dt[i.path]===dt.weights?e.traverse(function(p){p.morphTargetInfluences&&A.push(p.name?p.name:p.uuid)}):A.push(a);let l;switch(dt[i.path]){case dt.weights:l=r.NumberKeyframeTrack;break;case dt.rotation:l=r.QuaternionKeyframeTrack;break;case dt.position:case dt.scale:l=r.VectorKeyframeTrack;break;default:switch(s.itemSize){case 1:l=r.NumberKeyframeTrack;break;case 2:case 3:default:l=r.VectorKeyframeTrack;break}break}const h=n.interpolation!==void 0?tr[n.interpolation]:r.InterpolateLinear,u=this._getArrayFromAccessor(s);for(let p=0,g=A.length;p<g;p++){const m=new l(A[p]+"."+dt[i.path],t.array,u,h);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),o.push(m)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const s=jn(t.constructor),n=new Float32Array(t.length);for(let i=0,o=t.length;i<o;i++)n[i]=t[i]*s;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const n=this instanceof r.QuaternionKeyframeTrack?er:oi;return new n(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function cr(c,e,t){const s=e.attributes,n=new r.Box3;if(s.POSITION!==void 0){const a=t.json.accessors[s.POSITION],A=a.min,l=a.max;if(A!==void 0&&l!==void 0){if(n.set(new r.Vector3(A[0],A[1],A[2]),new r.Vector3(l[0],l[1],l[2])),a.normalized){const h=jn(Rt[a.componentType]);n.min.multiplyScalar(h),n.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=e.targets;if(i!==void 0){const a=new r.Vector3,A=new r.Vector3;for(let l=0,h=i.length;l<h;l++){const u=i[l];if(u.POSITION!==void 0){const p=t.json.accessors[u.POSITION],g=p.min,m=p.max;if(g!==void 0&&m!==void 0){if(A.setX(Math.max(Math.abs(g[0]),Math.abs(m[0]))),A.setY(Math.max(Math.abs(g[1]),Math.abs(m[1]))),A.setZ(Math.max(Math.abs(g[2]),Math.abs(m[2]))),p.normalized){const I=jn(Rt[p.componentType]);A.multiplyScalar(I)}a.max(A)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}c.boundingBox=n;const o=new r.Sphere;n.getCenter(o.center),o.radius=n.min.distanceTo(n.max)/2,c.boundingSphere=o}function ms(c,e,t){const s=e.attributes,n=[];function i(o,a){return t.getDependency("accessor",o).then(function(A){c.setAttribute(a,A)})}for(const o in s){const a=Hn[o]||o.toLowerCase();a in c.attributes||n.push(i(s[o],a))}if(e.indices!==void 0&&!c.index){const o=t.getDependency("accessor",e.indices).then(function(a){c.setIndex(a)});n.push(o)}return r.ColorManagement.workingColorSpace!==r.LinearSRGBColorSpace&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${r.ColorManagement.workingColorSpace}" not supported.`),ct(c,e),cr(c,e,t),Promise.all(n).then(function(){return e.targets!==void 0?sr(c,e.targets,t):c})}var lr=(function(){var c="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),s=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n=WebAssembly.validate(t)?e:c,i,o=WebAssembly.instantiate(a(n),{}).then(function(B){i=B.instance,i.exports.__wasm_call_ctors()});function a(B){for(var w=new Uint8Array(B.length),C=0;C<B.length;++C){var y=B.charCodeAt(C);w[C]=y>96?y-97:y>64?y-39:y+4}for(var x=0,C=0;C<B.length;++C)w[x++]=w[C]<60?s[w[C]]:(w[C]-60)*64+w[++C];return w.buffer.slice(0,x)}function A(B,w,C,y,x,R){var D=i.exports.sbrk,S=C+3&-4,v=D(S*y),U=D(x.length),G=new Uint8Array(i.exports.memory.buffer);G.set(x,U);var H=B(v,C,y,U,x.length);if(H==0&&R&&R(v,S,y),w.set(G.subarray(v,v+C*y)),D(v-D(0)),H!=0)throw new Error("Malformed buffer data: "+H)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],p=0;function g(B){var w={object:new Worker(B),pending:0,requests:{}};return w.object.onmessage=function(C){var y=C.data;w.pending-=y.count,w.requests[y.id][y.action](y.value),delete w.requests[y.id]},w}function m(B){for(var w="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(a(n))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+A.toString()+b.toString(),C=new Blob([w],{type:"text/javascript"}),y=URL.createObjectURL(C),x=0;x<B;++x)u[x]=g(y);URL.revokeObjectURL(y)}function I(B,w,C,y,x){for(var R=u[0],D=1;D<u.length;++D)u[D].pending<R.pending&&(R=u[D]);return new Promise(function(S,v){var U=new Uint8Array(C),G=p++;R.pending+=B,R.requests[G]={resolve:S,reject:v},R.object.postMessage({id:G,count:B,size:w,source:U,mode:y,filter:x},[U.buffer])})}function b(B){o.then(function(){var w=B.data;try{var C=new Uint8Array(w.count*w.size);A(i.exports[w.mode],C,w.count,w.size,w.source,i.exports[w.filter]),self.postMessage({id:w.id,count:w.count,action:"resolve",value:C},[C.buffer])}catch(y){self.postMessage({id:w.id,count:w.count,action:"reject",value:y})}})}return{ready:o,supported:!0,useWorkers:function(B){m(B)},decodeVertexBuffer:function(B,w,C,y,x){A(i.exports.meshopt_decodeVertexBuffer,B,w,C,y,i.exports[l[x]])},decodeIndexBuffer:function(B,w,C,y){A(i.exports.meshopt_decodeIndexBuffer,B,w,C,y)},decodeIndexSequence:function(B,w,C,y){A(i.exports.meshopt_decodeIndexSequence,B,w,C,y)},decodeGltfBuffer:function(B,w,C,y,x,R){A(i.exports[h[x]],B,w,C,y,i.exports[l[R]])},decodeGltfBufferAsync:function(B,w,C,y,x){return u.length>0?I(B,w,C,h[y],l[x]):o.then(function(){var R=new Uint8Array(B*w);return A(i.exports[h[y]],R,B,w,C,i.exports[l[x]]),R})}}})();const En=new WeakMap;class hr extends r.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,s,n){const i=new r.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,o=>{this.parse(o,t,n)},s,n)}parse(e,t,s=()=>{}){this.decodeDracoFile(e,t,null,null,r.SRGBColorSpace,s).catch(s)}decodeDracoFile(e,t,s,n,i=r.LinearSRGBColorSpace,o=()=>{}){const a={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:i};return this.decodeGeometry(e,a).then(t).catch(o)}decodeGeometry(e,t){const s=JSON.stringify(t);if(En.has(e)){const A=En.get(e);if(A.key===s)return A.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const i=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(i,o).then(A=>(n=A,new Promise((l,h)=>{n._callbacks[i]={resolve:l,reject:h},n.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(A=>this._createGeometry(A.geometry));return a.catch(()=>!0).then(()=>{n&&i&&this._releaseTask(n,i)}),En.set(e,{key:s,promise:a}),a}_createGeometry(e){const t=new r.BufferGeometry;e.index&&t.setIndex(new r.BufferAttribute(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const n=e.attributes[s],i=n.name,o=n.array,a=n.itemSize,A=new r.BufferAttribute(o,a);i==="color"&&(this._assignVertexColorSpace(A,n.vertexColorSpace),A.normalized=!(o instanceof Float32Array)),t.setAttribute(i,A)}return t}_assignVertexColorSpace(e,t){if(t!==r.SRGBColorSpace)return;const s=new r.Color;for(let n=0,i=e.count;n<i;n++)s.fromBufferAttribute(e,n),r.ColorManagement.toWorkingColorSpace(s,r.SRGBColorSpace),e.setXYZ(n,s.r,s.g,s.b)}_loadLibrary(e,t){const s=new r.FileLoader(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise((n,i)=>{s.load(e,n,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(s=>{const n=s[0];e||(this.decoderConfig.wasmBinary=s[1]);const i=ur.toString(),o=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join(`
33
+ `+this.flowCode[e])}}_addUniforms(){for(const e of r.defaultShaderStages)for(const t of this.uniforms[e])this.shader.uniforms[t.name]=t}_updateUniforms(){Ue.object=this.object,Ue.renderer=this.renderer,Ue.material=this.material,Ue.scene=this.scene;for(const e of this.updateNodes)Ue.updateNode(e)}}const si=new WeakMap;r.Material.prototype.onBuild=function(c,e,t){const s=this;if(s.isNodeMaterial===!0){let n;try{n=new To(c,t,e,s).build(),si.set(s,n)}catch(i){console.error("Material.prototype.onBuild: ",i)}}};r.Material.prototype.onBeforeRender=function(c,e,t,s,n){const i=si.get(this);if(i!==void 0){Ue.material=this,Ue.camera=t,Ue.object=n,Ue.renderer=c,Ue.scene=e,Ue.geometry=s;const o=i.updateNodes;if(o.length>0){c.state.useProgram(null);for(const a of o)Ue.updateNode(a)}}};var Jt=function(){var c=0,e=document.createElement("div");e.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",e.addEventListener("click",function(h){h.preventDefault(),s(++c%e.children.length)},!1);function t(h){return e.appendChild(h.dom),h}function s(h){for(var u=0;u<e.children.length;u++)e.children[u].style.display=u===h?"block":"none";c=h}var n=(performance||Date).now(),i=n,o=0,a=t(new Jt.Panel("FPS","#0ff","#002")),A=t(new Jt.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var l=t(new Jt.Panel("MB","#f08","#201"));return s(0),{REVISION:16,dom:e,addPanel:t,showPanel:s,begin:function(){n=(performance||Date).now()},end:function(){o++;var h=(performance||Date).now();if(A.update(h-n,200),h>=i+1e3&&(a.update(o*1e3/(h-i),100),i=h,o=0,l)){var u=performance.memory;l.update(u.usedJSHeapSize/1048576,u.jsHeapSizeLimit/1048576)}return h},update:function(){n=this.end()},domElement:e,setMode:s}};Jt.Panel=function(c,e,t){var s=1/0,n=0,i=Math.round,o=i(window.devicePixelRatio||1),a=80*o,A=48*o,l=3*o,h=2*o,u=3*o,p=15*o,g=74*o,m=30*o,I=document.createElement("canvas");I.width=a,I.height=A,I.style.cssText="width:80px;height:48px";var b=I.getContext("2d");return b.font="bold "+9*o+"px Helvetica,Arial,sans-serif",b.textBaseline="top",b.fillStyle=t,b.fillRect(0,0,a,A),b.fillStyle=e,b.fillText(c,l,h),b.fillRect(u,p,g,m),b.fillStyle=t,b.globalAlpha=.9,b.fillRect(u,p,g,m),{dom:I,update:function(B,w){s=Math.min(s,B),n=Math.max(n,B),b.fillStyle=t,b.globalAlpha=1,b.fillRect(0,0,a,p),b.fillStyle=e,b.fillText(i(B)+" "+c+" ("+i(s)+"-"+i(n)+")",l,h),b.drawImage(I,u+o,p,g-o,m,u,p,g-o,m),b.fillRect(u+g-o,p,o,m),b.fillStyle=t,b.globalAlpha=.9,b.fillRect(u+g-o,p,o,i((1-B/w)*m))}}};function vo(c,e=1e-4){e=Math.max(e,Number.EPSILON);const t={},s=c.getIndex(),n=c.getAttribute("position"),i=s?s.count:n.count;let o=0;const a=Object.keys(c.attributes),A={},l={},h=[],u=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"];for(let w=0,C=a.length;w<C;w++){const y=a[w],x=c.attributes[y];A[y]=new x.constructor(new x.array.constructor(x.count*x.itemSize),x.itemSize,x.normalized);const R=c.morphAttributes[y];R&&(l[y]||(l[y]=[]),R.forEach((D,S)=>{const v=new D.array.constructor(D.count*D.itemSize);l[y][S]=new D.constructor(v,D.itemSize,D.normalized)}))}const g=e*.5,m=Math.log10(1/e),I=Math.pow(10,m),b=g*I;for(let w=0;w<i;w++){const C=s?s.getX(w):w;let y="";for(let x=0,R=a.length;x<R;x++){const D=a[x],S=c.getAttribute(D),v=S.itemSize;for(let U=0;U<v;U++)y+=`${~~(S[u[U]](C)*I+b)},`}if(y in t)h.push(t[y]);else{for(let x=0,R=a.length;x<R;x++){const D=a[x],S=c.getAttribute(D),v=c.morphAttributes[D],U=S.itemSize,G=A[D],H=l[D];for(let X=0;X<U;X++){const N=u[X],Y=p[X];if(G[Y](o,S[N](C)),v)for(let O=0,Z=v.length;O<Z;O++)H[O][Y](o,v[O][N](C))}}t[y]=o,h.push(o),o++}}const B=c.clone();for(const w in c.attributes){const C=A[w];if(B.setAttribute(w,new C.constructor(C.array.slice(0,o*C.itemSize),C.itemSize,C.normalized)),w in l)for(let y=0;y<l[w].length;y++){const x=l[w][y];B.morphAttributes[w][y]=new x.constructor(x.array.slice(0,o*x.itemSize),x.itemSize,x.normalized)}}return B.setIndex(h),B}function ds(c,e){if(e===r.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),c;if(e===r.TriangleFanDrawMode||e===r.TriangleStripDrawMode){let t=c.getIndex();if(t===null){const o=[],a=c.getAttribute("position");if(a!==void 0){for(let A=0;A<a.count;A++)o.push(A);c.setIndex(o),t=c.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),c}const s=t.count-2,n=[];if(e===r.TriangleFanDrawMode)for(let o=1;o<=s;o++)n.push(t.getX(0)),n.push(t.getX(o)),n.push(t.getX(o+1));else for(let o=0;o<s;o++)o%2===0?(n.push(t.getX(o)),n.push(t.getX(o+1)),n.push(t.getX(o+2))):(n.push(t.getX(o+2)),n.push(t.getX(o+1)),n.push(t.getX(o)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=c.clone();return i.setIndex(n),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),c}class Zn extends r.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Fo(t)}),this.register(function(t){return new Lo(t)}),this.register(function(t){return new qo(t)}),this.register(function(t){return new zo(t)}),this.register(function(t){return new Yo(t)}),this.register(function(t){return new Go(t)}),this.register(function(t){return new No(t)}),this.register(function(t){return new Uo(t)}),this.register(function(t){return new Po(t)}),this.register(function(t){return new _o(t)}),this.register(function(t){return new Oo(t)}),this.register(function(t){return new ko(t)}),this.register(function(t){return new jo(t)}),this.register(function(t){return new Ho(t)}),this.register(function(t){return new Ro(t)}),this.register(function(t){return new Vo(t)}),this.register(function(t){return new Ko(t)})}load(e,t,s,n){const i=this;let o;if(this.resourcePath!=="")o=this.resourcePath;else if(this.path!==""){const l=r.LoaderUtils.extractUrlBase(e);o=r.LoaderUtils.resolveURL(l,this.path)}else o=r.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(l){n?n(l):console.error(l),i.manager.itemError(e),i.manager.itemEnd(e)},A=new r.FileLoader(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,function(l){try{i.parse(l,o,function(h){t(h),i.manager.itemEnd(e)},a)}catch(h){a(h)}},s,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,n){let i,o;const a={},A={},l=new TextDecoder;if(typeof e=="string")try{i=JSON.parse(e)}catch(u){o=e,n&&n(u);return}else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===ii){try{a[re.KHR_BINARY_GLTF]=new Jo(e)}catch(p){n&&n(p);return}try{i=JSON.parse(a[re.KHR_BINARY_GLTF].content)}catch(p){o=a[re.KHR_BINARY_GLTF].content,n&&n(p);return}}else try{i=JSON.parse(l.decode(e))}catch(p){o=l.decode(e),n&&n(p);return}else i=e;if(i.asset===void 0||i.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}this.json=i,this.jsonErrorData=o;const h=new Ar(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const p=this.pluginCallbacks[u](h);p.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),A[p.name]=p,a[p.name]=!0}if(i.extensionsUsed)for(let u=0;u<i.extensionsUsed.length;++u){const p=i.extensionsUsed[u],g=i.extensionsRequired||[];switch(p){case re.KHR_MATERIALS_UNLIT:a[p]=new Do;break;case re.KHR_DRACO_MESH_COMPRESSION:a[p]=new Wo(i,this.dracoLoader);break;case re.KHR_TEXTURE_TRANSFORM:a[p]=new Xo;break;case re.KHR_MESH_QUANTIZATION:a[p]=new Zo;break;default:g.indexOf(p)>=0&&A[p]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}h.setExtensions(a),h.setPlugins(A),h.parse(s,n)}parseAsync(e,t){const s=this;return new Promise(function(n,i){s.parse(e,t,n,i)})}}function Mo(){let c={};return{get:function(e){return c[e]},add:function(e,t){c[e]=t},remove:function(e){delete c[e]},removeAll:function(){c={}}}}const re={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Ro{constructor(e){this.parser=e,this.name=re.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,n=t.length;s<n;s++){const i=t[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let n=t.cache.get(s);if(n)return n;const i=t.json,A=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let l;const h=new r.Color(16777215);A.color!==void 0&&h.setRGB(A.color[0],A.color[1],A.color[2],r.LinearSRGBColorSpace);const u=A.range!==void 0?A.range:0;switch(A.type){case"directional":l=new r.DirectionalLight(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new r.PointLight(h),l.distance=u;break;case"spot":l=new r.SpotLight(h),l.distance=u,A.spot=A.spot||{},A.spot.innerConeAngle=A.spot.innerConeAngle!==void 0?A.spot.innerConeAngle:0,A.spot.outerConeAngle=A.spot.outerConeAngle!==void 0?A.spot.outerConeAngle:Math.PI/4,l.angle=A.spot.outerConeAngle,l.penumbra=1-A.spot.innerConeAngle/A.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+A.type)}return l.position.set(0,0,0),l.decay=2,ct(l,A),A.intensity!==void 0&&(l.intensity=A.intensity),l.name=t.createUniqueName(A.name||"light_"+e),n=Promise.resolve(l),t.cache.add(s,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,i=s.json.nodes[e],a=(i.extensions&&i.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(A){return s._getNodeRef(t.cache,a,A)})}}let Do=class{constructor(){this.name=re.KHR_MATERIALS_UNLIT}getMaterialType(){return r.MeshBasicMaterial}extendParams(e,t,s){const n=[];e.color=new r.Color(1,1,1),e.opacity=1;const i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const o=i.baseColorFactor;e.color.setRGB(o[0],o[1],o[2],r.LinearSRGBColorSpace),e.opacity=o[3]}i.baseColorTexture!==void 0&&n.push(s.assignTexture(e,"map",i.baseColorTexture,r.SRGBColorSpace))}return Promise.all(n)}},_o=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return i!==void 0&&(t.emissiveIntensity=i),Promise.resolve()}},Fo=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&i.push(s.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&i.push(s.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(i.push(s.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new r.Vector2(a,a)}return Promise.all(i)}},Lo=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_DISPERSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=i.dispersion!==void 0?i.dispersion:0,Promise.resolve()}},ko=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&i.push(s.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&i.push(s.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}},Go=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[];t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=n.extensions[this.name];if(o.sheenColorFactor!==void 0){const a=o.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],r.LinearSRGBColorSpace)}return o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&i.push(s.assignTexture(t,"sheenColorMap",o.sheenColorTexture,r.SRGBColorSpace)),o.sheenRoughnessTexture!==void 0&&i.push(s.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}},No=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&i.push(s.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(i)}},Uo=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&i.push(s.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const a=o.attenuationColor||[1,1,1];return t.attenuationColor=new r.Color().setRGB(a[0],a[1],a[2],r.LinearSRGBColorSpace),Promise.all(i)}},Po=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}},Oo=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&i.push(s.assignTexture(t,"specularIntensityMap",o.specularTexture));const a=o.specularColorFactor||[1,1,1];return t.specularColor=new r.Color().setRGB(a[0],a[1],a[2],r.LinearSRGBColorSpace),o.specularColorTexture!==void 0&&i.push(s.assignTexture(t,"specularColorMap",o.specularColorTexture,r.SRGBColorSpace)),Promise.all(i)}},Ho=class{constructor(e){this.parser=e,this.name=re.EXT_MATERIALS_BUMP}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return t.bumpScale=o.bumpFactor!==void 0?o.bumpFactor:1,o.bumpTexture!==void 0&&i.push(s.assignTexture(t,"bumpMap",o.bumpTexture)),Promise.all(i)}},jo=class{constructor(e){this.parser=e,this.name=re.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:r.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&i.push(s.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(i)}};class qo{constructor(e){this.parser=e,this.name=re.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,n=s.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const i=n.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,o)}}class zo{constructor(e){this.parser=e,this.name=re.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],a=n.images[o.source];let A=s.textureLoader;if(a.uri){const l=s.options.manager.getHandler(a.uri);l!==null&&(A=l)}return this.detectSupport().then(function(l){if(l)return s.loadTextureImage(e,o.source,A);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Yo{constructor(e){this.parser=e,this.name=re.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],a=n.images[o.source];let A=s.textureLoader;if(a.uri){const l=s.options.manager.getHandler(a.uri);l!==null&&(A=l)}return this.detectSupport().then(function(l){if(l)return s.loadTextureImage(e,o.source,A);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Vo{constructor(e){this.name=re.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(a){const A=n.byteOffset||0,l=n.byteLength||0,h=n.count,u=n.byteStride,p=new Uint8Array(a,A,l);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,u,p,n.mode,n.filter).then(function(g){return g.buffer}):o.ready.then(function(){const g=new ArrayBuffer(h*u);return o.decodeGltfBuffer(new Uint8Array(g),h,u,p,n.mode,n.filter),g})})}else return null}}let Ko=class{constructor(e){this.name=re.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=t.meshes[s.mesh];for(const l of n.primitives)if(l.mode!==We.TRIANGLES&&l.mode!==We.TRIANGLE_STRIP&&l.mode!==We.TRIANGLE_FAN&&l.mode!==void 0)return null;const o=s.extensions[this.name].attributes,a=[],A={};for(const l in o)a.push(this.parser.getDependency("accessor",o[l]).then(h=>(A[l]=h,A[l])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(l=>{const h=l.pop(),u=h.isGroup?h.children:[h],p=l[0].count,g=[];for(const m of u){const I=new r.Matrix4,b=new r.Vector3,B=new r.Quaternion,w=new r.Vector3(1,1,1),C=new r.InstancedMesh(m.geometry,m.material,p);for(let y=0;y<p;y++)A.TRANSLATION&&b.fromBufferAttribute(A.TRANSLATION,y),A.ROTATION&&B.fromBufferAttribute(A.ROTATION,y),A.SCALE&&w.fromBufferAttribute(A.SCALE,y),C.setMatrixAt(y,I.compose(b,B,w));for(const y in A)if(y==="_COLOR_0"){const x=A[y];C.instanceColor=new r.InstancedBufferAttribute(x.array,x.itemSize,x.normalized)}else y!=="TRANSLATION"&&y!=="ROTATION"&&y!=="SCALE"&&m.geometry.setAttribute(y,A[y]);r.Object3D.prototype.copy.call(C,m),this.parser.assignFinalMaterial(C),g.push(C)}return h.isGroup?(h.clear(),h.add(...g),h):g[0]}))}};const ii="glTF",Lt=12,ps={JSON:1313821514,BIN:5130562};class Jo{constructor(e){this.name=re.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Lt),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==ii)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-Lt,i=new DataView(e,Lt);let o=0;for(;o<n;){const a=i.getUint32(o,!0);o+=4;const A=i.getUint32(o,!0);if(o+=4,A===ps.JSON){const l=new Uint8Array(e,Lt+o,a);this.content=s.decode(l)}else if(A===ps.BIN){const l=Lt+o;this.body=e.slice(l,l+a)}o+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Wo{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=re.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},A={},l={};for(const h in o){const u=Hn[h]||h.toLowerCase();a[u]=o[h]}for(const h in e.attributes){const u=Hn[h]||h.toLowerCase();if(o[h]!==void 0){const p=s.accessors[e.attributes[h]],g=Rt[p.componentType];l[u]=g.name,A[u]=p.normalized===!0}}return t.getDependency("bufferView",i).then(function(h){return new Promise(function(u,p){n.decodeDracoFile(h,function(g){for(const m in g.attributes){const I=g.attributes[m],b=A[m];b!==void 0&&(I.normalized=b)}u(g)},a,l,r.LinearSRGBColorSpace,p)})})}}class Xo{constructor(){this.name=re.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Zo{constructor(){this.name=re.KHR_MESH_QUANTIZATION}}class oi extends r.Interpolant{constructor(e,t,s,n){super(e,t,s,n)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,n=this.valueSize,i=e*n*3+n;for(let o=0;o!==n;o++)t[o]=s[i+o];return t}interpolate_(e,t,s,n){const i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,A=a*2,l=a*3,h=n-t,u=(s-t)/h,p=u*u,g=p*u,m=e*l,I=m-l,b=-2*g+3*p,B=g-p,w=1-b,C=B-p+u;for(let y=0;y!==a;y++){const x=o[I+y+a],R=o[I+y+A]*h,D=o[m+y+a],S=o[m+y]*h;i[y]=w*x+C*R+b*D+B*S}return i}}const $o=new r.Quaternion;class er extends oi{interpolate_(e,t,s,n){const i=super.interpolate_(e,t,s,n);return $o.fromArray(i).normalize().toArray(i),i}}const We={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Rt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},gs={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},fs={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},mn={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Hn={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},dt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},tr={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete},In={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function nr(c){return c.DefaultMaterial===void 0&&(c.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),c.DefaultMaterial}function bt(c,e,t){for(const s in t.extensions)c[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function ct(c,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(c.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function sr(c,e,t){let s=!1,n=!1,i=!1;for(let l=0,h=e.length;l<h;l++){const u=e[l];if(u.POSITION!==void 0&&(s=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(i=!0),s&&n&&i)break}if(!s&&!n&&!i)return Promise.resolve(c);const o=[],a=[],A=[];for(let l=0,h=e.length;l<h;l++){const u=e[l];if(s){const p=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):c.attributes.position;o.push(p)}if(n){const p=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):c.attributes.normal;a.push(p)}if(i){const p=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):c.attributes.color;A.push(p)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(A)]).then(function(l){const h=l[0],u=l[1],p=l[2];return s&&(c.morphAttributes.position=h),n&&(c.morphAttributes.normal=u),i&&(c.morphAttributes.color=p),c.morphTargetsRelative=!0,c})}function ir(c,e){if(c.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)c.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(c.morphTargetInfluences.length===t.length){c.morphTargetDictionary={};for(let s=0,n=t.length;s<n;s++)c.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function or(c){let e;const t=c.extensions&&c.extensions[re.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+bn(t.attributes):e=c.indices+":"+bn(c.attributes)+":"+c.mode,c.targets!==void 0)for(let s=0,n=c.targets.length;s<n;s++)e+=":"+bn(c.targets[s]);return e}function bn(c){let e="";const t=Object.keys(c).sort();for(let s=0,n=t.length;s<n;s++)e+=t[s]+":"+c[t[s]]+";";return e}function jn(c){switch(c){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function rr(c){return c.search(/\.jpe?g($|\?)/i)>0||c.search(/^data\:image\/jpeg/)===0?"image/jpeg":c.search(/\.webp($|\?)/i)>0||c.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const ar=new r.Matrix4;class Ar{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Mo,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,n=-1,i=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const A=a.match(/Version\/(\d+)/);n=s&&A?parseInt(A[1],10):-1,i=a.indexOf("Firefox")>-1,o=i?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&n<17||i&&o<98?this.textureLoader=new r.TextureLoader(this.options.manager):this.textureLoader=new r.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(o){const a={scene:o[0][n.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:n.asset,parser:s,userData:{}};return bt(i,a,n),ct(a,n),Promise.all(s._invokeAll(function(A){return A.afterRoot&&A.afterRoot(a)})).then(function(){for(const A of a.scenes)A.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n].joints;for(let a=0,A=o.length;a<A;a++)e[o[a]].isBone=!0}for(let n=0,i=e.length;n<i;n++){const o=e[n];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(s[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const n=s.clone(),i=(o,a)=>{const A=this.associations.get(o);A!=null&&this.associations.set(a,A);for(const[l,h]of o.children.entries())i(h,a.children[l])};return i(s,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const n=e(t[s]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let n=0;n<t.length;n++){const i=e(t[n]);i&&s.push(i)}return s}getDependency(e,t){const s=e+":"+t;let n=this.cache.get(s);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(i){return i.loadNode&&i.loadNode(t)});break;case"mesh":n=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(s,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(i,o){return s.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[re.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(i,o){s.load(r.LoaderUtils.resolveURL(t.uri,n.path),i,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const n=t.byteLength||0,i=t.byteOffset||0;return s.slice(i,i+n)})}loadAccessor(e){const t=this,s=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const o=mn[n.type],a=Rt[n.componentType],A=n.normalized===!0,l=new a(n.count*o);return Promise.resolve(new r.BufferAttribute(l,o,A))}const i=[];return n.bufferView!==void 0?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),n.sparse!==void 0&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(o){const a=o[0],A=mn[n.type],l=Rt[n.componentType],h=l.BYTES_PER_ELEMENT,u=h*A,p=n.byteOffset||0,g=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,m=n.normalized===!0;let I,b;if(g&&g!==u){const B=Math.floor(p/g),w="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+B+":"+n.count;let C=t.cache.get(w);C||(I=new l(a,B*g,n.count*g/h),C=new r.InterleavedBuffer(I,g/h),t.cache.add(w,C)),b=new r.InterleavedBufferAttribute(C,A,p%g/h,m)}else a===null?I=new l(n.count*A):I=new l(a,p,n.count*A),b=new r.BufferAttribute(I,A,m);if(n.sparse!==void 0){const B=mn.SCALAR,w=Rt[n.sparse.indices.componentType],C=n.sparse.indices.byteOffset||0,y=n.sparse.values.byteOffset||0,x=new w(o[1],C,n.sparse.count*B),R=new l(o[2],y,n.sparse.count*A);a!==null&&(b=new r.BufferAttribute(b.array.slice(),b.itemSize,b.normalized)),b.normalized=!1;for(let D=0,S=x.length;D<S;D++){const v=x[D];if(b.setX(v,R[D*A]),A>=2&&b.setY(v,R[D*A+1]),A>=3&&b.setZ(v,R[D*A+2]),A>=4&&b.setW(v,R[D*A+3]),A>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}b.normalized=m}return b})}loadTexture(e){const t=this.json,s=this.options,i=t.textures[e].source,o=t.images[i];let a=this.textureLoader;if(o.uri){const A=s.manager.getHandler(o.uri);A!==null&&(a=A)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,s){const n=this,i=this.json,o=i.textures[e],a=i.images[t],A=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[A])return this.textureCache[A];const l=this.loadImageSource(t,s).then(function(h){h.flipY=!1,h.name=o.name||a.name||"",h.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(h.name=a.uri);const p=(i.samplers||{})[o.sampler]||{};return h.magFilter=gs[p.magFilter]||r.LinearFilter,h.minFilter=gs[p.minFilter]||r.LinearMipmapLinearFilter,h.wrapS=fs[p.wrapS]||r.RepeatWrapping,h.wrapT=fs[p.wrapT]||r.RepeatWrapping,h.anisotropy=4,n.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[A]=l,l}loadImageSource(e,t){const s=this,n=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=n.images[e],a=self.URL||self.webkitURL;let A=o.uri||"",l=!1;if(o.bufferView!==void 0)A=s.getDependency("bufferView",o.bufferView).then(function(u){l=!0;const p=new Blob([u],{type:o.mimeType});return A=a.createObjectURL(p),A});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(A).then(function(u){return new Promise(function(p,g){let m=p;t.isImageBitmapLoader===!0&&(m=function(I){const b=new r.Texture(I);b.needsUpdate=!0,p(b)}),t.load(r.LoaderUtils.resolveURL(u,i.path),m,void 0,g)})}).then(function(u){return l===!0&&a.revokeObjectURL(A),ct(u,o),u.userData.mimeType=o.mimeType||rr(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",A),u});return this.sourceCache[e]=h,h}assignTexture(e,t,s,n){const i=this;return this.getDependency("texture",s.index).then(function(o){if(!o)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(o=o.clone(),o.channel=s.texCoord),i.extensions[re.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[re.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const A=i.associations.get(o);o=i.extensions[re.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),i.associations.set(o,A)}}return n!==void 0&&(o.colorSpace=n),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const n=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+s.uuid;let A=this.cache.get(a);A||(A=new r.PointsMaterial,r.Material.prototype.copy.call(A,s),A.color.copy(s.color),A.map=s.map,A.sizeAttenuation=!1,this.cache.add(a,A)),s=A}else if(e.isLine){const a="LineBasicMaterial:"+s.uuid;let A=this.cache.get(a);A||(A=new r.LineBasicMaterial,r.Material.prototype.copy.call(A,s),A.color.copy(s.color),A.map=s.map,this.cache.add(a,A)),s=A}if(n||i||o){let a="ClonedMaterial:"+s.uuid+":";n&&(a+="derivative-tangents:"),i&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let A=this.cache.get(a);A||(A=s.clone(),i&&(A.vertexColors=!0),o&&(A.flatShading=!0),n&&(A.normalScale&&(A.normalScale.y*=-1),A.clearcoatNormalScale&&(A.clearcoatNormalScale.y*=-1)),this.cache.add(a,A),this.associations.set(A,this.associations.get(s))),s=A}e.material=s}getMaterialType(){return r.MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,n=this.extensions,i=s.materials[e];let o;const a={},A=i.extensions||{},l=[];if(A[re.KHR_MATERIALS_UNLIT]){const u=n[re.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),l.push(u.extendParams(a,i,t))}else{const u=i.pbrMetallicRoughness||{};if(a.color=new r.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const p=u.baseColorFactor;a.color.setRGB(p[0],p[1],p[2],r.LinearSRGBColorSpace),a.opacity=p[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(a,"map",u.baseColorTexture,r.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}i.doubleSided===!0&&(a.side=r.DoubleSide);const h=i.alphaMode||In.OPAQUE;if(h===In.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===In.MASK&&(a.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&o!==r.MeshBasicMaterial&&(l.push(t.assignTexture(a,"normalMap",i.normalTexture)),a.normalScale=new r.Vector2(1,1),i.normalTexture.scale!==void 0)){const u=i.normalTexture.scale;a.normalScale.set(u,u)}if(i.occlusionTexture!==void 0&&o!==r.MeshBasicMaterial&&(l.push(t.assignTexture(a,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&o!==r.MeshBasicMaterial){const u=i.emissiveFactor;a.emissive=new r.Color().setRGB(u[0],u[1],u[2],r.LinearSRGBColorSpace)}return i.emissiveTexture!==void 0&&o!==r.MeshBasicMaterial&&l.push(t.assignTexture(a,"emissiveMap",i.emissiveTexture,r.SRGBColorSpace)),Promise.all(l).then(function(){const u=new o(a);return i.name&&(u.name=i.name),ct(u,i),t.associations.set(u,{materials:e}),i.extensions&&bt(n,u,i),u})}createUniqueName(e){const t=r.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,n=this.primitiveCache;function i(a){return s[re.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(A){return ms(A,a,t)})}const o=[];for(let a=0,A=e.length;a<A;a++){const l=e[a],h=or(l),u=n[h];if(u)o.push(u.promise);else{let p;l.extensions&&l.extensions[re.KHR_DRACO_MESH_COMPRESSION]?p=i(l):p=ms(new r.BufferGeometry,l,t),n[h]={primitive:l,promise:p},o.push(p)}}return Promise.all(o)}loadMesh(e){const t=this,s=this.json,n=this.extensions,i=s.meshes[e],o=i.primitives,a=[];for(let A=0,l=o.length;A<l;A++){const h=o[A].material===void 0?nr(this.cache):this.getDependency("material",o[A].material);a.push(h)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(A){const l=A.slice(0,A.length-1),h=A[A.length-1],u=[];for(let g=0,m=h.length;g<m;g++){const I=h[g],b=o[g];let B;const w=l[g];if(b.mode===We.TRIANGLES||b.mode===We.TRIANGLE_STRIP||b.mode===We.TRIANGLE_FAN||b.mode===void 0)B=i.isSkinnedMesh===!0?new r.SkinnedMesh(I,w):new r.Mesh(I,w),B.isSkinnedMesh===!0&&B.normalizeSkinWeights(),b.mode===We.TRIANGLE_STRIP?B.geometry=ds(B.geometry,r.TriangleStripDrawMode):b.mode===We.TRIANGLE_FAN&&(B.geometry=ds(B.geometry,r.TriangleFanDrawMode));else if(b.mode===We.LINES)B=new r.LineSegments(I,w);else if(b.mode===We.LINE_STRIP)B=new r.Line(I,w);else if(b.mode===We.LINE_LOOP)B=new r.LineLoop(I,w);else if(b.mode===We.POINTS)B=new r.Points(I,w);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+b.mode);Object.keys(B.geometry.morphAttributes).length>0&&ir(B,i),B.name=t.createUniqueName(i.name||"mesh_"+e),ct(B,i),b.extensions&&bt(n,B,b),t.assignFinalMaterial(B),u.push(B)}for(let g=0,m=u.length;g<m;g++)t.associations.set(u[g],{meshes:e,primitives:g});if(u.length===1)return i.extensions&&bt(n,u[0],i),u[0];const p=new r.Group;i.extensions&&bt(n,p,i),t.associations.set(p,{meshes:e});for(let g=0,m=u.length;g<m;g++)p.add(u[g]);return p})}loadCamera(e){let t;const s=this.json.cameras[e],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),ct(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let n=0,i=t.joints.length;n<i;n++)s.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const i=n.pop(),o=n,a=[],A=[];for(let l=0,h=o.length;l<h;l++){const u=o[l];if(u){a.push(u);const p=new r.Matrix4;i!==null&&p.fromArray(i.array,l*16),A.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new r.Skeleton(a,A)})}loadAnimation(e){const t=this.json,s=this,n=t.animations[e],i=n.name?n.name:"animation_"+e,o=[],a=[],A=[],l=[],h=[];let u=0,p=n.channels.length;for(u=0,p=n.channels.length;u<p;u++){const g=n.channels[u],m=n.samplers[g.sampler],I=g.target,b=I.node,B=n.parameters!==void 0?n.parameters[m.input]:m.input,w=n.parameters!==void 0?n.parameters[m.output]:m.output;I.node!==void 0&&(o.push(this.getDependency("node",b)),a.push(this.getDependency("accessor",B)),A.push(this.getDependency("accessor",w)),l.push(m),h.push(I))}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(A),Promise.all(l),Promise.all(h)]).then(function(g){const m=g[0],I=g[1],b=g[2],B=g[3],w=g[4],C=[];for(u=0,p=m.length;u<p;u++){const y=m[u],x=I[u],R=b[u],D=B[u],S=w[u];if(y===void 0)continue;y.updateMatrix&&y.updateMatrix();const v=s._createAnimationTracks(y,x,R,D,S);if(v)for(let U=0;U<v.length;U++)C.push(v[U])}return new r.AnimationClip(i,void 0,C)})}createNodeMesh(e){const t=this.json,s=this,n=t.nodes[e];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(i){const o=s._getNodeRef(s.meshCache,n.mesh,i);return n.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let A=0,l=n.weights.length;A<l;A++)a.morphTargetInfluences[A]=n.weights[A]}),o})}loadNode(e){const t=this.json,s=this,n=t.nodes[e],i=s._loadNodeShallow(e),o=[],a=n.children||[];for(let l=0,h=a.length;l<h;l++)o.push(s.getDependency("node",a[l]));const A=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([i,Promise.all(o),A]).then(function(l){const h=l[0],u=l[1],p=l[2];p!==null&&h.traverse(function(g){g.isSkinnedMesh&&g.bind(p,ar)});for(let g=0,m=u.length;g<m;g++)h.add(u[g]);return h})}_loadNodeShallow(e){const t=this.json,s=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const i=t.nodes[e],o=i.name?n.createUniqueName(i.name):"",a=[],A=n._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return A&&a.push(A),i.camera!==void 0&&a.push(n.getDependency("camera",i.camera).then(function(l){return n._getNodeRef(n.cameraCache,i.camera,l)})),n._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){a.push(l)}),this.nodeCache[e]=Promise.all(a).then(function(l){let h;if(i.isBone===!0?h=new r.Bone:l.length>1?h=new r.Group:l.length===1?h=l[0]:h=new r.Object3D,h!==l[0])for(let u=0,p=l.length;u<p;u++)h.add(l[u]);if(i.name&&(h.userData.name=i.name,h.name=o),ct(h,i),i.extensions&&bt(s,h,i),i.matrix!==void 0){const u=new r.Matrix4;u.fromArray(i.matrix),h.applyMatrix4(u)}else i.translation!==void 0&&h.position.fromArray(i.translation),i.rotation!==void 0&&h.quaternion.fromArray(i.rotation),i.scale!==void 0&&h.scale.fromArray(i.scale);return n.associations.has(h)||n.associations.set(h,{}),n.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],n=this,i=new r.Group;s.name&&(i.name=n.createUniqueName(s.name)),ct(i,s),s.extensions&&bt(t,i,s);const o=s.nodes||[],a=[];for(let A=0,l=o.length;A<l;A++)a.push(n.getDependency("node",o[A]));return Promise.all(a).then(function(A){for(let h=0,u=A.length;h<u;h++)i.add(A[h]);const l=h=>{const u=new Map;for(const[p,g]of n.associations)(p instanceof r.Material||p instanceof r.Texture)&&u.set(p,g);return h.traverse(p=>{const g=n.associations.get(p);g!=null&&u.set(p,g)}),u};return n.associations=l(i),i})}_createAnimationTracks(e,t,s,n,i){const o=[],a=e.name?e.name:e.uuid,A=[];dt[i.path]===dt.weights?e.traverse(function(p){p.morphTargetInfluences&&A.push(p.name?p.name:p.uuid)}):A.push(a);let l;switch(dt[i.path]){case dt.weights:l=r.NumberKeyframeTrack;break;case dt.rotation:l=r.QuaternionKeyframeTrack;break;case dt.position:case dt.scale:l=r.VectorKeyframeTrack;break;default:s.itemSize===1?l=r.NumberKeyframeTrack:l=r.VectorKeyframeTrack;break}const h=n.interpolation!==void 0?tr[n.interpolation]:r.InterpolateLinear,u=this._getArrayFromAccessor(s);for(let p=0,g=A.length;p<g;p++){const m=new l(A[p]+"."+dt[i.path],t.array,u,h);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),o.push(m)}return o}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const s=jn(t.constructor),n=new Float32Array(t.length);for(let i=0,o=t.length;i<o;i++)n[i]=t[i]*s;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const n=this instanceof r.QuaternionKeyframeTrack?er:oi;return new n(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function cr(c,e,t){const s=e.attributes,n=new r.Box3;if(s.POSITION!==void 0){const a=t.json.accessors[s.POSITION],A=a.min,l=a.max;if(A!==void 0&&l!==void 0){if(n.set(new r.Vector3(A[0],A[1],A[2]),new r.Vector3(l[0],l[1],l[2])),a.normalized){const h=jn(Rt[a.componentType]);n.min.multiplyScalar(h),n.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=e.targets;if(i!==void 0){const a=new r.Vector3,A=new r.Vector3;for(let l=0,h=i.length;l<h;l++){const u=i[l];if(u.POSITION!==void 0){const p=t.json.accessors[u.POSITION],g=p.min,m=p.max;if(g!==void 0&&m!==void 0){if(A.setX(Math.max(Math.abs(g[0]),Math.abs(m[0]))),A.setY(Math.max(Math.abs(g[1]),Math.abs(m[1]))),A.setZ(Math.max(Math.abs(g[2]),Math.abs(m[2]))),p.normalized){const I=jn(Rt[p.componentType]);A.multiplyScalar(I)}a.max(A)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}c.boundingBox=n;const o=new r.Sphere;n.getCenter(o.center),o.radius=n.min.distanceTo(n.max)/2,c.boundingSphere=o}function ms(c,e,t){const s=e.attributes,n=[];function i(o,a){return t.getDependency("accessor",o).then(function(A){c.setAttribute(a,A)})}for(const o in s){const a=Hn[o]||o.toLowerCase();a in c.attributes||n.push(i(s[o],a))}if(e.indices!==void 0&&!c.index){const o=t.getDependency("accessor",e.indices).then(function(a){c.setIndex(a)});n.push(o)}return r.ColorManagement.workingColorSpace!==r.LinearSRGBColorSpace&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${r.ColorManagement.workingColorSpace}" not supported.`),ct(c,e),cr(c,e,t),Promise.all(n).then(function(){return e.targets!==void 0?sr(c,e.targets,t):c})}var lr=(function(){var c="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",e="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),s=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n=WebAssembly.validate(t)?e:c,i,o=WebAssembly.instantiate(a(n),{}).then(function(B){i=B.instance,i.exports.__wasm_call_ctors()});function a(B){for(var w=new Uint8Array(B.length),C=0;C<B.length;++C){var y=B.charCodeAt(C);w[C]=y>96?y-97:y>64?y-39:y+4}for(var x=0,C=0;C<B.length;++C)w[x++]=w[C]<60?s[w[C]]:(w[C]-60)*64+w[++C];return w.buffer.slice(0,x)}function A(B,w,C,y,x,R){var D=i.exports.sbrk,S=C+3&-4,v=D(S*y),U=D(x.length),G=new Uint8Array(i.exports.memory.buffer);G.set(x,U);var H=B(v,C,y,U,x.length);if(H==0&&R&&R(v,S,y),w.set(G.subarray(v,v+C*y)),D(v-D(0)),H!=0)throw new Error("Malformed buffer data: "+H)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],p=0;function g(B){var w={object:new Worker(B),pending:0,requests:{}};return w.object.onmessage=function(C){var y=C.data;w.pending-=y.count,w.requests[y.id][y.action](y.value),delete w.requests[y.id]},w}function m(B){for(var w="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(a(n))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+A.toString()+b.toString(),C=new Blob([w],{type:"text/javascript"}),y=URL.createObjectURL(C),x=0;x<B;++x)u[x]=g(y);URL.revokeObjectURL(y)}function I(B,w,C,y,x){for(var R=u[0],D=1;D<u.length;++D)u[D].pending<R.pending&&(R=u[D]);return new Promise(function(S,v){var U=new Uint8Array(C),G=p++;R.pending+=B,R.requests[G]={resolve:S,reject:v},R.object.postMessage({id:G,count:B,size:w,source:U,mode:y,filter:x},[U.buffer])})}function b(B){o.then(function(){var w=B.data;try{var C=new Uint8Array(w.count*w.size);A(i.exports[w.mode],C,w.count,w.size,w.source,i.exports[w.filter]),self.postMessage({id:w.id,count:w.count,action:"resolve",value:C},[C.buffer])}catch(y){self.postMessage({id:w.id,count:w.count,action:"reject",value:y})}})}return{ready:o,supported:!0,useWorkers:function(B){m(B)},decodeVertexBuffer:function(B,w,C,y,x){A(i.exports.meshopt_decodeVertexBuffer,B,w,C,y,i.exports[l[x]])},decodeIndexBuffer:function(B,w,C,y){A(i.exports.meshopt_decodeIndexBuffer,B,w,C,y)},decodeIndexSequence:function(B,w,C,y){A(i.exports.meshopt_decodeIndexSequence,B,w,C,y)},decodeGltfBuffer:function(B,w,C,y,x,R){A(i.exports[h[x]],B,w,C,y,i.exports[l[R]])},decodeGltfBufferAsync:function(B,w,C,y,x){return u.length>0?I(B,w,C,h[y],l[x]):o.then(function(){var R=new Uint8Array(B*w);return A(i.exports[h[y]],R,B,w,C,i.exports[l[x]]),R})}}})();const En=new WeakMap;class hr extends r.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,s,n){const i=new r.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,o=>{this.parse(o,t,n)},s,n)}parse(e,t,s=()=>{}){this.decodeDracoFile(e,t,null,null,r.SRGBColorSpace,s).catch(s)}decodeDracoFile(e,t,s,n,i=r.LinearSRGBColorSpace,o=()=>{}){const a={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:i};return this.decodeGeometry(e,a).then(t).catch(o)}decodeGeometry(e,t){const s=JSON.stringify(t);if(En.has(e)){const A=En.get(e);if(A.key===s)return A.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const i=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(i,o).then(A=>(n=A,new Promise((l,h)=>{n._callbacks[i]={resolve:l,reject:h},n.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(A=>this._createGeometry(A.geometry));return a.catch(()=>!0).then(()=>{n&&i&&this._releaseTask(n,i)}),En.set(e,{key:s,promise:a}),a}_createGeometry(e){const t=new r.BufferGeometry;e.index&&t.setIndex(new r.BufferAttribute(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const n=e.attributes[s],i=n.name,o=n.array,a=n.itemSize,A=new r.BufferAttribute(o,a);i==="color"&&(this._assignVertexColorSpace(A,n.vertexColorSpace),A.normalized=!(o instanceof Float32Array)),t.setAttribute(i,A)}return t}_assignVertexColorSpace(e,t){if(t!==r.SRGBColorSpace)return;const s=new r.Color;for(let n=0,i=e.count;n<i;n++)s.fromBufferAttribute(e,n),r.ColorManagement.toWorkingColorSpace(s,r.SRGBColorSpace),e.setXYZ(n,s.r,s.g,s.b)}_loadLibrary(e,t){const s=new r.FileLoader(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise((n,i)=>{s.load(e,n,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(s=>{const n=s[0];e||(this.decoderConfig.wasmBinary=s[1]);const i=ur.toString(),o=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join(`
34
34
  `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(i){const o=i.data;switch(o.type){case"decode":n._callbacks[o.id].resolve(o);break;case"error":n._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,i){return n._taskLoad>i._taskLoad?-1:1});const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function ur(){let c,e;onmessage=function(o){const a=o.data;switch(a.type){case"init":c=a.decoderConfig,e=new Promise(function(h){c.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(c)});break;case"decode":const A=a.buffer,l=a.taskConfig;e.then(h=>{const u=h.draco,p=new u.Decoder;try{const g=t(u,p,new Int8Array(A),l),m=g.attributes.map(I=>I.array.buffer);g.index&&m.push(g.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:g},m)}catch(g){console.error(g),self.postMessage({type:"error",id:a.id,error:g.message})}finally{u.destroy(p)}});break}};function t(o,a,A,l){const h=l.attributeIDs,u=l.attributeTypes;let p,g;const m=a.GetEncodedGeometryType(A);if(m===o.TRIANGULAR_MESH)p=new o.Mesh,g=a.DecodeArrayToMesh(A,A.byteLength,p);else if(m===o.POINT_CLOUD)p=new o.PointCloud,g=a.DecodeArrayToPointCloud(A,A.byteLength,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());const I={index:null,attributes:[]};for(const b in h){const B=self[u[b]];let w,C;if(l.useUniqueIDs)C=h[b],w=a.GetAttributeByUniqueId(p,C);else{if(C=a.GetAttributeId(p,o[h[b]]),C===-1)continue;w=a.GetAttribute(p,C)}const y=n(o,a,p,b,B,w);b==="color"&&(y.vertexColorSpace=l.vertexColorSpace),I.attributes.push(y)}return m===o.TRIANGULAR_MESH&&(I.index=s(o,a,p)),o.destroy(p),I}function s(o,a,A){const h=A.num_faces()*3,u=h*4,p=o._malloc(u);a.GetTrianglesUInt32Array(A,u,p);const g=new Uint32Array(o.HEAPF32.buffer,p,h).slice();return o._free(p),{array:g,itemSize:1}}function n(o,a,A,l,h,u){const p=u.num_components(),m=A.num_points()*p,I=m*h.BYTES_PER_ELEMENT,b=i(o,h),B=o._malloc(I);a.GetAttributeDataArrayForAllPoints(A,u,b,I,B);const w=new h(o.HEAPF32.buffer,B,m).slice();return o._free(B),{name:l,array:w,itemSize:p}}function i(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}class dr{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const s=this.workersResolve[e];if(s&&s(t),this.queue.length){const{resolve:n,msg:i,transfer:o}=this.queue.shift();this.workersResolve[e]=n,this.workers[e].postMessage(i,o)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(s=>{const n=this._getIdleWorker();n!==-1?(this._initWorker(n),this.workerStatus|=1<<n,this.workersResolve[n]=s,this.workers[n].postMessage(e,t)):this.queue.push({resolve:s,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const pr=0,Is=2,gr=1,bs=2,fr=0,mr=1,Ir=10,br=0,ri=9,ai=15,Ai=16,ci=22,li=37,hi=43,ui=76,di=83,pi=97,gi=100,fi=103,mi=109,Ii=122,bi=123,Er=131,Cr=132,Br=133,yr=134,wr=137,Qr=138,xr=141,Sr=142,Tr=145,vr=146,Ei=148,Ci=152,Mr=157,Rr=158,Bi=165,yi=166,$n=1000066e3;class kt{constructor(e,t,s,n){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,s),this._littleEndian=n,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){const s=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==t&&n<e;)n++,this._offset++;return n<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+s,n)}}const Le=[171,75,84,88,32,50,48,187,13,10,26,10];function Es(c){return new TextDecoder().decode(c)}function Dr(c){const e=new Uint8Array(c.buffer,c.byteOffset,Le.length);if(e[0]!==Le[0]||e[1]!==Le[1]||e[2]!==Le[2]||e[3]!==Le[3]||e[4]!==Le[4]||e[5]!==Le[5]||e[6]!==Le[6]||e[7]!==Le[7]||e[8]!==Le[8]||e[9]!==Le[9]||e[10]!==Le[10]||e[11]!==Le[11])throw new Error("Missing KTX 2.0 identifier.");const t={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},s=17*Uint32Array.BYTES_PER_ELEMENT,n=new kt(c,Le.length,s,!0);t.vkFormat=n._nextUint32(),t.typeSize=n._nextUint32(),t.pixelWidth=n._nextUint32(),t.pixelHeight=n._nextUint32(),t.pixelDepth=n._nextUint32(),t.layerCount=n._nextUint32(),t.faceCount=n._nextUint32(),t.levelCount=n._nextUint32(),t.supercompressionScheme=n._nextUint32();const i=n._nextUint32(),o=n._nextUint32(),a=n._nextUint32(),A=n._nextUint32(),l=n._nextUint64(),h=n._nextUint64(),u=3*Math.max(t.levelCount,1)*8,p=new kt(c,Le.length+s,u,!0);for(let te=0,W=Math.max(t.levelCount,1);te<W;te++)t.levels.push({levelData:new Uint8Array(c.buffer,c.byteOffset+p._nextUint64(),p._nextUint64()),uncompressedByteLength:p._nextUint64()});const g=new kt(c,i,o,!0);g._skip(4);const m=g._nextUint16(),I=g._nextUint16(),b=g._nextUint16(),B=g._nextUint16(),w={vendorId:m,descriptorType:I,versionNumber:b,colorModel:g._nextUint8(),colorPrimaries:g._nextUint8(),transferFunction:g._nextUint8(),flags:g._nextUint8(),texelBlockDimension:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],bytesPlane:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],samples:[]},C=(B/4-6)/4;for(let te=0;te<C;te++){const W={bitOffset:g._nextUint16(),bitLength:g._nextUint8(),channelType:g._nextUint8(),samplePosition:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};64&W.channelType?(W.sampleLower=g._nextInt32(),W.sampleUpper=g._nextInt32()):(W.sampleLower=g._nextUint32(),W.sampleUpper=g._nextUint32()),w.samples[te]=W}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(w);const y=new kt(c,a,A,!0);for(;y._offset<A;){const te=y._nextUint32(),W=y._scan(te),se=Es(W);if(t.keyValue[se]=y._nextUint8Array(te-W.byteLength-1),se.match(/^ktx/i)){const de=Es(t.keyValue[se]);t.keyValue[se]=de.substring(0,de.lastIndexOf("\0"))}y._skip(te%4?4-te%4:0)}if(h<=0)return t;const x=new kt(c,l,h,!0),R=x._nextUint16(),D=x._nextUint16(),S=x._nextUint32(),v=x._nextUint32(),U=x._nextUint32(),G=x._nextUint32(),H=[];for(let te=0,W=Math.max(t.levelCount,1);te<W;te++)H.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});const X=l+x._offset,N=X+S,Y=N+v,O=Y+U,Z=new Uint8Array(c.buffer,c.byteOffset+X,S),ie=new Uint8Array(c.buffer,c.byteOffset+N,v),ee=new Uint8Array(c.buffer,c.byteOffset+Y,U),ce=new Uint8Array(c.buffer,c.byteOffset+O,G);return t.globalData={endpointCount:R,selectorCount:D,imageDescs:H,endpointsData:Z,selectorsData:ie,tablesData:ee,extendedData:ce},t}let Cn,At,qn;const Bn={env:{emscripten_notify_memory_growth:function(c){qn=new Uint8Array(At.exports.memory.buffer)}}};class _r{init(){return Cn||(Cn=typeof fetch<"u"?fetch("data:application/wasm;base64,"+Cs).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Bn)).then(this._init):WebAssembly.instantiate(Buffer.from(Cs,"base64"),Bn).then(this._init),Cn)}_init(e){At=e.instance,Bn.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!At)throw new Error("ZSTDDecoder: Await .init() before decoding.");const s=e.byteLength,n=At.exports.malloc(s);qn.set(e,n),t=t||Number(At.exports.ZSTD_findDecompressedSize(n,s));const i=At.exports.malloc(t),o=At.exports.ZSTD_decompress(i,t,n,s),a=qn.slice(i,i+o);return At.exports.free(n),At.exports.free(i),a}}const Cs="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQi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MGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMy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B0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44A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AUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",Fr="display-p3",Lr="display-p3-linear",yn=new WeakMap;let wn=0,Qn;class Xe extends r.Loader{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new dr,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return e.isWebGPURenderer===!0?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new r.FileLoader(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),s=new r.FileLoader(this.manager);s.setPath(this.transcoderPath),s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials);const n=s.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,n]).then(([i,o])=>{const a=Xe.BasisWorker.toString(),A=["/* constants */","let _EngineFormat = "+JSON.stringify(Xe.EngineFormat),"let _EngineType = "+JSON.stringify(Xe.EngineType),"let _TranscoderFormat = "+JSON.stringify(Xe.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Xe.BasisFormat),"/* basis_transcoder.js */",i,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(`
35
35
  `);this.workerSourceURL=URL.createObjectURL(new Blob([A])),this.transcoderBinary=o,this.workerPool.setWorkerCreator(()=>{const l=new Worker(this.workerSourceURL),h=this.transcoderBinary.slice(0);return l.postMessage({type:"init",config:this.workerConfig,transcoderBinary:h},[h]),l})}),wn>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),wn++}return this.transcoderPending}load(e,t,s,n){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const i=new r.FileLoader(this.manager);i.setPath(this.path),i.setCrossOrigin(this.crossOrigin),i.setWithCredentials(this.withCredentials),i.setResponseType("arraybuffer"),i.load(e,o=>{this.parse(o,t,n)},s,n)}parse(e,t,s){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(yn.has(e))return yn.get(e).promise.then(t).catch(s);this._createTexture(e).then(n=>t?t(n):null).catch(s)}_createTextureFrom(e,t){const{type:s,error:n,data:{faces:i,width:o,height:a,format:A,type:l,dfdFlags:h}}=e;if(s==="error")return Promise.reject(n);let u;if(t.faceCount===6)u=new r.CompressedCubeTexture(i,A,l);else{const p=i[0].mipmaps;u=t.layerCount>1?new r.CompressedArrayTexture(p,o,a,t.layerCount,A,l):new r.CompressedTexture(p,o,a,A,l)}return u.minFilter=i[0].mipmaps.length===1?r.LinearFilter:r.LinearMipmapLinearFilter,u.magFilter=r.LinearFilter,u.generateMipmaps=!1,u.needsUpdate=!0,u.colorSpace=wi(t),u.premultiplyAlpha=!!(h&gr),u}async _createTexture(e,t={}){const s=Dr(new Uint8Array(e)),n=s.vkFormat===$n&&s.dataFormatDescriptor[0].colorModel===167;if(!(s.vkFormat===br||n&&!this.workerConfig.astcHDRSupported))return Gr(s);const o=t,a=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:o},[e])).then(A=>this._createTextureFrom(A.data,s));return yn.set(e,{promise:a}),a}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),wn--}}Xe.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2};Xe.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25};Xe.EngineFormat={RGBAFormat:r.RGBAFormat,RGBA_ASTC_4x4_Format:r.RGBA_ASTC_4x4_Format,RGB_BPTC_UNSIGNED_Format:r.RGB_BPTC_UNSIGNED_Format,RGBA_BPTC_Format:r.RGBA_BPTC_Format,RGBA_ETC2_EAC_Format:r.RGBA_ETC2_EAC_Format,RGBA_PVRTC_4BPPV1_Format:r.RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT5_Format:r.RGBA_S3TC_DXT5_Format,RGB_ETC1_Format:r.RGB_ETC1_Format,RGB_ETC2_Format:r.RGB_ETC2_Format,RGB_PVRTC_4BPPV1_Format:r.RGB_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format:r.RGBA_S3TC_DXT1_Format};Xe.EngineType={UnsignedByteType:r.UnsignedByteType,HalfFloatType:r.HalfFloatType,FloatType:r.FloatType};Xe.BasisWorker=function(){let c,e,t;const s=_EngineFormat,n=_EngineType,i=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",function(m){const I=m.data;switch(I.type){case"init":c=I.config,a(I.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:b,buffers:B,width:w,height:C,hasAlpha:y,format:x,type:R,dfdFlags:D}=A(I.buffer);self.postMessage({type:"transcode",id:I.id,data:{faces:b,width:w,height:C,hasAlpha:y,format:x,type:R,dfdFlags:D}},B)}catch(b){console.error(b),self.postMessage({type:"error",id:I.id,error:b.message})}});break}});function a(m){e=new Promise(I=>{t={wasmBinary:m,onRuntimeInitialized:I},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function A(m){const I=new t.KTX2File(new Uint8Array(m));function b(){I.close(),I.delete()}if(!I.isValid())throw b(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let B;if(I.isUASTC())B=o.UASTC;else if(I.isETC1S())B=o.ETC1S;else if(I.isHDR())B=o.UASTC_HDR;else throw new Error("THREE.KTX2Loader: Unknown Basis encoding");const w=I.getWidth(),C=I.getHeight(),y=I.getLayers()||1,x=I.getLevels(),R=I.getFaces(),D=I.getHasAlpha(),S=I.getDFDFlags(),{transcoderFormat:v,engineFormat:U,engineType:G}=u(B,w,C,D);if(!w||!C||!x)throw b(),new Error("THREE.KTX2Loader: Invalid texture");if(!I.startTranscoding())throw b(),new Error("THREE.KTX2Loader: .startTranscoding failed");const H=[],X=[];for(let N=0;N<R;N++){const Y=[];for(let O=0;O<x;O++){const Z=[];let ie,ee;for(let te=0;te<y;te++){const W=I.getImageLevelInfo(O,te,N);N===0&&O===0&&te===0&&(W.origWidth%4!==0||W.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),x>1?(ie=W.origWidth,ee=W.origHeight):(ie=W.width,ee=W.height);let se=new Uint8Array(I.getImageTranscodedSizeInBytes(O,te,0,v));const de=I.transcodeImage(se,O,te,N,v,0,-1,-1);if(G===n.HalfFloatType&&(se=new Uint16Array(se.buffer,se.byteOffset,se.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!de)throw b(),new Error("THREE.KTX2Loader: .transcodeImage failed.");Z.push(se)}const ce=g(Z);Y.push({data:ce,width:ie,height:ee}),X.push(ce.buffer)}H.push({mipmaps:Y,width:w,height:C,format:U,type:G})}return b(),{faces:H,buffers:X,width:w,height:C,hasAlpha:D,dfdFlags:S,format:U,type:G}}const l=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[i.ASTC_4x4,i.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],engineType:[n.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.BC7_M5,i.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],engineType:[n.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.BC1,i.BC3],engineFormat:[s.RGBA_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],engineType:[n.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.ETC1,i.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],engineType:[n.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.ETC1],engineFormat:[s.RGB_ETC1_Format],engineType:[n.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.PVRTC1_4_RGB,i.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],engineType:[n.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[i.BC6H],engineFormat:[s.RGB_BPTC_UNSIGNED_Format],engineType:[n.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[i.RGBA32,i.RGBA32],engineFormat:[s.RGBAFormat,s.RGBAFormat],engineType:[n.UnsignedByteType,n.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[i.RGBA_HALF],engineFormat:[s.RGBAFormat],engineType:[n.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],h={[o.ETC1S]:l.filter(m=>m.basisFormat.includes(o.ETC1S)).sort((m,I)=>m.priorityUASTC-I.priorityUASTC),[o.UASTC]:l.filter(m=>m.basisFormat.includes(o.UASTC)).sort((m,I)=>m.priorityUASTC-I.priorityUASTC),[o.UASTC_HDR]:l.filter(m=>m.basisFormat.includes(o.UASTC_HDR)).sort((m,I)=>m.priorityHDR-I.priorityHDR)};function u(m,I,b,B){const w=h[m];for(let C=0;C<w.length;C++){const y=w[C];if(y.if&&!c[y.if]||!y.basisFormat.includes(m)||B&&y.transcoderFormat.length<2||y.needsPowerOfTwo&&!(p(I)&&p(b)))continue;const x=y.transcoderFormat[B?1:0],R=y.engineFormat[B?1:0],D=y.engineType[0];return{transcoderFormat:x,engineFormat:R,engineType:D}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}function p(m){return m<=2?!0:(m&m-1)===0&&m!==0}function g(m){if(m.length===1)return m[0];let I=0;for(let w=0;w<m.length;w++){const C=m[w];I+=C.byteLength}const b=new Uint8Array(I);let B=0;for(let w=0;w<m.length;w++){const C=m[w];b.set(C,B),B+=C.byteLength}return b}};const kr=new Set([r.RGBAFormat,r.RGBFormat,r.RGFormat,r.RedFormat]),xn={[mi]:r.RGBAFormat,[pi]:r.RGBAFormat,[li]:r.RGBAFormat,[hi]:r.RGBAFormat,[fi]:r.RGFormat,[di]:r.RGFormat,[Ai]:r.RGFormat,[ci]:r.RGFormat,[gi]:r.RedFormat,[ui]:r.RedFormat,[ai]:r.RedFormat,[ri]:r.RedFormat,[bi]:r.RGBFormat,[Ii]:r.RGBFormat,[Ei]:r.RGB_ETC2_Format,[Ci]:r.RGBA_ETC2_EAC_Format,[$n]:r.RGBA_ASTC_4x4_Format,[Rr]:r.RGBA_ASTC_4x4_Format,[Mr]:r.RGBA_ASTC_4x4_Format,[yi]:r.RGBA_ASTC_6x6_Format,[Bi]:r.RGBA_ASTC_6x6_Format,[Br]:r.RGBA_S3TC_DXT1_Format,[yr]:r.RGBA_S3TC_DXT1_Format,[Er]:r.RGB_S3TC_DXT1_Format,[Cr]:r.RGB_S3TC_DXT1_Format,[Qr]:r.RGBA_S3TC_DXT3_Format,[wr]:r.RGBA_S3TC_DXT3_Format,[Sr]:r.RGBA_S3TC_DXT5_Format,[xr]:r.RGBA_S3TC_DXT5_Format,[vr]:r.RGBA_BPTC_Format,[Tr]:r.RGBA_BPTC_Format},Gt={[mi]:r.FloatType,[pi]:r.HalfFloatType,[li]:r.UnsignedByteType,[hi]:r.UnsignedByteType,[fi]:r.FloatType,[di]:r.HalfFloatType,[Ai]:r.UnsignedByteType,[ci]:r.UnsignedByteType,[gi]:r.FloatType,[ui]:r.HalfFloatType,[ai]:r.UnsignedByteType,[ri]:r.UnsignedByteType,[bi]:r.UnsignedInt5999Type,[Ii]:r.UnsignedInt101111Type,[Ei]:r.UnsignedByteType,[Ci]:r.UnsignedByteType,[$n]:r.HalfFloatType,[yi]:r.UnsignedByteType,[Bi]:r.UnsignedByteType};async function Gr(c){const{vkFormat:e}=c;if(xn[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let t;c.supercompressionScheme===Is&&(Qn||(Qn=new Promise(async o=>{const a=new _r;await a.init(),o(a)})),t=await Qn);const s=[];for(let o=0;o<c.levels.length;o++){const a=Math.max(1,c.pixelWidth>>o),A=Math.max(1,c.pixelHeight>>o),l=c.pixelDepth?Math.max(1,c.pixelDepth>>o):0,h=c.levels[o];let u;if(c.supercompressionScheme===pr)u=h.levelData;else if(c.supercompressionScheme===Is)u=t.decode(h.levelData,h.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let p;Gt[e]===r.FloatType?p=new Float32Array(u.buffer,u.byteOffset,u.byteLength/Float32Array.BYTES_PER_ELEMENT):Gt[e]===r.HalfFloatType?p=new Uint16Array(u.buffer,u.byteOffset,u.byteLength/Uint16Array.BYTES_PER_ELEMENT):Gt[e]===r.UnsignedInt5999Type||Gt[e]===r.UnsignedInt101111Type?p=new Uint32Array(u.buffer,u.byteOffset,u.byteLength/Uint32Array.BYTES_PER_ELEMENT):p=u,s.push({data:p,width:a,height:A,depth:l})}const n=c.levelCount===0||s.length>1;let i;if(kr.has(xn[e]))i=c.pixelDepth===0?new r.DataTexture(s[0].data,c.pixelWidth,c.pixelHeight):new r.Data3DTexture(s[0].data,c.pixelWidth,c.pixelHeight,c.pixelDepth),i.minFilter=n?r.NearestMipmapNearestFilter:r.NearestFilter,i.magFilter=r.NearestFilter,i.generateMipmaps=c.levelCount===0;else{if(c.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");i=new r.CompressedTexture(s,c.pixelWidth,c.pixelHeight),i.minFilter=n?r.LinearMipmapLinearFilter:r.LinearFilter,i.magFilter=r.LinearFilter}return i.mipmaps=s,i.type=Gt[e],i.format=xn[e],i.colorSpace=wi(c),i.needsUpdate=!0,Promise.resolve(i)}function wi(c){const e=c.dataFormatDescriptor[0];return e.colorPrimaries===mr?e.transferFunction===bs?r.SRGBColorSpace:r.LinearSRGBColorSpace:e.colorPrimaries===Ir?e.transferFunction===bs?Fr:Lr:(e.colorPrimaries===fr||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),r.NoColorSpace)}class Nr extends r.ExtrudeGeometry{constructor(e,t={}){const s=t.font;if(s===void 0)super();else{const n=s.generateShapes(e,t.size);t.depth===void 0&&t.height!==void 0&&console.warn("THREE.TextGeometry: .height is now depreciated. Please use .depth instead"),t.depth=t.depth!==void 0?t.depth:t.height!==void 0?t.height:50,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(n,t)}this.type="TextGeometry"}}class Ur extends r.Loader{constructor(e){super(e)}load(e,t,s,n){const i=this,o=new r.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){const A=i.parse(JSON.parse(a));t&&t(A)},s,n)}parse(e){return new Qi(e)}}class Qi{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){const s=[],n=Pr(e,t,this.data);for(let i=0,o=n.length;i<o;i++)s.push(...n[i].toShapes());return s}}function Pr(c,e,t){const s=Array.from(c),n=e/t.resolution,i=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*n,o=[];let a=0,A=0;for(let l=0;l<s.length;l++){const h=s[l];if(h===`
36
- `)a=0,A-=i;else{const u=Or(h,n,a,A,t);a+=u.offsetX,o.push(u.path)}}return o}function Or(c,e,t,s,n){const i=n.glyphs[c]||n.glyphs["?"];if(!i){console.error('THREE.Font: character "'+c+'" does not exists in font family '+n.familyName+".");return}const o=new r.ShapePath;let a,A,l,h,u,p,g,m;if(i.o){const I=i._cachedOutline||(i._cachedOutline=i.o.split(" "));for(let b=0,B=I.length;b<B;)switch(I[b++]){case"m":a=I[b++]*e+t,A=I[b++]*e+s,o.moveTo(a,A);break;case"l":a=I[b++]*e+t,A=I[b++]*e+s,o.lineTo(a,A);break;case"q":l=I[b++]*e+t,h=I[b++]*e+s,u=I[b++]*e+t,p=I[b++]*e+s,o.quadraticCurveTo(u,p,l,h);break;case"b":l=I[b++]*e+t,h=I[b++]*e+s,u=I[b++]*e+t,p=I[b++]*e+s,g=I[b++]*e+t,m=I[b++]*e+s,o.bezierCurveTo(u,p,g,m,l,h);break}}return{offsetX:i.ha*e,path:o}}const Et=new r.Raycaster,Fe=new r.Vector3,pt=new r.Vector3,Ce=new r.Quaternion,Bs={X:new r.Vector3(1,0,0),Y:new r.Vector3(0,1,0),Z:new r.Vector3(0,0,1)},Sn={type:"change"},ys={type:"mouseDown",mode:null},ws={type:"mouseUp",mode:null},Qs={type:"objectChange"};class Hr extends r.Controls{constructor(e,t=null){super(void 0,t);const s=new Kr(this);this._root=s;const n=new xi;this._gizmo=n,s.add(n);const i=new Jr;this._plane=i,s.add(i);const o=this;function a(C,y){let x=y;Object.defineProperty(o,C,{get:function(){return x!==void 0?x:y},set:function(R){x!==R&&(x=R,i[C]=R,n[C]=R,o.dispatchEvent({type:C+"-changed",value:R}),o.dispatchEvent(Sn))}}),o[C]=y,i[C]=y,n[C]=y}a("camera",e),a("object",void 0),a("enabled",!0),a("axis",null),a("mode","translate"),a("translationSnap",null),a("rotationSnap",null),a("scaleSnap",null),a("space","world"),a("size",1),a("dragging",!1),a("showX",!0),a("showY",!0),a("showZ",!0);const A=new r.Vector3,l=new r.Vector3,h=new r.Quaternion,u=new r.Quaternion,p=new r.Vector3,g=new r.Quaternion,m=new r.Vector3,I=new r.Vector3,b=new r.Vector3,B=0,w=new r.Vector3;a("worldPosition",A),a("worldPositionStart",l),a("worldQuaternion",h),a("worldQuaternionStart",u),a("cameraPosition",p),a("cameraQuaternion",g),a("pointStart",m),a("pointEnd",I),a("rotationAxis",b),a("rotationAngle",B),a("eye",w),this._offset=new r.Vector3,this._startNorm=new r.Vector3,this._endNorm=new r.Vector3,this._cameraScale=new r.Vector3,this._parentPosition=new r.Vector3,this._parentQuaternion=new r.Quaternion,this._parentQuaternionInv=new r.Quaternion,this._parentScale=new r.Vector3,this._worldScaleStart=new r.Vector3,this._worldQuaternionInv=new r.Quaternion,this._worldScale=new r.Vector3,this._positionStart=new r.Vector3,this._quaternionStart=new r.Quaternion,this._scaleStart=new r.Vector3,this._getPointer=jr.bind(this),this._onPointerDown=zr.bind(this),this._onPointerHover=qr.bind(this),this._onPointerMove=Yr.bind(this),this._onPointerUp=Vr.bind(this),t!==null&&this.connect()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="auto"}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&Et.setFromCamera(e,this.camera);const t=Tn(this._gizmo.picker[this.mode],Et);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&Et.setFromCamera(e,this.camera);const t=Tn(this._plane,Et,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,ys.mode=this.mode,this.dispatchEvent(ys)}}pointerMove(e){const t=this.axis,s=this.mode,n=this.object;let i=this.space;if(s==="scale"?i="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(i="world"),n===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&Et.setFromCamera(e,this.camera);const o=Tn(this._plane,Et,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),s==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),i==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),i==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(i==="local"&&(n.position.applyQuaternion(Ce.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),i==="world"&&(n.parent&&n.position.add(Fe.setFromMatrixPosition(n.parent.matrixWorld)),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(Fe.setFromMatrixPosition(n.parent.matrixWorld))));else if(s==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),pt.set(a,a,a)}else Fe.copy(this.pointStart),pt.copy(this.pointEnd),Fe.applyQuaternion(this._worldQuaternionInv),pt.applyQuaternion(this._worldQuaternionInv),pt.divide(Fe),t.search("X")===-1&&(pt.x=1),t.search("Y")===-1&&(pt.y=1),t.search("Z")===-1&&(pt.z=1);n.scale.copy(this._scaleStart).multiply(pt),this.scaleSnap&&(t.search("X")!==-1&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(s==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Fe.setFromMatrixPosition(this.camera.matrixWorld));let A=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Fe.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Bs[t]),Fe.copy(Bs[t]),i==="local"&&Fe.applyQuaternion(this.worldQuaternion),Fe.cross(this.eye),Fe.length()===0?A=!0:this.rotationAngle=this._offset.dot(Fe.normalize())*a),(t==="E"||A)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),i==="local"&&t!=="E"&&t!=="XYZE"?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(Ce.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(Ce.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Sn),this.dispatchEvent(Qs)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(ws.mode=this.mode,this.dispatchEvent(ws)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(Sn),this.dispatchEvent(Qs),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Et}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function jr(c){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:c.button};{const e=this.domElement.getBoundingClientRect();return{x:(c.clientX-e.left)/e.width*2-1,y:-(c.clientY-e.top)/e.height*2+1,button:c.button}}}function qr(c){if(this.enabled)switch(c.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(c));break}}function zr(c){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(c.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(c)),this.pointerDown(this._getPointer(c)))}function Yr(c){this.enabled&&this.pointerMove(this._getPointer(c))}function Vr(c){this.enabled&&(this.domElement.releasePointerCapture(c.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(c)))}function Tn(c,e,t){const s=e.intersectObject(c,!0);for(let n=0;n<s.length;n++)if(s[n].object.visible||t)return s[n];return!1}const en=new r.Euler,ge=new r.Vector3(0,1,0),xs=new r.Vector3(0,0,0),Ss=new r.Matrix4,tn=new r.Quaternion,hn=new r.Quaternion,et=new r.Vector3,Ts=new r.Matrix4,zt=new r.Vector3(1,0,0),Bt=new r.Vector3(0,1,0),Yt=new r.Vector3(0,0,1),nn=new r.Vector3,Nt=new r.Vector3,Ut=new r.Vector3;class Kr extends r.Object3D{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){const t=this.controls;t.object!==void 0&&(t.object.updateMatrixWorld(),t.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):t.object.parent.matrixWorld.decompose(t._parentPosition,t._parentQuaternion,t._parentScale),t.object.matrixWorld.decompose(t.worldPosition,t.worldQuaternion,t._worldScale),t._parentQuaternionInv.copy(t._parentQuaternion).invert(),t._worldQuaternionInv.copy(t.worldQuaternion).invert()),t.camera.updateMatrixWorld(),t.camera.matrixWorld.decompose(t.cameraPosition,t.cameraQuaternion,t._cameraScale),t.camera.isOrthographicCamera?t.camera.getWorldDirection(t.eye).negate():t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(),super.updateMatrixWorld(e)}}class xi extends r.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new r.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new r.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=e.clone();s.opacity=.15;const n=t.clone();n.opacity=.5;const i=e.clone();i.color.setHex(16711680);const o=e.clone();o.color.setHex(65280);const a=e.clone();a.color.setHex(255);const A=e.clone();A.color.setHex(16711680),A.opacity=.5;const l=e.clone();l.color.setHex(65280),l.opacity=.5;const h=e.clone();h.color.setHex(255),h.opacity=.5;const u=e.clone();u.opacity=.25;const p=e.clone();p.color.setHex(16776960),p.opacity=.25,e.clone().color.setHex(16776960);const m=e.clone();m.color.setHex(7895160);const I=new r.CylinderGeometry(0,.04,.1,12);I.translate(0,.05,0);const b=new r.BoxGeometry(.08,.08,.08);b.translate(0,.04,0);const B=new r.BufferGeometry;B.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,0,0],3));const w=new r.CylinderGeometry(.0075,.0075,.5,3);w.translate(0,.25,0);function C(Y,O){const Z=new r.TorusGeometry(Y,.0075,3,64,O*Math.PI*2);return Z.rotateY(Math.PI/2),Z.rotateX(Math.PI/2),Z}function y(){const Y=new r.BufferGeometry;return Y.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,1,1],3)),Y}const x={X:[[new r.Mesh(I,i),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(I,i),[-.5,0,0],[0,0,Math.PI/2]],[new r.Mesh(w,i),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new r.Mesh(I,o),[0,.5,0]],[new r.Mesh(I,o),[0,-.5,0],[Math.PI,0,0]],[new r.Mesh(w,o)]],Z:[[new r.Mesh(I,a),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(I,a),[0,0,-.5],[-Math.PI/2,0,0]],[new r.Mesh(w,a),null,[Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.1,0),u.clone()),[0,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),A.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},R={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.2,0),s)]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},D={START:[[new r.Mesh(new r.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],END:[[new r.Mesh(new r.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],DELTA:[[new r.Line(y(),n),null,null,null,"helper"]],X:[[new r.Line(B,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(B,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(B,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},S={XYZE:[[new r.Mesh(C(.5,1),m),null,[0,Math.PI/2,0]]],X:[[new r.Mesh(C(.5,.5),i)]],Y:[[new r.Mesh(C(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new r.Mesh(C(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new r.Mesh(C(.75,1),p),null,[0,Math.PI/2,0]]]},v={AXIS:[[new r.Line(B,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},U={XYZE:[[new r.Mesh(new r.SphereGeometry(.25,10,8),s)]],X:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new r.Mesh(new r.TorusGeometry(.75,.1,2,24),s)]]},G={X:[[new r.Mesh(b,i),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(w,i),[0,0,0],[0,0,-Math.PI/2]],[new r.Mesh(b,i),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(b,o),[0,.5,0]],[new r.Mesh(w,o)],[new r.Mesh(b,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new r.Mesh(b,a),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(w,a),[0,0,0],[Math.PI/2,0,0]],[new r.Mesh(b,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),A),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.1,.1,.1),u.clone())]]},H={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},X={X:[[new r.Line(B,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(B,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(B,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function N(Y){const O=new r.Object3D;for(const Z in Y)for(let ie=Y[Z].length;ie--;){const ee=Y[Z][ie][0].clone(),ce=Y[Z][ie][1],te=Y[Z][ie][2],W=Y[Z][ie][3],se=Y[Z][ie][4];ee.name=Z,ee.tag=se,ce&&ee.position.set(ce[0],ce[1],ce[2]),te&&ee.rotation.set(te[0],te[1],te[2]),W&&ee.scale.set(W[0],W[1],W[2]),ee.updateMatrix();const de=ee.geometry.clone();de.applyMatrix4(ee.matrix),ee.geometry=de,ee.renderOrder=1/0,ee.position.set(0,0,0),ee.rotation.set(0,0,0),ee.scale.set(1,1,1),O.add(ee)}return O}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=N(x)),this.add(this.gizmo.rotate=N(S)),this.add(this.gizmo.scale=N(G)),this.add(this.picker.translate=N(R)),this.add(this.picker.rotate=N(U)),this.add(this.picker.scale=N(H)),this.add(this.helper.translate=N(D)),this.add(this.helper.rotate=N(v)),this.add(this.helper.scale=N(X)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const s=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:hn;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let n=[];n=n.concat(this.picker[this.mode].children),n=n.concat(this.gizmo[this.mode].children),n=n.concat(this.helper[this.mode].children);for(let i=0;i<n.length;i++){const o=n[i];o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),o.scale.set(1,1,1).multiplyScalar(a*this.size/4),o.tag==="helper"){o.visible=!1,o.name==="AXIS"?(o.visible=!!this.axis,this.axis==="X"&&(Ce.setFromEuler(en.set(0,0,0)),o.quaternion.copy(s).multiply(Ce),Math.abs(ge.copy(zt).applyQuaternion(s).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Y"&&(Ce.setFromEuler(en.set(0,0,Math.PI/2)),o.quaternion.copy(s).multiply(Ce),Math.abs(ge.copy(Bt).applyQuaternion(s).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(Ce.setFromEuler(en.set(0,Math.PI/2,0)),o.quaternion.copy(s).multiply(Ce),Math.abs(ge.copy(Yt).applyQuaternion(s).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(Ce.setFromEuler(en.set(0,Math.PI/2,0)),ge.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(Ss.lookAt(xs,ge,Bt)),o.quaternion.multiply(Ce),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Fe.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Fe.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Fe),o.visible=this.dragging):(o.quaternion.copy(s),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(s),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(ge.copy(zt).applyQuaternion(s).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(ge.copy(Bt).applyQuaternion(s).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(ge.copy(Yt).applyQuaternion(s).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(ge.copy(Yt).applyQuaternion(s).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(ge.copy(zt).applyQuaternion(s).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(ge.copy(Bt).applyQuaternion(s).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(tn.copy(s),ge.copy(this.eye).applyQuaternion(Ce.copy(s).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(Ss.lookAt(this.eye,xs,Bt)),o.name==="X"&&(Ce.setFromAxisAngle(zt,Math.atan2(-ge.y,ge.z)),Ce.multiplyQuaternions(tn,Ce),o.quaternion.copy(Ce)),o.name==="Y"&&(Ce.setFromAxisAngle(Bt,Math.atan2(ge.x,ge.z)),Ce.multiplyQuaternions(tn,Ce),o.quaternion.copy(Ce)),o.name==="Z"&&(Ce.setFromAxisAngle(Yt,Math.atan2(ge.y,ge.x)),Ce.multiplyQuaternions(tn,Ce),o.quaternion.copy(Ce))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(A){return o.name===A}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(e)}}class Jr extends r.Mesh{constructor(){super(new r.PlaneGeometry(1e5,1e5,2,2),new r.MeshBasicMaterial({visible:!1,wireframe:!0,side:r.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),nn.copy(zt).applyQuaternion(t==="local"?this.worldQuaternion:hn),Nt.copy(Bt).applyQuaternion(t==="local"?this.worldQuaternion:hn),Ut.copy(Yt).applyQuaternion(t==="local"?this.worldQuaternion:hn),ge.copy(Nt),this.mode){case"translate":case"scale":switch(this.axis){case"X":ge.copy(this.eye).cross(nn),et.copy(nn).cross(ge);break;case"Y":ge.copy(this.eye).cross(Nt),et.copy(Nt).cross(ge);break;case"Z":ge.copy(this.eye).cross(Ut),et.copy(Ut).cross(ge);break;case"XY":et.copy(Ut);break;case"YZ":et.copy(nn);break;case"XZ":ge.copy(Ut),et.copy(Nt);break;case"XYZ":case"E":et.set(0,0,0);break}break;case"rotate":default:et.set(0,0,0)}et.length()===0?this.quaternion.copy(this.cameraQuaternion):(Ts.lookAt(Fe.set(0,0,0),et,ge),this.quaternion.setFromRotationMatrix(Ts)),super.updateMatrixWorld(e)}}var Qe=Uint8Array,qe=Uint16Array,es=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]),pn=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]),zn=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 es(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,Yn=Ti.r;vi[28]=258,Yn[258]=28;var Mi=Si(pn,0),Wr=Mi.b,vs=Mi.r,Vn=new qe(32768);for(var Ee=0;Ee<32768;++Ee){var gt=(Ee&43690)>>1|(Ee&21845)<<1;gt=(gt&52428)>>2|(gt&13107)<<2,gt=(gt&61680)>>4|(gt&3855)<<4,Vn[Ee]=((gt&65280)>>8|(gt&255)<<8)>>1}var it=(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 a;if(t){a=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,p=u|(1<<h)-1;u<=p;++u)a[Vn[u]>>A]=l}else for(a=new qe(s),n=0;n<s;++n)c[n]&&(a[n]=Vn[o[c[n]-1]++]>>15-c[n]);return a}),ft=new Qe(288);for(var Ee=0;Ee<144;++Ee)ft[Ee]=8;for(var Ee=144;Ee<256;++Ee)ft[Ee]=9;for(var Ee=256;Ee<280;++Ee)ft[Ee]=7;for(var Ee=280;Ee<288;++Ee)ft[Ee]=8;var Wt=new Qe(32);for(var Ee=0;Ee<32;++Ee)Wt[Ee]=5;var Xr=it(ft,9,0),Zr=it(ft,9,1),$r=it(Wt,5,0),ea=it(Wt,5,1),vn=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},Mn=function(c,e){var t=e/8|0;return(c[t]|c[t+1]<<8|c[t+2]<<16)>>(e&7)},ts=function(c){return(c+7)/8|0},ns=function(c,e,t){return(t==null||t>c.length)&&(t=c.length),new Qe(c.subarray(e,t))},ta=["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"],Ne=function(c,e,t){var s=new Error(e||ta[c]);if(s.code=c,Error.captureStackTrace&&Error.captureStackTrace(s,Ne),!t)throw s;return s},na=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,a=o||e.i!=2,A=e.i;o&&(t=new Qe(n*3));var l=function(lt){var mt=t.length;if(lt>mt){var ot=new Qe(Math.max(mt*2,lt));ot.set(t),t=ot}},h=e.f||0,u=e.p||0,p=e.b||0,g=e.l,m=e.d,I=e.m,b=e.n,B=n*8;do{if(!g){h=Ze(c,u,1);var w=Ze(c,u+1,3);if(u+=3,w)if(w==1)g=Zr,m=ea,I=9,b=5;else if(w==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),U=new Qe(19),G=0;G<D;++G)U[zn[G]]=Ze(c,u+G*3,7);u+=D*3;for(var H=vn(U),X=(1<<H)-1,N=it(U,H,1),G=0;G<S;){var Y=N[Ze(c,u,X)];u+=Y&15;var C=Y>>4;if(C<16)v[G++]=C;else{var O=0,Z=0;for(C==16?(Z=3+Ze(c,u,3),u+=2,O=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++]=O}}var ie=v.subarray(0,R),ee=v.subarray(R);I=vn(ie),b=vn(ee),g=it(ie,I,1),m=it(ee,b,1)}else Ne(1);else{var C=ts(u)+4,y=c[C-4]|c[C-3]<<8,x=C+y;if(x>n){A&&Ne(0);break}a&&l(p+y),t.set(c.subarray(C,x),p),e.b=p+=y,e.p=u=x*8,e.f=h;continue}if(u>B){A&&Ne(0);break}}a&&l(p+131072);for(var ce=(1<<I)-1,te=(1<<b)-1,W=u;;W=u){var O=g[Mn(c,u)&ce],se=O>>4;if(u+=O&15,u>B){A&&Ne(0);break}if(O||Ne(2),se<256)t[p++]=se;else if(se==256){W=u,g=null;break}else{var de=se-254;if(se>264){var G=se-257,me=dn[G];de=Ze(c,u,(1<<me)-1)+vi[G],u+=me}var Ae=m[Mn(c,u)&te],Pe=Ae>>4;Ae||Ne(3),u+=Ae&15;var ee=Wr[Pe];if(Pe>3){var me=pn[Pe];ee+=Mn(c,u)&(1<<me)-1,u+=me}if(u>B){A&&Ne(0);break}a&&l(p+131072);var Oe=p+de;if(p<ee){var wt=i-ee,Qt=Math.min(ee,Oe);for(wt+p<0&&Ne(3);p<Qt;++p)t[p]=s[wt+p]}for(;p<Oe;++p)t[p]=t[p-ee]}}e.l=g,e.p=W,e.b=p,e.f=h,g&&(h=1,e.m=I,e.d=m,e.n=b)}while(!h);return p!=t.length&&o?ns(t,0,p):t.subarray(0,p)},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},Rn=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 a=t[0],A=t[1],l=0,h=1,u=2;for(t[0]={s:-1,f:a.f+A.f,l:a,r:A};h!=n-1;)a=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:a.f+A.f,l:a,r:A};for(var p=i[0].s,s=1;s<n;++s)i[s].s>p&&(p=i[s].s);var g=new qe(p+1),m=Kn(t[h-1],g,0);if(m>e){var s=0,I=0,b=m-e,B=1<<b;for(i.sort(function(R,D){return g[D.s]-g[R.s]||R.f-D.f});s<n;++s){var w=i[s].s;if(g[w]>e)I+=B-(1<<m-g[w]),g[w]=e;else break}for(I>>=b;I>0;){var C=i[s].s;g[C]<e?I-=1<<e-g[C]++-1:++s}for(;s>=0&&I;--s){var y=i[s].s;g[y]==e&&(--g[y],++I)}m=e}return{t:new Qe(g),l:m}},Kn=function(c,e,t){return c.s==-1?Math.max(Kn(c.l,e,t+1),Kn(c.r,e,t+1)):e[c.s]=t},Ms=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},a=1;a<=e;++a)if(c[a]==n&&a!=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[a]}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=ts(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},Rs=function(c,e,t,s,n,i,o,a,A,l,h){at(e,h++,t),++n[256];for(var u=Rn(n,15),p=u.t,g=u.l,m=Rn(i,15),I=m.t,b=m.l,B=Ms(p),w=B.c,C=B.n,y=Ms(I),x=y.c,R=y.n,D=new qe(19),S=0;S<w.length;++S)++D[w[S]&31];for(var S=0;S<x.length;++S)++D[x[S]&31];for(var v=Rn(D,7),U=v.t,G=v.l,H=19;H>4&&!U[zn[H-1]];--H);var X=l+5<<3,N=Ot(n,ft)+Ot(i,Wt)+o,Y=Ot(n,p)+Ot(i,I)+o+14+3*H+Ot(D,U)+2*D[16]+3*D[17]+7*D[18];if(A>=0&&X<=N&&X<=Y)return Ri(e,h,c.subarray(A,A+l));var O,Z,ie,ee;if(at(e,h,1+(Y<N)),h+=2,Y<N){O=it(p,g,0),Z=p,ie=it(I,b,0),ee=I;var ce=it(U,G,0);at(e,h,C-257),at(e,h+5,R-1),at(e,h+10,H-4),h+=14;for(var S=0;S<H;++S)at(e,h+3*S,U[zn[S]]);h+=3*H;for(var te=[w,x],W=0;W<2;++W)for(var se=te[W],S=0;S<se.length;++S){var de=se[S]&31;at(e,h,ce[de]),h+=U[de],de>15&&(at(e,h,se[S]>>5&127),h+=se[S]>>12)}}else O=Xr,Z=ft,ie=$r,ee=Wt;for(var S=0;S<a;++S){var me=s[S];if(me>255){var de=me>>18&31;Pt(e,h,O[de+257]),h+=Z[de+257],de>7&&(at(e,h,me>>23&31),h+=dn[de]);var Ae=me&31;Pt(e,h,ie[Ae]),h+=ee[Ae],Ae>3&&(Pt(e,h,me>>5&8191),h+=pn[Ae])}else Pt(e,h,O[me]),h+=Z[me]}return Pt(e,h,O[256]),h+Z[256]},sa=new es([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Di=new Qe(0),ia=function(c,e,t,s,n,i){var o=i.z||c.length,a=new Qe(s+o+5*(1+Math.ceil(o/7e3))+n),A=a.subarray(s,a.length-n),l=i.l,h=(i.r||0)&7;if(e){h&&(A[0]=i.r>>3);for(var u=sa[e-1],p=u>>13,g=u&8191,m=(1<<t)-1,I=i.p||new qe(32768),b=i.h||new qe(m+1),B=Math.ceil(t/3),w=2*B,C=function(xt){return(c[xt]^c[xt+1]<<B^c[xt+2]<<w)&m},y=new es(25e3),x=new qe(288),R=new qe(32),D=0,S=0,v=i.i||0,U=0,G=i.w||0,H=0;v+2<o;++v){var X=C(v),N=v&32767,Y=b[X];if(I[N]=Y,b[X]=N,G<=v){var O=o-v;if((D>7e3||U>24576)&&(O>423||!l)){h=Rs(c,A,0,y,x,R,S,U,H,v-H,h),U=D=S=0,H=v;for(var Z=0;Z<286;++Z)x[Z]=0;for(var Z=0;Z<30;++Z)R[Z]=0}var ie=2,ee=0,ce=g,te=N-Y&32767;if(O>2&&X==C(v-te))for(var W=Math.min(p,O)-1,se=Math.min(32767,v),de=Math.min(258,O);te<=se&&--ce&&N!=Y;){if(c[v+ie]==c[v+ie-te]){for(var me=0;me<de&&c[v+me]==c[v+me-te];++me);if(me>ie){if(ie=me,ee=te,me>W)break;for(var Ae=Math.min(te,me-2),Pe=0,Z=0;Z<Ae;++Z){var Oe=v-te+Z&32767,wt=I[Oe],Qt=Oe-wt&32767;Qt>Pe&&(Pe=Qt,Y=Oe)}}}N=Y,Y=I[N],te+=N-Y&32767}if(ee){y[U++]=268435456|Yn[ie]<<18|vs[ee];var lt=Yn[ie]&31,mt=vs[ee]&31;S+=dn[lt]+pn[mt],++x[257+lt],++R[mt],G=v+ie,++D}else y[U++]=c[v],++x[c[v]]}}for(v=Math.max(v,G);v<o;++v)y[U++]=c[v],++x[c[v]];h=Rs(c,A,l,y,x,R,S,U,H,v-H,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 ot=v+65535;ot>=o&&(A[h/8|0]=l,ot=o),h=Ri(A,h+1,c.subarray(v,ot))}i.i=o}return ns(a,0,s+ts(h)+n)},oa=(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})(),ra=function(){var c=-1;return{p:function(e){for(var t=c,s=0;s<e.length;++s)t=oa[t&255^e[s]]^t>>>8;c=t},d:function(){return~c}}},aa=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 ia(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},Aa=function(c,e){return((c[0]&15)!=8||c[0]>>4>7||(c[0]<<8|c[1])%31)&&Ne(6,"invalid zlib data"),(c[1]>>5&1)==1&&Ne(6,"invalid zlib data: "+(c[1]&32?"need":"unexpected")+" dictionary"),(c[1]>>3&4)+2};function ca(c,e){return aa(c,e||{},0,0)}function Vt(c,e){return na(c.subarray(Aa(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,a=s;Array.isArray(i)&&(a=_i(s,i[1]),i=i[0]),i instanceof Qe?t[o]=[i,a]:(t[o+="/"]=[new Qe(0),a],Fi(i,o,t,s))}},Ds=typeof TextEncoder<"u"&&new TextEncoder,la=typeof TextDecoder<"u"&&new TextDecoder,ha=0;try{la.decode(Di,{stream:!0}),ha=1}catch{}function Jn(c,e){var t;if(Ds)return Ds.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 a=new Qe(i+8+(s-t<<1));a.set(n),n=a}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 ns(n,0,i)}var Wn=function(c){var e=0;if(c)for(var t in c){var s=c[t].length;s>65535&&Ne(9),e+=s+4}return e},_s=function(c,e,t,s,n,i,o,a){var A=s.length,l=t.extra,h=a&&a.length,u=Wn(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 p=new Date(t.mtime==null?Date.now():t.mtime),g=p.getFullYear()-1980;if((g<0||g>119)&&Ne(10),Re(c,e,g<<25|p.getMonth()+1<<21|p.getDate()<<16|p.getHours()<<11|p.getMinutes()<<5|p.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 m in l){var I=l[m],b=I.length;Re(c,e,+m),Re(c,e+2,b),c.set(I,e+4),e+=4+b}return h&&(c.set(a,e),e+=h),e},ua=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 da(c,e){e||(e={});var t={},s=[];Fi(c,"",t,e);var n=0,i=0;for(var o in t){var a=t[o],A=a[0],l=a[1],h=l.level==0?0:8,u=Jn(o),p=u.length,g=l.comment,m=g&&Jn(g),I=m&&m.length,b=Wn(l.extra);p>65535&&Ne(11);var B=h?ca(A,l):A,w=B.length,C=ra();C.p(A),s.push(_i(l,{size:A.length,crc:C.d(),c:B,f:u,m,u:p!=o.length||m&&g.length!=I,o:n,compression:h})),n+=30+p+b+w,i+=76+2*(p+b)+(I||0)+w}for(var y=new Qe(i+22),x=n,R=i-n,D=0;D<s.length;++D){var u=s[D];_s(y,u.o,u,u.f,u.u,u.c.length);var S=30+u.f.length+Wn(u.extra);y.set(u.c,u.o+S),_s(y,n,u,u.f,u.u,u.c.length,u.o,u.m),n+=16+S+(u.m?u.m.length:0)}return ua(y,n,s.length,R,x),y}class Li extends r.DataTextureLoader{constructor(e){super(e),this.type=r.HalfFloatType}parse(e){const v=Math.pow(2.7182818,2.2);function U(d,f){let E=0;for(let M=0;M<65536;++M)(M==0||d[M>>3]&1<<(M&7))&&(f[E++]=M);const Q=E-1;for(;E<65536;)f[E++]=0;return Q}function G(d){for(let f=0;f<16384;f++)d[f]={},d[f].len=0,d[f].lit=0,d[f].p=null}const H={l:0,c:0,lc:0};function X(d,f,E,Q,M){for(;E<d;)f=f<<8|As(Q,M),E+=8;E-=d,H.l=f>>E&(1<<d)-1,H.c=f,H.lc=E}const N=new Array(59);function Y(d){for(let E=0;E<=58;++E)N[E]=0;for(let E=0;E<65537;++E)N[d[E]]+=1;let f=0;for(let E=58;E>0;--E){const Q=f+N[E]>>1;N[E]=f,f=Q}for(let E=0;E<65537;++E){const Q=d[E];Q>0&&(d[E]=Q|N[Q]++<<6)}}function O(d,f,E,Q,M,T){const L=f;let P=0,k=0;for(;Q<=M;Q++){if(L.value-f.value>E)return!1;X(6,P,k,d,L);const F=H.l;if(P=H.c,k=H.lc,T[Q]=F,F==63){if(L.value-f.value>E)throw new Error("Something wrong with hufUnpackEncTable");X(8,P,k,d,L);let _=H.l+6;if(P=H.c,k=H.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--}}Y(T)}function Z(d){return d&63}function ie(d){return d>>6}function ee(d,f,E,Q){for(;f<=E;f++){const M=ie(d[f]),T=Z(d[f]);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]=f}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=f,L++}}}return!0}const ce={c:0,lc:0};function te(d,f,E,Q){d=d<<8|As(E,Q),f+=8,ce.c=d,ce.lc=f}const W={c:0,lc:0};function se(d,f,E,Q,M,T,L,P,k){if(d==f){Q<8&&(te(E,Q,M,T),E=ce.c,Q=ce.lc),Q-=8;let F=E>>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;W.c=E,W.lc=Q}function de(d){return d&65535}function me(d){const f=de(d);return f>32767?f-65536:f}const Ae={a:0,b:0};function Pe(d,f){const E=me(d),M=me(f),T=E+(M&1)+(M>>1),L=T,P=T-M;Ae.a=L,Ae.b=P}function Oe(d,f){const E=de(d),Q=de(f),M=E-(Q>>1)&65535,T=Q+M-32768&65535;Ae.a=T,Ae.b=M}function wt(d,f,E,Q,M,T,L){const P=L<16384,k=E>M?M:E;let F=1,_,j;for(;F<=k;)F<<=1;for(F>>=1,_=F,F>>=1;F>=1;){j=0;const K=j+T*(M-_),q=T*F,$=T*_,z=Q*F,J=Q*_;let ne,pe,Be,je;for(;j<=K;j+=$){let Ie=j;const le=j+Q*(E-_);for(;Ie<=le;Ie+=J){const xe=Ie+z,Ke=Ie+q,Te=Ke+z;P?(Pe(d[Ie+f],d[Ke+f]),ne=Ae.a,Be=Ae.b,Pe(d[xe+f],d[Te+f]),pe=Ae.a,je=Ae.b,Pe(ne,pe),d[Ie+f]=Ae.a,d[xe+f]=Ae.b,Pe(Be,je),d[Ke+f]=Ae.a,d[Te+f]=Ae.b):(Oe(d[Ie+f],d[Ke+f]),ne=Ae.a,Be=Ae.b,Oe(d[xe+f],d[Te+f]),pe=Ae.a,je=Ae.b,Oe(ne,pe),d[Ie+f]=Ae.a,d[xe+f]=Ae.b,Oe(Be,je),d[Ke+f]=Ae.a,d[Te+f]=Ae.b)}if(E&F){const xe=Ie+q;P?Pe(d[Ie+f],d[xe+f]):Oe(d[Ie+f],d[xe+f]),ne=Ae.a,d[xe+f]=Ae.b,d[Ie+f]=ne}}if(M&F){let Ie=j;const le=j+Q*(E-_);for(;Ie<=le;Ie+=J){const xe=Ie+z;P?Pe(d[Ie+f],d[xe+f]):Oe(d[Ie+f],d[xe+f]),ne=Ae.a,d[xe+f]=Ae.b,d[Ie+f]=ne}}_=F,F>>=1}return j}function Qt(d,f,E,Q,M,T,L,P,k){let F=0,_=0;const j=L,K=Math.trunc(Q.value+(M+7)/8);for(;Q.value<K;)for(te(F,_,E,Q),F=ce.c,_=ce.lc;_>=14;){const $=F>>_-14&16383,z=f[$];if(z.len)_-=z.len,se(z.lit,T,F,_,E,Q,P,k,j),F=W.c,_=W.lc;else{if(!z.p)throw new Error("hufDecode issues");let J;for(J=0;J<z.lit;J++){const ne=Z(d[z.p[J]]);for(;_<ne&&Q.value<K;)te(F,_,E,Q),F=ce.c,_=ce.lc;if(_>=ne&&ie(d[z.p[J]])==(F>>_-ne&(1<<ne)-1)){_-=ne,se(z.p[J],T,F,_,E,Q,P,k,j),F=W.c,_=W.lc;break}}if(J==z.lit)throw new Error("hufDecode issues")}}const q=8-M&7;for(F>>=q,_-=q;_>0;){const $=f[F<<14-_&16383];if($.len)_-=$.len,se($.lit,T,F,_,E,Q,P,k,j),F=W.c,_=W.lc;else throw new Error("hufDecode issues")}return!0}function lt(d,f,E,Q,M,T){const L={value:0},P=E.value,k=Ve(f,E),F=Ve(f,E);E.value+=4;const _=Ve(f,E);if(E.value+=4,k<0||k>=65537||F<0||F>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const j=new Array(65537),K=new Array(16384);G(K);const q=Q-(E.value-P);if(O(d,E,q,k,F,j),_>8*(Q-(E.value-P)))throw new Error("Something wrong with hufUncompress");ee(j,k,F,K),Qt(j,K,d,E,_,F,T,M,L)}function mt(d,f,E){for(let Q=0;Q<E;++Q)f[Q]=d[f[Q]]}function ot(d){for(let f=1;f<d.length;f++){const E=d[f-1]+d[f]-128;d[f]=E}}function xt(d,f){let E=0,Q=Math.floor((d.length+1)/2),M=0;const T=d.length-1;for(;!(M>T||(f[M++]=d[E++],M>T));)f[M++]=d[Q++]}function rs(d){let f=d.byteLength;const E=new Array;let Q=0;const M=new DataView(d);for(;f>0;){const T=M.getInt8(Q++);if(T<0){const L=-T;f-=L+1;for(let P=0;P<L;P++)E.push(M.getUint8(Q++))}else{const L=T;f-=2;const P=M.getUint8(Q++);for(let k=0;k<L+1;k++)E.push(P)}}return E}function Yi(d,f,E,Q,M,T){let L=new DataView(T.buffer);const P=E[d.idx[0]].width,k=E[d.idx[0]].height,F=3,_=Math.floor(P/8),j=Math.ceil(P/8),K=Math.ceil(k/8),q=P-(j-1)*8,$=k-(K-1)*8,z={value:0},J=new Array(F),ne=new Array(F),pe=new Array(F),Be=new Array(F),je=new Array(F);for(let le=0;le<F;++le)je[le]=f[d.idx[le]],J[le]=le<1?0:J[le-1]+j*K,ne[le]=new Float32Array(64),pe[le]=new Uint16Array(64),Be[le]=new Uint16Array(j*64);for(let le=0;le<K;++le){let xe=8;le==K-1&&(xe=$);let Ke=8;for(let ue=0;ue<j;++ue){ue==j-1&&(Ke=q);for(let fe=0;fe<F;++fe)pe[fe].fill(0),pe[fe][0]=M[J[fe]++],Vi(z,Q,pe[fe]),Ki(pe[fe],ne[fe]),Ji(ne[fe]);Wi(ne);for(let fe=0;fe<F;++fe)Xi(ne[fe],Be[fe],ue*64)}let Te=0;for(let ue=0;ue<F;++ue){const fe=E[d.idx[ue]].type;for(let rt=8*le;rt<8*le+xe;++rt){Te=je[ue][rt];for(let _t=0;_t<_;++_t){const $e=_t*64+(rt&7)*8;L.setUint16(Te+0*fe,Be[ue][$e+0],!0),L.setUint16(Te+2*fe,Be[ue][$e+1],!0),L.setUint16(Te+4*fe,Be[ue][$e+2],!0),L.setUint16(Te+6*fe,Be[ue][$e+3],!0),L.setUint16(Te+8*fe,Be[ue][$e+4],!0),L.setUint16(Te+10*fe,Be[ue][$e+5],!0),L.setUint16(Te+12*fe,Be[ue][$e+6],!0),L.setUint16(Te+14*fe,Be[ue][$e+7],!0),Te+=16*fe}}if(_!=j)for(let rt=8*le;rt<8*le+xe;++rt){const _t=je[ue][rt]+8*_*2*fe,$e=_*64+(rt&7)*8;for(let $t=0;$t<Ke;++$t)L.setUint16(_t+$t*2*fe,Be[ue][$e+$t],!0)}}}const Ie=new Uint16Array(P);L=new DataView(T.buffer);for(let le=0;le<F;++le){E[d.idx[le]].decoded=!0;const xe=E[d.idx[le]].type;if(E[le].type==2)for(let Ke=0;Ke<k;++Ke){const Te=je[le][Ke];for(let ue=0;ue<P;++ue)Ie[ue]=L.getUint16(Te+ue*2*xe,!0);for(let ue=0;ue<P;++ue)L.setFloat32(Te+ue*2*xe,V(Ie[ue]),!0)}}}function Vi(d,f,E){let Q,M=1;for(;M<64;)Q=f[d.value],Q==65280?M=64:Q>>8==255?M+=Q&255:(E[M]=Q,M++),d.value++}function Ki(d,f){f[0]=V(d[0]),f[1]=V(d[1]),f[2]=V(d[5]),f[3]=V(d[6]),f[4]=V(d[14]),f[5]=V(d[15]),f[6]=V(d[27]),f[7]=V(d[28]),f[8]=V(d[2]),f[9]=V(d[4]),f[10]=V(d[7]),f[11]=V(d[13]),f[12]=V(d[16]),f[13]=V(d[26]),f[14]=V(d[29]),f[15]=V(d[42]),f[16]=V(d[3]),f[17]=V(d[8]),f[18]=V(d[12]),f[19]=V(d[17]),f[20]=V(d[25]),f[21]=V(d[30]),f[22]=V(d[41]),f[23]=V(d[43]),f[24]=V(d[9]),f[25]=V(d[11]),f[26]=V(d[18]),f[27]=V(d[24]),f[28]=V(d[31]),f[29]=V(d[40]),f[30]=V(d[44]),f[31]=V(d[53]),f[32]=V(d[10]),f[33]=V(d[19]),f[34]=V(d[23]),f[35]=V(d[32]),f[36]=V(d[39]),f[37]=V(d[45]),f[38]=V(d[52]),f[39]=V(d[54]),f[40]=V(d[20]),f[41]=V(d[22]),f[42]=V(d[33]),f[43]=V(d[38]),f[44]=V(d[46]),f[45]=V(d[51]),f[46]=V(d[55]),f[47]=V(d[60]),f[48]=V(d[21]),f[49]=V(d[34]),f[50]=V(d[37]),f[51]=V(d[47]),f[52]=V(d[50]),f[53]=V(d[56]),f[54]=V(d[59]),f[55]=V(d[61]),f[56]=V(d[35]),f[57]=V(d[36]),f[58]=V(d[48]),f[59]=V(d[49]),f[60]=V(d[57]),f[61]=V(d[58]),f[62]=V(d[62]),f[63]=V(d[63])}function Ji(d){const f=.5*Math.cos(.7853975),E=.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 K=0;K<8;++K){const q=K*8;k[0]=Q*d[q+2],k[1]=L*d[q+2],k[2]=Q*d[q+6],k[3]=L*d[q+6],F[0]=E*d[q+1]+M*d[q+3]+T*d[q+5]+P*d[q+7],F[1]=M*d[q+1]-P*d[q+3]-E*d[q+5]-T*d[q+7],F[2]=T*d[q+1]-E*d[q+3]+P*d[q+5]+M*d[q+7],F[3]=P*d[q+1]-T*d[q+3]+M*d[q+5]-E*d[q+7],_[0]=f*(d[q+0]+d[q+4]),_[3]=f*(d[q+0]-d[q+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[q+0]=j[0]+F[0],d[q+1]=j[1]+F[1],d[q+2]=j[2]+F[2],d[q+3]=j[3]+F[3],d[q+4]=j[3]-F[3],d[q+5]=j[2]-F[2],d[q+6]=j[1]-F[1],d[q+7]=j[0]-F[0]}for(let K=0;K<8;++K)k[0]=Q*d[16+K],k[1]=L*d[16+K],k[2]=Q*d[48+K],k[3]=L*d[48+K],F[0]=E*d[8+K]+M*d[24+K]+T*d[40+K]+P*d[56+K],F[1]=M*d[8+K]-P*d[24+K]-E*d[40+K]-T*d[56+K],F[2]=T*d[8+K]-E*d[24+K]+P*d[40+K]+M*d[56+K],F[3]=P*d[8+K]-T*d[24+K]+M*d[40+K]-E*d[56+K],_[0]=f*(d[K]+d[32+K]),_[3]=f*(d[K]-d[32+K]),_[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+K]=j[0]+F[0],d[8+K]=j[1]+F[1],d[16+K]=j[2]+F[2],d[24+K]=j[3]+F[3],d[32+K]=j[3]-F[3],d[40+K]=j[2]-F[2],d[48+K]=j[1]-F[1],d[56+K]=j[0]-F[0]}function Wi(d){for(let f=0;f<64;++f){const E=d[0][f],Q=d[1][f],M=d[2][f];d[0][f]=E+1.5747*M,d[1][f]=E-.1873*Q-.4682*M,d[2][f]=E+1.8556*Q}}function Xi(d,f,E){for(let Q=0;Q<64;++Q)f[E+Q]=r.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 gn(d){return new DataView(d.array.buffer,d.offset.value,d.size)}function $i(d){const f=d.viewer.buffer.slice(d.offset.value,d.offset.value+d.size),E=new Uint8Array(rs(f)),Q=new Uint8Array(E.length);return ot(E),xt(E,Q),new DataView(Q.buffer)}function fn(d){const f=d.array.slice(d.offset.value,d.offset.value+d.size),E=Vt(f),Q=new Uint8Array(E.length);return ot(E),xt(E,Q),new DataView(Q.buffer)}function eo(d){const f=d.viewer,E={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 $=0,z=d.inputChannels.length;$<z;$++)L[$]={},L[$].start=T,L[$].end=L[$].start,L[$].nx=d.columns,L[$].ny=d.lines,L[$].size=d.type,T+=L[$].nx*L[$].ny*L[$].size;const P=Dt(f,E),k=Dt(f,E);if(k>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(P<=k)for(let $=0;$<k-P+1;$++)M[$+P]=ht(f,E);const F=new Uint16Array(65536),_=U(M,F),j=Ve(f,E);lt(d.array,f,E,j,Q,T);for(let $=0;$<d.inputChannels.length;++$){const z=L[$];for(let J=0;J<L[$].size;++J)wt(Q,z.start+J,z.nx,z.size,z.ny,z.nx*z.size,_)}mt(F,Q,T);let K=0;const q=new Uint8Array(Q.buffer.byteLength);for(let $=0;$<d.lines;$++)for(let z=0;z<d.inputChannels.length;z++){const J=L[z],ne=J.nx*J.size,pe=new Uint8Array(Q.buffer,J.end*2,ne*2);q.set(pe,K),K+=ne*2,J.end+=ne}return new DataView(q.buffer)}function to(d){const f=d.array.slice(d.offset.value,d.offset.value+d.size),E=Vt(f),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 q=0;q<d.columns;++q){const $=E[k[0]++]<<8|E[k[1]++];j+=$,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 q=0;q<d.columns;++q){const $=E[k[0]++]<<24|E[k[1]++]<<16|E[k[2]++]<<8;j+=$,T.setUint32(P,j,!0),P+=4}break}}return T}function as(d){const f=d.viewer,E={value:d.offset.value},Q=new Uint8Array(d.columns*d.lines*(d.inputChannels.length*d.type*2)),M={version:He(f,E),unknownUncompressedSize:He(f,E),unknownCompressedSize:He(f,E),acCompressedSize:He(f,E),dcCompressedSize:He(f,E),rleCompressedSize:He(f,E),rleUncompressedSize:He(f,E),rleRawSize:He(f,E),totalAcUncompressedCount:He(f,E),totalDcUncompressedCount:He(f,E),acCompression:He(f,E)};if(M.version<2)throw new Error("EXRLoader.parse: "+It.compression+" version "+M.version+" is unsupported");const T=new Array;let L=Dt(f,E)-2;for(;L>0;){const z=Zt(f.buffer,E),J=ht(f,E),ne=J>>2&3,pe=(J>>4)-1,Be=new Int8Array([pe])[0],je=ht(f,E);T.push({name:z,index:Be,type:je,compression:ne}),L-=z.length+3}const P=It.channels,k=new Array(d.inputChannels.length);for(let z=0;z<d.inputChannels.length;++z){const J=k[z]={},ne=P[z];J.name=ne.name,J.compression=0,J.decoded=!1,J.type=ne.pixelType,J.pLinear=ne.pLinear,J.width=d.columns,J.height=d.lines}const F={idx:new Array(3)};for(let z=0;z<d.inputChannels.length;++z){const J=k[z];for(let ne=0;ne<T.length;++ne){const pe=T[ne];J.name==pe.name&&(J.compression=pe.compression,pe.index>=0&&(F.idx[pe.index]=z),J.offset=z)}}let _,j,K;if(M.acCompressedSize>0)switch(M.acCompression){case 0:_=new Uint16Array(M.totalAcUncompressedCount),lt(d.array,f,E,M.acCompressedSize,_,M.totalAcUncompressedCount);break;case 1:const z=d.array.slice(E.value,E.value+M.totalAcUncompressedCount),J=Vt(z);_=new Uint16Array(J.buffer),E.value+=M.totalAcUncompressedCount;break}if(M.dcCompressedSize>0){const z={array:d.array,offset:E,size:M.dcCompressedSize};j=new Uint16Array(fn(z).buffer),E.value+=M.dcCompressedSize}if(M.rleRawSize>0){const z=d.array.slice(E.value,E.value+M.rleCompressedSize),J=Vt(z);K=rs(J.buffer),E.value+=M.rleCompressedSize}let q=0;const $=new Array(k.length);for(let z=0;z<$.length;++z)$[z]=new Array;for(let z=0;z<d.lines;++z)for(let J=0;J<k.length;++J)$[J].push(q),q+=k[J].width*d.type*2;Yi(F,$,k,_,j,Q);for(let z=0;z<k.length;++z){const J=k[z];if(!J.decoded)switch(J.compression){case 2:let ne=0,pe=0;for(let Be=0;Be<d.lines;++Be){let je=$[z][ne];for(let Ie=0;Ie<J.width;++Ie){for(let le=0;le<2*J.type;++le)Q[je++]=K[pe+le*J.width*J.height];pe++}ne++}break;case 1:default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(Q.buffer)}function Zt(d,f){const E=new Uint8Array(d);let Q=0;for(;E[f.value+Q]!=0;)Q+=1;const M=new TextDecoder().decode(E.slice(f.value,f.value+Q));return f.value=f.value+Q+1,M}function no(d,f,E){const Q=new TextDecoder().decode(new Uint8Array(d).slice(f.value,f.value+E));return f.value=f.value+E,Q}function so(d,f){const E=Ye(d,f),Q=Ve(d,f);return[E,Q]}function io(d,f){const E=Ve(d,f),Q=Ve(d,f);return[E,Q]}function Ye(d,f){const E=d.getInt32(f.value,!0);return f.value=f.value+4,E}function Ve(d,f){const E=d.getUint32(f.value,!0);return f.value=f.value+4,E}function As(d,f){const E=d[f.value];return f.value=f.value+1,E}function ht(d,f){const E=d.getUint8(f.value);return f.value=f.value+1,E}const He=function(d,f){let E;return"getBigInt64"in DataView.prototype?E=Number(d.getBigInt64(f.value,!0)):E=d.getUint32(f.value+4,!0)+Number(d.getUint32(f.value,!0)<<32),f.value+=8,E};function _e(d,f){const E=d.getFloat32(f.value,!0);return f.value+=4,E}function oo(d,f){return r.DataUtils.toHalfFloat(_e(d,f))}function V(d){const f=(d&31744)>>10,E=d&1023;return(d>>15?-1:1)*(f?f===31?E?NaN:1/0:Math.pow(2,f-15)*(1+E/1024):6103515625e-14*(E/1024))}function Dt(d,f){const E=d.getUint16(f.value,!0);return f.value+=2,E}function ro(d,f){return V(Dt(d,f))}function ao(d,f,E,Q){const M=E.value,T=[];for(;E.value<M+Q-1;){const L=Zt(f,E),P=Ye(d,E),k=ht(d,E);E.value+=3;const F=Ye(d,E),_=Ye(d,E);T.push({name:L,pixelType:P,pLinear:k,xSampling:F,ySampling:_})}return E.value+=1,T}function Ao(d,f){const E=_e(d,f),Q=_e(d,f),M=_e(d,f),T=_e(d,f),L=_e(d,f),P=_e(d,f),k=_e(d,f),F=_e(d,f);return{redX:E,redY:Q,greenX:M,greenY:T,blueX:L,blueY:P,whiteX:k,whiteY:F}}function co(d,f){const E=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],Q=ht(d,f);return E[Q]}function lo(d,f){const E=Ye(d,f),Q=Ye(d,f),M=Ye(d,f),T=Ye(d,f);return{xMin:E,yMin:Q,xMax:M,yMax:T}}function ho(d,f){const E=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],Q=ht(d,f);return E[Q]}function uo(d,f){const E=["ENVMAP_LATLONG","ENVMAP_CUBE"],Q=ht(d,f);return E[Q]}function po(d,f){const E=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],Q=["ROUND_DOWN","ROUND_UP"],M=Ve(d,f),T=Ve(d,f),L=ht(d,f);return{xSize:M,ySize:T,levelMode:E[L&15],roundingMode:Q[L>>4]}}function go(d,f){const E=_e(d,f),Q=_e(d,f);return[E,Q]}function fo(d,f){const E=_e(d,f),Q=_e(d,f),M=_e(d,f);return[E,Q,M]}function mo(d,f,E,Q,M){if(Q==="string"||Q==="stringvector"||Q==="iccProfile")return no(f,E,M);if(Q==="chlist")return ao(d,f,E,M);if(Q==="chromaticities")return Ao(d,E);if(Q==="compression")return co(d,E);if(Q==="box2i")return lo(d,E);if(Q==="envmap")return uo(d,E);if(Q==="tiledesc")return po(d,E);if(Q==="lineOrder")return ho(d,E);if(Q==="float")return _e(d,E);if(Q==="v2f")return go(d,E);if(Q==="v3f")return fo(d,E);if(Q==="int")return Ye(d,E);if(Q==="rational")return so(d,E);if(Q==="timecode")return io(d,E);if(Q==="preview")return E.value+=M,"skipped";E.value+=M}function Io(d,f){const E=Math.log2(d);return f=="ROUND_DOWN"?Math.floor(E):Math.ceil(E)}function bo(d,f,E){let Q=0;switch(d.levelMode){case"ONE_LEVEL":Q=1;break;case"MIPMAP_LEVELS":Q=Io(Math.max(f,E),d.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return Q}function cs(d,f,E,Q){const M=new Array(d);for(let T=0;T<d;T++){const L=1<<T;let P=f/L|0;Q=="ROUND_UP"&&P*L<f&&(P+=1);const k=Math.max(P,1);M[T]=(k+E-1)/E|0}return M}function Eo(){const d=this,f=d.offset,E={value:0};for(let Q=0;Q<d.tileCount;Q++){const M=Ye(d.viewer,f),T=Ye(d.viewer,f);f.value+=8,d.size=Ve(d.viewer,f);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):gn(d);f.value+=d.size;for(let j=0;j<d.lines;j++){const K=j*d.columns*d.totalBytes;for(let q=0;q<d.inputChannels.length;q++){const $=It.channels[q].name,z=d.channelByteOffsets[$]*d.columns,J=d.decodeChannels[$];if(J===void 0)continue;E.value=K+z;const ne=(d.height-(1+P+j))*d.outLineWidth;for(let pe=0;pe<d.columns;pe++){const Be=ne+(pe+L)*d.outputChannels+J;d.byteArray[Be]=d.getter(_,E)}}}}}function Co(){const d=this,f=d.offset,E={value:0};for(let Q=0;Q<d.height/d.blockHeight;Q++){const M=Ye(d.viewer,f)-It.dataWindow.yMin;d.size=Ve(d.viewer,f),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):gn(d);f.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,K=(d.height-1-_)*d.outLineWidth;for(let q=0;q<d.inputChannels.length;q++){const $=It.channels[q].name,z=d.channelByteOffsets[$]*d.columns,J=d.decodeChannels[$];if(J!==void 0){E.value=j+z;for(let ne=0;ne<d.columns;ne++){const pe=K+ne*d.outputChannels+J;d.byteArray[pe]=d.getter(P,E)}}}}}}function Bo(d,f,E){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)},E.value=8;let T=!0;for(;T;){const L=Zt(f,E);if(L==0)T=!1;else{const P=Zt(f,E),k=Ve(d,E),F=mo(d,f,E,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,f,E,Q,M){const T={size:0,viewer:f,array:E,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:r.LinearSRGBColorSpace};switch(d.compression){case"NO_COMPRESSION":T.blockHeight=1,T.uncompress=gn;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 r.FloatType:T.getter=ro;break;case r.HalfFloatType:T.getter=Dt;break}else if(T.type==2)switch(M){case r.FloatType:T.getter=_e;break;case r.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 r.FloatType:T.byteArray=new Float32Array(k),P&&T.byteArray.fill(1,0,k);break;case r.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=r.RGBAFormat,T.colorSpace=r.LinearSRGBColorSpace):(T.format=r.RedFormat,T.colorSpace=r.NoColorSpace),d.spec.singleTile){T.blockHeight=d.tiles.ySize,T.blockWidth=d.tiles.xSize;const _=bo(d.tiles,T.width,T.height),j=cs(_,T.width,d.tiles.xSize,d.tiles.roundingMode),K=cs(_,T.height,d.tiles.ySize,d.tiles.roundingMode);T.tileCount=j[0]*K[0];for(let q=0;q<_;q++)for(let $=0;$<K[q];$++)for(let z=0;z<j[q];z++)He(f,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(f,Q);T.decode=Co.bind(T)}return T}const ls={value:0},hs=new DataView(e),wo=new Uint8Array(e),It=Bo(hs,e,ls),St=yo(It,hs,wo,ls,this.type);return St.decode(),{header:It,width:St.width,height:St.height,data:St.byteArray,format:St.format,colorSpace:St.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,s,n){function i(o,a){o.colorSpace=a.colorSpace,o.minFilter=r.LinearFilter,o.magFilter=r.LinearFilter,o.generateMipmaps=!1,o.flipY=!1,t&&t(o,a)}return super.load(e,i,s,n)}}const pa=Object.freeze(Object.defineProperty({__proto__:null,EXRLoader:Li},Symbol.toStringTag,{value:"Module"}));class ki extends r.DataTextureLoader{constructor(e){super(e),this.type=r.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,U){v=v||1024;let H=S.pos,X=-1,N=0,Y="",O=String.fromCharCode.apply(null,new Uint16Array(S.subarray(H,H+128)));for(;0>(X=O.indexOf(`
36
+ `)a=0,A-=i;else{const u=Or(h,n,a,A,t);a+=u.offsetX,o.push(u.path)}}return o}function Or(c,e,t,s,n){const i=n.glyphs[c]||n.glyphs["?"];if(!i){console.error('THREE.Font: character "'+c+'" does not exists in font family '+n.familyName+".");return}const o=new r.ShapePath;let a,A,l,h,u,p,g,m;if(i.o){const I=i._cachedOutline||(i._cachedOutline=i.o.split(" "));for(let b=0,B=I.length;b<B;)switch(I[b++]){case"m":a=I[b++]*e+t,A=I[b++]*e+s,o.moveTo(a,A);break;case"l":a=I[b++]*e+t,A=I[b++]*e+s,o.lineTo(a,A);break;case"q":l=I[b++]*e+t,h=I[b++]*e+s,u=I[b++]*e+t,p=I[b++]*e+s,o.quadraticCurveTo(u,p,l,h);break;case"b":l=I[b++]*e+t,h=I[b++]*e+s,u=I[b++]*e+t,p=I[b++]*e+s,g=I[b++]*e+t,m=I[b++]*e+s,o.bezierCurveTo(u,p,g,m,l,h);break}}return{offsetX:i.ha*e,path:o}}const Et=new r.Raycaster,Fe=new r.Vector3,pt=new r.Vector3,Ce=new r.Quaternion,Bs={X:new r.Vector3(1,0,0),Y:new r.Vector3(0,1,0),Z:new r.Vector3(0,0,1)},Sn={type:"change"},ys={type:"mouseDown",mode:null},ws={type:"mouseUp",mode:null},Qs={type:"objectChange"};class Hr extends r.Controls{constructor(e,t=null){super(void 0,t);const s=new Kr(this);this._root=s;const n=new xi;this._gizmo=n,s.add(n);const i=new Jr;this._plane=i,s.add(i);const o=this;function a(C,y){let x=y;Object.defineProperty(o,C,{get:function(){return x!==void 0?x:y},set:function(R){x!==R&&(x=R,i[C]=R,n[C]=R,o.dispatchEvent({type:C+"-changed",value:R}),o.dispatchEvent(Sn))}}),o[C]=y,i[C]=y,n[C]=y}a("camera",e),a("object",void 0),a("enabled",!0),a("axis",null),a("mode","translate"),a("translationSnap",null),a("rotationSnap",null),a("scaleSnap",null),a("space","world"),a("size",1),a("dragging",!1),a("showX",!0),a("showY",!0),a("showZ",!0);const A=new r.Vector3,l=new r.Vector3,h=new r.Quaternion,u=new r.Quaternion,p=new r.Vector3,g=new r.Quaternion,m=new r.Vector3,I=new r.Vector3,b=new r.Vector3,B=0,w=new r.Vector3;a("worldPosition",A),a("worldPositionStart",l),a("worldQuaternion",h),a("worldQuaternionStart",u),a("cameraPosition",p),a("cameraQuaternion",g),a("pointStart",m),a("pointEnd",I),a("rotationAxis",b),a("rotationAngle",B),a("eye",w),this._offset=new r.Vector3,this._startNorm=new r.Vector3,this._endNorm=new r.Vector3,this._cameraScale=new r.Vector3,this._parentPosition=new r.Vector3,this._parentQuaternion=new r.Quaternion,this._parentQuaternionInv=new r.Quaternion,this._parentScale=new r.Vector3,this._worldScaleStart=new r.Vector3,this._worldQuaternionInv=new r.Quaternion,this._worldScale=new r.Vector3,this._positionStart=new r.Vector3,this._quaternionStart=new r.Quaternion,this._scaleStart=new r.Vector3,this._getPointer=jr.bind(this),this._onPointerDown=zr.bind(this),this._onPointerHover=qr.bind(this),this._onPointerMove=Yr.bind(this),this._onPointerUp=Vr.bind(this),t!==null&&this.connect()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="auto"}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&Et.setFromCamera(e,this.camera);const t=Tn(this._gizmo.picker[this.mode],Et);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&Et.setFromCamera(e,this.camera);const t=Tn(this._plane,Et,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,ys.mode=this.mode,this.dispatchEvent(ys)}}pointerMove(e){const t=this.axis,s=this.mode,n=this.object;let i=this.space;if(s==="scale"?i="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(i="world"),n===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&Et.setFromCamera(e,this.camera);const o=Tn(this._plane,Et,!0);if(o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),s==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),i==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),i==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(i==="local"&&(n.position.applyQuaternion(Ce.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),i==="world"&&(n.parent&&n.position.add(Fe.setFromMatrixPosition(n.parent.matrixWorld)),t.search("X")!==-1&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(Fe.setFromMatrixPosition(n.parent.matrixWorld))));else if(s==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),pt.set(a,a,a)}else Fe.copy(this.pointStart),pt.copy(this.pointEnd),Fe.applyQuaternion(this._worldQuaternionInv),pt.applyQuaternion(this._worldQuaternionInv),pt.divide(Fe),t.search("X")===-1&&(pt.x=1),t.search("Y")===-1&&(pt.y=1),t.search("Z")===-1&&(pt.z=1);n.scale.copy(this._scaleStart).multiply(pt),this.scaleSnap&&(t.search("X")!==-1&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(s==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Fe.setFromMatrixPosition(this.camera.matrixWorld));let A=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Fe.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Bs[t]),Fe.copy(Bs[t]),i==="local"&&Fe.applyQuaternion(this.worldQuaternion),Fe.cross(this.eye),Fe.length()===0?A=!0:this.rotationAngle=this._offset.dot(Fe.normalize())*a),(t==="E"||A)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),i==="local"&&t!=="E"&&t!=="XYZE"?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(Ce.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(Ce.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Sn),this.dispatchEvent(Qs)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(ws.mode=this.mode,this.dispatchEvent(ws)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(Sn),this.dispatchEvent(Qs),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Et}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function jr(c){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:c.button};{const e=this.domElement.getBoundingClientRect();return{x:(c.clientX-e.left)/e.width*2-1,y:-(c.clientY-e.top)/e.height*2+1,button:c.button}}}function qr(c){if(this.enabled)switch(c.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(c));break}}function zr(c){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(c.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(c)),this.pointerDown(this._getPointer(c)))}function Yr(c){this.enabled&&this.pointerMove(this._getPointer(c))}function Vr(c){this.enabled&&(this.domElement.releasePointerCapture(c.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(c)))}function Tn(c,e,t){const s=e.intersectObject(c,!0);for(let n=0;n<s.length;n++)if(s[n].object.visible||t)return s[n];return!1}const en=new r.Euler,ge=new r.Vector3(0,1,0),xs=new r.Vector3(0,0,0),Ss=new r.Matrix4,tn=new r.Quaternion,hn=new r.Quaternion,et=new r.Vector3,Ts=new r.Matrix4,zt=new r.Vector3(1,0,0),Bt=new r.Vector3(0,1,0),Yt=new r.Vector3(0,0,1),nn=new r.Vector3,Nt=new r.Vector3,Ut=new r.Vector3;class Kr extends r.Object3D{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){const t=this.controls;t.object!==void 0&&(t.object.updateMatrixWorld(),t.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):t.object.parent.matrixWorld.decompose(t._parentPosition,t._parentQuaternion,t._parentScale),t.object.matrixWorld.decompose(t.worldPosition,t.worldQuaternion,t._worldScale),t._parentQuaternionInv.copy(t._parentQuaternion).invert(),t._worldQuaternionInv.copy(t.worldQuaternion).invert()),t.camera.updateMatrixWorld(),t.camera.matrixWorld.decompose(t.cameraPosition,t.cameraQuaternion,t._cameraScale),t.camera.isOrthographicCamera?t.camera.getWorldDirection(t.eye).negate():t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(),super.updateMatrixWorld(e)}}class xi extends r.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new r.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new r.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=e.clone();s.opacity=.15;const n=t.clone();n.opacity=.5;const i=e.clone();i.color.setHex(16711680);const o=e.clone();o.color.setHex(65280);const a=e.clone();a.color.setHex(255);const A=e.clone();A.color.setHex(16711680),A.opacity=.5;const l=e.clone();l.color.setHex(65280),l.opacity=.5;const h=e.clone();h.color.setHex(255),h.opacity=.5;const u=e.clone();u.opacity=.25;const p=e.clone();p.color.setHex(16776960),p.opacity=.25,e.clone().color.setHex(16776960);const m=e.clone();m.color.setHex(7895160);const I=new r.CylinderGeometry(0,.04,.1,12);I.translate(0,.05,0);const b=new r.BoxGeometry(.08,.08,.08);b.translate(0,.04,0);const B=new r.BufferGeometry;B.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,0,0],3));const w=new r.CylinderGeometry(.0075,.0075,.5,3);w.translate(0,.25,0);function C(Y,O){const Z=new r.TorusGeometry(Y,.0075,3,64,O*Math.PI*2);return Z.rotateY(Math.PI/2),Z.rotateX(Math.PI/2),Z}function y(){const Y=new r.BufferGeometry;return Y.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,1,1],3)),Y}const x={X:[[new r.Mesh(I,i),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(I,i),[-.5,0,0],[0,0,Math.PI/2]],[new r.Mesh(w,i),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new r.Mesh(I,o),[0,.5,0]],[new r.Mesh(I,o),[0,-.5,0],[Math.PI,0,0]],[new r.Mesh(w,o)]],Z:[[new r.Mesh(I,a),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(I,a),[0,0,-.5],[-Math.PI/2,0,0]],[new r.Mesh(w,a),null,[Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.1,0),u.clone()),[0,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),A.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},R={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.2,0),s)]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},D={START:[[new r.Mesh(new r.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],END:[[new r.Mesh(new r.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],DELTA:[[new r.Line(y(),n),null,null,null,"helper"]],X:[[new r.Line(B,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(B,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(B,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},S={XYZE:[[new r.Mesh(C(.5,1),m),null,[0,Math.PI/2,0]]],X:[[new r.Mesh(C(.5,.5),i)]],Y:[[new r.Mesh(C(.5,.5),o),null,[0,0,-Math.PI/2]]],Z:[[new r.Mesh(C(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new r.Mesh(C(.75,1),p),null,[0,Math.PI/2,0]]]},v={AXIS:[[new r.Line(B,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},U={XYZE:[[new r.Mesh(new r.SphereGeometry(.25,10,8),s)]],X:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new r.Mesh(new r.TorusGeometry(.75,.1,2,24),s)]]},G={X:[[new r.Mesh(b,i),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(w,i),[0,0,0],[0,0,-Math.PI/2]],[new r.Mesh(b,i),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(b,o),[0,.5,0]],[new r.Mesh(w,o)],[new r.Mesh(b,o),[0,-.5,0],[0,0,Math.PI]]],Z:[[new r.Mesh(b,a),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(w,a),[0,0,0],[Math.PI/2,0,0]],[new r.Mesh(b,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),A),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.1,.1,.1),u.clone())]]},H={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},X={X:[[new r.Line(B,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(B,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(B,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function N(Y){const O=new r.Object3D;for(const Z in Y)for(let ie=Y[Z].length;ie--;){const ee=Y[Z][ie][0].clone(),ce=Y[Z][ie][1],te=Y[Z][ie][2],W=Y[Z][ie][3],se=Y[Z][ie][4];ee.name=Z,ee.tag=se,ce&&ee.position.set(ce[0],ce[1],ce[2]),te&&ee.rotation.set(te[0],te[1],te[2]),W&&ee.scale.set(W[0],W[1],W[2]),ee.updateMatrix();const de=ee.geometry.clone();de.applyMatrix4(ee.matrix),ee.geometry=de,ee.renderOrder=1/0,ee.position.set(0,0,0),ee.rotation.set(0,0,0),ee.scale.set(1,1,1),O.add(ee)}return O}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=N(x)),this.add(this.gizmo.rotate=N(S)),this.add(this.gizmo.scale=N(G)),this.add(this.picker.translate=N(R)),this.add(this.picker.rotate=N(U)),this.add(this.picker.scale=N(H)),this.add(this.helper.translate=N(D)),this.add(this.helper.rotate=N(v)),this.add(this.helper.scale=N(X)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const s=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:hn;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let n=[];n=n.concat(this.picker[this.mode].children),n=n.concat(this.gizmo[this.mode].children),n=n.concat(this.helper[this.mode].children);for(let i=0;i<n.length;i++){const o=n[i];o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),o.scale.set(1,1,1).multiplyScalar(a*this.size/4),o.tag==="helper"){o.visible=!1,o.name==="AXIS"?(o.visible=!!this.axis,this.axis==="X"&&(Ce.setFromEuler(en.set(0,0,0)),o.quaternion.copy(s).multiply(Ce),Math.abs(ge.copy(zt).applyQuaternion(s).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Y"&&(Ce.setFromEuler(en.set(0,0,Math.PI/2)),o.quaternion.copy(s).multiply(Ce),Math.abs(ge.copy(Bt).applyQuaternion(s).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(Ce.setFromEuler(en.set(0,Math.PI/2,0)),o.quaternion.copy(s).multiply(Ce),Math.abs(ge.copy(Yt).applyQuaternion(s).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(Ce.setFromEuler(en.set(0,Math.PI/2,0)),ge.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(Ss.lookAt(xs,ge,Bt)),o.quaternion.multiply(Ce),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Fe.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Fe.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Fe),o.visible=this.dragging):(o.quaternion.copy(s),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(s),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(ge.copy(zt).applyQuaternion(s).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(ge.copy(Bt).applyQuaternion(s).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(ge.copy(Yt).applyQuaternion(s).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(ge.copy(Yt).applyQuaternion(s).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(ge.copy(zt).applyQuaternion(s).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(ge.copy(Bt).applyQuaternion(s).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(tn.copy(s),ge.copy(this.eye).applyQuaternion(Ce.copy(s).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(Ss.lookAt(this.eye,xs,Bt)),o.name==="X"&&(Ce.setFromAxisAngle(zt,Math.atan2(-ge.y,ge.z)),Ce.multiplyQuaternions(tn,Ce),o.quaternion.copy(Ce)),o.name==="Y"&&(Ce.setFromAxisAngle(Bt,Math.atan2(ge.x,ge.z)),Ce.multiplyQuaternions(tn,Ce),o.quaternion.copy(Ce)),o.name==="Z"&&(Ce.setFromAxisAngle(Yt,Math.atan2(ge.y,ge.x)),Ce.multiplyQuaternions(tn,Ce),o.quaternion.copy(Ce))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(A){return o.name===A}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(e)}}class Jr extends r.Mesh{constructor(){super(new r.PlaneGeometry(1e5,1e5,2,2),new r.MeshBasicMaterial({visible:!1,wireframe:!0,side:r.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),nn.copy(zt).applyQuaternion(t==="local"?this.worldQuaternion:hn),Nt.copy(Bt).applyQuaternion(t==="local"?this.worldQuaternion:hn),Ut.copy(Yt).applyQuaternion(t==="local"?this.worldQuaternion:hn),ge.copy(Nt),this.mode){case"translate":case"scale":switch(this.axis){case"X":ge.copy(this.eye).cross(nn),et.copy(nn).cross(ge);break;case"Y":ge.copy(this.eye).cross(Nt),et.copy(Nt).cross(ge);break;case"Z":ge.copy(this.eye).cross(Ut),et.copy(Ut).cross(ge);break;case"XY":et.copy(Ut);break;case"YZ":et.copy(nn);break;case"XZ":ge.copy(Ut),et.copy(Nt);break;case"XYZ":case"E":et.set(0,0,0);break}break;default:et.set(0,0,0)}et.length()===0?this.quaternion.copy(this.cameraQuaternion):(Ts.lookAt(Fe.set(0,0,0),et,ge),this.quaternion.setFromRotationMatrix(Ts)),super.updateMatrixWorld(e)}}var Qe=Uint8Array,qe=Uint16Array,es=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]),pn=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]),zn=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 es(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,Yn=Ti.r;vi[28]=258,Yn[258]=28;var Mi=Si(pn,0),Wr=Mi.b,vs=Mi.r,Vn=new qe(32768);for(var Ee=0;Ee<32768;++Ee){var gt=(Ee&43690)>>1|(Ee&21845)<<1;gt=(gt&52428)>>2|(gt&13107)<<2,gt=(gt&61680)>>4|(gt&3855)<<4,Vn[Ee]=((gt&65280)>>8|(gt&255)<<8)>>1}var it=(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 a;if(t){a=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,p=u|(1<<h)-1;u<=p;++u)a[Vn[u]>>A]=l}else for(a=new qe(s),n=0;n<s;++n)c[n]&&(a[n]=Vn[o[c[n]-1]++]>>15-c[n]);return a}),ft=new Qe(288);for(var Ee=0;Ee<144;++Ee)ft[Ee]=8;for(var Ee=144;Ee<256;++Ee)ft[Ee]=9;for(var Ee=256;Ee<280;++Ee)ft[Ee]=7;for(var Ee=280;Ee<288;++Ee)ft[Ee]=8;var Wt=new Qe(32);for(var Ee=0;Ee<32;++Ee)Wt[Ee]=5;var Xr=it(ft,9,0),Zr=it(ft,9,1),$r=it(Wt,5,0),ea=it(Wt,5,1),vn=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},Mn=function(c,e){var t=e/8|0;return(c[t]|c[t+1]<<8|c[t+2]<<16)>>(e&7)},ts=function(c){return(c+7)/8|0},ns=function(c,e,t){return(t==null||t>c.length)&&(t=c.length),new Qe(c.subarray(e,t))},ta=["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"],Ne=function(c,e,t){var s=new Error(e||ta[c]);if(s.code=c,Error.captureStackTrace&&Error.captureStackTrace(s,Ne),!t)throw s;return s},na=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,a=o||e.i!=2,A=e.i;o&&(t=new Qe(n*3));var l=function(lt){var mt=t.length;if(lt>mt){var ot=new Qe(Math.max(mt*2,lt));ot.set(t),t=ot}},h=e.f||0,u=e.p||0,p=e.b||0,g=e.l,m=e.d,I=e.m,b=e.n,B=n*8;do{if(!g){h=Ze(c,u,1);var w=Ze(c,u+1,3);if(u+=3,w)if(w==1)g=Zr,m=ea,I=9,b=5;else if(w==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),U=new Qe(19),G=0;G<D;++G)U[zn[G]]=Ze(c,u+G*3,7);u+=D*3;for(var H=vn(U),X=(1<<H)-1,N=it(U,H,1),G=0;G<S;){var Y=N[Ze(c,u,X)];u+=Y&15;var C=Y>>4;if(C<16)v[G++]=C;else{var O=0,Z=0;for(C==16?(Z=3+Ze(c,u,3),u+=2,O=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++]=O}}var ie=v.subarray(0,R),ee=v.subarray(R);I=vn(ie),b=vn(ee),g=it(ie,I,1),m=it(ee,b,1)}else Ne(1);else{var C=ts(u)+4,y=c[C-4]|c[C-3]<<8,x=C+y;if(x>n){A&&Ne(0);break}a&&l(p+y),t.set(c.subarray(C,x),p),e.b=p+=y,e.p=u=x*8,e.f=h;continue}if(u>B){A&&Ne(0);break}}a&&l(p+131072);for(var ce=(1<<I)-1,te=(1<<b)-1,W=u;;W=u){var O=g[Mn(c,u)&ce],se=O>>4;if(u+=O&15,u>B){A&&Ne(0);break}if(O||Ne(2),se<256)t[p++]=se;else if(se==256){W=u,g=null;break}else{var de=se-254;if(se>264){var G=se-257,me=dn[G];de=Ze(c,u,(1<<me)-1)+vi[G],u+=me}var Ae=m[Mn(c,u)&te],Pe=Ae>>4;Ae||Ne(3),u+=Ae&15;var ee=Wr[Pe];if(Pe>3){var me=pn[Pe];ee+=Mn(c,u)&(1<<me)-1,u+=me}if(u>B){A&&Ne(0);break}a&&l(p+131072);var Oe=p+de;if(p<ee){var wt=i-ee,Qt=Math.min(ee,Oe);for(wt+p<0&&Ne(3);p<Qt;++p)t[p]=s[wt+p]}for(;p<Oe;++p)t[p]=t[p-ee]}}e.l=g,e.p=W,e.b=p,e.f=h,g&&(h=1,e.m=I,e.d=m,e.n=b)}while(!h);return p!=t.length&&o?ns(t,0,p):t.subarray(0,p)},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},Rn=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 a=t[0],A=t[1],l=0,h=1,u=2;for(t[0]={s:-1,f:a.f+A.f,l:a,r:A};h!=n-1;)a=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:a.f+A.f,l:a,r:A};for(var p=i[0].s,s=1;s<n;++s)i[s].s>p&&(p=i[s].s);var g=new qe(p+1),m=Kn(t[h-1],g,0);if(m>e){var s=0,I=0,b=m-e,B=1<<b;for(i.sort(function(R,D){return g[D.s]-g[R.s]||R.f-D.f});s<n;++s){var w=i[s].s;if(g[w]>e)I+=B-(1<<m-g[w]),g[w]=e;else break}for(I>>=b;I>0;){var C=i[s].s;g[C]<e?I-=1<<e-g[C]++-1:++s}for(;s>=0&&I;--s){var y=i[s].s;g[y]==e&&(--g[y],++I)}m=e}return{t:new Qe(g),l:m}},Kn=function(c,e,t){return c.s==-1?Math.max(Kn(c.l,e,t+1),Kn(c.r,e,t+1)):e[c.s]=t},Ms=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},a=1;a<=e;++a)if(c[a]==n&&a!=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[a]}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=ts(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},Rs=function(c,e,t,s,n,i,o,a,A,l,h){at(e,h++,t),++n[256];for(var u=Rn(n,15),p=u.t,g=u.l,m=Rn(i,15),I=m.t,b=m.l,B=Ms(p),w=B.c,C=B.n,y=Ms(I),x=y.c,R=y.n,D=new qe(19),S=0;S<w.length;++S)++D[w[S]&31];for(var S=0;S<x.length;++S)++D[x[S]&31];for(var v=Rn(D,7),U=v.t,G=v.l,H=19;H>4&&!U[zn[H-1]];--H);var X=l+5<<3,N=Ot(n,ft)+Ot(i,Wt)+o,Y=Ot(n,p)+Ot(i,I)+o+14+3*H+Ot(D,U)+2*D[16]+3*D[17]+7*D[18];if(A>=0&&X<=N&&X<=Y)return Ri(e,h,c.subarray(A,A+l));var O,Z,ie,ee;if(at(e,h,1+(Y<N)),h+=2,Y<N){O=it(p,g,0),Z=p,ie=it(I,b,0),ee=I;var ce=it(U,G,0);at(e,h,C-257),at(e,h+5,R-1),at(e,h+10,H-4),h+=14;for(var S=0;S<H;++S)at(e,h+3*S,U[zn[S]]);h+=3*H;for(var te=[w,x],W=0;W<2;++W)for(var se=te[W],S=0;S<se.length;++S){var de=se[S]&31;at(e,h,ce[de]),h+=U[de],de>15&&(at(e,h,se[S]>>5&127),h+=se[S]>>12)}}else O=Xr,Z=ft,ie=$r,ee=Wt;for(var S=0;S<a;++S){var me=s[S];if(me>255){var de=me>>18&31;Pt(e,h,O[de+257]),h+=Z[de+257],de>7&&(at(e,h,me>>23&31),h+=dn[de]);var Ae=me&31;Pt(e,h,ie[Ae]),h+=ee[Ae],Ae>3&&(Pt(e,h,me>>5&8191),h+=pn[Ae])}else Pt(e,h,O[me]),h+=Z[me]}return Pt(e,h,O[256]),h+Z[256]},sa=new es([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Di=new Qe(0),ia=function(c,e,t,s,n,i){var o=i.z||c.length,a=new Qe(s+o+5*(1+Math.ceil(o/7e3))+n),A=a.subarray(s,a.length-n),l=i.l,h=(i.r||0)&7;if(e){h&&(A[0]=i.r>>3);for(var u=sa[e-1],p=u>>13,g=u&8191,m=(1<<t)-1,I=i.p||new qe(32768),b=i.h||new qe(m+1),B=Math.ceil(t/3),w=2*B,C=function(xt){return(c[xt]^c[xt+1]<<B^c[xt+2]<<w)&m},y=new es(25e3),x=new qe(288),R=new qe(32),D=0,S=0,v=i.i||0,U=0,G=i.w||0,H=0;v+2<o;++v){var X=C(v),N=v&32767,Y=b[X];if(I[N]=Y,b[X]=N,G<=v){var O=o-v;if((D>7e3||U>24576)&&(O>423||!l)){h=Rs(c,A,0,y,x,R,S,U,H,v-H,h),U=D=S=0,H=v;for(var Z=0;Z<286;++Z)x[Z]=0;for(var Z=0;Z<30;++Z)R[Z]=0}var ie=2,ee=0,ce=g,te=N-Y&32767;if(O>2&&X==C(v-te))for(var W=Math.min(p,O)-1,se=Math.min(32767,v),de=Math.min(258,O);te<=se&&--ce&&N!=Y;){if(c[v+ie]==c[v+ie-te]){for(var me=0;me<de&&c[v+me]==c[v+me-te];++me);if(me>ie){if(ie=me,ee=te,me>W)break;for(var Ae=Math.min(te,me-2),Pe=0,Z=0;Z<Ae;++Z){var Oe=v-te+Z&32767,wt=I[Oe],Qt=Oe-wt&32767;Qt>Pe&&(Pe=Qt,Y=Oe)}}}N=Y,Y=I[N],te+=N-Y&32767}if(ee){y[U++]=268435456|Yn[ie]<<18|vs[ee];var lt=Yn[ie]&31,mt=vs[ee]&31;S+=dn[lt]+pn[mt],++x[257+lt],++R[mt],G=v+ie,++D}else y[U++]=c[v],++x[c[v]]}}for(v=Math.max(v,G);v<o;++v)y[U++]=c[v],++x[c[v]];h=Rs(c,A,l,y,x,R,S,U,H,v-H,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 ot=v+65535;ot>=o&&(A[h/8|0]=l,ot=o),h=Ri(A,h+1,c.subarray(v,ot))}i.i=o}return ns(a,0,s+ts(h)+n)},oa=(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})(),ra=function(){var c=-1;return{p:function(e){for(var t=c,s=0;s<e.length;++s)t=oa[t&255^e[s]]^t>>>8;c=t},d:function(){return~c}}},aa=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 ia(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},Aa=function(c,e){return((c[0]&15)!=8||c[0]>>4>7||(c[0]<<8|c[1])%31)&&Ne(6,"invalid zlib data"),(c[1]>>5&1)==1&&Ne(6,"invalid zlib data: "+(c[1]&32?"need":"unexpected")+" dictionary"),(c[1]>>3&4)+2};function ca(c,e){return aa(c,e||{},0,0)}function Vt(c,e){return na(c.subarray(Aa(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,a=s;Array.isArray(i)&&(a=_i(s,i[1]),i=i[0]),i instanceof Qe?t[o]=[i,a]:(t[o+="/"]=[new Qe(0),a],Fi(i,o,t,s))}},Ds=typeof TextEncoder<"u"&&new TextEncoder,la=typeof TextDecoder<"u"&&new TextDecoder,ha=0;try{la.decode(Di,{stream:!0}),ha=1}catch{}function Jn(c,e){var t;if(Ds)return Ds.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 a=new Qe(i+8+(s-t<<1));a.set(n),n=a}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 ns(n,0,i)}var Wn=function(c){var e=0;if(c)for(var t in c){var s=c[t].length;s>65535&&Ne(9),e+=s+4}return e},_s=function(c,e,t,s,n,i,o,a){var A=s.length,l=t.extra,h=a&&a.length,u=Wn(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 p=new Date(t.mtime==null?Date.now():t.mtime),g=p.getFullYear()-1980;if((g<0||g>119)&&Ne(10),Re(c,e,g<<25|p.getMonth()+1<<21|p.getDate()<<16|p.getHours()<<11|p.getMinutes()<<5|p.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 m in l){var I=l[m],b=I.length;Re(c,e,+m),Re(c,e+2,b),c.set(I,e+4),e+=4+b}return h&&(c.set(a,e),e+=h),e},ua=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 da(c,e){e||(e={});var t={},s=[];Fi(c,"",t,e);var n=0,i=0;for(var o in t){var a=t[o],A=a[0],l=a[1],h=l.level==0?0:8,u=Jn(o),p=u.length,g=l.comment,m=g&&Jn(g),I=m&&m.length,b=Wn(l.extra);p>65535&&Ne(11);var B=h?ca(A,l):A,w=B.length,C=ra();C.p(A),s.push(_i(l,{size:A.length,crc:C.d(),c:B,f:u,m,u:p!=o.length||m&&g.length!=I,o:n,compression:h})),n+=30+p+b+w,i+=76+2*(p+b)+(I||0)+w}for(var y=new Qe(i+22),x=n,R=i-n,D=0;D<s.length;++D){var u=s[D];_s(y,u.o,u,u.f,u.u,u.c.length);var S=30+u.f.length+Wn(u.extra);y.set(u.c,u.o+S),_s(y,n,u,u.f,u.u,u.c.length,u.o,u.m),n+=16+S+(u.m?u.m.length:0)}return ua(y,n,s.length,R,x),y}class Li extends r.DataTextureLoader{constructor(e){super(e),this.type=r.HalfFloatType}parse(e){const v=Math.pow(2.7182818,2.2);function U(d,f){let E=0;for(let M=0;M<65536;++M)(M==0||d[M>>3]&1<<(M&7))&&(f[E++]=M);const Q=E-1;for(;E<65536;)f[E++]=0;return Q}function G(d){for(let f=0;f<16384;f++)d[f]={},d[f].len=0,d[f].lit=0,d[f].p=null}const H={l:0,c:0,lc:0};function X(d,f,E,Q,M){for(;E<d;)f=f<<8|As(Q,M),E+=8;E-=d,H.l=f>>E&(1<<d)-1,H.c=f,H.lc=E}const N=new Array(59);function Y(d){for(let E=0;E<=58;++E)N[E]=0;for(let E=0;E<65537;++E)N[d[E]]+=1;let f=0;for(let E=58;E>0;--E){const Q=f+N[E]>>1;N[E]=f,f=Q}for(let E=0;E<65537;++E){const Q=d[E];Q>0&&(d[E]=Q|N[Q]++<<6)}}function O(d,f,E,Q,M,T){const L=f;let P=0,k=0;for(;Q<=M;Q++){if(L.value-f.value>E)return!1;X(6,P,k,d,L);const F=H.l;if(P=H.c,k=H.lc,T[Q]=F,F==63){if(L.value-f.value>E)throw new Error("Something wrong with hufUnpackEncTable");X(8,P,k,d,L);let _=H.l+6;if(P=H.c,k=H.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--}}Y(T)}function Z(d){return d&63}function ie(d){return d>>6}function ee(d,f,E,Q){for(;f<=E;f++){const M=ie(d[f]),T=Z(d[f]);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]=f}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=f,L++}}}return!0}const ce={c:0,lc:0};function te(d,f,E,Q){d=d<<8|As(E,Q),f+=8,ce.c=d,ce.lc=f}const W={c:0,lc:0};function se(d,f,E,Q,M,T,L,P,k){if(d==f){Q<8&&(te(E,Q,M,T),E=ce.c,Q=ce.lc),Q-=8;let F=E>>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;W.c=E,W.lc=Q}function de(d){return d&65535}function me(d){const f=de(d);return f>32767?f-65536:f}const Ae={a:0,b:0};function Pe(d,f){const E=me(d),M=me(f),T=E+(M&1)+(M>>1),L=T,P=T-M;Ae.a=L,Ae.b=P}function Oe(d,f){const E=de(d),Q=de(f),M=E-(Q>>1)&65535,T=Q+M-32768&65535;Ae.a=T,Ae.b=M}function wt(d,f,E,Q,M,T,L){const P=L<16384,k=E>M?M:E;let F=1,_,j;for(;F<=k;)F<<=1;for(F>>=1,_=F,F>>=1;F>=1;){j=0;const K=j+T*(M-_),q=T*F,$=T*_,z=Q*F,J=Q*_;let ne,pe,Be,je;for(;j<=K;j+=$){let Ie=j;const le=j+Q*(E-_);for(;Ie<=le;Ie+=J){const xe=Ie+z,Ke=Ie+q,Te=Ke+z;P?(Pe(d[Ie+f],d[Ke+f]),ne=Ae.a,Be=Ae.b,Pe(d[xe+f],d[Te+f]),pe=Ae.a,je=Ae.b,Pe(ne,pe),d[Ie+f]=Ae.a,d[xe+f]=Ae.b,Pe(Be,je),d[Ke+f]=Ae.a,d[Te+f]=Ae.b):(Oe(d[Ie+f],d[Ke+f]),ne=Ae.a,Be=Ae.b,Oe(d[xe+f],d[Te+f]),pe=Ae.a,je=Ae.b,Oe(ne,pe),d[Ie+f]=Ae.a,d[xe+f]=Ae.b,Oe(Be,je),d[Ke+f]=Ae.a,d[Te+f]=Ae.b)}if(E&F){const xe=Ie+q;P?Pe(d[Ie+f],d[xe+f]):Oe(d[Ie+f],d[xe+f]),ne=Ae.a,d[xe+f]=Ae.b,d[Ie+f]=ne}}if(M&F){let Ie=j;const le=j+Q*(E-_);for(;Ie<=le;Ie+=J){const xe=Ie+z;P?Pe(d[Ie+f],d[xe+f]):Oe(d[Ie+f],d[xe+f]),ne=Ae.a,d[xe+f]=Ae.b,d[Ie+f]=ne}}_=F,F>>=1}return j}function Qt(d,f,E,Q,M,T,L,P,k){let F=0,_=0;const j=L,K=Math.trunc(Q.value+(M+7)/8);for(;Q.value<K;)for(te(F,_,E,Q),F=ce.c,_=ce.lc;_>=14;){const $=F>>_-14&16383,z=f[$];if(z.len)_-=z.len,se(z.lit,T,F,_,E,Q,P,k,j),F=W.c,_=W.lc;else{if(!z.p)throw new Error("hufDecode issues");let J;for(J=0;J<z.lit;J++){const ne=Z(d[z.p[J]]);for(;_<ne&&Q.value<K;)te(F,_,E,Q),F=ce.c,_=ce.lc;if(_>=ne&&ie(d[z.p[J]])==(F>>_-ne&(1<<ne)-1)){_-=ne,se(z.p[J],T,F,_,E,Q,P,k,j),F=W.c,_=W.lc;break}}if(J==z.lit)throw new Error("hufDecode issues")}}const q=8-M&7;for(F>>=q,_-=q;_>0;){const $=f[F<<14-_&16383];if($.len)_-=$.len,se($.lit,T,F,_,E,Q,P,k,j),F=W.c,_=W.lc;else throw new Error("hufDecode issues")}return!0}function lt(d,f,E,Q,M,T){const L={value:0},P=E.value,k=Ve(f,E),F=Ve(f,E);E.value+=4;const _=Ve(f,E);if(E.value+=4,k<0||k>=65537||F<0||F>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const j=new Array(65537),K=new Array(16384);G(K);const q=Q-(E.value-P);if(O(d,E,q,k,F,j),_>8*(Q-(E.value-P)))throw new Error("Something wrong with hufUncompress");ee(j,k,F,K),Qt(j,K,d,E,_,F,T,M,L)}function mt(d,f,E){for(let Q=0;Q<E;++Q)f[Q]=d[f[Q]]}function ot(d){for(let f=1;f<d.length;f++){const E=d[f-1]+d[f]-128;d[f]=E}}function xt(d,f){let E=0,Q=Math.floor((d.length+1)/2),M=0;const T=d.length-1;for(;!(M>T||(f[M++]=d[E++],M>T));)f[M++]=d[Q++]}function rs(d){let f=d.byteLength;const E=new Array;let Q=0;const M=new DataView(d);for(;f>0;){const T=M.getInt8(Q++);if(T<0){const L=-T;f-=L+1;for(let P=0;P<L;P++)E.push(M.getUint8(Q++))}else{const L=T;f-=2;const P=M.getUint8(Q++);for(let k=0;k<L+1;k++)E.push(P)}}return E}function Yi(d,f,E,Q,M,T){let L=new DataView(T.buffer);const P=E[d.idx[0]].width,k=E[d.idx[0]].height,F=3,_=Math.floor(P/8),j=Math.ceil(P/8),K=Math.ceil(k/8),q=P-(j-1)*8,$=k-(K-1)*8,z={value:0},J=new Array(F),ne=new Array(F),pe=new Array(F),Be=new Array(F),je=new Array(F);for(let le=0;le<F;++le)je[le]=f[d.idx[le]],J[le]=le<1?0:J[le-1]+j*K,ne[le]=new Float32Array(64),pe[le]=new Uint16Array(64),Be[le]=new Uint16Array(j*64);for(let le=0;le<K;++le){let xe=8;le==K-1&&(xe=$);let Ke=8;for(let ue=0;ue<j;++ue){ue==j-1&&(Ke=q);for(let fe=0;fe<F;++fe)pe[fe].fill(0),pe[fe][0]=M[J[fe]++],Vi(z,Q,pe[fe]),Ki(pe[fe],ne[fe]),Ji(ne[fe]);Wi(ne);for(let fe=0;fe<F;++fe)Xi(ne[fe],Be[fe],ue*64)}let Te=0;for(let ue=0;ue<F;++ue){const fe=E[d.idx[ue]].type;for(let rt=8*le;rt<8*le+xe;++rt){Te=je[ue][rt];for(let _t=0;_t<_;++_t){const $e=_t*64+(rt&7)*8;L.setUint16(Te+0*fe,Be[ue][$e+0],!0),L.setUint16(Te+2*fe,Be[ue][$e+1],!0),L.setUint16(Te+4*fe,Be[ue][$e+2],!0),L.setUint16(Te+6*fe,Be[ue][$e+3],!0),L.setUint16(Te+8*fe,Be[ue][$e+4],!0),L.setUint16(Te+10*fe,Be[ue][$e+5],!0),L.setUint16(Te+12*fe,Be[ue][$e+6],!0),L.setUint16(Te+14*fe,Be[ue][$e+7],!0),Te+=16*fe}}if(_!=j)for(let rt=8*le;rt<8*le+xe;++rt){const _t=je[ue][rt]+8*_*2*fe,$e=_*64+(rt&7)*8;for(let $t=0;$t<Ke;++$t)L.setUint16(_t+$t*2*fe,Be[ue][$e+$t],!0)}}}const Ie=new Uint16Array(P);L=new DataView(T.buffer);for(let le=0;le<F;++le){E[d.idx[le]].decoded=!0;const xe=E[d.idx[le]].type;if(E[le].type==2)for(let Ke=0;Ke<k;++Ke){const Te=je[le][Ke];for(let ue=0;ue<P;++ue)Ie[ue]=L.getUint16(Te+ue*2*xe,!0);for(let ue=0;ue<P;++ue)L.setFloat32(Te+ue*2*xe,V(Ie[ue]),!0)}}}function Vi(d,f,E){let Q,M=1;for(;M<64;)Q=f[d.value],Q==65280?M=64:Q>>8==255?M+=Q&255:(E[M]=Q,M++),d.value++}function Ki(d,f){f[0]=V(d[0]),f[1]=V(d[1]),f[2]=V(d[5]),f[3]=V(d[6]),f[4]=V(d[14]),f[5]=V(d[15]),f[6]=V(d[27]),f[7]=V(d[28]),f[8]=V(d[2]),f[9]=V(d[4]),f[10]=V(d[7]),f[11]=V(d[13]),f[12]=V(d[16]),f[13]=V(d[26]),f[14]=V(d[29]),f[15]=V(d[42]),f[16]=V(d[3]),f[17]=V(d[8]),f[18]=V(d[12]),f[19]=V(d[17]),f[20]=V(d[25]),f[21]=V(d[30]),f[22]=V(d[41]),f[23]=V(d[43]),f[24]=V(d[9]),f[25]=V(d[11]),f[26]=V(d[18]),f[27]=V(d[24]),f[28]=V(d[31]),f[29]=V(d[40]),f[30]=V(d[44]),f[31]=V(d[53]),f[32]=V(d[10]),f[33]=V(d[19]),f[34]=V(d[23]),f[35]=V(d[32]),f[36]=V(d[39]),f[37]=V(d[45]),f[38]=V(d[52]),f[39]=V(d[54]),f[40]=V(d[20]),f[41]=V(d[22]),f[42]=V(d[33]),f[43]=V(d[38]),f[44]=V(d[46]),f[45]=V(d[51]),f[46]=V(d[55]),f[47]=V(d[60]),f[48]=V(d[21]),f[49]=V(d[34]),f[50]=V(d[37]),f[51]=V(d[47]),f[52]=V(d[50]),f[53]=V(d[56]),f[54]=V(d[59]),f[55]=V(d[61]),f[56]=V(d[35]),f[57]=V(d[36]),f[58]=V(d[48]),f[59]=V(d[49]),f[60]=V(d[57]),f[61]=V(d[58]),f[62]=V(d[62]),f[63]=V(d[63])}function Ji(d){const f=.5*Math.cos(.7853975),E=.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 K=0;K<8;++K){const q=K*8;k[0]=Q*d[q+2],k[1]=L*d[q+2],k[2]=Q*d[q+6],k[3]=L*d[q+6],F[0]=E*d[q+1]+M*d[q+3]+T*d[q+5]+P*d[q+7],F[1]=M*d[q+1]-P*d[q+3]-E*d[q+5]-T*d[q+7],F[2]=T*d[q+1]-E*d[q+3]+P*d[q+5]+M*d[q+7],F[3]=P*d[q+1]-T*d[q+3]+M*d[q+5]-E*d[q+7],_[0]=f*(d[q+0]+d[q+4]),_[3]=f*(d[q+0]-d[q+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[q+0]=j[0]+F[0],d[q+1]=j[1]+F[1],d[q+2]=j[2]+F[2],d[q+3]=j[3]+F[3],d[q+4]=j[3]-F[3],d[q+5]=j[2]-F[2],d[q+6]=j[1]-F[1],d[q+7]=j[0]-F[0]}for(let K=0;K<8;++K)k[0]=Q*d[16+K],k[1]=L*d[16+K],k[2]=Q*d[48+K],k[3]=L*d[48+K],F[0]=E*d[8+K]+M*d[24+K]+T*d[40+K]+P*d[56+K],F[1]=M*d[8+K]-P*d[24+K]-E*d[40+K]-T*d[56+K],F[2]=T*d[8+K]-E*d[24+K]+P*d[40+K]+M*d[56+K],F[3]=P*d[8+K]-T*d[24+K]+M*d[40+K]-E*d[56+K],_[0]=f*(d[K]+d[32+K]),_[3]=f*(d[K]-d[32+K]),_[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+K]=j[0]+F[0],d[8+K]=j[1]+F[1],d[16+K]=j[2]+F[2],d[24+K]=j[3]+F[3],d[32+K]=j[3]-F[3],d[40+K]=j[2]-F[2],d[48+K]=j[1]-F[1],d[56+K]=j[0]-F[0]}function Wi(d){for(let f=0;f<64;++f){const E=d[0][f],Q=d[1][f],M=d[2][f];d[0][f]=E+1.5747*M,d[1][f]=E-.1873*Q-.4682*M,d[2][f]=E+1.8556*Q}}function Xi(d,f,E){for(let Q=0;Q<64;++Q)f[E+Q]=r.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 gn(d){return new DataView(d.array.buffer,d.offset.value,d.size)}function $i(d){const f=d.viewer.buffer.slice(d.offset.value,d.offset.value+d.size),E=new Uint8Array(rs(f)),Q=new Uint8Array(E.length);return ot(E),xt(E,Q),new DataView(Q.buffer)}function fn(d){const f=d.array.slice(d.offset.value,d.offset.value+d.size),E=Vt(f),Q=new Uint8Array(E.length);return ot(E),xt(E,Q),new DataView(Q.buffer)}function eo(d){const f=d.viewer,E={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 $=0,z=d.inputChannels.length;$<z;$++)L[$]={},L[$].start=T,L[$].end=L[$].start,L[$].nx=d.columns,L[$].ny=d.lines,L[$].size=d.type,T+=L[$].nx*L[$].ny*L[$].size;const P=Dt(f,E),k=Dt(f,E);if(k>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(P<=k)for(let $=0;$<k-P+1;$++)M[$+P]=ht(f,E);const F=new Uint16Array(65536),_=U(M,F),j=Ve(f,E);lt(d.array,f,E,j,Q,T);for(let $=0;$<d.inputChannels.length;++$){const z=L[$];for(let J=0;J<L[$].size;++J)wt(Q,z.start+J,z.nx,z.size,z.ny,z.nx*z.size,_)}mt(F,Q,T);let K=0;const q=new Uint8Array(Q.buffer.byteLength);for(let $=0;$<d.lines;$++)for(let z=0;z<d.inputChannels.length;z++){const J=L[z],ne=J.nx*J.size,pe=new Uint8Array(Q.buffer,J.end*2,ne*2);q.set(pe,K),K+=ne*2,J.end+=ne}return new DataView(q.buffer)}function to(d){const f=d.array.slice(d.offset.value,d.offset.value+d.size),E=Vt(f),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 q=0;q<d.columns;++q){const $=E[k[0]++]<<8|E[k[1]++];j+=$,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 q=0;q<d.columns;++q){const $=E[k[0]++]<<24|E[k[1]++]<<16|E[k[2]++]<<8;j+=$,T.setUint32(P,j,!0),P+=4}break}}return T}function as(d){const f=d.viewer,E={value:d.offset.value},Q=new Uint8Array(d.columns*d.lines*(d.inputChannels.length*d.type*2)),M={version:He(f,E),unknownUncompressedSize:He(f,E),unknownCompressedSize:He(f,E),acCompressedSize:He(f,E),dcCompressedSize:He(f,E),rleCompressedSize:He(f,E),rleUncompressedSize:He(f,E),rleRawSize:He(f,E),totalAcUncompressedCount:He(f,E),totalDcUncompressedCount:He(f,E),acCompression:He(f,E)};if(M.version<2)throw new Error("EXRLoader.parse: "+It.compression+" version "+M.version+" is unsupported");const T=new Array;let L=Dt(f,E)-2;for(;L>0;){const z=Zt(f.buffer,E),J=ht(f,E),ne=J>>2&3,pe=(J>>4)-1,Be=new Int8Array([pe])[0],je=ht(f,E);T.push({name:z,index:Be,type:je,compression:ne}),L-=z.length+3}const P=It.channels,k=new Array(d.inputChannels.length);for(let z=0;z<d.inputChannels.length;++z){const J=k[z]={},ne=P[z];J.name=ne.name,J.compression=0,J.decoded=!1,J.type=ne.pixelType,J.pLinear=ne.pLinear,J.width=d.columns,J.height=d.lines}const F={idx:new Array(3)};for(let z=0;z<d.inputChannels.length;++z){const J=k[z];for(let ne=0;ne<T.length;++ne){const pe=T[ne];J.name==pe.name&&(J.compression=pe.compression,pe.index>=0&&(F.idx[pe.index]=z),J.offset=z)}}let _,j,K;if(M.acCompressedSize>0)switch(M.acCompression){case 0:_=new Uint16Array(M.totalAcUncompressedCount),lt(d.array,f,E,M.acCompressedSize,_,M.totalAcUncompressedCount);break;case 1:const z=d.array.slice(E.value,E.value+M.totalAcUncompressedCount),J=Vt(z);_=new Uint16Array(J.buffer),E.value+=M.totalAcUncompressedCount;break}if(M.dcCompressedSize>0){const z={array:d.array,offset:E,size:M.dcCompressedSize};j=new Uint16Array(fn(z).buffer),E.value+=M.dcCompressedSize}if(M.rleRawSize>0){const z=d.array.slice(E.value,E.value+M.rleCompressedSize),J=Vt(z);K=rs(J.buffer),E.value+=M.rleCompressedSize}let q=0;const $=new Array(k.length);for(let z=0;z<$.length;++z)$[z]=new Array;for(let z=0;z<d.lines;++z)for(let J=0;J<k.length;++J)$[J].push(q),q+=k[J].width*d.type*2;Yi(F,$,k,_,j,Q);for(let z=0;z<k.length;++z){const J=k[z];if(!J.decoded)switch(J.compression){case 2:let ne=0,pe=0;for(let Be=0;Be<d.lines;++Be){let je=$[z][ne];for(let Ie=0;Ie<J.width;++Ie){for(let le=0;le<2*J.type;++le)Q[je++]=K[pe+le*J.width*J.height];pe++}ne++}break;default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(Q.buffer)}function Zt(d,f){const E=new Uint8Array(d);let Q=0;for(;E[f.value+Q]!=0;)Q+=1;const M=new TextDecoder().decode(E.slice(f.value,f.value+Q));return f.value=f.value+Q+1,M}function no(d,f,E){const Q=new TextDecoder().decode(new Uint8Array(d).slice(f.value,f.value+E));return f.value=f.value+E,Q}function so(d,f){const E=Ye(d,f),Q=Ve(d,f);return[E,Q]}function io(d,f){const E=Ve(d,f),Q=Ve(d,f);return[E,Q]}function Ye(d,f){const E=d.getInt32(f.value,!0);return f.value=f.value+4,E}function Ve(d,f){const E=d.getUint32(f.value,!0);return f.value=f.value+4,E}function As(d,f){const E=d[f.value];return f.value=f.value+1,E}function ht(d,f){const E=d.getUint8(f.value);return f.value=f.value+1,E}const He=function(d,f){let E;return"getBigInt64"in DataView.prototype?E=Number(d.getBigInt64(f.value,!0)):E=d.getUint32(f.value+4,!0)+Number(d.getUint32(f.value,!0)<<32),f.value+=8,E};function _e(d,f){const E=d.getFloat32(f.value,!0);return f.value+=4,E}function oo(d,f){return r.DataUtils.toHalfFloat(_e(d,f))}function V(d){const f=(d&31744)>>10,E=d&1023;return(d>>15?-1:1)*(f?f===31?E?NaN:1/0:Math.pow(2,f-15)*(1+E/1024):6103515625e-14*(E/1024))}function Dt(d,f){const E=d.getUint16(f.value,!0);return f.value+=2,E}function ro(d,f){return V(Dt(d,f))}function ao(d,f,E,Q){const M=E.value,T=[];for(;E.value<M+Q-1;){const L=Zt(f,E),P=Ye(d,E),k=ht(d,E);E.value+=3;const F=Ye(d,E),_=Ye(d,E);T.push({name:L,pixelType:P,pLinear:k,xSampling:F,ySampling:_})}return E.value+=1,T}function Ao(d,f){const E=_e(d,f),Q=_e(d,f),M=_e(d,f),T=_e(d,f),L=_e(d,f),P=_e(d,f),k=_e(d,f),F=_e(d,f);return{redX:E,redY:Q,greenX:M,greenY:T,blueX:L,blueY:P,whiteX:k,whiteY:F}}function co(d,f){const E=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],Q=ht(d,f);return E[Q]}function lo(d,f){const E=Ye(d,f),Q=Ye(d,f),M=Ye(d,f),T=Ye(d,f);return{xMin:E,yMin:Q,xMax:M,yMax:T}}function ho(d,f){const E=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],Q=ht(d,f);return E[Q]}function uo(d,f){const E=["ENVMAP_LATLONG","ENVMAP_CUBE"],Q=ht(d,f);return E[Q]}function po(d,f){const E=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],Q=["ROUND_DOWN","ROUND_UP"],M=Ve(d,f),T=Ve(d,f),L=ht(d,f);return{xSize:M,ySize:T,levelMode:E[L&15],roundingMode:Q[L>>4]}}function go(d,f){const E=_e(d,f),Q=_e(d,f);return[E,Q]}function fo(d,f){const E=_e(d,f),Q=_e(d,f),M=_e(d,f);return[E,Q,M]}function mo(d,f,E,Q,M){if(Q==="string"||Q==="stringvector"||Q==="iccProfile")return no(f,E,M);if(Q==="chlist")return ao(d,f,E,M);if(Q==="chromaticities")return Ao(d,E);if(Q==="compression")return co(d,E);if(Q==="box2i")return lo(d,E);if(Q==="envmap")return uo(d,E);if(Q==="tiledesc")return po(d,E);if(Q==="lineOrder")return ho(d,E);if(Q==="float")return _e(d,E);if(Q==="v2f")return go(d,E);if(Q==="v3f")return fo(d,E);if(Q==="int")return Ye(d,E);if(Q==="rational")return so(d,E);if(Q==="timecode")return io(d,E);if(Q==="preview")return E.value+=M,"skipped";E.value+=M}function Io(d,f){const E=Math.log2(d);return f=="ROUND_DOWN"?Math.floor(E):Math.ceil(E)}function bo(d,f,E){let Q=0;switch(d.levelMode){case"ONE_LEVEL":Q=1;break;case"MIPMAP_LEVELS":Q=Io(Math.max(f,E),d.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return Q}function cs(d,f,E,Q){const M=new Array(d);for(let T=0;T<d;T++){const L=1<<T;let P=f/L|0;Q=="ROUND_UP"&&P*L<f&&(P+=1);const k=Math.max(P,1);M[T]=(k+E-1)/E|0}return M}function Eo(){const d=this,f=d.offset,E={value:0};for(let Q=0;Q<d.tileCount;Q++){const M=Ye(d.viewer,f),T=Ye(d.viewer,f);f.value+=8,d.size=Ve(d.viewer,f);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):gn(d);f.value+=d.size;for(let j=0;j<d.lines;j++){const K=j*d.columns*d.totalBytes;for(let q=0;q<d.inputChannels.length;q++){const $=It.channels[q].name,z=d.channelByteOffsets[$]*d.columns,J=d.decodeChannels[$];if(J===void 0)continue;E.value=K+z;const ne=(d.height-(1+P+j))*d.outLineWidth;for(let pe=0;pe<d.columns;pe++){const Be=ne+(pe+L)*d.outputChannels+J;d.byteArray[Be]=d.getter(_,E)}}}}}function Co(){const d=this,f=d.offset,E={value:0};for(let Q=0;Q<d.height/d.blockHeight;Q++){const M=Ye(d.viewer,f)-It.dataWindow.yMin;d.size=Ve(d.viewer,f),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):gn(d);f.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,K=(d.height-1-_)*d.outLineWidth;for(let q=0;q<d.inputChannels.length;q++){const $=It.channels[q].name,z=d.channelByteOffsets[$]*d.columns,J=d.decodeChannels[$];if(J!==void 0){E.value=j+z;for(let ne=0;ne<d.columns;ne++){const pe=K+ne*d.outputChannels+J;d.byteArray[pe]=d.getter(P,E)}}}}}}function Bo(d,f,E){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)},E.value=8;let T=!0;for(;T;){const L=Zt(f,E);if(L==0)T=!1;else{const P=Zt(f,E),k=Ve(d,E),F=mo(d,f,E,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,f,E,Q,M){const T={size:0,viewer:f,array:E,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:r.LinearSRGBColorSpace};switch(d.compression){case"NO_COMPRESSION":T.blockHeight=1,T.uncompress=gn;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 r.FloatType:T.getter=ro;break;case r.HalfFloatType:T.getter=Dt;break}else if(T.type==2)switch(M){case r.FloatType:T.getter=_e;break;case r.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 r.FloatType:T.byteArray=new Float32Array(k),P&&T.byteArray.fill(1,0,k);break;case r.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=r.RGBAFormat,T.colorSpace=r.LinearSRGBColorSpace):(T.format=r.RedFormat,T.colorSpace=r.NoColorSpace),d.spec.singleTile){T.blockHeight=d.tiles.ySize,T.blockWidth=d.tiles.xSize;const _=bo(d.tiles,T.width,T.height),j=cs(_,T.width,d.tiles.xSize,d.tiles.roundingMode),K=cs(_,T.height,d.tiles.ySize,d.tiles.roundingMode);T.tileCount=j[0]*K[0];for(let q=0;q<_;q++)for(let $=0;$<K[q];$++)for(let z=0;z<j[q];z++)He(f,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(f,Q);T.decode=Co.bind(T)}return T}const ls={value:0},hs=new DataView(e),wo=new Uint8Array(e),It=Bo(hs,e,ls),St=yo(It,hs,wo,ls,this.type);return St.decode(),{header:It,width:St.width,height:St.height,data:St.byteArray,format:St.format,colorSpace:St.colorSpace,type:this.type}}setDataType(e){return this.type=e,this}load(e,t,s,n){function i(o,a){o.colorSpace=a.colorSpace,o.minFilter=r.LinearFilter,o.magFilter=r.LinearFilter,o.generateMipmaps=!1,o.flipY=!1,t&&t(o,a)}return super.load(e,i,s,n)}}const pa=Object.freeze(Object.defineProperty({__proto__:null,EXRLoader:Li},Symbol.toStringTag,{value:"Module"}));class ki extends r.DataTextureLoader{constructor(e){super(e),this.type=r.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,U){v=v||1024;let H=S.pos,X=-1,N=0,Y="",O=String.fromCharCode.apply(null,new Uint16Array(S.subarray(H,H+128)));for(;0>(X=O.indexOf(`
37
37
  `))&&N<v&&H<S.byteLength;)Y+=O,N+=O.length,H+=128,O+=String.fromCharCode.apply(null,new Uint16Array(S.subarray(H,H+128)));return-1<X?(S.pos+=N+X+1,Y+O.slice(0,X)):!1},p=function(S){const v=/^#\?(\S+)/,U=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,G=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,H=/^\s*FORMAT=(\S+)\s*$/,X=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,N={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let Y,O;for((S.pos>=S.byteLength||!(Y=u(S)))&&o(1,"no header found"),(O=Y.match(v))||o(3,"bad initial token"),N.valid|=1,N.programtype=O[1],N.string+=Y+`
38
38
  `;Y=u(S),Y!==!1;){if(N.string+=Y+`
39
39
  `,Y.charAt(0)==="#"){N.comments+=Y+`
40
- `;continue}if((O=Y.match(U))&&(N.gamma=parseFloat(O[1])),(O=Y.match(G))&&(N.exposure=parseFloat(O[1])),(O=Y.match(H))&&(N.valid|=2,N.format=O[1]),(O=Y.match(X))&&(N.valid|=4,N.height=parseInt(O[1],10),N.width=parseInt(O[2],10)),N.valid&2&&N.valid&4)break}return N.valid&2||o(3,"missing format specifier"),N.valid&4||o(3,"missing image size specifier"),N},g=function(S,v,U){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 H=new Uint8Array(4*v*U);H.length||o(4,"unable to allocate buffer space");let X=0,N=0;const Y=4*G,O=new Uint8Array(4),Z=new Uint8Array(Y);let ie=U;for(;ie>0&&N<S.byteLength;){N+4>S.byteLength&&o(1),O[0]=S[N++],O[1]=S[N++],O[2]=S[N++],O[3]=S[N++],(O[0]!=2||O[1]!=2||(O[2]<<8|O[3])!=G)&&o(3,"bad rgbe scanline format");let ee=0,ce;for(;ee<Y&&N<S.byteLength;){ce=S[N++];const W=ce>128;if(W&&(ce-=128),(ce===0||ee+ce>Y)&&o(3,"bad scanline data"),W){const se=S[N++];for(let de=0;de<ce;de++)Z[ee++]=se}else Z.set(S.subarray(N,N+ce),ee),ee+=ce,N+=ce}const te=G;for(let W=0;W<te;W++){let se=0;H[X]=Z[W+se],se+=G,H[X+1]=Z[W+se],se+=G,H[X+2]=Z[W+se],se+=G,H[X+3]=Z[W+se],X+=4}ie--}return H},m=function(S,v,U,G){const H=S[v+3],X=Math.pow(2,H-128)/255;U[G+0]=S[v+0]*X,U[G+1]=S[v+1]*X,U[G+2]=S[v+2]*X,U[G+3]=1},I=function(S,v,U,G){const H=S[v+3],X=Math.pow(2,H-128)/255;U[G+0]=r.DataUtils.toHalfFloat(Math.min(S[v+0]*X,65504)),U[G+1]=r.DataUtils.toHalfFloat(Math.min(S[v+1]*X,65504)),U[G+2]=r.DataUtils.toHalfFloat(Math.min(S[v+2]*X,65504)),U[G+3]=r.DataUtils.toHalfFloat(1)},b=new Uint8Array(e);b.pos=0;const B=p(b),w=B.width,C=B.height,y=g(b.subarray(b.pos),w,C);let x,R,D;switch(this.type){case r.FloatType:D=y.length/4;const S=new Float32Array(D*4);for(let U=0;U<D;U++)m(y,U*4,S,U*4);x=S,R=r.FloatType;break;case r.HalfFloatType:D=y.length/4;const v=new Uint16Array(D*4);for(let U=0;U<D;U++)I(y,U*4,v,U*4);x=v,R=r.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:w,height:C,data:x,header:B.string,gamma:B.gamma,exposure:B.exposure,type:R}}setDataType(e){return this.type=e,this}load(e,t,s,n){function i(o,a){switch(o.type){case r.FloatType:case r.HalfFloatType:o.colorSpace=r.LinearSRGBColorSpace,o.minFilter=r.LinearFilter,o.magFilter=r.LinearFilter,o.generateMipmaps=!1,o.flipY=!0;break}t&&t(o,a)}return super.load(e,i,s,n)}}const ga=Object.freeze(Object.defineProperty({__proto__:null,RGBELoader:ki},Symbol.toStringTag,{value:"Module"}));function Gi(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 fa(c,e,t,s){const n=[],i=[],o=[];n[0]=1;for(let a=1;a<=t;++a){i[a]=e-s[c+1-a],o[a]=s[c+a]-e;let A=0;for(let l=0;l<a;++l){const h=o[l+1],u=i[a-l],p=n[l]/(h+u);n[l]=A+h*p,A=u*p}n[a]=A}return n}function ma(c,e,t,s){const n=Gi(c,s,e),i=fa(n,s,c,e),o=new r.Vector4(0,0,0,0);for(let a=0;a<=c;++a){const A=t[n-c+a],l=i[a],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 Ia(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 a=[];for(let u=0;u<=t;++u)a[u]=i.slice(0);a[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 p=0;for(let g=0;g<u;++g){const m=l[g+1],I=A[u-g];a[u][g]=m+I;const b=a[g][u-1]/a[u][g];a[g][u]=p+m*b,p=I*b}a[u][u]=p}for(let u=0;u<=t;++u)o[0][u]=a[u][t];for(let u=0;u<=t;++u){let p=0,g=1;const m=[];for(let I=0;I<=t;++I)m[I]=i.slice(0);m[0][0]=1;for(let I=1;I<=s;++I){let b=0;const B=u-I,w=t-I;u>=I&&(m[g][0]=m[p][0]/a[w+1][B],b=m[g][0]*a[B][w]);const C=B>=-1?1:-B,y=u-1<=w?I-1:t-u;for(let R=C;R<=y;++R)m[g][R]=(m[p][R]-m[p][R-1])/a[w+1][B+R],b+=m[g][R]*a[B+R][w];u<=w&&(m[g][I]=-m[p][I-1]/a[w+1][u],b+=m[g][I]*a[u][w]),o[I][u]=b;const x=p;p=g,g=x}}let h=t;for(let u=1;u<=s;++u){for(let p=0;p<=t;++p)o[u][p]*=h;h*=t-u}return o}function ba(c,e,t,s,n){const i=n<c?n:c,o=[],a=Gi(c,s,e),A=Ia(a,s,c,i,e),l=[];for(let h=0;h<t.length;++h){const u=t[h].clone(),p=u.w;u.x*=p,u.y*=p,u.z*=p,l[h]=u}for(let h=0;h<=i;++h){const u=l[a-c].clone().multiplyScalar(A[h][0]);for(let p=1;p<=c;++p)u.add(l[a-c+p].clone().multiplyScalar(A[h][p]));o[h]=u}for(let h=i+1;h<=n+1;++h)o[h]=new r.Vector4(0,0,0);return o}function Ea(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 Ca(c){const e=c.length,t=[],s=[];for(let i=0;i<e;++i){const o=c[i];t[i]=new r.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 a=1;a<=i;++a)o.sub(n[i-a].clone().multiplyScalar(Ea(i,a)*s[a]));n[i]=o.divideScalar(s[0])}return n}function Ba(c,e,t,s,n){const i=ba(c,e,t,s,n);return Ca(i)}class ya extends r.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 a=s[o];this.controlPoints[o]=new r.Vector4(a.x,a.y,a.z,a.w)}}getPoint(e,t=new r.Vector3){const s=t,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=ma(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 r.Vector3){const s=t,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Ba(this.degree,this.knots,this.controlPoints,n,1);return s.copy(i[1]).normalize(),s}}let oe,we,ke;class wa extends r.Loader{constructor(e){super(e)}load(e,t,s,n){const i=this,o=i.path===""?r.LoaderUtils.extractUrlBase(e):i.path,a=new r.FileLoader(this.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.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))oe=new va().parse(e);else{const n=Pi(e);if(!Ra(n))throw new Error("THREE.FBXLoader: Unknown format.");if(Ls(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ls(n));oe=new Ta().parse(n)}const s=new r.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Qa(s,this.manager).parse(oe)}getFbxTree(){return oe}}class Qa{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 xa().parse(n);return this.parseScene(n,i,s),ke}parseConnections(){const e=new Map;return"Connections"in oe&&oe.Connections.connections.forEach(function(s){const n=s[0],i=s[1],o=s[2];e.has(n)||e.set(n,{parents:[],children:[]});const a={ID:i,relationship:o};e.get(n).parents.push(a),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 oe.Objects){const s=oe.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 a=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,A=typeof i.Content=="string"&&i.Content!=="";if(a||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 oe.Objects){const s=oe.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,a=i!==void 0?i.value:0;if(s.wrapS=o===0?r.RepeatWrapping:r.ClampToEdgeWrapping,s.wrapT=a===0?r.RepeatWrapping:r.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 r.Texture;const o=i.path;o||i.setPath(this.textureLoader.path);const a=we.get(e.id).children;let A;a!==void 0&&a.length>0&&t[a[0].ID]!==void 0&&(A=t[a[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 oe.Objects){const s=oe.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 a;switch(i.toLowerCase()){case"phong":a=new r.MeshPhongMaterial;break;case"lambert":a=new r.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),a=new r.MeshPhongMaterial;break}return a.setValues(o),a.name=n,a}parseParameters(e,t,s){const n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.Diffuse.value),r.SRGBColorSpace):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.DiffuseColor.value),r.SRGBColorSpace)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.Emissive.value),r.SRGBColorSpace):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.EmissiveColor.value),r.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=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.Specular.value),r.SRGBColorSpace):e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.SpecularColor.value),r.SRGBColorSpace));const i=this;return we.get(s).children.forEach(function(o){const a=o.relationship;switch(a){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=r.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=r.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=r.EquirectangularReflectionMapping,n.envMap.colorSpace=r.SRGBColorSpace);break;case"SpecularColor":n.specularMap=i.getTexture(t,o.ID),n.specularMap!==void 0&&(n.specularMap.colorSpace=r.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.",a);break}}),n}getTexture(e,t){return"LayeredTexture"in oe.Objects&&t in oe.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 oe.Objects){const s=oe.Objects.Deformer;for(const n in s){const i=s[n],o=we.get(parseInt(n));if(i.attrType==="Skin"){const a=this.parseSkeleton(o,s);a.ID=n,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[n]=a}else if(i.attrType==="BlendShape"){const a={id:n};a.rawTargets=this.parseMorphTargets(o,s),a.id=n,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=a}}}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 r.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],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;a.geoID=we.get(parseInt(i.ID)).children.filter(function(A){return A.relationship===void 0})[0].ID,s.push(a)}return s}parseScene(e,t,s){ke=new r.Group;const n=this.parseModels(e.skeletons,t,s),i=oe.Objects.Model,o=this;n.forEach(function(A){const l=i[A.ID];o.setLookAtProperties(A,l),we.get(A.ID)?.parents?.forEach(function(u){const p=n.get(u.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 a=new Sa().parse();ke.children.length===1&&ke.children[0].isGroup&&(ke.children[0].animations=a,ke=ke.children[0]),ke.animations=a}parseModels(e,t,s){const n=new Map,i=oe.Objects.Model;for(const o in i){const a=parseInt(o),A=i[o],l=we.get(a);let h=this.buildSkeleton(l,e,a,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 r.Bone;break;case"Null":default:h=new r.Group;break}h.name=A.attrName?r.PropertyBinding.sanitizeNodeName(A.attrName):"",h.userData.originalName=A.attrName,h.ID=a}this.getTransformData(h,A),n.set(a,h)}return n}buildSkeleton(e,t,s,n){let i=null;return e?.parents.forEach(function(o){for(const a in t){const A=t[a];A.rawBones.forEach(function(l,h){if(l.ID===o.ID){const u=i;i=new r.Bone,i.matrixWorld.copy(l.transformLink),i.name=n?r.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=oe.Objects.NodeAttribute[n.ID];i!==void 0&&(s=i)}),s===void 0)t=new r.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 a=window.innerWidth,A=window.innerHeight;s.AspectWidth!==void 0&&s.AspectHeight!==void 0&&(a=s.AspectWidth.value,A=s.AspectHeight.value);const l=a/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 r.PerspectiveCamera(h,l,i,o),u!==null&&t.setFocalLength(u);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),t=new r.Object3D;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new r.Object3D;break}}return t}createLight(e){let t,s;if(e.children.forEach(function(n){const i=oe.Objects.NodeAttribute[n.ID];i!==void 0&&(s=i)}),s===void 0)t=new r.Object3D;else{let n;s.LightType===void 0?n=0:n=s.LightType.value;let i=16777215;s.Color!==void 0&&(i=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(s.Color.value),r.SRGBColorSpace));let o=s.Intensity===void 0?1:s.Intensity.value/100;s.CastLightOnObject!==void 0&&s.CastLightOnObject.value===0&&(o=0);let a=0;s.FarAttenuationEnd!==void 0&&(s.EnableFarAttenuation!==void 0&&s.EnableFarAttenuation.value===0?a=0:a=s.FarAttenuationEnd.value);const A=1;switch(n){case 0:t=new r.PointLight(i,o,a,A);break;case 1:t=new r.DirectionalLight(i,o);break;case 2:let l=Math.PI/3;s.InnerAngle!==void 0&&(l=r.MathUtils.degToRad(s.InnerAngle.value));let h=0;s.OuterAngle!==void 0&&(h=r.MathUtils.degToRad(s.OuterAngle.value),h=Math.max(h,1)),t=new r.SpotLight(i,o,a,l,h,A);break;default:console.warn("THREE.FBXLoader: Unknown light type "+s.LightType.value+", defaulting to a PointLight."),t=new r.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 a=[];if(e.children.forEach(function(A){t.has(A.ID)&&(i=t.get(A.ID)),s.has(A.ID)&&a.push(s.get(A.ID))}),a.length>1?o=a:a.length>0?o=a[0]:(o=new r.MeshPhongMaterial({name:r.Loader.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(o)),"color"in i.attributes&&a.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>=a.length)&&(u.materialIndex=a.length,A=!0)}if(A){const l=new r.MeshStandardMaterial;a.push(l)}}return i.FBX_Deformer?(n=new r.SkinnedMesh(i,o),n.normalizeSkinWeights()):n=new r.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 r.LineBasicMaterial({name:r.Loader.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new r.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=oe.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 r.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 r.Skeleton(o.bones),n[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in oe.Objects){const t=oe.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 r.Matrix4().fromArray(i.Matrix.a)}):e[n.Node]=new r.Matrix4().fromArray(n.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in oe){if("AmbientColor"in oe.GlobalSettings){const e=oe.GlobalSettings.AmbientColor.value,t=e[0],s=e[1],n=e[2];if(t!==0||s!==0||n!==0){const i=new r.Color().setRGB(t,s,n,r.SRGBColorSpace);ke.add(new r.AmbientLight(i,1))}}"UnitScaleFactor"in oe.GlobalSettings&&(ke.userData.unitScaleFactor=oe.GlobalSettings.UnitScaleFactor.value)}}}class xa{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in oe.Objects){const s=oe.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 oe.Objects.Model[u.ID]});if(o.length===0)return;const a=e.children.reduce(function(u,p){return n[p.ID]!==void 0&&(u=n[p.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,a,i,h)}genGeometry(e,t,s,n){const i=new r.BufferGeometry;e.attrName&&(i.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),A=new r.Float32BufferAttribute(a.vertex,3);if(A.applyMatrix4(n),i.setAttribute("position",A),a.colors.length>0&&i.setAttribute("color",new r.Float32BufferAttribute(a.colors,3)),t&&(i.setAttribute("skinIndex",new r.Uint16BufferAttribute(a.weightsIndices,4)),i.setAttribute("skinWeight",new r.Float32BufferAttribute(a.vertexWeights,4)),i.FBX_Deformer=t),a.normal.length>0){const l=new r.Matrix3().getNormalMatrix(n),h=new r.Float32BufferAttribute(a.normal,3);h.applyNormalMatrix(l),i.setAttribute("normal",h)}if(a.uvs.forEach(function(l,h){const u=h===0?"uv":`uv${h}`;i.setAttribute(u,new r.Float32BufferAttribute(a.uvs[h],2))}),o.material&&o.material.mappingType!=="AllSame"){let l=a.materialIndex[0],h=0;if(a.materialIndex.forEach(function(u,p){u!==l&&(i.addGroup(h,p-h,l),l=u,h=p)}),i.groups.length>0){const u=i.groups[i.groups.length-1],p=u.start+u.count;p!==a.materialIndex.length&&i.addGroup(p,a.materialIndex.length-p,l)}i.groups.length===0&&i.addGroup(0,a.materialIndex.length,a.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,a){s.weightTable[o]===void 0&&(s.weightTable[o]=[]),s.weightTable[o].push({id:i,weight:n.weights[a]})})})),s}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let s=0,n=0,i=!1,o=[],a=[],A=[],l=[],h=[],u=[];const p=this;return e.vertexIndices.forEach(function(g,m){let I,b=!1;g<0&&(g=g^-1,b=!0);let B=[],w=[];if(o.push(g*3,g*3+1,g*3+2),e.color){const C=sn(m,s,g,e.color);A.push(C[0],C[1],C[2])}if(e.skeleton){if(e.weightTable[g]!==void 0&&e.weightTable[g].forEach(function(C){w.push(C.weight),B.push(C.id)}),w.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],y=[0,0,0,0];w.forEach(function(x,R){let D=x,S=B[R];y.forEach(function(v,U,G){if(D>v){G[U]=D,D=v;const H=C[U];C[U]=S,S=H}})}),B=C,w=y}for(;w.length<4;)w.push(0),B.push(0);for(let C=0;C<4;++C)h.push(w[C]),u.push(B[C])}if(e.normal){const C=sn(m,s,g,e.normal);a.push(C[0],C[1],C[2])}e.material&&e.material.mappingType!=="AllSame"&&(I=sn(m,s,g,e.material)[0],I<0&&(p.negativeMaterialIndices=!0,I=0)),e.uv&&e.uv.forEach(function(C,y){const x=sn(m,s,g,C);l[y]===void 0&&(l[y]=[]),l[y].push(x[0]),l[y].push(x[1])}),n++,b&&(p.genFace(t,e,o,I,a,A,l,h,u,n),s++,n=0,o=[],a=[],A=[],l=[],h=[],u=[])}),t}getNormalNewell(e){const t=new r.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 r.Vector3(0,1,0):new r.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 r.Vector2(e.dot(t),e.dot(s))}genFace(e,t,s,n,i,o,a,A,l,h){let u;if(h>3){const p=[],g=t.baseVertexPositions||t.vertexPositions;for(let B=0;B<s.length;B+=3)p.push(new r.Vector3(g[s[B]],g[s[B+1]],g[s[B+2]]));const{tangent:m,bitangent:I}=this.getNormalTangentAndBitangent(p),b=[];for(const B of p)b.push(this.flattenVertex(B,m,I));u=r.ShapeUtils.triangulateShape(b,[])}else h===2?(console.warn("THREE.FBXLoader: Edge topology detected. This is currently not supported. The resulting mesh will not be correct."),u=[[0,1,2]]):u=[[0,1,2]];for(const[p,g,m]of u)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[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[m*3]]),e.vertex.push(t.vertexPositions[s[m*3+1]]),e.vertex.push(t.vertexPositions[s[m*3+2]]),t.skeleton&&(e.vertexWeights.push(A[p*4]),e.vertexWeights.push(A[p*4+1]),e.vertexWeights.push(A[p*4+2]),e.vertexWeights.push(A[p*4+3]),e.vertexWeights.push(A[g*4]),e.vertexWeights.push(A[g*4+1]),e.vertexWeights.push(A[g*4+2]),e.vertexWeights.push(A[g*4+3]),e.vertexWeights.push(A[m*4]),e.vertexWeights.push(A[m*4+1]),e.vertexWeights.push(A[m*4+2]),e.vertexWeights.push(A[m*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[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[m*4]),e.weightsIndices.push(l[m*4+1]),e.weightsIndices.push(l[m*4+2]),e.weightsIndices.push(l[m*4+3])),t.color&&(e.colors.push(o[p*3]),e.colors.push(o[p*3+1]),e.colors.push(o[p*3+2]),e.colors.push(o[g*3]),e.colors.push(o[g*3+1]),e.colors.push(o[g*3+2]),e.colors.push(o[m*3]),e.colors.push(o[m*3+1]),e.colors.push(o[m*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[p*3]),e.normal.push(i[p*3+1]),e.normal.push(i[p*3+2]),e.normal.push(i[g*3]),e.normal.push(i[g*3+1]),e.normal.push(i[g*3+2]),e.normal.push(i[m*3]),e.normal.push(i[m*3+1]),e.normal.push(i[m*3+2])),t.uv&&t.uv.forEach(function(I,b){e.uvs[b]===void 0&&(e.uvs[b]=[]),e.uvs[b].push(a[b][p*2]),e.uvs[b].push(a[b][p*2+1]),e.uvs[b].push(a[b][g*2]),e.uvs[b].push(a[b][g*2+1]),e.uvs[b].push(a[b][m*2]),e.uvs[b].push(a[b][m*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(a){const A=oe.Objects.Geometry[a.geoID];A!==void 0&&i.genMorphGeometry(e,t,A,n,a.name)})})}genMorphGeometry(e,t,s,n,i){const o=t.Vertices!==void 0?t.Vertices.a:[],a=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 p={vertexIndices:a,vertexPositions:u,baseVertexPositions:o},g=this.genBuffers(p),m=new r.Float32BufferAttribute(g.vertex,3);m.name=i||s.attrName,m.applyMatrix4(n),e.morphAttributes.position.push(m)}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,a=new r.Color;o<n.length;o+=4)a.fromArray(n,o),r.ColorManagement.toWorkingColorSpace(a,r.SRGBColorSpace),a.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 r.BufferGeometry;const s=t-1,n=e.KnotVector.a,i=[],o=e.Points.a;for(let u=0,p=o.length;u<p;u+=4)i.push(new r.Vector4().fromArray(o,u));let a,A;if(e.Form==="Closed")i.push(i[0]);else if(e.Form==="Periodic"){a=s,A=n.length-1-a;for(let u=0;u<s;++u)i.push(i[u])}const h=new ya(s,n,i,a,A).getPoints(i.length*12);return new r.BufferGeometry().setFromPoints(h)}}class Sa{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(oe.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=oe.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=oe.Objects.AnimationCurve;for(const s in t){const n={id:t[s].id,times:t[s].KeyTime.a.map(Da),values:t[s].KeyValueFloat.a},i=we.get(n.id);if(i!==void 0){const o=i.parents[0].ID,a=i.parents[0].relationship;a.match(/X/)?e.get(o).curves.x=n:a.match(/Y/)?e.get(o).curves.y=n:a.match(/Z/)?e.get(o).curves.z=n:a.match(/DeformPercent/)&&e.has(o)&&(e.get(o).curves.morph=n)}}}parseAnimationLayers(e){const t=oe.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(p){return p.relationship!==void 0})[0].ID;if(u!==void 0){const p=oe.Objects.Model[u.toString()];if(p===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",A);return}const g={modelName:p.attrName?r.PropertyBinding.sanitizeNodeName(p.attrName):"",ID:p.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};ke.traverse(function(m){m.ID===p.id&&(g.transform=m.matrix,m.userData.transformData&&(g.eulerOrder=m.userData.transformData.eulerOrder))}),g.transform||(g.transform=new r.Matrix4),"PreRotation"in p&&(g.preRotation=p.PreRotation.value),"PostRotation"in p&&(g.postRotation=p.PostRotation.value),i[l]=g}}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(B){return B.relationship!==void 0})[0].ID,p=we.get(u).parents[0].ID,g=we.get(p).parents[0].ID,m=we.get(g).parents[0].ID,I=oe.Objects.Model[m],b={modelName:I.attrName?r.PropertyBinding.sanitizeNodeName(I.attrName):"",morphName:oe.Objects.Deformer[u].attrName};i[l]=b}i[l][h.attr]=h}}}),s.set(parseInt(n),i))}return s}parseAnimStacks(e){const t=oe.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 r.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let s=new r.Vector3,n=new r.Vector3;if(e.transform&&e.transform.decompose(s,new r.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 r.VectorKeyframeTrack(e+"."+n,i,o)}generateRotationTrack(e,t,s,n,i){let o,a;if(t.x===void 0||t.y===void 0||t.z===void 0){console.warn("THREE.FBXLoader: Missing rotation curves "+(t.x===void 0?"x ":"")+(t.y===void 0?"y ":"")+(t.z===void 0?"z ":"")+" for animation of "+e+". This is currently not supported.");return}if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const p=this.interpolateRotations(t.x,t.y,t.z,i);o=p[0],a=p[1]}const A=Xt(0);s!==void 0&&(s=s.map(r.MathUtils.degToRad),s.push(A),s=new r.Euler().fromArray(s),s=new r.Quaternion().setFromEuler(s)),n!==void 0&&(n=n.map(r.MathUtils.degToRad),n.push(A),n=new r.Euler().fromArray(n),n=new r.Quaternion().setFromEuler(n).invert());const l=new r.Quaternion,h=new r.Euler,u=[];if(!(!a||!o)){for(let p=0;p<a.length;p+=3)h.set(a[p],a[p+1],a[p+2],i),l.setFromEuler(h),s!==void 0&&l.premultiply(s),n!==void 0&&l.multiply(n),p>2&&new r.Quaternion().fromArray(u,(p-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(u,p/3*4);return new r.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 r.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,a=-1,A=-1;return e.forEach(function(l){if(t.x&&(o=t.x.times.indexOf(l)),t.y&&(a=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(a!==-1){const h=t.y.values[a];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(r.MathUtils.degToRad(e.values[0])),o.push(r.MathUtils.degToRad(t.values[0])),o.push(r.MathUtils.degToRad(s.values[0]));for(let a=1;a<e.values.length;a++){const A=[e.values[a-1],t.values[a-1],s.values[a-1]];if(isNaN(A[0])||isNaN(A[1])||isNaN(A[2]))continue;const l=A.map(r.MathUtils.degToRad),h=[e.values[a],t.values[a],s.values[a]];if(isNaN(h[0])||isNaN(h[1])||isNaN(h[2]))continue;const u=h.map(r.MathUtils.degToRad),p=[h[0]-A[0],h[1]-A[1],h[2]-A[2]],g=[Math.abs(p[0]),Math.abs(p[1]),Math.abs(p[2])];if(g[0]>=180||g[1]>=180||g[2]>=180){const I=Math.max(...g)/180,b=new r.Euler(...l,n),B=new r.Euler(...u,n),w=new r.Quaternion().setFromEuler(b),C=new r.Quaternion().setFromEuler(B);w.dot(C)&&C.set(-C.x,-C.y,-C.z,-C.w);const y=e.times[a-1],x=e.times[a]-y,R=new r.Quaternion,D=new r.Euler;for(let S=0;S<1;S+=1/I)R.copy(w.clone().slerp(C.clone(),S)),i.push(y+S*x),D.setFromQuaternion(R,n),o.push(D.x),o.push(D.y),o.push(D.z)}else i.push(e.times[a]),o.push(r.MathUtils.degToRad(e.values[a])),o.push(r.MathUtils.degToRad(t.values[a])),o.push(r.MathUtils.degToRad(s.values[a]))}return[i,o]}}class Ta{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 Ni,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]*;/),a=n.match(/^[\s\t]*$/);if(o||a)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),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(s,i):s in a?(s==="PoseNode"?a.PoseNode.push(i):a[s].id!==void 0&&(a[s]={},a[s][a[s].id]=a[s]),o.id!==""&&(a[s][o.id]=i)):typeof o.id=="number"?(a[s]={},a[s][o.id]=i):s!=="Properties70"&&(s==="PoseNode"?a[s]=[i]:a[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(p){return p.trim().replace(/^"/,"")}),n="connections",i=[l,h],Fa(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=_n(i))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=_n(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],a=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=_n(l);break}this.getPrevNode()[i]={type:o,type2:a,flag:A,value:l},this.setCurrentProp(this.getPrevNode(),i)}}class va{parse(e){const t=new Fs(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 Ni;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(),a=e.getString(o);if(n===0)return null;const A=[];for(let p=0;p<i;p++)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 p=this.parseNode(e,t);p!==null&&this.parseSubNode(a,s,p)}return s.propertyList=A,typeof l=="number"&&(s.id=l),h!==""&&(s.attrName=h),u!==""&&(s.attrType=u),a!==""&&(s.name=a),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],a=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:a,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 a=Vt(new Uint8Array(e.getArrayBuffer(o))),A=new Fs(a.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 Fs{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 Ni{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 Ra(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 Ls(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 Da(c){return c/46186158e3}const _a=[];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 La(_a,s.buffer,i,o)}const Dn=new r.Euler,Tt=new r.Vector3;function Ui(c){const e=new r.Matrix4,t=new r.Matrix4,s=new r.Matrix4,n=new r.Matrix4,i=new r.Matrix4,o=new r.Matrix4,a=new r.Matrix4,A=new r.Matrix4,l=new r.Matrix4,h=new r.Matrix4,u=new r.Matrix4,p=new r.Matrix4,g=c.inheritType?c.inheritType:0;c.translation&&e.setPosition(Tt.fromArray(c.translation));const m=Xt(0);if(c.preRotation){const G=c.preRotation.map(r.MathUtils.degToRad);G.push(m),t.makeRotationFromEuler(Dn.fromArray(G))}if(c.rotation){const G=c.rotation.map(r.MathUtils.degToRad);G.push(c.eulerOrder||m),s.makeRotationFromEuler(Dn.fromArray(G))}if(c.postRotation){const G=c.postRotation.map(r.MathUtils.degToRad);G.push(m),n.makeRotationFromEuler(Dn.fromArray(G)),n.invert()}c.scale&&i.scale(Tt.fromArray(c.scale)),c.scalingOffset&&a.setPosition(Tt.fromArray(c.scalingOffset)),c.scalingPivot&&o.setPosition(Tt.fromArray(c.scalingPivot)),c.rotationOffset&&A.setPosition(Tt.fromArray(c.rotationOffset)),c.rotationPivot&&l.setPosition(Tt.fromArray(c.rotationPivot)),c.parentMatrixWorld&&(u.copy(c.parentMatrix),h.copy(c.parentMatrixWorld));const I=t.clone().multiply(s).multiply(n),b=new r.Matrix4;b.extractRotation(h);const B=new r.Matrix4;B.copyPosition(h);const w=B.clone().invert().multiply(h),C=b.clone().invert().multiply(w),y=i,x=new r.Matrix4;if(g===0)x.copy(b).multiply(I).multiply(C).multiply(y);else if(g===1)x.copy(b).multiply(C).multiply(I).multiply(y);else{const H=new r.Matrix4().scale(new r.Vector3().setFromMatrixScale(u)).clone().invert(),X=C.clone().multiply(H);x.copy(b).multiply(I).multiply(X).multiply(y)}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(a).multiply(o).multiply(i).multiply(D);const v=new r.Matrix4().copyPosition(S),U=h.clone().multiply(v);return p.copyPosition(U),S=p.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 _n(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 Fa(c,e){for(let t=0,s=c.length,n=e.length;t<n;t++,s++)c[s]=e[t]}function La(c,e,t,s){for(let n=t,i=0;n<s;n++,i++)c[i]=e[n];return c}class ka extends r.Loader{constructor(e){super(e)}load(e,t,s,n){const i=this,o=this.path===""?r.LoaderUtils.extractUrlBase(e):this.path,a=new r.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.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(`
40
+ `;continue}if((O=Y.match(U))&&(N.gamma=parseFloat(O[1])),(O=Y.match(G))&&(N.exposure=parseFloat(O[1])),(O=Y.match(H))&&(N.valid|=2,N.format=O[1]),(O=Y.match(X))&&(N.valid|=4,N.height=parseInt(O[1],10),N.width=parseInt(O[2],10)),N.valid&2&&N.valid&4)break}return N.valid&2||o(3,"missing format specifier"),N.valid&4||o(3,"missing image size specifier"),N},g=function(S,v,U){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 H=new Uint8Array(4*v*U);H.length||o(4,"unable to allocate buffer space");let X=0,N=0;const Y=4*G,O=new Uint8Array(4),Z=new Uint8Array(Y);let ie=U;for(;ie>0&&N<S.byteLength;){N+4>S.byteLength&&o(1),O[0]=S[N++],O[1]=S[N++],O[2]=S[N++],O[3]=S[N++],(O[0]!=2||O[1]!=2||(O[2]<<8|O[3])!=G)&&o(3,"bad rgbe scanline format");let ee=0,ce;for(;ee<Y&&N<S.byteLength;){ce=S[N++];const W=ce>128;if(W&&(ce-=128),(ce===0||ee+ce>Y)&&o(3,"bad scanline data"),W){const se=S[N++];for(let de=0;de<ce;de++)Z[ee++]=se}else Z.set(S.subarray(N,N+ce),ee),ee+=ce,N+=ce}const te=G;for(let W=0;W<te;W++){let se=0;H[X]=Z[W+se],se+=G,H[X+1]=Z[W+se],se+=G,H[X+2]=Z[W+se],se+=G,H[X+3]=Z[W+se],X+=4}ie--}return H},m=function(S,v,U,G){const H=S[v+3],X=Math.pow(2,H-128)/255;U[G+0]=S[v+0]*X,U[G+1]=S[v+1]*X,U[G+2]=S[v+2]*X,U[G+3]=1},I=function(S,v,U,G){const H=S[v+3],X=Math.pow(2,H-128)/255;U[G+0]=r.DataUtils.toHalfFloat(Math.min(S[v+0]*X,65504)),U[G+1]=r.DataUtils.toHalfFloat(Math.min(S[v+1]*X,65504)),U[G+2]=r.DataUtils.toHalfFloat(Math.min(S[v+2]*X,65504)),U[G+3]=r.DataUtils.toHalfFloat(1)},b=new Uint8Array(e);b.pos=0;const B=p(b),w=B.width,C=B.height,y=g(b.subarray(b.pos),w,C);let x,R,D;switch(this.type){case r.FloatType:D=y.length/4;const S=new Float32Array(D*4);for(let U=0;U<D;U++)m(y,U*4,S,U*4);x=S,R=r.FloatType;break;case r.HalfFloatType:D=y.length/4;const v=new Uint16Array(D*4);for(let U=0;U<D;U++)I(y,U*4,v,U*4);x=v,R=r.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:w,height:C,data:x,header:B.string,gamma:B.gamma,exposure:B.exposure,type:R}}setDataType(e){return this.type=e,this}load(e,t,s,n){function i(o,a){switch(o.type){case r.FloatType:case r.HalfFloatType:o.colorSpace=r.LinearSRGBColorSpace,o.minFilter=r.LinearFilter,o.magFilter=r.LinearFilter,o.generateMipmaps=!1,o.flipY=!0;break}t&&t(o,a)}return super.load(e,i,s,n)}}const ga=Object.freeze(Object.defineProperty({__proto__:null,RGBELoader:ki},Symbol.toStringTag,{value:"Module"}));function Gi(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 fa(c,e,t,s){const n=[],i=[],o=[];n[0]=1;for(let a=1;a<=t;++a){i[a]=e-s[c+1-a],o[a]=s[c+a]-e;let A=0;for(let l=0;l<a;++l){const h=o[l+1],u=i[a-l],p=n[l]/(h+u);n[l]=A+h*p,A=u*p}n[a]=A}return n}function ma(c,e,t,s){const n=Gi(c,s,e),i=fa(n,s,c,e),o=new r.Vector4(0,0,0,0);for(let a=0;a<=c;++a){const A=t[n-c+a],l=i[a],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 Ia(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 a=[];for(let u=0;u<=t;++u)a[u]=i.slice(0);a[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 p=0;for(let g=0;g<u;++g){const m=l[g+1],I=A[u-g];a[u][g]=m+I;const b=a[g][u-1]/a[u][g];a[g][u]=p+m*b,p=I*b}a[u][u]=p}for(let u=0;u<=t;++u)o[0][u]=a[u][t];for(let u=0;u<=t;++u){let p=0,g=1;const m=[];for(let I=0;I<=t;++I)m[I]=i.slice(0);m[0][0]=1;for(let I=1;I<=s;++I){let b=0;const B=u-I,w=t-I;u>=I&&(m[g][0]=m[p][0]/a[w+1][B],b=m[g][0]*a[B][w]);const C=B>=-1?1:-B,y=u-1<=w?I-1:t-u;for(let R=C;R<=y;++R)m[g][R]=(m[p][R]-m[p][R-1])/a[w+1][B+R],b+=m[g][R]*a[B+R][w];u<=w&&(m[g][I]=-m[p][I-1]/a[w+1][u],b+=m[g][I]*a[u][w]),o[I][u]=b;const x=p;p=g,g=x}}let h=t;for(let u=1;u<=s;++u){for(let p=0;p<=t;++p)o[u][p]*=h;h*=t-u}return o}function ba(c,e,t,s,n){const i=n<c?n:c,o=[],a=Gi(c,s,e),A=Ia(a,s,c,i,e),l=[];for(let h=0;h<t.length;++h){const u=t[h].clone(),p=u.w;u.x*=p,u.y*=p,u.z*=p,l[h]=u}for(let h=0;h<=i;++h){const u=l[a-c].clone().multiplyScalar(A[h][0]);for(let p=1;p<=c;++p)u.add(l[a-c+p].clone().multiplyScalar(A[h][p]));o[h]=u}for(let h=i+1;h<=n+1;++h)o[h]=new r.Vector4(0,0,0);return o}function Ea(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 Ca(c){const e=c.length,t=[],s=[];for(let i=0;i<e;++i){const o=c[i];t[i]=new r.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 a=1;a<=i;++a)o.sub(n[i-a].clone().multiplyScalar(Ea(i,a)*s[a]));n[i]=o.divideScalar(s[0])}return n}function Ba(c,e,t,s,n){const i=ba(c,e,t,s,n);return Ca(i)}class ya extends r.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 a=s[o];this.controlPoints[o]=new r.Vector4(a.x,a.y,a.z,a.w)}}getPoint(e,t=new r.Vector3){const s=t,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=ma(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 r.Vector3){const s=t,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Ba(this.degree,this.knots,this.controlPoints,n,1);return s.copy(i[1]).normalize(),s}}let oe,we,ke;class wa extends r.Loader{constructor(e){super(e)}load(e,t,s,n){const i=this,o=i.path===""?r.LoaderUtils.extractUrlBase(e):i.path,a=new r.FileLoader(this.manager);a.setPath(i.path),a.setResponseType("arraybuffer"),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.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))oe=new va().parse(e);else{const n=Pi(e);if(!Ra(n))throw new Error("THREE.FBXLoader: Unknown format.");if(Ls(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ls(n));oe=new Ta().parse(n)}const s=new r.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Qa(s,this.manager).parse(oe)}getFbxTree(){return oe}}class Qa{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 xa().parse(n);return this.parseScene(n,i,s),ke}parseConnections(){const e=new Map;return"Connections"in oe&&oe.Connections.connections.forEach(function(s){const n=s[0],i=s[1],o=s[2];e.has(n)||e.set(n,{parents:[],children:[]});const a={ID:i,relationship:o};e.get(n).parents.push(a),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 oe.Objects){const s=oe.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 a=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,A=typeof i.Content=="string"&&i.Content!=="";if(a||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 oe.Objects){const s=oe.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,a=i!==void 0?i.value:0;if(s.wrapS=o===0?r.RepeatWrapping:r.ClampToEdgeWrapping,s.wrapT=a===0?r.RepeatWrapping:r.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 r.Texture;const o=i.path;o||i.setPath(this.textureLoader.path);const a=we.get(e.id).children;let A;a!==void 0&&a.length>0&&t[a[0].ID]!==void 0&&(A=t[a[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 oe.Objects){const s=oe.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 a;switch(i.toLowerCase()){case"phong":a=new r.MeshPhongMaterial;break;case"lambert":a=new r.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),a=new r.MeshPhongMaterial;break}return a.setValues(o),a.name=n,a}parseParameters(e,t,s){const n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.Diffuse.value),r.SRGBColorSpace):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.DiffuseColor.value),r.SRGBColorSpace)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.Emissive.value),r.SRGBColorSpace):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.EmissiveColor.value),r.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=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.Specular.value),r.SRGBColorSpace):e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(e.SpecularColor.value),r.SRGBColorSpace));const i=this;return we.get(s).children.forEach(function(o){const a=o.relationship;switch(a){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=r.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=r.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=r.EquirectangularReflectionMapping,n.envMap.colorSpace=r.SRGBColorSpace);break;case"SpecularColor":n.specularMap=i.getTexture(t,o.ID),n.specularMap!==void 0&&(n.specularMap.colorSpace=r.SRGBColorSpace);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=i.getTexture(t,o.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),n}getTexture(e,t){return"LayeredTexture"in oe.Objects&&t in oe.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 oe.Objects){const s=oe.Objects.Deformer;for(const n in s){const i=s[n],o=we.get(parseInt(n));if(i.attrType==="Skin"){const a=this.parseSkeleton(o,s);a.ID=n,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[n]=a}else if(i.attrType==="BlendShape"){const a={id:n};a.rawTargets=this.parseMorphTargets(o,s),a.id=n,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=a}}}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 r.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],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;a.geoID=we.get(parseInt(i.ID)).children.filter(function(A){return A.relationship===void 0})[0].ID,s.push(a)}return s}parseScene(e,t,s){ke=new r.Group;const n=this.parseModels(e.skeletons,t,s),i=oe.Objects.Model,o=this;n.forEach(function(A){const l=i[A.ID];o.setLookAtProperties(A,l),we.get(A.ID)?.parents?.forEach(function(u){const p=n.get(u.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 a=new Sa().parse();ke.children.length===1&&ke.children[0].isGroup&&(ke.children[0].animations=a,ke=ke.children[0]),ke.animations=a}parseModels(e,t,s){const n=new Map,i=oe.Objects.Model;for(const o in i){const a=parseInt(o),A=i[o],l=we.get(a);let h=this.buildSkeleton(l,e,a,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 r.Bone;break;default:h=new r.Group;break}h.name=A.attrName?r.PropertyBinding.sanitizeNodeName(A.attrName):"",h.userData.originalName=A.attrName,h.ID=a}this.getTransformData(h,A),n.set(a,h)}return n}buildSkeleton(e,t,s,n){let i=null;return e?.parents.forEach(function(o){for(const a in t){const A=t[a];A.rawBones.forEach(function(l,h){if(l.ID===o.ID){const u=i;i=new r.Bone,i.matrixWorld.copy(l.transformLink),i.name=n?r.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=oe.Objects.NodeAttribute[n.ID];i!==void 0&&(s=i)}),s===void 0)t=new r.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 a=window.innerWidth,A=window.innerHeight;s.AspectWidth!==void 0&&s.AspectHeight!==void 0&&(a=s.AspectWidth.value,A=s.AspectHeight.value);const l=a/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 r.PerspectiveCamera(h,l,i,o),u!==null&&t.setFocalLength(u);break;case 1:console.warn("THREE.FBXLoader: Orthographic cameras not supported yet."),t=new r.Object3D;break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new r.Object3D;break}}return t}createLight(e){let t,s;if(e.children.forEach(function(n){const i=oe.Objects.NodeAttribute[n.ID];i!==void 0&&(s=i)}),s===void 0)t=new r.Object3D;else{let n;s.LightType===void 0?n=0:n=s.LightType.value;let i=16777215;s.Color!==void 0&&(i=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(s.Color.value),r.SRGBColorSpace));let o=s.Intensity===void 0?1:s.Intensity.value/100;s.CastLightOnObject!==void 0&&s.CastLightOnObject.value===0&&(o=0);let a=0;s.FarAttenuationEnd!==void 0&&(s.EnableFarAttenuation!==void 0&&s.EnableFarAttenuation.value===0?a=0:a=s.FarAttenuationEnd.value);const A=1;switch(n){case 0:t=new r.PointLight(i,o,a,A);break;case 1:t=new r.DirectionalLight(i,o);break;case 2:let l=Math.PI/3;s.InnerAngle!==void 0&&(l=r.MathUtils.degToRad(s.InnerAngle.value));let h=0;s.OuterAngle!==void 0&&(h=r.MathUtils.degToRad(s.OuterAngle.value),h=Math.max(h,1)),t=new r.SpotLight(i,o,a,l,h,A);break;default:console.warn("THREE.FBXLoader: Unknown light type "+s.LightType.value+", defaulting to a PointLight."),t=new r.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 a=[];if(e.children.forEach(function(A){t.has(A.ID)&&(i=t.get(A.ID)),s.has(A.ID)&&a.push(s.get(A.ID))}),a.length>1?o=a:a.length>0?o=a[0]:(o=new r.MeshPhongMaterial({name:r.Loader.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(o)),"color"in i.attributes&&a.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>=a.length)&&(u.materialIndex=a.length,A=!0)}if(A){const l=new r.MeshStandardMaterial;a.push(l)}}return i.FBX_Deformer?(n=new r.SkinnedMesh(i,o),n.normalizeSkinWeights()):n=new r.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 r.LineBasicMaterial({name:r.Loader.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new r.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=oe.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 r.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 r.Skeleton(o.bones),n[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in oe.Objects){const t=oe.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 r.Matrix4().fromArray(i.Matrix.a)}):e[n.Node]=new r.Matrix4().fromArray(n.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in oe){if("AmbientColor"in oe.GlobalSettings){const e=oe.GlobalSettings.AmbientColor.value,t=e[0],s=e[1],n=e[2];if(t!==0||s!==0||n!==0){const i=new r.Color().setRGB(t,s,n,r.SRGBColorSpace);ke.add(new r.AmbientLight(i,1))}}"UnitScaleFactor"in oe.GlobalSettings&&(ke.userData.unitScaleFactor=oe.GlobalSettings.UnitScaleFactor.value)}}}class xa{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in oe.Objects){const s=oe.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 oe.Objects.Model[u.ID]});if(o.length===0)return;const a=e.children.reduce(function(u,p){return n[p.ID]!==void 0&&(u=n[p.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,a,i,h)}genGeometry(e,t,s,n){const i=new r.BufferGeometry;e.attrName&&(i.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),A=new r.Float32BufferAttribute(a.vertex,3);if(A.applyMatrix4(n),i.setAttribute("position",A),a.colors.length>0&&i.setAttribute("color",new r.Float32BufferAttribute(a.colors,3)),t&&(i.setAttribute("skinIndex",new r.Uint16BufferAttribute(a.weightsIndices,4)),i.setAttribute("skinWeight",new r.Float32BufferAttribute(a.vertexWeights,4)),i.FBX_Deformer=t),a.normal.length>0){const l=new r.Matrix3().getNormalMatrix(n),h=new r.Float32BufferAttribute(a.normal,3);h.applyNormalMatrix(l),i.setAttribute("normal",h)}if(a.uvs.forEach(function(l,h){const u=h===0?"uv":`uv${h}`;i.setAttribute(u,new r.Float32BufferAttribute(a.uvs[h],2))}),o.material&&o.material.mappingType!=="AllSame"){let l=a.materialIndex[0],h=0;if(a.materialIndex.forEach(function(u,p){u!==l&&(i.addGroup(h,p-h,l),l=u,h=p)}),i.groups.length>0){const u=i.groups[i.groups.length-1],p=u.start+u.count;p!==a.materialIndex.length&&i.addGroup(p,a.materialIndex.length-p,l)}i.groups.length===0&&i.addGroup(0,a.materialIndex.length,a.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,a){s.weightTable[o]===void 0&&(s.weightTable[o]=[]),s.weightTable[o].push({id:i,weight:n.weights[a]})})})),s}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let s=0,n=0,i=!1,o=[],a=[],A=[],l=[],h=[],u=[];const p=this;return e.vertexIndices.forEach(function(g,m){let I,b=!1;g<0&&(g=g^-1,b=!0);let B=[],w=[];if(o.push(g*3,g*3+1,g*3+2),e.color){const C=sn(m,s,g,e.color);A.push(C[0],C[1],C[2])}if(e.skeleton){if(e.weightTable[g]!==void 0&&e.weightTable[g].forEach(function(C){w.push(C.weight),B.push(C.id)}),w.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],y=[0,0,0,0];w.forEach(function(x,R){let D=x,S=B[R];y.forEach(function(v,U,G){if(D>v){G[U]=D,D=v;const H=C[U];C[U]=S,S=H}})}),B=C,w=y}for(;w.length<4;)w.push(0),B.push(0);for(let C=0;C<4;++C)h.push(w[C]),u.push(B[C])}if(e.normal){const C=sn(m,s,g,e.normal);a.push(C[0],C[1],C[2])}e.material&&e.material.mappingType!=="AllSame"&&(I=sn(m,s,g,e.material)[0],I<0&&(p.negativeMaterialIndices=!0,I=0)),e.uv&&e.uv.forEach(function(C,y){const x=sn(m,s,g,C);l[y]===void 0&&(l[y]=[]),l[y].push(x[0]),l[y].push(x[1])}),n++,b&&(p.genFace(t,e,o,I,a,A,l,h,u,n),s++,n=0,o=[],a=[],A=[],l=[],h=[],u=[])}),t}getNormalNewell(e){const t=new r.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 r.Vector3(0,1,0):new r.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 r.Vector2(e.dot(t),e.dot(s))}genFace(e,t,s,n,i,o,a,A,l,h){let u;if(h>3){const p=[],g=t.baseVertexPositions||t.vertexPositions;for(let B=0;B<s.length;B+=3)p.push(new r.Vector3(g[s[B]],g[s[B+1]],g[s[B+2]]));const{tangent:m,bitangent:I}=this.getNormalTangentAndBitangent(p),b=[];for(const B of p)b.push(this.flattenVertex(B,m,I));u=r.ShapeUtils.triangulateShape(b,[])}else h===2?(console.warn("THREE.FBXLoader: Edge topology detected. This is currently not supported. The resulting mesh will not be correct."),u=[[0,1,2]]):u=[[0,1,2]];for(const[p,g,m]of u)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[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[m*3]]),e.vertex.push(t.vertexPositions[s[m*3+1]]),e.vertex.push(t.vertexPositions[s[m*3+2]]),t.skeleton&&(e.vertexWeights.push(A[p*4]),e.vertexWeights.push(A[p*4+1]),e.vertexWeights.push(A[p*4+2]),e.vertexWeights.push(A[p*4+3]),e.vertexWeights.push(A[g*4]),e.vertexWeights.push(A[g*4+1]),e.vertexWeights.push(A[g*4+2]),e.vertexWeights.push(A[g*4+3]),e.vertexWeights.push(A[m*4]),e.vertexWeights.push(A[m*4+1]),e.vertexWeights.push(A[m*4+2]),e.vertexWeights.push(A[m*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[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[m*4]),e.weightsIndices.push(l[m*4+1]),e.weightsIndices.push(l[m*4+2]),e.weightsIndices.push(l[m*4+3])),t.color&&(e.colors.push(o[p*3]),e.colors.push(o[p*3+1]),e.colors.push(o[p*3+2]),e.colors.push(o[g*3]),e.colors.push(o[g*3+1]),e.colors.push(o[g*3+2]),e.colors.push(o[m*3]),e.colors.push(o[m*3+1]),e.colors.push(o[m*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[p*3]),e.normal.push(i[p*3+1]),e.normal.push(i[p*3+2]),e.normal.push(i[g*3]),e.normal.push(i[g*3+1]),e.normal.push(i[g*3+2]),e.normal.push(i[m*3]),e.normal.push(i[m*3+1]),e.normal.push(i[m*3+2])),t.uv&&t.uv.forEach(function(I,b){e.uvs[b]===void 0&&(e.uvs[b]=[]),e.uvs[b].push(a[b][p*2]),e.uvs[b].push(a[b][p*2+1]),e.uvs[b].push(a[b][g*2]),e.uvs[b].push(a[b][g*2+1]),e.uvs[b].push(a[b][m*2]),e.uvs[b].push(a[b][m*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(a){const A=oe.Objects.Geometry[a.geoID];A!==void 0&&i.genMorphGeometry(e,t,A,n,a.name)})})}genMorphGeometry(e,t,s,n,i){const o=t.Vertices!==void 0?t.Vertices.a:[],a=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 p={vertexIndices:a,vertexPositions:u,baseVertexPositions:o},g=this.genBuffers(p),m=new r.Float32BufferAttribute(g.vertex,3);m.name=i||s.attrName,m.applyMatrix4(n),e.morphAttributes.position.push(m)}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,a=new r.Color;o<n.length;o+=4)a.fromArray(n,o),r.ColorManagement.toWorkingColorSpace(a,r.SRGBColorSpace),a.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 r.BufferGeometry;const s=t-1,n=e.KnotVector.a,i=[],o=e.Points.a;for(let u=0,p=o.length;u<p;u+=4)i.push(new r.Vector4().fromArray(o,u));let a,A;if(e.Form==="Closed")i.push(i[0]);else if(e.Form==="Periodic"){a=s,A=n.length-1-a;for(let u=0;u<s;++u)i.push(i[u])}const h=new ya(s,n,i,a,A).getPoints(i.length*12);return new r.BufferGeometry().setFromPoints(h)}}class Sa{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(oe.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=oe.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=oe.Objects.AnimationCurve;for(const s in t){const n={id:t[s].id,times:t[s].KeyTime.a.map(Da),values:t[s].KeyValueFloat.a},i=we.get(n.id);if(i!==void 0){const o=i.parents[0].ID,a=i.parents[0].relationship;a.match(/X/)?e.get(o).curves.x=n:a.match(/Y/)?e.get(o).curves.y=n:a.match(/Z/)?e.get(o).curves.z=n:a.match(/DeformPercent/)&&e.has(o)&&(e.get(o).curves.morph=n)}}}parseAnimationLayers(e){const t=oe.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(p){return p.relationship!==void 0})[0].ID;if(u!==void 0){const p=oe.Objects.Model[u.toString()];if(p===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",A);return}const g={modelName:p.attrName?r.PropertyBinding.sanitizeNodeName(p.attrName):"",ID:p.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};ke.traverse(function(m){m.ID===p.id&&(g.transform=m.matrix,m.userData.transformData&&(g.eulerOrder=m.userData.transformData.eulerOrder))}),g.transform||(g.transform=new r.Matrix4),"PreRotation"in p&&(g.preRotation=p.PreRotation.value),"PostRotation"in p&&(g.postRotation=p.PostRotation.value),i[l]=g}}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(B){return B.relationship!==void 0})[0].ID,p=we.get(u).parents[0].ID,g=we.get(p).parents[0].ID,m=we.get(g).parents[0].ID,I=oe.Objects.Model[m],b={modelName:I.attrName?r.PropertyBinding.sanitizeNodeName(I.attrName):"",morphName:oe.Objects.Deformer[u].attrName};i[l]=b}i[l][h.attr]=h}}}),s.set(parseInt(n),i))}return s}parseAnimStacks(e){const t=oe.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 r.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let s=new r.Vector3,n=new r.Vector3;if(e.transform&&e.transform.decompose(s,new r.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 r.VectorKeyframeTrack(e+"."+n,i,o)}generateRotationTrack(e,t,s,n,i){let o,a;if(t.x===void 0||t.y===void 0||t.z===void 0){console.warn("THREE.FBXLoader: Missing rotation curves "+(t.x===void 0?"x ":"")+(t.y===void 0?"y ":"")+(t.z===void 0?"z ":"")+" for animation of "+e+". This is currently not supported.");return}if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const p=this.interpolateRotations(t.x,t.y,t.z,i);o=p[0],a=p[1]}const A=Xt(0);s!==void 0&&(s=s.map(r.MathUtils.degToRad),s.push(A),s=new r.Euler().fromArray(s),s=new r.Quaternion().setFromEuler(s)),n!==void 0&&(n=n.map(r.MathUtils.degToRad),n.push(A),n=new r.Euler().fromArray(n),n=new r.Quaternion().setFromEuler(n).invert());const l=new r.Quaternion,h=new r.Euler,u=[];if(!(!a||!o)){for(let p=0;p<a.length;p+=3)h.set(a[p],a[p+1],a[p+2],i),l.setFromEuler(h),s!==void 0&&l.premultiply(s),n!==void 0&&l.multiply(n),p>2&&new r.Quaternion().fromArray(u,(p-3)/3*4).dot(l)<0&&l.set(-l.x,-l.y,-l.z,-l.w),l.toArray(u,p/3*4);return new r.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 r.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,a=-1,A=-1;return e.forEach(function(l){if(t.x&&(o=t.x.times.indexOf(l)),t.y&&(a=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(a!==-1){const h=t.y.values[a];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(r.MathUtils.degToRad(e.values[0])),o.push(r.MathUtils.degToRad(t.values[0])),o.push(r.MathUtils.degToRad(s.values[0]));for(let a=1;a<e.values.length;a++){const A=[e.values[a-1],t.values[a-1],s.values[a-1]];if(isNaN(A[0])||isNaN(A[1])||isNaN(A[2]))continue;const l=A.map(r.MathUtils.degToRad),h=[e.values[a],t.values[a],s.values[a]];if(isNaN(h[0])||isNaN(h[1])||isNaN(h[2]))continue;const u=h.map(r.MathUtils.degToRad),p=[h[0]-A[0],h[1]-A[1],h[2]-A[2]],g=[Math.abs(p[0]),Math.abs(p[1]),Math.abs(p[2])];if(g[0]>=180||g[1]>=180||g[2]>=180){const I=Math.max(...g)/180,b=new r.Euler(...l,n),B=new r.Euler(...u,n),w=new r.Quaternion().setFromEuler(b),C=new r.Quaternion().setFromEuler(B);w.dot(C)&&C.set(-C.x,-C.y,-C.z,-C.w);const y=e.times[a-1],x=e.times[a]-y,R=new r.Quaternion,D=new r.Euler;for(let S=0;S<1;S+=1/I)R.copy(w.clone().slerp(C.clone(),S)),i.push(y+S*x),D.setFromQuaternion(R,n),o.push(D.x),o.push(D.y),o.push(D.z)}else i.push(e.times[a]),o.push(r.MathUtils.degToRad(e.values[a])),o.push(r.MathUtils.degToRad(t.values[a])),o.push(r.MathUtils.degToRad(s.values[a]))}return[i,o]}}class Ta{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 Ni,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]*;/),a=n.match(/^[\s\t]*$/);if(o||a)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),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(s,i):s in a?(s==="PoseNode"?a.PoseNode.push(i):a[s].id!==void 0&&(a[s]={},a[s][a[s].id]=a[s]),o.id!==""&&(a[s][o.id]=i)):typeof o.id=="number"?(a[s]={},a[s][o.id]=i):s!=="Properties70"&&(s==="PoseNode"?a[s]=[i]:a[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(p){return p.trim().replace(/^"/,"")}),n="connections",i=[l,h],Fa(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=_n(i))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=_n(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],a=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=_n(l);break}this.getPrevNode()[i]={type:o,type2:a,flag:A,value:l},this.setCurrentProp(this.getPrevNode(),i)}}class va{parse(e){const t=new Fs(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 Ni;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(),a=e.getString(o);if(n===0)return null;const A=[];for(let p=0;p<i;p++)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 p=this.parseNode(e,t);p!==null&&this.parseSubNode(a,s,p)}return s.propertyList=A,typeof l=="number"&&(s.id=l),h!==""&&(s.attrName=h),u!==""&&(s.attrType=u),a!==""&&(s.name=a),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],a=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:a,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 a=Vt(new Uint8Array(e.getArrayBuffer(o))),A=new Fs(a.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 Fs{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 Ni{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 Ra(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 Ls(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 Da(c){return c/46186158e3}const _a=[];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 La(_a,s.buffer,i,o)}const Dn=new r.Euler,Tt=new r.Vector3;function Ui(c){const e=new r.Matrix4,t=new r.Matrix4,s=new r.Matrix4,n=new r.Matrix4,i=new r.Matrix4,o=new r.Matrix4,a=new r.Matrix4,A=new r.Matrix4,l=new r.Matrix4,h=new r.Matrix4,u=new r.Matrix4,p=new r.Matrix4,g=c.inheritType?c.inheritType:0;c.translation&&e.setPosition(Tt.fromArray(c.translation));const m=Xt(0);if(c.preRotation){const G=c.preRotation.map(r.MathUtils.degToRad);G.push(m),t.makeRotationFromEuler(Dn.fromArray(G))}if(c.rotation){const G=c.rotation.map(r.MathUtils.degToRad);G.push(c.eulerOrder||m),s.makeRotationFromEuler(Dn.fromArray(G))}if(c.postRotation){const G=c.postRotation.map(r.MathUtils.degToRad);G.push(m),n.makeRotationFromEuler(Dn.fromArray(G)),n.invert()}c.scale&&i.scale(Tt.fromArray(c.scale)),c.scalingOffset&&a.setPosition(Tt.fromArray(c.scalingOffset)),c.scalingPivot&&o.setPosition(Tt.fromArray(c.scalingPivot)),c.rotationOffset&&A.setPosition(Tt.fromArray(c.rotationOffset)),c.rotationPivot&&l.setPosition(Tt.fromArray(c.rotationPivot)),c.parentMatrixWorld&&(u.copy(c.parentMatrix),h.copy(c.parentMatrixWorld));const I=t.clone().multiply(s).multiply(n),b=new r.Matrix4;b.extractRotation(h);const B=new r.Matrix4;B.copyPosition(h);const w=B.clone().invert().multiply(h),C=b.clone().invert().multiply(w),y=i,x=new r.Matrix4;if(g===0)x.copy(b).multiply(I).multiply(C).multiply(y);else if(g===1)x.copy(b).multiply(C).multiply(I).multiply(y);else{const H=new r.Matrix4().scale(new r.Vector3().setFromMatrixScale(u)).clone().invert(),X=C.clone().multiply(H);x.copy(b).multiply(I).multiply(X).multiply(y)}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(a).multiply(o).multiply(i).multiply(D);const v=new r.Matrix4().copyPosition(S),U=h.clone().multiply(v);return p.copyPosition(U),S=p.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 _n(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 Fa(c,e){for(let t=0,s=c.length,n=e.length;t<n;t++,s++)c[s]=e[t]}function La(c,e,t,s){for(let n=t,i=0;n<s;n++,i++)c[i]=e[n];return c}class ka extends r.Loader{constructor(e){super(e)}load(e,t,s,n){const i=this,o=this.path===""?r.LoaderUtils.extractUrlBase(e):this.path,a=new r.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.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(`
41
41
  `);let n={};const i=/\s+/,o={};for(let A=0;A<s.length;A++){let l=s[A];if(l=l.trim(),l.length===0||l.charAt(0)==="#")continue;const h=l.indexOf(" ");let u=h>=0?l.substring(0,h):l;u=u.toLowerCase();let p=h>=0?l.substring(h+1):"";if(p=p.trim(),u==="newmtl")n={name:p},o[p]=n;else if(u==="ka"||u==="kd"||u==="ks"||u==="ke"){const g=p.split(i,3);n[u]=[parseFloat(g[0]),parseFloat(g[1]),parseFloat(g[2])]}else n[u]=p}const a=new Ga(this.resourcePath||t,this.materialOptions);return a.setCrossOrigin(this.crossOrigin),a.setManager(this.manager),a.setMaterials(o),a}}class Ga{constructor(e="",t={}){this.baseUrl=e,this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:r.FrontSide,this.wrap=this.options.wrap!==void 0?this.options.wrap:r.RepeatWrapping}setCrossOrigin(e){return this.crossOrigin=e,this}setManager(e){this.manager=e}setMaterials(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(e){if(!this.options)return e;const t={};for(const s in e){const n=e[s],i={};t[s]=i;for(const o in n){let a=!0,A=n[o];const l=o.toLowerCase();switch(l){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(A=[A[0]/255,A[1]/255,A[2]/255]),this.options&&this.options.ignoreZeroRGBs&&A[0]===0&&A[1]===0&&A[2]===0&&(a=!1);break}a&&(i[l]=A)}}return t}preload(){for(const e in this.materialsInfo)this.create(e)}getIndex(e){return this.nameLookup[e]}getAsArray(){let e=0;for(const t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray}create(e){return this.materials[e]===void 0&&this.createMaterial_(e),this.materials[e]}createMaterial_(e){const t=this,s=this.materialsInfo[e],n={name:e,side:this.side};function i(a,A){return typeof A!="string"||A===""?"":/^https?:\/\//i.test(A)?A:a+A}function o(a,A){if(n[a])return;const l=t.getTextureParams(A,n),h=t.loadTexture(i(t.baseUrl,l.url));h.repeat.copy(l.scale),h.offset.copy(l.offset),h.wrapS=t.wrap,h.wrapT=t.wrap,(a==="map"||a==="emissiveMap")&&(h.colorSpace=r.SRGBColorSpace),n[a]=h}for(const a in s){const A=s[a];let l;if(A!=="")switch(a.toLowerCase()){case"kd":n.color=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(A),r.SRGBColorSpace);break;case"ks":n.specular=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(A),r.SRGBColorSpace);break;case"ke":n.emissive=r.ColorManagement.toWorkingColorSpace(new r.Color().fromArray(A),r.SRGBColorSpace);break;case"map_kd":o("map",A);break;case"map_ks":o("specularMap",A);break;case"map_ke":o("emissiveMap",A);break;case"norm":o("normalMap",A);break;case"map_bump":case"bump":o("bumpMap",A);break;case"map_d":o("alphaMap",A),n.transparent=!0;break;case"ns":n.shininess=parseFloat(A);break;case"d":l=parseFloat(A),l<1&&(n.opacity=l,n.transparent=!0);break;case"tr":l=parseFloat(A),this.options&&this.options.invertTrProperty&&(l=1-l),l>0&&(n.opacity=1-l,n.transparent=!0);break}}return this.materials[e]=new r.MeshPhongMaterial(n),this.materials[e]}getTextureParams(e,t){const s={scale:new r.Vector2(1,1),offset:new r.Vector2(0,0)},n=e.split(/\s+/);let i;return i=n.indexOf("-bm"),i>=0&&(t.bumpScale=parseFloat(n[i+1]),n.splice(i,2)),i=n.indexOf("-s"),i>=0&&(s.scale.set(parseFloat(n[i+1]),parseFloat(n[i+2])),n.splice(i,4)),i=n.indexOf("-o"),i>=0&&(s.offset.set(parseFloat(n[i+1]),parseFloat(n[i+2])),n.splice(i,4)),s.url=n.join(" ").trim(),s}loadTexture(e,t,s,n,i){const o=this.manager!==void 0?this.manager:r.DefaultLoadingManager;let a=o.getHandler(e);a===null&&(a=new r.TextureLoader(o)),a.setCrossOrigin&&a.setCrossOrigin(this.crossOrigin);const A=a.load(e,s,n,i);return t!==void 0&&(A.mapping=t),A}}const Na=/^[og]\s*(.+)?/,Ua=/^mtllib /,Pa=/^usemtl /,Oa=/^usemap /,ks=/\s+/,Gs=new r.Vector3,Fn=new r.Vector3,Ns=new r.Vector3,Us=new r.Vector3,Je=new r.Vector3,on=new r.Color;function Ha(){const c={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&this.object.fromDeclaration===!1){this.object.name=e,this.object.fromDeclaration=t!==!1;return}const s=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:t!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(n,i){const o=this._finalize(!1);o&&(o.inherited||o.groupCount<=0)&&this.materials.splice(o.index,1);const a={index:this.materials.length,name:n||"",mtllib:Array.isArray(i)&&i.length>0?i[i.length-1]:"",smooth:o!==void 0?o.smooth:this.smooth,groupStart:o!==void 0?o.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(A){const l={index:typeof A=="number"?A:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return l.clone=this.clone.bind(l),l}};return this.materials.push(a),a},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(n){const i=this.currentMaterial();if(i&&i.groupEnd===-1&&(i.groupEnd=this.geometry.vertices.length/3,i.groupCount=i.groupEnd-i.groupStart,i.inherited=!1),n&&this.materials.length>1)for(let o=this.materials.length-1;o>=0;o--)this.materials[o].groupCount<=0&&this.materials.splice(o,1);return n&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),i}},s&&s.name&&typeof s.clone=="function"){const n=s.clone(0);n.inherited=!0,this.object.materials.push(n)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/3)*3},parseNormalIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/3)*3},parseUVIndex:function(e,t){const s=parseInt(e,10);return(s>=0?s-1:s+t/2)*2},addVertex:function(e,t,s){const n=this.vertices,i=this.object.geometry.vertices;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[s+0],n[s+1],n[s+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,s){const n=this.normals,i=this.object.geometry.normals;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[s+0],n[s+1],n[s+2])},addFaceNormal:function(e,t,s){const n=this.vertices,i=this.object.geometry.normals;Gs.fromArray(n,e),Fn.fromArray(n,t),Ns.fromArray(n,s),Je.subVectors(Ns,Fn),Us.subVectors(Gs,Fn),Je.cross(Us),Je.normalize(),i.push(Je.x,Je.y,Je.z),i.push(Je.x,Je.y,Je.z),i.push(Je.x,Je.y,Je.z)},addColor:function(e,t,s){const n=this.colors,i=this.object.geometry.colors;n[e]!==void 0&&i.push(n[e+0],n[e+1],n[e+2]),n[t]!==void 0&&i.push(n[t+0],n[t+1],n[t+2]),n[s]!==void 0&&i.push(n[s+0],n[s+1],n[s+2])},addUV:function(e,t,s){const n=this.uvs,i=this.object.geometry.uvs;i.push(n[e+0],n[e+1]),i.push(n[t+0],n[t+1]),i.push(n[s+0],n[s+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,s,n,i,o,a,A,l){const h=this.vertices.length;let u=this.parseVertexIndex(e,h),p=this.parseVertexIndex(t,h),g=this.parseVertexIndex(s,h);if(this.addVertex(u,p,g),this.addColor(u,p,g),a!==void 0&&a!==""){const m=this.normals.length;u=this.parseNormalIndex(a,m),p=this.parseNormalIndex(A,m),g=this.parseNormalIndex(l,m),this.addNormal(u,p,g)}else this.addFaceNormal(u,p,g);if(n!==void 0&&n!==""){const m=this.uvs.length;u=this.parseUVIndex(n,m),p=this.parseUVIndex(i,m),g=this.parseUVIndex(o,m),this.addUV(u,p,g),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let s=0,n=e.length;s<n;s++){const i=this.parseVertexIndex(e[s],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const s=this.vertices.length,n=this.uvs.length;for(let i=0,o=e.length;i<o;i++)this.addVertexLine(this.parseVertexIndex(e[i],s));for(let i=0,o=t.length;i<o;i++)this.addUVLine(this.parseUVIndex(t[i],n))}};return c.startObject("",!1),c}class ja extends r.Loader{constructor(e){super(e),this.materials=null,this.materialsLoader=new ka(e)}load(e,t,s,n){const i=this,o=new r.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,async function(a){try{const A=i.parse(a,!0);for(let l=0,h=A.materialLibraries.length;l<h;l++){const u=A.materialLibraries[l],p=e.startsWith("blob:")?e+"/"+u:new URL(u,e);console.debug("Loading MTL file: "+p),await new Promise((g,m)=>{i.materialsLoader.load(p.toString(),I=>{i.setMaterials(I),g()},null,m)})}t(i.createObjects(A))}catch(A){n?n(A):console.error(A),i.manager.itemError(e)}},s,n)}setMTLLoader(e){return this.materialsLoader=e,this}setMaterials(e){return this.materials=e,this}parse(e,t=!1){const s=new Ha;e.indexOf(`\r
42
42
  `)!==-1&&(e=e.replace(/\r\n/g,`
43
43
  `)),e.indexOf(`\\