@shopware-ag/dive 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/build/chunks/{AssetCache-DnAAa719.mjs → AssetCache-DadU3pjv.mjs} +8 -9
  2. package/build/chunks/AssetCache-GSqD2GKD.cjs +1 -0
  3. package/build/chunks/{AssetLoader-DnVvCd41.cjs → AssetLoader-BOBXNUHe.cjs} +1 -1
  4. package/build/chunks/{AssetLoader-Bkp3fWZz.mjs → AssetLoader-Dwnjh3GI.mjs} +16 -17
  5. package/build/chunks/{FileTypes-D3Dxr2dj.mjs → FileTypes-CUga4xrG.mjs} +386 -294
  6. package/build/chunks/{FileTypes-B-MjfMGd.cjs → FileTypes-Cm1k0dUE.cjs} +2 -2
  7. package/build/chunks/GridNode-CK4PiwHT.cjs +1 -0
  8. package/build/chunks/GridNode-KgFpPNWa.mjs +30 -0
  9. package/build/chunks/{ModelComponent-WA0kLOEY.mjs → ModelComponent-Cpy9q21L.mjs} +1 -1
  10. package/build/chunks/{ModelComponent-Cmu0EX0r.cjs → ModelComponent-DuBAn1uS.cjs} +1 -1
  11. package/build/chunks/OrbitController-CK4OclLu.cjs +1 -0
  12. package/build/chunks/{OrbitController-DxCbrQVB.mjs → OrbitController-DFf6ANcN.mjs} +3 -4
  13. package/build/chunks/{SpriteTextComponent-BpoKLOjA.cjs → SpriteTextComponent-Bho3ynCj.cjs} +1 -1
  14. package/build/chunks/{SpriteTextComponent-DIZFqao0.mjs → SpriteTextComponent-DrBnD0_-.mjs} +1 -1
  15. package/build/chunks/{detachTransformControls-B4iRF1bw.mjs → detachTransformControls-D6VK3L3-.mjs} +1 -1
  16. package/build/chunks/{detachTransformControls-CZ2cd5hx.cjs → detachTransformControls-DFTq45Xl.cjs} +1 -1
  17. package/build/chunks/{isFileExtensionSupported-B1q2eWs7.cjs → isFileExtensionSupported-CCEhBoz9.cjs} +1 -1
  18. package/build/chunks/{isFileExtensionSupported-BqOqU3-h.mjs → isFileExtensionSupported-vz_2VJPi.mjs} +1 -1
  19. package/build/components/grid/GridComponent.d.ts +51 -1
  20. package/build/constants/GridColors.d.ts +46 -2
  21. package/build/dive.cjs +1 -1
  22. package/build/dive.mjs +106 -104
  23. package/build/engine/renderer/Renderer.d.ts +21 -1
  24. package/build/engine/scene/Scene.d.ts +9 -9
  25. package/build/plugins/ar/index.cjs +1 -1
  26. package/build/plugins/ar/index.mjs +1 -1
  27. package/build/plugins/assetcache/index.cjs +1 -1
  28. package/build/plugins/assetcache/index.mjs +1 -1
  29. package/build/plugins/assetloader/index.cjs +1 -1
  30. package/build/plugins/assetloader/index.mjs +2 -2
  31. package/build/plugins/mediacreator/index.cjs +1 -1
  32. package/build/plugins/mediacreator/index.mjs +3 -4
  33. package/build/plugins/orbitcontroller/index.cjs +1 -1
  34. package/build/plugins/orbitcontroller/index.mjs +1 -1
  35. package/build/plugins/orientationdisplay/index.cjs +1 -1
  36. package/build/plugins/orientationdisplay/index.mjs +4 -5
  37. package/build/plugins/quickview/index.cjs +1 -1
  38. package/build/plugins/quickview/index.mjs +7 -8
  39. package/build/plugins/shader/index.cjs +1 -1
  40. package/build/plugins/shader/index.mjs +1 -1
  41. package/build/plugins/shader/src/shaders/GridNode.d.ts +4 -0
  42. package/build/plugins/state/index.cjs +1 -1
  43. package/build/plugins/state/index.mjs +151 -163
  44. package/build/plugins/toolbox/index.cjs +1 -1
  45. package/build/plugins/toolbox/index.mjs +7 -8
  46. package/package.json +1 -1
  47. package/build/chunks/AssetCache-CUVFS7wk.cjs +0 -1
  48. package/build/chunks/GridNode-0R5ZnzR6.mjs +0 -30
  49. package/build/chunks/GridNode-iqnu86_v.cjs +0 -1
  50. package/build/chunks/OrbitController-CAJIiZeE.cjs +0 -1
@@ -1,10 +1,9 @@
1
1
  var _ = Object.defineProperty;
2
2
  var f = (i, e, t) => e in i ? _(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var s = (i, e, t) => f(i, typeof e != "symbol" ? e + "" : e, t);
4
- import "./FileTypes-D3Dxr2dj.mjs";
4
+ import "./FileTypes-CUga4xrG.mjs";
5
5
  import "three/webgpu";
6
6
  import "three/examples/jsm/loaders/HDRLoader.js";
7
- import "three/tsl";
8
7
  import { N as d, F as l } from "./network-error-BONfHWQq.mjs";
9
8
  class y {
10
9
  constructor(e) {
@@ -50,10 +49,10 @@ class y {
50
49
  let a = 0;
51
50
  try {
52
51
  for (; ; ) {
53
- const c = await t.read();
54
- if (c.done)
52
+ const o = await t.read();
53
+ if (o.done)
55
54
  break;
56
- const u = c.value ?? new Uint8Array(0);
55
+ const u = o.value ?? new Uint8Array(0);
57
56
  r.push(u), a += u.byteLength;
58
57
  }
59
58
  } finally {
@@ -100,10 +99,10 @@ class w {
100
99
  this._cache.clear();
101
100
  }
102
101
  }
103
- const n = Symbol.for("@shopware-ag/dive/assetcache"), o = globalThis;
104
- o[n] || (o[n] = new w());
105
- const k = o[n];
102
+ const n = Symbol.for("@shopware-ag/dive/assetcache"), c = globalThis;
103
+ c[n] || (c[n] = new w());
104
+ const b = c[n];
106
105
  export {
107
- k as A,
106
+ b as A,
108
107
  y as C
109
108
  };
@@ -0,0 +1 @@
1
+ "use strict";var d=Object.defineProperty;var l=(i,e,t)=>e in i?d(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var s=(i,e,t)=>l(i,typeof e!="symbol"?e+"":e,t);require("./FileTypes-Cm1k0dUE.cjs");require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");const _=require("./network-error-CdDXil5g.cjs");class f{constructor(e){s(this,"_promise");s(this,"_resolve");s(this,"_arrayBuffer",null);s(this,"_size",0);s(this,"_createdAt");s(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}_getHeader(e,t){var r,a;return((a=(r=e.headers)==null?void 0:r.get)==null?void 0:a.call(r,t))??null}_concatChunks(e,t){const r=new Uint8Array(t);let a=0;for(const n of e)r.set(n,a),a+=n.byteLength;return r.buffer}async _readBodyWithReader(e){const t=e.body.getReader(),r=[];let a=0;try{for(;;){const o=await t.read();if(o.done)break;const u=o.value??new Uint8Array(0);r.push(u),a+=u.byteLength}}finally{t.releaseLock()}return this._concatChunks(r,a)}async load(){var t;const e=await fetch(this._uri);if(!e.ok)throw new _.NetworkError(this._uri);try{(t=e.body)!=null&&t.getReader?this._arrayBuffer=await this._readBodyWithReader(e):this._arrayBuffer=await e.arrayBuffer(),this._size+=this._arrayBuffer.byteLength,this._updatedAt=new Date}catch{throw new _.FileContentError(this._uri)}return this._resolve(this._arrayBuffer),this._arrayBuffer}}class y{constructor(){s(this,"_cache",new Map)}get(){return this._cache}create(e){const t=new f(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 h=Symbol.for("@shopware-ag/dive/assetcache"),c=globalThis;c[h]||(c[h]=new y);const w=c[h];exports.AssetCache=w;exports.Chunk=f;
@@ -1,3 +1,3 @@
1
- "use strict";var G=Object.create;var C=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var q=(c,t,n)=>t in c?C(c,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[t]=n;var H=(c,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of v(t))!j.call(c,s)&&s!==n&&C(c,s,{get:()=>t[s],enumerable:!(r=B(t,s))||r.enumerable});return c};var I=(c,t,n)=>(n=c!=null?G(W(c)):{},H(t||!c||!c.__esModule?C(n,"default",{value:c,enumerable:!0}):n,c));var p=(c,t,n)=>q(c,typeof t!="symbol"?t+"":t,n);const z=require("three/examples/jsm/loaders/GLTFLoader.js"),Y=require("three/examples/jsm/loaders/USDLoader.js"),J=require("./FileTypes-B-MjfMGd.cjs"),w=require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");require("three/tsl");const U=require("./isFileExtensionSupported-B1q2eWs7.cjs"),R=require("./parse-error-Dy_EE4rL.cjs"),$=require("three/examples/jsm/loaders/DRACOLoader.js"),T=require("./AssetCache-CUVFS7wk.cjs");function N(){let c,t;onmessage=function(e){const o=e.data;switch(o.type){case"init":c=o.decoderConfig,t=new Promise(function(i){c.onModuleLoaded=function(_){i({draco:_})},DracoDecoderModule(c)});break;case"decode":const d=o.buffer,l=o.taskConfig;t.then(i=>{const _=i.draco,a=new _.Decoder;try{const u=n(_,a,new Int8Array(d),l),h=u.attributes.map(g=>g.array.buffer);u.index&&h.push(u.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:u},h)}catch(u){console.error(u),self.postMessage({type:"error",id:o.id,error:u.message})}finally{_.destroy(a)}});break}};function n(e,o,d,l){const i=l.attributeIDs,_=l.attributeTypes;let a,u;const h=o.GetEncodedGeometryType(d);if(h===e.TRIANGULAR_MESH)a=new e.Mesh,u=o.DecodeArrayToMesh(d,d.byteLength,a);else if(h===e.POINT_CLOUD)a=new e.PointCloud,u=o.DecodeArrayToPointCloud(d,d.byteLength,a);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!u.ok()||a.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+u.error_msg());const g={index:null,attributes:[]};for(const A in i){const D=self[_[A]];let y,m;if(l.useUniqueIDs)m=i[A],y=o.GetAttributeByUniqueId(a,m);else{if(m=o.GetAttributeId(a,e[i[A]]),m===-1)continue;y=o.GetAttribute(a,m)}const E=s(e,o,a,A,D,y);A==="color"&&(E.vertexColorSpace=l.vertexColorSpace),g.attributes.push(E)}return h===e.TRIANGULAR_MESH&&(g.index=r(e,o,a)),e.destroy(a),g}function r(e,o,d){const i=d.num_faces()*3,_=i*4,a=e._malloc(_);o.GetTrianglesUInt32Array(d,_,a);const u=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:u,itemSize:1}}function s(e,o,d,l,i,_){const a=d.num_points(),u=_.num_components(),h=f(e,i),g=u*i.BYTES_PER_ELEMENT,A=Math.ceil(g/4)*4,D=A/i.BYTES_PER_ELEMENT,y=a*g,m=a*A,E=e._malloc(y);o.GetAttributeDataArrayForAllPoints(d,_,h,y,E);const O=new i(e.HEAPF32.buffer,E,y/i.BYTES_PER_ELEMENT);let L;if(g===A)L=O.slice();else{L=new i(m/i.BYTES_PER_ELEMENT);let M=0;for(let b=0,x=O.length;b<x;b+=u){for(let S=0;S<u;S++)L[M+S]=O[b+S];M+=D}}return e._free(E),{name:l,count:a,itemSize:u,array:L,stride:D}}function f(e,o){switch(o){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}}const P={LOAD_DRACO_JS_DECODER:async()=>(await import("three/examples/jsm/libs/draco/draco_decoder.js?raw")).default,LOAD_DRACO_WASM_WRAPPER:async()=>(await import("three/examples/jsm/libs/draco/draco_wasm_wrapper.js?raw")).default,LOAD_DRACO_WASM_DECODER:async()=>{const c=(await import("three/examples/jsm/libs/draco/draco_decoder.wasm?url")).default;return await(await fetch(c)).arrayBuffer()}};class k extends $.DRACOLoader{constructor(){super(...arguments);p(this,"decoderPending",null);p(this,"decoderConfig",{type:"js",wasmBinary:null});p(this,"workerSourceURL","")}async _initDecoder(){if(this.decoderPending)return this.decoderPending;const n=typeof WebAssembly!="object"||this.decoderConfig.type==="js",r=[];return n?r.push(P.LOAD_DRACO_JS_DECODER()):(r.push(P.LOAD_DRACO_WASM_WRAPPER()),r.push(P.LOAD_DRACO_WASM_DECODER())),this.decoderPending=Promise.all(r).then(s=>{const f=s[0];n||(this.decoderConfig.wasmBinary=s[1]);const e=N.toString(),o=["/* draco decoder */",f,"","/* worker */",e.substring(e.indexOf("{")+1,e.lastIndexOf("}"))].join(`
1
+ "use strict";var G=Object.create;var C=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var q=(c,t,n)=>t in c?C(c,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[t]=n;var H=(c,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of v(t))!j.call(c,s)&&s!==n&&C(c,s,{get:()=>t[s],enumerable:!(r=B(t,s))||r.enumerable});return c};var I=(c,t,n)=>(n=c!=null?G(W(c)):{},H(t||!c||!c.__esModule?C(n,"default",{value:c,enumerable:!0}):n,c));var p=(c,t,n)=>q(c,typeof t!="symbol"?t+"":t,n);const z=require("three/examples/jsm/loaders/GLTFLoader.js"),Y=require("three/examples/jsm/loaders/USDLoader.js"),J=require("./FileTypes-Cm1k0dUE.cjs"),w=require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");const U=require("./isFileExtensionSupported-CCEhBoz9.cjs"),R=require("./parse-error-Dy_EE4rL.cjs"),$=require("three/examples/jsm/loaders/DRACOLoader.js"),T=require("./AssetCache-GSqD2GKD.cjs");function N(){let c,t;onmessage=function(e){const o=e.data;switch(o.type){case"init":c=o.decoderConfig,t=new Promise(function(i){c.onModuleLoaded=function(_){i({draco:_})},DracoDecoderModule(c)});break;case"decode":const d=o.buffer,l=o.taskConfig;t.then(i=>{const _=i.draco,a=new _.Decoder;try{const u=n(_,a,new Int8Array(d),l),h=u.attributes.map(g=>g.array.buffer);u.index&&h.push(u.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:u},h)}catch(u){console.error(u),self.postMessage({type:"error",id:o.id,error:u.message})}finally{_.destroy(a)}});break}};function n(e,o,d,l){const i=l.attributeIDs,_=l.attributeTypes;let a,u;const h=o.GetEncodedGeometryType(d);if(h===e.TRIANGULAR_MESH)a=new e.Mesh,u=o.DecodeArrayToMesh(d,d.byteLength,a);else if(h===e.POINT_CLOUD)a=new e.PointCloud,u=o.DecodeArrayToPointCloud(d,d.byteLength,a);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!u.ok()||a.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+u.error_msg());const g={index:null,attributes:[]};for(const A in i){const D=self[_[A]];let y,m;if(l.useUniqueIDs)m=i[A],y=o.GetAttributeByUniqueId(a,m);else{if(m=o.GetAttributeId(a,e[i[A]]),m===-1)continue;y=o.GetAttribute(a,m)}const E=s(e,o,a,A,D,y);A==="color"&&(E.vertexColorSpace=l.vertexColorSpace),g.attributes.push(E)}return h===e.TRIANGULAR_MESH&&(g.index=r(e,o,a)),e.destroy(a),g}function r(e,o,d){const i=d.num_faces()*3,_=i*4,a=e._malloc(_);o.GetTrianglesUInt32Array(d,_,a);const u=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:u,itemSize:1}}function s(e,o,d,l,i,_){const a=d.num_points(),u=_.num_components(),h=f(e,i),g=u*i.BYTES_PER_ELEMENT,A=Math.ceil(g/4)*4,D=A/i.BYTES_PER_ELEMENT,y=a*g,m=a*A,E=e._malloc(y);o.GetAttributeDataArrayForAllPoints(d,_,h,y,E);const O=new i(e.HEAPF32.buffer,E,y/i.BYTES_PER_ELEMENT);let L;if(g===A)L=O.slice();else{L=new i(m/i.BYTES_PER_ELEMENT);let M=0;for(let b=0,x=O.length;b<x;b+=u){for(let S=0;S<u;S++)L[M+S]=O[b+S];M+=D}}return e._free(E),{name:l,count:a,itemSize:u,array:L,stride:D}}function f(e,o){switch(o){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}}const P={LOAD_DRACO_JS_DECODER:async()=>(await import("three/examples/jsm/libs/draco/draco_decoder.js?raw")).default,LOAD_DRACO_WASM_WRAPPER:async()=>(await import("three/examples/jsm/libs/draco/draco_wasm_wrapper.js?raw")).default,LOAD_DRACO_WASM_DECODER:async()=>{const c=(await import("three/examples/jsm/libs/draco/draco_decoder.wasm?url")).default;return await(await fetch(c)).arrayBuffer()}};class k extends $.DRACOLoader{constructor(){super(...arguments);p(this,"decoderPending",null);p(this,"decoderConfig",{type:"js",wasmBinary:null});p(this,"workerSourceURL","")}async _initDecoder(){if(this.decoderPending)return this.decoderPending;const n=typeof WebAssembly!="object"||this.decoderConfig.type==="js",r=[];return n?r.push(P.LOAD_DRACO_JS_DECODER()):(r.push(P.LOAD_DRACO_WASM_WRAPPER()),r.push(P.LOAD_DRACO_WASM_DECODER())),this.decoderPending=Promise.all(r).then(s=>{const f=s[0];n||(this.decoderConfig.wasmBinary=s[1]);const e=N.toString(),o=["/* draco decoder */",f,"","/* worker */",e.substring(e.indexOf("{")+1,e.lastIndexOf("}"))].join(`
2
2
  `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}}function V(){let c=null,t=null;const n=[[/'CONFIG_CONTROL_DESIGN'\s*\)/g,"'AP203_CONFIGURATION_CONTROLLED_3D_DESIGN_OF_MECHANICAL_PARTS_AND_ASSEMBLIES_MIM_LF')"],[/'AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF\.\s*\{[\s\S]*?\}\s*'/g,"'AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF'"]];function r(){return c||(c=occtimportjs({locateFile:function(){return t}})),c}function s(e){for(var o=new TextDecoder("utf-8",{fatal:!1}),d=new TextEncoder,l=o.decode(e),i=0;i<n.length;i++){var _=n[i][0],a=n[i][1];l=l.replace(_,a)}return new Uint8Array(d.encode(l))}function f(e,o){var d=s(o);try{var l=e.ReadStepFile(d,null);if(l.success&&l.root)return l}catch{}try{return e.ReadStepFile(o,null)}catch{return{success:!1,root:{meshes:[],children:[]},meshes:[]}}}onmessage=async function(e){var o=e.data;switch(o.type){case"init":t=o.wasmUrl;break;case"parse":try{var d=await r(),l=new Uint8Array(o.buffer),i=o.fileType,_;if(i==="step"||i==="stp"?_=f(d,l):_=d.ReadIgesFile(l,null),!_.success||!_.root){self.postMessage({type:"error",id:o.id,error:"Failed to parse CAD file"});return}self.postMessage({type:"result",id:o.id,result:_})}catch(a){self.postMessage({type:"error",id:o.id,error:a instanceof Error?a.message:String(a)})}break}}}const F={LOAD_OCCT_JS:async()=>(await Promise.resolve().then(()=>require("./occt-import-js-DdbbsFBH.cjs"))).default,LOAD_OCCT_WASM_URL:async()=>(await Promise.resolve().then(()=>require("./occt-import-js-BQ1yZHCj.cjs"))).default};class Z{constructor(){p(this,"_workerPending",null);p(this,"_worker",null);p(this,"_nextId",0);p(this,"_pending",new Map)}_getWorker(){return this._workerPending?this._workerPending:(this._workerPending=(async()=>{const[t,n]=await Promise.all([F.LOAD_OCCT_JS(),F.LOAD_OCCT_WASM_URL()]),r=V.toString(),s=["/* occt-import-js */",t,"","/* step worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
3
3
  `),f=URL.createObjectURL(new Blob([s])),e=new Worker(f),o=new URL(n,window.location.href).href;return e.postMessage({type:"init",wasmUrl:o}),e.onmessage=d=>{const{type:l,id:i,result:_,error:a}=d.data,u=this._pending.get(i);if(u)if(this._pending.delete(i),l==="result")try{u.resolve(this._buildScene(_))}catch(h){u.reject(h instanceof Error?h:new Error(String(h)))}else u.reject(new Error(a??"Worker error"))},e.onerror=d=>{for(const[,{reject:l}]of this._pending)l(new Error(d.message??"Worker error"));this._pending.clear()},this._worker=e,e})(),this._workerPending)}async parseAsync(t,n){const r=this._nextId++,s=await this._getWorker();return new Promise((f,e)=>{this._pending.set(r,{resolve:f,reject:e});const o=t.slice(0);s.postMessage({type:"parse",id:r,buffer:o,fileType:n},[o])})}dispose(){if(this._worker){for(const[,{reject:t}]of this._pending)t(new Error("STEPLoader disposed"));this._pending.clear(),this._worker.terminate(),this._worker=null,this._workerPending=null}}_buildScene(t){const n=new w.Group;return n.name=t.root.name??"CAD Model",this._buildNode(t.root,t.meshes,n),n.rotation.x=-Math.PI/2,n.rotation.z=Math.PI/2,n}_buildNode(t,n,r){const s=new w.Group;s.name=t.name??"Part";for(const f of t.meshes){const e=n[f];if(e!=null&&e.attributes){const o=this._createMesh(e);s.add(o)}}for(const f of t.children)this._buildNode(f,n,s);r.add(s)}_createMesh(t){var l,i;const{position:n,normal:r}=t.attributes,s=t.index??t.attributes.index,f=new w.BufferGeometry;f.setAttribute("position",new w.BufferAttribute(new Float32Array(n.array),3)),(l=r==null?void 0:r.array)!=null&&l.length?f.setAttribute("normal",new w.BufferAttribute(new Float32Array(r.array),3)):f.computeVertexNormals(),(i=s==null?void 0:s.array)!=null&&i.length&&f.setIndex(new w.BufferAttribute(new Uint32Array(s.array),1));const e=t.color,o=new w.MeshStandardMaterial({metalness:.3,roughness:.6});e&&e.length>=3?o.color.setRGB(e[0],e[1],e[2]):o.color.setHex(13421772);const d=new w.Mesh(f,o);return d.name=t.name??"Mesh",d.castShadow=!0,d.receiveShadow=!0,d}}class K{constructor(){p(this,"_gltfLoader");p(this,"_usdLoader");p(this,"_stepLoader");const t=new k;t.setDecoderConfig({type:"wasm"}),this._gltfLoader=new z.GLTFLoader,this._gltfLoader.setDRACOLoader(t),this._usdLoader=new Y.USDLoader,this._stepLoader=new Z}async load(t,n){let r;if(n)r=n;else if(r=U.getFileTypeFromUri(t),r.length===0&&(r=await this._detectFileTypeFromContent(t),r.length===0))throw new R.FileTypeError("No file extension found in URI","");if(!U.isFileExtensionSupported(r))throw new R.FileTypeError(`Unsupported file type: ${r}. Supported types: ${J.SUPPORTED_FILE_TYPES.join(", ")}`,r);const s=T.AssetCache.read(t);if(s)return s.arrayBuffer?this._parse(s.arrayBuffer,r):s.promise.then(o=>this._parse(o,r));const e=await T.AssetCache.create(t).load();return this._parse(e,r)}async _detectFileTypeFromContent(t){try{const n=T.AssetCache.read(t);let r;n?n.arrayBuffer?r=n.arrayBuffer:r=await n.promise:r=await T.AssetCache.create(t).load();const s=new Uint8Array(r);return s.length>=12&&String.fromCharCode(s[0],s[1],s[2],s[3])==="glTF"?s[12]===0?"glb":"gltf":s.length>=4&&s[0]===80&&s[1]===75&&(s[2]===3||s[2]===5)&&(s[3]===4||s[3]===6)?"usdz":s.length>=20&&new TextDecoder("ascii").decode(s.subarray(0,20)).startsWith("ISO-10303-21")?"step":s.length>=80&&s[72]===83?"iges":""}catch{return""}}async _parse(t,n){try{switch(n){case"glb":case"gltf":{const r=await this._gltfLoader.parseAsync(t,"");return r.scene.animations=r.animations,r.scene}case"usdz":{const r=this._usdLoader.parse(t);return r.animations=[],r}case"step":case"stp":{const r=await this._stepLoader.parseAsync(t,n);return r.animations=[],r}case"iges":case"igs":{const r=await this._stepLoader.parseAsync(t,n);return r.animations=[],r}}}catch(r){throw r instanceof Error?new R.ParseError(`Failed to parse ${n} file: ${r.message}`,r):new R.ParseError(`Failed to parse ${n} file`)}}}exports.AssetLoader=K;exports.DRACOWorker=N;exports.DracoLoader=k;
@@ -3,14 +3,13 @@ var F = (_, r, s) => r in _ ? k(_, r, { enumerable: !0, configurable: !0, writab
3
3
  var h = (_, r, s) => F(_, typeof r != "symbol" ? r + "" : r, s);
4
4
  import { GLTFLoader as x } from "three/examples/jsm/loaders/GLTFLoader.js";
5
5
  import { USDLoader as G } from "three/examples/jsm/loaders/USDLoader.js";
6
- import { S as B } from "./FileTypes-D3Dxr2dj.mjs";
6
+ import { S as B } from "./FileTypes-CUga4xrG.mjs";
7
7
  import { Group as C, BufferGeometry as W, BufferAttribute as T, MeshStandardMaterial as v, Mesh as j } from "three/webgpu";
8
8
  import "three/examples/jsm/loaders/HDRLoader.js";
9
- import "three/tsl";
10
- import { g as H, i as z } from "./isFileExtensionSupported-BqOqU3-h.mjs";
9
+ import { g as H, i as z } from "./isFileExtensionSupported-vz_2VJPi.mjs";
11
10
  import { F as P, P as M } from "./parse-error-DfOPyLWM.mjs";
12
11
  import { DRACOLoader as Y } from "three/examples/jsm/loaders/DRACOLoader.js";
13
- import { A as S } from "./AssetCache-DnAAa719.mjs";
12
+ import { A as S } from "./AssetCache-DadU3pjv.mjs";
14
13
  function J() {
15
14
  let _, r;
16
15
  onmessage = function(e) {
@@ -34,7 +33,7 @@ function J() {
34
33
  new Int8Array(c),
35
34
  d
36
35
  ), p = l.attributes.map(
37
- (m) => m.array.buffer
36
+ (g) => g.array.buffer
38
37
  );
39
38
  l.index && p.push(l.index.array.buffer), self.postMessage(
40
39
  { type: "decode", id: n.id, geometry: l },
@@ -75,19 +74,19 @@ function J() {
75
74
  throw new Error(
76
75
  "THREE.DRACOLoader: Decoding failed: " + l.error_msg()
77
76
  );
78
- const m = { index: null, attributes: [] };
79
- for (const g in i) {
80
- const E = self[f[g]];
77
+ const g = { index: null, attributes: [] };
78
+ for (const m in i) {
79
+ const E = self[f[m]];
81
80
  let w, A;
82
81
  if (d.useUniqueIDs)
83
- A = i[g], w = n.GetAttributeByUniqueId(
82
+ A = i[m], w = n.GetAttributeByUniqueId(
84
83
  a,
85
84
  A
86
85
  );
87
86
  else {
88
87
  if (A = n.GetAttributeId(
89
88
  a,
90
- e[i[g]]
89
+ e[i[m]]
91
90
  ), A === -1) continue;
92
91
  w = n.GetAttribute(a, A);
93
92
  }
@@ -95,13 +94,13 @@ function J() {
95
94
  e,
96
95
  n,
97
96
  a,
98
- g,
97
+ m,
99
98
  E,
100
99
  w
101
100
  );
102
- g === "color" && (y.vertexColorSpace = d.vertexColorSpace), m.attributes.push(y);
101
+ m === "color" && (y.vertexColorSpace = d.vertexColorSpace), g.attributes.push(y);
103
102
  }
104
- return p === e.TRIANGULAR_MESH && (m.index = t(e, n, a)), e.destroy(a), m;
103
+ return p === e.TRIANGULAR_MESH && (g.index = t(e, n, a)), e.destroy(a), g;
105
104
  }
106
105
  function t(e, n, c) {
107
106
  const i = c.num_faces() * 3, f = i * 4, a = e._malloc(f);
@@ -114,7 +113,7 @@ function J() {
114
113
  return e._free(a), { array: l, itemSize: 1 };
115
114
  }
116
115
  function o(e, n, c, d, i, f) {
117
- const a = c.num_points(), l = f.num_components(), p = u(e, i), m = l * i.BYTES_PER_ELEMENT, g = Math.ceil(m / 4) * 4, E = g / i.BYTES_PER_ELEMENT, w = a * m, A = a * g, y = e._malloc(w);
116
+ const a = c.num_points(), l = f.num_components(), p = u(e, i), g = l * i.BYTES_PER_ELEMENT, m = Math.ceil(g / 4) * 4, E = m / i.BYTES_PER_ELEMENT, w = a * g, A = a * m, y = e._malloc(w);
118
117
  n.GetAttributeDataArrayForAllPoints(
119
118
  c,
120
119
  f,
@@ -128,7 +127,7 @@ function J() {
128
127
  w / i.BYTES_PER_ELEMENT
129
128
  );
130
129
  let D;
131
- if (m === g)
130
+ if (g === m)
132
131
  D = R.slice();
133
132
  else {
134
133
  D = new i(
@@ -400,7 +399,7 @@ class V {
400
399
  return c.name = r.name ?? "Mesh", c.castShadow = !0, c.receiveShadow = !0, c;
401
400
  }
402
401
  }
403
- class ae {
402
+ class ie {
404
403
  constructor() {
405
404
  h(this, "_gltfLoader");
406
405
  h(this, "_usdLoader");
@@ -500,7 +499,7 @@ class ae {
500
499
  }
501
500
  }
502
501
  export {
503
- ae as A,
502
+ ie as A,
504
503
  J as D,
505
504
  $ as a
506
505
  };