@shopware-ag/dive 4.0.1 → 4.1.0

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 (73) hide show
  1. package/build/chunks/{AssetCache-DnAAa719.mjs → AssetCache-BukUxOQj.mjs} +8 -9
  2. package/build/chunks/AssetCache-qEEswhJh.cjs +1 -0
  3. package/build/chunks/{AssetExporter-CoL-QXkB.cjs → AssetExporter-42qgIOkb.cjs} +1 -1
  4. package/build/chunks/{AssetExporter-CD2iuQce.mjs → AssetExporter-B92XZQEe.mjs} +1 -1
  5. package/build/chunks/AssetLoader-Bn4R6_rn.cjs +3 -0
  6. package/build/chunks/{AssetLoader-Bkp3fWZz.mjs → AssetLoader-DvbdFdyg.mjs} +53 -55
  7. package/build/chunks/{FileTypes-D3Dxr2dj.mjs → FileTypes-C8BdyVai.mjs} +887 -492
  8. package/build/chunks/FileTypes-DTCnNV95.cjs +29 -0
  9. package/build/chunks/GridNode-BJ35_54X.cjs +1 -0
  10. package/build/chunks/GridNode-CRviKlfb.mjs +58 -0
  11. package/build/chunks/{ModelComponent-Cmu0EX0r.cjs → ModelComponent-CHIXv2a6.cjs} +1 -1
  12. package/build/chunks/{ModelComponent-WA0kLOEY.mjs → ModelComponent-DEUhl62p.mjs} +2 -2
  13. package/build/chunks/OrbitController-Cq5Q1m82.cjs +1 -0
  14. package/build/chunks/{OrbitController-DxCbrQVB.mjs → OrbitController-DgAc7NaY.mjs} +3 -4
  15. package/build/chunks/{SpriteTextComponent-BpoKLOjA.cjs → SpriteTextComponent-IYbrESut.cjs} +1 -1
  16. package/build/chunks/{SpriteTextComponent-DIZFqao0.mjs → SpriteTextComponent-JwWMzAKh.mjs} +1 -1
  17. package/build/chunks/{contributesToBounds-DYmHYES4.mjs → contributesToBounds-DK3AK1Lq.mjs} +4 -3
  18. package/build/chunks/{contributesToBounds-C1mva__U.cjs → contributesToBounds-Dmh3K2n5.cjs} +1 -1
  19. package/build/chunks/{detachTransformControls-CZ2cd5hx.cjs → detachTransformControls-C6Zej6b_.cjs} +1 -1
  20. package/build/chunks/{detachTransformControls-B4iRF1bw.mjs → detachTransformControls-DRCqBDEX.mjs} +2 -2
  21. package/build/chunks/draco_decoder-C69s_Ovp.cjs +34 -0
  22. package/build/chunks/draco_decoder-C9dq_cZY.mjs +37 -0
  23. package/build/chunks/draco_decoder-CPiEz08P.cjs +1 -0
  24. package/build/chunks/draco_decoder-kYeZ1HbP.mjs +4 -0
  25. package/build/chunks/draco_wasm_wrapper-DXbP0W2R.cjs +117 -0
  26. package/build/chunks/draco_wasm_wrapper-FC39lTlO.mjs +120 -0
  27. package/build/chunks/{isFileExtensionSupported-B1q2eWs7.cjs → isFileExtensionSupported-CY90yqQo.cjs} +1 -1
  28. package/build/chunks/{isFileExtensionSupported-BqOqU3-h.mjs → isFileExtensionSupported-DRnGwWT2.mjs} +1 -1
  29. package/build/components/camera/CameraComponent.d.ts +2 -1
  30. package/build/components/grid/GridComponent.d.ts +51 -1
  31. package/build/components/index.d.ts +1 -0
  32. package/build/components/softshadow/SoftShadowComponent.d.ts +197 -0
  33. package/build/components/softshadow/index.d.ts +1 -0
  34. package/build/constants/GridColors.d.ts +46 -2
  35. package/build/constants/VisibilityLayerMask.d.ts +12 -0
  36. package/build/dive.cjs +1 -1
  37. package/build/dive.mjs +105 -101
  38. package/build/engine/node/Node.d.ts +2 -0
  39. package/build/engine/renderer/Renderer.d.ts +21 -1
  40. package/build/engine/scene/Scene.d.ts +9 -9
  41. package/build/plugins/ar/index.cjs +1 -1
  42. package/build/plugins/ar/index.mjs +2 -2
  43. package/build/plugins/assetcache/index.cjs +1 -1
  44. package/build/plugins/assetcache/index.mjs +1 -1
  45. package/build/plugins/assetexporter/index.cjs +1 -1
  46. package/build/plugins/assetexporter/index.mjs +1 -1
  47. package/build/plugins/assetloader/index.cjs +1 -1
  48. package/build/plugins/assetloader/index.mjs +2 -2
  49. package/build/plugins/assetloader/src/draco/DracoLoader.d.ts +0 -1
  50. package/build/plugins/mediacreator/index.cjs +1 -1
  51. package/build/plugins/mediacreator/index.mjs +3 -4
  52. package/build/plugins/orbitcontroller/index.cjs +1 -1
  53. package/build/plugins/orbitcontroller/index.mjs +1 -1
  54. package/build/plugins/orientationdisplay/index.cjs +1 -1
  55. package/build/plugins/orientationdisplay/index.mjs +5 -6
  56. package/build/plugins/quickview/index.cjs +1 -1
  57. package/build/plugins/quickview/index.mjs +7 -8
  58. package/build/plugins/shader/index.cjs +1 -1
  59. package/build/plugins/shader/index.mjs +3 -2
  60. package/build/plugins/shader/src/index.d.ts +1 -0
  61. package/build/plugins/shader/src/shaders/BlurNode.d.ts +43 -0
  62. package/build/plugins/shader/src/shaders/GridNode.d.ts +4 -0
  63. package/build/plugins/state/index.cjs +1 -1
  64. package/build/plugins/state/index.mjs +151 -163
  65. package/build/plugins/toolbox/index.cjs +1 -1
  66. package/build/plugins/toolbox/index.mjs +8 -9
  67. package/package.json +2 -2
  68. package/build/chunks/AssetCache-CUVFS7wk.cjs +0 -1
  69. package/build/chunks/AssetLoader-DnVvCd41.cjs +0 -3
  70. package/build/chunks/FileTypes-B-MjfMGd.cjs +0 -29
  71. package/build/chunks/GridNode-0R5ZnzR6.mjs +0 -30
  72. package/build/chunks/GridNode-iqnu86_v.cjs +0 -1
  73. 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-C8BdyVai.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-DTCnNV95.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 +1 @@
1
- "use strict";var u=Object.defineProperty;var p=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e,t)=>p(s,typeof e!="symbol"?e+"":e,t);const f=require("three/webgpu"),l=require("three/examples/jsm/exporters/GLTFExporter.js"),y=require("three/examples/jsm/exporters/USDZExporter.js"),o=require("./parse-error-Dy_EE4rL.cjs"),x=require("./contributesToBounds-C1mva__U.cjs"),a=require("./collectAnimations-C3HfZHte.cjs"),c={onlyVisible:!0};class E{constructor(){i(this,"_gltfExporter");i(this,"_usdzExporter");this._gltfExporter=new l.GLTFExporter,this._usdzExporter=new y.USDZExporter}async export(e,t,r){this._computeNormals(e);const n=this._hideNonProductGeometry(e);try{return await this._exportByType(e,t,r)}finally{n()}}async _exportByType(e,t,r){switch(t){case"glb":return this._exportGlb(e,r);case"gltf":return this._exportGltf(e,r);case"usdz":return this._exportUsdz(e,r);default:throw new o.FileTypeError(`Unsupported file type: ${t}`,t)}}async _exportGlb(e,t){try{const r=await this._gltfExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c,binary:!0});if(r instanceof ArrayBuffer)return r;throw new o.ParseError("Failed to export GLB: expected ArrayBuffer")}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export GLB",r)}}async _exportGltf(e,t){try{const r=await this._gltfExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c,binary:!1}),n=JSON.stringify(r);return new TextEncoder().encode(n).buffer}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export GLTF",r)}}async _exportUsdz(e,t){try{return(await this._usdzExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c})).buffer}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export USDZ",r)}}_hideNonProductGeometry(e){const t=[];return e.traverse(r=>{"geometry"in r&&(x.contributesToBounds(r)||r.visible&&(r.visible=!1,t.push(r)))}),()=>{t.forEach(r=>{r.visible=!0})}}_computeNormals(e){e.traverse(t=>{t instanceof f.Mesh&&t.geometry&&(t.geometry.getAttribute("normal")||t.geometry.computeVertexNormals())})}}exports.AssetExporter=E;
1
+ "use strict";var u=Object.defineProperty;var p=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var i=(s,e,t)=>p(s,typeof e!="symbol"?e+"":e,t);const f=require("three/webgpu"),l=require("three/examples/jsm/exporters/GLTFExporter.js"),y=require("three/examples/jsm/exporters/USDZExporter.js"),o=require("./parse-error-Dy_EE4rL.cjs"),x=require("./contributesToBounds-Dmh3K2n5.cjs"),a=require("./collectAnimations-C3HfZHte.cjs"),c={onlyVisible:!0};class E{constructor(){i(this,"_gltfExporter");i(this,"_usdzExporter");this._gltfExporter=new l.GLTFExporter,this._usdzExporter=new y.USDZExporter}async export(e,t,r){this._computeNormals(e);const n=this._hideNonProductGeometry(e);try{return await this._exportByType(e,t,r)}finally{n()}}async _exportByType(e,t,r){switch(t){case"glb":return this._exportGlb(e,r);case"gltf":return this._exportGltf(e,r);case"usdz":return this._exportUsdz(e,r);default:throw new o.FileTypeError(`Unsupported file type: ${t}`,t)}}async _exportGlb(e,t){try{const r=await this._gltfExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c,binary:!0});if(r instanceof ArrayBuffer)return r;throw new o.ParseError("Failed to export GLB: expected ArrayBuffer")}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export GLB",r)}}async _exportGltf(e,t){try{const r=await this._gltfExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c,binary:!1}),n=JSON.stringify(r);return new TextEncoder().encode(n).buffer}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export GLTF",r)}}async _exportUsdz(e,t){try{return(await this._usdzExporter.parseAsync(e,{animations:a.collectAnimations(e),...t,...c})).buffer}catch(r){throw r instanceof o.ParseError?r:new o.ParseError("Failed to export USDZ",r)}}_hideNonProductGeometry(e){const t=[];return e.traverse(r=>{"geometry"in r&&(x.contributesToBounds(r)||r.visible&&(r.visible=!1,t.push(r)))}),()=>{t.forEach(r=>{r.visible=!0})}}_computeNormals(e){e.traverse(t=>{t instanceof f.Mesh&&t.geometry&&(t.geometry.getAttribute("normal")||t.geometry.computeVertexNormals())})}}exports.AssetExporter=E;
@@ -5,7 +5,7 @@ import { Mesh as u } from "three/webgpu";
5
5
  import { GLTFExporter as y } from "three/examples/jsm/exporters/GLTFExporter.js";
6
6
  import { USDZExporter as l } from "three/examples/jsm/exporters/USDZExporter.js";
7
7
  import { F as m, P as o } from "./parse-error-DfOPyLWM.mjs";
8
- import { c as x } from "./contributesToBounds-DYmHYES4.mjs";
8
+ import { c as x } from "./contributesToBounds-DK3AK1Lq.mjs";
9
9
  import { c as i } from "./collectAnimations-BgYCN1le.mjs";
10
10
  const f = { onlyVisible: !0 };
11
11
  class b {
@@ -0,0 +1,3 @@
1
+ "use strict";var k=Object.defineProperty;var x=(_,r,s)=>r in _?k(_,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):_[r]=s;var p=(_,r,s)=>x(_,typeof r!="symbol"?r+"":r,s);const G=require("three/examples/jsm/loaders/GLTFLoader.js"),v=require("three/examples/jsm/loaders/USDLoader.js"),B=require("./FileTypes-DTCnNV95.cjs"),w=require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");const I=require("./isFileExtensionSupported-CY90yqQo.cjs"),R=require("./parse-error-Dy_EE4rL.cjs"),W=require("three/examples/jsm/loaders/DRACOLoader.js"),T=require("./AssetCache-qEEswhJh.cjs");function U(){let _,r;onmessage=function(e){const n=e.data;switch(n.type){case"init":_=n.decoderConfig,r=new Promise(function(i){_.onModuleLoaded=function(f){i({draco:f})},DracoDecoderModule(_)});break;case"decode":const c=n.buffer,d=n.taskConfig;r.then(i=>{const f=i.draco,a=new f.Decoder;try{const l=s(f,a,new Int8Array(c),d),h=l.attributes.map(A=>A.array.buffer);l.index&&h.push(l.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:l},h)}catch(l){console.error(l),self.postMessage({type:"error",id:n.id,error:l.message})}finally{f.destroy(a)}});break}};function s(e,n,c,d){const i=d.attributeIDs,f=d.attributeTypes;let a,l;const h=n.GetEncodedGeometryType(c);if(h===e.TRIANGULAR_MESH)a=new e.Mesh,l=n.DecodeArrayToMesh(c,c.byteLength,a);else if(h===e.POINT_CLOUD)a=new e.PointCloud,l=n.DecodeArrayToPointCloud(c,c.byteLength,a);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!l.ok()||a.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const A={index:null,attributes:[]};for(const g in i){const D=self[f[g]];let y,m;if(d.useUniqueIDs)m=i[g],y=n.GetAttributeByUniqueId(a,m);else{if(m=n.GetAttributeId(a,e[i[g]]),m===-1)continue;y=n.GetAttribute(a,m)}const E=o(e,n,a,g,D,y);g==="color"&&(E.vertexColorSpace=d.vertexColorSpace),A.attributes.push(E)}return h===e.TRIANGULAR_MESH&&(A.index=t(e,n,a)),e.destroy(a),A}function t(e,n,c){const i=c.num_faces()*3,f=i*4,a=e._malloc(f);n.GetTrianglesUInt32Array(c,f,a);const l=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:l,itemSize:1}}function o(e,n,c,d,i,f){const a=c.num_points(),l=f.num_components(),h=u(e,i),A=l*i.BYTES_PER_ELEMENT,g=Math.ceil(A/4)*4,D=g/i.BYTES_PER_ELEMENT,y=a*A,m=a*g,E=e._malloc(y);n.GetAttributeDataArrayForAllPoints(c,f,h,y,E);const O=new i(e.HEAPF32.buffer,E,y/i.BYTES_PER_ELEMENT);let L;if(A===g)L=O.slice();else{L=new i(m/i.BYTES_PER_ELEMENT);let P=0;for(let b=0,N=O.length;b<N;b+=l){for(let S=0;S<l;S++)L[P+S]=O[b+S];P+=D}}return e._free(E),{name:d,count:a,itemSize:l,array:L,stride:D}}function u(e,n){switch(n){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 C={LOAD_DRACO_JS_DECODER:async()=>(await Promise.resolve().then(()=>require("./draco_decoder-C69s_Ovp.cjs"))).default,LOAD_DRACO_WASM_WRAPPER:async()=>(await Promise.resolve().then(()=>require("./draco_wasm_wrapper-DXbP0W2R.cjs"))).default,LOAD_DRACO_WASM_DECODER:async()=>{const _=(await Promise.resolve().then(()=>require("./draco_decoder-CPiEz08P.cjs"))).default;return await(await fetch(_)).arrayBuffer()}};class F extends W.DRACOLoader{constructor(){super(...arguments);p(this,"decoderPending",null);p(this,"decoderConfig",{wasmBinary:null});p(this,"workerSourceURL","")}async _initDecoder(){if(this.decoderPending)return this.decoderPending;const s=typeof WebAssembly!="object",t=[];return s?t.push(C.LOAD_DRACO_JS_DECODER()):(t.push(C.LOAD_DRACO_WASM_WRAPPER()),t.push(C.LOAD_DRACO_WASM_DECODER())),this.decoderPending=Promise.all(t).then(o=>{const u=o[0];s||(this.decoderConfig.wasmBinary=o[1]);const e=U.toString(),n=["/* draco decoder */",u,"","/* worker */",e.substring(e.indexOf("{")+1,e.lastIndexOf("}"))].join(`
2
+ `);this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}}function j(){let _=null,r=null;const s=[[/'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 t(){return _||(_=occtimportjs({locateFile:function(){return r}})),_}function o(e){for(var n=new TextDecoder("utf-8",{fatal:!1}),c=new TextEncoder,d=n.decode(e),i=0;i<s.length;i++){var f=s[i][0],a=s[i][1];d=d.replace(f,a)}return new Uint8Array(c.encode(d))}function u(e,n){var c=o(n);try{var d=e.ReadStepFile(c,null);if(d.success&&d.root)return d}catch{}try{return e.ReadStepFile(n,null)}catch{return{success:!1,root:{meshes:[],children:[]},meshes:[]}}}onmessage=async function(e){var n=e.data;switch(n.type){case"init":r=n.wasmUrl;break;case"parse":try{var c=await t(),d=new Uint8Array(n.buffer),i=n.fileType,f;if(i==="step"||i==="stp"?f=u(c,d):f=c.ReadIgesFile(d,null),!f.success||!f.root){self.postMessage({type:"error",id:n.id,error:"Failed to parse CAD file"});return}self.postMessage({type:"result",id:n.id,result:f})}catch(a){self.postMessage({type:"error",id:n.id,error:a instanceof Error?a.message:String(a)})}break}}}const M={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 q{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[r,s]=await Promise.all([M.LOAD_OCCT_JS(),M.LOAD_OCCT_WASM_URL()]),t=j.toString(),o=["/* occt-import-js */",r,"","/* step worker */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}"))].join(`
3
+ `),u=URL.createObjectURL(new Blob([o])),e=new Worker(u),n=new URL(s,window.location.href).href;return e.postMessage({type:"init",wasmUrl:n}),e.onmessage=c=>{const{type:d,id:i,result:f,error:a}=c.data,l=this._pending.get(i);if(l)if(this._pending.delete(i),d==="result")try{l.resolve(this._buildScene(f))}catch(h){l.reject(h instanceof Error?h:new Error(String(h)))}else l.reject(new Error(a??"Worker error"))},e.onerror=c=>{for(const[,{reject:d}]of this._pending)d(new Error(c.message??"Worker error"));this._pending.clear()},this._worker=e,e})(),this._workerPending)}async parseAsync(r,s){const t=this._nextId++,o=await this._getWorker();return new Promise((u,e)=>{this._pending.set(t,{resolve:u,reject:e});const n=r.slice(0);o.postMessage({type:"parse",id:t,buffer:n,fileType:s},[n])})}dispose(){if(this._worker){for(const[,{reject:r}]of this._pending)r(new Error("STEPLoader disposed"));this._pending.clear(),this._worker.terminate(),this._worker=null,this._workerPending=null}}_buildScene(r){const s=new w.Group;return s.name=r.root.name??"CAD Model",this._buildNode(r.root,r.meshes,s),s.rotation.x=-Math.PI/2,s.rotation.z=Math.PI/2,s}_buildNode(r,s,t){const o=new w.Group;o.name=r.name??"Part";for(const u of r.meshes){const e=s[u];if(e!=null&&e.attributes){const n=this._createMesh(e);o.add(n)}}for(const u of r.children)this._buildNode(u,s,o);t.add(o)}_createMesh(r){var d,i;const{position:s,normal:t}=r.attributes,o=r.index??r.attributes.index,u=new w.BufferGeometry;u.setAttribute("position",new w.BufferAttribute(new Float32Array(s.array),3)),(d=t==null?void 0:t.array)!=null&&d.length?u.setAttribute("normal",new w.BufferAttribute(new Float32Array(t.array),3)):u.computeVertexNormals(),(i=o==null?void 0:o.array)!=null&&i.length&&u.setIndex(new w.BufferAttribute(new Uint32Array(o.array),1));const e=r.color,n=new w.MeshStandardMaterial({metalness:.3,roughness:.6});e&&e.length>=3?n.color.setRGB(e[0],e[1],e[2]):n.color.setHex(13421772);const c=new w.Mesh(u,n);return c.name=r.name??"Mesh",c.castShadow=!0,c.receiveShadow=!0,c}}class H{constructor(){p(this,"_gltfLoader");p(this,"_usdLoader");p(this,"_stepLoader");const r=new F;this._gltfLoader=new G.GLTFLoader,this._gltfLoader.setDRACOLoader(r),this._usdLoader=new v.USDLoader,this._stepLoader=new q}async load(r,s){let t;if(s)t=s;else if(t=I.getFileTypeFromUri(r),t.length===0&&(t=await this._detectFileTypeFromContent(r),t.length===0))throw new R.FileTypeError("No file extension found in URI","");if(!I.isFileExtensionSupported(t))throw new R.FileTypeError(`Unsupported file type: ${t}. Supported types: ${B.SUPPORTED_FILE_TYPES.join(", ")}`,t);const o=T.AssetCache.read(r);if(o)return o.arrayBuffer?this._parse(o.arrayBuffer,t):o.promise.then(n=>this._parse(n,t));const e=await T.AssetCache.create(r).load();return this._parse(e,t)}async _detectFileTypeFromContent(r){try{const s=T.AssetCache.read(r);let t;s?s.arrayBuffer?t=s.arrayBuffer:t=await s.promise:t=await T.AssetCache.create(r).load();const o=new Uint8Array(t);return o.length>=12&&String.fromCharCode(o[0],o[1],o[2],o[3])==="glTF"?o[12]===0?"glb":"gltf":o.length>=4&&o[0]===80&&o[1]===75&&(o[2]===3||o[2]===5)&&(o[3]===4||o[3]===6)?"usdz":o.length>=20&&new TextDecoder("ascii").decode(o.subarray(0,20)).startsWith("ISO-10303-21")?"step":o.length>=80&&o[72]===83?"iges":""}catch{return""}}async _parse(r,s){try{switch(s){case"glb":case"gltf":{const t=await this._gltfLoader.parseAsync(r,"");return t.scene.animations=t.animations,t.scene}case"usdz":{const t=this._usdLoader.parse(r);return t.animations=[],t}case"step":case"stp":{const t=await this._stepLoader.parseAsync(r,s);return t.animations=[],t}case"iges":case"igs":{const t=await this._stepLoader.parseAsync(r,s);return t.animations=[],t}}}catch(t){throw t instanceof Error?new R.ParseError(`Failed to parse ${s} file: ${t.message}`,t):new R.ParseError(`Failed to parse ${s} file`)}}}exports.AssetLoader=H;exports.DRACOWorker=U;exports.DracoLoader=F;
@@ -3,34 +3,33 @@ 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-C8BdyVai.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-DRnGwWT2.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-BukUxOQj.mjs";
14
13
  function J() {
15
14
  let _, r;
16
15
  onmessage = function(e) {
17
16
  const n = e.data;
18
17
  switch (n.type) {
19
18
  case "init":
20
- _ = n.decoderConfig, r = new Promise(function(i) {
19
+ _ = n.decoderConfig, r = new Promise(function(a) {
21
20
  _.onModuleLoaded = function(f) {
22
- i({ draco: f });
21
+ a({ draco: f });
23
22
  }, DracoDecoderModule(_);
24
23
  });
25
24
  break;
26
25
  case "decode":
27
26
  const c = n.buffer, d = n.taskConfig;
28
- r.then((i) => {
29
- const f = i.draco, a = new f.Decoder();
27
+ r.then((a) => {
28
+ const f = a.draco, i = new f.Decoder();
30
29
  try {
31
30
  const l = s(
32
31
  f,
33
- a,
32
+ i,
34
33
  new Int8Array(c),
35
34
  d
36
35
  ), p = l.attributes.map(
@@ -47,74 +46,74 @@ function J() {
47
46
  error: l.message
48
47
  });
49
48
  } finally {
50
- f.destroy(a);
49
+ f.destroy(i);
51
50
  }
52
51
  });
53
52
  break;
54
53
  }
55
54
  };
56
55
  function s(e, n, c, d) {
57
- const i = d.attributeIDs, f = d.attributeTypes;
58
- let a, l;
56
+ const a = d.attributeIDs, f = d.attributeTypes;
57
+ let i, l;
59
58
  const p = n.GetEncodedGeometryType(c);
60
59
  if (p === e.TRIANGULAR_MESH)
61
- a = new e.Mesh(), l = n.DecodeArrayToMesh(
60
+ i = new e.Mesh(), l = n.DecodeArrayToMesh(
62
61
  c,
63
62
  c.byteLength,
64
- a
63
+ i
65
64
  );
66
65
  else if (p === e.POINT_CLOUD)
67
- a = new e.PointCloud(), l = n.DecodeArrayToPointCloud(
66
+ i = new e.PointCloud(), l = n.DecodeArrayToPointCloud(
68
67
  c,
69
68
  c.byteLength,
70
- a
69
+ i
71
70
  );
72
71
  else
73
72
  throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
74
- if (!l.ok() || a.ptr === 0)
73
+ if (!l.ok() || i.ptr === 0)
75
74
  throw new Error(
76
75
  "THREE.DRACOLoader: Decoding failed: " + l.error_msg()
77
76
  );
78
77
  const m = { index: null, attributes: [] };
79
- for (const g in i) {
78
+ for (const g in a) {
80
79
  const E = self[f[g]];
81
80
  let w, A;
82
81
  if (d.useUniqueIDs)
83
- A = i[g], w = n.GetAttributeByUniqueId(
84
- a,
82
+ A = a[g], w = n.GetAttributeByUniqueId(
83
+ i,
85
84
  A
86
85
  );
87
86
  else {
88
87
  if (A = n.GetAttributeId(
89
- a,
90
- e[i[g]]
88
+ i,
89
+ e[a[g]]
91
90
  ), A === -1) continue;
92
- w = n.GetAttribute(a, A);
91
+ w = n.GetAttribute(i, A);
93
92
  }
94
93
  const y = o(
95
94
  e,
96
95
  n,
97
- a,
96
+ i,
98
97
  g,
99
98
  E,
100
99
  w
101
100
  );
102
101
  g === "color" && (y.vertexColorSpace = d.vertexColorSpace), m.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 && (m.index = t(e, n, i)), e.destroy(i), m;
105
104
  }
106
105
  function t(e, n, c) {
107
- const i = c.num_faces() * 3, f = i * 4, a = e._malloc(f);
108
- n.GetTrianglesUInt32Array(c, f, a);
106
+ const a = c.num_faces() * 3, f = a * 4, i = e._malloc(f);
107
+ n.GetTrianglesUInt32Array(c, f, i);
109
108
  const l = new Uint32Array(
110
109
  e.HEAPF32.buffer,
111
- a,
112
- i
110
+ i,
111
+ a
113
112
  ).slice();
114
- return e._free(a), { array: l, itemSize: 1 };
113
+ return e._free(i), { array: l, itemSize: 1 };
115
114
  }
116
- 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);
115
+ function o(e, n, c, d, a, f) {
116
+ const i = c.num_points(), l = f.num_components(), p = u(e, a), m = l * a.BYTES_PER_ELEMENT, g = Math.ceil(m / 4) * 4, E = g / a.BYTES_PER_ELEMENT, w = i * m, A = i * g, y = e._malloc(w);
118
117
  n.GetAttributeDataArrayForAllPoints(
119
118
  c,
120
119
  f,
@@ -122,17 +121,17 @@ function J() {
122
121
  w,
123
122
  y
124
123
  );
125
- const R = new i(
124
+ const R = new a(
126
125
  e.HEAPF32.buffer,
127
126
  y,
128
- w / i.BYTES_PER_ELEMENT
127
+ w / a.BYTES_PER_ELEMENT
129
128
  );
130
129
  let D;
131
130
  if (m === g)
132
131
  D = R.slice();
133
132
  else {
134
- D = new i(
135
- A / i.BYTES_PER_ELEMENT
133
+ D = new a(
134
+ A / a.BYTES_PER_ELEMENT
136
135
  );
137
136
  let I = 0;
138
137
  for (let O = 0, N = R.length; O < N; O += l) {
@@ -143,7 +142,7 @@ function J() {
143
142
  }
144
143
  return e._free(y), {
145
144
  name: d,
146
- count: a,
145
+ count: i,
147
146
  itemSize: l,
148
147
  array: D,
149
148
  stride: E
@@ -169,10 +168,10 @@ function J() {
169
168
  }
170
169
  }
171
170
  const b = {
172
- LOAD_DRACO_JS_DECODER: async () => (await import("three/examples/jsm/libs/draco/draco_decoder.js?raw")).default,
173
- LOAD_DRACO_WASM_WRAPPER: async () => (await import("three/examples/jsm/libs/draco/draco_wasm_wrapper.js?raw")).default,
171
+ LOAD_DRACO_JS_DECODER: async () => (await import("./draco_decoder-C9dq_cZY.mjs")).default,
172
+ LOAD_DRACO_WASM_WRAPPER: async () => (await import("./draco_wasm_wrapper-FC39lTlO.mjs")).default,
174
173
  LOAD_DRACO_WASM_DECODER: async () => {
175
- const _ = (await import("three/examples/jsm/libs/draco/draco_decoder.wasm?url")).default;
174
+ const _ = (await import("./draco_decoder-kYeZ1HbP.mjs")).default;
176
175
  return await (await fetch(_)).arrayBuffer();
177
176
  }
178
177
  };
@@ -181,14 +180,13 @@ class $ extends Y {
181
180
  super(...arguments);
182
181
  h(this, "decoderPending", null);
183
182
  h(this, "decoderConfig", {
184
- type: "js",
185
183
  wasmBinary: null
186
184
  });
187
185
  h(this, "workerSourceURL", "");
188
186
  }
189
187
  async _initDecoder() {
190
188
  if (this.decoderPending) return this.decoderPending;
191
- const s = typeof WebAssembly != "object" || this.decoderConfig.type === "js", t = [];
189
+ const s = typeof WebAssembly != "object", t = [];
192
190
  return s ? t.push(
193
191
  b.LOAD_DRACO_JS_DECODER()
194
192
  ) : (t.push(
@@ -233,9 +231,9 @@ function q() {
233
231
  })), _;
234
232
  }
235
233
  function o(e) {
236
- for (var n = new TextDecoder("utf-8", { fatal: !1 }), c = new TextEncoder(), d = n.decode(e), i = 0; i < s.length; i++) {
237
- var f = s[i][0], a = s[i][1];
238
- d = d.replace(f, a);
234
+ for (var n = new TextDecoder("utf-8", { fatal: !1 }), c = new TextEncoder(), d = n.decode(e), a = 0; a < s.length; a++) {
235
+ var f = s[a][0], i = s[a][1];
236
+ d = d.replace(f, i);
239
237
  }
240
238
  return new Uint8Array(c.encode(d));
241
239
  }
@@ -264,8 +262,8 @@ function q() {
264
262
  break;
265
263
  case "parse":
266
264
  try {
267
- var c = await t(), d = new Uint8Array(n.buffer), i = n.fileType, f;
268
- if (i === "step" || i === "stp" ? f = u(c, d) : f = c.ReadIgesFile(d, null), !f.success || !f.root) {
265
+ var c = await t(), d = new Uint8Array(n.buffer), a = n.fileType, f;
266
+ if (a === "step" || a === "stp" ? f = u(c, d) : f = c.ReadIgesFile(d, null), !f.success || !f.root) {
269
267
  self.postMessage({
270
268
  type: "error",
271
269
  id: n.id,
@@ -278,11 +276,11 @@ function q() {
278
276
  id: n.id,
279
277
  result: f
280
278
  });
281
- } catch (a) {
279
+ } catch (i) {
282
280
  self.postMessage({
283
281
  type: "error",
284
282
  id: n.id,
285
- error: a instanceof Error ? a.message : String(a)
283
+ error: i instanceof Error ? i.message : String(i)
286
284
  });
287
285
  }
288
286
  break;
@@ -319,9 +317,9 @@ class V {
319
317
  ].join(`
320
318
  `), u = URL.createObjectURL(new Blob([o])), e = new Worker(u), n = new URL(s, window.location.href).href;
321
319
  return e.postMessage({ type: "init", wasmUrl: n }), e.onmessage = (c) => {
322
- const { type: d, id: i, result: f, error: a } = c.data, l = this._pending.get(i);
320
+ const { type: d, id: a, result: f, error: i } = c.data, l = this._pending.get(a);
323
321
  if (l)
324
- if (this._pending.delete(i), d === "result")
322
+ if (this._pending.delete(a), d === "result")
325
323
  try {
326
324
  l.resolve(this._buildScene(f));
327
325
  } catch (p) {
@@ -330,7 +328,7 @@ class V {
330
328
  );
331
329
  }
332
330
  else
333
- l.reject(new Error(a ?? "Worker error"));
331
+ l.reject(new Error(i ?? "Worker error"));
334
332
  }, e.onerror = (c) => {
335
333
  for (const [, { reject: d }] of this._pending)
336
334
  d(new Error(c.message ?? "Worker error"));
@@ -380,7 +378,7 @@ class V {
380
378
  t.add(o);
381
379
  }
382
380
  _createMesh(r) {
383
- var d, i;
381
+ var d, a;
384
382
  const { position: s, normal: t } = r.attributes, o = r.index ?? r.attributes.index, u = new W();
385
383
  u.setAttribute(
386
384
  "position",
@@ -388,7 +386,7 @@ class V {
388
386
  ), (d = t == null ? void 0 : t.array) != null && d.length ? u.setAttribute(
389
387
  "normal",
390
388
  new T(new Float32Array(t.array), 3)
391
- ) : u.computeVertexNormals(), (i = o == null ? void 0 : o.array) != null && i.length && u.setIndex(
389
+ ) : u.computeVertexNormals(), (a = o == null ? void 0 : o.array) != null && a.length && u.setIndex(
392
390
  new T(new Uint32Array(o.array), 1)
393
391
  );
394
392
  const e = r.color, n = new v({
@@ -406,7 +404,7 @@ class ae {
406
404
  h(this, "_usdLoader");
407
405
  h(this, "_stepLoader");
408
406
  const r = new $();
409
- r.setDecoderConfig({ type: "wasm" }), this._gltfLoader = new x(), this._gltfLoader.setDRACOLoader(r), this._usdLoader = new G(), this._stepLoader = new V();
407
+ this._gltfLoader = new x(), this._gltfLoader.setDRACOLoader(r), this._usdLoader = new G(), this._stepLoader = new V();
410
408
  }
411
409
  async load(r, s) {
412
410
  let t;