@shopware-ag/dive 2.0.1-beta.2 → 2.0.1-beta.3
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/FileTypes-DuVGjbcR.mjs +36 -0
- package/build/chunks/FileTypes-DzVpDu_p.cjs +1 -0
- package/build/chunks/fflate.module-DHdJvhNh.cjs +6 -0
- package/build/chunks/fflate.module-xyO_T3Zm.mjs +602 -0
- package/build/chunks/index-C7Wx_9uY.mjs +33 -0
- package/build/chunks/index-MNP0K5dt.cjs +1 -0
- package/build/chunks/{package-CgUmyOWW.mjs → package-C16N_5TP.mjs} +1 -1
- package/build/chunks/{package-BVRC9JGj.cjs → package-CafekLb8.cjs} +1 -1
- package/build/chunks/parse-error-BFRJyIxM.mjs +14 -0
- package/build/chunks/parse-error-Bd09D_1L.cjs +1 -0
- package/build/dive.cjs +2 -2
- package/build/dive.mjs +61 -46
- package/build/src/index.d.ts +4 -4
- package/build/src/modules/ar/ARSystem.cjs +1 -1
- package/build/src/modules/ar/ARSystem.mjs +2 -2
- package/build/src/modules/asset/exporter/AssetExporter.cjs +24 -24
- package/build/src/modules/asset/exporter/AssetExporter.mjs +4 -3
- package/build/src/modules/asset/loader/AssetLoader.cjs +4 -4
- package/build/src/modules/asset/loader/AssetLoader.mjs +85 -89
- package/build/src/modules/systeminfo/SystemInfo.cjs +1 -1
- package/build/src/modules/systeminfo/SystemInfo.mjs +112 -3
- package/package.json +1 -1
- package/build/chunks/FileTypes-BjZ0rrIV.cjs +0 -1
- package/build/chunks/FileTypes-qgYnI0Jg.mjs +0 -30
- package/build/chunks/SystemInfo-DPAQG-S5.mjs +0 -139
- package/build/chunks/SystemInfo-oX-NNneO.cjs +0 -1
- package/build/chunks/index-C_uFFwT2.mjs +0 -5
- package/build/chunks/index-DAwIH9xh.cjs +0 -1
- package/build/chunks/parse-error-2f5qpXP5.cjs +0 -6
- package/build/chunks/parse-error-DRBVHL9E.mjs +0 -614
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
var ve = Object.defineProperty;
|
|
2
2
|
var Be = (d, e, t) => e in d ? ve(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t;
|
|
3
3
|
var v = (d, e, t) => Be(d, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { TrianglesDrawMode as je, TriangleFanDrawMode as re, TriangleStripDrawMode as be, Loader as ae, LoaderUtils as X, FileLoader as K, MeshPhysicalMaterial as D, Vector2 as q, Color as U, LinearSRGBColorSpace as O, SRGBColorSpace as N, SpotLight as Ke, PointLight as Ve, DirectionalLight as We, Matrix4 as Y, Vector3 as B, Quaternion as Le, InstancedMesh as Xe, InstancedBufferAttribute as ze, Object3D as ce, 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 J, MirroredRepeatWrapping as Ne, ClampToEdgeWrapping as Oe, PointsMaterial as tt, Material as Z, LineBasicMaterial as nt, MeshStandardMaterial as De, DoubleSide as st, MeshBasicMaterial as W, PropertyBinding as rt, BufferGeometry as ue, 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 de, VectorKeyframeTrack as he, NumberKeyframeTrack as pe, QuaternionKeyframeTrack as me, ColorManagement as ge, FrontSide as At, Interpolant as Tt, Box3 as yt, Sphere as
|
|
5
|
-
import { u as
|
|
6
|
-
import { g as _t, i as wt, S as Et } from "../../../../chunks/FileTypes-
|
|
4
|
+
import { TrianglesDrawMode as je, TriangleFanDrawMode as re, TriangleStripDrawMode as be, Loader as ae, LoaderUtils as X, FileLoader as K, MeshPhysicalMaterial as D, Vector2 as q, Color as U, LinearSRGBColorSpace as O, SRGBColorSpace as N, SpotLight as Ke, PointLight as Ve, DirectionalLight as We, Matrix4 as Y, Vector3 as B, Quaternion as Le, InstancedMesh as Xe, InstancedBufferAttribute as ze, Object3D as ce, 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 J, MirroredRepeatWrapping as Ne, ClampToEdgeWrapping as Oe, PointsMaterial as tt, Material as Z, LineBasicMaterial as nt, MeshStandardMaterial as De, DoubleSide as st, MeshBasicMaterial as W, PropertyBinding as rt, BufferGeometry as ue, 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 de, VectorKeyframeTrack as he, NumberKeyframeTrack as pe, QuaternionKeyframeTrack as me, ColorManagement as ge, FrontSide as At, Interpolant as Tt, Box3 as yt, Sphere as Rt, NoColorSpace as H } from "three";
|
|
5
|
+
import { u as xt, a as Ae } from "../../../../chunks/fflate.module-xyO_T3Zm.mjs";
|
|
6
|
+
import { N as Te, g as _t, i as wt, S as Et } from "../../../../chunks/FileTypes-DuVGjbcR.mjs";
|
|
7
|
+
import { F as ye, P as Re } from "../../../../chunks/parse-error-BFRJyIxM.mjs";
|
|
7
8
|
function xe(d, e) {
|
|
8
9
|
if (e === je)
|
|
9
10
|
return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
|
|
@@ -573,9 +574,9 @@ class Kt {
|
|
|
573
574
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((c) => {
|
|
574
575
|
const u = c.pop(), l = u.isGroup ? u.children : [u], f = c[0].count, m = [];
|
|
575
576
|
for (const T of l) {
|
|
576
|
-
const
|
|
577
|
+
const x = new Y(), y = new B(), R = new Le(), E = new B(1, 1, 1), S = new Xe(T.geometry, T.material, f);
|
|
577
578
|
for (let _ = 0; _ < f; _++)
|
|
578
|
-
i.TRANSLATION && y.fromBufferAttribute(i.TRANSLATION, _), i.ROTATION &&
|
|
579
|
+
i.TRANSLATION && y.fromBufferAttribute(i.TRANSLATION, _), i.ROTATION && R.fromBufferAttribute(i.ROTATION, _), i.SCALE && E.fromBufferAttribute(i.SCALE, _), S.setMatrixAt(_, x.compose(y, R, E));
|
|
579
580
|
for (const _ in i)
|
|
580
581
|
if (_ === "_COLOR_0") {
|
|
581
582
|
const M = i[_];
|
|
@@ -587,7 +588,7 @@ class Kt {
|
|
|
587
588
|
}));
|
|
588
589
|
}
|
|
589
590
|
}
|
|
590
|
-
const Fe = "glTF", V = 12,
|
|
591
|
+
const Fe = "glTF", V = 12, _e = { JSON: 1313821514, BIN: 5130562 };
|
|
591
592
|
class Vt {
|
|
592
593
|
constructor(e) {
|
|
593
594
|
this.name = b.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
@@ -606,10 +607,10 @@ class Vt {
|
|
|
606
607
|
const a = r.getUint32(s, !0);
|
|
607
608
|
s += 4;
|
|
608
609
|
const i = r.getUint32(s, !0);
|
|
609
|
-
if (s += 4, i ===
|
|
610
|
+
if (s += 4, i === _e.JSON) {
|
|
610
611
|
const c = new Uint8Array(e, V + s, a);
|
|
611
612
|
this.content = o.decode(c);
|
|
612
|
-
} else if (i ===
|
|
613
|
+
} else if (i === _e.BIN) {
|
|
613
614
|
const c = V + s;
|
|
614
615
|
this.body = e.slice(c, c + a);
|
|
615
616
|
}
|
|
@@ -642,8 +643,8 @@ class Wt {
|
|
|
642
643
|
return new Promise(function(l, f) {
|
|
643
644
|
n.decodeDracoFile(u, function(m) {
|
|
644
645
|
for (const T in m.attributes) {
|
|
645
|
-
const
|
|
646
|
-
y !== void 0 && (
|
|
646
|
+
const x = m.attributes[T], y = i[T];
|
|
647
|
+
y !== void 0 && (x.normalized = y);
|
|
647
648
|
}
|
|
648
649
|
l(m);
|
|
649
650
|
}, a, c, O, f);
|
|
@@ -675,10 +676,10 @@ class Ue extends Tt {
|
|
|
675
676
|
return t;
|
|
676
677
|
}
|
|
677
678
|
interpolate_(e, t, o, n) {
|
|
678
|
-
const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, i = a * 2, c = a * 3, u = n - t, l = (o - t) / u, f = l * l, m = f * l, T = e * c,
|
|
679
|
+
const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, i = a * 2, c = a * 3, u = n - t, l = (o - t) / u, f = l * l, m = f * l, T = e * c, x = T - c, y = -2 * m + 3 * f, R = m - f, E = 1 - y, S = R - f + l;
|
|
679
680
|
for (let _ = 0; _ !== a; _++) {
|
|
680
|
-
const M = s[
|
|
681
|
-
r[_] = E * M + S * I + y * L +
|
|
681
|
+
const M = s[x + _ + a], I = s[x + _ + i] * u, L = s[T + _ + a], h = s[T + _] * u;
|
|
682
|
+
r[_] = E * M + S * I + y * L + R * h;
|
|
682
683
|
}
|
|
683
684
|
return r;
|
|
684
685
|
}
|
|
@@ -705,14 +706,14 @@ const C = {
|
|
|
705
706
|
5123: Uint16Array,
|
|
706
707
|
5125: Uint32Array,
|
|
707
708
|
5126: Float32Array
|
|
708
|
-
},
|
|
709
|
+
}, we = {
|
|
709
710
|
9728: et,
|
|
710
711
|
9729: Ce,
|
|
711
712
|
9984: $e,
|
|
712
713
|
9985: Ze,
|
|
713
714
|
9986: Qe,
|
|
714
715
|
9987: Ie
|
|
715
|
-
},
|
|
716
|
+
}, Ee = {
|
|
716
717
|
33071: Oe,
|
|
717
718
|
33648: Ne,
|
|
718
719
|
10497: J
|
|
@@ -1074,15 +1075,15 @@ class sn {
|
|
|
1074
1075
|
const r = [];
|
|
1075
1076
|
return n.bufferView !== void 0 ? r.push(this.getDependency("bufferView", n.bufferView)) : r.push(null), n.sparse !== void 0 && (r.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(r).then(function(s) {
|
|
1076
1077
|
const a = s[0], i = $[n.type], c = j[n.componentType], u = c.BYTES_PER_ELEMENT, l = u * i, f = n.byteOffset || 0, m = n.bufferView !== void 0 ? o.bufferViews[n.bufferView].byteStride : void 0, T = n.normalized === !0;
|
|
1077
|
-
let
|
|
1078
|
+
let x, y;
|
|
1078
1079
|
if (m && m !== l) {
|
|
1079
|
-
const
|
|
1080
|
+
const R = Math.floor(f / m), E = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + R + ":" + n.count;
|
|
1080
1081
|
let S = t.cache.get(E);
|
|
1081
|
-
S || (
|
|
1082
|
+
S || (x = new c(a, R * m, n.count * m / u), S = new Ye(x, m / u), t.cache.add(E, S)), y = new Je(S, i, f % m / u, T);
|
|
1082
1083
|
} else
|
|
1083
|
-
a === null ?
|
|
1084
|
+
a === null ? x = new c(n.count * i) : x = new c(a, f, n.count * i), y = new P(x, i, T);
|
|
1084
1085
|
if (n.sparse !== void 0) {
|
|
1085
|
-
const
|
|
1086
|
+
const R = $.SCALAR, E = j[n.sparse.indices.componentType], S = n.sparse.indices.byteOffset || 0, _ = n.sparse.values.byteOffset || 0, M = new E(s[1], S, n.sparse.count * R), I = new c(s[2], _, n.sparse.count * i);
|
|
1086
1087
|
a !== null && (y = new P(y.array.slice(), y.itemSize, y.normalized));
|
|
1087
1088
|
for (let L = 0, h = M.length; L < h; L++) {
|
|
1088
1089
|
const p = M[L];
|
|
@@ -1113,7 +1114,7 @@ class sn {
|
|
|
1113
1114
|
const c = this.loadImageSource(t, o).then(function(u) {
|
|
1114
1115
|
u.flipY = !1, u.name = s.name || a.name || "", u.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (u.name = a.uri);
|
|
1115
1116
|
const f = (r.samplers || {})[s.sampler] || {};
|
|
1116
|
-
return u.magFilter =
|
|
1117
|
+
return u.magFilter = we[f.magFilter] || Ce, u.minFilter = we[f.minFilter] || Ie, u.wrapS = Ee[f.wrapS] || J, u.wrapT = Ee[f.wrapT] || J, n.associations.set(u, { textures: e }), u;
|
|
1117
1118
|
}).catch(function() {
|
|
1118
1119
|
return null;
|
|
1119
1120
|
});
|
|
@@ -1136,8 +1137,8 @@ class sn {
|
|
|
1136
1137
|
const u = Promise.resolve(i).then(function(l) {
|
|
1137
1138
|
return new Promise(function(f, m) {
|
|
1138
1139
|
let T = f;
|
|
1139
|
-
t.isImageBitmapLoader === !0 && (T = function(
|
|
1140
|
-
const y = new de(
|
|
1140
|
+
t.isImageBitmapLoader === !0 && (T = function(x) {
|
|
1141
|
+
const y = new de(x);
|
|
1141
1142
|
y.needsUpdate = !0, f(y);
|
|
1142
1143
|
}), t.load(X.resolveURL(l, r.path), T, void 0, m);
|
|
1143
1144
|
});
|
|
@@ -1257,7 +1258,7 @@ class sn {
|
|
|
1257
1258
|
const t = this, o = this.extensions, n = this.primitiveCache;
|
|
1258
1259
|
function r(a) {
|
|
1259
1260
|
return o[b.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(i) {
|
|
1260
|
-
return
|
|
1261
|
+
return Se(i, a, t);
|
|
1261
1262
|
});
|
|
1262
1263
|
}
|
|
1263
1264
|
const s = [];
|
|
@@ -1267,7 +1268,7 @@ class sn {
|
|
|
1267
1268
|
s.push(l.promise);
|
|
1268
1269
|
else {
|
|
1269
1270
|
let f;
|
|
1270
|
-
c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f = r(c) : f =
|
|
1271
|
+
c.extensions && c.extensions[b.KHR_DRACO_MESH_COMPRESSION] ? f = r(c) : f = Se(new ue(), c, t), n[u] = { primitive: c, promise: f }, s.push(f);
|
|
1271
1272
|
}
|
|
1272
1273
|
}
|
|
1273
1274
|
return Promise.all(s);
|
|
@@ -1286,22 +1287,22 @@ class sn {
|
|
|
1286
1287
|
return a.push(t.loadGeometries(s)), Promise.all(a).then(function(i) {
|
|
1287
1288
|
const c = i.slice(0, i.length - 1), u = i[i.length - 1], l = [];
|
|
1288
1289
|
for (let m = 0, T = u.length; m < T; m++) {
|
|
1289
|
-
const
|
|
1290
|
-
let
|
|
1290
|
+
const x = u[m], y = s[m];
|
|
1291
|
+
let R;
|
|
1291
1292
|
const E = c[m];
|
|
1292
1293
|
if (y.mode === C.TRIANGLES || y.mode === C.TRIANGLE_STRIP || y.mode === C.TRIANGLE_FAN || y.mode === void 0)
|
|
1293
|
-
|
|
1294
|
+
R = r.isSkinnedMesh === !0 ? new ot(x, E) : new Pe(x, E), R.isSkinnedMesh === !0 && R.normalizeSkinWeights(), y.mode === C.TRIANGLE_STRIP ? R.geometry = xe(R.geometry, be) : y.mode === C.TRIANGLE_FAN && (R.geometry = xe(R.geometry, re));
|
|
1294
1295
|
else if (y.mode === C.LINES)
|
|
1295
|
-
|
|
1296
|
+
R = new it(x, E);
|
|
1296
1297
|
else if (y.mode === C.LINE_STRIP)
|
|
1297
|
-
|
|
1298
|
+
R = new at(x, E);
|
|
1298
1299
|
else if (y.mode === C.LINE_LOOP)
|
|
1299
|
-
|
|
1300
|
+
R = new ct(x, E);
|
|
1300
1301
|
else if (y.mode === C.POINTS)
|
|
1301
|
-
|
|
1302
|
+
R = new ut(x, E);
|
|
1302
1303
|
else
|
|
1303
1304
|
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
|
|
1304
|
-
Object.keys(
|
|
1305
|
+
Object.keys(R.geometry.morphAttributes).length > 0 && $t(R, r), R.name = t.createUniqueName(r.name || "mesh_" + e), F(R, r), y.extensions && G(n, R, y), t.assignFinalMaterial(R), l.push(R);
|
|
1305
1306
|
}
|
|
1306
1307
|
for (let m = 0, T = l.length; m < T; m++)
|
|
1307
1308
|
t.associations.set(l[m], {
|
|
@@ -1362,8 +1363,8 @@ class sn {
|
|
|
1362
1363
|
loadAnimation(e) {
|
|
1363
1364
|
const t = this.json, o = this, n = t.animations[e], r = n.name ? n.name : "animation_" + e, s = [], a = [], i = [], c = [], u = [];
|
|
1364
1365
|
for (let l = 0, f = n.channels.length; l < f; l++) {
|
|
1365
|
-
const m = n.channels[l], T = n.samplers[m.sampler],
|
|
1366
|
-
|
|
1366
|
+
const m = n.channels[l], T = n.samplers[m.sampler], x = m.target, y = x.node, R = n.parameters !== void 0 ? n.parameters[T.input] : T.input, E = n.parameters !== void 0 ? n.parameters[T.output] : T.output;
|
|
1367
|
+
x.node !== void 0 && (s.push(this.getDependency("node", y)), a.push(this.getDependency("accessor", R)), i.push(this.getDependency("accessor", E)), c.push(T), u.push(x));
|
|
1367
1368
|
}
|
|
1368
1369
|
return Promise.all([
|
|
1369
1370
|
Promise.all(s),
|
|
@@ -1372,17 +1373,17 @@ class sn {
|
|
|
1372
1373
|
Promise.all(c),
|
|
1373
1374
|
Promise.all(u)
|
|
1374
1375
|
]).then(function(l) {
|
|
1375
|
-
const f = l[0], m = l[1], T = l[2],
|
|
1376
|
+
const f = l[0], m = l[1], T = l[2], x = l[3], y = l[4], R = [];
|
|
1376
1377
|
for (let E = 0, S = f.length; E < S; E++) {
|
|
1377
|
-
const _ = f[E], M = m[E], I = T[E], L =
|
|
1378
|
+
const _ = f[E], M = m[E], I = T[E], L = x[E], h = y[E];
|
|
1378
1379
|
if (_ === void 0) continue;
|
|
1379
1380
|
_.updateMatrix && _.updateMatrix();
|
|
1380
1381
|
const p = o._createAnimationTracks(_, M, I, L, h);
|
|
1381
1382
|
if (p)
|
|
1382
1383
|
for (let g = 0; g < p.length; g++)
|
|
1383
|
-
|
|
1384
|
+
R.push(p[g]);
|
|
1384
1385
|
}
|
|
1385
|
-
return new pt(r, void 0,
|
|
1386
|
+
return new pt(r, void 0, R);
|
|
1386
1387
|
});
|
|
1387
1388
|
}
|
|
1388
1389
|
createNodeMesh(e) {
|
|
@@ -1560,8 +1561,8 @@ function rn(d, e, t) {
|
|
|
1560
1561
|
const f = t.json.accessors[l.POSITION], m = f.min, T = f.max;
|
|
1561
1562
|
if (m !== void 0 && T !== void 0) {
|
|
1562
1563
|
if (i.setX(Math.max(Math.abs(m[0]), Math.abs(T[0]))), i.setY(Math.max(Math.abs(m[1]), Math.abs(T[1]))), i.setZ(Math.max(Math.abs(m[2]), Math.abs(T[2]))), f.normalized) {
|
|
1563
|
-
const
|
|
1564
|
-
i.multiplyScalar(
|
|
1564
|
+
const x = ie(j[f.componentType]);
|
|
1565
|
+
i.multiplyScalar(x);
|
|
1565
1566
|
}
|
|
1566
1567
|
a.max(i);
|
|
1567
1568
|
} else
|
|
@@ -1571,10 +1572,10 @@ function rn(d, e, t) {
|
|
|
1571
1572
|
n.expandByVector(a);
|
|
1572
1573
|
}
|
|
1573
1574
|
d.boundingBox = n;
|
|
1574
|
-
const s = new
|
|
1575
|
+
const s = new Rt();
|
|
1575
1576
|
n.getCenter(s.center), s.radius = n.min.distanceTo(n.max) / 2, d.boundingSphere = s;
|
|
1576
1577
|
}
|
|
1577
|
-
function
|
|
1578
|
+
function Se(d, e, t) {
|
|
1578
1579
|
const o = e.attributes, n = [];
|
|
1579
1580
|
function r(s, a) {
|
|
1580
1581
|
return t.getDependency("accessor", s).then(function(i) {
|
|
@@ -1675,7 +1676,7 @@ class an extends ae {
|
|
|
1675
1676
|
return h[p];
|
|
1676
1677
|
g && console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
|
|
1677
1678
|
}
|
|
1678
|
-
const s =
|
|
1679
|
+
const s = xt(new Uint8Array(e)), a = o(s), i = r(s);
|
|
1679
1680
|
if (i === void 0)
|
|
1680
1681
|
return console.warn("THREE.USDZLoader: No usda file found."), new z();
|
|
1681
1682
|
const c = Ae(i), u = t.parse(c);
|
|
@@ -1743,7 +1744,7 @@ class an extends ae {
|
|
|
1743
1744
|
}
|
|
1744
1745
|
return new P(w, A);
|
|
1745
1746
|
}
|
|
1746
|
-
function
|
|
1747
|
+
function x(h) {
|
|
1747
1748
|
if (h) {
|
|
1748
1749
|
if ("rel material:binding" in h) {
|
|
1749
1750
|
const A = h["rel material:binding"].replace(/^<\//, "").replace(/>$/, "").split("/");
|
|
@@ -1763,7 +1764,7 @@ class an extends ae {
|
|
|
1763
1764
|
}
|
|
1764
1765
|
}
|
|
1765
1766
|
}
|
|
1766
|
-
function
|
|
1767
|
+
function R(h, p) {
|
|
1767
1768
|
p["float inputs:rotation"] && (h.rotation = parseFloat(p["float inputs:rotation"])), p["float2 inputs:scale"] && (h.repeat = new q().fromArray(JSON.parse("[" + p["float2 inputs:scale"].replace(/[()]*/g, "") + "]"))), p["float2 inputs:translation"] && (h.offset = new q().fromArray(JSON.parse("[" + p["float2 inputs:translation"].replace(/[()]*/g, "") + "]")));
|
|
1768
1769
|
}
|
|
1769
1770
|
function E(h) {
|
|
@@ -1773,41 +1774,41 @@ class an extends ae {
|
|
|
1773
1774
|
const g = h['def Shader "PreviewSurface"'];
|
|
1774
1775
|
if ("color3f inputs:diffuseColor.connect" in g) {
|
|
1775
1776
|
const A = g["color3f inputs:diffuseColor.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1776
|
-
p.map = _(w), p.map.colorSpace = N, 'def Shader "Transform2d_diffuse"' in h &&
|
|
1777
|
+
p.map = _(w), p.map.colorSpace = N, 'def Shader "Transform2d_diffuse"' in h && R(p.map, h['def Shader "Transform2d_diffuse"']);
|
|
1777
1778
|
} else if ("color3f inputs:diffuseColor" in g) {
|
|
1778
1779
|
const A = g["color3f inputs:diffuseColor"].replace(/[()]*/g, "");
|
|
1779
1780
|
p.color.fromArray(JSON.parse("[" + A + "]"));
|
|
1780
1781
|
}
|
|
1781
1782
|
if ("color3f inputs:emissiveColor.connect" in g) {
|
|
1782
1783
|
const A = g["color3f inputs:emissiveColor.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1783
|
-
p.emissiveMap = _(w), p.emissiveMap.colorSpace = N, p.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in h &&
|
|
1784
|
+
p.emissiveMap = _(w), p.emissiveMap.colorSpace = N, p.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in h && R(p.emissiveMap, h['def Shader "Transform2d_emissive"']);
|
|
1784
1785
|
} else if ("color3f inputs:emissiveColor" in g) {
|
|
1785
1786
|
const A = g["color3f inputs:emissiveColor"].replace(/[()]*/g, "");
|
|
1786
1787
|
p.emissive.fromArray(JSON.parse("[" + A + "]"));
|
|
1787
1788
|
}
|
|
1788
1789
|
if ("normal3f inputs:normal.connect" in g) {
|
|
1789
1790
|
const A = g["normal3f inputs:normal.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1790
|
-
p.normalMap = _(w), p.normalMap.colorSpace = H, 'def Shader "Transform2d_normal"' in h &&
|
|
1791
|
+
p.normalMap = _(w), p.normalMap.colorSpace = H, 'def Shader "Transform2d_normal"' in h && R(p.normalMap, h['def Shader "Transform2d_normal"']);
|
|
1791
1792
|
}
|
|
1792
1793
|
if ("float inputs:roughness.connect" in g) {
|
|
1793
1794
|
const A = g["float inputs:roughness.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1794
|
-
p.roughness = 1, p.roughnessMap = _(w), p.roughnessMap.colorSpace = H, 'def Shader "Transform2d_roughness"' in h &&
|
|
1795
|
+
p.roughness = 1, p.roughnessMap = _(w), p.roughnessMap.colorSpace = H, 'def Shader "Transform2d_roughness"' in h && R(p.roughnessMap, h['def Shader "Transform2d_roughness"']);
|
|
1795
1796
|
} else "float inputs:roughness" in g && (p.roughness = parseFloat(g["float inputs:roughness"]));
|
|
1796
1797
|
if ("float inputs:metallic.connect" in g) {
|
|
1797
1798
|
const A = g["float inputs:metallic.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1798
|
-
p.metalness = 1, p.metalnessMap = _(w), p.metalnessMap.colorSpace = H, 'def Shader "Transform2d_metallic"' in h &&
|
|
1799
|
+
p.metalness = 1, p.metalnessMap = _(w), p.metalnessMap.colorSpace = H, 'def Shader "Transform2d_metallic"' in h && R(p.metalnessMap, h['def Shader "Transform2d_metallic"']);
|
|
1799
1800
|
} else "float inputs:metallic" in g && (p.metalness = parseFloat(g["float inputs:metallic"]));
|
|
1800
1801
|
if ("float inputs:clearcoat.connect" in g) {
|
|
1801
1802
|
const A = g["float inputs:clearcoat.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1802
|
-
p.clearcoat = 1, p.clearcoatMap = _(w), p.clearcoatMap.colorSpace = H, 'def Shader "Transform2d_clearcoat"' in h &&
|
|
1803
|
+
p.clearcoat = 1, p.clearcoatMap = _(w), p.clearcoatMap.colorSpace = H, 'def Shader "Transform2d_clearcoat"' in h && R(p.clearcoatMap, h['def Shader "Transform2d_clearcoat"']);
|
|
1803
1804
|
} else "float inputs:clearcoat" in g && (p.clearcoat = parseFloat(g["float inputs:clearcoat"]));
|
|
1804
1805
|
if ("float inputs:clearcoatRoughness.connect" in g) {
|
|
1805
1806
|
const A = g["float inputs:clearcoatRoughness.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1806
|
-
p.clearcoatRoughness = 1, p.clearcoatRoughnessMap = _(w), p.clearcoatRoughnessMap.colorSpace = H, 'def Shader "Transform2d_clearcoatRoughness"' in h &&
|
|
1807
|
+
p.clearcoatRoughness = 1, p.clearcoatRoughnessMap = _(w), p.clearcoatRoughnessMap.colorSpace = H, 'def Shader "Transform2d_clearcoatRoughness"' in h && R(p.clearcoatRoughnessMap, h['def Shader "Transform2d_clearcoatRoughness"']);
|
|
1807
1808
|
} else "float inputs:clearcoatRoughness" in g && (p.clearcoatRoughness = parseFloat(g["float inputs:clearcoatRoughness"]));
|
|
1808
1809
|
if ("float inputs:ior" in g && (p.ior = parseFloat(g["float inputs:ior"])), "float inputs:occlusion.connect" in g) {
|
|
1809
1810
|
const A = g["float inputs:occlusion.connect"], w = S(u, /(\w+).output/.exec(A)[1]);
|
|
1810
|
-
p.aoMap = _(w), p.aoMap.colorSpace = H, 'def Shader "Transform2d_occlusion"' in h &&
|
|
1811
|
+
p.aoMap = _(w), p.aoMap.colorSpace = H, 'def Shader "Transform2d_occlusion"' in h && R(p.aoMap, h['def Shader "Transform2d_occlusion"']);
|
|
1811
1812
|
}
|
|
1812
1813
|
}
|
|
1813
1814
|
if ('def Shader "diffuseColor_texture"' in h) {
|
|
@@ -1844,7 +1845,7 @@ class an extends ae {
|
|
|
1844
1845
|
return null;
|
|
1845
1846
|
}
|
|
1846
1847
|
function M(h) {
|
|
1847
|
-
const p = m(l(h)), g = E(
|
|
1848
|
+
const p = m(l(h)), g = E(x(h)), A = p ? new Pe(p, g) : new ce();
|
|
1848
1849
|
if ("matrix4d xformOp:transform" in h) {
|
|
1849
1850
|
const w = JSON.parse("[" + h["matrix4d xformOp:transform"].replace(/[()]*/g, "") + "]");
|
|
1850
1851
|
A.matrix.fromArray(w), A.matrix.decompose(A.position, A.quaternion, A.scale);
|
|
@@ -1864,11 +1865,6 @@ class an extends ae {
|
|
|
1864
1865
|
return I(u, L), L;
|
|
1865
1866
|
}
|
|
1866
1867
|
}
|
|
1867
|
-
class Se extends Error {
|
|
1868
|
-
constructor(e, t, o) {
|
|
1869
|
-
super(t), this.url = e, this.cause = o, this.name = "NetworkError";
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
1868
|
const ne = /* @__PURE__ */ new WeakMap();
|
|
1873
1869
|
class cn extends ae {
|
|
1874
1870
|
constructor(e) {
|
|
@@ -2030,7 +2026,7 @@ function un() {
|
|
|
2030
2026
|
e.then((u) => {
|
|
2031
2027
|
const l = u.draco, f = new l.Decoder();
|
|
2032
2028
|
try {
|
|
2033
|
-
const m = t(l, f, new Int8Array(i), c), T = m.attributes.map((
|
|
2029
|
+
const m = t(l, f, new Int8Array(i), c), T = m.attributes.map((x) => x.array.buffer);
|
|
2034
2030
|
m.index && T.push(m.index.array.buffer), self.postMessage({ type: "decode", id: a.id, geometry: m }, T);
|
|
2035
2031
|
} catch (m) {
|
|
2036
2032
|
console.error(m), self.postMessage({ type: "error", id: a.id, error: m.message });
|
|
@@ -2053,9 +2049,9 @@ function un() {
|
|
|
2053
2049
|
throw new Error("THREE.DRACOLoader: Unexpected geometry type.");
|
|
2054
2050
|
if (!m.ok() || f.ptr === 0)
|
|
2055
2051
|
throw new Error("THREE.DRACOLoader: Decoding failed: " + m.error_msg());
|
|
2056
|
-
const
|
|
2052
|
+
const x = { index: null, attributes: [] };
|
|
2057
2053
|
for (const y in u) {
|
|
2058
|
-
const
|
|
2054
|
+
const R = self[l[y]];
|
|
2059
2055
|
let E, S;
|
|
2060
2056
|
if (c.useUniqueIDs)
|
|
2061
2057
|
S = u[y], E = a.GetAttributeByUniqueId(f, S);
|
|
@@ -2063,10 +2059,10 @@ function un() {
|
|
|
2063
2059
|
if (S = a.GetAttributeId(f, s[u[y]]), S === -1) continue;
|
|
2064
2060
|
E = a.GetAttribute(f, S);
|
|
2065
2061
|
}
|
|
2066
|
-
const _ = n(s, a, f, y,
|
|
2067
|
-
y === "color" && (_.vertexColorSpace = c.vertexColorSpace),
|
|
2062
|
+
const _ = n(s, a, f, y, R, E);
|
|
2063
|
+
y === "color" && (_.vertexColorSpace = c.vertexColorSpace), x.attributes.push(_);
|
|
2068
2064
|
}
|
|
2069
|
-
return T === s.TRIANGULAR_MESH && (
|
|
2065
|
+
return T === s.TRIANGULAR_MESH && (x.index = o(s, a, f)), s.destroy(f), x;
|
|
2070
2066
|
}
|
|
2071
2067
|
function o(s, a, i) {
|
|
2072
2068
|
const u = i.num_faces() * 3, l = u * 4, f = s._malloc(l);
|
|
@@ -2075,10 +2071,10 @@ function un() {
|
|
|
2075
2071
|
return s._free(f), { array: m, itemSize: 1 };
|
|
2076
2072
|
}
|
|
2077
2073
|
function n(s, a, i, c, u, l) {
|
|
2078
|
-
const f = l.num_components(), T = i.num_points() * f,
|
|
2079
|
-
a.GetAttributeDataArrayForAllPoints(i, l, y,
|
|
2080
|
-
const E = new u(s.HEAPF32.buffer,
|
|
2081
|
-
return s._free(
|
|
2074
|
+
const f = l.num_components(), T = i.num_points() * f, x = T * u.BYTES_PER_ELEMENT, y = r(s, u), R = s._malloc(x);
|
|
2075
|
+
a.GetAttributeDataArrayForAllPoints(i, l, y, x, R);
|
|
2076
|
+
const E = new u(s.HEAPF32.buffer, R, T).slice();
|
|
2077
|
+
return s._free(R), {
|
|
2082
2078
|
name: c,
|
|
2083
2079
|
array: E,
|
|
2084
2080
|
itemSize: f
|
|
@@ -2126,7 +2122,7 @@ function ln() {
|
|
|
2126
2122
|
new Int8Array(i),
|
|
2127
2123
|
c
|
|
2128
2124
|
), T = m.attributes.map(
|
|
2129
|
-
(
|
|
2125
|
+
(x) => x.array.buffer
|
|
2130
2126
|
);
|
|
2131
2127
|
m.index && T.push(m.index.array.buffer), self.postMessage(
|
|
2132
2128
|
{ type: "decode", id: a.id, geometry: m },
|
|
@@ -2167,9 +2163,9 @@ function ln() {
|
|
|
2167
2163
|
throw new Error(
|
|
2168
2164
|
"THREE.DRACOLoader: Decoding failed: " + m.error_msg()
|
|
2169
2165
|
);
|
|
2170
|
-
const
|
|
2166
|
+
const x = { index: null, attributes: [] };
|
|
2171
2167
|
for (const y in u) {
|
|
2172
|
-
const
|
|
2168
|
+
const R = self[l[y]];
|
|
2173
2169
|
let E, S;
|
|
2174
2170
|
if (c.useUniqueIDs)
|
|
2175
2171
|
S = u[y], E = a.GetAttributeByUniqueId(
|
|
@@ -2188,12 +2184,12 @@ function ln() {
|
|
|
2188
2184
|
a,
|
|
2189
2185
|
f,
|
|
2190
2186
|
y,
|
|
2191
|
-
|
|
2187
|
+
R,
|
|
2192
2188
|
E
|
|
2193
2189
|
);
|
|
2194
|
-
y === "color" && (_.vertexColorSpace = c.vertexColorSpace),
|
|
2190
|
+
y === "color" && (_.vertexColorSpace = c.vertexColorSpace), x.attributes.push(_);
|
|
2195
2191
|
}
|
|
2196
|
-
return T === s.TRIANGULAR_MESH && (
|
|
2192
|
+
return T === s.TRIANGULAR_MESH && (x.index = o(s, a, f)), s.destroy(f), x;
|
|
2197
2193
|
}
|
|
2198
2194
|
function o(s, a, i) {
|
|
2199
2195
|
const u = i.num_faces() * 3, l = u * 4, f = s._malloc(l);
|
|
@@ -2206,20 +2202,20 @@ function ln() {
|
|
|
2206
2202
|
return s._free(f), { array: m, itemSize: 1 };
|
|
2207
2203
|
}
|
|
2208
2204
|
function n(s, a, i, c, u, l) {
|
|
2209
|
-
const f = l.num_components(), T = i.num_points() * f,
|
|
2205
|
+
const f = l.num_components(), T = i.num_points() * f, x = T * u.BYTES_PER_ELEMENT, y = r(s, u), R = s._malloc(x);
|
|
2210
2206
|
a.GetAttributeDataArrayForAllPoints(
|
|
2211
2207
|
i,
|
|
2212
2208
|
l,
|
|
2213
2209
|
y,
|
|
2214
|
-
|
|
2215
|
-
|
|
2210
|
+
x,
|
|
2211
|
+
R
|
|
2216
2212
|
);
|
|
2217
2213
|
const E = new u(
|
|
2218
2214
|
s.HEAPF32.buffer,
|
|
2219
|
-
|
|
2215
|
+
R,
|
|
2220
2216
|
T
|
|
2221
2217
|
).slice();
|
|
2222
|
-
return s._free(
|
|
2218
|
+
return s._free(R), {
|
|
2223
2219
|
name: c,
|
|
2224
2220
|
array: E,
|
|
2225
2221
|
itemSize: f
|
|
@@ -2288,7 +2284,7 @@ class fn extends cn {
|
|
|
2288
2284
|
), this.decoderPending;
|
|
2289
2285
|
}
|
|
2290
2286
|
}
|
|
2291
|
-
class
|
|
2287
|
+
class An {
|
|
2292
2288
|
constructor() {
|
|
2293
2289
|
v(this, "_gltfLoader");
|
|
2294
2290
|
v(this, "_usdzLoader");
|
|
@@ -2298,19 +2294,19 @@ class gn {
|
|
|
2298
2294
|
async _loadFile(e) {
|
|
2299
2295
|
const t = await fetch(e);
|
|
2300
2296
|
if (!t.ok)
|
|
2301
|
-
throw new
|
|
2297
|
+
throw new Te(e, `Failed to fetch file from ${e}`);
|
|
2302
2298
|
try {
|
|
2303
2299
|
return await t.arrayBuffer();
|
|
2304
2300
|
} catch {
|
|
2305
|
-
throw new
|
|
2301
|
+
throw new Te(e, `Failed to fetch file from ${e}`);
|
|
2306
2302
|
}
|
|
2307
2303
|
}
|
|
2308
2304
|
async load(e) {
|
|
2309
2305
|
const t = _t(e);
|
|
2310
2306
|
if (t.length === 0)
|
|
2311
|
-
throw new
|
|
2307
|
+
throw new ye("No file extension found in URI", "");
|
|
2312
2308
|
if (!wt(t))
|
|
2313
|
-
throw new
|
|
2309
|
+
throw new ye(
|
|
2314
2310
|
`Unsupported file type: ${t}. Supported types: ${Et.join(", ")}`,
|
|
2315
2311
|
t
|
|
2316
2312
|
);
|
|
@@ -2327,13 +2323,13 @@ class gn {
|
|
|
2327
2323
|
return await this._usdzLoader.parse(o);
|
|
2328
2324
|
}
|
|
2329
2325
|
} catch (n) {
|
|
2330
|
-
throw n instanceof Error ? new
|
|
2326
|
+
throw n instanceof Error ? new Re(
|
|
2331
2327
|
`Failed to parse ${t} file: ${n.message}`,
|
|
2332
2328
|
n
|
|
2333
|
-
) : new
|
|
2329
|
+
) : new Re(`Failed to parse ${t} file`);
|
|
2334
2330
|
}
|
|
2335
2331
|
}
|
|
2336
2332
|
}
|
|
2337
2333
|
export {
|
|
2338
|
-
|
|
2334
|
+
An as AssetLoader
|
|
2339
2335
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../chunks/index-
|
|
1
|
+
"use strict";var a=Object.defineProperty;var d=(r,e,s)=>e in r?a(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var o=(r,e,s)=>d(r,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../chunks/index-MNP0K5dt.cjs");class n{static getSystem(){if(typeof window>"u"||!window.navigator)return t.ESystem.UNKNOWN;const e=window.navigator.userAgent.toLowerCase();return e.includes("iphone")||e.includes("ipad")?t.ESystem.IOS:e.includes("android")?t.ESystem.ANDROID:e.includes("windows")?t.ESystem.WINDOWS:e.includes("macintosh")?t.ESystem.MACOS:e.includes("linux")?t.ESystem.LINUX:t.ESystem.UNKNOWN}static async getSupportsWebXR(){if(this._supportsWebXR!==!1)return this._supportsWebXR;if(!window.isSecureContext)return this._supportsWebXR=!1,this._webXRUnsupportedReason=t.EWebXRUnsupportedReason.NO_HTTPS,this._supportsWebXR;if(!navigator.xr)return this._supportsWebXR=!1,this._webXRUnsupportedReason=t.EWebXRUnsupportedReason.NO_WEBXR_API,this._supportsWebXR;try{const e=await navigator.xr.isSessionSupported("immersive-ar");this._supportsWebXR=e,this._supportsWebXR||(this._webXRUnsupportedReason=t.EWebXRUnsupportedReason.IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE)}catch{this._supportsWebXR=!1,this._webXRUnsupportedReason=t.EWebXRUnsupportedReason.AR_PERMISSION_DENIED}return this._supportsWebXR}static getWebXRUnsupportedReason(){return this._supportsWebXR?(console.log("WebXR is supported."),null):this._webXRUnsupportedReason}static getSupportsARQuickLook(){if(document.createElement("a").relList.supports("ar"))return!0;const s=window.navigator.userAgent,i=window.navigator.platform,u=window.navigator.vendor,p="ARQuickLook is not supported";throw new t.ARCompatibilityError(p,s,i,u)}static getSupportsSceneViewer(){if(typeof window>"u"||!window.navigator)return!1;const e=window.navigator.userAgent.toLowerCase();if(!e.includes("android")||!e.includes("chrome"))return!1;const s=e.match(/chrome\/(\d+)/);return!(!s||parseInt(s[1])<89)}static get isMobile(){return this.getSystem()===t.ESystem.ANDROID||this.getSystem()===t.ESystem.IOS}static get isDesktop(){return!this.isMobile}static getSupportsAR(){return this.getSupportsARQuickLook()||this.getSupportsSceneViewer()}}o(n,"_supportsWebXR",!1),o(n,"_webXRUnsupportedReason",null);exports.SystemInfo=n;
|
|
@@ -1,5 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var d = (r, t, e) => t in r ? c(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var i = (r, t, e) => d(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { E as s, a as o, A as R } from "../../../chunks/index-C7Wx_9uY.mjs";
|
|
5
|
+
class n {
|
|
6
|
+
/**
|
|
7
|
+
* Gets the current system (iOS, Android, Windows, etc.)
|
|
8
|
+
* @returns DIVESystem The current system
|
|
9
|
+
*/
|
|
10
|
+
static getSystem() {
|
|
11
|
+
if (typeof window > "u" || !window.navigator)
|
|
12
|
+
return s.UNKNOWN;
|
|
13
|
+
const t = window.navigator.userAgent.toLowerCase();
|
|
14
|
+
return t.includes("iphone") || t.includes("ipad") ? s.IOS : t.includes("android") ? s.ANDROID : t.includes("windows") ? s.WINDOWS : t.includes("macintosh") ? s.MACOS : t.includes("linux") ? s.LINUX : s.UNKNOWN;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device supports WebXR.
|
|
18
|
+
*/
|
|
19
|
+
static async getSupportsWebXR() {
|
|
20
|
+
if (this._supportsWebXR !== !1)
|
|
21
|
+
return this._supportsWebXR;
|
|
22
|
+
if (!window.isSecureContext)
|
|
23
|
+
return this._supportsWebXR = !1, this._webXRUnsupportedReason = o.NO_HTTPS, this._supportsWebXR;
|
|
24
|
+
if (!navigator.xr)
|
|
25
|
+
return this._supportsWebXR = !1, this._webXRUnsupportedReason = o.NO_WEBXR_API, this._supportsWebXR;
|
|
26
|
+
try {
|
|
27
|
+
const t = await navigator.xr.isSessionSupported("immersive-ar");
|
|
28
|
+
this._supportsWebXR = t, this._supportsWebXR || (this._webXRUnsupportedReason = o.IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE);
|
|
29
|
+
} catch {
|
|
30
|
+
this._supportsWebXR = !1, this._webXRUnsupportedReason = o.AR_PERMISSION_DENIED;
|
|
31
|
+
}
|
|
32
|
+
return this._supportsWebXR;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @returns The reason why WebXR is not supported on the user's device. Returns null if WebXR is supported.
|
|
36
|
+
*/
|
|
37
|
+
static getWebXRUnsupportedReason() {
|
|
38
|
+
return this._supportsWebXR ? (console.log("WebXR is supported."), null) : this._webXRUnsupportedReason;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Checks if ARQuickLook is supported on the current device
|
|
42
|
+
* This checks for:
|
|
43
|
+
* 1. AR support via relList
|
|
44
|
+
*
|
|
45
|
+
* Requirements:
|
|
46
|
+
* - iOS 13.0 or later
|
|
47
|
+
* - Safari browser (ARQuickLook is only supported in Safari)
|
|
48
|
+
* - Device with AR capabilities (iPhone/iPad with LiDAR scanner or ARKit support)
|
|
49
|
+
*
|
|
50
|
+
* Note: ARQuickLook is only available in Safari on iOS. Other browsers
|
|
51
|
+
* (Chrome, Firefox, etc.) do not support ARQuickLook, even on iOS.
|
|
52
|
+
*
|
|
53
|
+
* @returns boolean indicating if ARQuickLook is supported
|
|
54
|
+
* @throws ARCompatibilityError if ARQuickLook is not supported, with detailed browser information
|
|
55
|
+
*/
|
|
56
|
+
static getSupportsARQuickLook() {
|
|
57
|
+
if (document.createElement("a").relList.supports("ar"))
|
|
58
|
+
return !0;
|
|
59
|
+
const e = window.navigator.userAgent, u = window.navigator.platform, a = window.navigator.vendor, p = "ARQuickLook is not supported";
|
|
60
|
+
throw new R(
|
|
61
|
+
p,
|
|
62
|
+
e,
|
|
63
|
+
u,
|
|
64
|
+
a
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Checks if SceneViewer is supported on the current device
|
|
69
|
+
* This checks for:
|
|
70
|
+
* 1. Android device
|
|
71
|
+
* 2. Chrome browser (version 89 or later)
|
|
72
|
+
*
|
|
73
|
+
* Requirements:
|
|
74
|
+
* - Android 7.0 (API level 24) or later
|
|
75
|
+
* - Chrome for Android 89 or later
|
|
76
|
+
*
|
|
77
|
+
* Note: According to Google's documentation, if these requirements are met,
|
|
78
|
+
* SceneViewer will be available. If ARCore is not installed, SceneViewer will
|
|
79
|
+
* fall back to showing the model in 3D.
|
|
80
|
+
*
|
|
81
|
+
* @returns boolean indicating if SceneViewer is supported
|
|
82
|
+
*/
|
|
83
|
+
static getSupportsSceneViewer() {
|
|
84
|
+
if (typeof window > "u" || !window.navigator)
|
|
85
|
+
return !1;
|
|
86
|
+
const t = window.navigator.userAgent.toLowerCase();
|
|
87
|
+
if (!t.includes("android") || !t.includes("chrome"))
|
|
88
|
+
return !1;
|
|
89
|
+
const e = t.match(/chrome\/(\d+)/);
|
|
90
|
+
return !(!e || parseInt(e[1]) < 89);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @returns A boolean indicating whether the user's device is a mobile device.
|
|
94
|
+
*/
|
|
95
|
+
static get isMobile() {
|
|
96
|
+
return this.getSystem() === s.ANDROID || this.getSystem() === s.IOS;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @returns A boolean indicating whether the user's device is a desktop device.
|
|
100
|
+
*/
|
|
101
|
+
static get isDesktop() {
|
|
102
|
+
return !this.isMobile;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @returns A promise that resolves to a boolean indicating whether the user's device is capable of AR.
|
|
106
|
+
*/
|
|
107
|
+
static getSupportsAR() {
|
|
108
|
+
return this.getSupportsARQuickLook() || this.getSupportsSceneViewer();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
i(n, "_supportsWebXR", !1), i(n, "_webXRUnsupportedReason", null);
|
|
3
112
|
export {
|
|
4
|
-
|
|
113
|
+
n as SystemInfo
|
|
5
114
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function i(e){var n;const t=e.split("/").pop()||"";return!t.includes(".")||t.endsWith(".")?"":((n=t.split(".").pop())==null?void 0:n.toLowerCase().split("?")[0])||""}function o(e){return e.toLowerCase()in{glb:!0,gltf:!0,usdz:!0}}const s={glb:{key:"glb",extension:"glb"},gltf:{key:"gltf",extension:"gltf"},usdz:{key:"usdz",extension:"usdz"}},l=Object.values(s).map(e=>e.extension);exports.FILE_TYPES=s;exports.SUPPORTED_FILE_TYPES=l;exports.getFileTypeFromUri=i;exports.isFileTypeSupported=o;
|