@shopware-ag/dive 3.0.4-beta.2 → 3.0.4-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/chunks/AssetCache-B42MsW7s.cjs +1 -0
- package/build/chunks/AssetCache-CTBSMCs6.mjs +194 -0
- package/build/chunks/{AssetLoader-BWvWCaSc.cjs → AssetLoader-BJWH7K-f.cjs} +1 -1
- package/build/chunks/{AssetLoader-Ddj2uoTR.mjs → AssetLoader-yYsetEgE.mjs} +3 -3
- package/build/chunks/FileTypes-C4ghi3zQ.cjs +29 -0
- package/build/chunks/{FileTypes-r11aGBWV.mjs → FileTypes-gLjhiero.mjs} +45 -44
- package/build/chunks/{isFileTypeSupported-G8AdpjYd.mjs → isFileTypeSupported-B-ye2zhW.mjs} +1 -1
- package/build/chunks/{isFileTypeSupported-DnXPxN1D.cjs → isFileTypeSupported-BWQxC9QF.cjs} +1 -1
- package/build/dive.cjs +1 -1
- package/build/dive.mjs +2 -2
- package/build/engine/Dive.d.ts +1 -1
- package/build/engine/clock/Clock.d.ts +2 -1
- package/build/engine/view/View.d.ts +1 -1
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.mjs +1 -1
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetcache/src/chunk/Chunk.d.ts +2 -0
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.mjs +2 -2
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orientationdisplay/index.cjs +1 -1
- package/build/plugins/orientationdisplay/index.mjs +1 -1
- package/build/plugins/quickview/index.cjs +1 -1
- package/build/plugins/quickview/index.mjs +17 -17
- package/build/plugins/state/index.cjs +1 -1
- package/build/plugins/state/index.mjs +1 -1
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.mjs +1 -1
- package/package.json +1 -1
- package/build/chunks/AssetCache-CWMOYS2I.mjs +0 -140
- package/build/chunks/AssetCache-Rcp-qOJo.cjs +0 -1
- package/build/chunks/FileTypes-BhRYMiWf.cjs +0 -29
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var g=Object.defineProperty;var p=(i,e,r)=>e in i?g(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r;var o=(i,e,r)=>p(i,typeof e!="symbol"?e+"":e,r);require("./FileTypes-C4ghi3zQ.cjs");require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");require("three/tsl");const l=require("./network-error-CdDXil5g.cjs");class _{constructor(e){o(this,"_promise");o(this,"_resolve");o(this,"_arrayBuffer",null);o(this,"_size",0);o(this,"_createdAt");o(this,"_updatedAt");this._uri=e,this._promise=new Promise(r=>{this._resolve=r}),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,r){var t,a;return((a=(t=e.headers)==null?void 0:t.get)==null?void 0:a.call(t,r))??null}_concatChunks(e,r){const t=new Uint8Array(r);let a=0;for(const s of e)t.set(s,a),a+=s.byteLength;return t.buffer}async _readBodyWithReader(e,r){const t=e.body.getReader(),a=[];let s=0,n=0;this._logLoad("reader-start",{uri:this._uri,elapsedMs:Math.round(performance.now()-r)});try{for(;;){const c=await t.read();if(c.done){this._logLoad("reader-done",{uri:this._uri,chunkCount:n,totalByteLength:s,elapsedMs:Math.round(performance.now()-r)});break}const h=c.value??new Uint8Array(0);a.push(h),s+=h.byteLength,n+=1,this._logLoad("reader-chunk",{uri:this._uri,chunkCount:n,chunkByteLength:h.byteLength,totalByteLength:s,elapsedMs:Math.round(performance.now()-r)})}}finally{t.releaseLock()}const f=this._concatChunks(a,s);return this._logLoad("reader-complete",{uri:this._uri,chunkCount:n,totalByteLength:s,elapsedMs:Math.round(performance.now()-r)}),f}_logLoad(e,r={}){console.info("[Chunk.load]",e,r)}_logLoadError(e,r,t={}){console.error("[Chunk.load]",e,{...t,error:r instanceof Error?r.message:String(r)})}async load(){var t;const e=performance.now();let r;this._logLoad("fetch-start",{uri:this._uri});try{r=await fetch(this._uri)}catch(a){throw this._logLoadError("fetch-failed",a,{uri:this._uri,elapsedMs:Math.round(performance.now()-e)}),a}if(this._logLoad("fetch-resolved",{uri:this._uri,ok:r.ok,status:r.status,contentLength:this._getHeader(r,"content-length"),contentType:this._getHeader(r,"content-type"),elapsedMs:Math.round(performance.now()-e)}),!r.ok)throw this._logLoad("fetch-not-ok",{uri:this._uri,status:r.status,elapsedMs:Math.round(performance.now()-e)}),new l.NetworkError(this._uri);try{this._logLoad("array-buffer-start",{uri:this._uri,elapsedMs:Math.round(performance.now()-e)}),(t=r.body)!=null&&t.getReader?this._arrayBuffer=await this._readBodyWithReader(r,e):(this._logLoad("array-buffer-fallback-start",{uri:this._uri,elapsedMs:Math.round(performance.now()-e)}),this._arrayBuffer=await r.arrayBuffer(),this._logLoad("array-buffer-fallback-resolved",{uri:this._uri,byteLength:this._arrayBuffer.byteLength,elapsedMs:Math.round(performance.now()-e)})),this._logLoad("array-buffer-resolved",{uri:this._uri,byteLength:this._arrayBuffer.byteLength,elapsedMs:Math.round(performance.now()-e)}),this._size+=this._arrayBuffer.byteLength,this._updatedAt=new Date,this._logLoad("metadata-updated",{uri:this._uri,size:this._size,updatedAt:this._updatedAt.toISOString(),elapsedMs:Math.round(performance.now()-e)})}catch(a){throw this._logLoadError("array-buffer-failed",a,{uri:this._uri,elapsedMs:Math.round(performance.now()-e)}),new l.FileContentError(this._uri)}return this._logLoad("resolve-start",{uri:this._uri,byteLength:this._arrayBuffer.byteLength,elapsedMs:Math.round(performance.now()-e)}),this._resolve(this._arrayBuffer),this._logLoad("resolve-complete",{uri:this._uri,byteLength:this._arrayBuffer.byteLength,elapsedMs:Math.round(performance.now()-e)}),this._arrayBuffer}}class y{constructor(){o(this,"_cache",new Map)}get(){return this._cache}create(e){const r=new _(e);return this._cache.set(e,r),r}write(e,r){this._cache.set(e,r)}read(e){return this._cache.get(e)??null}delete(...e){e.forEach(r=>{this._cache.delete(r)})}clear(){this._cache.clear()}}const u=Symbol.for("@shopware-ag/dive/assetcache"),d=globalThis;d[u]||(d[u]=new y);const w=d[u];exports.AssetCache=w;exports.Chunk=_;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var f = (i, e, r) => e in i ? _(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
|
|
3
|
+
var o = (i, e, r) => f(i, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import "./FileTypes-gLjhiero.mjs";
|
|
5
|
+
import "three/webgpu";
|
|
6
|
+
import "three/examples/jsm/loaders/HDRLoader.js";
|
|
7
|
+
import "three/tsl";
|
|
8
|
+
import { N as p, F as g } from "./network-error-BONfHWQq.mjs";
|
|
9
|
+
class y {
|
|
10
|
+
constructor(e) {
|
|
11
|
+
o(this, "_promise");
|
|
12
|
+
o(this, "_resolve");
|
|
13
|
+
o(this, "_arrayBuffer", null);
|
|
14
|
+
// metadata
|
|
15
|
+
o(this, "_size", 0);
|
|
16
|
+
o(this, "_createdAt");
|
|
17
|
+
o(this, "_updatedAt");
|
|
18
|
+
this._uri = e, this._promise = new Promise((r) => {
|
|
19
|
+
this._resolve = r;
|
|
20
|
+
}), this._createdAt = /* @__PURE__ */ new Date(), this._updatedAt = /* @__PURE__ */ new Date();
|
|
21
|
+
}
|
|
22
|
+
get promise() {
|
|
23
|
+
return this._promise;
|
|
24
|
+
}
|
|
25
|
+
get size() {
|
|
26
|
+
return this._size;
|
|
27
|
+
}
|
|
28
|
+
get createdAt() {
|
|
29
|
+
return this._createdAt;
|
|
30
|
+
}
|
|
31
|
+
get updatedAt() {
|
|
32
|
+
return this._updatedAt;
|
|
33
|
+
}
|
|
34
|
+
get arrayBuffer() {
|
|
35
|
+
return this._arrayBuffer;
|
|
36
|
+
}
|
|
37
|
+
_getHeader(e, r) {
|
|
38
|
+
var t, a;
|
|
39
|
+
return ((a = (t = e.headers) == null ? void 0 : t.get) == null ? void 0 : a.call(t, r)) ?? null;
|
|
40
|
+
}
|
|
41
|
+
_concatChunks(e, r) {
|
|
42
|
+
const t = new Uint8Array(r);
|
|
43
|
+
let a = 0;
|
|
44
|
+
for (const s of e)
|
|
45
|
+
t.set(s, a), a += s.byteLength;
|
|
46
|
+
return t.buffer;
|
|
47
|
+
}
|
|
48
|
+
async _readBodyWithReader(e, r) {
|
|
49
|
+
const t = e.body.getReader(), a = [];
|
|
50
|
+
let s = 0, n = 0;
|
|
51
|
+
this._logLoad("reader-start", {
|
|
52
|
+
uri: this._uri,
|
|
53
|
+
elapsedMs: Math.round(performance.now() - r)
|
|
54
|
+
});
|
|
55
|
+
try {
|
|
56
|
+
for (; ; ) {
|
|
57
|
+
const c = await t.read();
|
|
58
|
+
if (c.done) {
|
|
59
|
+
this._logLoad("reader-done", {
|
|
60
|
+
uri: this._uri,
|
|
61
|
+
chunkCount: n,
|
|
62
|
+
totalByteLength: s,
|
|
63
|
+
elapsedMs: Math.round(performance.now() - r)
|
|
64
|
+
});
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
const h = c.value ?? new Uint8Array(0);
|
|
68
|
+
a.push(h), s += h.byteLength, n += 1, this._logLoad("reader-chunk", {
|
|
69
|
+
uri: this._uri,
|
|
70
|
+
chunkCount: n,
|
|
71
|
+
chunkByteLength: h.byteLength,
|
|
72
|
+
totalByteLength: s,
|
|
73
|
+
elapsedMs: Math.round(performance.now() - r)
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
} finally {
|
|
77
|
+
t.releaseLock();
|
|
78
|
+
}
|
|
79
|
+
const l = this._concatChunks(a, s);
|
|
80
|
+
return this._logLoad("reader-complete", {
|
|
81
|
+
uri: this._uri,
|
|
82
|
+
chunkCount: n,
|
|
83
|
+
totalByteLength: s,
|
|
84
|
+
elapsedMs: Math.round(performance.now() - r)
|
|
85
|
+
}), l;
|
|
86
|
+
}
|
|
87
|
+
_logLoad(e, r = {}) {
|
|
88
|
+
console.info("[Chunk.load]", e, r);
|
|
89
|
+
}
|
|
90
|
+
_logLoadError(e, r, t = {}) {
|
|
91
|
+
console.error("[Chunk.load]", e, {
|
|
92
|
+
...t,
|
|
93
|
+
error: r instanceof Error ? r.message : String(r)
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
async load() {
|
|
97
|
+
var t;
|
|
98
|
+
const e = performance.now();
|
|
99
|
+
let r;
|
|
100
|
+
this._logLoad("fetch-start", {
|
|
101
|
+
uri: this._uri
|
|
102
|
+
});
|
|
103
|
+
try {
|
|
104
|
+
r = await fetch(this._uri);
|
|
105
|
+
} catch (a) {
|
|
106
|
+
throw this._logLoadError("fetch-failed", a, {
|
|
107
|
+
uri: this._uri,
|
|
108
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
109
|
+
}), a;
|
|
110
|
+
}
|
|
111
|
+
if (this._logLoad("fetch-resolved", {
|
|
112
|
+
uri: this._uri,
|
|
113
|
+
ok: r.ok,
|
|
114
|
+
status: r.status,
|
|
115
|
+
contentLength: this._getHeader(r, "content-length"),
|
|
116
|
+
contentType: this._getHeader(r, "content-type"),
|
|
117
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
118
|
+
}), !r.ok)
|
|
119
|
+
throw this._logLoad("fetch-not-ok", {
|
|
120
|
+
uri: this._uri,
|
|
121
|
+
status: r.status,
|
|
122
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
123
|
+
}), new p(this._uri);
|
|
124
|
+
try {
|
|
125
|
+
this._logLoad("array-buffer-start", {
|
|
126
|
+
uri: this._uri,
|
|
127
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
128
|
+
}), (t = r.body) != null && t.getReader ? this._arrayBuffer = await this._readBodyWithReader(r, e) : (this._logLoad("array-buffer-fallback-start", {
|
|
129
|
+
uri: this._uri,
|
|
130
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
131
|
+
}), this._arrayBuffer = await r.arrayBuffer(), this._logLoad("array-buffer-fallback-resolved", {
|
|
132
|
+
uri: this._uri,
|
|
133
|
+
byteLength: this._arrayBuffer.byteLength,
|
|
134
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
135
|
+
})), this._logLoad("array-buffer-resolved", {
|
|
136
|
+
uri: this._uri,
|
|
137
|
+
byteLength: this._arrayBuffer.byteLength,
|
|
138
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
139
|
+
}), this._size += this._arrayBuffer.byteLength, this._updatedAt = /* @__PURE__ */ new Date(), this._logLoad("metadata-updated", {
|
|
140
|
+
uri: this._uri,
|
|
141
|
+
size: this._size,
|
|
142
|
+
updatedAt: this._updatedAt.toISOString(),
|
|
143
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
144
|
+
});
|
|
145
|
+
} catch (a) {
|
|
146
|
+
throw this._logLoadError("array-buffer-failed", a, {
|
|
147
|
+
uri: this._uri,
|
|
148
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
149
|
+
}), new g(this._uri);
|
|
150
|
+
}
|
|
151
|
+
return this._logLoad("resolve-start", {
|
|
152
|
+
uri: this._uri,
|
|
153
|
+
byteLength: this._arrayBuffer.byteLength,
|
|
154
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
155
|
+
}), this._resolve(this._arrayBuffer), this._logLoad("resolve-complete", {
|
|
156
|
+
uri: this._uri,
|
|
157
|
+
byteLength: this._arrayBuffer.byteLength,
|
|
158
|
+
elapsedMs: Math.round(performance.now() - e)
|
|
159
|
+
}), this._arrayBuffer;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
class w {
|
|
163
|
+
constructor() {
|
|
164
|
+
o(this, "_cache", /* @__PURE__ */ new Map());
|
|
165
|
+
}
|
|
166
|
+
get() {
|
|
167
|
+
return this._cache;
|
|
168
|
+
}
|
|
169
|
+
create(e) {
|
|
170
|
+
const r = new y(e);
|
|
171
|
+
return this._cache.set(e, r), r;
|
|
172
|
+
}
|
|
173
|
+
write(e, r) {
|
|
174
|
+
this._cache.set(e, r);
|
|
175
|
+
}
|
|
176
|
+
read(e) {
|
|
177
|
+
return this._cache.get(e) ?? null;
|
|
178
|
+
}
|
|
179
|
+
delete(...e) {
|
|
180
|
+
e.forEach((r) => {
|
|
181
|
+
this._cache.delete(r);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
clear() {
|
|
185
|
+
this._cache.clear();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const u = Symbol.for("@shopware-ag/dive/assetcache"), d = globalThis;
|
|
189
|
+
d[u] || (d[u] = new w());
|
|
190
|
+
const A = d[u];
|
|
191
|
+
export {
|
|
192
|
+
A,
|
|
193
|
+
y as C
|
|
194
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var U=Object.create;var b=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var v=(a,r,s)=>r in a?b(a,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[r]=s;var W=(a,r,s,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of F(r))!G.call(a,e)&&e!==s&&b(a,e,{get:()=>r[e],enumerable:!(t=k(r,e))||t.enumerable});return a};var C=(a,r,s)=>(s=a!=null?U(N(a)):{},W(r||!a||!a.__esModule?b(s,"default",{value:a,enumerable:!0}):s,a));var _=(a,r,s)=>v(a,typeof r!="symbol"?r+"":r,s);const B=require("three/examples/jsm/loaders/GLTFLoader.js"),q=require("three/examples/jsm/loaders/USDLoader.js"),j=require("./FileTypes-
|
|
1
|
+
"use strict";var U=Object.create;var b=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var v=(a,r,s)=>r in a?b(a,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[r]=s;var W=(a,r,s,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of F(r))!G.call(a,e)&&e!==s&&b(a,e,{get:()=>r[e],enumerable:!(t=k(r,e))||t.enumerable});return a};var C=(a,r,s)=>(s=a!=null?U(N(a)):{},W(r||!a||!a.__esModule?b(s,"default",{value:a,enumerable:!0}):s,a));var _=(a,r,s)=>v(a,typeof r!="symbol"?r+"":r,s);const B=require("three/examples/jsm/loaders/GLTFLoader.js"),q=require("three/examples/jsm/loaders/USDLoader.js"),j=require("./FileTypes-C4ghi3zQ.cjs"),m=require("three/webgpu");require("three/examples/jsm/loaders/HDRLoader.js");require("three/tsl");const R=require("./isFileTypeSupported-BWQxC9QF.cjs"),M=require("./parse-error-Dy_EE4rL.cjs"),H=require("three/examples/jsm/loaders/DRACOLoader.js"),D=require("./AssetCache-B42MsW7s.cjs");function I(){let a,r;onmessage=function(o){const n=o.data;switch(n.type){case"init":a=n.decoderConfig,r=new Promise(function(d){a.onModuleLoaded=function(h){d({draco:h})},DracoDecoderModule(a)});break;case"decode":const i=n.buffer,u=n.taskConfig;r.then(d=>{const h=d.draco,l=new h.Decoder;try{const f=s(h,l,new Int8Array(i),u),p=f.attributes.map(g=>g.array.buffer);f.index&&p.push(f.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:f},p)}catch(f){console.error(f),self.postMessage({type:"error",id:n.id,error:f.message})}finally{h.destroy(l)}});break}};function s(o,n,i,u){const d=u.attributeIDs,h=u.attributeTypes;let l,f;const p=n.GetEncodedGeometryType(i);if(p===o.TRIANGULAR_MESH)l=new o.Mesh,f=n.DecodeArrayToMesh(i,i.byteLength,l);else if(p===o.POINT_CLOUD)l=new o.PointCloud,f=n.DecodeArrayToPointCloud(i,i.byteLength,l);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||l.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());const g={index:null,attributes:[]};for(const w in d){const A=self[h[w]];let L,y;if(u.useUniqueIDs)y=d[w],L=n.GetAttributeByUniqueId(l,y);else{if(y=n.GetAttributeId(l,o[d[w]]),y===-1)continue;L=n.GetAttribute(l,y)}const T=e(o,n,l,w,A,L);w==="color"&&(T.vertexColorSpace=u.vertexColorSpace),g.attributes.push(T)}return p===o.TRIANGULAR_MESH&&(g.index=t(o,n,l)),o.destroy(l),g}function t(o,n,i){const d=i.num_faces()*3,h=d*4,l=o._malloc(h);n.GetTrianglesUInt32Array(i,h,l);const f=new Uint32Array(o.HEAPF32.buffer,l,d).slice();return o._free(l),{array:f,itemSize:1}}function e(o,n,i,u,d,h){const l=h.num_components(),p=i.num_points()*l,g=p*d.BYTES_PER_ELEMENT,w=c(o,d),A=o._malloc(g);n.GetAttributeDataArrayForAllPoints(i,h,w,g,A);const L=new d(o.HEAPF32.buffer,A,p).slice();return o._free(A),{name:u,array:L,itemSize:l}}function c(o,n){switch(n){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}const S={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 a=(await import("three/examples/jsm/libs/draco/draco_decoder.wasm?url")).default;return await(await fetch(a)).arrayBuffer()}};class P extends H.DRACOLoader{constructor(){super(...arguments);_(this,"decoderPending",null);_(this,"decoderConfig",{type:"js",wasmBinary:null});_(this,"workerSourceURL","")}async _initDecoder(){if(this.decoderPending)return this.decoderPending;const s=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return s?t.push(S.LOAD_DRACO_JS_DECODER()):(t.push(S.LOAD_DRACO_WASM_WRAPPER()),t.push(S.LOAD_DRACO_WASM_DECODER())),this.decoderPending=Promise.all(t).then(e=>{const c=e[0];s||(this.decoderConfig.wasmBinary=e[1]);const o=I.toString(),n=["/* draco decoder */",c,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
|
|
2
2
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}}function z(){let a=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 a||(a=occtimportjs({locateFile:function(){return r}})),a}function e(o){for(var n=new TextDecoder("utf-8",{fatal:!1}),i=new TextEncoder,u=n.decode(o),d=0;d<s.length;d++){var h=s[d][0],l=s[d][1];u=u.replace(h,l)}return new Uint8Array(i.encode(u))}function c(o,n){var i=e(n);try{var u=o.ReadStepFile(i,null);if(u.success&&u.root)return u}catch{}try{return o.ReadStepFile(n,null)}catch{return{success:!1,root:{meshes:[],children:[]},meshes:[]}}}onmessage=async function(o){var n=o.data;switch(n.type){case"init":r=n.wasmUrl;break;case"parse":try{var i=await t(),u=new Uint8Array(n.buffer),d=n.fileType,h;if(d==="step"||d==="stp"?h=c(i,u):h=i.ReadIgesFile(u,null),!h.success||!h.root){self.postMessage({type:"error",id:n.id,error:"Failed to parse CAD file"});return}self.postMessage({type:"result",id:n.id,result:h})}catch(l){self.postMessage({type:"error",id:n.id,error:l instanceof Error?l.message:String(l)})}break}}}const O={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 J{constructor(){_(this,"_workerPending",null);_(this,"_worker",null);_(this,"_nextId",0);_(this,"_pending",new Map)}_getWorker(){return this._workerPending?this._workerPending:(this._workerPending=(async()=>{const[r,s]=await Promise.all([O.LOAD_OCCT_JS(),O.LOAD_OCCT_WASM_URL()]),t=z.toString(),e=["/* occt-import-js */",r,"","/* step worker */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}"))].join(`
|
|
3
3
|
`),c=URL.createObjectURL(new Blob([e])),o=new Worker(c),n=new URL(s,window.location.href).href;return o.postMessage({type:"init",wasmUrl:n}),o.onmessage=i=>{const{type:u,id:d,result:h,error:l}=i.data,f=this._pending.get(d);if(f)if(this._pending.delete(d),u==="result")try{f.resolve(this._buildScene(h))}catch(p){f.reject(p instanceof Error?p:new Error(String(p)))}else f.reject(new Error(l??"Worker error"))},o.onerror=i=>{for(const[,{reject:u}]of this._pending)u(new Error(i.message??"Worker error"));this._pending.clear()},this._worker=o,o})(),this._workerPending)}async parseAsync(r,s){const t=this._nextId++,e=await this._getWorker();return new Promise((c,o)=>{this._pending.set(t,{resolve:c,reject:o});const n=r.slice(0);e.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 m.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 e=new m.Group;e.name=r.name??"Part";for(const c of r.meshes){const o=s[c];if(o!=null&&o.attributes){const n=this._createMesh(o);e.add(n)}}for(const c of r.children)this._buildNode(c,s,e);t.add(e)}_createMesh(r){var u,d;const{position:s,normal:t}=r.attributes,e=r.index??r.attributes.index,c=new m.BufferGeometry;c.setAttribute("position",new m.BufferAttribute(new Float32Array(s.array),3)),(u=t==null?void 0:t.array)!=null&&u.length?c.setAttribute("normal",new m.BufferAttribute(new Float32Array(t.array),3)):c.computeVertexNormals(),(d=e==null?void 0:e.array)!=null&&d.length&&c.setIndex(new m.BufferAttribute(new Uint32Array(e.array),1));const o=r.color,n=new m.MeshStandardMaterial({metalness:.3,roughness:.6});o&&o.length>=3?n.color.setRGB(o[0],o[1],o[2]):n.color.setHex(13421772);const i=new m.Mesh(c,n);return i.name=r.name??"Mesh",i.castShadow=!0,i.receiveShadow=!0,i}}const E=a=>Array.isArray(a==null?void 0:a.children)?a.children.length:0;class ${constructor(){_(this,"_gltfLoader");_(this,"_usdLoader");_(this,"_stepLoader");const r=new P;r.setDecoderConfig({type:"wasm"}),this._gltfLoader=new B.GLTFLoader,this._gltfLoader.setDRACOLoader(r),this._usdLoader=new q.USDLoader,this._stepLoader=new J}_logLoad(r,s={}){console.info("[AssetLoader.load]",r,s)}_logLoadError(r,s,t={}){console.error("[AssetLoader.load]",r,{...t,error:s instanceof Error?s.message:String(s)})}async load(r,s){const t=performance.now();let e;if(this._logLoad("start",{uri:r,fileType:s??null}),s)e=s,this._logLoad("using-explicit-file-type",{uri:r,extension:e,elapsedMs:Math.round(performance.now()-t)});else if(e=R.getFileTypeFromUri(r),this._logLoad("derived-file-type-from-uri",{uri:r,extension:e,elapsedMs:Math.round(performance.now()-t)}),e.length===0&&(this._logLoad("detect-file-type-from-content-start",{uri:r,elapsedMs:Math.round(performance.now()-t)}),e=await this._detectFileTypeFromContent(r),this._logLoad("detect-file-type-from-content-complete",{uri:r,extension:e,elapsedMs:Math.round(performance.now()-t)}),e.length===0))throw new M.FileTypeError("No file extension found in URI","");if(!R.isFileTypeSupported(e))throw new M.FileTypeError(`Unsupported file type: ${e}. Supported types: ${j.SUPPORTED_FILE_TYPES.join(", ")}`,e);const c=D.AssetCache.read(r);if(this._logLoad(c?"cache-hit":"cache-miss",{uri:r,extension:e,hasArrayBuffer:!!(c!=null&&c.arrayBuffer),elapsedMs:Math.round(performance.now()-t)}),c)return c.arrayBuffer?(this._logLoad("parse-start",{uri:r,extension:e,source:"cache-array-buffer",byteLength:c.arrayBuffer.byteLength,elapsedMs:Math.round(performance.now()-t)}),this._parse(c.arrayBuffer,e,{uri:r,source:"cache-array-buffer",startedAt:t})):(this._logLoad("await-existing-cache-promise-start",{uri:r,extension:e,elapsedMs:Math.round(performance.now()-t)}),c.promise.then(i=>(this._logLoad("await-existing-cache-promise-resolved",{uri:r,extension:e,byteLength:i.byteLength,elapsedMs:Math.round(performance.now()-t)}),this._logLoad("parse-start",{uri:r,extension:e,source:"cache-promise",byteLength:i.byteLength,elapsedMs:Math.round(performance.now()-t)}),this._parse(i,e,{uri:r,source:"cache-promise",startedAt:t}))));const o=D.AssetCache.create(r);this._logLoad("chunk-created",{uri:r,extension:e,elapsedMs:Math.round(performance.now()-t)}),this._logLoad("chunk-load-start",{uri:r,extension:e,elapsedMs:Math.round(performance.now()-t)});const n=await o.load();return this._logLoad("chunk-load-resolved",{uri:r,extension:e,byteLength:n.byteLength,elapsedMs:Math.round(performance.now()-t)}),this._logLoad("parse-start",{uri:r,extension:e,source:"fresh-chunk",byteLength:n.byteLength,elapsedMs:Math.round(performance.now()-t)}),this._parse(n,e,{uri:r,source:"fresh-chunk",startedAt:t})}async _detectFileTypeFromContent(r){try{const s=D.AssetCache.read(r);let t;s?s.arrayBuffer?t=s.arrayBuffer:t=await s.promise:t=await D.AssetCache.create(r).load();const e=new Uint8Array(t);return e.length>=12&&String.fromCharCode(e[0],e[1],e[2],e[3])==="glTF"?e[12]===0?"glb":"gltf":e.length>=4&&e[0]===80&&e[1]===75&&(e[2]===3||e[2]===5)&&(e[3]===4||e[3]===6)?"usdz":e.length>=20&&new TextDecoder("ascii").decode(e.subarray(0,20)).startsWith("ISO-10303-21")?"step":e.length>=80&&e[72]===83?"iges":""}catch{return""}}async _parse(r,s,t){try{switch(this._logLoad("parse-dispatch",{uri:t.uri,type:s,source:t.source,byteLength:r.byteLength,elapsedMs:Math.round(performance.now()-t.startedAt)}),s){case"glb":case"gltf":{this._logLoad("gltf-parse-start",{uri:t.uri,type:s,source:t.source,elapsedMs:Math.round(performance.now()-t.startedAt)});const e=await this._gltfLoader.parseAsync(r,"");return e.scene.animations=e.animations,this._logLoad("gltf-parse-complete",{uri:t.uri,type:s,source:t.source,childCount:E(e.scene),animationCount:Array.isArray(e.animations)?e.animations.length:0,elapsedMs:Math.round(performance.now()-t.startedAt)}),e.scene}case"usdz":{this._logLoad("usdz-parse-start",{uri:t.uri,type:s,source:t.source,elapsedMs:Math.round(performance.now()-t.startedAt)});const e=this._usdLoader.parse(r);return e.animations=[],this._logLoad("usdz-parse-complete",{uri:t.uri,type:s,source:t.source,childCount:E(e),elapsedMs:Math.round(performance.now()-t.startedAt)}),e}case"step":case"stp":{this._logLoad("step-parse-start",{uri:t.uri,type:s,source:t.source,elapsedMs:Math.round(performance.now()-t.startedAt)});const e=await this._stepLoader.parseAsync(r,s);return e.animations=[],this._logLoad("step-parse-complete",{uri:t.uri,type:s,source:t.source,childCount:E(e),elapsedMs:Math.round(performance.now()-t.startedAt)}),e}case"iges":case"igs":{this._logLoad("iges-parse-start",{uri:t.uri,type:s,source:t.source,elapsedMs:Math.round(performance.now()-t.startedAt)});const e=await this._stepLoader.parseAsync(r,s);return e.animations=[],this._logLoad("iges-parse-complete",{uri:t.uri,type:s,source:t.source,childCount:E(e),elapsedMs:Math.round(performance.now()-t.startedAt)}),e}}}catch(e){throw this._logLoadError("parse-failed",e,{uri:t.uri,type:s,source:t.source,elapsedMs:Math.round(performance.now()-t.startedAt)}),e instanceof Error?new M.ParseError(`Failed to parse ${s} file: ${e.message}`,e):new M.ParseError(`Failed to parse ${s} file`)}}}exports.AssetLoader=$;exports.DRACOWorker=I;exports.DracoLoader=P;
|
|
@@ -3,14 +3,14 @@ var I = (u, t, o) => t in u ? T(u, t, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var _ = (u, t, o) => I(u, typeof t != "symbol" ? t + "" : t, o);
|
|
4
4
|
import { GLTFLoader as P } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
5
5
|
import { USDLoader as U } from "three/examples/jsm/loaders/USDLoader.js";
|
|
6
|
-
import { S as k } from "./FileTypes-
|
|
6
|
+
import { S as k } from "./FileTypes-gLjhiero.mjs";
|
|
7
7
|
import { Group as S, BufferGeometry as F, BufferAttribute as D, MeshStandardMaterial as N, Mesh as G } from "three/webgpu";
|
|
8
8
|
import "three/examples/jsm/loaders/HDRLoader.js";
|
|
9
9
|
import "three/tsl";
|
|
10
|
-
import { g as v, i as W } from "./isFileTypeSupported-
|
|
10
|
+
import { g as v, i as W } from "./isFileTypeSupported-B-ye2zhW.mjs";
|
|
11
11
|
import { F as C, P as R } from "./parse-error-DfOPyLWM.mjs";
|
|
12
12
|
import { DRACOLoader as B } from "three/examples/jsm/loaders/DRACOLoader.js";
|
|
13
|
-
import { A as L } from "./AssetCache-
|
|
13
|
+
import { A as L } from "./AssetCache-CTBSMCs6.mjs";
|
|
14
14
|
function H() {
|
|
15
15
|
let u, t;
|
|
16
16
|
onmessage = function(s) {
|