@shopware-ag/dive 2.2.22 → 2.2.24

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 (27) hide show
  1. package/build/chunks/{AssetCache-DId1aPWv.cjs → AssetCache-BvteEWMc.cjs} +1 -1
  2. package/build/chunks/{AssetCache-B65duc9h.mjs → AssetCache-CT7yQAu0.mjs} +1 -1
  3. package/build/chunks/{AssetLoader-BjQS3voP.cjs → AssetLoader-C8es4ZuG.cjs} +1 -1
  4. package/build/chunks/{AssetLoader-CCpaemfb.mjs → AssetLoader-CIsnnlqu.mjs} +2 -2
  5. package/build/chunks/{FileTypes-D4Kace9O.cjs → FileTypes-CjUNNEmP.cjs} +1 -1
  6. package/build/chunks/{FileTypes-owHHIk7N.mjs → FileTypes-D_r2gn3i.mjs} +1 -1
  7. package/build/chunks/{SelectTool-DBSU9mHL.cjs → SelectTool-C-G8iiqX.cjs} +1 -1
  8. package/build/chunks/{SelectTool-D6UFvpld.mjs → SelectTool-CP-RUr3R.mjs} +1 -1
  9. package/build/dive.cjs +1 -1
  10. package/build/dive.mjs +1 -1
  11. package/build/plugins/ar/index.cjs +1 -1
  12. package/build/plugins/ar/index.mjs +1 -1
  13. package/build/plugins/assetcache/index.cjs +1 -1
  14. package/build/plugins/assetcache/index.mjs +1 -1
  15. package/build/plugins/assetloader/index.cjs +1 -1
  16. package/build/plugins/assetloader/index.mjs +1 -1
  17. package/build/plugins/orbitcontroller/index.cjs +1 -1
  18. package/build/plugins/orbitcontroller/index.mjs +1 -1
  19. package/build/plugins/orientationdisplay/index.cjs +1 -1
  20. package/build/plugins/orientationdisplay/index.mjs +1 -1
  21. package/build/plugins/quickview/index.cjs +1 -1
  22. package/build/plugins/quickview/index.mjs +1 -1
  23. package/build/plugins/state/index.cjs +8 -8
  24. package/build/plugins/state/index.mjs +429 -412
  25. package/build/plugins/toolbox/index.cjs +1 -1
  26. package/build/plugins/toolbox/index.mjs +2 -2
  27. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";var n=Object.defineProperty;var u=(s,e,t)=>e in s?n(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var r=(s,e,t)=>u(s,typeof e!="symbol"?e+"":e,t);require("./FileTypes-D4Kace9O.cjs");require("three");const h=require("./network-error-CdDXil5g.cjs");class c{constructor(e){r(this,"_promise");r(this,"_resolve");r(this,"_arrayBuffer",null);r(this,"_size",0);r(this,"_createdAt");r(this,"_updatedAt");this._uri=e,this._promise=new Promise(t=>{this._resolve=t}),this._createdAt=new Date,this._updatedAt=new Date}get promise(){return this._promise}get size(){return this._size}get createdAt(){return this._createdAt}get updatedAt(){return this._updatedAt}get arrayBuffer(){return this._arrayBuffer}async load(){const e=await fetch(this._uri);if(!e.ok)throw new h.NetworkError(this._uri);try{this._arrayBuffer=await e.arrayBuffer(),this._size+=this._arrayBuffer.byteLength,this._updatedAt=new Date}catch{throw new h.FileContentError(this._uri)}return this._resolve(this._arrayBuffer),this._arrayBuffer}}class o{constructor(){r(this,"_cache",new Map)}get(){return this._cache}create(e){const t=new c(e);return this._cache.set(e,t),t}write(e,t){this._cache.set(e,t)}read(e){return this._cache.get(e)??null}delete(...e){e.forEach(t=>{this._cache.delete(t)})}clear(){this._cache.clear()}}const a=Symbol.for("@shopware-ag/dive/assetcache"),i=globalThis;i[a]||(i[a]=new o);const _=i[a];exports.AssetCache=_;exports.Chunk=c;
1
+ "use strict";var n=Object.defineProperty;var u=(s,e,t)=>e in s?n(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var r=(s,e,t)=>u(s,typeof e!="symbol"?e+"":e,t);require("./FileTypes-CjUNNEmP.cjs");require("three");const h=require("./network-error-CdDXil5g.cjs");class c{constructor(e){r(this,"_promise");r(this,"_resolve");r(this,"_arrayBuffer",null);r(this,"_size",0);r(this,"_createdAt");r(this,"_updatedAt");this._uri=e,this._promise=new Promise(t=>{this._resolve=t}),this._createdAt=new Date,this._updatedAt=new Date}get promise(){return this._promise}get size(){return this._size}get createdAt(){return this._createdAt}get updatedAt(){return this._updatedAt}get arrayBuffer(){return this._arrayBuffer}async load(){const e=await fetch(this._uri);if(!e.ok)throw new h.NetworkError(this._uri);try{this._arrayBuffer=await e.arrayBuffer(),this._size+=this._arrayBuffer.byteLength,this._updatedAt=new Date}catch{throw new h.FileContentError(this._uri)}return this._resolve(this._arrayBuffer),this._arrayBuffer}}class o{constructor(){r(this,"_cache",new Map)}get(){return this._cache}create(e){const t=new c(e);return this._cache.set(e,t),t}write(e,t){this._cache.set(e,t)}read(e){return this._cache.get(e)??null}delete(...e){e.forEach(t=>{this._cache.delete(t)})}clear(){this._cache.clear()}}const a=Symbol.for("@shopware-ag/dive/assetcache"),i=globalThis;i[a]||(i[a]=new o);const _=i[a];exports.AssetCache=_;exports.Chunk=c;
@@ -1,7 +1,7 @@
1
1
  var h = Object.defineProperty;
2
2
  var c = (s, e, t) => e in s ? h(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
3
  var r = (s, e, t) => c(s, typeof e != "symbol" ? e + "" : e, t);
4
- import "./FileTypes-owHHIk7N.mjs";
4
+ import "./FileTypes-D_r2gn3i.mjs";
5
5
  import "three";
6
6
  import { N as o, F as _ } from "./network-error-BONfHWQq.mjs";
7
7
  class n {
@@ -1,4 +1,4 @@
1
- "use strict";var le=Object.defineProperty;var ue=(h,e,t)=>e in h?le(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t;var k=(h,e,t)=>ue(h,typeof e!="symbol"?e+"":e,t);const f=require("three"),v=require("./fflate.module-DHdJvhNh.cjs"),fe=require("./FileTypes-D4Kace9O.cjs"),Q=require("./isFileTypeSupported-CrEqYiv9.cjs"),U=require("./parse-error-Dy_EE4rL.cjs"),B=require("./AssetCache-DId1aPWv.cjs");function Z(h,e){if(e===f.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),h;if(e===f.TriangleFanDrawMode||e===f.TriangleStripDrawMode){let t=h.getIndex();if(t===null){const s=[],a=h.getAttribute("position");if(a!==void 0){for(let i=0;i<a.count;i++)s.push(i);h.setIndex(s),t=h.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),h}const r=t.count-2,n=[];if(e===f.TriangleFanDrawMode)for(let s=1;s<=r;s++)n.push(t.getX(0)),n.push(t.getX(s)),n.push(t.getX(s+1));else for(let s=0;s<r;s++)s%2===0?(n.push(t.getX(s)),n.push(t.getX(s+1)),n.push(t.getX(s+2))):(n.push(t.getX(s+2)),n.push(t.getX(s+1)),n.push(t.getX(s)));n.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=h.clone();return o.setIndex(n),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),h}class de extends f.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Ae(t)}),this.register(function(t){return new Ee(t)}),this.register(function(t){return new be(t)}),this.register(function(t){return new Me(t)}),this.register(function(t){return new ye(t)}),this.register(function(t){return new Re(t)}),this.register(function(t){return new xe(t)}),this.register(function(t){return new _e(t)}),this.register(function(t){return new ge(t)}),this.register(function(t){return new Se(t)}),this.register(function(t){return new Te(t)}),this.register(function(t){return new Le(t)}),this.register(function(t){return new we(t)}),this.register(function(t){return new pe(t)}),this.register(function(t){return new Ce(t)}),this.register(function(t){return new Ie(t)})}load(e,t,r,n){const o=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const c=f.LoaderUtils.extractUrlBase(e);s=f.LoaderUtils.resolveURL(c,this.path)}else s=f.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){n?n(c):console.error(c),o.manager.itemError(e),o.manager.itemEnd(e)},i=new f.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,function(c){try{o.parse(c,s,function(l){t(l),o.manager.itemEnd(e)},a)}catch(l){a(l)}},r,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,n){let o;const s={},a={},i=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(i.decode(new Uint8Array(e,0,4))===se){try{s[b.KHR_BINARY_GLTF]=new Ne(e)}catch(u){n&&n(u);return}o=JSON.parse(s[b.KHR_BINARY_GLTF].content)}else o=JSON.parse(i.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Ve(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let l=0;l<this.pluginCallbacks.length;l++){const u=this.pluginCallbacks[l](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,s[u.name]=!0}if(o.extensionsUsed)for(let l=0;l<o.extensionsUsed.length;++l){const u=o.extensionsUsed[l],d=o.extensionsRequired||[];switch(u){case b.KHR_MATERIALS_UNLIT:s[u]=new me;break;case b.KHR_DRACO_MESH_COMPRESSION:s[u]=new De(o,this.dracoLoader);break;case b.KHR_TEXTURE_TRANSFORM:s[u]=new Oe;break;case b.KHR_MESH_QUANTIZATION:s[u]=new Pe;break;default:d.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(s),c.setPlugins(a),c.parse(r,n)}parseAsync(e,t){const r=this;return new Promise(function(n,o){r.parse(e,t,n,o)})}}function he(){let h={};return{get:function(e){return h[e]},add:function(e,t){h[e]=t},remove:function(e){delete h[e]},removeAll:function(){h={}}}}const b={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_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 pe{constructor(e){this.parser=e,this.name=b.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,n=t.length;r<n;r++){const o=t[r];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let n=t.cache.get(r);if(n)return n;const o=t.json,i=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let c;const l=new f.Color(16777215);i.color!==void 0&&l.setRGB(i.color[0],i.color[1],i.color[2],f.LinearSRGBColorSpace);const u=i.range!==void 0?i.range:0;switch(i.type){case"directional":c=new f.DirectionalLight(l),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new f.PointLight(l),c.distance=u;break;case"spot":c=new f.SpotLight(l),c.distance=u,i.spot=i.spot||{},i.spot.innerConeAngle=i.spot.innerConeAngle!==void 0?i.spot.innerConeAngle:0,i.spot.outerConeAngle=i.spot.outerConeAngle!==void 0?i.spot.outerConeAngle:Math.PI/4,c.angle=i.spot.outerConeAngle,c.penumbra=1-i.spot.innerConeAngle/i.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+i.type)}return c.position.set(0,0,0),c.decay=2,O(c,i),i.intensity!==void 0&&(c.intensity=i.intensity),c.name=t.createUniqueName(i.name||"light_"+e),n=Promise.resolve(c),t.cache.add(r,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,o=r.json.nodes[e],a=(o.extensions&&o.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(i){return r._getNodeRef(t.cache,a,i)})}}class me{constructor(){this.name=b.KHR_MATERIALS_UNLIT}getMaterialType(){return f.MeshBasicMaterial}extendParams(e,t,r){const n=[];e.color=new f.Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const s=o.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],f.LinearSRGBColorSpace),e.opacity=s[3]}o.baseColorTexture!==void 0&&n.push(r.assignTexture(e,"map",o.baseColorTexture,f.SRGBColorSpace))}return Promise.all(n)}}class ge{constructor(e){this.parser=e,this.name=b.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 o=n.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class Ae{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&o.push(r.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&o.push(r.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(o.push(r.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const a=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new f.Vector2(a,a)}return Promise.all(o)}}class Te{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&o.push(r.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&o.push(r.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(o)}}class ye{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_SHEEN}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new f.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=n.extensions[this.name];if(s.sheenColorFactor!==void 0){const a=s.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],f.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&o.push(r.assignTexture(t,"sheenColorMap",s.sheenColorTexture,f.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&o.push(r.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(o)}}class Re{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&o.push(r.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(o)}}class xe{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_VOLUME}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&o.push(r.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return t.attenuationColor=new f.Color().setRGB(a[0],a[1],a[2],f.LinearSRGBColorSpace),Promise.all(o)}}class _e{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_IOR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=n.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class Se{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_SPECULAR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&o.push(r.assignTexture(t,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return t.specularColor=new f.Color().setRGB(a[0],a[1],a[2],f.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&o.push(r.assignTexture(t,"specularColorMap",s.specularColorTexture,f.SRGBColorSpace)),Promise.all(o)}}class we{constructor(e){this.parser=e,this.name=b.EXT_MATERIALS_BUMP}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];return t.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&o.push(r.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(o)}}class Le{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&o.push(r.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(o)}}class Ee{constructor(e){this.parser=e,this.name=b.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,n=r.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const o=n.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,s)}}class be{constructor(e){this.parser=e,this.name=b.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,n=r.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const s=o.extensions[t],a=n.images[s.source];let i=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(i=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,s.source,i);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.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 Me{constructor(e){this.parser=e,this.name=b.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,n=r.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const s=o.extensions[t],a=n.images[s.source];let i=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(i=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,s.source,i);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.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 Ce{constructor(e){this.name=b.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const n=r.extensions[this.name],o=this.parser.getDependency("buffer",n.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(a){const i=n.byteOffset||0,c=n.byteLength||0,l=n.count,u=n.byteStride,d=new Uint8Array(a,i,c);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(l,u,d,n.mode,n.filter).then(function(g){return g.buffer}):s.ready.then(function(){const g=new ArrayBuffer(l*u);return s.decodeGltfBuffer(new Uint8Array(g),l,u,d,n.mode,n.filter),g})})}else return null}}class Ie{constructor(e){this.name=b.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const n=t.meshes[r.mesh];for(const c of n.primitives)if(c.mode!==N.TRIANGLES&&c.mode!==N.TRIANGLE_STRIP&&c.mode!==N.TRIANGLE_FAN&&c.mode!==void 0)return null;const s=r.extensions[this.name].attributes,a=[],i={};for(const c in s)a.push(this.parser.getDependency("accessor",s[c]).then(l=>(i[c]=l,i[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const l=c.pop(),u=l.isGroup?l.children:[l],d=c[0].count,g=[];for(const y of u){const _=new f.Matrix4,R=new f.Vector3,x=new f.Quaternion,L=new f.Vector3(1,1,1),E=new f.InstancedMesh(y.geometry,y.material,d);for(let S=0;S<d;S++)i.TRANSLATION&&R.fromBufferAttribute(i.TRANSLATION,S),i.ROTATION&&x.fromBufferAttribute(i.ROTATION,S),i.SCALE&&L.fromBufferAttribute(i.SCALE,S),E.setMatrixAt(S,_.compose(R,x,L));for(const S in i)if(S==="_COLOR_0"){const C=i[S];E.instanceColor=new f.InstancedBufferAttribute(C.array,C.itemSize,C.normalized)}else S!=="TRANSLATION"&&S!=="ROTATION"&&S!=="SCALE"&&y.geometry.setAttribute(S,i[S]);f.Object3D.prototype.copy.call(E,y),this.parser.assignFinalMaterial(E),g.push(E)}return l.isGroup?(l.clear(),l.add(...g),l):g[0]}))}}const se="glTF",G=12,$={JSON:1313821514,BIN:5130562};class Ne{constructor(e){this.name=b.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,G),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==se)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-G,o=new DataView(e,G);let s=0;for(;s<n;){const a=o.getUint32(s,!0);s+=4;const i=o.getUint32(s,!0);if(s+=4,i===$.JSON){const c=new Uint8Array(e,G+s,a);this.content=r.decode(c)}else if(i===$.BIN){const c=G+s;this.body=e.slice(c,c+a)}s+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class De{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=b.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,n=this.dracoLoader,o=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,a={},i={},c={};for(const l in s){const u=q[l]||l.toLowerCase();a[u]=s[l]}for(const l in e.attributes){const u=q[l]||l.toLowerCase();if(s[l]!==void 0){const d=r.accessors[e.attributes[l]],g=F[d.componentType];c[u]=g.name,i[u]=d.normalized===!0}}return t.getDependency("bufferView",o).then(function(l){return new Promise(function(u,d){n.decodeDracoFile(l,function(g){for(const y in g.attributes){const _=g.attributes[y],R=i[y];R!==void 0&&(_.normalized=R)}u(g)},a,c,f.LinearSRGBColorSpace,d)})})}}class Oe{constructor(){this.name=b.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 Pe{constructor(){this.name=b.KHR_MESH_QUANTIZATION}}class re extends f.Interpolant{constructor(e,t,r,n){super(e,t,r,n)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,o=e*n*3+n;for(let s=0;s!==n;s++)t[s]=r[o+s];return t}interpolate_(e,t,r,n){const o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,i=a*2,c=a*3,l=n-t,u=(r-t)/l,d=u*u,g=d*u,y=e*c,_=y-c,R=-2*g+3*d,x=g-d,L=1-R,E=x-d+u;for(let S=0;S!==a;S++){const C=s[_+S+a],I=s[_+S+i]*l,M=s[y+S+a],p=s[y+S]*l;o[S]=L*C+E*I+R*M+x*p}return o}}const ke=new f.Quaternion;class Fe extends re{interpolate_(e,t,r,n){const o=super.interpolate_(e,t,r,n);return ke.fromArray(o).normalize().toArray(o),o}}const N={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},F={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ee={9728:f.NearestFilter,9729:f.LinearFilter,9984:f.NearestMipmapNearestFilter,9985:f.LinearMipmapNearestFilter,9986:f.NearestMipmapLinearFilter,9987:f.LinearMipmapLinearFilter},te={33071:f.ClampToEdgeWrapping,33648:f.MirroredRepeatWrapping,10497:f.RepeatWrapping},j={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},q={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"},D={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ge={CUBICSPLINE:void 0,LINEAR:f.InterpolateLinear,STEP:f.InterpolateDiscrete},K={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ue(h){return h.DefaultMaterial===void 0&&(h.DefaultMaterial=new f.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:f.FrontSide})),h.DefaultMaterial}function P(h,e,t){for(const r in t.extensions)h[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=t.extensions[r])}function O(h,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(h.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Be(h,e,t){let r=!1,n=!1,o=!1;for(let c=0,l=e.length;c<l;c++){const u=e[c];if(u.POSITION!==void 0&&(r=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(o=!0),r&&n&&o)break}if(!r&&!n&&!o)return Promise.resolve(h);const s=[],a=[],i=[];for(let c=0,l=e.length;c<l;c++){const u=e[c];if(r){const d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):h.attributes.position;s.push(d)}if(n){const d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):h.attributes.normal;a.push(d)}if(o){const d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):h.attributes.color;i.push(d)}}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(i)]).then(function(c){const l=c[0],u=c[1],d=c[2];return r&&(h.morphAttributes.position=l),n&&(h.morphAttributes.normal=u),o&&(h.morphAttributes.color=d),h.morphTargetsRelative=!0,h})}function He(h,e){if(h.updateMorphTargets(),e.weights!==void 0)for(let t=0,r=e.weights.length;t<r;t++)h.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(h.morphTargetInfluences.length===t.length){h.morphTargetDictionary={};for(let r=0,n=t.length;r<n;r++)h.morphTargetDictionary[t[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function ve(h){let e;const t=h.extensions&&h.extensions[b.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+V(t.attributes):e=h.indices+":"+V(h.attributes)+":"+h.mode,h.targets!==void 0)for(let r=0,n=h.targets.length;r<n;r++)e+=":"+V(h.targets[r]);return e}function V(h){let e="";const t=Object.keys(h).sort();for(let r=0,n=t.length;r<n;r++)e+=t[r]+":"+h[t[r]]+";";return e}function z(h){switch(h){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 je(h){return h.search(/\.jpe?g($|\?)/i)>0||h.search(/^data\:image\/jpeg/)===0?"image/jpeg":h.search(/\.webp($|\?)/i)>0||h.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ke=new f.Matrix4;class Ve{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new he,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 r=!1,n=!1,o=-1;typeof navigator<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,o=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||n&&o<98?this.textureLoader=new f.TextureLoader(this.options.manager):this.textureLoader=new f.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new f.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 r=this,n=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(s){const a={scene:s[0][n.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:n.asset,parser:r,userData:{}};return P(o,a,n),O(a,n),Promise.all(r._invokeAll(function(i){return i.afterRoot&&i.afterRoot(a)})).then(function(){for(const i of a.scenes)i.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let n=0,o=t.length;n<o;n++){const s=t[n].joints;for(let a=0,i=s.length;a<i;a++)e[s[a]].isBone=!0}for(let n=0,o=e.length;n<o;n++){const s=e[n];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(r[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const n=r.clone(),o=(s,a)=>{const i=this.associations.get(s);i!=null&&this.associations.set(a,i);for(const[c,l]of s.children.entries())o(l,a.children[c])};return o(r,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const n=e(t[r]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let n=0;n<t.length;n++){const o=e(t[n]);o&&r.push(o)}return r}getDependency(e,t){const r=e+":"+t;let n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":n=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(r,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(o,s){return r.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],r=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[b.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(o,s){r.load(f.LoaderUtils.resolveURL(t.uri,n.path),o,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(r){const n=t.byteLength||0,o=t.byteOffset||0;return r.slice(o,o+n)})}loadAccessor(e){const t=this,r=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const s=j[n.type],a=F[n.componentType],i=n.normalized===!0,c=new a(n.count*s);return Promise.resolve(new f.BufferAttribute(c,s,i))}const o=[];return n.bufferView!==void 0?o.push(this.getDependency("bufferView",n.bufferView)):o.push(null),n.sparse!==void 0&&(o.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(o).then(function(s){const a=s[0],i=j[n.type],c=F[n.componentType],l=c.BYTES_PER_ELEMENT,u=l*i,d=n.byteOffset||0,g=n.bufferView!==void 0?r.bufferViews[n.bufferView].byteStride:void 0,y=n.normalized===!0;let _,R;if(g&&g!==u){const x=Math.floor(d/g),L="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+x+":"+n.count;let E=t.cache.get(L);E||(_=new c(a,x*g,n.count*g/l),E=new f.InterleavedBuffer(_,g/l),t.cache.add(L,E)),R=new f.InterleavedBufferAttribute(E,i,d%g/l,y)}else a===null?_=new c(n.count*i):_=new c(a,d,n.count*i),R=new f.BufferAttribute(_,i,y);if(n.sparse!==void 0){const x=j.SCALAR,L=F[n.sparse.indices.componentType],E=n.sparse.indices.byteOffset||0,S=n.sparse.values.byteOffset||0,C=new L(s[1],E,n.sparse.count*x),I=new c(s[2],S,n.sparse.count*i);a!==null&&(R=new f.BufferAttribute(R.array.slice(),R.itemSize,R.normalized));for(let M=0,p=C.length;M<p;M++){const m=C[M];if(R.setX(m,I[M*i]),i>=2&&R.setY(m,I[M*i+1]),i>=3&&R.setZ(m,I[M*i+2]),i>=4&&R.setW(m,I[M*i+3]),i>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return R})}loadTexture(e){const t=this.json,r=this.options,o=t.textures[e].source,s=t.images[o];let a=this.textureLoader;if(s.uri){const i=r.manager.getHandler(s.uri);i!==null&&(a=i)}return this.loadTextureImage(e,o,a)}loadTextureImage(e,t,r){const n=this,o=this.json,s=o.textures[e],a=o.images[t],i=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[i])return this.textureCache[i];const c=this.loadImageSource(t,r).then(function(l){l.flipY=!1,l.name=s.name||a.name||"",l.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(l.name=a.uri);const d=(o.samplers||{})[s.sampler]||{};return l.magFilter=ee[d.magFilter]||f.LinearFilter,l.minFilter=ee[d.minFilter]||f.LinearMipmapLinearFilter,l.wrapS=te[d.wrapS]||f.RepeatWrapping,l.wrapT=te[d.wrapT]||f.RepeatWrapping,n.associations.set(l,{textures:e}),l}).catch(function(){return null});return this.textureCache[i]=c,c}loadImageSource(e,t){const r=this,n=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const s=n.images[e],a=self.URL||self.webkitURL;let i=s.uri||"",c=!1;if(s.bufferView!==void 0)i=r.getDependency("bufferView",s.bufferView).then(function(u){c=!0;const d=new Blob([u],{type:s.mimeType});return i=a.createObjectURL(d),i});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(i).then(function(u){return new Promise(function(d,g){let y=d;t.isImageBitmapLoader===!0&&(y=function(_){const R=new f.Texture(_);R.needsUpdate=!0,d(R)}),t.load(f.LoaderUtils.resolveURL(u,o.path),y,void 0,g)})}).then(function(u){return c===!0&&a.revokeObjectURL(i),u.userData.mimeType=s.mimeType||je(s.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",i),u});return this.sourceCache[e]=l,l}assignTexture(e,t,r,n){const o=this;return this.getDependency("texture",r.index).then(function(s){if(!s)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(s=s.clone(),s.channel=r.texCoord),o.extensions[b.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[b.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const i=o.associations.get(s);s=o.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),o.associations.set(s,i)}}return n!==void 0&&(s.colorSpace=n),e[t]=s,s})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const n=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let i=this.cache.get(a);i||(i=new f.PointsMaterial,f.Material.prototype.copy.call(i,r),i.color.copy(r.color),i.map=r.map,i.sizeAttenuation=!1,this.cache.add(a,i)),r=i}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let i=this.cache.get(a);i||(i=new f.LineBasicMaterial,f.Material.prototype.copy.call(i,r),i.color.copy(r.color),i.map=r.map,this.cache.add(a,i)),r=i}if(n||o||s){let a="ClonedMaterial:"+r.uuid+":";n&&(a+="derivative-tangents:"),o&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let i=this.cache.get(a);i||(i=r.clone(),o&&(i.vertexColors=!0),s&&(i.flatShading=!0),n&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),this.cache.add(a,i),this.associations.set(i,this.associations.get(r))),r=i}e.material=r}getMaterialType(){return f.MeshStandardMaterial}loadMaterial(e){const t=this,r=this.json,n=this.extensions,o=r.materials[e];let s;const a={},i=o.extensions||{},c=[];if(i[b.KHR_MATERIALS_UNLIT]){const u=n[b.KHR_MATERIALS_UNLIT];s=u.getMaterialType(),c.push(u.extendParams(a,o,t))}else{const u=o.pbrMetallicRoughness||{};if(a.color=new f.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],f.LinearSRGBColorSpace),a.opacity=d[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,f.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),s=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}o.doubleSided===!0&&(a.side=f.DoubleSide);const l=o.alphaMode||K.OPAQUE;if(l===K.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,l===K.MASK&&(a.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&s!==f.MeshBasicMaterial&&(c.push(t.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new f.Vector2(1,1),o.normalTexture.scale!==void 0)){const u=o.normalTexture.scale;a.normalScale.set(u,u)}if(o.occlusionTexture!==void 0&&s!==f.MeshBasicMaterial&&(c.push(t.assignTexture(a,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&s!==f.MeshBasicMaterial){const u=o.emissiveFactor;a.emissive=new f.Color().setRGB(u[0],u[1],u[2],f.LinearSRGBColorSpace)}return o.emissiveTexture!==void 0&&s!==f.MeshBasicMaterial&&c.push(t.assignTexture(a,"emissiveMap",o.emissiveTexture,f.SRGBColorSpace)),Promise.all(c).then(function(){const u=new s(a);return o.name&&(u.name=o.name),O(u,o),t.associations.set(u,{materials:e}),o.extensions&&P(n,u,o),u})}createUniqueName(e){const t=f.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,n=this.primitiveCache;function o(a){return r[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(i){return ne(i,a,t)})}const s=[];for(let a=0,i=e.length;a<i;a++){const c=e[a],l=ve(c),u=n[l];if(u)s.push(u.promise);else{let d;c.extensions&&c.extensions[b.KHR_DRACO_MESH_COMPRESSION]?d=o(c):d=ne(new f.BufferGeometry,c,t),n[l]={primitive:c,promise:d},s.push(d)}}return Promise.all(s)}loadMesh(e){const t=this,r=this.json,n=this.extensions,o=r.meshes[e],s=o.primitives,a=[];for(let i=0,c=s.length;i<c;i++){const l=s[i].material===void 0?Ue(this.cache):this.getDependency("material",s[i].material);a.push(l)}return a.push(t.loadGeometries(s)),Promise.all(a).then(function(i){const c=i.slice(0,i.length-1),l=i[i.length-1],u=[];for(let g=0,y=l.length;g<y;g++){const _=l[g],R=s[g];let x;const L=c[g];if(R.mode===N.TRIANGLES||R.mode===N.TRIANGLE_STRIP||R.mode===N.TRIANGLE_FAN||R.mode===void 0)x=o.isSkinnedMesh===!0?new f.SkinnedMesh(_,L):new f.Mesh(_,L),x.isSkinnedMesh===!0&&x.normalizeSkinWeights(),R.mode===N.TRIANGLE_STRIP?x.geometry=Z(x.geometry,f.TriangleStripDrawMode):R.mode===N.TRIANGLE_FAN&&(x.geometry=Z(x.geometry,f.TriangleFanDrawMode));else if(R.mode===N.LINES)x=new f.LineSegments(_,L);else if(R.mode===N.LINE_STRIP)x=new f.Line(_,L);else if(R.mode===N.LINE_LOOP)x=new f.LineLoop(_,L);else if(R.mode===N.POINTS)x=new f.Points(_,L);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+R.mode);Object.keys(x.geometry.morphAttributes).length>0&&He(x,o),x.name=t.createUniqueName(o.name||"mesh_"+e),O(x,o),R.extensions&&P(n,x,R),t.assignFinalMaterial(x),u.push(x)}for(let g=0,y=u.length;g<y;g++)t.associations.set(u[g],{meshes:e,primitives:g});if(u.length===1)return o.extensions&&P(n,u[0],o),u[0];const d=new f.Group;o.extensions&&P(n,d,o),t.associations.set(d,{meshes:e});for(let g=0,y=u.length;g<y;g++)d.add(u[g]);return d})}loadCamera(e){let t;const r=this.json.cameras[e],n=r[r.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?t=new f.PerspectiveCamera(f.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):r.type==="orthographic"&&(t=new f.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),O(t,r),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],r=[];for(let n=0,o=t.joints.length;n<o;n++)r.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(n){const o=n.pop(),s=n,a=[],i=[];for(let c=0,l=s.length;c<l;c++){const u=s[c];if(u){a.push(u);const d=new f.Matrix4;o!==null&&d.fromArray(o.array,c*16),i.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new f.Skeleton(a,i)})}loadAnimation(e){const t=this.json,r=this,n=t.animations[e],o=n.name?n.name:"animation_"+e,s=[],a=[],i=[],c=[],l=[];for(let u=0,d=n.channels.length;u<d;u++){const g=n.channels[u],y=n.samplers[g.sampler],_=g.target,R=_.node,x=n.parameters!==void 0?n.parameters[y.input]:y.input,L=n.parameters!==void 0?n.parameters[y.output]:y.output;_.node!==void 0&&(s.push(this.getDependency("node",R)),a.push(this.getDependency("accessor",x)),i.push(this.getDependency("accessor",L)),c.push(y),l.push(_))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(i),Promise.all(c),Promise.all(l)]).then(function(u){const d=u[0],g=u[1],y=u[2],_=u[3],R=u[4],x=[];for(let L=0,E=d.length;L<E;L++){const S=d[L],C=g[L],I=y[L],M=_[L],p=R[L];if(S===void 0)continue;S.updateMatrix&&S.updateMatrix();const m=r._createAnimationTracks(S,C,I,M,p);if(m)for(let A=0;A<m.length;A++)x.push(m[A])}return new f.AnimationClip(o,void 0,x)})}createNodeMesh(e){const t=this.json,r=this,n=t.nodes[e];return n.mesh===void 0?null:r.getDependency("mesh",n.mesh).then(function(o){const s=r._getNodeRef(r.meshCache,n.mesh,o);return n.weights!==void 0&&s.traverse(function(a){if(a.isMesh)for(let i=0,c=n.weights.length;i<c;i++)a.morphTargetInfluences[i]=n.weights[i]}),s})}loadNode(e){const t=this.json,r=this,n=t.nodes[e],o=r._loadNodeShallow(e),s=[],a=n.children||[];for(let c=0,l=a.length;c<l;c++)s.push(r.getDependency("node",a[c]));const i=n.skin===void 0?Promise.resolve(null):r.getDependency("skin",n.skin);return Promise.all([o,Promise.all(s),i]).then(function(c){const l=c[0],u=c[1],d=c[2];d!==null&&l.traverse(function(g){g.isSkinnedMesh&&g.bind(d,Ke)});for(let g=0,y=u.length;g<y;g++)l.add(u[g]);return l})}_loadNodeShallow(e){const t=this.json,r=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],s=o.name?n.createUniqueName(o.name):"",a=[],i=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return i&&a.push(i),o.camera!==void 0&&a.push(n.getDependency("camera",o.camera).then(function(c){return n._getNodeRef(n.cameraCache,o.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let l;if(o.isBone===!0?l=new f.Bone:c.length>1?l=new f.Group:c.length===1?l=c[0]:l=new f.Object3D,l!==c[0])for(let u=0,d=c.length;u<d;u++)l.add(c[u]);if(o.name&&(l.userData.name=o.name,l.name=s),O(l,o),o.extensions&&P(r,l,o),o.matrix!==void 0){const u=new f.Matrix4;u.fromArray(o.matrix),l.applyMatrix4(u)}else o.translation!==void 0&&l.position.fromArray(o.translation),o.rotation!==void 0&&l.quaternion.fromArray(o.rotation),o.scale!==void 0&&l.scale.fromArray(o.scale);return n.associations.has(l)||n.associations.set(l,{}),n.associations.get(l).nodes=e,l}),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],n=this,o=new f.Group;r.name&&(o.name=n.createUniqueName(r.name)),O(o,r),r.extensions&&P(t,o,r);const s=r.nodes||[],a=[];for(let i=0,c=s.length;i<c;i++)a.push(n.getDependency("node",s[i]));return Promise.all(a).then(function(i){for(let l=0,u=i.length;l<u;l++)o.add(i[l]);const c=l=>{const u=new Map;for(const[d,g]of n.associations)(d instanceof f.Material||d instanceof f.Texture)&&u.set(d,g);return l.traverse(d=>{const g=n.associations.get(d);g!=null&&u.set(d,g)}),u};return n.associations=c(o),o})}_createAnimationTracks(e,t,r,n,o){const s=[],a=e.name?e.name:e.uuid,i=[];D[o.path]===D.weights?e.traverse(function(d){d.morphTargetInfluences&&i.push(d.name?d.name:d.uuid)}):i.push(a);let c;switch(D[o.path]){case D.weights:c=f.NumberKeyframeTrack;break;case D.rotation:c=f.QuaternionKeyframeTrack;break;case D.position:case D.scale:c=f.VectorKeyframeTrack;break;default:switch(r.itemSize){case 1:c=f.NumberKeyframeTrack;break;case 2:case 3:default:c=f.VectorKeyframeTrack;break}break}const l=n.interpolation!==void 0?Ge[n.interpolation]:f.InterpolateLinear,u=this._getArrayFromAccessor(r);for(let d=0,g=i.length;d<g;d++){const y=new c(i[d]+"."+D[o.path],t.array,u,l);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(y),s.push(y)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const r=z(t.constructor),n=new Float32Array(t.length);for(let o=0,s=t.length;o<s;o++)n[o]=t[o]*r;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(r){const n=this instanceof f.QuaternionKeyframeTrack?Fe:re;return new n(this.times,this.values,this.getValueSize()/3,r)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function We(h,e,t){const r=e.attributes,n=new f.Box3;if(r.POSITION!==void 0){const a=t.json.accessors[r.POSITION],i=a.min,c=a.max;if(i!==void 0&&c!==void 0){if(n.set(new f.Vector3(i[0],i[1],i[2]),new f.Vector3(c[0],c[1],c[2])),a.normalized){const l=z(F[a.componentType]);n.min.multiplyScalar(l),n.max.multiplyScalar(l)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const a=new f.Vector3,i=new f.Vector3;for(let c=0,l=o.length;c<l;c++){const u=o[c];if(u.POSITION!==void 0){const d=t.json.accessors[u.POSITION],g=d.min,y=d.max;if(g!==void 0&&y!==void 0){if(i.setX(Math.max(Math.abs(g[0]),Math.abs(y[0]))),i.setY(Math.max(Math.abs(g[1]),Math.abs(y[1]))),i.setZ(Math.max(Math.abs(g[2]),Math.abs(y[2]))),d.normalized){const _=z(F[d.componentType]);i.multiplyScalar(_)}a.max(i)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}h.boundingBox=n;const s=new f.Sphere;n.getCenter(s.center),s.radius=n.min.distanceTo(n.max)/2,h.boundingSphere=s}function ne(h,e,t){const r=e.attributes,n=[];function o(s,a){return t.getDependency("accessor",s).then(function(i){h.setAttribute(a,i)})}for(const s in r){const a=q[s]||s.toLowerCase();a in h.attributes||n.push(o(r[s],a))}if(e.indices!==void 0&&!h.index){const s=t.getDependency("accessor",e.indices).then(function(a){h.setIndex(a)});n.push(s)}return f.ColorManagement.workingColorSpace!==f.LinearSRGBColorSpace&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${f.ColorManagement.workingColorSpace}" not supported.`),O(h,e),We(h,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Be(h,e.targets,t):h})}class Xe{parse(e){const t={},r=e.split(`
1
+ "use strict";var le=Object.defineProperty;var ue=(h,e,t)=>e in h?le(h,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[e]=t;var k=(h,e,t)=>ue(h,typeof e!="symbol"?e+"":e,t);const f=require("three"),v=require("./fflate.module-DHdJvhNh.cjs"),fe=require("./FileTypes-CjUNNEmP.cjs"),Q=require("./isFileTypeSupported-CrEqYiv9.cjs"),U=require("./parse-error-Dy_EE4rL.cjs"),B=require("./AssetCache-BvteEWMc.cjs");function Z(h,e){if(e===f.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),h;if(e===f.TriangleFanDrawMode||e===f.TriangleStripDrawMode){let t=h.getIndex();if(t===null){const s=[],a=h.getAttribute("position");if(a!==void 0){for(let i=0;i<a.count;i++)s.push(i);h.setIndex(s),t=h.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),h}const r=t.count-2,n=[];if(e===f.TriangleFanDrawMode)for(let s=1;s<=r;s++)n.push(t.getX(0)),n.push(t.getX(s)),n.push(t.getX(s+1));else for(let s=0;s<r;s++)s%2===0?(n.push(t.getX(s)),n.push(t.getX(s+1)),n.push(t.getX(s+2))):(n.push(t.getX(s+2)),n.push(t.getX(s+1)),n.push(t.getX(s)));n.length/3!==r&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=h.clone();return o.setIndex(n),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),h}class de extends f.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Ae(t)}),this.register(function(t){return new Ee(t)}),this.register(function(t){return new be(t)}),this.register(function(t){return new Me(t)}),this.register(function(t){return new ye(t)}),this.register(function(t){return new Re(t)}),this.register(function(t){return new xe(t)}),this.register(function(t){return new _e(t)}),this.register(function(t){return new ge(t)}),this.register(function(t){return new Se(t)}),this.register(function(t){return new Te(t)}),this.register(function(t){return new Le(t)}),this.register(function(t){return new we(t)}),this.register(function(t){return new pe(t)}),this.register(function(t){return new Ce(t)}),this.register(function(t){return new Ie(t)})}load(e,t,r,n){const o=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const c=f.LoaderUtils.extractUrlBase(e);s=f.LoaderUtils.resolveURL(c,this.path)}else s=f.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const a=function(c){n?n(c):console.error(c),o.manager.itemError(e),o.manager.itemEnd(e)},i=new f.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,function(c){try{o.parse(c,s,function(l){t(l),o.manager.itemEnd(e)},a)}catch(l){a(l)}},r,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,n){let o;const s={},a={},i=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(i.decode(new Uint8Array(e,0,4))===se){try{s[b.KHR_BINARY_GLTF]=new Ne(e)}catch(u){n&&n(u);return}o=JSON.parse(s[b.KHR_BINARY_GLTF].content)}else o=JSON.parse(i.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Ve(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let l=0;l<this.pluginCallbacks.length;l++){const u=this.pluginCallbacks[l](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,s[u.name]=!0}if(o.extensionsUsed)for(let l=0;l<o.extensionsUsed.length;++l){const u=o.extensionsUsed[l],d=o.extensionsRequired||[];switch(u){case b.KHR_MATERIALS_UNLIT:s[u]=new me;break;case b.KHR_DRACO_MESH_COMPRESSION:s[u]=new De(o,this.dracoLoader);break;case b.KHR_TEXTURE_TRANSFORM:s[u]=new Oe;break;case b.KHR_MESH_QUANTIZATION:s[u]=new Pe;break;default:d.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(s),c.setPlugins(a),c.parse(r,n)}parseAsync(e,t){const r=this;return new Promise(function(n,o){r.parse(e,t,n,o)})}}function he(){let h={};return{get:function(e){return h[e]},add:function(e,t){h[e]=t},remove:function(e){delete h[e]},removeAll:function(){h={}}}}const b={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_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 pe{constructor(e){this.parser=e,this.name=b.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,n=t.length;r<n;r++){const o=t[r];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let n=t.cache.get(r);if(n)return n;const o=t.json,i=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let c;const l=new f.Color(16777215);i.color!==void 0&&l.setRGB(i.color[0],i.color[1],i.color[2],f.LinearSRGBColorSpace);const u=i.range!==void 0?i.range:0;switch(i.type){case"directional":c=new f.DirectionalLight(l),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new f.PointLight(l),c.distance=u;break;case"spot":c=new f.SpotLight(l),c.distance=u,i.spot=i.spot||{},i.spot.innerConeAngle=i.spot.innerConeAngle!==void 0?i.spot.innerConeAngle:0,i.spot.outerConeAngle=i.spot.outerConeAngle!==void 0?i.spot.outerConeAngle:Math.PI/4,c.angle=i.spot.outerConeAngle,c.penumbra=1-i.spot.innerConeAngle/i.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+i.type)}return c.position.set(0,0,0),c.decay=2,O(c,i),i.intensity!==void 0&&(c.intensity=i.intensity),c.name=t.createUniqueName(i.name||"light_"+e),n=Promise.resolve(c),t.cache.add(r,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,o=r.json.nodes[e],a=(o.extensions&&o.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(i){return r._getNodeRef(t.cache,a,i)})}}class me{constructor(){this.name=b.KHR_MATERIALS_UNLIT}getMaterialType(){return f.MeshBasicMaterial}extendParams(e,t,r){const n=[];e.color=new f.Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const s=o.baseColorFactor;e.color.setRGB(s[0],s[1],s[2],f.LinearSRGBColorSpace),e.opacity=s[3]}o.baseColorTexture!==void 0&&n.push(r.assignTexture(e,"map",o.baseColorTexture,f.SRGBColorSpace))}return Promise.all(n)}}class ge{constructor(e){this.parser=e,this.name=b.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 o=n.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class Ae{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&o.push(r.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&o.push(r.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(o.push(r.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const a=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new f.Vector2(a,a)}return Promise.all(o)}}class Te{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&o.push(r.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&o.push(r.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(o)}}class ye{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_SHEEN}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new f.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=n.extensions[this.name];if(s.sheenColorFactor!==void 0){const a=s.sheenColorFactor;t.sheenColor.setRGB(a[0],a[1],a[2],f.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&o.push(r.assignTexture(t,"sheenColorMap",s.sheenColorTexture,f.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&o.push(r.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(o)}}class Re{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&o.push(r.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(o)}}class xe{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_VOLUME}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&o.push(r.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return t.attenuationColor=new f.Color().setRGB(a[0],a[1],a[2],f.LinearSRGBColorSpace),Promise.all(o)}}class _e{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_IOR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=n.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class Se{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_SPECULAR}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&o.push(r.assignTexture(t,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return t.specularColor=new f.Color().setRGB(a[0],a[1],a[2],f.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&o.push(r.assignTexture(t,"specularColorMap",s.specularColorTexture,f.SRGBColorSpace)),Promise.all(o)}}class we{constructor(e){this.parser=e,this.name=b.EXT_MATERIALS_BUMP}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];return t.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&o.push(r.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(o)}}class Le{constructor(e){this.parser=e,this.name=b.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const r=this.parser.json.materials[e];return!r.extensions||!r.extensions[this.name]?null:f.MeshPhysicalMaterial}extendMaterialParams(e,t){const r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],s=n.extensions[this.name];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&o.push(r.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(o)}}class Ee{constructor(e){this.parser=e,this.name=b.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,n=r.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const o=n.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,s)}}class be{constructor(e){this.parser=e,this.name=b.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,n=r.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const s=o.extensions[t],a=n.images[s.source];let i=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(i=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,s.source,i);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.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 Me{constructor(e){this.parser=e,this.name=b.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,n=r.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const s=o.extensions[t],a=n.images[s.source];let i=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(i=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,s.source,i);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.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 Ce{constructor(e){this.name=b.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const n=r.extensions[this.name],o=this.parser.getDependency("buffer",n.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(a){const i=n.byteOffset||0,c=n.byteLength||0,l=n.count,u=n.byteStride,d=new Uint8Array(a,i,c);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(l,u,d,n.mode,n.filter).then(function(g){return g.buffer}):s.ready.then(function(){const g=new ArrayBuffer(l*u);return s.decodeGltfBuffer(new Uint8Array(g),l,u,d,n.mode,n.filter),g})})}else return null}}class Ie{constructor(e){this.name=b.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const n=t.meshes[r.mesh];for(const c of n.primitives)if(c.mode!==N.TRIANGLES&&c.mode!==N.TRIANGLE_STRIP&&c.mode!==N.TRIANGLE_FAN&&c.mode!==void 0)return null;const s=r.extensions[this.name].attributes,a=[],i={};for(const c in s)a.push(this.parser.getDependency("accessor",s[c]).then(l=>(i[c]=l,i[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const l=c.pop(),u=l.isGroup?l.children:[l],d=c[0].count,g=[];for(const y of u){const _=new f.Matrix4,R=new f.Vector3,x=new f.Quaternion,L=new f.Vector3(1,1,1),E=new f.InstancedMesh(y.geometry,y.material,d);for(let S=0;S<d;S++)i.TRANSLATION&&R.fromBufferAttribute(i.TRANSLATION,S),i.ROTATION&&x.fromBufferAttribute(i.ROTATION,S),i.SCALE&&L.fromBufferAttribute(i.SCALE,S),E.setMatrixAt(S,_.compose(R,x,L));for(const S in i)if(S==="_COLOR_0"){const C=i[S];E.instanceColor=new f.InstancedBufferAttribute(C.array,C.itemSize,C.normalized)}else S!=="TRANSLATION"&&S!=="ROTATION"&&S!=="SCALE"&&y.geometry.setAttribute(S,i[S]);f.Object3D.prototype.copy.call(E,y),this.parser.assignFinalMaterial(E),g.push(E)}return l.isGroup?(l.clear(),l.add(...g),l):g[0]}))}}const se="glTF",G=12,$={JSON:1313821514,BIN:5130562};class Ne{constructor(e){this.name=b.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,G),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==se)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-G,o=new DataView(e,G);let s=0;for(;s<n;){const a=o.getUint32(s,!0);s+=4;const i=o.getUint32(s,!0);if(s+=4,i===$.JSON){const c=new Uint8Array(e,G+s,a);this.content=r.decode(c)}else if(i===$.BIN){const c=G+s;this.body=e.slice(c,c+a)}s+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class De{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=b.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,n=this.dracoLoader,o=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,a={},i={},c={};for(const l in s){const u=q[l]||l.toLowerCase();a[u]=s[l]}for(const l in e.attributes){const u=q[l]||l.toLowerCase();if(s[l]!==void 0){const d=r.accessors[e.attributes[l]],g=F[d.componentType];c[u]=g.name,i[u]=d.normalized===!0}}return t.getDependency("bufferView",o).then(function(l){return new Promise(function(u,d){n.decodeDracoFile(l,function(g){for(const y in g.attributes){const _=g.attributes[y],R=i[y];R!==void 0&&(_.normalized=R)}u(g)},a,c,f.LinearSRGBColorSpace,d)})})}}class Oe{constructor(){this.name=b.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 Pe{constructor(){this.name=b.KHR_MESH_QUANTIZATION}}class re extends f.Interpolant{constructor(e,t,r,n){super(e,t,r,n)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,o=e*n*3+n;for(let s=0;s!==n;s++)t[s]=r[o+s];return t}interpolate_(e,t,r,n){const o=this.resultBuffer,s=this.sampleValues,a=this.valueSize,i=a*2,c=a*3,l=n-t,u=(r-t)/l,d=u*u,g=d*u,y=e*c,_=y-c,R=-2*g+3*d,x=g-d,L=1-R,E=x-d+u;for(let S=0;S!==a;S++){const C=s[_+S+a],I=s[_+S+i]*l,M=s[y+S+a],p=s[y+S]*l;o[S]=L*C+E*I+R*M+x*p}return o}}const ke=new f.Quaternion;class Fe extends re{interpolate_(e,t,r,n){const o=super.interpolate_(e,t,r,n);return ke.fromArray(o).normalize().toArray(o),o}}const N={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},F={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ee={9728:f.NearestFilter,9729:f.LinearFilter,9984:f.NearestMipmapNearestFilter,9985:f.LinearMipmapNearestFilter,9986:f.NearestMipmapLinearFilter,9987:f.LinearMipmapLinearFilter},te={33071:f.ClampToEdgeWrapping,33648:f.MirroredRepeatWrapping,10497:f.RepeatWrapping},j={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},q={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"},D={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ge={CUBICSPLINE:void 0,LINEAR:f.InterpolateLinear,STEP:f.InterpolateDiscrete},K={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ue(h){return h.DefaultMaterial===void 0&&(h.DefaultMaterial=new f.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:f.FrontSide})),h.DefaultMaterial}function P(h,e,t){for(const r in t.extensions)h[r]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=t.extensions[r])}function O(h,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(h.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Be(h,e,t){let r=!1,n=!1,o=!1;for(let c=0,l=e.length;c<l;c++){const u=e[c];if(u.POSITION!==void 0&&(r=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(o=!0),r&&n&&o)break}if(!r&&!n&&!o)return Promise.resolve(h);const s=[],a=[],i=[];for(let c=0,l=e.length;c<l;c++){const u=e[c];if(r){const d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):h.attributes.position;s.push(d)}if(n){const d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):h.attributes.normal;a.push(d)}if(o){const d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):h.attributes.color;i.push(d)}}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(i)]).then(function(c){const l=c[0],u=c[1],d=c[2];return r&&(h.morphAttributes.position=l),n&&(h.morphAttributes.normal=u),o&&(h.morphAttributes.color=d),h.morphTargetsRelative=!0,h})}function He(h,e){if(h.updateMorphTargets(),e.weights!==void 0)for(let t=0,r=e.weights.length;t<r;t++)h.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(h.morphTargetInfluences.length===t.length){h.morphTargetDictionary={};for(let r=0,n=t.length;r<n;r++)h.morphTargetDictionary[t[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function ve(h){let e;const t=h.extensions&&h.extensions[b.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+V(t.attributes):e=h.indices+":"+V(h.attributes)+":"+h.mode,h.targets!==void 0)for(let r=0,n=h.targets.length;r<n;r++)e+=":"+V(h.targets[r]);return e}function V(h){let e="";const t=Object.keys(h).sort();for(let r=0,n=t.length;r<n;r++)e+=t[r]+":"+h[t[r]]+";";return e}function z(h){switch(h){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 je(h){return h.search(/\.jpe?g($|\?)/i)>0||h.search(/^data\:image\/jpeg/)===0?"image/jpeg":h.search(/\.webp($|\?)/i)>0||h.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Ke=new f.Matrix4;class Ve{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new he,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 r=!1,n=!1,o=-1;typeof navigator<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,o=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||n&&o<98?this.textureLoader=new f.TextureLoader(this.options.manager):this.textureLoader=new f.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new f.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 r=this,n=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(s){const a={scene:s[0][n.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:n.asset,parser:r,userData:{}};return P(o,a,n),O(a,n),Promise.all(r._invokeAll(function(i){return i.afterRoot&&i.afterRoot(a)})).then(function(){for(const i of a.scenes)i.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let n=0,o=t.length;n<o;n++){const s=t[n].joints;for(let a=0,i=s.length;a<i;a++)e[s[a]].isBone=!0}for(let n=0,o=e.length;n<o;n++){const s=e[n];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(r[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const n=r.clone(),o=(s,a)=>{const i=this.associations.get(s);i!=null&&this.associations.set(a,i);for(const[c,l]of s.children.entries())o(l,a.children[c])};return o(r,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const n=e(t[r]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let n=0;n<t.length;n++){const o=e(t[n]);o&&r.push(o)}return r}getDependency(e,t){const r=e+":"+t;let n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":n=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(r,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(o,s){return r.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],r=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[b.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(o,s){r.load(f.LoaderUtils.resolveURL(t.uri,n.path),o,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(r){const n=t.byteLength||0,o=t.byteOffset||0;return r.slice(o,o+n)})}loadAccessor(e){const t=this,r=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const s=j[n.type],a=F[n.componentType],i=n.normalized===!0,c=new a(n.count*s);return Promise.resolve(new f.BufferAttribute(c,s,i))}const o=[];return n.bufferView!==void 0?o.push(this.getDependency("bufferView",n.bufferView)):o.push(null),n.sparse!==void 0&&(o.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(o).then(function(s){const a=s[0],i=j[n.type],c=F[n.componentType],l=c.BYTES_PER_ELEMENT,u=l*i,d=n.byteOffset||0,g=n.bufferView!==void 0?r.bufferViews[n.bufferView].byteStride:void 0,y=n.normalized===!0;let _,R;if(g&&g!==u){const x=Math.floor(d/g),L="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+x+":"+n.count;let E=t.cache.get(L);E||(_=new c(a,x*g,n.count*g/l),E=new f.InterleavedBuffer(_,g/l),t.cache.add(L,E)),R=new f.InterleavedBufferAttribute(E,i,d%g/l,y)}else a===null?_=new c(n.count*i):_=new c(a,d,n.count*i),R=new f.BufferAttribute(_,i,y);if(n.sparse!==void 0){const x=j.SCALAR,L=F[n.sparse.indices.componentType],E=n.sparse.indices.byteOffset||0,S=n.sparse.values.byteOffset||0,C=new L(s[1],E,n.sparse.count*x),I=new c(s[2],S,n.sparse.count*i);a!==null&&(R=new f.BufferAttribute(R.array.slice(),R.itemSize,R.normalized));for(let M=0,p=C.length;M<p;M++){const m=C[M];if(R.setX(m,I[M*i]),i>=2&&R.setY(m,I[M*i+1]),i>=3&&R.setZ(m,I[M*i+2]),i>=4&&R.setW(m,I[M*i+3]),i>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return R})}loadTexture(e){const t=this.json,r=this.options,o=t.textures[e].source,s=t.images[o];let a=this.textureLoader;if(s.uri){const i=r.manager.getHandler(s.uri);i!==null&&(a=i)}return this.loadTextureImage(e,o,a)}loadTextureImage(e,t,r){const n=this,o=this.json,s=o.textures[e],a=o.images[t],i=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[i])return this.textureCache[i];const c=this.loadImageSource(t,r).then(function(l){l.flipY=!1,l.name=s.name||a.name||"",l.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(l.name=a.uri);const d=(o.samplers||{})[s.sampler]||{};return l.magFilter=ee[d.magFilter]||f.LinearFilter,l.minFilter=ee[d.minFilter]||f.LinearMipmapLinearFilter,l.wrapS=te[d.wrapS]||f.RepeatWrapping,l.wrapT=te[d.wrapT]||f.RepeatWrapping,n.associations.set(l,{textures:e}),l}).catch(function(){return null});return this.textureCache[i]=c,c}loadImageSource(e,t){const r=this,n=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const s=n.images[e],a=self.URL||self.webkitURL;let i=s.uri||"",c=!1;if(s.bufferView!==void 0)i=r.getDependency("bufferView",s.bufferView).then(function(u){c=!0;const d=new Blob([u],{type:s.mimeType});return i=a.createObjectURL(d),i});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(i).then(function(u){return new Promise(function(d,g){let y=d;t.isImageBitmapLoader===!0&&(y=function(_){const R=new f.Texture(_);R.needsUpdate=!0,d(R)}),t.load(f.LoaderUtils.resolveURL(u,o.path),y,void 0,g)})}).then(function(u){return c===!0&&a.revokeObjectURL(i),u.userData.mimeType=s.mimeType||je(s.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",i),u});return this.sourceCache[e]=l,l}assignTexture(e,t,r,n){const o=this;return this.getDependency("texture",r.index).then(function(s){if(!s)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(s=s.clone(),s.channel=r.texCoord),o.extensions[b.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[b.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const i=o.associations.get(s);s=o.extensions[b.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),o.associations.set(s,i)}}return n!==void 0&&(s.colorSpace=n),e[t]=s,s})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const n=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let i=this.cache.get(a);i||(i=new f.PointsMaterial,f.Material.prototype.copy.call(i,r),i.color.copy(r.color),i.map=r.map,i.sizeAttenuation=!1,this.cache.add(a,i)),r=i}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let i=this.cache.get(a);i||(i=new f.LineBasicMaterial,f.Material.prototype.copy.call(i,r),i.color.copy(r.color),i.map=r.map,this.cache.add(a,i)),r=i}if(n||o||s){let a="ClonedMaterial:"+r.uuid+":";n&&(a+="derivative-tangents:"),o&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let i=this.cache.get(a);i||(i=r.clone(),o&&(i.vertexColors=!0),s&&(i.flatShading=!0),n&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),this.cache.add(a,i),this.associations.set(i,this.associations.get(r))),r=i}e.material=r}getMaterialType(){return f.MeshStandardMaterial}loadMaterial(e){const t=this,r=this.json,n=this.extensions,o=r.materials[e];let s;const a={},i=o.extensions||{},c=[];if(i[b.KHR_MATERIALS_UNLIT]){const u=n[b.KHR_MATERIALS_UNLIT];s=u.getMaterialType(),c.push(u.extendParams(a,o,t))}else{const u=o.pbrMetallicRoughness||{};if(a.color=new f.Color(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],f.LinearSRGBColorSpace),a.opacity=d[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,f.SRGBColorSpace)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),s=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}o.doubleSided===!0&&(a.side=f.DoubleSide);const l=o.alphaMode||K.OPAQUE;if(l===K.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,l===K.MASK&&(a.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&s!==f.MeshBasicMaterial&&(c.push(t.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new f.Vector2(1,1),o.normalTexture.scale!==void 0)){const u=o.normalTexture.scale;a.normalScale.set(u,u)}if(o.occlusionTexture!==void 0&&s!==f.MeshBasicMaterial&&(c.push(t.assignTexture(a,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&s!==f.MeshBasicMaterial){const u=o.emissiveFactor;a.emissive=new f.Color().setRGB(u[0],u[1],u[2],f.LinearSRGBColorSpace)}return o.emissiveTexture!==void 0&&s!==f.MeshBasicMaterial&&c.push(t.assignTexture(a,"emissiveMap",o.emissiveTexture,f.SRGBColorSpace)),Promise.all(c).then(function(){const u=new s(a);return o.name&&(u.name=o.name),O(u,o),t.associations.set(u,{materials:e}),o.extensions&&P(n,u,o),u})}createUniqueName(e){const t=f.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,n=this.primitiveCache;function o(a){return r[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(i){return ne(i,a,t)})}const s=[];for(let a=0,i=e.length;a<i;a++){const c=e[a],l=ve(c),u=n[l];if(u)s.push(u.promise);else{let d;c.extensions&&c.extensions[b.KHR_DRACO_MESH_COMPRESSION]?d=o(c):d=ne(new f.BufferGeometry,c,t),n[l]={primitive:c,promise:d},s.push(d)}}return Promise.all(s)}loadMesh(e){const t=this,r=this.json,n=this.extensions,o=r.meshes[e],s=o.primitives,a=[];for(let i=0,c=s.length;i<c;i++){const l=s[i].material===void 0?Ue(this.cache):this.getDependency("material",s[i].material);a.push(l)}return a.push(t.loadGeometries(s)),Promise.all(a).then(function(i){const c=i.slice(0,i.length-1),l=i[i.length-1],u=[];for(let g=0,y=l.length;g<y;g++){const _=l[g],R=s[g];let x;const L=c[g];if(R.mode===N.TRIANGLES||R.mode===N.TRIANGLE_STRIP||R.mode===N.TRIANGLE_FAN||R.mode===void 0)x=o.isSkinnedMesh===!0?new f.SkinnedMesh(_,L):new f.Mesh(_,L),x.isSkinnedMesh===!0&&x.normalizeSkinWeights(),R.mode===N.TRIANGLE_STRIP?x.geometry=Z(x.geometry,f.TriangleStripDrawMode):R.mode===N.TRIANGLE_FAN&&(x.geometry=Z(x.geometry,f.TriangleFanDrawMode));else if(R.mode===N.LINES)x=new f.LineSegments(_,L);else if(R.mode===N.LINE_STRIP)x=new f.Line(_,L);else if(R.mode===N.LINE_LOOP)x=new f.LineLoop(_,L);else if(R.mode===N.POINTS)x=new f.Points(_,L);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+R.mode);Object.keys(x.geometry.morphAttributes).length>0&&He(x,o),x.name=t.createUniqueName(o.name||"mesh_"+e),O(x,o),R.extensions&&P(n,x,R),t.assignFinalMaterial(x),u.push(x)}for(let g=0,y=u.length;g<y;g++)t.associations.set(u[g],{meshes:e,primitives:g});if(u.length===1)return o.extensions&&P(n,u[0],o),u[0];const d=new f.Group;o.extensions&&P(n,d,o),t.associations.set(d,{meshes:e});for(let g=0,y=u.length;g<y;g++)d.add(u[g]);return d})}loadCamera(e){let t;const r=this.json.cameras[e],n=r[r.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?t=new f.PerspectiveCamera(f.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):r.type==="orthographic"&&(t=new f.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),O(t,r),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],r=[];for(let n=0,o=t.joints.length;n<o;n++)r.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(n){const o=n.pop(),s=n,a=[],i=[];for(let c=0,l=s.length;c<l;c++){const u=s[c];if(u){a.push(u);const d=new f.Matrix4;o!==null&&d.fromArray(o.array,c*16),i.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[c])}return new f.Skeleton(a,i)})}loadAnimation(e){const t=this.json,r=this,n=t.animations[e],o=n.name?n.name:"animation_"+e,s=[],a=[],i=[],c=[],l=[];for(let u=0,d=n.channels.length;u<d;u++){const g=n.channels[u],y=n.samplers[g.sampler],_=g.target,R=_.node,x=n.parameters!==void 0?n.parameters[y.input]:y.input,L=n.parameters!==void 0?n.parameters[y.output]:y.output;_.node!==void 0&&(s.push(this.getDependency("node",R)),a.push(this.getDependency("accessor",x)),i.push(this.getDependency("accessor",L)),c.push(y),l.push(_))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(i),Promise.all(c),Promise.all(l)]).then(function(u){const d=u[0],g=u[1],y=u[2],_=u[3],R=u[4],x=[];for(let L=0,E=d.length;L<E;L++){const S=d[L],C=g[L],I=y[L],M=_[L],p=R[L];if(S===void 0)continue;S.updateMatrix&&S.updateMatrix();const m=r._createAnimationTracks(S,C,I,M,p);if(m)for(let A=0;A<m.length;A++)x.push(m[A])}return new f.AnimationClip(o,void 0,x)})}createNodeMesh(e){const t=this.json,r=this,n=t.nodes[e];return n.mesh===void 0?null:r.getDependency("mesh",n.mesh).then(function(o){const s=r._getNodeRef(r.meshCache,n.mesh,o);return n.weights!==void 0&&s.traverse(function(a){if(a.isMesh)for(let i=0,c=n.weights.length;i<c;i++)a.morphTargetInfluences[i]=n.weights[i]}),s})}loadNode(e){const t=this.json,r=this,n=t.nodes[e],o=r._loadNodeShallow(e),s=[],a=n.children||[];for(let c=0,l=a.length;c<l;c++)s.push(r.getDependency("node",a[c]));const i=n.skin===void 0?Promise.resolve(null):r.getDependency("skin",n.skin);return Promise.all([o,Promise.all(s),i]).then(function(c){const l=c[0],u=c[1],d=c[2];d!==null&&l.traverse(function(g){g.isSkinnedMesh&&g.bind(d,Ke)});for(let g=0,y=u.length;g<y;g++)l.add(u[g]);return l})}_loadNodeShallow(e){const t=this.json,r=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],s=o.name?n.createUniqueName(o.name):"",a=[],i=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(e)});return i&&a.push(i),o.camera!==void 0&&a.push(n.getDependency("camera",o.camera).then(function(c){return n._getNodeRef(n.cameraCache,o.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(e)}).forEach(function(c){a.push(c)}),this.nodeCache[e]=Promise.all(a).then(function(c){let l;if(o.isBone===!0?l=new f.Bone:c.length>1?l=new f.Group:c.length===1?l=c[0]:l=new f.Object3D,l!==c[0])for(let u=0,d=c.length;u<d;u++)l.add(c[u]);if(o.name&&(l.userData.name=o.name,l.name=s),O(l,o),o.extensions&&P(r,l,o),o.matrix!==void 0){const u=new f.Matrix4;u.fromArray(o.matrix),l.applyMatrix4(u)}else o.translation!==void 0&&l.position.fromArray(o.translation),o.rotation!==void 0&&l.quaternion.fromArray(o.rotation),o.scale!==void 0&&l.scale.fromArray(o.scale);return n.associations.has(l)||n.associations.set(l,{}),n.associations.get(l).nodes=e,l}),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],n=this,o=new f.Group;r.name&&(o.name=n.createUniqueName(r.name)),O(o,r),r.extensions&&P(t,o,r);const s=r.nodes||[],a=[];for(let i=0,c=s.length;i<c;i++)a.push(n.getDependency("node",s[i]));return Promise.all(a).then(function(i){for(let l=0,u=i.length;l<u;l++)o.add(i[l]);const c=l=>{const u=new Map;for(const[d,g]of n.associations)(d instanceof f.Material||d instanceof f.Texture)&&u.set(d,g);return l.traverse(d=>{const g=n.associations.get(d);g!=null&&u.set(d,g)}),u};return n.associations=c(o),o})}_createAnimationTracks(e,t,r,n,o){const s=[],a=e.name?e.name:e.uuid,i=[];D[o.path]===D.weights?e.traverse(function(d){d.morphTargetInfluences&&i.push(d.name?d.name:d.uuid)}):i.push(a);let c;switch(D[o.path]){case D.weights:c=f.NumberKeyframeTrack;break;case D.rotation:c=f.QuaternionKeyframeTrack;break;case D.position:case D.scale:c=f.VectorKeyframeTrack;break;default:switch(r.itemSize){case 1:c=f.NumberKeyframeTrack;break;case 2:case 3:default:c=f.VectorKeyframeTrack;break}break}const l=n.interpolation!==void 0?Ge[n.interpolation]:f.InterpolateLinear,u=this._getArrayFromAccessor(r);for(let d=0,g=i.length;d<g;d++){const y=new c(i[d]+"."+D[o.path],t.array,u,l);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(y),s.push(y)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const r=z(t.constructor),n=new Float32Array(t.length);for(let o=0,s=t.length;o<s;o++)n[o]=t[o]*r;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(r){const n=this instanceof f.QuaternionKeyframeTrack?Fe:re;return new n(this.times,this.values,this.getValueSize()/3,r)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function We(h,e,t){const r=e.attributes,n=new f.Box3;if(r.POSITION!==void 0){const a=t.json.accessors[r.POSITION],i=a.min,c=a.max;if(i!==void 0&&c!==void 0){if(n.set(new f.Vector3(i[0],i[1],i[2]),new f.Vector3(c[0],c[1],c[2])),a.normalized){const l=z(F[a.componentType]);n.min.multiplyScalar(l),n.max.multiplyScalar(l)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const a=new f.Vector3,i=new f.Vector3;for(let c=0,l=o.length;c<l;c++){const u=o[c];if(u.POSITION!==void 0){const d=t.json.accessors[u.POSITION],g=d.min,y=d.max;if(g!==void 0&&y!==void 0){if(i.setX(Math.max(Math.abs(g[0]),Math.abs(y[0]))),i.setY(Math.max(Math.abs(g[1]),Math.abs(y[1]))),i.setZ(Math.max(Math.abs(g[2]),Math.abs(y[2]))),d.normalized){const _=z(F[d.componentType]);i.multiplyScalar(_)}a.max(i)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}h.boundingBox=n;const s=new f.Sphere;n.getCenter(s.center),s.radius=n.min.distanceTo(n.max)/2,h.boundingSphere=s}function ne(h,e,t){const r=e.attributes,n=[];function o(s,a){return t.getDependency("accessor",s).then(function(i){h.setAttribute(a,i)})}for(const s in r){const a=q[s]||s.toLowerCase();a in h.attributes||n.push(o(r[s],a))}if(e.indices!==void 0&&!h.index){const s=t.getDependency("accessor",e.indices).then(function(a){h.setIndex(a)});n.push(s)}return f.ColorManagement.workingColorSpace!==f.LinearSRGBColorSpace&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${f.ColorManagement.workingColorSpace}" not supported.`),O(h,e),We(h,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Be(h,e.targets,t):h})}class Xe{parse(e){const t={},r=e.split(`
2
2
  `);let n=null,o=t;const s=[t];for(const a of r)if(a.includes("=")){const i=a.split("="),c=i[0].trim(),l=i[1].trim();if(l.endsWith("{")){const u={};s.push(u),o[c]=u,o=u}else o[c]=l}else if(a.endsWith("{")){const i=o[n]||{};s.push(i),o[n]=i,o=i}else if(a.endsWith("}")){if(s.pop(),s.length===0)continue;o=s[s.length-1]}else if(a.endsWith("(")){const i={};s.push(i),n=a.split("(")[0].trim()||n,o[n]=i,o=i}else a.endsWith(")")?(s.pop(),o=s[s.length-1]):n=a.trim();return t}}class qe extends f.Loader{constructor(e){super(e)}load(e,t,r,n){const o=this,s=new f.FileLoader(o.manager);s.setPath(o.path),s.setResponseType("arraybuffer"),s.setRequestHeader(o.requestHeader),s.setWithCredentials(o.withCredentials),s.load(e,function(a){try{t(o.parse(a))}catch(i){n?n(i):console.error(i),o.manager.itemError(e)}},r,n)}parse(e){const t=new Xe;function r(p){const m={};new f.FileLoader().setResponseType("arraybuffer");for(const T in p){if(T.endsWith("png")){const w=new Blob([p[T]],{type:{type:"image/png"}});m[T]=URL.createObjectURL(w)}if(T.endsWith("usd")||T.endsWith("usda")){if(n(p[T])){console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");continue}const w=v.strFromU8(p[T]);m[T]=t.parse(w)}}return m}function n(p){const m=p.slice(0,7),A=new Uint8Array([80,88,82,45,85,83,68,67]);return m.every((T,w)=>T===A[w])}function o(p){if(p.length<1)return;const m=Object.keys(p)[0];let A=!1;if(m.endsWith("usda"))return p[m];if(m.endsWith("usdc"))A=!0;else if(m.endsWith("usd"))if(n(p[m]))A=!0;else return p[m];A&&console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.")}const s=v.unzipSync(new Uint8Array(e)),a=r(s),i=o(s);if(i===void 0)return console.warn("THREE.USDZLoader: No usda file found."),new f.Group;const c=v.strFromU8(i),l=t.parse(c);function u(p){if(p){if("prepend references"in p){const A=p["prepend references"].split("@"),T=A[1].replace(/^.\//,""),w=A[2].replace(/^<\//,"").replace(/>$/,"");return d(a[T],w)}return d(p)}}function d(p,m){if(p){if(m!==void 0){const A=`def Mesh "${m}"`;if(A in p)return p[A]}for(const A in p){const T=p[A];if(A.startsWith("def Mesh"))return"point3f[] points"in p&&(T["point3f[] points"]=p["point3f[] points"]),"texCoord2f[] primvars:st"in p&&(T["texCoord2f[] primvars:st"]=p["texCoord2f[] primvars:st"]),"int[] primvars:st:indices"in p&&(T["int[] primvars:st:indices"]=p["int[] primvars:st:indices"]),T;if(typeof T=="object"){const w=d(T);if(w)return w}}}}function g(p){if(!p)return;let m=new f.BufferGeometry;if("int[] faceVertexIndices"in p){const A=JSON.parse(p["int[] faceVertexIndices"]);m.setIndex(A)}if("point3f[] points"in p){const A=JSON.parse(p["point3f[] points"].replace(/[()]*/g,"")),T=new f.BufferAttribute(new Float32Array(A),3);m.setAttribute("position",T)}if("normal3f[] normals"in p){const A=JSON.parse(p["normal3f[] normals"].replace(/[()]*/g,"")),T=new f.BufferAttribute(new Float32Array(A),3);m.setAttribute("normal",T)}else m.computeVertexNormals();if("float2[] primvars:st"in p&&(p["texCoord2f[] primvars:st"]=p["float2[] primvars:st"]),"texCoord2f[] primvars:st"in p){const A=JSON.parse(p["texCoord2f[] primvars:st"].replace(/[()]*/g,"")),T=new f.BufferAttribute(new Float32Array(A),2);if("int[] primvars:st:indices"in p){m=m.toNonIndexed();const w=JSON.parse(p["int[] primvars:st:indices"]);m.setAttribute("uv",y(T,w))}else m.setAttribute("uv",T)}return m}function y(p,m){const A=p.array,T=p.itemSize,w=new A.constructor(m.length*T);let Y=0,ae=0;for(let H=0,ce=m.length;H<ce;H++){Y=m[H]*T;for(let J=0;J<T;J++)w[ae++]=A[Y++]}return new f.BufferAttribute(w,T)}function _(p){if(p){if("rel material:binding"in p){const T=p["rel material:binding"].replace(/^<\//,"").replace(/>$/,"").split("/");return R(l,` "${T[1]}"`)}return R(p)}}function R(p,m=""){for(const A in p){const T=p[A];if(A.startsWith("def Material"+m))return T;if(typeof T=="object"){const w=R(T,m);if(w)return w}}}function x(p,m){m["float inputs:rotation"]&&(p.rotation=parseFloat(m["float inputs:rotation"])),m["float2 inputs:scale"]&&(p.repeat=new f.Vector2().fromArray(JSON.parse("["+m["float2 inputs:scale"].replace(/[()]*/g,"")+"]"))),m["float2 inputs:translation"]&&(p.offset=new f.Vector2().fromArray(JSON.parse("["+m["float2 inputs:translation"].replace(/[()]*/g,"")+"]")))}function L(p){const m=new f.MeshPhysicalMaterial;if(p!==void 0){if('def Shader "PreviewSurface"'in p){const A=p['def Shader "PreviewSurface"'];if("color3f inputs:diffuseColor.connect"in A){const T=A["color3f inputs:diffuseColor.connect"],w=E(l,/(\w+).output/.exec(T)[1]);m.map=S(w),m.map.colorSpace=f.SRGBColorSpace,'def Shader "Transform2d_diffuse"'in p&&x(m.map,p['def Shader "Transform2d_diffuse"'])}else if("color3f inputs:diffuseColor"in A){const T=A["color3f inputs:diffuseColor"].replace(/[()]*/g,"");m.color.fromArray(JSON.parse("["+T+"]"))}if("color3f inputs:emissiveColor.connect"in A){const T=A["color3f inputs:emissiveColor.connect"],w=E(l,/(\w+).output/.exec(T)[1]);m.emissiveMap=S(w),m.emissiveMap.colorSpace=f.SRGBColorSpace,m.emissive.set(16777215),'def Shader "Transform2d_emissive"'in p&&x(m.emissiveMap,p['def Shader "Transform2d_emissive"'])}else if("color3f inputs:emissiveColor"in A){const T=A["color3f inputs:emissiveColor"].replace(/[()]*/g,"");m.emissive.fromArray(JSON.parse("["+T+"]"))}if("normal3f inputs:normal.connect"in A){const T=A["normal3f inputs:normal.connect"],w=E(l,/(\w+).output/.exec(T)[1]);m.normalMap=S(w),m.normalMap.colorSpace=f.NoColorSpace,'def Shader "Transform2d_normal"'in p&&x(m.normalMap,p['def Shader "Transform2d_normal"'])}if("float inputs:roughness.connect"in A){const T=A["float inputs:roughness.connect"],w=E(l,/(\w+).output/.exec(T)[1]);m.roughness=1,m.roughnessMap=S(w),m.roughnessMap.colorSpace=f.NoColorSpace,'def Shader "Transform2d_roughness"'in p&&x(m.roughnessMap,p['def Shader "Transform2d_roughness"'])}else"float inputs:roughness"in A&&(m.roughness=parseFloat(A["float inputs:roughness"]));if("float inputs:metallic.connect"in A){const T=A["float inputs:metallic.connect"],w=E(l,/(\w+).output/.exec(T)[1]);m.metalness=1,m.metalnessMap=S(w),m.metalnessMap.colorSpace=f.NoColorSpace,'def Shader "Transform2d_metallic"'in p&&x(m.metalnessMap,p['def Shader "Transform2d_metallic"'])}else"float inputs:metallic"in A&&(m.metalness=parseFloat(A["float inputs:metallic"]));if("float inputs:clearcoat.connect"in A){const T=A["float inputs:clearcoat.connect"],w=E(l,/(\w+).output/.exec(T)[1]);m.clearcoat=1,m.clearcoatMap=S(w),m.clearcoatMap.colorSpace=f.NoColorSpace,'def Shader "Transform2d_clearcoat"'in p&&x(m.clearcoatMap,p['def Shader "Transform2d_clearcoat"'])}else"float inputs:clearcoat"in A&&(m.clearcoat=parseFloat(A["float inputs:clearcoat"]));if("float inputs:clearcoatRoughness.connect"in A){const T=A["float inputs:clearcoatRoughness.connect"],w=E(l,/(\w+).output/.exec(T)[1]);m.clearcoatRoughness=1,m.clearcoatRoughnessMap=S(w),m.clearcoatRoughnessMap.colorSpace=f.NoColorSpace,'def Shader "Transform2d_clearcoatRoughness"'in p&&x(m.clearcoatRoughnessMap,p['def Shader "Transform2d_clearcoatRoughness"'])}else"float inputs:clearcoatRoughness"in A&&(m.clearcoatRoughness=parseFloat(A["float inputs:clearcoatRoughness"]));if("float inputs:ior"in A&&(m.ior=parseFloat(A["float inputs:ior"])),"float inputs:occlusion.connect"in A){const T=A["float inputs:occlusion.connect"],w=E(l,/(\w+).output/.exec(T)[1]);m.aoMap=S(w),m.aoMap.colorSpace=f.NoColorSpace,'def Shader "Transform2d_occlusion"'in p&&x(m.aoMap,p['def Shader "Transform2d_occlusion"'])}}if('def Shader "diffuseColor_texture"'in p){const A=p['def Shader "diffuseColor_texture"'];m.map=S(A),m.map.colorSpace=f.SRGBColorSpace}if('def Shader "normal_texture"'in p){const A=p['def Shader "normal_texture"'];m.normalMap=S(A),m.normalMap.colorSpace=f.NoColorSpace}}return m}function E(p,m){for(const A in p){const T=p[A];if(A.startsWith(`def Shader "${m}"`))return T;if(typeof T=="object"){const w=E(T,m);if(w)return w}}}function S(p){if("asset inputs:file"in p){const m=p["asset inputs:file"].replace(/@*/g,""),T=new f.TextureLoader().load(a[m]),w={'"clamp"':f.ClampToEdgeWrapping,'"mirror"':f.MirroredRepeatWrapping,'"repeat"':f.RepeatWrapping};return"token inputs:wrapS"in p&&(T.wrapS=w[p["token inputs:wrapS"]]),"token inputs:wrapT"in p&&(T.wrapT=w[p["token inputs:wrapT"]]),T}return null}function C(p){const m=g(u(p)),A=L(_(p)),T=m?new f.Mesh(m,A):new f.Object3D;if("matrix4d xformOp:transform"in p){const w=JSON.parse("["+p["matrix4d xformOp:transform"].replace(/[()]*/g,"")+"]");T.matrix.fromArray(w),T.matrix.decompose(T.position,T.quaternion,T.scale)}return T}function I(p,m){for(const A in p)if(A.startsWith("def Scope"))I(p[A],m);else if(A.startsWith("def Xform")){const T=C(p[A]);/def Xform "(\w+)"/.test(A)&&(T.name=/def Xform "(\w+)"/.exec(A)[1]),m.add(T),I(p[A],T)}}const M=new f.Group;return I(l,M),M}}const W=new WeakMap;class ze extends f.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,r,n){const o=new f.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,s=>{this.parse(s,t,n)},r,n)}parse(e,t,r=()=>{}){this.decodeDracoFile(e,t,null,null,f.SRGBColorSpace).catch(r)}decodeDracoFile(e,t,r,n,o=f.LinearSRGBColorSpace,s=()=>{}){const a={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:o};return this.decodeGeometry(e,a).then(t).catch(s)}decodeGeometry(e,t){const r=JSON.stringify(t);if(W.has(e)){const i=W.get(e);if(i.key===r)return i.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 o=this.workerNextTaskID++,s=e.byteLength,a=this._getWorker(o,s).then(i=>(n=i,new Promise((c,l)=>{n._callbacks[o]={resolve:c,reject:l},n.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))).then(i=>this._createGeometry(i.geometry));return a.catch(()=>!0).then(()=>{n&&o&&this._releaseTask(n,o)}),W.set(e,{key:r,promise:a}),a}_createGeometry(e){const t=new f.BufferGeometry;e.index&&t.setIndex(new f.BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const n=e.attributes[r],o=n.name,s=n.array,a=n.itemSize,i=new f.BufferAttribute(s,a);o==="color"&&(this._assignVertexColorSpace(i,n.vertexColorSpace),i.normalized=!(s instanceof Float32Array)),t.setAttribute(o,i)}return t}_assignVertexColorSpace(e,t){if(t!==f.SRGBColorSpace)return;const r=new f.Color;for(let n=0,o=e.count;n<o;n++)r.fromBufferAttribute(e,n).convertSRGBToLinear(),e.setXYZ(n,r.r,r.g,r.b)}_loadLibrary(e,t){const r=new f.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((n,o)=>{r.load(e,n,void 0,o)})}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(r=>{const n=r[0];e||(this.decoderConfig.wasmBinary=r[1]);const o=Ye.toString(),s=["/* draco decoder */",n,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
3
3
  `);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),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(o){const s=o.data;switch(s.type){case"decode":n._callbacks[s.id].resolve(s);break;case"error":n._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,o){return n._taskLoad>o._taskLoad?-1:1});const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_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 Ye(){let h,e;onmessage=function(s){const a=s.data;switch(a.type){case"init":h=a.decoderConfig,e=new Promise(function(l){h.onModuleLoaded=function(u){l({draco:u})},DracoDecoderModule(h)});break;case"decode":const i=a.buffer,c=a.taskConfig;e.then(l=>{const u=l.draco,d=new u.Decoder;try{const g=t(u,d,new Int8Array(i),c),y=g.attributes.map(_=>_.array.buffer);g.index&&y.push(g.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:g},y)}catch(g){console.error(g),self.postMessage({type:"error",id:a.id,error:g.message})}finally{u.destroy(d)}});break}};function t(s,a,i,c){const l=c.attributeIDs,u=c.attributeTypes;let d,g;const y=a.GetEncodedGeometryType(i);if(y===s.TRIANGULAR_MESH)d=new s.Mesh,g=a.DecodeArrayToMesh(i,i.byteLength,d);else if(y===s.POINT_CLOUD)d=new s.PointCloud,g=a.DecodeArrayToPointCloud(i,i.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());const _={index:null,attributes:[]};for(const R in l){const x=self[u[R]];let L,E;if(c.useUniqueIDs)E=l[R],L=a.GetAttributeByUniqueId(d,E);else{if(E=a.GetAttributeId(d,s[l[R]]),E===-1)continue;L=a.GetAttribute(d,E)}const S=n(s,a,d,R,x,L);R==="color"&&(S.vertexColorSpace=c.vertexColorSpace),_.attributes.push(S)}return y===s.TRIANGULAR_MESH&&(_.index=r(s,a,d)),s.destroy(d),_}function r(s,a,i){const l=i.num_faces()*3,u=l*4,d=s._malloc(u);a.GetTrianglesUInt32Array(i,u,d);const g=new Uint32Array(s.HEAPF32.buffer,d,l).slice();return s._free(d),{array:g,itemSize:1}}function n(s,a,i,c,l,u){const d=u.num_components(),y=i.num_points()*d,_=y*l.BYTES_PER_ELEMENT,R=o(s,l),x=s._malloc(_);a.GetAttributeDataArrayForAllPoints(i,u,R,_,x);const L=new l(s.HEAPF32.buffer,x,y).slice();return s._free(x),{name:c,array:L,itemSize:d}}function o(s,a){switch(a){case Float32Array:return s.DT_FLOAT32;case Int8Array:return s.DT_INT8;case Int16Array:return s.DT_INT16;case Int32Array:return s.DT_INT32;case Uint8Array:return s.DT_UINT8;case Uint16Array:return s.DT_UINT16;case Uint32Array:return s.DT_UINT32}}}function oe(){let h,e;onmessage=function(s){const a=s.data;switch(a.type){case"init":h=a.decoderConfig,e=new Promise(function(l){h.onModuleLoaded=function(u){l({draco:u})},DracoDecoderModule(h)});break;case"decode":const i=a.buffer,c=a.taskConfig;e.then(l=>{const u=l.draco,d=new u.Decoder;try{const g=t(u,d,new Int8Array(i),c),y=g.attributes.map(_=>_.array.buffer);g.index&&y.push(g.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:g},y)}catch(g){console.error(g),self.postMessage({type:"error",id:a.id,error:g.message})}finally{u.destroy(d)}});break}};function t(s,a,i,c){const l=c.attributeIDs,u=c.attributeTypes;let d,g;const y=a.GetEncodedGeometryType(i);if(y===s.TRIANGULAR_MESH)d=new s.Mesh,g=a.DecodeArrayToMesh(i,i.byteLength,d);else if(y===s.POINT_CLOUD)d=new s.PointCloud,g=a.DecodeArrayToPointCloud(i,i.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());const _={index:null,attributes:[]};for(const R in l){const x=self[u[R]];let L,E;if(c.useUniqueIDs)E=l[R],L=a.GetAttributeByUniqueId(d,E);else{if(E=a.GetAttributeId(d,s[l[R]]),E===-1)continue;L=a.GetAttribute(d,E)}const S=n(s,a,d,R,x,L);R==="color"&&(S.vertexColorSpace=c.vertexColorSpace),_.attributes.push(S)}return y===s.TRIANGULAR_MESH&&(_.index=r(s,a,d)),s.destroy(d),_}function r(s,a,i){const l=i.num_faces()*3,u=l*4,d=s._malloc(u);a.GetTrianglesUInt32Array(i,u,d);const g=new Uint32Array(s.HEAPF32.buffer,d,l).slice();return s._free(d),{array:g,itemSize:1}}function n(s,a,i,c,l,u){const d=u.num_components(),y=i.num_points()*d,_=y*l.BYTES_PER_ELEMENT,R=o(s,l),x=s._malloc(_);a.GetAttributeDataArrayForAllPoints(i,u,R,_,x);const L=new l(s.HEAPF32.buffer,x,y).slice();return s._free(x),{name:c,array:L,itemSize:d}}function o(s,a){switch(a){case Float32Array:return s.DT_FLOAT32;case Int8Array:return s.DT_INT8;case Int16Array:return s.DT_INT16;case Int32Array:return s.DT_INT32;case Uint8Array:return s.DT_UINT8;case Uint16Array:return s.DT_UINT16;case Uint32Array:return s.DT_UINT32}}}const X={LOAD_DRACO_JS_DECODER:async()=>(await Promise.resolve().then(()=>require("./draco_decoder-DvYjcLz_.cjs"))).default,LOAD_DRACO_WASM_WRAPPER:async()=>(await Promise.resolve().then(()=>require("./draco_wasm_wrapper-FoEVV9af.cjs"))).default,LOAD_DRACO_WASM_DECODER:async()=>{const h=(await Promise.resolve().then(()=>require("./draco_decoder-Bh9flJPu.cjs"))).default;return await(await fetch(h)).arrayBuffer()}};class ie extends ze{constructor(){super(...arguments);k(this,"decoderPending",null);k(this,"decoderConfig",{type:"js",wasmBinary:null});k(this,"workerSourceURL","")}async _initDecoder(){if(this.decoderPending)return this.decoderPending;const t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",r=[];return t?r.push(X.LOAD_DRACO_JS_DECODER()):(r.push(X.LOAD_DRACO_WASM_WRAPPER()),r.push(X.LOAD_DRACO_WASM_DECODER())),this.decoderPending=Promise.all(r).then(n=>{const o=n[0];t||(this.decoderConfig.wasmBinary=n[1]);const s=oe.toString(),a=["/* draco decoder */",o,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
4
4
  `);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}}class Je{constructor(){k(this,"_gltfLoader");k(this,"_usdzLoader");const e=new ie;e.setDecoderConfig({type:"wasm"}),this._gltfLoader=new de,this._gltfLoader.setDRACOLoader(e),this._usdzLoader=new qe}async load(e,t){let r;if(t)r=t;else if(r=Q.getFileTypeFromUri(e),r.length===0&&(r=await this._detectFileTypeFromContent(e),r.length===0))throw new U.FileTypeError("No file extension found in URI","");if(!Q.isFileTypeSupported(r))throw new U.FileTypeError(`Unsupported file type: ${r}. Supported types: ${fe.SUPPORTED_FILE_TYPES.join(", ")}`,r);const n=B.AssetCache.read(e);if(n)return n.arrayBuffer?this._parse(n.arrayBuffer,r):n.promise.then(a=>this._parse(a,r));const s=await B.AssetCache.create(e).load();return this._parse(s,r)}async _detectFileTypeFromContent(e){try{const t=B.AssetCache.read(e);let r;t?t.arrayBuffer?r=t.arrayBuffer:r=await t.promise:r=await B.AssetCache.create(e).load();const n=new Uint8Array(r);return n.length>=12&&String.fromCharCode(n[0],n[1],n[2],n[3])==="glTF"?n[12]===0?"glb":"gltf":n.length>=4&&n[0]===80&&n[1]===75&&(n[2]===3||n[2]===5)&&(n[3]===4||n[3]===6)?"usdz":""}catch{return""}}async _parse(e,t){try{switch(t){case"glb":case"gltf":return(await this._gltfLoader.parseAsync(e,"")).scene;case"usdz":return await this._usdzLoader.parse(e)}}catch(r){throw r instanceof Error?new U.ParseError(`Failed to parse ${t} file: ${r.message}`,r):new U.ParseError(`Failed to parse ${t} file`)}}}exports.AssetLoader=Je;exports.DRACOWorker=oe;exports.DracoLoader=ie;
@@ -3,10 +3,10 @@ var Be = (d, e, t) => e in d ? ve(d, e, { enumerable: !0, configurable: !0, writ
3
3
  var v = (d, e, t) => Be(d, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { TrianglesDrawMode as je, TriangleFanDrawMode as oe, TriangleStripDrawMode as be, Loader as ce, LoaderUtils as X, FileLoader as K, MeshPhysicalMaterial as O, Vector2 as Y, Color as U, LinearSRGBColorSpace as D, SRGBColorSpace as N, SpotLight as Ke, PointLight as Ve, DirectionalLight as We, Matrix4 as J, Vector3 as B, Quaternion as Le, InstancedMesh as Xe, InstancedBufferAttribute as ze, Object3D as ue, TextureLoader as Me, ImageBitmapLoader as qe, BufferAttribute as P, InterleavedBuffer as Ye, InterleavedBufferAttribute as Je, LinearMipmapLinearFilter as Ie, NearestMipmapLinearFilter as Qe, LinearMipmapNearestFilter as Ze, NearestMipmapNearestFilter as $e, LinearFilter as Ce, NearestFilter as et, RepeatWrapping as Q, MirroredRepeatWrapping as Ne, ClampToEdgeWrapping as De, PointsMaterial as tt, Material as $, LineBasicMaterial as nt, MeshStandardMaterial as Oe, DoubleSide as st, MeshBasicMaterial as W, PropertyBinding as rt, BufferGeometry as le, SkinnedMesh as ot, Mesh as Pe, LineSegments as it, Line as at, LineLoop as ct, Points as ut, Group as z, PerspectiveCamera as lt, MathUtils as ft, OrthographicCamera as dt, Skeleton as ht, AnimationClip as pt, Bone as mt, InterpolateDiscrete as gt, InterpolateLinear as ke, Texture as he, VectorKeyframeTrack as pe, NumberKeyframeTrack as me, QuaternionKeyframeTrack as ge, ColorManagement as Ae, FrontSide as At, Interpolant as Tt, Box3 as yt, Sphere as xt, NoColorSpace as H } from "three";
5
5
  import { u as Rt, a as Te } from "./fflate.module-xyO_T3Zm.mjs";
6
- import { S as _t } from "./FileTypes-owHHIk7N.mjs";
6
+ import { S as _t } from "./FileTypes-D_r2gn3i.mjs";
7
7
  import { g as wt, i as Et } from "./isFileTypeSupported-BSpswPHU.mjs";
8
8
  import { F as ye, P as xe } from "./parse-error-DfOPyLWM.mjs";
9
- import { A as q } from "./AssetCache-B65duc9h.mjs";
9
+ import { A as q } from "./AssetCache-CT7yQAu0.mjs";
10
10
  function Re(d, e) {
11
11
  if (e === je)
12
12
  return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
@@ -30,4 +30,4 @@
30
30
  @@%-::::::::::::-%@ @%-------------=%@@
31
31
  @@@@+:::::::#@@ @@*-------*@@@@
32
32
  @@@@@@@ @@@@@@
33
- `;window.DIVE={instances:[],get instance(){return window.DIVE.instances[0]}};const O={autoStart:!0,displayAxes:!1,...M,...G.DIVEPerspectiveCameraDefaultSettings,...x,...zA};class CA{constructor(t){i(this,"_instanceId",g.MathUtils.generateUUID());i(this,"_settings");i(this,"_views");i(this,"_mainView");i(this,"_scene");i(this,"_clock");i(this,"_orientationDisplay",null);this._settings={...O,...t??{}},this._clock=new AA,this._scene=new IA({backgroundColor:(t==null?void 0:t.backgroundColor)??O.backgroundColor,displayGrid:(t==null?void 0:t.displayGrid)??O.displayGrid,displayFloor:(t==null?void 0:t.displayFloor)??O.displayFloor});const A=new k(this._scene,new G.DIVEPerspectiveCamera,this._settings);this._clock.addTicker(A),this._views=[A],this._mainView=A,this._settings.displayAxes&&Promise.resolve().then(()=>require("../plugins/orientationdisplay/index.cjs")).then(({OrientationDisplay:e})=>{this._orientationDisplay=new e(this.mainView.renderer,this.scene,this.mainView.camera),this._clock.addTicker(this._orientationDisplay)}),this._settings.autoStart&&this.start(),console.log("DIVE 2.2.22 initialized successfully!"),console.log(KA),window.DIVE.instances.push(this)}static async QuickView(t,A){return Promise.resolve().then(()=>require("../plugins/quickview/index.cjs")).then(({QuickView:e})=>e(t,A))}get engine(){return{scene:this.scene,camera:this.mainView.camera,renderer:this.mainView.renderer,setCanvas:t=>{this.mainView.setCanvas(t)},clock:this.clock,start:()=>{this.start()},stop:()=>{this.stop()},dispose:()=>{this.dispose()}}}get views(){return this._views}get mainView(){return this._mainView}get canvas(){return this.mainView.canvas}get scene(){return this._scene}get clock(){return this._clock}start(){this._clock.start()}stop(){this._clock.stop()}async dispose(){return new Promise(t=>{this._views.forEach(A=>{A.dispose()}),this._views=[],this._orientationDisplay&&(this._clock.removeTicker(this._orientationDisplay),this._orientationDisplay.dispose()),this.scene.dispose(),window.DIVE.instances=window.DIVE.instances.filter(A=>A._instanceId!==this._instanceId),t()})}createView(t){const A=new k(this._scene,t??new G.DIVEPerspectiveCamera,{...this._settings,canvas:void 0});return this._views.push(A),this._clock.addTicker(A),this._views.length===1&&(this._mainView=A),A}disposeView(t){this._views=this._views.filter(A=>A!==t),this._clock.removeTicker(t),this._mainView===t&&(this._mainView=this._views[0]),t.dispose()}}const lA=CA,wA={glb:{key:"glb",extension:"glb"},gltf:{key:"gltf",extension:"gltf"},usdz:{key:"usdz",extension:"usdz"}},vA=Object.values(wA).map(r=>r.extension);exports.BoundingBox=E;exports.DIVE=CA;exports.DIVEAmbientLight=oA;exports.DIVEClock=AA;exports.DIVEDefaultSettings=O;exports.DIVEEngine=lA;exports.DIVEEnvironment=gA;exports.DIVEEnvironmentDefaultSettings=iA;exports.DIVEFloor=rA;exports.DIVEGrid=PA;exports.DIVEGroup=hA;exports.DIVEModel=_;exports.DIVENode=Z;exports.DIVEPointLight=sA;exports.DIVEPrimitive=fA;exports.DIVERenderPipeline=pA;exports.DIVERenderer=S;exports.DIVERendererDefaultSettings=x;exports.DIVEResizeManager=tA;exports.DIVERoot=aA;exports.DIVEScene=IA;exports.DIVESceneDefaultSettings=M;exports.DIVESceneLight=nA;exports.DIVEView=k;exports.FILE_TYPES=wA;exports.GRID_CENTER_LINE_COLOR=BA;exports.GRID_SIDE_LINE_COLOR=cA;exports.OrbitController=T;exports.OrbitControllerDefaultSettings=zA;exports.SUPPORTED_FILE_TYPES=vA;exports.findSceneRecursive=J;
33
+ `;window.DIVE={instances:[],get instance(){return window.DIVE.instances[0]}};const O={autoStart:!0,displayAxes:!1,...M,...G.DIVEPerspectiveCameraDefaultSettings,...x,...zA};class CA{constructor(t){i(this,"_instanceId",g.MathUtils.generateUUID());i(this,"_settings");i(this,"_views");i(this,"_mainView");i(this,"_scene");i(this,"_clock");i(this,"_orientationDisplay",null);this._settings={...O,...t??{}},this._clock=new AA,this._scene=new IA({backgroundColor:(t==null?void 0:t.backgroundColor)??O.backgroundColor,displayGrid:(t==null?void 0:t.displayGrid)??O.displayGrid,displayFloor:(t==null?void 0:t.displayFloor)??O.displayFloor});const A=new k(this._scene,new G.DIVEPerspectiveCamera,this._settings);this._clock.addTicker(A),this._views=[A],this._mainView=A,this._settings.displayAxes&&Promise.resolve().then(()=>require("../plugins/orientationdisplay/index.cjs")).then(({OrientationDisplay:e})=>{this._orientationDisplay=new e(this.mainView.renderer,this.scene,this.mainView.camera),this._clock.addTicker(this._orientationDisplay)}),this._settings.autoStart&&this.start(),console.log("DIVE 2.2.24 initialized successfully!"),console.log(KA),window.DIVE.instances.push(this)}static async QuickView(t,A){return Promise.resolve().then(()=>require("../plugins/quickview/index.cjs")).then(({QuickView:e})=>e(t,A))}get engine(){return{scene:this.scene,camera:this.mainView.camera,renderer:this.mainView.renderer,setCanvas:t=>{this.mainView.setCanvas(t)},clock:this.clock,start:()=>{this.start()},stop:()=>{this.stop()},dispose:()=>{this.dispose()}}}get views(){return this._views}get mainView(){return this._mainView}get canvas(){return this.mainView.canvas}get scene(){return this._scene}get clock(){return this._clock}start(){this._clock.start()}stop(){this._clock.stop()}async dispose(){return new Promise(t=>{this._views.forEach(A=>{A.dispose()}),this._views=[],this._orientationDisplay&&(this._clock.removeTicker(this._orientationDisplay),this._orientationDisplay.dispose()),this.scene.dispose(),window.DIVE.instances=window.DIVE.instances.filter(A=>A._instanceId!==this._instanceId),t()})}createView(t){const A=new k(this._scene,t??new G.DIVEPerspectiveCamera,{...this._settings,canvas:void 0});return this._views.push(A),this._clock.addTicker(A),this._views.length===1&&(this._mainView=A),A}disposeView(t){this._views=this._views.filter(A=>A!==t),this._clock.removeTicker(t),this._mainView===t&&(this._mainView=this._views[0]),t.dispose()}}const lA=CA,wA={glb:{key:"glb",extension:"glb"},gltf:{key:"gltf",extension:"gltf"},usdz:{key:"usdz",extension:"usdz"}},vA=Object.values(wA).map(r=>r.extension);exports.BoundingBox=E;exports.DIVE=CA;exports.DIVEAmbientLight=oA;exports.DIVEClock=AA;exports.DIVEDefaultSettings=O;exports.DIVEEngine=lA;exports.DIVEEnvironment=gA;exports.DIVEEnvironmentDefaultSettings=iA;exports.DIVEFloor=rA;exports.DIVEGrid=PA;exports.DIVEGroup=hA;exports.DIVEModel=_;exports.DIVENode=Z;exports.DIVEPointLight=sA;exports.DIVEPrimitive=fA;exports.DIVERenderPipeline=pA;exports.DIVERenderer=S;exports.DIVERendererDefaultSettings=x;exports.DIVEResizeManager=tA;exports.DIVERoot=aA;exports.DIVEScene=IA;exports.DIVESceneDefaultSettings=M;exports.DIVESceneLight=nA;exports.DIVEView=k;exports.FILE_TYPES=wA;exports.GRID_CENTER_LINE_COLOR=BA;exports.GRID_SIDE_LINE_COLOR=cA;exports.OrbitController=T;exports.OrbitControllerDefaultSettings=zA;exports.SUPPORTED_FILE_TYPES=vA;exports.findSceneRecursive=J;
@@ -1969,7 +1969,7 @@ class mi {
1969
1969
  this.mainView.camera
1970
1970
  ), this._clock.addTicker(this._orientationDisplay);
1971
1971
  }
1972
- ), this._settings.autoStart && this.start(), console.log("DIVE 2.2.22 initialized successfully!"), console.log(Di), window.DIVE.instances.push(this);
1972
+ ), this._settings.autoStart && this.start(), console.log("DIVE 2.2.24 initialized successfully!"), console.log(Di), window.DIVE.instances.push(this);
1973
1973
  }
1974
1974
  /**
1975
1975
  * @deprecated This static method will be removed in a future version. Please use `import { QuickView, QuickViewSettings, QuickViewDefaultSettings } from '@shopware-ag/dive/quickview'` instead.
@@ -1 +1 @@
1
- "use strict";var wt=Object.defineProperty;var gt=(r,n,e)=>n in r?wt(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var h=(r,n,e)=>gt(r,typeof n!="symbol"?n+"":n,e);require("./FileTypes-D4Kace9O.cjs");const t=require("three"),j=require("./findInterface-C6mrvf_t.cjs"),$=require("./PerspectiveCamera-iAsZqrnY.cjs"),Q=require("./AxisHelperColors-BrGqktN5.cjs"),D=new t.Raycaster,p=new t.Vector3,P=new t.Vector3,c=new t.Quaternion,tt={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},U={type:"change"},et={type:"mouseDown"},it={type:"mouseUp",mode:null},nt={type:"objectChange"};class bt extends t.Object3D{constructor(n,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const o=new xt;this._gizmo=o,this.add(o);const s=new Dt;this._plane=s,this.add(s);const a=this;function i(m,y){let A=y;Object.defineProperty(a,m,{get:function(){return A!==void 0?A:y},set:function(x){A!==x&&(A=x,s[m]=x,o[m]=x,a.dispatchEvent({type:m+"-changed",value:x}),a.dispatchEvent(U))}}),a[m]=y,s[m]=y,o[m]=y}i("camera",n),i("object",void 0),i("enabled",!0),i("axis",null),i("mode","translate"),i("translationSnap",null),i("rotationSnap",null),i("scaleSnap",null),i("space","world"),i("size",1),i("dragging",!1),i("showX",!0),i("showY",!0),i("showZ",!0);const d=new t.Vector3,f=new t.Vector3,E=new t.Quaternion,T=new t.Quaternion,z=new t.Vector3,C=new t.Quaternion,K=new t.Vector3,H=new t.Vector3,M=new t.Vector3,S=0,g=new t.Vector3;i("worldPosition",d),i("worldPositionStart",f),i("worldQuaternion",E),i("worldQuaternionStart",T),i("cameraPosition",z),i("cameraQuaternion",C),i("pointStart",K),i("pointEnd",H),i("rotationAxis",M),i("rotationAngle",S),i("eye",g),this._offset=new t.Vector3,this._startNorm=new t.Vector3,this._endNorm=new t.Vector3,this._cameraScale=new t.Vector3,this._parentPosition=new t.Vector3,this._parentQuaternion=new t.Quaternion,this._parentQuaternionInv=new t.Quaternion,this._parentScale=new t.Vector3,this._worldScaleStart=new t.Vector3,this._worldQuaternionInv=new t.Quaternion,this._worldScale=new t.Vector3,this._positionStart=new t.Vector3,this._quaternionStart=new t.Quaternion,this._scaleStart=new t.Vector3,this._getPointer=Mt.bind(this),this._onPointerDown=vt.bind(this),this._onPointerHover=St.bind(this),this._onPointerMove=Pt.bind(this),this._onPointerUp=Et.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(n){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(n)}pointerHover(n){if(this.object===void 0||this.dragging===!0)return;n!==null&&D.setFromCamera(n,this.camera);const e=N(this._gizmo.picker[this.mode],D);e?this.axis=e.object.name:this.axis=null}pointerDown(n){if(!(this.object===void 0||this.dragging===!0||n!=null&&n.button!==0)&&this.axis!==null){n!==null&&D.setFromCamera(n,this.camera);const e=N(this._plane,D,!0);e&&(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(e.point).sub(this.worldPositionStart)),this.dragging=!0,et.mode=this.mode,this.dispatchEvent(et)}}pointerMove(n){const e=this.axis,o=this.mode,s=this.object;let a=this.space;if(o==="scale"?a="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(a="world"),s===void 0||e===null||this.dragging===!1||n!==null&&n.button!==-1)return;n!==null&&D.setFromCamera(n,this.camera);const i=N(this._plane,D,!0);if(i){if(this.pointEnd.copy(i.point).sub(this.worldPositionStart),o==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),a==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),a==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(a==="local"&&(s.position.applyQuaternion(c.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),a==="world"&&(s.parent&&s.position.add(p.setFromMatrixPosition(s.parent.matrixWorld)),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(p.setFromMatrixPosition(s.parent.matrixWorld))));else if(o==="scale"){if(e.search("XYZ")!==-1){let d=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(d*=-1),P.set(d,d,d)}else p.copy(this.pointStart),P.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),P.applyQuaternion(this._worldQuaternionInv),P.divide(p),e.search("X")===-1&&(P.x=1),e.search("Y")===-1&&(P.y=1),e.search("Z")===-1&&(P.z=1);s.scale.copy(this._scaleStart).multiply(P),this.scaleSnap&&(e.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const d=20/this.worldPosition.distanceTo(p.setFromMatrixPosition(this.camera.matrixWorld));let f=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*d):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(tt[e]),p.copy(tt[e]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?f=!0:this.rotationAngle=this._offset.dot(p.normalize())*d),(e==="E"||f)&&(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),a==="local"&&e!=="E"&&e!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(U),this.dispatchEvent(nt)}}pointerUp(n){n!==null&&n.button!==0||(this.dragging&&this.axis!==null&&(it.mode=this.mode,this.dispatchEvent(it)),this.dragging=!1,this.axis=null)}dispose(){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.traverse(function(n){n.geometry&&n.geometry.dispose(),n.material&&n.material.dispose()})}attach(n){return this.object=n,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,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(U),this.dispatchEvent(nt),this.pointStart.copy(this.pointEnd))}getRaycaster(){return D}getMode(){return this.mode}setMode(n){this.mode=n}setTranslationSnap(n){this.translationSnap=n}setRotationSnap(n){this.rotationSnap=n}setScaleSnap(n){this.scaleSnap=n}setSize(n){this.size=n}setSpace(n){this.space=n}}function Mt(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const n=this.domElement.getBoundingClientRect();return{x:(r.clientX-n.left)/n.width*2-1,y:-(r.clientY-n.top)/n.height*2+1,button:r.button}}}function St(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function vt(r){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function Pt(r){this.enabled&&this.pointerMove(this._getPointer(r))}function Et(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function N(r,n,e){const o=n.intersectObject(r,!0);for(let s=0;s<o.length;s++)if(o[s].object.visible||e)return o[s];return!1}const q=new t.Euler,l=new t.Vector3(0,1,0),ot=new t.Vector3(0,0,0),st=new t.Matrix4,B=new t.Quaternion,F=new t.Quaternion,b=new t.Vector3,rt=new t.Matrix4,O=new t.Vector3(1,0,0),I=new t.Vector3(0,1,0),Z=new t.Vector3(0,0,1),W=new t.Vector3,X=new t.Vector3,Y=new t.Vector3;class xt extends t.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const n=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=n.clone();o.opacity=.15;const s=e.clone();s.opacity=.5;const a=n.clone();a.color.setHex(16711680);const i=n.clone();i.color.setHex(65280);const d=n.clone();d.color.setHex(255);const f=n.clone();f.color.setHex(16711680),f.opacity=.5;const E=n.clone();E.color.setHex(65280),E.opacity=.5;const T=n.clone();T.color.setHex(255),T.opacity=.5;const z=n.clone();z.opacity=.25;const C=n.clone();C.color.setHex(16776960),C.opacity=.25,n.clone().color.setHex(16776960);const H=n.clone();H.color.setHex(7895160);const M=new t.CylinderGeometry(0,.04,.1,12);M.translate(0,.05,0);const S=new t.BoxGeometry(.08,.08,.08);S.translate(0,.04,0);const g=new t.BufferGeometry;g.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const m=new t.CylinderGeometry(.0075,.0075,.5,3);m.translate(0,.25,0);function y(_,V){const w=new t.TorusGeometry(_,.0075,3,64,V*Math.PI*2);return w.rotateY(Math.PI/2),w.rotateX(Math.PI/2),w}function A(){const _=new t.BufferGeometry;return _.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),_}const x={X:[[new t.Mesh(M,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(M,a),[-.5,0,0],[0,0,Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(M,i),[0,.5,0]],[new t.Mesh(M,i),[0,-.5,0],[Math.PI,0,0]],[new t.Mesh(m,i)]],Z:[[new t.Mesh(M,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(M,d),[0,0,-.5],[-Math.PI/2,0,0]],[new t.Mesh(m,d),null,[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),z.clone()),[0,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T.clone()),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},ht={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.2,0),o)]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},ct={START:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new t.Line(A(),s),null,null,null,"helper"]],X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},dt={XYZE:[[new t.Mesh(y(.5,1),H),null,[0,Math.PI/2,0]]],X:[[new t.Mesh(y(.5,.5),a)]],Y:[[new t.Mesh(y(.5,.5),i),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(y(.5,.5),d),null,[0,Math.PI/2,0]]],E:[[new t.Mesh(y(.75,1),C),null,[0,Math.PI/2,0]]]},pt={AXIS:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},mt={XYZE:[[new t.Mesh(new t.SphereGeometry(.25,10,8),o)]],X:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new t.Mesh(new t.TorusGeometry(.75,.1,2,24),o)]]},ut={X:[[new t.Mesh(S,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]],[new t.Mesh(S,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(S,i),[0,.5,0]],[new t.Mesh(m,i)],[new t.Mesh(S,i),[0,-.5,0],[0,0,Math.PI]]],Z:[[new t.Mesh(S,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(m,d),[0,0,0],[Math.PI/2,0,0]],[new t.Mesh(S,d),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.1,.1,.1),z.clone())]]},ft={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},_t={X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function v(_){const V=new t.Object3D;for(const w in _)for(let G=_[w].length;G--;){const u=_[w][G][0].clone(),L=_[w][G][1],R=_[w][G][2],k=_[w][G][3],yt=_[w][G][4];u.name=w,u.tag=yt,L&&u.position.set(L[0],L[1],L[2]),R&&u.rotation.set(R[0],R[1],R[2]),k&&u.scale.set(k[0],k[1],k[2]),u.updateMatrix();const J=u.geometry.clone();J.applyMatrix4(u.matrix),u.geometry=J,u.renderOrder=1/0,u.position.set(0,0,0),u.rotation.set(0,0,0),u.scale.set(1,1,1),V.add(u)}return V}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=v(x)),this.add(this.gizmo.rotate=v(dt)),this.add(this.gizmo.scale=v(ut)),this.add(this.picker.translate=v(ht)),this.add(this.picker.rotate=v(mt)),this.add(this.picker.scale=v(ft)),this.add(this.helper.translate=v(ct)),this.add(this.helper.rotate=v(pt)),this.add(this.helper.scale=v(_t)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(n){const o=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:F;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 s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let a=0;a<s.length;a++){const i=s[a];i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition);let d;if(this.camera.isOrthographicCamera?d=(this.camera.top-this.camera.bottom)/this.camera.zoom:d=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),i.scale.set(1,1,1).multiplyScalar(d*this.size/4),i.tag==="helper"){i.visible=!1,i.name==="AXIS"?(i.visible=!!this.axis,this.axis==="X"&&(c.setFromEuler(q.set(0,0,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(c.setFromEuler(q.set(0,0,Math.PI/2)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),l.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(st.lookAt(ot,l,I)),i.quaternion.multiply(c),i.visible=this.dragging),this.axis==="E"&&(i.visible=!1)):i.name==="START"?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):i.name==="END"?(i.position.copy(this.worldPosition),i.visible=this.dragging):i.name==="DELTA"?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),p.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),p.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(p),i.visible=this.dragging):(i.quaternion.copy(o),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=this.axis.search(i.name)!==-1));continue}i.quaternion.copy(o),this.mode==="translate"||this.mode==="scale"?(i.name==="X"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Y"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Z"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XY"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="YZ"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XZ"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(B.copy(o),l.copy(this.eye).applyQuaternion(c.copy(o).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(st.lookAt(this.eye,ot,I)),i.name==="X"&&(c.setFromAxisAngle(O,Math.atan2(-l.y,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Y"&&(c.setFromAxisAngle(I,Math.atan2(l.x,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Z"&&(c.setFromAxisAngle(Z,Math.atan2(l.y,l.x)),c.multiplyQuaternions(B,c),i.quaternion.copy(c))),i.visible=i.visible&&(i.name.indexOf("X")===-1||this.showX),i.visible=i.visible&&(i.name.indexOf("Y")===-1||this.showY),i.visible=i.visible&&(i.name.indexOf("Z")===-1||this.showZ),i.visible=i.visible&&(i.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),i.material._color=i.material._color||i.material.color.clone(),i.material._opacity=i.material._opacity||i.material.opacity,i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled&&this.axis&&(i.name===this.axis||this.axis.split("").some(function(f){return i.name===f}))&&(i.material.color.setHex(16776960),i.material.opacity=1)}super.updateMatrixWorld(n)}}class Dt extends t.Mesh{constructor(){super(new t.PlaneGeometry(1e5,1e5,2,2),new t.MeshBasicMaterial({visible:!1,wireframe:!0,side:t.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(n){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),W.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:F),X.copy(I).applyQuaternion(e==="local"?this.worldQuaternion:F),Y.copy(Z).applyQuaternion(e==="local"?this.worldQuaternion:F),l.copy(X),this.mode){case"translate":case"scale":switch(this.axis){case"X":l.copy(this.eye).cross(W),b.copy(W).cross(l);break;case"Y":l.copy(this.eye).cross(X),b.copy(X).cross(l);break;case"Z":l.copy(this.eye).cross(Y),b.copy(Y).cross(l);break;case"XY":b.copy(Y);break;case"YZ":b.copy(W);break;case"XZ":l.copy(Y),b.copy(X);break;case"XYZ":case"E":b.set(0,0,0);break}break;case"rotate":default:b.set(0,0,0)}b.length()===0?this.quaternion.copy(this.cameraQuaternion):(rt.lookAt(p.set(0,0,0),b,l),this.quaternion.setFromRotationMatrix(rt)),super.updateMatrixWorld(n)}}class at{constructor(n,e){h(this,"POINTER_DRAG_THRESHOLD",.001);h(this,"name");h(this,"_canvas");h(this,"_scene");h(this,"_controller");h(this,"_pointer");h(this,"_pointerPrimaryDown");h(this,"_pointerMiddleDown");h(this,"_pointerSecondaryDown");h(this,"_lastPointerDown");h(this,"_lastPointerUp");h(this,"_raycaster");h(this,"_intersects");h(this,"_hovered");h(this,"_dragging");h(this,"_dragStart");h(this,"_dragCurrent");h(this,"_dragEnd");h(this,"_dragDelta");h(this,"_draggable");h(this,"_dragRaycastOnObjects");this.name="BaseTool",this._canvas=e.domElement,this._scene=n,this._controller=e,this._pointer=new t.Vector2,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new t.Vector2,this._lastPointerUp=new t.Vector2,this._raycaster=new t.Raycaster,this._raycaster.layers.mask=$.PRODUCT_LAYER_MASK|$.UI_LAYER_MASK,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new t.Vector3,this._dragCurrent=new t.Vector3,this._dragEnd=new t.Vector3,this._dragDelta=new t.Vector3,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}activate(){}deactivate(){}onPointerDown(n){var e;switch(n.button){case 0:{this._pointerPrimaryDown=!0;break}case 1:{this._pointerMiddleDown=!0;break}case 2:{this._pointerSecondaryDown=!0;break}default:console.warn("DIVEBaseTool.onPointerDown: Unknown button: "+n.button)}this._lastPointerDown.copy(this._pointer),this._draggable=j.findInterface((e=this._intersects[0])==null?void 0:e.object,"isDraggable")||null}onDragStart(n){this._draggable&&(this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0)),this._intersects.length!==0&&(this._dragStart.copy(this._intersects[0].point.clone()),this._dragCurrent.copy(this._intersects[0].point.clone()),this._dragEnd.copy(this._dragStart.clone()),this._dragDelta.set(0,0,0),this._draggable&&this._draggable.onDragStart&&(this._draggable.onDragStart({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._dragging=!0,this._controller.enabled=!1)))}onPointerMove(n){var o;this._pointer.x=n.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(n.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const e=j.findInterface((o=this._intersects[0])==null?void 0:o.object,"isHoverable");if(this._intersects[0]&&e){if(!this._hovered){e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}if(this._hovered.uuid!==e.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}e.onPointerOver&&e.onPointerOver(this._intersects[0]),this._hovered=e}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(n),this.onDrag(n))}onDrag(n){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const e=this._intersects[0];e&&(this._dragCurrent.copy(e.point.clone()),this._dragEnd.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone()),this._draggable&&this._draggable.onDrag&&this._draggable.onDrag({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}))}onPointerUp(n){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(n):this.onClick(n),n.button){case 0:this._pointerPrimaryDown=!1;break;case 1:this._pointerMiddleDown=!1;break;case 2:this._pointerSecondaryDown=!1;break}this._lastPointerUp.copy(this._pointer)}onClick(n){}onDragEnd(n){const e=this._intersects[0];e&&(this._dragEnd.copy(e.point.clone()),this._dragCurrent.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone())),this._draggable&&this._draggable.onDragEnd&&this._draggable.onDragEnd({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._draggable=null,this._dragging=!1,this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0),this._controller.enabled=!0}onWheel(n){}raycast(n){return n!==void 0?this._raycaster.intersectObjects(n,!0).filter(e=>e.object.visible):this._raycaster.intersectObjects(this._scene.children,!0).filter(e=>e.object.visible)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}const It=r=>r.isTransformTool!==void 0;class lt extends at{constructor(e,o){super(e,o);h(this,"isTransformTool",!0);h(this,"_scaleLinked");h(this,"_gizmo");this.name="DIVETransformTool",this._scaleLinked=!1,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo)}activate(){}setGizmoMode(e){this._gizmo.mode=e}setGizmoVisible(e){const o=this._scene.children.includes(this._gizmo);e&&!o?(this._scene.add(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.enableAll()):!e&&o&&(this._scene.remove(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.disableAll())}setGizmoScaleLinked(e){this._scaleLinked=e}initGizmo(){const e=new bt(this._controller.object,this._controller.domElement);return e.mode="translate",e.traverse(o=>{if(!("isMesh"in o))return;const s=o.material;o.name==="X"&&s.color.set(Q.AxesColorRed),o.name==="Y"&&s.color.set(Q.AxesColorGreen),o.name==="Z"&&s.color.set(Q.AxesColorBlue),o.name==="XY"&&s.color.set(Q.AxesColorBlue),o.name==="YZ"&&s.color.set(Q.AxesColorRed),o.name==="XZ"&&s.color.set(Q.AxesColorGreen)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(j.implementsInterface(e.object,"isMovable")&&e.object.onMove&&(e.object.onMove(),this._scaleLinked)){const o=e.object.scale,s=(o.x+o.y+o.z)/3;e.object.scale.set(s,s,s)}}),e.addEventListener("mouseUp",()=>{this._controller.enabled=!0,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Tt=r=>r.isSelectTool!==void 0;class At extends lt{constructor(e,o){super(e,o);h(this,"isSelectTool",!0);this.name="SelectTool"}activate(){}select(e){this.attachGizmo(e),e.onSelect&&e.onSelect()}deselect(e){this.detachGizmo(),e.onDeselect&&e.onDeselect()}attachGizmo(e){if("isMovable"in e){const o=e;this._gizmo.attach(o),this.setGizmoVisible(o.visible)}}detachGizmo(){this._gizmo.detach()}onClick(e){super.onClick(e);const o=this._raycaster.intersectObjects(this._scene.root.children,!0).filter(a=>a.object.visible)[0],s=j.findInterface(o==null?void 0:o.object,"isSelectable");if(!o||!s){this._gizmo.object&&this.deselect(this._gizmo.object);return}if(this._gizmo.object){if(this._gizmo.object.uuid===s.uuid)return;this.deselect(this._gizmo.object)}this.select(s)}}exports.DIVEBaseTool=at;exports.DIVESelectTool=At;exports.DIVETransformTool=lt;exports.isSelectTool=Tt;exports.isTransformTool=It;
1
+ "use strict";var wt=Object.defineProperty;var gt=(r,n,e)=>n in r?wt(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var h=(r,n,e)=>gt(r,typeof n!="symbol"?n+"":n,e);require("./FileTypes-CjUNNEmP.cjs");const t=require("three"),j=require("./findInterface-C6mrvf_t.cjs"),$=require("./PerspectiveCamera-iAsZqrnY.cjs"),Q=require("./AxisHelperColors-BrGqktN5.cjs"),D=new t.Raycaster,p=new t.Vector3,P=new t.Vector3,c=new t.Quaternion,tt={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},U={type:"change"},et={type:"mouseDown"},it={type:"mouseUp",mode:null},nt={type:"objectChange"};class bt extends t.Object3D{constructor(n,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const o=new xt;this._gizmo=o,this.add(o);const s=new Dt;this._plane=s,this.add(s);const a=this;function i(m,y){let A=y;Object.defineProperty(a,m,{get:function(){return A!==void 0?A:y},set:function(x){A!==x&&(A=x,s[m]=x,o[m]=x,a.dispatchEvent({type:m+"-changed",value:x}),a.dispatchEvent(U))}}),a[m]=y,s[m]=y,o[m]=y}i("camera",n),i("object",void 0),i("enabled",!0),i("axis",null),i("mode","translate"),i("translationSnap",null),i("rotationSnap",null),i("scaleSnap",null),i("space","world"),i("size",1),i("dragging",!1),i("showX",!0),i("showY",!0),i("showZ",!0);const d=new t.Vector3,f=new t.Vector3,E=new t.Quaternion,T=new t.Quaternion,z=new t.Vector3,C=new t.Quaternion,K=new t.Vector3,H=new t.Vector3,M=new t.Vector3,S=0,g=new t.Vector3;i("worldPosition",d),i("worldPositionStart",f),i("worldQuaternion",E),i("worldQuaternionStart",T),i("cameraPosition",z),i("cameraQuaternion",C),i("pointStart",K),i("pointEnd",H),i("rotationAxis",M),i("rotationAngle",S),i("eye",g),this._offset=new t.Vector3,this._startNorm=new t.Vector3,this._endNorm=new t.Vector3,this._cameraScale=new t.Vector3,this._parentPosition=new t.Vector3,this._parentQuaternion=new t.Quaternion,this._parentQuaternionInv=new t.Quaternion,this._parentScale=new t.Vector3,this._worldScaleStart=new t.Vector3,this._worldQuaternionInv=new t.Quaternion,this._worldScale=new t.Vector3,this._positionStart=new t.Vector3,this._quaternionStart=new t.Quaternion,this._scaleStart=new t.Vector3,this._getPointer=Mt.bind(this),this._onPointerDown=vt.bind(this),this._onPointerHover=St.bind(this),this._onPointerMove=Pt.bind(this),this._onPointerUp=Et.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(n){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(n)}pointerHover(n){if(this.object===void 0||this.dragging===!0)return;n!==null&&D.setFromCamera(n,this.camera);const e=N(this._gizmo.picker[this.mode],D);e?this.axis=e.object.name:this.axis=null}pointerDown(n){if(!(this.object===void 0||this.dragging===!0||n!=null&&n.button!==0)&&this.axis!==null){n!==null&&D.setFromCamera(n,this.camera);const e=N(this._plane,D,!0);e&&(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(e.point).sub(this.worldPositionStart)),this.dragging=!0,et.mode=this.mode,this.dispatchEvent(et)}}pointerMove(n){const e=this.axis,o=this.mode,s=this.object;let a=this.space;if(o==="scale"?a="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(a="world"),s===void 0||e===null||this.dragging===!1||n!==null&&n.button!==-1)return;n!==null&&D.setFromCamera(n,this.camera);const i=N(this._plane,D,!0);if(i){if(this.pointEnd.copy(i.point).sub(this.worldPositionStart),o==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),a==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),a==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(a==="local"&&(s.position.applyQuaternion(c.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),a==="world"&&(s.parent&&s.position.add(p.setFromMatrixPosition(s.parent.matrixWorld)),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(p.setFromMatrixPosition(s.parent.matrixWorld))));else if(o==="scale"){if(e.search("XYZ")!==-1){let d=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(d*=-1),P.set(d,d,d)}else p.copy(this.pointStart),P.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),P.applyQuaternion(this._worldQuaternionInv),P.divide(p),e.search("X")===-1&&(P.x=1),e.search("Y")===-1&&(P.y=1),e.search("Z")===-1&&(P.z=1);s.scale.copy(this._scaleStart).multiply(P),this.scaleSnap&&(e.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const d=20/this.worldPosition.distanceTo(p.setFromMatrixPosition(this.camera.matrixWorld));let f=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*d):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(tt[e]),p.copy(tt[e]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?f=!0:this.rotationAngle=this._offset.dot(p.normalize())*d),(e==="E"||f)&&(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),a==="local"&&e!=="E"&&e!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(U),this.dispatchEvent(nt)}}pointerUp(n){n!==null&&n.button!==0||(this.dragging&&this.axis!==null&&(it.mode=this.mode,this.dispatchEvent(it)),this.dragging=!1,this.axis=null)}dispose(){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.traverse(function(n){n.geometry&&n.geometry.dispose(),n.material&&n.material.dispose()})}attach(n){return this.object=n,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,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(U),this.dispatchEvent(nt),this.pointStart.copy(this.pointEnd))}getRaycaster(){return D}getMode(){return this.mode}setMode(n){this.mode=n}setTranslationSnap(n){this.translationSnap=n}setRotationSnap(n){this.rotationSnap=n}setScaleSnap(n){this.scaleSnap=n}setSize(n){this.size=n}setSpace(n){this.space=n}}function Mt(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const n=this.domElement.getBoundingClientRect();return{x:(r.clientX-n.left)/n.width*2-1,y:-(r.clientY-n.top)/n.height*2+1,button:r.button}}}function St(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function vt(r){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function Pt(r){this.enabled&&this.pointerMove(this._getPointer(r))}function Et(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function N(r,n,e){const o=n.intersectObject(r,!0);for(let s=0;s<o.length;s++)if(o[s].object.visible||e)return o[s];return!1}const q=new t.Euler,l=new t.Vector3(0,1,0),ot=new t.Vector3(0,0,0),st=new t.Matrix4,B=new t.Quaternion,F=new t.Quaternion,b=new t.Vector3,rt=new t.Matrix4,O=new t.Vector3(1,0,0),I=new t.Vector3(0,1,0),Z=new t.Vector3(0,0,1),W=new t.Vector3,X=new t.Vector3,Y=new t.Vector3;class xt extends t.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const n=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=n.clone();o.opacity=.15;const s=e.clone();s.opacity=.5;const a=n.clone();a.color.setHex(16711680);const i=n.clone();i.color.setHex(65280);const d=n.clone();d.color.setHex(255);const f=n.clone();f.color.setHex(16711680),f.opacity=.5;const E=n.clone();E.color.setHex(65280),E.opacity=.5;const T=n.clone();T.color.setHex(255),T.opacity=.5;const z=n.clone();z.opacity=.25;const C=n.clone();C.color.setHex(16776960),C.opacity=.25,n.clone().color.setHex(16776960);const H=n.clone();H.color.setHex(7895160);const M=new t.CylinderGeometry(0,.04,.1,12);M.translate(0,.05,0);const S=new t.BoxGeometry(.08,.08,.08);S.translate(0,.04,0);const g=new t.BufferGeometry;g.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const m=new t.CylinderGeometry(.0075,.0075,.5,3);m.translate(0,.25,0);function y(_,V){const w=new t.TorusGeometry(_,.0075,3,64,V*Math.PI*2);return w.rotateY(Math.PI/2),w.rotateX(Math.PI/2),w}function A(){const _=new t.BufferGeometry;return _.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),_}const x={X:[[new t.Mesh(M,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(M,a),[-.5,0,0],[0,0,Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(M,i),[0,.5,0]],[new t.Mesh(M,i),[0,-.5,0],[Math.PI,0,0]],[new t.Mesh(m,i)]],Z:[[new t.Mesh(M,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(M,d),[0,0,-.5],[-Math.PI/2,0,0]],[new t.Mesh(m,d),null,[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),z.clone()),[0,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T.clone()),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},ht={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.2,0),o)]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},ct={START:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new t.Line(A(),s),null,null,null,"helper"]],X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},dt={XYZE:[[new t.Mesh(y(.5,1),H),null,[0,Math.PI/2,0]]],X:[[new t.Mesh(y(.5,.5),a)]],Y:[[new t.Mesh(y(.5,.5),i),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(y(.5,.5),d),null,[0,Math.PI/2,0]]],E:[[new t.Mesh(y(.75,1),C),null,[0,Math.PI/2,0]]]},pt={AXIS:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},mt={XYZE:[[new t.Mesh(new t.SphereGeometry(.25,10,8),o)]],X:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new t.Mesh(new t.TorusGeometry(.75,.1,2,24),o)]]},ut={X:[[new t.Mesh(S,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]],[new t.Mesh(S,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(S,i),[0,.5,0]],[new t.Mesh(m,i)],[new t.Mesh(S,i),[0,-.5,0],[0,0,Math.PI]]],Z:[[new t.Mesh(S,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(m,d),[0,0,0],[Math.PI/2,0,0]],[new t.Mesh(S,d),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.1,.1,.1),z.clone())]]},ft={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},_t={X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function v(_){const V=new t.Object3D;for(const w in _)for(let G=_[w].length;G--;){const u=_[w][G][0].clone(),L=_[w][G][1],R=_[w][G][2],k=_[w][G][3],yt=_[w][G][4];u.name=w,u.tag=yt,L&&u.position.set(L[0],L[1],L[2]),R&&u.rotation.set(R[0],R[1],R[2]),k&&u.scale.set(k[0],k[1],k[2]),u.updateMatrix();const J=u.geometry.clone();J.applyMatrix4(u.matrix),u.geometry=J,u.renderOrder=1/0,u.position.set(0,0,0),u.rotation.set(0,0,0),u.scale.set(1,1,1),V.add(u)}return V}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=v(x)),this.add(this.gizmo.rotate=v(dt)),this.add(this.gizmo.scale=v(ut)),this.add(this.picker.translate=v(ht)),this.add(this.picker.rotate=v(mt)),this.add(this.picker.scale=v(ft)),this.add(this.helper.translate=v(ct)),this.add(this.helper.rotate=v(pt)),this.add(this.helper.scale=v(_t)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(n){const o=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:F;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 s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let a=0;a<s.length;a++){const i=s[a];i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition);let d;if(this.camera.isOrthographicCamera?d=(this.camera.top-this.camera.bottom)/this.camera.zoom:d=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),i.scale.set(1,1,1).multiplyScalar(d*this.size/4),i.tag==="helper"){i.visible=!1,i.name==="AXIS"?(i.visible=!!this.axis,this.axis==="X"&&(c.setFromEuler(q.set(0,0,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(c.setFromEuler(q.set(0,0,Math.PI/2)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),l.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(st.lookAt(ot,l,I)),i.quaternion.multiply(c),i.visible=this.dragging),this.axis==="E"&&(i.visible=!1)):i.name==="START"?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):i.name==="END"?(i.position.copy(this.worldPosition),i.visible=this.dragging):i.name==="DELTA"?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),p.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),p.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(p),i.visible=this.dragging):(i.quaternion.copy(o),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=this.axis.search(i.name)!==-1));continue}i.quaternion.copy(o),this.mode==="translate"||this.mode==="scale"?(i.name==="X"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Y"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Z"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XY"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="YZ"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XZ"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(B.copy(o),l.copy(this.eye).applyQuaternion(c.copy(o).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(st.lookAt(this.eye,ot,I)),i.name==="X"&&(c.setFromAxisAngle(O,Math.atan2(-l.y,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Y"&&(c.setFromAxisAngle(I,Math.atan2(l.x,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Z"&&(c.setFromAxisAngle(Z,Math.atan2(l.y,l.x)),c.multiplyQuaternions(B,c),i.quaternion.copy(c))),i.visible=i.visible&&(i.name.indexOf("X")===-1||this.showX),i.visible=i.visible&&(i.name.indexOf("Y")===-1||this.showY),i.visible=i.visible&&(i.name.indexOf("Z")===-1||this.showZ),i.visible=i.visible&&(i.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),i.material._color=i.material._color||i.material.color.clone(),i.material._opacity=i.material._opacity||i.material.opacity,i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled&&this.axis&&(i.name===this.axis||this.axis.split("").some(function(f){return i.name===f}))&&(i.material.color.setHex(16776960),i.material.opacity=1)}super.updateMatrixWorld(n)}}class Dt extends t.Mesh{constructor(){super(new t.PlaneGeometry(1e5,1e5,2,2),new t.MeshBasicMaterial({visible:!1,wireframe:!0,side:t.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(n){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),W.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:F),X.copy(I).applyQuaternion(e==="local"?this.worldQuaternion:F),Y.copy(Z).applyQuaternion(e==="local"?this.worldQuaternion:F),l.copy(X),this.mode){case"translate":case"scale":switch(this.axis){case"X":l.copy(this.eye).cross(W),b.copy(W).cross(l);break;case"Y":l.copy(this.eye).cross(X),b.copy(X).cross(l);break;case"Z":l.copy(this.eye).cross(Y),b.copy(Y).cross(l);break;case"XY":b.copy(Y);break;case"YZ":b.copy(W);break;case"XZ":l.copy(Y),b.copy(X);break;case"XYZ":case"E":b.set(0,0,0);break}break;case"rotate":default:b.set(0,0,0)}b.length()===0?this.quaternion.copy(this.cameraQuaternion):(rt.lookAt(p.set(0,0,0),b,l),this.quaternion.setFromRotationMatrix(rt)),super.updateMatrixWorld(n)}}class at{constructor(n,e){h(this,"POINTER_DRAG_THRESHOLD",.001);h(this,"name");h(this,"_canvas");h(this,"_scene");h(this,"_controller");h(this,"_pointer");h(this,"_pointerPrimaryDown");h(this,"_pointerMiddleDown");h(this,"_pointerSecondaryDown");h(this,"_lastPointerDown");h(this,"_lastPointerUp");h(this,"_raycaster");h(this,"_intersects");h(this,"_hovered");h(this,"_dragging");h(this,"_dragStart");h(this,"_dragCurrent");h(this,"_dragEnd");h(this,"_dragDelta");h(this,"_draggable");h(this,"_dragRaycastOnObjects");this.name="BaseTool",this._canvas=e.domElement,this._scene=n,this._controller=e,this._pointer=new t.Vector2,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new t.Vector2,this._lastPointerUp=new t.Vector2,this._raycaster=new t.Raycaster,this._raycaster.layers.mask=$.PRODUCT_LAYER_MASK|$.UI_LAYER_MASK,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new t.Vector3,this._dragCurrent=new t.Vector3,this._dragEnd=new t.Vector3,this._dragDelta=new t.Vector3,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}activate(){}deactivate(){}onPointerDown(n){var e;switch(n.button){case 0:{this._pointerPrimaryDown=!0;break}case 1:{this._pointerMiddleDown=!0;break}case 2:{this._pointerSecondaryDown=!0;break}default:console.warn("DIVEBaseTool.onPointerDown: Unknown button: "+n.button)}this._lastPointerDown.copy(this._pointer),this._draggable=j.findInterface((e=this._intersects[0])==null?void 0:e.object,"isDraggable")||null}onDragStart(n){this._draggable&&(this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0)),this._intersects.length!==0&&(this._dragStart.copy(this._intersects[0].point.clone()),this._dragCurrent.copy(this._intersects[0].point.clone()),this._dragEnd.copy(this._dragStart.clone()),this._dragDelta.set(0,0,0),this._draggable&&this._draggable.onDragStart&&(this._draggable.onDragStart({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._dragging=!0,this._controller.enabled=!1)))}onPointerMove(n){var o;this._pointer.x=n.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(n.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const e=j.findInterface((o=this._intersects[0])==null?void 0:o.object,"isHoverable");if(this._intersects[0]&&e){if(!this._hovered){e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}if(this._hovered.uuid!==e.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}e.onPointerOver&&e.onPointerOver(this._intersects[0]),this._hovered=e}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(n),this.onDrag(n))}onDrag(n){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const e=this._intersects[0];e&&(this._dragCurrent.copy(e.point.clone()),this._dragEnd.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone()),this._draggable&&this._draggable.onDrag&&this._draggable.onDrag({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}))}onPointerUp(n){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(n):this.onClick(n),n.button){case 0:this._pointerPrimaryDown=!1;break;case 1:this._pointerMiddleDown=!1;break;case 2:this._pointerSecondaryDown=!1;break}this._lastPointerUp.copy(this._pointer)}onClick(n){}onDragEnd(n){const e=this._intersects[0];e&&(this._dragEnd.copy(e.point.clone()),this._dragCurrent.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone())),this._draggable&&this._draggable.onDragEnd&&this._draggable.onDragEnd({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._draggable=null,this._dragging=!1,this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0),this._controller.enabled=!0}onWheel(n){}raycast(n){return n!==void 0?this._raycaster.intersectObjects(n,!0).filter(e=>e.object.visible):this._raycaster.intersectObjects(this._scene.children,!0).filter(e=>e.object.visible)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}const It=r=>r.isTransformTool!==void 0;class lt extends at{constructor(e,o){super(e,o);h(this,"isTransformTool",!0);h(this,"_scaleLinked");h(this,"_gizmo");this.name="DIVETransformTool",this._scaleLinked=!1,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo)}activate(){}setGizmoMode(e){this._gizmo.mode=e}setGizmoVisible(e){const o=this._scene.children.includes(this._gizmo);e&&!o?(this._scene.add(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.enableAll()):!e&&o&&(this._scene.remove(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.disableAll())}setGizmoScaleLinked(e){this._scaleLinked=e}initGizmo(){const e=new bt(this._controller.object,this._controller.domElement);return e.mode="translate",e.traverse(o=>{if(!("isMesh"in o))return;const s=o.material;o.name==="X"&&s.color.set(Q.AxesColorRed),o.name==="Y"&&s.color.set(Q.AxesColorGreen),o.name==="Z"&&s.color.set(Q.AxesColorBlue),o.name==="XY"&&s.color.set(Q.AxesColorBlue),o.name==="YZ"&&s.color.set(Q.AxesColorRed),o.name==="XZ"&&s.color.set(Q.AxesColorGreen)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(j.implementsInterface(e.object,"isMovable")&&e.object.onMove&&(e.object.onMove(),this._scaleLinked)){const o=e.object.scale,s=(o.x+o.y+o.z)/3;e.object.scale.set(s,s,s)}}),e.addEventListener("mouseUp",()=>{this._controller.enabled=!0,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Tt=r=>r.isSelectTool!==void 0;class At extends lt{constructor(e,o){super(e,o);h(this,"isSelectTool",!0);this.name="SelectTool"}activate(){}select(e){this.attachGizmo(e),e.onSelect&&e.onSelect()}deselect(e){this.detachGizmo(),e.onDeselect&&e.onDeselect()}attachGizmo(e){if("isMovable"in e){const o=e;this._gizmo.attach(o),this.setGizmoVisible(o.visible)}}detachGizmo(){this._gizmo.detach()}onClick(e){super.onClick(e);const o=this._raycaster.intersectObjects(this._scene.root.children,!0).filter(a=>a.object.visible)[0],s=j.findInterface(o==null?void 0:o.object,"isSelectable");if(!o||!s){this._gizmo.object&&this.deselect(this._gizmo.object);return}if(this._gizmo.object){if(this._gizmo.object.uuid===s.uuid)return;this.deselect(this._gizmo.object)}this.select(s)}}exports.DIVEBaseTool=at;exports.DIVESelectTool=At;exports.DIVETransformTool=lt;exports.isSelectTool=Tt;exports.isTransformTool=It;
@@ -1,7 +1,7 @@
1
1
  var jt = Object.defineProperty;
2
2
  var Xt = (r, i, t) => i in r ? jt(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
3
3
  var c = (r, i, t) => Xt(r, typeof i != "symbol" ? i + "" : i, t);
4
- import "./FileTypes-owHHIk7N.mjs";
4
+ import "./FileTypes-D_r2gn3i.mjs";
5
5
  import { Object3D as st, Vector3 as a, Quaternion as E, Raycaster as bt, MeshBasicMaterial as St, LineBasicMaterial as Yt, CylinderGeometry as w, BoxGeometry as f, BufferGeometry as lt, Float32BufferAttribute as ht, Mesh as o, OctahedronGeometry as B, Line as I, TorusGeometry as C, SphereGeometry as Qt, Euler as Zt, Matrix4 as vt, PlaneGeometry as Ht, DoubleSide as Ot, Vector2 as tt } from "three";
6
6
  import { f as ot, i as et } from "./findInterface-DbJ5qzbc.mjs";
7
7
  import { P as Ct, U as kt } from "./PerspectiveCamera-BFzE2TQU.mjs";