@speridlabs/visus 2.4.1 → 2.4.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/dist/react.es.js CHANGED
@@ -1,9 +1,9 @@
1
- var Ye = Object.defineProperty;
2
- var $e = (n, e, t) => e in n ? Ye(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var M = (n, e, t) => $e(n, typeof e != "symbol" ? e + "" : e, t);
4
- import He, { useState as Xe, useRef as Ze, useEffect as Je } from "react";
5
- import * as h from "three";
6
- var we = { exports: {} }, pe = {};
1
+ var Qe = Object.defineProperty;
2
+ var Ke = (a, e, t) => e in a ? Qe(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
+ var w = (a, e, t) => Ke(a, typeof e != "symbol" ? e + "" : e, t);
4
+ import et, { useState as tt, useRef as st, useEffect as rt } from "react";
5
+ import * as u from "three";
6
+ var Se = { exports: {} }, ge = {};
7
7
  /**
8
8
  * @license React
9
9
  * react-jsx-runtime.production.js
@@ -13,29 +13,29 @@ var we = { exports: {} }, pe = {};
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
15
  */
16
- var Pe;
17
- function Qe() {
18
- if (Pe) return pe;
19
- Pe = 1;
20
- var n = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
21
- function t(r, s, a) {
16
+ var Oe;
17
+ function nt() {
18
+ if (Oe) return ge;
19
+ Oe = 1;
20
+ var a = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
21
+ function t(s, r, n) {
22
22
  var o = null;
23
- if (a !== void 0 && (o = "" + a), s.key !== void 0 && (o = "" + s.key), "key" in s) {
24
- a = {};
25
- for (var i in s)
26
- i !== "key" && (a[i] = s[i]);
27
- } else a = s;
28
- return s = a.ref, {
29
- $$typeof: n,
30
- type: r,
23
+ if (n !== void 0 && (o = "" + n), r.key !== void 0 && (o = "" + r.key), "key" in r) {
24
+ n = {};
25
+ for (var c in r)
26
+ c !== "key" && (n[c] = r[c]);
27
+ } else n = r;
28
+ return r = n.ref, {
29
+ $$typeof: a,
30
+ type: s,
31
31
  key: o,
32
- ref: s !== void 0 ? s : null,
33
- props: a
32
+ ref: r !== void 0 ? r : null,
33
+ props: n
34
34
  };
35
35
  }
36
- return pe.Fragment = e, pe.jsx = t, pe.jsxs = t, pe;
36
+ return ge.Fragment = e, ge.jsx = t, ge.jsxs = t, ge;
37
37
  }
38
- var xe = {};
38
+ var ye = {};
39
39
  /**
40
40
  * @license React
41
41
  * react-jsx-runtime.development.js
@@ -45,251 +45,251 @@ var xe = {};
45
45
  * This source code is licensed under the MIT license found in the
46
46
  * LICENSE file in the root directory of this source tree.
47
47
  */
48
- var Be;
49
- function Ke() {
50
- return Be || (Be = 1, process.env.NODE_ENV !== "production" && function() {
51
- function n(c) {
52
- if (c == null) return null;
53
- if (typeof c == "function")
54
- return c.$$typeof === p ? null : c.displayName || c.name || null;
55
- if (typeof c == "string") return c;
56
- switch (c) {
57
- case v:
48
+ var Ue;
49
+ function at() {
50
+ return Ue || (Ue = 1, process.env.NODE_ENV !== "production" && function() {
51
+ function a(i) {
52
+ if (i == null) return null;
53
+ if (typeof i == "function")
54
+ return i.$$typeof === y ? null : i.displayName || i.name || null;
55
+ if (typeof i == "string") return i;
56
+ switch (i) {
57
+ case C:
58
58
  return "Fragment";
59
- case E:
59
+ case B:
60
60
  return "Profiler";
61
- case b:
61
+ case k:
62
62
  return "StrictMode";
63
- case L:
63
+ case W:
64
64
  return "Suspense";
65
- case A:
65
+ case T:
66
66
  return "SuspenseList";
67
- case w:
67
+ case E:
68
68
  return "Activity";
69
69
  }
70
- if (typeof c == "object")
71
- switch (typeof c.tag == "number" && console.error(
70
+ if (typeof i == "object")
71
+ switch (typeof i.tag == "number" && console.error(
72
72
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
73
- ), c.$$typeof) {
74
- case g:
73
+ ), i.$$typeof) {
74
+ case v:
75
75
  return "Portal";
76
- case P:
77
- return (c.displayName || "Context") + ".Provider";
78
- case T:
79
- return (c._context.displayName || "Context") + ".Consumer";
80
- case H:
81
- var k = c.render;
82
- return c = c.displayName, c || (c = k.displayName || k.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c;
83
- case C:
84
- return k = c.displayName || null, k !== null ? k : n(c.type) || "Memo";
85
- case _:
86
- k = c._payload, c = c._init;
76
+ case F:
77
+ return (i.displayName || "Context") + ".Provider";
78
+ case U:
79
+ return (i._context.displayName || "Context") + ".Consumer";
80
+ case N:
81
+ var A = i.render;
82
+ return i = i.displayName, i || (i = A.displayName || A.name || "", i = i !== "" ? "ForwardRef(" + i + ")" : "ForwardRef"), i;
83
+ case S:
84
+ return A = i.displayName || null, A !== null ? A : a(i.type) || "Memo";
85
+ case z:
86
+ A = i._payload, i = i._init;
87
87
  try {
88
- return n(c(k));
88
+ return a(i(A));
89
89
  } catch {
90
90
  }
91
91
  }
92
92
  return null;
93
93
  }
94
- function e(c) {
95
- return "" + c;
94
+ function e(i) {
95
+ return "" + i;
96
96
  }
97
- function t(c) {
97
+ function t(i) {
98
98
  try {
99
- e(c);
100
- var k = !1;
99
+ e(i);
100
+ var A = !1;
101
101
  } catch {
102
- k = !0;
102
+ A = !0;
103
103
  }
104
- if (k) {
105
- k = console;
106
- var B = k.error, F = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
107
- return B.call(
108
- k,
104
+ if (A) {
105
+ A = console;
106
+ var q = A.error, O = typeof Symbol == "function" && Symbol.toStringTag && i[Symbol.toStringTag] || i.constructor.name || "Object";
107
+ return q.call(
108
+ A,
109
109
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
110
- F
111
- ), e(c);
110
+ O
111
+ ), e(i);
112
112
  }
113
113
  }
114
- function r(c) {
115
- if (c === v) return "<>";
116
- if (typeof c == "object" && c !== null && c.$$typeof === _)
114
+ function s(i) {
115
+ if (i === C) return "<>";
116
+ if (typeof i == "object" && i !== null && i.$$typeof === z)
117
117
  return "<...>";
118
118
  try {
119
- var k = n(c);
120
- return k ? "<" + k + ">" : "<...>";
119
+ var A = a(i);
120
+ return A ? "<" + A + ">" : "<...>";
121
121
  } catch {
122
122
  return "<...>";
123
123
  }
124
124
  }
125
- function s() {
126
- var c = R.A;
127
- return c === null ? null : c.getOwner();
125
+ function r() {
126
+ var i = b.A;
127
+ return i === null ? null : i.getOwner();
128
128
  }
129
- function a() {
129
+ function n() {
130
130
  return Error("react-stack-top-frame");
131
131
  }
132
- function o(c) {
133
- if (q.call(c, "key")) {
134
- var k = Object.getOwnPropertyDescriptor(c, "key").get;
135
- if (k && k.isReactWarning) return !1;
132
+ function o(i) {
133
+ if (j.call(i, "key")) {
134
+ var A = Object.getOwnPropertyDescriptor(i, "key").get;
135
+ if (A && A.isReactWarning) return !1;
136
136
  }
137
- return c.key !== void 0;
137
+ return i.key !== void 0;
138
138
  }
139
- function i(c, k) {
140
- function B() {
141
- V || (V = !0, console.error(
139
+ function c(i, A) {
140
+ function q() {
141
+ D || (D = !0, console.error(
142
142
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
143
- k
143
+ A
144
144
  ));
145
145
  }
146
- B.isReactWarning = !0, Object.defineProperty(c, "key", {
147
- get: B,
146
+ q.isReactWarning = !0, Object.defineProperty(i, "key", {
147
+ get: q,
148
148
  configurable: !0
149
149
  });
150
150
  }
151
151
  function m() {
152
- var c = n(this.type);
153
- return D[c] || (D[c] = !0, console.error(
152
+ var i = a(this.type);
153
+ return x[i] || (x[i] = !0, console.error(
154
154
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
155
- )), c = this.props.ref, c !== void 0 ? c : null;
155
+ )), i = this.props.ref, i !== void 0 ? i : null;
156
156
  }
157
- function f(c, k, B, F, I, d, z, W) {
158
- return B = d.ref, c = {
159
- $$typeof: x,
160
- type: c,
161
- key: k,
157
+ function g(i, A, q, O, R, d, P, G) {
158
+ return q = d.ref, i = {
159
+ $$typeof: p,
160
+ type: i,
161
+ key: A,
162
162
  props: d,
163
- _owner: I
164
- }, (B !== void 0 ? B : null) !== null ? Object.defineProperty(c, "ref", {
163
+ _owner: R
164
+ }, (q !== void 0 ? q : null) !== null ? Object.defineProperty(i, "ref", {
165
165
  enumerable: !1,
166
166
  get: m
167
- }) : Object.defineProperty(c, "ref", { enumerable: !1, value: null }), c._store = {}, Object.defineProperty(c._store, "validated", {
167
+ }) : Object.defineProperty(i, "ref", { enumerable: !1, value: null }), i._store = {}, Object.defineProperty(i._store, "validated", {
168
168
  configurable: !1,
169
169
  enumerable: !1,
170
170
  writable: !0,
171
171
  value: 0
172
- }), Object.defineProperty(c, "_debugInfo", {
172
+ }), Object.defineProperty(i, "_debugInfo", {
173
173
  configurable: !1,
174
174
  enumerable: !1,
175
175
  writable: !0,
176
176
  value: null
177
- }), Object.defineProperty(c, "_debugStack", {
177
+ }), Object.defineProperty(i, "_debugStack", {
178
178
  configurable: !1,
179
179
  enumerable: !1,
180
180
  writable: !0,
181
- value: z
182
- }), Object.defineProperty(c, "_debugTask", {
181
+ value: P
182
+ }), Object.defineProperty(i, "_debugTask", {
183
183
  configurable: !1,
184
184
  enumerable: !1,
185
185
  writable: !0,
186
- value: W
187
- }), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
186
+ value: G
187
+ }), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
188
188
  }
189
- function y(c, k, B, F, I, d, z, W) {
190
- var S = k.children;
191
- if (S !== void 0)
192
- if (F)
193
- if (j(S)) {
194
- for (F = 0; F < S.length; F++)
195
- l(S[F]);
196
- Object.freeze && Object.freeze(S);
189
+ function f(i, A, q, O, R, d, P, G) {
190
+ var M = A.children;
191
+ if (M !== void 0)
192
+ if (O)
193
+ if (L(M)) {
194
+ for (O = 0; O < M.length; O++)
195
+ l(M[O]);
196
+ Object.freeze && Object.freeze(M);
197
197
  } else
198
198
  console.error(
199
199
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
200
200
  );
201
- else l(S);
202
- if (q.call(k, "key")) {
203
- S = n(c);
204
- var U = Object.keys(k).filter(function(X) {
205
- return X !== "key";
201
+ else l(M);
202
+ if (j.call(A, "key")) {
203
+ M = a(i);
204
+ var V = Object.keys(A).filter(function(Z) {
205
+ return Z !== "key";
206
206
  });
207
- F = 0 < U.length ? "{key: someKey, " + U.join(": ..., ") + ": ...}" : "{key: someKey}", N[S + F] || (U = 0 < U.length ? "{" + U.join(": ..., ") + ": ...}" : "{}", console.error(
207
+ O = 0 < V.length ? "{key: someKey, " + V.join(": ..., ") + ": ...}" : "{key: someKey}", $[M + O] || (V = 0 < V.length ? "{" + V.join(": ..., ") + ": ...}" : "{}", console.error(
208
208
  `A props object containing a "key" prop is being spread into JSX:
209
209
  let props = %s;
210
210
  <%s {...props} />
211
211
  React keys must be passed directly to JSX without using spread:
212
212
  let props = %s;
213
213
  <%s key={someKey} {...props} />`,
214
- F,
215
- S,
216
- U,
217
- S
218
- ), N[S + F] = !0);
214
+ O,
215
+ M,
216
+ V,
217
+ M
218
+ ), $[M + O] = !0);
219
219
  }
220
- if (S = null, B !== void 0 && (t(B), S = "" + B), o(k) && (t(k.key), S = "" + k.key), "key" in k) {
221
- B = {};
222
- for (var $ in k)
223
- $ !== "key" && (B[$] = k[$]);
224
- } else B = k;
225
- return S && i(
226
- B,
227
- typeof c == "function" ? c.displayName || c.name || "Unknown" : c
228
- ), f(
229
- c,
230
- S,
220
+ if (M = null, q !== void 0 && (t(q), M = "" + q), o(A) && (t(A.key), M = "" + A.key), "key" in A) {
221
+ q = {};
222
+ for (var H in A)
223
+ H !== "key" && (q[H] = A[H]);
224
+ } else q = A;
225
+ return M && c(
226
+ q,
227
+ typeof i == "function" ? i.displayName || i.name || "Unknown" : i
228
+ ), g(
229
+ i,
230
+ M,
231
231
  d,
232
- I,
233
- s(),
234
- B,
235
- z,
236
- W
232
+ R,
233
+ r(),
234
+ q,
235
+ P,
236
+ G
237
237
  );
238
238
  }
239
- function l(c) {
240
- typeof c == "object" && c !== null && c.$$typeof === x && c._store && (c._store.validated = 1);
239
+ function l(i) {
240
+ typeof i == "object" && i !== null && i.$$typeof === p && i._store && (i._store.validated = 1);
241
241
  }
242
- var u = He, x = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), T = Symbol.for("react.consumer"), P = Symbol.for("react.context"), H = Symbol.for("react.forward_ref"), L = Symbol.for("react.suspense"), A = Symbol.for("react.suspense_list"), C = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), w = Symbol.for("react.activity"), p = Symbol.for("react.client.reference"), R = u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, q = Object.prototype.hasOwnProperty, j = Array.isArray, Y = console.createTask ? console.createTask : function() {
242
+ var h = et, p = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), C = Symbol.for("react.fragment"), k = Symbol.for("react.strict_mode"), B = Symbol.for("react.profiler"), U = Symbol.for("react.consumer"), F = Symbol.for("react.context"), N = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), z = Symbol.for("react.lazy"), E = Symbol.for("react.activity"), y = Symbol.for("react.client.reference"), b = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, L = Array.isArray, I = console.createTask ? console.createTask : function() {
243
243
  return null;
244
244
  };
245
- u = {
246
- "react-stack-bottom-frame": function(c) {
247
- return c();
245
+ h = {
246
+ "react-stack-bottom-frame": function(i) {
247
+ return i();
248
248
  }
249
249
  };
250
- var V, D = {}, O = u["react-stack-bottom-frame"].bind(
251
- u,
252
- a
253
- )(), J = Y(r(a)), N = {};
254
- xe.Fragment = v, xe.jsx = function(c, k, B, F, I) {
255
- var d = 1e4 > R.recentlyCreatedOwnerStacks++;
256
- return y(
257
- c,
258
- k,
259
- B,
250
+ var D, x = {}, _ = h["react-stack-bottom-frame"].bind(
251
+ h,
252
+ n
253
+ )(), X = I(s(n)), $ = {};
254
+ ye.Fragment = C, ye.jsx = function(i, A, q, O, R) {
255
+ var d = 1e4 > b.recentlyCreatedOwnerStacks++;
256
+ return f(
257
+ i,
258
+ A,
259
+ q,
260
260
  !1,
261
- F,
262
- I,
263
- d ? Error("react-stack-top-frame") : O,
264
- d ? Y(r(c)) : J
261
+ O,
262
+ R,
263
+ d ? Error("react-stack-top-frame") : _,
264
+ d ? I(s(i)) : X
265
265
  );
266
- }, xe.jsxs = function(c, k, B, F, I) {
267
- var d = 1e4 > R.recentlyCreatedOwnerStacks++;
268
- return y(
269
- c,
270
- k,
271
- B,
266
+ }, ye.jsxs = function(i, A, q, O, R) {
267
+ var d = 1e4 > b.recentlyCreatedOwnerStacks++;
268
+ return f(
269
+ i,
270
+ A,
271
+ q,
272
272
  !0,
273
- F,
274
- I,
275
- d ? Error("react-stack-top-frame") : O,
276
- d ? Y(r(c)) : J
273
+ O,
274
+ R,
275
+ d ? Error("react-stack-top-frame") : _,
276
+ d ? I(s(i)) : X
277
277
  );
278
278
  };
279
- }()), xe;
279
+ }()), ye;
280
280
  }
281
- var De;
282
- function et() {
283
- return De || (De = 1, process.env.NODE_ENV === "production" ? we.exports = Qe() : we.exports = Ke()), we.exports;
281
+ var Ve;
282
+ function ot() {
283
+ return Ve || (Ve = 1, process.env.NODE_ENV === "production" ? Se.exports = nt() : Se.exports = at()), Se.exports;
284
284
  }
285
- var tt = et();
285
+ var it = ot();
286
286
  class be {
287
287
  constructor() {
288
- M(this, "min", new h.Vector3(1 / 0, 1 / 0, 1 / 0));
289
- M(this, "max", new h.Vector3(-1 / 0, -1 / 0, -1 / 0));
290
- M(this, "center", new h.Vector3());
288
+ w(this, "min", new u.Vector3(1 / 0, 1 / 0, 1 / 0));
289
+ w(this, "max", new u.Vector3(-1 / 0, -1 / 0, -1 / 0));
290
+ w(this, "center", new u.Vector3());
291
291
  /** Half extents (size/2) */
292
- M(this, "halfExtents", new h.Vector3());
292
+ w(this, "halfExtents", new u.Vector3());
293
293
  }
294
294
  /**
295
295
  * Reset the bounding box to its initial state
@@ -330,7 +330,7 @@ class be {
330
330
  * @returns THREE.Box3 representation
331
331
  */
332
332
  toBox3() {
333
- return new h.Box3().set(this.min, this.max);
333
+ return new u.Box3().set(this.min, this.max);
334
334
  }
335
335
  /**
336
336
  * Create a clone of this bounding box
@@ -341,15 +341,15 @@ class be {
341
341
  return e.min.copy(this.min), e.max.copy(this.max), e.center.copy(this.center), e.halfExtents.copy(this.halfExtents), e;
342
342
  }
343
343
  }
344
- class rt {
344
+ class ct {
345
345
  constructor(e = 0) {
346
- M(this, "numSplats", 0);
347
- M(this, "positions");
348
- M(this, "rotations");
349
- M(this, "scales");
350
- M(this, "colors");
351
- M(this, "opacities");
352
- M(this, "boundingBox", new be());
346
+ w(this, "numSplats", 0);
347
+ w(this, "positions");
348
+ w(this, "rotations");
349
+ w(this, "scales");
350
+ w(this, "colors");
351
+ w(this, "opacities");
352
+ w(this, "boundingBox", new be());
353
353
  this.numSplats = e, this.allocateBuffers(e);
354
354
  }
355
355
  allocateBuffers(e) {
@@ -364,13 +364,13 @@ class rt {
364
364
  * @param color Color
365
365
  * @param opacity Opacity value
366
366
  */
367
- setSplat(e, t, r, s, a, o) {
367
+ setSplat(e, t, s, r, n, o) {
368
368
  if (e >= this.numSplats)
369
369
  throw new Error(
370
370
  `Splat index out of bounds: ${e} >= ${this.numSplats}`
371
371
  );
372
- const i = e * 3, m = e * 4, f = e * 3, y = e * 3;
373
- this.positions[i] = t.x, this.positions[i + 1] = t.y, this.positions[i + 2] = t.z, this.rotations[m] = r.x, this.rotations[m + 1] = r.y, this.rotations[m + 2] = r.z, this.rotations[m + 3] = r.w, this.scales[f] = s.x, this.scales[f + 1] = s.y, this.scales[f + 2] = s.z, this.colors[y] = a.r, this.colors[y + 1] = a.g, this.colors[y + 2] = a.b, this.opacities[e] = o;
372
+ const c = e * 3, m = e * 4, g = e * 3, f = e * 3;
373
+ this.positions[c] = t.x, this.positions[c + 1] = t.y, this.positions[c + 2] = t.z, this.rotations[m] = s.x, this.rotations[m + 1] = s.y, this.rotations[m + 2] = s.z, this.rotations[m + 3] = s.w, this.scales[g] = r.x, this.scales[g + 1] = r.y, this.scales[g + 2] = r.z, this.colors[f] = n.r, this.colors[f + 1] = n.g, this.colors[f + 2] = n.b, this.opacities[e] = o;
374
374
  }
375
375
  /**
376
376
  * Get a splat's data
@@ -382,29 +382,29 @@ class rt {
382
382
  throw new Error(
383
383
  `Splat index out of bounds: ${e} >= ${this.numSplats}`
384
384
  );
385
- const t = e * 3, r = e * 4, s = e * 3, a = e * 3;
385
+ const t = e * 3, s = e * 4, r = e * 3, n = e * 3;
386
386
  return {
387
- position: new h.Vector3(
387
+ position: new u.Vector3(
388
388
  this.positions[t],
389
389
  this.positions[t + 1],
390
390
  this.positions[t + 2]
391
391
  ),
392
- rotation: new h.Quaternion(
393
- this.rotations[r],
394
- this.rotations[r + 1],
395
- this.rotations[r + 2],
396
- this.rotations[r + 3]
392
+ rotation: new u.Quaternion(
393
+ this.rotations[s],
394
+ this.rotations[s + 1],
395
+ this.rotations[s + 2],
396
+ this.rotations[s + 3]
397
397
  ),
398
398
  // Convert log scale back to linear scale for external use
399
- scale: new h.Vector3(
400
- Math.exp(this.scales[s]),
401
- Math.exp(this.scales[s + 1]),
402
- Math.exp(this.scales[s + 2])
399
+ scale: new u.Vector3(
400
+ Math.exp(this.scales[r]),
401
+ Math.exp(this.scales[r + 1]),
402
+ Math.exp(this.scales[r + 2])
403
403
  ),
404
- color: new h.Color(
405
- this.colors[a],
406
- this.colors[a + 1],
407
- this.colors[a + 2]
404
+ color: new u.Color(
405
+ this.colors[n],
406
+ this.colors[n + 1],
407
+ this.colors[n + 2]
408
408
  ),
409
409
  opacity: this.opacities[e]
410
410
  };
@@ -415,13 +415,13 @@ class rt {
415
415
  */
416
416
  calculateBoundingBox() {
417
417
  this.boundingBox.reset();
418
- const e = new h.Vector3();
418
+ const e = new u.Vector3();
419
419
  for (let t = 0; t < this.numSplats; t++) {
420
- const r = t * 3;
420
+ const s = t * 3;
421
421
  e.set(
422
- this.positions[r],
423
- this.positions[r + 1],
424
- this.positions[r + 2]
422
+ this.positions[s],
423
+ this.positions[s + 1],
424
+ this.positions[s + 2]
425
425
  ), this.boundingBox.expandByPoint(e);
426
426
  }
427
427
  return this.boundingBox;
@@ -431,97 +431,134 @@ class rt {
431
431
  * This is for visualization/debugging purposes only, not for rendering
432
432
  */
433
433
  createDebugGeometry() {
434
- const e = new h.BufferGeometry();
434
+ const e = new u.BufferGeometry();
435
435
  e.setAttribute(
436
436
  "position",
437
- new h.BufferAttribute(this.positions, 3)
437
+ new u.BufferAttribute(this.positions, 3)
438
438
  );
439
- const t = new Float32Array(this.numSplats * 3), r = new h.Quaternion(), s = new h.Euler();
440
- for (let a = 0; a < this.numSplats; a++) {
441
- const o = a * 4, i = a * 3;
442
- r.set(
439
+ const t = new Float32Array(this.numSplats * 3), s = new u.Quaternion(), r = new u.Euler();
440
+ for (let n = 0; n < this.numSplats; n++) {
441
+ const o = n * 4, c = n * 3;
442
+ s.set(
443
443
  this.rotations[o],
444
444
  this.rotations[o + 1],
445
445
  this.rotations[o + 2],
446
446
  this.rotations[o + 3]
447
- ), s.setFromQuaternion(r), t[i] = s.x, t[i + 1] = s.y, t[i + 2] = s.z;
447
+ ), r.setFromQuaternion(s), t[c] = r.x, t[c + 1] = r.y, t[c + 2] = r.z;
448
448
  }
449
449
  return e.setAttribute(
450
450
  "rotation",
451
- new h.BufferAttribute(t, 3)
451
+ new u.BufferAttribute(t, 3)
452
452
  ), e.setAttribute(
453
453
  "scale",
454
- new h.BufferAttribute(this.scales, 3)
454
+ new u.BufferAttribute(this.scales, 3)
455
455
  ), e.setAttribute(
456
456
  "color",
457
- new h.BufferAttribute(this.colors, 3)
457
+ new u.BufferAttribute(this.colors, 3)
458
458
  ), e.setAttribute(
459
459
  "opacity",
460
- new h.BufferAttribute(this.opacities, 1)
460
+ new u.BufferAttribute(this.opacities, 1)
461
461
  ), e;
462
462
  }
463
463
  dispose() {
464
464
  this.numSplats = 0, this.scales = new Float32Array(0), this.colors = new Float32Array(0), this.positions = new Float32Array(0), this.rotations = new Float32Array(0), this.opacities = new Float32Array(0);
465
465
  }
466
466
  }
467
- class Fe {
467
+ class Le {
468
468
  // Upper 8 bits of 16-bit means
469
- constructor(e, t, r) {
470
- M(this, "ranges");
471
- M(this, "numSplats", 0);
472
- M(this, "boundingBox", new be());
469
+ constructor(e, t, s) {
470
+ w(this, "ranges");
471
+ w(this, "version", 1);
472
+ w(this, "numSplats", 0);
473
+ w(this, "boundingBox", new be());
473
474
  // Original SOGS textures
474
- M(this, "sh0");
475
+ w(this, "sh0");
475
476
  // SH DC coefficients + alpha
476
- M(this, "quats");
477
+ w(this, "quats");
477
478
  // Quaternion components + mode
478
- M(this, "scales");
479
+ w(this, "scales");
479
480
  // Scale values (8-bit)
480
- M(this, "means_l");
481
+ w(this, "means_l");
481
482
  // Lower 8 bits of 16-bit means
482
- M(this, "means_u");
483
- this.ranges = t, this.numSplats = e, this.sh0 = r.sh0, this.quats = r.quats, this.scales = r.scales, this.means_l = r.means_l, this.means_u = r.means_u, this.boundingBox = this.calculateBoundingBox();
483
+ w(this, "means_u");
484
+ this.ranges = t, this.numSplats = e, this.sh0 = s.sh0, this.quats = s.quats, this.scales = s.scales, this.means_l = s.means_l, this.means_u = s.means_u, this.boundingBox = this.calculateBoundingBox();
484
485
  }
485
486
  calculateBoundingBox() {
486
487
  this.boundingBox.reset();
487
- const { mins: e, maxs: t } = this.ranges.means, r = (s) => Math.sign(s) * (Math.exp(Math.abs(s)) - 1);
488
+ const { mins: e, maxs: t } = this.ranges.means, s = (r) => Math.sign(r) * (Math.exp(Math.abs(r)) - 1);
488
489
  return this.boundingBox.center.set(
489
- (r(e[0]) + r(t[0])) * 0.5,
490
- (r(e[1]) + r(t[1])) * 0.5,
491
- (r(e[2]) + r(t[2])) * 0.5
490
+ (s(e[0]) + s(t[0])) * 0.5,
491
+ (s(e[1]) + s(t[1])) * 0.5,
492
+ (s(e[2]) + s(t[2])) * 0.5
492
493
  ), this.boundingBox.halfExtents.set(
493
- (r(t[0]) - r(e[0])) * 0.5,
494
- (r(t[1]) - r(e[1])) * 0.5,
495
- (r(t[2]) - r(e[2])) * 0.5
494
+ (s(t[0]) - s(e[0])) * 0.5,
495
+ (s(t[1]) - s(e[1])) * 0.5,
496
+ (s(t[2]) - s(e[2])) * 0.5
496
497
  ), this.boundingBox;
497
498
  }
498
499
  dispose() {
499
500
  this.sh0.dispose(), this.quats.dispose(), this.scales.dispose(), this.means_l.dispose(), this.means_u.dispose();
500
501
  }
501
502
  }
502
- class qe {
503
+ class We {
504
+ // Upper 8 bits of 16-bit means
505
+ constructor(e, t, s) {
506
+ w(this, "ranges");
507
+ w(this, "version", 2);
508
+ w(this, "numSplats", 0);
509
+ w(this, "boundingBox", new be());
510
+ // Original SOGS textures
511
+ w(this, "sh0");
512
+ // SH DC coefficients + alpha
513
+ w(this, "quats");
514
+ // Quaternion components + mode
515
+ w(this, "scales");
516
+ // Scale values (8-bit)
517
+ w(this, "means_l");
518
+ // Lower 8 bits of 16-bit means
519
+ w(this, "means_u");
520
+ this.ranges = t, this.numSplats = e, this.sh0 = s.sh0, this.quats = s.quats, this.scales = s.scales, this.means_l = s.means_l, this.means_u = s.means_u, this.boundingBox = this.calculateBoundingBox();
521
+ }
522
+ calculateBoundingBox() {
523
+ this.boundingBox.reset();
524
+ const { mins: e, maxs: t } = this.ranges.means, s = (r) => Math.sign(r) * (Math.exp(Math.abs(r)) - 1);
525
+ return this.boundingBox.center.set(
526
+ (s(e[0]) + s(t[0])) * 0.5,
527
+ (s(e[1]) + s(t[1])) * 0.5,
528
+ (s(e[2]) + s(t[2])) * 0.5
529
+ ), this.boundingBox.halfExtents.set(
530
+ (s(t[0]) - s(e[0])) * 0.5,
531
+ (s(t[1]) - s(e[1])) * 0.5,
532
+ (s(t[2]) - s(e[2])) * 0.5
533
+ ), this.boundingBox;
534
+ }
535
+ dispose() {
536
+ this.sh0.dispose(), this.quats.dispose(), this.scales.dispose(), this.means_l.dispose(), this.means_u.dispose();
537
+ }
538
+ }
539
+ class Ie {
503
540
  // RGBA32UI - (Position + Rotation + Scale)
504
541
  // RGBA32UI Texture Content:
505
542
  // .r = Means Lower (RGB)
506
543
  // .g = Means Upper (RGB)
507
544
  // .b = Rotation (RGBA)
508
545
  // .a = Scale (RGB)
509
- constructor(e, t, r, s, a, o, i, m) {
546
+ constructor(e, t, s, r, n, o, c, m) {
510
547
  // Info data - cpu
511
- M(this, "numSplats");
512
- M(this, "textureWidth");
513
- M(this, "textureHeight");
514
- M(this, "ranges");
515
- M(this, "centers");
548
+ w(this, "numSplats");
549
+ w(this, "textureWidth");
550
+ w(this, "textureHeight");
551
+ w(this, "ranges");
552
+ w(this, "centers");
516
553
  // TODO: see if necesary or can be compressed somehow
517
- M(this, "boundingBox");
554
+ w(this, "boundingBox");
518
555
  // GPU Textures
519
- M(this, "packedColor");
556
+ w(this, "packedColor");
520
557
  // RGBA8 - (Color + Opacity)
521
558
  // RGBA8 Texture Content:
522
559
  // .rgb = Color, .a = Opacity
523
- M(this, "packedGeometry");
524
- this.numSplats = e, this.textureWidth = t, this.textureHeight = r, this.boundingBox = m, this.ranges = i, this.centers = s, this.packedColor = o, this.packedGeometry = a;
560
+ w(this, "packedGeometry");
561
+ this.numSplats = e, this.textureWidth = t, this.textureHeight = s, this.boundingBox = m, this.ranges = c, this.centers = r, this.packedColor = o, this.packedGeometry = n;
525
562
  }
526
563
  /**
527
564
  * Optional: Reconstruct a full JS object for a specific splat.
@@ -536,31 +573,31 @@ class qe {
536
573
  // public abstract deserialize(): ISplat;
537
574
  // public abstract returnPacked(): ISplat;
538
575
  }
539
- const me = 0.28209479177387814;
540
- class Ce {
576
+ const de = 0.28209479177387814;
577
+ class we {
541
578
  /**
542
579
  * Packs PLY data (Float32) into the Unified SOGS-like Format.
543
580
  */
544
581
  // prettier-ignore
545
582
  static packPly(e) {
546
- const t = e.numSplats, r = Math.ceil(Math.sqrt(t)), s = Math.ceil(t / r), a = r * s, { ranges: o, colorScale: i } = this.calculatePlyRanges(e), m = new Uint32Array(a * 4), f = new Uint8Array(a * 4), y = new h.Quaternion();
583
+ const t = e.numSplats, s = Math.ceil(Math.sqrt(t)), r = Math.ceil(t / s), n = s * r, { ranges: o, colorScale: c } = this.calculatePlyRanges(e), m = new Uint32Array(n * 4), g = new Uint8Array(n * 4), f = new u.Quaternion();
547
584
  for (let l = 0; l < t; l++) {
548
- const u = l * 4, x = l * 3, g = l * 4, v = e.positions[x + 0], b = e.positions[x + 1], E = e.positions[x + 2], T = this.clamp01(this.norm(v, o.means.min.x, o.means.max.x)), P = this.clamp01(this.norm(b, o.means.min.y, o.means.max.y)), H = this.clamp01(this.norm(E, o.means.min.z, o.means.max.z)), L = T * 65535 | 0, A = P * 65535 | 0, C = H * 65535 | 0;
549
- m[u + 0] = this.pack4Bytes(L & 255, A & 255, C & 255, 0), m[u + 1] = this.pack4Bytes(L >> 8, A >> 8, C >> 8, 0), y.set(e.rotations[g], e.rotations[g + 1], e.rotations[g + 2], e.rotations[g + 3]).normalize();
550
- let _ = y.w, w = y.x, p = y.y, R = y.z;
551
- const q = Math.abs(_), j = Math.abs(w), Y = Math.abs(p), V = Math.abs(R);
552
- let D = 0, O = q;
553
- j > O && (O = j, D = 1), Y > O && (O = Y, D = 2), V > O && (O = V, D = 3), (D === 0 ? _ : D === 1 ? w : D === 2 ? p : R) < 0 && (_ = -_, w = -w, p = -p, R = -R);
554
- let N = 0, c = 0, k = 0;
555
- D === 0 && (N = w, c = p, k = R), D === 1 && (N = _, c = p, k = R), D === 2 && (N = _, c = w, k = R), D === 3 && (N = _, c = w, k = p);
556
- const B = (se) => Math.min(255, Math.max(0, Math.round((0.5 + se / Math.SQRT2) * 255)));
557
- m[u + 2] = this.pack4Bytes(B(N), B(c), B(k), D);
558
- const F = this.norm(e.scales[x + 0], o.scales.min.x, o.scales.max.x), I = this.norm(e.scales[x + 1], o.scales.min.y, o.scales.max.y), d = this.norm(e.scales[x + 2], o.scales.min.z, o.scales.max.z);
559
- m[u + 3] = this.pack4Bytes(Math.floor(F * 255), Math.floor(I * 255), Math.floor(d * 255), 0);
560
- const z = this.clamp01(e.colors[x + 0] * i), W = this.clamp01(e.colors[x + 1] * i), S = this.clamp01(e.colors[x + 2] * i), U = (z - 0.5) / me, $ = (W - 0.5) / me, X = (S - 0.5) / me, Q = this.clamp01(this.norm(U, o.sh0.min.x, o.sh0.max.x)), Z = this.clamp01(this.norm($, o.sh0.min.y, o.sh0.max.y)), K = this.clamp01(this.norm(X, o.sh0.min.z, o.sh0.max.z)), re = this.clamp01(e.opacities[l]);
561
- f[u + 0] = Math.round(Q * 255), f[u + 1] = Math.round(Z * 255), f[u + 2] = Math.round(K * 255), f[u + 3] = Math.round(re * 255);
585
+ const h = l * 4, p = l * 3, v = l * 4, C = e.positions[p + 0], k = e.positions[p + 1], B = e.positions[p + 2], U = this.clamp01(this.norm(C, o.means.min.x, o.means.max.x)), F = this.clamp01(this.norm(k, o.means.min.y, o.means.max.y)), N = this.clamp01(this.norm(B, o.means.min.z, o.means.max.z)), W = U * 65535 | 0, T = F * 65535 | 0, S = N * 65535 | 0;
586
+ m[h + 0] = this.pack4Bytes(W & 255, T & 255, S & 255, 0), m[h + 1] = this.pack4Bytes(W >> 8, T >> 8, S >> 8, 0), f.set(e.rotations[v], e.rotations[v + 1], e.rotations[v + 2], e.rotations[v + 3]).normalize();
587
+ let z = f.w, E = f.x, y = f.y, b = f.z;
588
+ const j = Math.abs(z), L = Math.abs(E), I = Math.abs(y), D = Math.abs(b);
589
+ let x = 0, _ = j;
590
+ L > _ && (_ = L, x = 1), I > _ && (_ = I, x = 2), D > _ && (_ = D, x = 3), (x === 0 ? z : x === 1 ? E : x === 2 ? y : b) < 0 && (z = -z, E = -E, y = -y, b = -b);
591
+ let $ = 0, i = 0, A = 0;
592
+ x === 0 && ($ = E, i = y, A = b), x === 1 && ($ = z, i = y, A = b), x === 2 && ($ = z, i = E, A = b), x === 3 && ($ = z, i = E, A = y);
593
+ const q = (te) => Math.min(255, Math.max(0, Math.round((0.5 + te / Math.SQRT2) * 255)));
594
+ m[h + 2] = this.pack4Bytes(q($), q(i), q(A), x);
595
+ const O = this.norm(e.scales[p + 0], o.scales.min.x, o.scales.max.x), R = this.norm(e.scales[p + 1], o.scales.min.y, o.scales.max.y), d = this.norm(e.scales[p + 2], o.scales.min.z, o.scales.max.z);
596
+ m[h + 3] = this.pack4Bytes(Math.floor(O * 255), Math.floor(R * 255), Math.floor(d * 255), 0);
597
+ const P = this.clamp01(e.colors[p + 0] * c), G = this.clamp01(e.colors[p + 1] * c), M = this.clamp01(e.colors[p + 2] * c), V = (P - 0.5) / de, H = (G - 0.5) / de, Z = (M - 0.5) / de, Q = this.clamp01(this.norm(V, o.sh0.min.x, o.sh0.max.x)), J = this.clamp01(this.norm(H, o.sh0.min.y, o.sh0.max.y)), K = this.clamp01(this.norm(Z, o.sh0.min.z, o.sh0.max.z)), ee = this.clamp01(e.opacities[l]);
598
+ g[h + 0] = Math.round(Q * 255), g[h + 1] = Math.round(J * 255), g[h + 2] = Math.round(K * 255), g[h + 3] = Math.round(ee * 255);
562
599
  }
563
- return new qe(t, r, s, e.positions, m, f, o, e.boundingBox);
600
+ return new Ie(t, s, r, e.positions, m, g, o, e.boundingBox);
564
601
  }
565
602
  /**
566
603
  * Packs SOGS data.
@@ -569,46 +606,122 @@ class Ce {
569
606
  */
570
607
  // prettier-ignore
571
608
  static packSogs(e) {
572
- const t = e.numSplats, r = Math.ceil(Math.sqrt(t)), s = Math.ceil(t / r), a = r * s, o = this.convertSogsRanges(e.ranges), i = e.ranges.means.mins[0], m = e.ranges.means.mins[1], f = e.ranges.means.mins[2], y = e.ranges.means.maxs[0], l = e.ranges.means.maxs[1], u = e.ranges.means.maxs[2], x = (w) => Math.sign(w) * (Math.exp(Math.abs(w)) - 1), g = new h.Vector3(
573
- x(i),
574
- x(m),
575
- x(f)
576
- ), v = new h.Vector3(
577
- x(y),
578
- x(l),
579
- x(u)
609
+ var y, b, j;
610
+ const t = e.numSplats;
611
+ let s = Math.ceil(Math.sqrt(t)), r = Math.ceil(t / s);
612
+ const n = ((y = e.means_l) == null ? void 0 : y.image) ?? ((b = e.sh0) == null ? void 0 : b.image) ?? ((j = e.quats) == null ? void 0 : j.image);
613
+ n && typeof n.width == "number" && typeof n.height == "number" && (s = n.width, r = n.height);
614
+ const o = s * r;
615
+ if (o < t) throw new Error(`SOG v1 texture too small: ${s}x${r}=${o} < count=${t}`);
616
+ const c = this.convertSogsRanges(e.ranges), m = e.ranges.means.mins[0], g = e.ranges.means.mins[1], f = e.ranges.means.mins[2], l = e.ranges.means.maxs[0], h = e.ranges.means.maxs[1], p = e.ranges.means.maxs[2], v = (L) => Math.sign(L) * (Math.exp(Math.abs(L)) - 1), C = new u.Vector3(
617
+ v(m),
618
+ v(g),
619
+ v(f)
620
+ ), k = new u.Vector3(
621
+ v(l),
622
+ v(h),
623
+ v(p)
580
624
  );
581
- o.means.min.copy(g), o.means.max.copy(v);
582
- const b = e, E = this.getPixels(b.means_l), T = this.getPixels(b.means_u), P = this.getPixels(b.quats), H = this.getPixels(b.scales), L = this.getPixels(b.sh0), A = new Uint32Array(a * 4), C = new Uint8Array(a * 4), _ = new Float32Array(t * 3);
583
- for (let w = 0; w < t; w++) {
584
- const p = w * 4, R = T[p + 0], q = E[p + 0], j = T[p + 1], Y = E[p + 1], V = T[p + 2], D = E[p + 2], O = (R << 8 | q) / 65535, J = (j << 8 | Y) / 65535, N = (V << 8 | D) / 65535, c = this.sogsDecode(O, i, y), k = this.sogsDecode(J, m, l), B = this.sogsDecode(N, f, u);
585
- _[w * 3 + 0] = c, _[w * 3 + 1] = k, _[w * 3 + 2] = B;
586
- const F = this.clamp01(this.norm(c, g.x, v.x)) * 65535 | 0, I = this.clamp01(this.norm(k, g.y, v.y)) * 65535 | 0, d = this.clamp01(this.norm(B, g.z, v.z)) * 65535 | 0;
587
- A[p + 0] = this.pack4Bytes(F & 255, I & 255, d & 255, 0), A[p + 1] = this.pack4Bytes(F >> 8, I >> 8, d >> 8, 0), A[p + 3] = this.pack4Bytes(H[p], H[p + 1], H[p + 2], 0);
588
- const W = P[p + 3] - 252;
589
- A[p + 2] = this.pack4Bytes(P[p + 0], P[p + 1], P[p + 2], W), C[p + 0] = L[p], C[p + 1] = L[p + 1], C[p + 2] = L[p + 2];
590
- const S = L[p + 3] / 255, U = e.ranges.sh0.mins[3] + (e.ranges.sh0.maxs[3] - e.ranges.sh0.mins[3]) * S, $ = 1 / (1 + Math.exp(-U));
591
- C[p + 3] = Math.round(Math.max(0, Math.min(1, $)) * 255);
625
+ c.means.min.copy(C), c.means.max.copy(k);
626
+ const B = e, U = this.getPixels(B.means_l), F = this.getPixels(B.means_u), N = this.getPixels(B.quats), W = this.getPixels(B.scales), T = this.getPixels(B.sh0), S = new Uint32Array(o * 4), z = new Uint8Array(o * 4), E = new Float32Array(t * 3);
627
+ for (let L = 0; L < t; L++) {
628
+ const I = L * 4, D = F[I + 0], x = U[I + 0], _ = F[I + 1], X = U[I + 1], $ = F[I + 2], i = U[I + 2], A = (D << 8 | x) / 65535, q = (_ << 8 | X) / 65535, O = ($ << 8 | i) / 65535, R = this.sogsDecode(A, m, l), d = this.sogsDecode(q, g, h), P = this.sogsDecode(O, f, p);
629
+ E[L * 3 + 0] = R, E[L * 3 + 1] = d, E[L * 3 + 2] = P;
630
+ const G = this.clamp01(this.norm(R, C.x, k.x)) * 65535 | 0, M = this.clamp01(this.norm(d, C.y, k.y)) * 65535 | 0, V = this.clamp01(this.norm(P, C.z, k.z)) * 65535 | 0;
631
+ S[I + 0] = this.pack4Bytes(G & 255, M & 255, V & 255, 0), S[I + 1] = this.pack4Bytes(G >> 8, M >> 8, V >> 8, 0), S[I + 3] = this.pack4Bytes(W[I], W[I + 1], W[I + 2], 0);
632
+ const Z = N[I + 3] - 252;
633
+ S[I + 2] = this.pack4Bytes(N[I + 0], N[I + 1], N[I + 2], Z), z[I + 0] = T[I], z[I + 1] = T[I + 1], z[I + 2] = T[I + 2];
634
+ const Q = T[I + 3] / 255, J = e.ranges.sh0.mins[3] + (e.ranges.sh0.maxs[3] - e.ranges.sh0.mins[3]) * Q, K = 1 / (1 + Math.exp(-J));
635
+ z[I + 3] = Math.round(Math.max(0, Math.min(1, K)) * 255);
636
+ }
637
+ return new Ie(t, s, r, E, S, z, c, e.boundingBox);
638
+ }
639
+ /**
640
+ * Packs SOG V2 data.
641
+ */
642
+ static packSog2(e) {
643
+ var j, L, I;
644
+ const t = e.numSplats;
645
+ let s = Math.ceil(Math.sqrt(t)), r = Math.ceil(t / s);
646
+ const n = ((j = e.means_l) == null ? void 0 : j.image) ?? ((L = e.sh0) == null ? void 0 : L.image) ?? ((I = e.quats) == null ? void 0 : I.image);
647
+ n && typeof n.width == "number" && typeof n.height == "number" && (s = n.width, r = n.height);
648
+ const o = s * r;
649
+ if (o < t) throw new Error(`SOG v2 texture too small: ${s}x${r}=${o} < count=${t}`);
650
+ const c = e.ranges.means.mins[0], m = e.ranges.means.mins[1], g = e.ranges.means.mins[2], f = e.ranges.means.maxs[0], l = e.ranges.means.maxs[1], h = e.ranges.means.maxs[2], p = (D) => Math.sign(D) * (Math.exp(Math.abs(D)) - 1), v = new u.Vector3(
651
+ p(c),
652
+ p(m),
653
+ p(g)
654
+ ), C = new u.Vector3(
655
+ p(f),
656
+ p(l),
657
+ p(h)
658
+ ), k = (D) => {
659
+ let x = 1 / 0, _ = -1 / 0;
660
+ for (const i of D)
661
+ Number.isFinite(i) && (x = Math.min(x, i), _ = Math.max(_, i));
662
+ (!Number.isFinite(x) || !Number.isFinite(_)) && (x = 0, _ = 1);
663
+ const X = _ - x || 1, $ = new Uint8Array(256);
664
+ for (let i = 0; i < 256; i++) {
665
+ const q = ((i < D.length && Number.isFinite(D[i]) ? D[i] : x + (_ - x) * (i / 255)) - x) / X, O = Math.max(0, Math.min(255, Math.round(q * 255)));
666
+ $[i] = O;
667
+ }
668
+ return { cbMin: x, cbMax: _, lut: $ };
669
+ }, B = k(e.ranges.scales.codebook), U = k(e.ranges.sh0.codebook), F = {
670
+ means: { min: v.clone(), max: C.clone() },
671
+ scales: {
672
+ min: new u.Vector3(
673
+ B.cbMin,
674
+ B.cbMin,
675
+ B.cbMin
676
+ ),
677
+ max: new u.Vector3(
678
+ B.cbMax,
679
+ B.cbMax,
680
+ B.cbMax
681
+ )
682
+ },
683
+ sh0: {
684
+ min: new u.Vector3(
685
+ U.cbMin,
686
+ U.cbMin,
687
+ U.cbMin
688
+ ),
689
+ max: new u.Vector3(
690
+ U.cbMax,
691
+ U.cbMax,
692
+ U.cbMax
693
+ )
694
+ }
695
+ }, N = this.getPixels(e.means_l), W = this.getPixels(e.means_u), T = this.getPixels(e.quats), S = this.getPixels(e.scales), z = this.getPixels(e.sh0), E = new Uint32Array(o * 4), y = new Uint8Array(o * 4), b = new Float32Array(t * 3);
696
+ for (let D = 0; D < t; D++) {
697
+ const x = D * 4, _ = W[x + 0], X = N[x + 0], $ = W[x + 1], i = N[x + 1], A = W[x + 2], q = N[x + 2], O = (_ << 8 | X) / 65535, R = ($ << 8 | i) / 65535, d = (A << 8 | q) / 65535, P = this.sogsDecode(O, c, f), G = this.sogsDecode(R, m, l), M = this.sogsDecode(d, g, h);
698
+ b[D * 3 + 0] = P, b[D * 3 + 1] = G, b[D * 3 + 2] = M;
699
+ const V = this.clamp01(this.norm(P, v.x, C.x)) * 65535 | 0, H = this.clamp01(this.norm(G, v.y, C.y)) * 65535 | 0, Z = this.clamp01(this.norm(M, v.z, C.z)) * 65535 | 0;
700
+ E[x + 0] = this.pack4Bytes(V & 255, H & 255, Z & 255, 0), E[x + 1] = this.pack4Bytes(V >> 8, H >> 8, Z >> 8, 0);
701
+ const J = T[x + 3] - 252 & 3;
702
+ E[x + 2] = this.pack4Bytes(T[x + 0], T[x + 1], T[x + 2], J);
703
+ const K = B.lut[S[x + 0]], ee = B.lut[S[x + 1]], te = B.lut[S[x + 2]];
704
+ E[x + 3] = this.pack4Bytes(K, ee, te, 0), y[x + 0] = U.lut[z[x + 0]], y[x + 1] = U.lut[z[x + 1]], y[x + 2] = U.lut[z[x + 2]], y[x + 3] = z[x + 3];
592
705
  }
593
- return new qe(t, r, s, _, A, C, o, e.boundingBox);
706
+ return new Ie(t, s, r, b, E, y, F, e.boundingBox);
594
707
  }
595
708
  // --- Helpers ---
596
709
  // prettier-ignore
597
- static pack4Bytes(e, t, r, s) {
598
- return (e & 255) << 24 | (t & 255) << 16 | (r & 255) << 8 | s & 255;
710
+ static pack4Bytes(e, t, s, r) {
711
+ return (e & 255) << 24 | (t & 255) << 16 | (s & 255) << 8 | r & 255;
599
712
  }
600
713
  // prettier-ignore
601
714
  static getPixels(e) {
602
- const t = e.image, r = t.width, s = t.height;
715
+ const t = e.image, s = t.width, r = t.height;
603
716
  if (t.data && (t.data instanceof Uint8Array || t.data instanceof Uint8ClampedArray)) return new Uint8Array(t.data);
604
- const a = document.createElement("canvas");
605
- a.width = r, a.height = s;
606
- const o = a.getContext("2d", { willReadFrequently: !0 });
717
+ const n = document.createElement("canvas");
718
+ n.width = s, n.height = r;
719
+ const o = n.getContext("2d", { willReadFrequently: !0 });
607
720
  if (!o) throw new Error("Canvas init failed");
608
- return o.drawImage(t, 0, 0), new Uint8Array(o.getImageData(0, 0, r, s).data);
721
+ return o.drawImage(t, 0, 0), new Uint8Array(o.getImageData(0, 0, s, r).data);
609
722
  }
610
723
  static convertSogsRanges(e) {
611
- const t = (r) => new h.Vector3(r[0], r[1], r[2]);
724
+ const t = (s) => new u.Vector3(s[0], s[1], s[2]);
612
725
  return {
613
726
  sh0: { min: t(e.sh0.mins), max: t(e.sh0.maxs) },
614
727
  means: { min: t(e.means.mins), max: t(e.means.maxs) },
@@ -616,28 +729,28 @@ class Ce {
616
729
  };
617
730
  }
618
731
  static calculatePlyRanges(e) {
619
- const t = new h.Vector3(1 / 0, 1 / 0, 1 / 0), r = new h.Vector3(-1 / 0, -1 / 0, -1 / 0), s = new h.Vector3(1 / 0, 1 / 0, 1 / 0), a = new h.Vector3(-1 / 0, -1 / 0, -1 / 0), o = new h.Vector3(1 / 0, 1 / 0, 1 / 0), i = new h.Vector3(-1 / 0, -1 / 0, -1 / 0);
732
+ const t = new u.Vector3(1 / 0, 1 / 0, 1 / 0), s = new u.Vector3(-1 / 0, -1 / 0, -1 / 0), r = new u.Vector3(1 / 0, 1 / 0, 1 / 0), n = new u.Vector3(-1 / 0, -1 / 0, -1 / 0), o = new u.Vector3(1 / 0, 1 / 0, 1 / 0), c = new u.Vector3(-1 / 0, -1 / 0, -1 / 0);
620
733
  let m = 0;
621
- for (let y = 0; y < e.numSplats; y++) {
622
- const l = y * 3, u = e.positions[l + 0], x = e.positions[l + 1], g = e.positions[l + 2];
623
- t.x = Math.min(t.x, u), r.x = Math.max(r.x, u), t.y = Math.min(t.y, x), r.y = Math.max(r.y, x), t.z = Math.min(t.z, g), r.z = Math.max(r.z, g), s.x = Math.min(s.x, e.scales[l]), a.x = Math.max(a.x, e.scales[l]), s.y = Math.min(s.y, e.scales[l + 1]), a.y = Math.max(a.y, e.scales[l + 1]), s.z = Math.min(s.z, e.scales[l + 2]), a.z = Math.max(a.z, e.scales[l + 2]), m = Math.max(
734
+ for (let f = 0; f < e.numSplats; f++) {
735
+ const l = f * 3, h = e.positions[l + 0], p = e.positions[l + 1], v = e.positions[l + 2];
736
+ t.x = Math.min(t.x, h), s.x = Math.max(s.x, h), t.y = Math.min(t.y, p), s.y = Math.max(s.y, p), t.z = Math.min(t.z, v), s.z = Math.max(s.z, v), r.x = Math.min(r.x, e.scales[l]), n.x = Math.max(n.x, e.scales[l]), r.y = Math.min(r.y, e.scales[l + 1]), n.y = Math.max(n.y, e.scales[l + 1]), r.z = Math.min(r.z, e.scales[l + 2]), n.z = Math.max(n.z, e.scales[l + 2]), m = Math.max(
624
737
  m,
625
738
  e.colors[l],
626
739
  e.colors[l + 1],
627
740
  e.colors[l + 2]
628
741
  );
629
742
  }
630
- const f = m > 1.5 ? 1 / 255 : 1;
631
- for (let y = 0; y < e.numSplats; y++) {
632
- const l = y * 3, u = this.clamp01(e.colors[l + 0] * f), x = this.clamp01(e.colors[l + 1] * f), g = this.clamp01(e.colors[l + 2] * f), v = (u - 0.5) / me, b = (x - 0.5) / me, E = (g - 0.5) / me;
633
- o.x = Math.min(o.x, v), i.x = Math.max(i.x, v), o.y = Math.min(o.y, b), i.y = Math.max(i.y, b), o.z = Math.min(o.z, E), i.z = Math.max(i.z, E);
743
+ const g = m > 1.5 ? 1 / 255 : 1;
744
+ for (let f = 0; f < e.numSplats; f++) {
745
+ const l = f * 3, h = this.clamp01(e.colors[l + 0] * g), p = this.clamp01(e.colors[l + 1] * g), v = this.clamp01(e.colors[l + 2] * g), C = (h - 0.5) / de, k = (p - 0.5) / de, B = (v - 0.5) / de;
746
+ o.x = Math.min(o.x, C), c.x = Math.max(c.x, C), o.y = Math.min(o.y, k), c.y = Math.max(c.y, k), o.z = Math.min(o.z, B), c.z = Math.max(c.z, B);
634
747
  }
635
748
  return {
636
- colorScale: f,
749
+ colorScale: g,
637
750
  ranges: {
638
- sh0: { min: o, max: i },
639
- means: { min: t, max: r },
640
- scales: { min: s, max: a }
751
+ sh0: { min: o, max: c },
752
+ means: { min: t, max: s },
753
+ scales: { min: r, max: n }
641
754
  }
642
755
  };
643
756
  }
@@ -647,49 +760,49 @@ class Ce {
647
760
  // prettier-ignore
648
761
  // private static lerp(a: number, b: number, t: number) { return a + (b - a) * t; } // prettier-ignore
649
762
  // private static invSogsMap(v: number) { return Math.sign(v) * Math.log(Math.abs(v) + 1) } // prettier-ignore
650
- static norm(e, t, r) {
651
- return (e - t) / (r - t || 1);
763
+ static norm(e, t, s) {
764
+ return (e - t) / (s - t || 1);
652
765
  }
653
766
  // prettier-ignore
654
- static sogsDecode(e, t, r) {
655
- const s = t + (r - t) * e;
656
- return Math.sign(s) * (Math.exp(Math.abs(s)) - 1);
767
+ static sogsDecode(e, t, s) {
768
+ const r = t + (s - t) * e;
769
+ return Math.sign(r) * (Math.exp(Math.abs(r)) - 1);
657
770
  }
658
771
  }
659
- class st extends h.Loader {
660
- constructor(t) {
772
+ class lt extends u.Loader {
773
+ constructor(t, s) {
661
774
  super(t);
662
- M(this, "requestId", 0);
663
- M(this, "worker");
664
- M(this, "pendingCallbacks", /* @__PURE__ */ new Map());
665
- this.withCredentials = !0;
666
- const r = this.createWorkerCode(), s = new Blob([r], { type: "application/javascript" });
667
- this.worker = new Worker(URL.createObjectURL(s)), this.worker.onmessage = this.onWorkerMessage.bind(this);
775
+ w(this, "requestId", 0);
776
+ w(this, "worker");
777
+ w(this, "pendingCallbacks", /* @__PURE__ */ new Map());
778
+ this.withCredentials = (s == null ? void 0 : s.withCredentials) ?? !1;
779
+ const r = this.createWorkerCode(), n = new Blob([r], { type: "application/javascript" });
780
+ this.worker = new Worker(URL.createObjectURL(n)), this.worker.onmessage = this.onWorkerMessage.bind(this);
668
781
  }
669
782
  /**
670
783
  * Handles messages received from the parsing worker
671
784
  * @param event The message event from the worker
672
785
  */
673
786
  onWorkerMessage(t) {
674
- const { requestId: r, error: s, result: a } = t.data, o = this.pendingCallbacks.get(r);
675
- if (!o) return console.warn(`PlyLoader: Received response for unknown request ${r}`);
676
- if (this.pendingCallbacks.delete(r), s) return o.reject(new Error(s));
677
- if (!a) return o.reject(new Error("Worker returned no result"));
787
+ const { requestId: s, error: r, result: n } = t.data, o = this.pendingCallbacks.get(s);
788
+ if (!o) return console.warn(`PlyLoader: Received response for unknown request ${s}`);
789
+ if (this.pendingCallbacks.delete(s), r) return o.reject(new Error(r));
790
+ if (!n) return o.reject(new Error("Worker returned no result"));
678
791
  try {
679
- const i = new rt(0);
680
- i.numSplats = a.numSplats, i.positions = new Float32Array(a.positions), i.rotations = new Float32Array(a.rotations), i.scales = new Float32Array(a.scales), i.colors = new Float32Array(a.colors), i.opacities = new Float32Array(a.opacities), i.boundingBox.min.set(
681
- a.boundingBox.minX,
682
- a.boundingBox.minY,
683
- a.boundingBox.minZ
684
- ), i.boundingBox.max.set(
685
- a.boundingBox.maxX,
686
- a.boundingBox.maxY,
687
- a.boundingBox.maxZ
792
+ const c = new ct(0);
793
+ c.numSplats = n.numSplats, c.positions = new Float32Array(n.positions), c.rotations = new Float32Array(n.rotations), c.scales = new Float32Array(n.scales), c.colors = new Float32Array(n.colors), c.opacities = new Float32Array(n.opacities), c.boundingBox.min.set(
794
+ n.boundingBox.minX,
795
+ n.boundingBox.minY,
796
+ n.boundingBox.minZ
797
+ ), c.boundingBox.max.set(
798
+ n.boundingBox.maxX,
799
+ n.boundingBox.maxY,
800
+ n.boundingBox.maxZ
688
801
  ), this.worker.terminate();
689
- const m = Ce.packPly(i);
690
- i.dispose(), o.resolve(m);
691
- } catch (i) {
692
- o.reject(i);
802
+ const m = we.packPly(c);
803
+ c.dispose(), o.resolve(m);
804
+ } catch (c) {
805
+ o.reject(c);
693
806
  }
694
807
  }
695
808
  /**
@@ -699,19 +812,19 @@ class st extends h.Loader {
699
812
  * @param onProgress Optional progress callback
700
813
  * @param onError Optional error callback
701
814
  */
702
- load(t, r, s, a) {
703
- const o = new h.FileLoader(this.manager);
815
+ load(t, s, r, n) {
816
+ const o = new u.FileLoader(this.manager);
704
817
  o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(this.withCredentials), o.load(
705
818
  t,
706
- (i) => {
707
- this.parseAsync(i).then((m) => {
708
- r && r(m);
819
+ (c) => {
820
+ this.parseAsync(c).then((m) => {
821
+ s && s(m);
709
822
  }).catch((m) => {
710
- a ? a(m) : console.error(m), this.manager.itemError(t);
823
+ n ? n(m) : console.error(m), this.manager.itemError(t);
711
824
  });
712
825
  },
713
- s,
714
- a
826
+ r,
827
+ n
715
828
  );
716
829
  }
717
830
  /**
@@ -720,19 +833,19 @@ class st extends h.Loader {
720
833
  * @param onProgress Optional progress callback
721
834
  * @returns A Promise that resolves with the parsed SplatData
722
835
  */
723
- loadAsync(t, r) {
724
- return new Promise((s, a) => {
725
- const o = new h.FileLoader(this.manager);
836
+ loadAsync(t, s) {
837
+ return new Promise((r, n) => {
838
+ const o = new u.FileLoader(this.manager);
726
839
  o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(this.withCredentials), o.load(
727
840
  t,
728
- (i) => {
729
- this.parseAsync(i).then(s).catch((m) => {
730
- a(m), this.manager.itemError(t);
841
+ (c) => {
842
+ this.parseAsync(c).then(r).catch((m) => {
843
+ n(m), this.manager.itemError(t);
731
844
  });
732
845
  },
733
- r,
734
- (i) => {
735
- a(i), this.manager.itemError(t);
846
+ s,
847
+ (c) => {
848
+ n(c), this.manager.itemError(t);
736
849
  }
737
850
  );
738
851
  });
@@ -743,11 +856,11 @@ class st extends h.Loader {
743
856
  * @returns Promise that resolves with parsed SplatData
744
857
  */
745
858
  parseAsync(t) {
746
- return new Promise((r, s) => {
747
- const a = this.requestId++;
748
- this.pendingCallbacks.set(a, { resolve: r, reject: s });
859
+ return new Promise((s, r) => {
860
+ const n = this.requestId++;
861
+ this.pendingCallbacks.set(n, { resolve: s, reject: r });
749
862
  const o = {
750
- requestId: a,
863
+ requestId: n,
751
864
  buffer: t
752
865
  };
753
866
  this.worker.postMessage(o, [t]);
@@ -765,203 +878,203 @@ class st extends h.Loader {
765
878
  */
766
879
  createWorkerCode() {
767
880
  return `(${(function() {
768
- self.onmessage = (s) => {
769
- const { requestId: a, buffer: o } = s.data;
881
+ self.onmessage = (r) => {
882
+ const { requestId: n, buffer: o } = r.data;
770
883
  try {
771
- const i = r(o), m = {
772
- requestId: a,
773
- result: i
884
+ const c = s(o), m = {
885
+ requestId: n,
886
+ result: c
774
887
  };
775
888
  self.postMessage(m, [
776
- i.positions,
777
- i.rotations,
778
- i.scales,
779
- i.colors,
780
- i.opacities
889
+ c.positions,
890
+ c.rotations,
891
+ c.scales,
892
+ c.colors,
893
+ c.opacities
781
894
  ]);
782
- } catch (i) {
895
+ } catch (c) {
783
896
  const m = {
784
- requestId: a,
785
- error: i instanceof Error ? i.message : String(i)
897
+ requestId: n,
898
+ error: c instanceof Error ? c.message : String(c)
786
899
  };
787
900
  self.postMessage(m);
788
901
  }
789
902
  };
790
- function r(s) {
791
- const a = new TextDecoder(), o = new Uint8Array(s), i = [112, 108, 121, 10], m = `
903
+ function s(r) {
904
+ const n = new TextDecoder(), o = new Uint8Array(r), c = [112, 108, 121, 10], m = `
792
905
  end_header
793
906
  `;
794
- for (let I = 0; I < i.length; I++)
795
- if (o[I] !== i[I])
907
+ for (let R = 0; R < c.length; R++)
908
+ if (o[R] !== c[R])
796
909
  throw new Error(
797
910
  "Invalid PLY file: Missing magic bytes"
798
911
  );
799
- let f = 0;
800
- for (let I = 0; I < o.length - m.length; I++) {
912
+ let g = 0;
913
+ for (let R = 0; R < o.length - m.length; R++) {
801
914
  let d = !0;
802
- for (let z = 0; z < m.length; z++)
803
- if (o[I + z] !== m.charCodeAt(z)) {
915
+ for (let P = 0; P < m.length; P++)
916
+ if (o[R + P] !== m.charCodeAt(P)) {
804
917
  d = !1;
805
918
  break;
806
919
  }
807
920
  if (d) {
808
- f = I + m.length;
921
+ g = R + m.length;
809
922
  break;
810
923
  }
811
924
  }
812
- if (f === 0)
925
+ if (g === 0)
813
926
  throw new Error(
814
927
  "Invalid PLY file: Could not find end of header"
815
928
  );
816
- const l = a.decode(
817
- o.subarray(0, f)
929
+ const l = n.decode(
930
+ o.subarray(0, g)
818
931
  ).split(`
819
- `), u = [];
820
- let x = null;
821
- for (let I = 1; I < l.length; I++) {
822
- const d = l[I].trim();
932
+ `), h = [];
933
+ let p = null;
934
+ for (let R = 1; R < l.length; R++) {
935
+ const d = l[R].trim();
823
936
  if (d === "" || d === "end_header") continue;
824
- const z = d.split(" ");
825
- switch (z[0]) {
937
+ const P = d.split(" ");
938
+ switch (P[0]) {
826
939
  case "format":
827
- x = z[1];
940
+ p = P[1];
828
941
  break;
829
942
  case "element":
830
- u.push({
831
- name: z[1],
832
- count: parseInt(z[2], 10),
943
+ h.push({
944
+ name: P[1],
945
+ count: parseInt(P[2], 10),
833
946
  properties: []
834
947
  });
835
948
  break;
836
949
  case "property":
837
- if (u.length === 0)
950
+ if (h.length === 0)
838
951
  throw new Error(
839
952
  "Invalid PLY file: Property without element"
840
953
  );
841
- u[u.length - 1].properties.push({
842
- type: z[1],
843
- name: z[2]
954
+ h[h.length - 1].properties.push({
955
+ type: P[1],
956
+ name: P[2]
844
957
  });
845
958
  break;
846
959
  }
847
960
  }
848
- if (x !== "binary_little_endian")
849
- throw new Error(`Unsupported PLY format: ${x}`);
850
- const g = u.find((I) => I.name === "vertex");
851
- if (!g)
961
+ if (p !== "binary_little_endian")
962
+ throw new Error(`Unsupported PLY format: ${p}`);
963
+ const v = h.find((R) => R.name === "vertex");
964
+ if (!v)
852
965
  throw new Error(
853
966
  "Invalid PLY file: No vertex element found"
854
967
  );
855
- const v = g.count, b = new Float32Array(v * 3), E = new Float32Array(v * 4), T = new Float32Array(v * 3), P = new Float32Array(v * 3), H = new Float32Array(v), L = new DataView(s);
856
- let A = f;
857
- const C = (I) => g.properties.findIndex(
858
- (d) => d.name === I
859
- ), _ = C("x"), w = C("y"), p = C("z"), R = [
860
- C("rot_0"),
861
- C("rot_1"),
862
- C("rot_2"),
863
- C("rot_3")
864
- ], q = [
865
- C("scale_0"),
866
- C("scale_1"),
867
- C("scale_2")
968
+ const C = v.count, k = new Float32Array(C * 3), B = new Float32Array(C * 4), U = new Float32Array(C * 3), F = new Float32Array(C * 3), N = new Float32Array(C), W = new DataView(r);
969
+ let T = g;
970
+ const S = (R) => v.properties.findIndex(
971
+ (d) => d.name === R
972
+ ), z = S("x"), E = S("y"), y = S("z"), b = [
973
+ S("rot_0"),
974
+ S("rot_1"),
975
+ S("rot_2"),
976
+ S("rot_3")
868
977
  ], j = [
869
- C("f_dc_0"),
870
- C("f_dc_1"),
871
- C("f_dc_2")
872
- ], Y = C("opacity");
978
+ S("scale_0"),
979
+ S("scale_1"),
980
+ S("scale_2")
981
+ ], L = [
982
+ S("f_dc_0"),
983
+ S("f_dc_1"),
984
+ S("f_dc_2")
985
+ ], I = S("opacity");
873
986
  if ([
874
- _,
875
- w,
876
- p,
877
- ...R,
878
- ...q,
987
+ z,
988
+ E,
989
+ y,
990
+ ...b,
879
991
  ...j,
880
- Y
881
- ].some((I) => I === -1))
992
+ ...L,
993
+ I
994
+ ].some((R) => R === -1))
882
995
  throw new Error(
883
996
  "Invalid PLY file: Missing required properties"
884
997
  );
885
- const D = 0.28209479177387814, O = (I) => {
886
- if (I > 0) return 1 / (1 + Math.exp(-I));
887
- const d = Math.exp(I);
998
+ const x = 0.28209479177387814, _ = (R) => {
999
+ if (R > 0) return 1 / (1 + Math.exp(-R));
1000
+ const d = Math.exp(R);
888
1001
  return d / (1 + d);
889
1002
  };
890
- let J = 1 / 0, N = 1 / 0, c = 1 / 0, k = -1 / 0, B = -1 / 0, F = -1 / 0;
891
- for (let I = 0; I < v; I++) {
1003
+ let X = 1 / 0, $ = 1 / 0, i = 1 / 0, A = -1 / 0, q = -1 / 0, O = -1 / 0;
1004
+ for (let R = 0; R < C; R++) {
892
1005
  const d = [];
893
- for (let Se = 0; Se < g.properties.length; Se++) {
894
- const ze = g.properties[Se].type;
1006
+ for (let Ce = 0; Ce < v.properties.length; Ce++) {
1007
+ const Fe = v.properties[Ce].type;
895
1008
  let ce;
896
- switch (ze) {
1009
+ switch (Fe) {
897
1010
  case "char":
898
- ce = L.getInt8(A), A += 1;
1011
+ ce = W.getInt8(T), T += 1;
899
1012
  break;
900
1013
  case "uchar":
901
- ce = L.getUint8(A), A += 1;
1014
+ ce = W.getUint8(T), T += 1;
902
1015
  break;
903
1016
  case "short":
904
- ce = L.getInt16(A, !0), A += 2;
1017
+ ce = W.getInt16(T, !0), T += 2;
905
1018
  break;
906
1019
  case "ushort":
907
- ce = L.getUint16(A, !0), A += 2;
1020
+ ce = W.getUint16(T, !0), T += 2;
908
1021
  break;
909
1022
  case "int":
910
- ce = L.getInt32(A, !0), A += 4;
1023
+ ce = W.getInt32(T, !0), T += 4;
911
1024
  break;
912
1025
  case "uint":
913
- ce = L.getUint32(A, !0), A += 4;
1026
+ ce = W.getUint32(T, !0), T += 4;
914
1027
  break;
915
1028
  case "float":
916
- ce = L.getFloat32(A, !0), A += 4;
1029
+ ce = W.getFloat32(T, !0), T += 4;
917
1030
  break;
918
1031
  case "double":
919
- ce = L.getFloat64(A, !0), A += 8;
1032
+ ce = W.getFloat64(T, !0), T += 8;
920
1033
  break;
921
1034
  default:
922
1035
  throw new Error(
923
- `Unsupported property type: ${ze}`
1036
+ `Unsupported property type: ${Fe}`
924
1037
  );
925
1038
  }
926
1039
  d.push(ce);
927
1040
  }
928
- const z = d[_], W = d[w], S = d[p], U = I * 3;
929
- b[U] = z, b[U + 1] = W, b[U + 2] = S, J = Math.min(J, z), N = Math.min(N, W), c = Math.min(c, S), k = Math.max(k, z), B = Math.max(B, W), F = Math.max(F, S);
930
- let $ = d[R[1]], X = d[R[2]], Q = d[R[3]], Z = d[R[0]];
1041
+ const P = d[z], G = d[E], M = d[y], V = R * 3;
1042
+ k[V] = P, k[V + 1] = G, k[V + 2] = M, X = Math.min(X, P), $ = Math.min($, G), i = Math.min(i, M), A = Math.max(A, P), q = Math.max(q, G), O = Math.max(O, M);
1043
+ let H = d[b[1]], Z = d[b[2]], Q = d[b[3]], J = d[b[0]];
931
1044
  const K = Math.sqrt(
932
- $ * $ + X * X + Q * Q + Z * Z
1045
+ H * H + Z * Z + Q * Q + J * J
933
1046
  );
934
- K > 0 && ($ /= K, X /= K, Q /= K, Z /= K), Z < 0 && ($ = -$, X = -X, Q = -Q, Z = -Z);
935
- const re = I * 4;
936
- E[re] = $, E[re + 1] = X, E[re + 2] = Q, E[re + 3] = Z;
937
- const se = I * 3;
938
- T[se] = d[q[0]], T[se + 1] = d[q[1]], T[se + 2] = d[q[2]];
939
- let ue = 0.5 + d[j[0]] * D, he = 0.5 + d[j[1]] * D, oe = 0.5 + d[j[2]] * D;
940
- ue = Math.max(0, Math.min(1, ue)), he = Math.max(0, Math.min(1, he)), oe = Math.max(0, Math.min(1, oe));
941
- const Me = I * 3;
942
- P[Me] = ue, P[Me + 1] = he, P[Me + 2] = oe, H[I] = O(d[Y]);
1047
+ K > 0 && (H /= K, Z /= K, Q /= K, J /= K), J < 0 && (H = -H, Z = -Z, Q = -Q, J = -J);
1048
+ const ee = R * 4;
1049
+ B[ee] = H, B[ee + 1] = Z, B[ee + 2] = Q, B[ee + 3] = J;
1050
+ const te = R * 3;
1051
+ U[te] = d[j[0]], U[te + 1] = d[j[1]], U[te + 2] = d[j[2]];
1052
+ let me = 0.5 + d[L[0]] * x, fe = 0.5 + d[L[1]] * x, oe = 0.5 + d[L[2]] * x;
1053
+ me = Math.max(0, Math.min(1, me)), fe = Math.max(0, Math.min(1, fe)), oe = Math.max(0, Math.min(1, oe));
1054
+ const Ee = R * 3;
1055
+ F[Ee] = me, F[Ee + 1] = fe, F[Ee + 2] = oe, N[R] = _(d[I]);
943
1056
  }
944
1057
  return {
945
- numSplats: v,
946
- positions: b.buffer,
947
- rotations: E.buffer,
948
- scales: T.buffer,
949
- colors: P.buffer,
950
- opacities: H.buffer,
1058
+ numSplats: C,
1059
+ positions: k.buffer,
1060
+ rotations: B.buffer,
1061
+ scales: U.buffer,
1062
+ colors: F.buffer,
1063
+ opacities: N.buffer,
951
1064
  boundingBox: {
952
- minX: J,
953
- minY: N,
954
- minZ: c,
955
- maxX: k,
956
- maxY: B,
957
- maxZ: F
1065
+ minX: X,
1066
+ minY: $,
1067
+ minZ: i,
1068
+ maxX: A,
1069
+ maxY: q,
1070
+ maxZ: O
958
1071
  }
959
1072
  };
960
1073
  }
961
1074
  }).toString()})();`;
962
1075
  }
963
1076
  }
964
- var ee = Uint8Array, fe = Uint16Array, nt = Int32Array, Ue = new ee([
1077
+ var se = Uint8Array, pe = Uint16Array, ht = Int32Array, Ne = new se([
965
1078
  0,
966
1079
  0,
967
1080
  0,
@@ -996,7 +1109,7 @@ var ee = Uint8Array, fe = Uint16Array, nt = Int32Array, Ue = new ee([
996
1109
  0,
997
1110
  /* impossible */
998
1111
  0
999
- ]), Ve = new ee([
1112
+ ]), $e = new se([
1000
1113
  0,
1001
1114
  0,
1002
1115
  0,
@@ -1030,65 +1143,65 @@ var ee = Uint8Array, fe = Uint16Array, nt = Int32Array, Ue = new ee([
1030
1143
  /* unused */
1031
1144
  0,
1032
1145
  0
1033
- ]), at = new ee([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Le = function(n, e) {
1034
- for (var t = new fe(31), r = 0; r < 31; ++r)
1035
- t[r] = e += 1 << n[r - 1];
1036
- for (var s = new nt(t[30]), r = 1; r < 30; ++r)
1037
- for (var a = t[r]; a < t[r + 1]; ++a)
1038
- s[a] = a - t[r] << 5 | r;
1039
- return { b: t, r: s };
1040
- }, je = Le(Ue, 2), We = je.b, ot = je.r;
1041
- We[28] = 258, ot[258] = 28;
1042
- var it = Le(Ve, 0), ct = it.b, Ie = new fe(32768);
1043
- for (var G = 0; G < 32768; ++G) {
1044
- var le = (G & 43690) >> 1 | (G & 21845) << 1;
1045
- le = (le & 52428) >> 2 | (le & 13107) << 2, le = (le & 61680) >> 4 | (le & 3855) << 4, Ie[G] = ((le & 65280) >> 8 | (le & 255) << 8) >> 1;
1146
+ ]), ut = new se([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Ye = function(a, e) {
1147
+ for (var t = new pe(31), s = 0; s < 31; ++s)
1148
+ t[s] = e += 1 << a[s - 1];
1149
+ for (var r = new ht(t[30]), s = 1; s < 30; ++s)
1150
+ for (var n = t[s]; n < t[s + 1]; ++n)
1151
+ r[n] = n - t[s] << 5 | s;
1152
+ return { b: t, r };
1153
+ }, Xe = Ye(Ne, 2), He = Xe.b, mt = Xe.r;
1154
+ He[28] = 258, mt[258] = 28;
1155
+ var ft = Ye($e, 0), dt = ft.b, Be = new pe(32768);
1156
+ for (var Y = 0; Y < 32768; ++Y) {
1157
+ var le = (Y & 43690) >> 1 | (Y & 21845) << 1;
1158
+ le = (le & 52428) >> 2 | (le & 13107) << 2, le = (le & 61680) >> 4 | (le & 3855) << 4, Be[Y] = ((le & 65280) >> 8 | (le & 255) << 8) >> 1;
1046
1159
  }
1047
- var ye = function(n, e, t) {
1048
- for (var r = n.length, s = 0, a = new fe(e); s < r; ++s)
1049
- n[s] && ++a[n[s] - 1];
1050
- var o = new fe(e);
1051
- for (s = 1; s < e; ++s)
1052
- o[s] = o[s - 1] + a[s - 1] << 1;
1053
- var i;
1160
+ var ve = function(a, e, t) {
1161
+ for (var s = a.length, r = 0, n = new pe(e); r < s; ++r)
1162
+ a[r] && ++n[a[r] - 1];
1163
+ var o = new pe(e);
1164
+ for (r = 1; r < e; ++r)
1165
+ o[r] = o[r - 1] + n[r - 1] << 1;
1166
+ var c;
1054
1167
  if (t) {
1055
- i = new fe(1 << e);
1168
+ c = new pe(1 << e);
1056
1169
  var m = 15 - e;
1057
- for (s = 0; s < r; ++s)
1058
- if (n[s])
1059
- for (var f = s << 4 | n[s], y = e - n[s], l = o[n[s] - 1]++ << y, u = l | (1 << y) - 1; l <= u; ++l)
1060
- i[Ie[l] >> m] = f;
1170
+ for (r = 0; r < s; ++r)
1171
+ if (a[r])
1172
+ for (var g = r << 4 | a[r], f = e - a[r], l = o[a[r] - 1]++ << f, h = l | (1 << f) - 1; l <= h; ++l)
1173
+ c[Be[l] >> m] = g;
1061
1174
  } else
1062
- for (i = new fe(r), s = 0; s < r; ++s)
1063
- n[s] && (i[s] = Ie[o[n[s] - 1]++] >> 15 - n[s]);
1064
- return i;
1065
- }, ge = new ee(288);
1066
- for (var G = 0; G < 144; ++G)
1067
- ge[G] = 8;
1068
- for (var G = 144; G < 256; ++G)
1069
- ge[G] = 9;
1070
- for (var G = 256; G < 280; ++G)
1071
- ge[G] = 7;
1072
- for (var G = 280; G < 288; ++G)
1073
- ge[G] = 8;
1074
- var Ge = new ee(32);
1075
- for (var G = 0; G < 32; ++G)
1076
- Ge[G] = 5;
1077
- var lt = /* @__PURE__ */ ye(ge, 9, 1), ut = /* @__PURE__ */ ye(Ge, 5, 1), Ae = function(n) {
1078
- for (var e = n[0], t = 1; t < n.length; ++t)
1079
- n[t] > e && (e = n[t]);
1175
+ for (c = new pe(s), r = 0; r < s; ++r)
1176
+ a[r] && (c[r] = Be[o[a[r] - 1]++] >> 15 - a[r]);
1177
+ return c;
1178
+ }, Me = new se(288);
1179
+ for (var Y = 0; Y < 144; ++Y)
1180
+ Me[Y] = 8;
1181
+ for (var Y = 144; Y < 256; ++Y)
1182
+ Me[Y] = 9;
1183
+ for (var Y = 256; Y < 280; ++Y)
1184
+ Me[Y] = 7;
1185
+ for (var Y = 280; Y < 288; ++Y)
1186
+ Me[Y] = 8;
1187
+ var Ze = new se(32);
1188
+ for (var Y = 0; Y < 32; ++Y)
1189
+ Ze[Y] = 5;
1190
+ var pt = /* @__PURE__ */ ve(Me, 9, 1), xt = /* @__PURE__ */ ve(Ze, 5, 1), Re = function(a) {
1191
+ for (var e = a[0], t = 1; t < a.length; ++t)
1192
+ a[t] > e && (e = a[t]);
1080
1193
  return e;
1081
- }, ne = function(n, e, t) {
1082
- var r = e / 8 | 0;
1083
- return (n[r] | n[r + 1] << 8) >> (e & 7) & t;
1084
- }, ke = function(n, e) {
1194
+ }, ne = function(a, e, t) {
1195
+ var s = e / 8 | 0;
1196
+ return (a[s] | a[s + 1] << 8) >> (e & 7) & t;
1197
+ }, _e = function(a, e) {
1085
1198
  var t = e / 8 | 0;
1086
- return (n[t] | n[t + 1] << 8 | n[t + 2] << 16) >> (e & 7);
1087
- }, ht = function(n) {
1088
- return (n + 7) / 8 | 0;
1089
- }, _e = function(n, e, t) {
1090
- return (e == null || e < 0) && (e = 0), (t == null || t > n.length) && (t = n.length), new ee(n.subarray(e, t));
1091
- }, mt = [
1199
+ return (a[t] | a[t + 1] << 8 | a[t + 2] << 16) >> (e & 7);
1200
+ }, gt = function(a) {
1201
+ return (a + 7) / 8 | 0;
1202
+ }, qe = function(a, e, t) {
1203
+ return (e == null || e < 0) && (e = 0), (t == null || t > a.length) && (t = a.length), new se(a.subarray(e, t));
1204
+ }, yt = [
1092
1205
  "unexpected EOF",
1093
1206
  "invalid block type",
1094
1207
  "invalid length/literal",
@@ -1104,241 +1217,263 @@ var lt = /* @__PURE__ */ ye(ge, 9, 1), ut = /* @__PURE__ */ ye(Ge, 5, 1), Ae = f
1104
1217
  "stream finishing",
1105
1218
  "invalid zip data"
1106
1219
  // determined by unknown compression method
1107
- ], te = function(n, e, t) {
1108
- var r = new Error(e || mt[n]);
1109
- if (r.code = n, Error.captureStackTrace && Error.captureStackTrace(r, te), !t)
1110
- throw r;
1111
- return r;
1112
- }, ft = function(n, e, t, r) {
1113
- var s = n.length, a = r ? r.length : 0;
1114
- if (!s || e.f && !e.l)
1115
- return t || new ee(0);
1116
- var o = !t, i = o || e.i != 2, m = e.i;
1117
- o && (t = new ee(s * 3));
1118
- var f = function(X) {
1220
+ ], re = function(a, e, t) {
1221
+ var s = new Error(e || yt[a]);
1222
+ if (s.code = a, Error.captureStackTrace && Error.captureStackTrace(s, re), !t)
1223
+ throw s;
1224
+ return s;
1225
+ }, wt = function(a, e, t, s) {
1226
+ var r = a.length, n = s ? s.length : 0;
1227
+ if (!r || e.f && !e.l)
1228
+ return t || new se(0);
1229
+ var o = !t, c = o || e.i != 2, m = e.i;
1230
+ o && (t = new se(r * 3));
1231
+ var g = function(Z) {
1119
1232
  var Q = t.length;
1120
- if (X > Q) {
1121
- var Z = new ee(Math.max(Q * 2, X));
1122
- Z.set(t), t = Z;
1233
+ if (Z > Q) {
1234
+ var J = new se(Math.max(Q * 2, Z));
1235
+ J.set(t), t = J;
1123
1236
  }
1124
- }, y = e.f || 0, l = e.p || 0, u = e.b || 0, x = e.l, g = e.d, v = e.m, b = e.n, E = s * 8;
1237
+ }, f = e.f || 0, l = e.p || 0, h = e.b || 0, p = e.l, v = e.d, C = e.m, k = e.n, B = r * 8;
1125
1238
  do {
1126
- if (!x) {
1127
- y = ne(n, l, 1);
1128
- var T = ne(n, l + 1, 3);
1129
- if (l += 3, T)
1130
- if (T == 1)
1131
- x = lt, g = ut, v = 9, b = 5;
1132
- else if (T == 2) {
1133
- var A = ne(n, l, 31) + 257, C = ne(n, l + 10, 15) + 4, _ = A + ne(n, l + 5, 31) + 1;
1239
+ if (!p) {
1240
+ f = ne(a, l, 1);
1241
+ var U = ne(a, l + 1, 3);
1242
+ if (l += 3, U)
1243
+ if (U == 1)
1244
+ p = pt, v = xt, C = 9, k = 5;
1245
+ else if (U == 2) {
1246
+ var T = ne(a, l, 31) + 257, S = ne(a, l + 10, 15) + 4, z = T + ne(a, l + 5, 31) + 1;
1134
1247
  l += 14;
1135
- for (var w = new ee(_), p = new ee(19), R = 0; R < C; ++R)
1136
- p[at[R]] = ne(n, l + R * 3, 7);
1137
- l += C * 3;
1138
- for (var q = Ae(p), j = (1 << q) - 1, Y = ye(p, q, 1), R = 0; R < _; ) {
1139
- var V = Y[ne(n, l, j)];
1140
- l += V & 15;
1141
- var P = V >> 4;
1142
- if (P < 16)
1143
- w[R++] = P;
1248
+ for (var E = new se(z), y = new se(19), b = 0; b < S; ++b)
1249
+ y[ut[b]] = ne(a, l + b * 3, 7);
1250
+ l += S * 3;
1251
+ for (var j = Re(y), L = (1 << j) - 1, I = ve(y, j, 1), b = 0; b < z; ) {
1252
+ var D = I[ne(a, l, L)];
1253
+ l += D & 15;
1254
+ var F = D >> 4;
1255
+ if (F < 16)
1256
+ E[b++] = F;
1144
1257
  else {
1145
- var D = 0, O = 0;
1146
- for (P == 16 ? (O = 3 + ne(n, l, 3), l += 2, D = w[R - 1]) : P == 17 ? (O = 3 + ne(n, l, 7), l += 3) : P == 18 && (O = 11 + ne(n, l, 127), l += 7); O--; )
1147
- w[R++] = D;
1258
+ var x = 0, _ = 0;
1259
+ for (F == 16 ? (_ = 3 + ne(a, l, 3), l += 2, x = E[b - 1]) : F == 17 ? (_ = 3 + ne(a, l, 7), l += 3) : F == 18 && (_ = 11 + ne(a, l, 127), l += 7); _--; )
1260
+ E[b++] = x;
1148
1261
  }
1149
1262
  }
1150
- var J = w.subarray(0, A), N = w.subarray(A);
1151
- v = Ae(J), b = Ae(N), x = ye(J, v, 1), g = ye(N, b, 1);
1263
+ var X = E.subarray(0, T), $ = E.subarray(T);
1264
+ C = Re(X), k = Re($), p = ve(X, C, 1), v = ve($, k, 1);
1152
1265
  } else
1153
- te(1);
1266
+ re(1);
1154
1267
  else {
1155
- var P = ht(l) + 4, H = n[P - 4] | n[P - 3] << 8, L = P + H;
1156
- if (L > s) {
1157
- m && te(0);
1268
+ var F = gt(l) + 4, N = a[F - 4] | a[F - 3] << 8, W = F + N;
1269
+ if (W > r) {
1270
+ m && re(0);
1158
1271
  break;
1159
1272
  }
1160
- i && f(u + H), t.set(n.subarray(P, L), u), e.b = u += H, e.p = l = L * 8, e.f = y;
1273
+ c && g(h + N), t.set(a.subarray(F, W), h), e.b = h += N, e.p = l = W * 8, e.f = f;
1161
1274
  continue;
1162
1275
  }
1163
- if (l > E) {
1164
- m && te(0);
1276
+ if (l > B) {
1277
+ m && re(0);
1165
1278
  break;
1166
1279
  }
1167
1280
  }
1168
- i && f(u + 131072);
1169
- for (var c = (1 << v) - 1, k = (1 << b) - 1, B = l; ; B = l) {
1170
- var D = x[ke(n, l) & c], F = D >> 4;
1171
- if (l += D & 15, l > E) {
1172
- m && te(0);
1281
+ c && g(h + 131072);
1282
+ for (var i = (1 << C) - 1, A = (1 << k) - 1, q = l; ; q = l) {
1283
+ var x = p[_e(a, l) & i], O = x >> 4;
1284
+ if (l += x & 15, l > B) {
1285
+ m && re(0);
1173
1286
  break;
1174
1287
  }
1175
- if (D || te(2), F < 256)
1176
- t[u++] = F;
1177
- else if (F == 256) {
1178
- B = l, x = null;
1288
+ if (x || re(2), O < 256)
1289
+ t[h++] = O;
1290
+ else if (O == 256) {
1291
+ q = l, p = null;
1179
1292
  break;
1180
1293
  } else {
1181
- var I = F - 254;
1182
- if (F > 264) {
1183
- var R = F - 257, d = Ue[R];
1184
- I = ne(n, l, (1 << d) - 1) + We[R], l += d;
1294
+ var R = O - 254;
1295
+ if (O > 264) {
1296
+ var b = O - 257, d = Ne[b];
1297
+ R = ne(a, l, (1 << d) - 1) + He[b], l += d;
1185
1298
  }
1186
- var z = g[ke(n, l) & k], W = z >> 4;
1187
- z || te(3), l += z & 15;
1188
- var N = ct[W];
1189
- if (W > 3) {
1190
- var d = Ve[W];
1191
- N += ke(n, l) & (1 << d) - 1, l += d;
1299
+ var P = v[_e(a, l) & A], G = P >> 4;
1300
+ P || re(3), l += P & 15;
1301
+ var $ = dt[G];
1302
+ if (G > 3) {
1303
+ var d = $e[G];
1304
+ $ += _e(a, l) & (1 << d) - 1, l += d;
1192
1305
  }
1193
- if (l > E) {
1194
- m && te(0);
1306
+ if (l > B) {
1307
+ m && re(0);
1195
1308
  break;
1196
1309
  }
1197
- i && f(u + 131072);
1198
- var S = u + I;
1199
- if (u < N) {
1200
- var U = a - N, $ = Math.min(N, S);
1201
- for (U + u < 0 && te(3); u < $; ++u)
1202
- t[u] = r[U + u];
1310
+ c && g(h + 131072);
1311
+ var M = h + R;
1312
+ if (h < $) {
1313
+ var V = n - $, H = Math.min($, M);
1314
+ for (V + h < 0 && re(3); h < H; ++h)
1315
+ t[h] = s[V + h];
1203
1316
  }
1204
- for (; u < S; ++u)
1205
- t[u] = t[u - N];
1317
+ for (; h < M; ++h)
1318
+ t[h] = t[h - $];
1206
1319
  }
1207
1320
  }
1208
- e.l = x, e.p = B, e.b = u, e.f = y, x && (y = 1, e.m = v, e.d = g, e.n = b);
1209
- } while (!y);
1210
- return u != t.length && o ? _e(t, 0, u) : t.subarray(0, u);
1211
- }, dt = /* @__PURE__ */ new ee(0), ie = function(n, e) {
1212
- return n[e] | n[e + 1] << 8;
1213
- }, ae = function(n, e) {
1214
- return (n[e] | n[e + 1] << 8 | n[e + 2] << 16 | n[e + 3] << 24) >>> 0;
1215
- }, Ee = function(n, e) {
1216
- return ae(n, e) + ae(n, e + 4) * 4294967296;
1321
+ e.l = p, e.p = q, e.b = h, e.f = f, p && (f = 1, e.m = C, e.d = v, e.n = k);
1322
+ } while (!f);
1323
+ return h != t.length && o ? qe(t, 0, h) : t.subarray(0, h);
1324
+ }, vt = /* @__PURE__ */ new se(0), ie = function(a, e) {
1325
+ return a[e] | a[e + 1] << 8;
1326
+ }, ae = function(a, e) {
1327
+ return (a[e] | a[e + 1] << 8 | a[e + 2] << 16 | a[e + 3] << 24) >>> 0;
1328
+ }, Te = function(a, e) {
1329
+ return ae(a, e) + ae(a, e + 4) * 4294967296;
1217
1330
  };
1218
- function pt(n, e) {
1219
- return ft(n, { i: 2 }, e && e.out, e && e.dictionary);
1331
+ function bt(a, e) {
1332
+ return wt(a, { i: 2 }, e && e.out, e && e.dictionary);
1220
1333
  }
1221
- var Re = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), xt = 0;
1334
+ var Pe = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), Mt = 0;
1222
1335
  try {
1223
- Re.decode(dt, { stream: !0 }), xt = 1;
1336
+ Pe.decode(vt, { stream: !0 }), Mt = 1;
1224
1337
  } catch {
1225
1338
  }
1226
- var yt = function(n) {
1339
+ var St = function(a) {
1227
1340
  for (var e = "", t = 0; ; ) {
1228
- var r = n[t++], s = (r > 127) + (r > 223) + (r > 239);
1229
- if (t + s > n.length)
1230
- return { s: e, r: _e(n, t - 1) };
1231
- s ? s == 3 ? (r = ((r & 15) << 18 | (n[t++] & 63) << 12 | (n[t++] & 63) << 6 | n[t++] & 63) - 65536, e += String.fromCharCode(55296 | r >> 10, 56320 | r & 1023)) : s & 1 ? e += String.fromCharCode((r & 31) << 6 | n[t++] & 63) : e += String.fromCharCode((r & 15) << 12 | (n[t++] & 63) << 6 | n[t++] & 63) : e += String.fromCharCode(r);
1341
+ var s = a[t++], r = (s > 127) + (s > 223) + (s > 239);
1342
+ if (t + r > a.length)
1343
+ return { s: e, r: qe(a, t - 1) };
1344
+ r ? r == 3 ? (s = ((s & 15) << 18 | (a[t++] & 63) << 12 | (a[t++] & 63) << 6 | a[t++] & 63) - 65536, e += String.fromCharCode(55296 | s >> 10, 56320 | s & 1023)) : r & 1 ? e += String.fromCharCode((s & 31) << 6 | a[t++] & 63) : e += String.fromCharCode((s & 15) << 12 | (a[t++] & 63) << 6 | a[t++] & 63) : e += String.fromCharCode(s);
1232
1345
  }
1233
1346
  };
1234
- function gt(n, e) {
1347
+ function At(a, e) {
1235
1348
  if (e) {
1236
- for (var t = "", r = 0; r < n.length; r += 16384)
1237
- t += String.fromCharCode.apply(null, n.subarray(r, r + 16384));
1349
+ for (var t = "", s = 0; s < a.length; s += 16384)
1350
+ t += String.fromCharCode.apply(null, a.subarray(s, s + 16384));
1238
1351
  return t;
1239
1352
  } else {
1240
- if (Re)
1241
- return Re.decode(n);
1242
- var s = yt(n), a = s.s, t = s.r;
1243
- return t.length && te(8), a;
1353
+ if (Pe)
1354
+ return Pe.decode(a);
1355
+ var r = St(a), n = r.s, t = r.r;
1356
+ return t.length && re(8), n;
1244
1357
  }
1245
1358
  }
1246
- var wt = function(n, e) {
1247
- return e + 30 + ie(n, e + 26) + ie(n, e + 28);
1248
- }, vt = function(n, e, t) {
1249
- var r = ie(n, e + 28), s = gt(n.subarray(e + 46, e + 46 + r), !(ie(n, e + 8) & 2048)), a = e + 46 + r, o = ae(n, e + 20), i = t && o == 4294967295 ? bt(n, a) : [o, ae(n, e + 24), ae(n, e + 42)], m = i[0], f = i[1], y = i[2];
1250
- return [ie(n, e + 10), m, f, s, a + ie(n, e + 30) + ie(n, e + 32), y];
1251
- }, bt = function(n, e) {
1252
- for (; ie(n, e) != 1; e += 4 + ie(n, e + 2))
1359
+ var kt = function(a, e) {
1360
+ return e + 30 + ie(a, e + 26) + ie(a, e + 28);
1361
+ }, Et = function(a, e, t) {
1362
+ var s = ie(a, e + 28), r = At(a.subarray(e + 46, e + 46 + s), !(ie(a, e + 8) & 2048)), n = e + 46 + s, o = ae(a, e + 20), c = t && o == 4294967295 ? Ct(a, n) : [o, ae(a, e + 24), ae(a, e + 42)], m = c[0], g = c[1], f = c[2];
1363
+ return [ie(a, e + 10), m, g, r, n + ie(a, e + 30) + ie(a, e + 32), f];
1364
+ }, Ct = function(a, e) {
1365
+ for (; ie(a, e) != 1; e += 4 + ie(a, e + 2))
1253
1366
  ;
1254
- return [Ee(n, e + 12), Ee(n, e + 4), Ee(n, e + 20)];
1367
+ return [Te(a, e + 12), Te(a, e + 4), Te(a, e + 20)];
1255
1368
  };
1256
- function Mt(n, e) {
1257
- for (var t = {}, r = n.length - 22; ae(n, r) != 101010256; --r)
1258
- (!r || n.length - r > 65558) && te(13);
1259
- var s = ie(n, r + 8);
1260
- if (!s)
1369
+ function It(a, e) {
1370
+ for (var t = {}, s = a.length - 22; ae(a, s) != 101010256; --s)
1371
+ (!s || a.length - s > 65558) && re(13);
1372
+ var r = ie(a, s + 8);
1373
+ if (!r)
1261
1374
  return {};
1262
- var a = ae(n, r + 16), o = a == 4294967295 || s == 65535;
1375
+ var n = ae(a, s + 16), o = n == 4294967295 || r == 65535;
1263
1376
  if (o) {
1264
- var i = ae(n, r - 12);
1265
- o = ae(n, i) == 101075792, o && (s = ae(n, i + 32), a = ae(n, i + 48));
1377
+ var c = ae(a, s - 12);
1378
+ o = ae(a, c) == 101075792, o && (r = ae(a, c + 32), n = ae(a, c + 48));
1266
1379
  }
1267
- for (var m = 0; m < s; ++m) {
1268
- var f = vt(n, a, o), y = f[0], l = f[1], u = f[2], x = f[3], g = f[4], v = f[5], b = wt(n, v);
1269
- a = g, y ? y == 8 ? t[x] = pt(n.subarray(b, b + l), { out: new ee(u) }) : te(14, "unknown compression type " + y) : t[x] = _e(n, b, b + l);
1380
+ for (var m = 0; m < r; ++m) {
1381
+ var g = Et(a, n, o), f = g[0], l = g[1], h = g[2], p = g[3], v = g[4], C = g[5], k = kt(a, C);
1382
+ n = v, f ? f == 8 ? t[p] = bt(a.subarray(k, k + l), { out: new se(h) }) : re(14, "unknown compression type " + f) : t[p] = qe(a, k, k + l);
1270
1383
  }
1271
1384
  return t;
1272
1385
  }
1273
- const Oe = (n) => {
1274
- if (typeof n != "object" || n === null) throw new Error("Invalid SOGS metadata: not an object");
1275
- const e = n, t = e.version ?? 1;
1276
- if (t !== 1) throw new Error(`Unsupported SOGS version: ${String(t)}`);
1277
- const r = (v) => {
1278
- const b = e[v];
1279
- if (typeof b != "object" || b === null) throw new Error(`Invalid SOGS metadata section: ${v}`);
1280
- return b;
1281
- }, s = r("means"), a = r("sh0"), o = r("quats"), i = r("scales"), m = typeof e.count == "number" && Number.isFinite(e.count) ? e.count : void 0, f = Array.isArray(s.shape) ? s.shape : void 0, y = f && typeof f[0] == "number" ? f[0] : void 0;
1282
- if (m === void 0 && y === void 0)
1283
- throw new Error(
1284
- "Invalid SOGS metadata: unable to determine splat count"
1285
- );
1286
- if (m !== void 0 && y !== void 0 && m !== y)
1287
- throw new Error(
1288
- "Inconsistent SOGS metadata: count does not match means.shape[0]"
1289
- );
1290
- const l = m ?? y, u = (v, b) => {
1291
- const E = v.mins, T = v.maxs;
1292
- if (!Array.isArray(E) || E.length !== 3)
1293
- throw new Error(`${b}.mins must be length-3`);
1294
- if (!Array.isArray(T) || T.length !== 3)
1295
- throw new Error(`${b}.maxs must be length-3`);
1296
- if (![...E, ...T].every(
1297
- (P) => typeof P == "number" && Number.isFinite(P)
1298
- ))
1299
- throw new Error(`${b}.mins/maxs must be finite numbers`);
1300
- return {
1301
- mins: [E[0], E[1], E[2]],
1302
- maxs: [T[0], T[1], T[2]]
1303
- };
1304
- }, x = (v, b) => {
1305
- const E = v.mins, T = v.maxs;
1306
- if (!Array.isArray(E) || E.length !== 4)
1307
- throw new Error(`${b}.mins must be length-4`);
1308
- if (!Array.isArray(T) || T.length !== 4)
1309
- throw new Error(`${b}.maxs must be length-4`);
1310
- if (![...E, ...T].every(
1311
- (P) => typeof P == "number" && Number.isFinite(P)
1312
- ))
1313
- throw new Error(`${b}.mins/maxs must be finite numbers`);
1386
+ const ke = (a) => typeof a == "number" && Number.isFinite(a), he = (a, e) => {
1387
+ const t = a[e];
1388
+ if (typeof t != "object" || t === null)
1389
+ throw new Error(`Invalid SOG metadata section: ${e}`);
1390
+ return t;
1391
+ }, ue = (a, e) => {
1392
+ const t = a.files;
1393
+ if (!Array.isArray(t))
1394
+ throw new Error(`${e}.files is not an array`);
1395
+ if (!t.every((s) => typeof s == "string"))
1396
+ throw new Error(`${e}.files contains non-strings`);
1397
+ return t;
1398
+ }, ze = (a, e) => {
1399
+ const t = a.mins, s = a.maxs;
1400
+ if (!Array.isArray(t) || t.length !== 3)
1401
+ throw new Error(`${e}.mins must be length-3`);
1402
+ if (!Array.isArray(s) || s.length !== 3)
1403
+ throw new Error(`${e}.maxs must be length-3`);
1404
+ if (![...t, ...s].every(ke))
1405
+ throw new Error(`${e}.mins/maxs must be finite numbers`);
1406
+ return {
1407
+ mins: [t[0], t[1], t[2]],
1408
+ maxs: [s[0], s[1], s[2]]
1409
+ };
1410
+ }, Rt = (a, e) => {
1411
+ const t = a.mins, s = a.maxs;
1412
+ if (!Array.isArray(t) || t.length !== 4)
1413
+ throw new Error(`${e}.mins must be length-4`);
1414
+ if (!Array.isArray(s) || s.length !== 4)
1415
+ throw new Error(`${e}.maxs must be length-4`);
1416
+ if (![...t, ...s].every(ke))
1417
+ throw new Error(`${e}.mins/maxs must be finite numbers`);
1418
+ return {
1419
+ mins: [t[0], t[1], t[2], t[3]],
1420
+ maxs: [s[0], s[1], s[2], s[3]]
1421
+ };
1422
+ }, je = (a, e) => {
1423
+ const t = a.codebook;
1424
+ if (!Array.isArray(t))
1425
+ throw new Error(`${e}.codebook is not an array`);
1426
+ if (!t.every(ke))
1427
+ throw new Error(`${e}.codebook contains non-finite numbers`);
1428
+ return t;
1429
+ }, Ge = (a) => {
1430
+ if (typeof a != "object" || a === null) throw new Error("Invalid SOG metadata: not an object");
1431
+ const e = a, t = e.version ?? 1;
1432
+ if (t !== 1 && t !== 2) throw new Error(`Unsupported SOG version: ${String(t)}`);
1433
+ if (t === 1) {
1434
+ const f = he(e, "means"), l = he(e, "sh0"), h = he(e, "quats"), p = he(e, "scales"), v = typeof e.count == "number" && Number.isFinite(e.count) ? e.count : void 0, C = Array.isArray(f.shape) ? f.shape : void 0, k = C && typeof C[0] == "number" ? C[0] : void 0;
1435
+ if (v === void 0 && k === void 0) throw new Error("Invalid SOGS metadata: unable to determine splat count");
1436
+ if (v !== void 0 && k !== void 0 && v !== k) throw new Error("Inconsistent SOGS metadata: count does not match means.shape[0]");
1314
1437
  return {
1315
- mins: [E[0], E[1], E[2], E[3]],
1316
- maxs: [T[0], T[1], T[2], T[3]]
1438
+ version: 1,
1439
+ numSplats: (v ?? k) | 0,
1440
+ files: {
1441
+ sh0: ue(l, "sh0"),
1442
+ means: ue(f, "means"),
1443
+ quats: ue(h, "quats"),
1444
+ scales: ue(p, "scales")
1445
+ },
1446
+ ranges: {
1447
+ sh0: Rt(l, "sh0"),
1448
+ means: ze(f, "means"),
1449
+ scales: ze(p, "scales")
1450
+ }
1317
1451
  };
1318
- }, g = (v, b) => {
1319
- const E = v.files;
1320
- if (!Array.isArray(E)) throw new Error(`${b}.files is not an array`);
1321
- if (!E.every((T) => typeof T == "string")) throw new Error(`${b}.files contains non-strings`);
1322
- return E;
1323
- };
1452
+ }
1453
+ const s = e.count;
1454
+ if (!ke(s)) throw new Error('Invalid SOG v2 metadata: missing/invalid "count"');
1455
+ const r = s | 0, n = he(e, "means"), o = he(e, "sh0"), c = he(e, "quats"), m = he(e, "scales");
1324
1456
  return {
1325
- numSplats: l,
1457
+ version: 2,
1458
+ numSplats: r,
1326
1459
  files: {
1327
- sh0: g(a, "sh0"),
1328
- means: g(s, "means"),
1329
- quats: g(o, "quats"),
1330
- scales: g(i, "scales")
1460
+ sh0: ue(o, "sh0"),
1461
+ means: ue(n, "means"),
1462
+ quats: ue(c, "quats"),
1463
+ scales: ue(m, "scales")
1331
1464
  },
1332
1465
  ranges: {
1333
- sh0: x(a, "sh0"),
1334
- means: u(s, "means"),
1335
- scales: u(i, "scales")
1336
- }
1466
+ means: ze(n, "means"),
1467
+ sh0: { codebook: je(o, "sh0") },
1468
+ scales: { codebook: je(m, "scales") }
1469
+ },
1470
+ antialias: typeof e.antialias == "boolean" ? e.antialias : void 0
1471
+ // prettier-ignore
1337
1472
  };
1338
1473
  };
1339
- class St extends h.Loader {
1340
- constructor(e) {
1341
- super(e), this.withCredentials = !0;
1474
+ class _t extends u.Loader {
1475
+ constructor(e, t) {
1476
+ super(e), this.withCredentials = (t == null ? void 0 : t.withCredentials) ?? !1;
1342
1477
  }
1343
1478
  /**
1344
1479
  * Detect if a buffer is a ZIP file by checking magic bytes
@@ -1356,19 +1491,19 @@ class St extends h.Loader {
1356
1491
  * @param onProgress Optional progress callback
1357
1492
  * @param onError Optional error callback
1358
1493
  */
1359
- load(e, t, r, s) {
1360
- const a = new h.FileLoader(this.manager);
1361
- a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(this.withCredentials), a.load(
1494
+ load(e, t, s, r) {
1495
+ const n = new u.FileLoader(this.manager);
1496
+ n.setResponseType("arraybuffer"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
1362
1497
  e,
1363
1498
  (o) => {
1364
- this.parseAsync(e, o).then((i) => {
1365
- t && t(i);
1366
- }).catch((i) => {
1367
- this.manager.itemError(e), s && s(i), console.error("Error loading SOGS meta:", i);
1499
+ this.parseAsync(e, o).then((c) => {
1500
+ t && t(c);
1501
+ }).catch((c) => {
1502
+ this.manager.itemError(e), r && r(c), console.error("Error loading SOGS meta:", c);
1368
1503
  });
1369
1504
  },
1370
- r,
1371
- s
1505
+ s,
1506
+ r
1372
1507
  );
1373
1508
  }
1374
1509
  /**
@@ -1378,18 +1513,18 @@ class St extends h.Loader {
1378
1513
  * @returns A Promise that resolves with the parsed SplatData
1379
1514
  */
1380
1515
  loadAsync(e, t) {
1381
- return new Promise((r, s) => {
1382
- const a = new h.FileLoader(this.manager);
1383
- a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(this.withCredentials), a.load(
1516
+ return new Promise((s, r) => {
1517
+ const n = new u.FileLoader(this.manager);
1518
+ n.setResponseType("arraybuffer"), n.setRequestHeader(this.requestHeader), n.setPath(this.path), n.setWithCredentials(this.withCredentials), n.load(
1384
1519
  e,
1385
1520
  (o) => {
1386
- this.parseAsync(e, o).then(r).catch((i) => {
1387
- s(i), this.manager.itemError(e);
1521
+ this.parseAsync(e, o).then(s).catch((c) => {
1522
+ r(c), this.manager.itemError(e);
1388
1523
  });
1389
1524
  },
1390
1525
  t,
1391
1526
  (o) => {
1392
- s(o), this.manager.itemError(e);
1527
+ r(o), this.manager.itemError(e);
1393
1528
  }
1394
1529
  );
1395
1530
  });
@@ -1397,85 +1532,90 @@ class St extends h.Loader {
1397
1532
  async parseAsync(e, t) {
1398
1533
  if (!(t instanceof ArrayBuffer)) throw new Error("SOGS loader: expected ArrayBuffer payload");
1399
1534
  if (this.isZipBuffer(t)) return this.parseZipAsync(t);
1400
- const s = new TextDecoder("utf-8").decode(t), a = JSON.parse(s);
1401
- return this.parseMetaAsync(e, a);
1535
+ const r = new TextDecoder("utf-8").decode(t), n = JSON.parse(r);
1536
+ return this.parseMetaAsync(e, n);
1402
1537
  }
1403
1538
  async parseMetaAsync(e, t) {
1404
- const { numSplats: r, files: s, ranges: a } = Oe(t), o = new h.TextureLoader(this.manager);
1405
- o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials);
1406
- const i = (E, T) => {
1539
+ const s = Ge(t), { numSplats: r, files: n, ranges: o, version: c } = s, m = new u.TextureLoader(this.manager);
1540
+ m.setPath(this.path), m.setRequestHeader(this.requestHeader), m.setWithCredentials(this.withCredentials);
1541
+ const g = (F, N) => {
1407
1542
  try {
1408
- return new URL(T, E).toString();
1543
+ return new URL(N, F).toString();
1409
1544
  } catch {
1410
- return E.substring(0, E.lastIndexOf("/") + 1) + T;
1545
+ return F.substring(0, F.lastIndexOf("/") + 1) + N;
1411
1546
  }
1412
- }, m = (E, T) => {
1413
- const P = i(e, E);
1414
- return new Promise((H, L) => {
1415
- o.load(
1416
- P,
1417
- (A) => {
1418
- A.generateMipmaps = !1, A.magFilter = h.NearestFilter, A.minFilter = h.NearestFilter, A.flipY = !1, H(A);
1547
+ }, f = (F, N) => {
1548
+ const W = g(e, F);
1549
+ return new Promise((T, S) => {
1550
+ m.load(
1551
+ W,
1552
+ (z) => {
1553
+ z.generateMipmaps = !1, z.magFilter = u.NearestFilter, z.minFilter = u.NearestFilter, z.flipY = !1, T(z);
1419
1554
  },
1420
1555
  void 0,
1421
- (A) => {
1422
- const C = A instanceof Error ? A.message : String(A);
1423
- L(
1556
+ (z) => {
1557
+ const E = z instanceof Error ? z.message : String(z);
1558
+ S(
1424
1559
  new Error(
1425
- `SOGS loader: failed to load ${T} (${E}): ${C}`
1560
+ `SOGS loader: failed to load ${N} (${F}): ${E}`
1426
1561
  )
1427
1562
  );
1428
1563
  }
1429
1564
  );
1430
1565
  });
1431
1566
  };
1432
- if (!Array.isArray(s.sh0) || s.sh0.length < 1) throw new Error("SOGS loader: files.sh0 must have at least 1 entry (sh0)");
1433
- if (!Array.isArray(s.means) || s.means.length < 2) throw new Error("SOGS loader: files.means must have at least 2 entries (means_l, means_u)");
1434
- if (!Array.isArray(s.quats) || s.quats.length < 1) throw new Error("SOGS loader: files.quats must have at least 1 entry");
1435
- if (!Array.isArray(s.scales) || s.scales.length < 1) throw new Error("SOGS loader: files.scales must have at least 1 entry");
1436
- const [f, y, l, u, x] = await Promise.all([
1437
- m(s.means[0], "means_l"),
1438
- m(s.means[1], "means_u"),
1439
- m(s.quats[0], "quats"),
1440
- m(s.scales[0], "scales"),
1441
- m(s.sh0[0], "sh0")
1442
- ]), g = { means_l: f, means_u: y, quats: l, scales: u, sh0: x }, v = new Fe(r, a, g), b = Ce.packSogs(v);
1443
- return v.dispose(), b;
1567
+ if (!Array.isArray(n.sh0) || n.sh0.length < 1) throw new Error("SOGS loader: files.sh0 must have at least 1 entry (sh0)");
1568
+ if (!Array.isArray(n.means) || n.means.length < 2) throw new Error("SOGS loader: files.means must have at least 2 entries (means_l, means_u)");
1569
+ if (!Array.isArray(n.quats) || n.quats.length < 1) throw new Error("SOGS loader: files.quats must have at least 1 entry");
1570
+ if (!Array.isArray(n.scales) || n.scales.length < 1) throw new Error("SOGS loader: files.scales must have at least 1 entry");
1571
+ const [l, h, p, v, C] = await Promise.all([
1572
+ f(n.means[0], "means_l"),
1573
+ f(n.means[1], "means_u"),
1574
+ f(n.quats[0], "quats"),
1575
+ f(n.scales[0], "scales"),
1576
+ f(n.sh0[0], "sh0")
1577
+ ]), k = { means_l: l, means_u: h, quats: p, scales: v, sh0: C };
1578
+ if (c === 1) {
1579
+ const F = new Le(r, o, k), N = we.packSogs(F);
1580
+ return F.dispose(), N;
1581
+ }
1582
+ const B = new We(r, o, k), U = we.packSog2(B);
1583
+ return B.dispose(), U;
1444
1584
  }
1445
1585
  async parseZipAsync(e) {
1446
- const t = Mt(new Uint8Array(e)), r = Object.keys(t), s = r.find((_) => _.toLowerCase().endsWith("meta.json")) ?? null;
1447
- if (!s) throw new Error("SOGS loader: zip missing meta.json");
1448
- const a = s.includes("/") ? s.slice(0, s.lastIndexOf("/") + 1) : "", o = new TextDecoder(), i = JSON.parse(o.decode(t[s])), { numSplats: m, files: f, ranges: y } = Oe(i), l = (_) => _.replace(/\\/g, "/").replace(/^\.?\//, ""), u = (_) => {
1449
- const w = l(_), p = [l(a + w), w];
1450
- for (const j of p) {
1451
- const Y = t[j];
1452
- if (Y) return Y;
1586
+ const t = It(new Uint8Array(e)), s = Object.keys(t), r = s.find((y) => y.toLowerCase().endsWith("meta.json")) ?? null;
1587
+ if (!r) throw new Error("SOGS loader: zip missing meta.json");
1588
+ const n = r.includes("/") ? r.slice(0, r.lastIndexOf("/") + 1) : "", o = new TextDecoder(), c = JSON.parse(o.decode(t[r])), m = Ge(c), { numSplats: g, files: f, ranges: l, version: h } = m, p = (y) => y.replace(/\\/g, "/").replace(/^\.?\//, ""), v = (y) => {
1589
+ const b = p(y), j = [p(n + b), b];
1590
+ for (const D of j) {
1591
+ const x = t[D];
1592
+ if (x) return x;
1453
1593
  }
1454
- const R = w.split("/").pop(), q = r.find((j) => l(j).endsWith("/" + w)) ?? r.find((j) => l(j).endsWith("/" + R)) ?? r.find((j) => l(j) === R) ?? null;
1455
- if (q) return t[q];
1456
- throw new Error(`SOGS loader: zip missing file "${_}"`);
1457
- }, x = (_) => {
1458
- const w = _.toLowerCase();
1459
- return w.endsWith(".png") ? "image/png" : w.endsWith(".jpg") || w.endsWith(".jpeg") ? "image/jpeg" : w.endsWith(".webp") ? "image/webp" : "application/octet-stream";
1460
- }, g = new h.TextureLoader(this.manager);
1461
- g.setRequestHeader(this.requestHeader), g.setWithCredentials(this.withCredentials);
1462
- const v = (_, w) => {
1463
- const p = u(_), R = new Blob([p], {
1464
- type: x(_)
1465
- }), q = URL.createObjectURL(R);
1466
- return new Promise((j, Y) => {
1467
- g.load(
1468
- q,
1469
- (V) => {
1470
- URL.revokeObjectURL(q), V.generateMipmaps = !1, V.magFilter = h.NearestFilter, V.minFilter = h.NearestFilter, V.flipY = !1, j(V);
1594
+ const L = b.split("/").pop(), I = s.find((D) => p(D).endsWith("/" + b)) ?? s.find((D) => p(D).endsWith("/" + L)) ?? s.find((D) => p(D) === L) ?? null;
1595
+ if (I) return t[I];
1596
+ throw new Error(`SOGS loader: zip missing file "${y}"`);
1597
+ }, C = (y) => {
1598
+ const b = y.toLowerCase();
1599
+ return b.endsWith(".png") ? "image/png" : b.endsWith(".jpg") || b.endsWith(".jpeg") ? "image/jpeg" : b.endsWith(".webp") ? "image/webp" : "application/octet-stream";
1600
+ }, k = new u.TextureLoader(this.manager);
1601
+ k.setRequestHeader(this.requestHeader), k.setWithCredentials(this.withCredentials);
1602
+ const B = (y, b) => {
1603
+ const j = v(y), L = new Blob([j], {
1604
+ type: C(y)
1605
+ }), I = URL.createObjectURL(L);
1606
+ return new Promise((D, x) => {
1607
+ k.load(
1608
+ I,
1609
+ (_) => {
1610
+ URL.revokeObjectURL(I), _.generateMipmaps = !1, _.magFilter = u.NearestFilter, _.minFilter = u.NearestFilter, _.flipY = !1, D(_);
1471
1611
  },
1472
1612
  void 0,
1473
- (V) => {
1474
- URL.revokeObjectURL(q);
1475
- const D = V instanceof Error ? V.message : String(V);
1476
- Y(
1613
+ (_) => {
1614
+ URL.revokeObjectURL(I);
1615
+ const X = _ instanceof Error ? _.message : String(_);
1616
+ x(
1477
1617
  new Error(
1478
- `SOGS loader: failed to load ${w} from zip (${_}): ${D}`
1618
+ `SOGS loader: failed to load ${b} from zip (${y}): ${X}`
1479
1619
  )
1480
1620
  );
1481
1621
  }
@@ -1486,28 +1626,33 @@ class St extends h.Loader {
1486
1626
  if (!Array.isArray(f.means) || f.means.length < 2) throw new Error("SOGS loader: files.means must have at least 2 entries (means_l, means_u)");
1487
1627
  if (!Array.isArray(f.quats) || f.quats.length < 1) throw new Error("SOGS loader: files.quats must have at least 1 entry");
1488
1628
  if (!Array.isArray(f.scales) || f.scales.length < 1) throw new Error("SOGS loader: files.scales must have at least 1 entry");
1489
- const [b, E, T, P, H] = await Promise.all([
1490
- v(f.means[0], "means_l"),
1491
- v(f.means[1], "means_u"),
1492
- v(f.quats[0], "quats"),
1493
- v(f.scales[0], "scales"),
1494
- v(f.sh0[0], "sh0")
1495
- ]), L = { means_l: b, means_u: E, quats: T, scales: P, sh0: H }, A = new Fe(m, y, L), C = Ce.packSogs(A);
1496
- return A.dispose(), C;
1629
+ const [U, F, N, W, T] = await Promise.all([
1630
+ B(f.means[0], "means_l"),
1631
+ B(f.means[1], "means_u"),
1632
+ B(f.quats[0], "quats"),
1633
+ B(f.scales[0], "scales"),
1634
+ B(f.sh0[0], "sh0")
1635
+ ]), S = { means_l: U, means_u: F, quats: N, scales: W, sh0: T };
1636
+ if (h === 1) {
1637
+ const y = new Le(g, l, S), b = we.packSogs(y);
1638
+ return y.dispose(), b;
1639
+ }
1640
+ const z = new We(g, l, S), E = we.packSog2(z);
1641
+ return z.dispose(), E;
1497
1642
  }
1498
1643
  }
1499
- class At extends h.EventDispatcher {
1644
+ class Tt extends u.EventDispatcher {
1500
1645
  constructor() {
1501
1646
  super();
1502
- M(this, "worker");
1503
- M(this, "centers", null);
1504
- M(this, "orderTexture", null);
1647
+ w(this, "worker");
1648
+ w(this, "centers", null);
1649
+ w(this, "orderTexture", null);
1505
1650
  /** Bounding box data for optimization */
1506
- M(this, "chunks", null);
1507
- M(this, "lastCameraPosition", new h.Vector3());
1508
- M(this, "lastCameraDirection", new h.Vector3());
1509
- const t = this.createWorkerCode(), r = new Blob([t], { type: "application/javascript" });
1510
- this.worker = new Worker(URL.createObjectURL(r)), this.worker.onmessage = this.onWorkerMessage.bind(this);
1651
+ w(this, "chunks", null);
1652
+ w(this, "lastCameraPosition", new u.Vector3());
1653
+ w(this, "lastCameraDirection", new u.Vector3());
1654
+ const t = this.createWorkerCode(), s = new Blob([t], { type: "application/javascript" });
1655
+ this.worker = new Worker(URL.createObjectURL(s)), this.worker.onmessage = this.onWorkerMessage.bind(this);
1511
1656
  }
1512
1657
  /**
1513
1658
  * Handles messages received from the sorting worker.
@@ -1516,14 +1661,14 @@ class At extends h.EventDispatcher {
1516
1661
  onWorkerMessage(t) {
1517
1662
  if (!this.orderTexture || !this.orderTexture.image)
1518
1663
  return console.error("SplatSorter: Order texture not initialized!");
1519
- const { order: r, count: s } = t.data, a = this.orderTexture.image.data;
1520
- if (!(a instanceof Uint32Array))
1664
+ const { order: s, count: r } = t.data, n = this.orderTexture.image.data;
1665
+ if (!(n instanceof Uint32Array))
1521
1666
  return console.error(
1522
1667
  "SplatSorter: Order texture data is not a Uint32Array!"
1523
1668
  );
1524
- a.set(new Uint32Array(r)), this.orderTexture.source.data.updateRanges || (this.orderTexture.source.data.updateRanges = []), this.orderTexture.needsUpdate = !0;
1525
- const o = a.buffer.slice(0), i = { order: o };
1526
- this.worker.postMessage(i, [o]), this.dispatchEvent({ type: "updated", count: s });
1669
+ n.set(new Uint32Array(s)), this.orderTexture.source.data.updateRanges || (this.orderTexture.source.data.updateRanges = []), this.orderTexture.needsUpdate = !0;
1670
+ const o = n.buffer.slice(0), c = { order: o };
1671
+ this.worker.postMessage(c, [o]), this.dispatchEvent({ type: "updated", count: r });
1527
1672
  }
1528
1673
  /**
1529
1674
  * Initializes the sorter with necessary data and textures.
@@ -1532,35 +1677,35 @@ class At extends h.EventDispatcher {
1532
1677
  * @param chunks Optional: A Float32Array containing bounding box chunk data [minX, minY, minZ, maxX, maxY, maxZ, ...] for optimization.
1533
1678
  * @param transferOwnership Optional: If true, transfers ownership of centers buffer to worker (saves memory, main thread loses access). Default: false.
1534
1679
  */
1535
- init(t, r, s, a = !1) {
1680
+ init(t, s, r, n = !1) {
1536
1681
  if (!t || !(t.image.data instanceof Uint32Array))
1537
1682
  throw new Error("SplatSorter: Invalid orderTexture provided. Must be DataTexture with Uint32Array data.");
1538
- if (!r || r.length % 3 !== 0)
1683
+ if (!s || s.length % 3 !== 0)
1539
1684
  throw new Error("SplatSorter: Invalid centers array provided. Length must be multiple of 3.");
1540
- if (t.image.data.length < r.length / 3)
1685
+ if (t.image.data.length < s.length / 3)
1541
1686
  throw new Error("SplatSorter: orderTexture data buffer is smaller than the number of splats.");
1542
- if (r.buffer.byteLength === 0)
1687
+ if (s.buffer.byteLength === 0)
1543
1688
  throw new Error(
1544
1689
  "SplatSorter: positions buffer is detached (likely React StrictMode + cached asset). "
1545
1690
  );
1546
- const o = r.length / 3;
1547
- this.orderTexture = t, a ? this.centers = null : this.centers = r.slice();
1548
- const i = this.orderTexture.image.data;
1549
- for (let u = 0; u < o; u++) i[u] = u;
1691
+ const o = s.length / 3;
1692
+ this.orderTexture = t, n ? this.centers = null : this.centers = s.slice();
1693
+ const c = this.orderTexture.image.data;
1694
+ for (let h = 0; h < o; h++) c[h] = h;
1550
1695
  this.orderTexture.source.data.updateRanges || (this.orderTexture.source.data.updateRanges = []), this.orderTexture.needsUpdate = !0;
1551
- const m = i.buffer.slice(0), f = a ? r.buffer : r.buffer.slice(0), y = {
1696
+ const m = c.buffer.slice(0), g = n ? s.buffer : s.buffer.slice(0), f = {
1552
1697
  order: m,
1553
- centers: f
1698
+ centers: g
1554
1699
  }, l = [
1555
1700
  m,
1556
- f
1701
+ g
1557
1702
  ];
1558
- if (s) {
1559
- this.chunks = s.slice();
1560
- const u = this.chunks.buffer.slice(0);
1561
- y.chunks = u, l.push(u);
1703
+ if (r) {
1704
+ this.chunks = r.slice();
1705
+ const h = this.chunks.buffer.slice(0);
1706
+ f.chunks = h, l.push(h);
1562
1707
  }
1563
- this.worker.postMessage(y, l), queueMicrotask(() => {
1708
+ this.worker.postMessage(f, l), queueMicrotask(() => {
1564
1709
  this.dispatchEvent({
1565
1710
  type: "updated",
1566
1711
  count: o
@@ -1577,46 +1722,46 @@ class At extends h.EventDispatcher {
1577
1722
  return console.warn(
1578
1723
  "SplatSorter: Cannot set mapping before initialization."
1579
1724
  );
1580
- let r;
1581
- const s = [];
1725
+ let s;
1726
+ const r = [];
1582
1727
  if (!t) {
1583
1728
  const m = this.centers.buffer.slice(0);
1584
- return r = {
1729
+ return s = {
1585
1730
  centers: m,
1586
1731
  mapping: null
1587
- }, s.push(m), this.worker.postMessage(r, s);
1732
+ }, r.push(m), this.worker.postMessage(s, r);
1588
1733
  }
1589
- const a = new Float32Array(t.length * 3);
1734
+ const n = new Float32Array(t.length * 3);
1590
1735
  for (let m = 0; m < t.length; m++) {
1591
- const f = t[m];
1592
- if (f * 3 + 2 >= this.centers.length) {
1736
+ const g = t[m];
1737
+ if (g * 3 + 2 >= this.centers.length) {
1593
1738
  console.warn(
1594
- `SplatSorter: Mapping index ${f} out of bounds.`
1739
+ `SplatSorter: Mapping index ${g} out of bounds.`
1595
1740
  );
1596
1741
  continue;
1597
1742
  }
1598
- const y = f * 3, l = m * 3;
1599
- a[l + 0] = this.centers[y + 0], a[l + 1] = this.centers[y + 1], a[l + 2] = this.centers[y + 2];
1743
+ const f = g * 3, l = m * 3;
1744
+ n[l + 0] = this.centers[f + 0], n[l + 1] = this.centers[f + 1], n[l + 2] = this.centers[f + 2];
1600
1745
  }
1601
- const o = a.buffer.slice(0), i = t.buffer.slice(0);
1602
- r = {
1746
+ const o = n.buffer.slice(0), c = t.buffer.slice(0);
1747
+ s = {
1603
1748
  centers: o,
1604
- mapping: i
1605
- }, s.push(o, i), this.worker.postMessage(r, s);
1749
+ mapping: c
1750
+ }, r.push(o, c), this.worker.postMessage(s, r);
1606
1751
  }
1607
1752
  /**
1608
1753
  * Updates the camera parameters used for sorting.
1609
1754
  * @param position The camera's position in the sorter's local coordinate space.
1610
1755
  * @param direction The camera's forward direction in the sorter's local coordinate space.
1611
1756
  */
1612
- setCamera(t, r) {
1613
- const s = this.lastCameraPosition.distanceToSquared(t) > 1e-7, a = this.lastCameraDirection.dot(r) < 0.9999;
1614
- if (!s && !a)
1757
+ setCamera(t, s) {
1758
+ const r = this.lastCameraPosition.distanceToSquared(t) > 1e-7, n = this.lastCameraDirection.dot(s) < 0.9999;
1759
+ if (!r && !n)
1615
1760
  return;
1616
- this.lastCameraPosition.copy(t), this.lastCameraDirection.copy(r);
1761
+ this.lastCameraPosition.copy(t), this.lastCameraDirection.copy(s);
1617
1762
  const o = {
1618
1763
  cameraPosition: { x: t.x, y: t.y, z: t.z },
1619
- cameraDirection: { x: r.x, y: r.y, z: r.z }
1764
+ cameraDirection: { x: s.x, y: s.y, z: s.z }
1620
1765
  };
1621
1766
  this.worker.postMessage(o);
1622
1767
  }
@@ -1632,186 +1777,186 @@ class At extends h.EventDispatcher {
1632
1777
  */
1633
1778
  createWorkerCode() {
1634
1779
  return `(${(function() {
1635
- let r = null, s = null, a = null, o = null, i = null, m = null, f = !1;
1636
- const y = { x: 0, y: 0, z: 0 }, l = { x: 0, y: 0, z: 0 }, u = { x: 0, y: 0, z: 0 }, x = { x: 0, y: 0, z: 0 };
1637
- let g = null, v = null;
1638
- const b = 32, E = new Array(b).fill(0), T = new Array(b).fill(0), P = new Array(b).fill(0), H = (A, C, _) => {
1639
- for (; A <= C; ) {
1640
- const w = C + A >> 1, p = _(w);
1641
- if (p > 0) A = w + 1;
1642
- else if (p < 0) C = w - 1;
1643
- else return w;
1780
+ let s = null, r = null, n = null, o = null, c = null, m = null, g = !1;
1781
+ const f = { x: 0, y: 0, z: 0 }, l = { x: 0, y: 0, z: 0 }, h = { x: 0, y: 0, z: 0 }, p = { x: 0, y: 0, z: 0 };
1782
+ let v = null, C = null;
1783
+ const k = 32, B = new Array(k).fill(0), U = new Array(k).fill(0), F = new Array(k).fill(0), N = (T, S, z) => {
1784
+ for (; T <= S; ) {
1785
+ const E = S + T >> 1, y = z(E);
1786
+ if (y > 0) T = E + 1;
1787
+ else if (y < 0) S = E - 1;
1788
+ else return E;
1644
1789
  }
1645
- return ~A;
1646
- }, L = () => {
1647
- if (!r || !s || !i || !m)
1790
+ return ~T;
1791
+ }, W = () => {
1792
+ if (!s || !r || !c || !m)
1648
1793
  return;
1649
- if (s.length === 0) {
1794
+ if (r.length === 0) {
1650
1795
  const d = {
1651
- order: r.buffer,
1796
+ order: s.buffer,
1652
1797
  count: 0
1653
1798
  };
1654
- self.postMessage(d, [r.buffer]), r = null;
1799
+ self.postMessage(d, [s.buffer]), s = null;
1655
1800
  return;
1656
1801
  }
1657
- const A = i.x, C = i.y, _ = i.z, w = m.x, p = m.y, R = m.z, q = 1e-4, j = Math.abs(A - y.x) > q || Math.abs(C - y.y) > q || Math.abs(_ - y.z) > q, Y = Math.abs(w - l.x) > q || Math.abs(p - l.y) > q || Math.abs(R - l.z) > q;
1658
- if (!f && !j && !Y)
1802
+ const T = c.x, S = c.y, z = c.z, E = m.x, y = m.y, b = m.z, j = 1e-4, L = Math.abs(T - f.x) > j || Math.abs(S - f.y) > j || Math.abs(z - f.z) > j, I = Math.abs(E - l.x) > j || Math.abs(y - l.y) > j || Math.abs(b - l.z) > j;
1803
+ if (!g && !L && !I)
1659
1804
  return;
1660
- f = !1, y.x = A, y.y = C, y.z = _, l.x = w, l.y = p, l.z = R;
1661
- let V = 1 / 0, D = -1 / 0;
1805
+ g = !1, f.x = T, f.y = S, f.z = z, l.x = E, l.y = y, l.z = b;
1806
+ let D = 1 / 0, x = -1 / 0;
1662
1807
  for (let d = 0; d < 8; ++d) {
1663
- const z = d & 1 ? u.x : x.x, W = d & 2 ? u.y : x.y, S = d & 4 ? u.z : x.z, U = z * w + W * p + S * R;
1664
- V = Math.min(V, U), D = Math.max(D, U);
1808
+ const P = d & 1 ? h.x : p.x, G = d & 2 ? h.y : p.y, M = d & 4 ? h.z : p.z, V = P * E + G * y + M * b;
1809
+ D = Math.min(D, V), x = Math.max(x, V);
1665
1810
  }
1666
- const O = s.length / 3, J = D - V, c = (1 << Math.max(
1811
+ const _ = r.length / 3, X = x - D, i = (1 << Math.max(
1667
1812
  10,
1668
- Math.min(20, Math.ceil(Math.log2(O / 4)))
1813
+ Math.min(20, Math.ceil(Math.log2(_ / 4)))
1669
1814
  )) + 1;
1670
- if ((!g || g.length !== O) && (g = new Uint32Array(O)), !v || v.length !== c ? v = new Uint32Array(c) : v.fill(0), J < 1e-7) {
1671
- for (let d = 0; d < O; ++d) g[d] = 0;
1672
- v[0] = O;
1673
- } else if (a && a.length > 0) {
1674
- const d = a.length / 6;
1675
- E.fill(0);
1676
- for (let S = 0; S < d; ++S) {
1677
- const U = S * 6, $ = a[U + 0], X = a[U + 1], Q = a[U + 2], Z = a[U + 3], K = $ * w + X * p + Q * R - V, re = K - Z, se = K + Z, ue = Math.max(
1815
+ if ((!v || v.length !== _) && (v = new Uint32Array(_)), !C || C.length !== i ? C = new Uint32Array(i) : C.fill(0), X < 1e-7) {
1816
+ for (let d = 0; d < _; ++d) v[d] = 0;
1817
+ C[0] = _;
1818
+ } else if (n && n.length > 0) {
1819
+ const d = n.length / 6;
1820
+ B.fill(0);
1821
+ for (let M = 0; M < d; ++M) {
1822
+ const V = M * 6, H = n[V + 0], Z = n[V + 1], Q = n[V + 2], J = n[V + 3], K = H * E + Z * y + Q * b - D, ee = K - J, te = K + J, me = Math.max(
1678
1823
  0,
1679
- Math.floor(re * b / J)
1680
- ), he = Math.min(
1681
- b,
1682
- Math.ceil(se * b / J)
1824
+ Math.floor(ee * k / X)
1825
+ ), fe = Math.min(
1826
+ k,
1827
+ Math.ceil(te * k / X)
1683
1828
  );
1684
- for (let oe = ue; oe < he; ++oe)
1685
- E[oe]++;
1829
+ for (let oe = me; oe < fe; ++oe)
1830
+ B[oe]++;
1686
1831
  }
1687
- let z = 0;
1688
- for (let S = 0; S < b; ++S) z += E[S];
1689
- P[0] = 0, T[0] = 0;
1690
- for (let S = 1; S < b; ++S)
1691
- P[S - 1] = E[S - 1] / z * c >>> 0, T[S] = T[S - 1] + P[S - 1];
1692
- P[b - 1] = E[b - 1] / z * c >>> 0;
1693
- const W = J / b;
1694
- for (let S = 0; S < O; ++S) {
1695
- const U = S * 3, $ = s[U + 0], X = s[U + 1], Q = s[U + 2], Z = $ * w + X * p + Q * R, re = (D - Z) / W, se = Math.max(
1832
+ let P = 0;
1833
+ for (let M = 0; M < k; ++M) P += B[M];
1834
+ F[0] = 0, U[0] = 0;
1835
+ for (let M = 1; M < k; ++M)
1836
+ F[M - 1] = B[M - 1] / P * i >>> 0, U[M] = U[M - 1] + F[M - 1];
1837
+ F[k - 1] = B[k - 1] / P * i >>> 0;
1838
+ const G = X / k;
1839
+ for (let M = 0; M < _; ++M) {
1840
+ const V = M * 3, H = r[V + 0], Z = r[V + 1], Q = r[V + 2], J = H * E + Z * y + Q * b, ee = (x - J) / G, te = Math.max(
1696
1841
  0,
1697
1842
  Math.min(
1698
- b - 1,
1699
- Math.floor(re)
1843
+ k - 1,
1844
+ Math.floor(ee)
1700
1845
  )
1701
- ), ue = re - se, he = T[se] + P[se] * ue >>> 0, oe = Math.min(he, c - 1);
1702
- g[S] = oe, v[oe]++;
1846
+ ), me = ee - te, fe = U[te] + F[te] * me >>> 0, oe = Math.min(fe, i - 1);
1847
+ v[M] = oe, C[oe]++;
1703
1848
  }
1704
1849
  } else {
1705
- const d = (c - 1) / J;
1706
- for (let z = 0; z < O; ++z) {
1707
- const W = z * 3, S = s[W + 0], U = s[W + 1], $ = s[W + 2], X = S * w + U * p + $ * R, Z = (D - X) * d >>> 0, K = Math.min(Z, c - 1);
1708
- g[z] = K, v[K]++;
1850
+ const d = (i - 1) / X;
1851
+ for (let P = 0; P < _; ++P) {
1852
+ const G = P * 3, M = r[G + 0], V = r[G + 1], H = r[G + 2], Z = M * E + V * y + H * b, J = (x - Z) * d >>> 0, K = Math.min(J, i - 1);
1853
+ v[P] = K, C[K]++;
1709
1854
  }
1710
1855
  }
1711
- for (let d = 1; d < c; d++)
1712
- v[d] += v[d - 1];
1713
- for (let d = O - 1; d >= 0; d--) {
1714
- const z = g[d], W = --v[z];
1715
- r[W] = o ? o[d] : d;
1856
+ for (let d = 1; d < i; d++)
1857
+ C[d] += C[d - 1];
1858
+ for (let d = _ - 1; d >= 0; d--) {
1859
+ const P = v[d], G = --C[P];
1860
+ s[G] = o ? o[d] : d;
1716
1861
  }
1717
- const k = A * w + C * p + _ * R, B = (d) => {
1718
- if (!r) return -1 / 0;
1719
- const z = r[d], W = z;
1720
- if (!s || W * 3 + 2 >= s.length)
1862
+ const A = T * E + S * y + z * b, q = (d) => {
1863
+ if (!s) return -1 / 0;
1864
+ const P = s[d], G = P;
1865
+ if (!r || G * 3 + 2 >= r.length)
1721
1866
  return -1 / 0;
1722
- const S = W * 3;
1723
- return s[S] * w + s[S + 1] * p + s[S + 2] * R - k;
1867
+ const M = G * 3;
1868
+ return r[M] * E + r[M + 1] * y + r[M + 2] * b - A;
1724
1869
  };
1725
- let F = O;
1726
- if (O > 0 && B(O - 1) < 0) {
1727
- const d = H(
1870
+ let O = _;
1871
+ if (_ > 0 && q(_ - 1) < 0) {
1872
+ const d = N(
1728
1873
  0,
1729
- O - 1,
1730
- B
1874
+ _ - 1,
1875
+ q
1731
1876
  );
1732
- F = d < 0 ? ~d : d;
1877
+ O = d < 0 ? ~d : d;
1733
1878
  }
1734
- const I = {
1735
- order: r.buffer,
1736
- count: F
1879
+ const R = {
1880
+ order: s.buffer,
1881
+ count: O
1737
1882
  };
1738
- self.postMessage(I, [r.buffer]), r = null;
1883
+ self.postMessage(R, [s.buffer]), s = null;
1739
1884
  };
1740
- self.onmessage = (A) => {
1741
- const C = A.data;
1742
- C.order && (r = new Uint32Array(C.order));
1743
- let _ = !1;
1744
- if (C.centers && (s = new Float32Array(C.centers), _ = !0, f = !0), Object.prototype.hasOwnProperty.call(C, "mapping") && (o = C.mapping ? new Uint32Array(C.mapping) : null, f = !0), C.chunks) {
1745
- if (a = new Float32Array(C.chunks), a.length > 0 && a[3] > 0)
1746
- for (let w = 0; w < a.length / 6; ++w) {
1747
- const p = w * 6, R = a[p + 0], q = a[p + 1], j = a[p + 2], Y = a[p + 3], V = a[p + 4], D = a[p + 5];
1748
- a[p + 0] = (R + Y) * 0.5, a[p + 1] = (q + V) * 0.5, a[p + 2] = (j + D) * 0.5, a[p + 3] = Math.sqrt(
1749
- (Y - R) ** 2 + (V - q) ** 2 + (D - j) ** 2
1885
+ self.onmessage = (T) => {
1886
+ const S = T.data;
1887
+ S.order && (s = new Uint32Array(S.order));
1888
+ let z = !1;
1889
+ if (S.centers && (r = new Float32Array(S.centers), z = !0, g = !0), Object.prototype.hasOwnProperty.call(S, "mapping") && (o = S.mapping ? new Uint32Array(S.mapping) : null, g = !0), S.chunks) {
1890
+ if (n = new Float32Array(S.chunks), n.length > 0 && n[3] > 0)
1891
+ for (let E = 0; E < n.length / 6; ++E) {
1892
+ const y = E * 6, b = n[y + 0], j = n[y + 1], L = n[y + 2], I = n[y + 3], D = n[y + 4], x = n[y + 5];
1893
+ n[y + 0] = (b + I) * 0.5, n[y + 1] = (j + D) * 0.5, n[y + 2] = (L + x) * 0.5, n[y + 3] = Math.sqrt(
1894
+ (I - b) ** 2 + (D - j) ** 2 + (x - L) ** 2
1750
1895
  ) * 0.5;
1751
1896
  }
1752
- f = !0;
1897
+ g = !0;
1753
1898
  }
1754
- if (_ && s && s.length > 0) {
1755
- u.x = x.x = s[0], u.y = x.y = s[1], u.z = x.z = s[2];
1756
- for (let w = 1; w < s.length / 3; w++) {
1757
- const p = w * 3;
1758
- u.x = Math.min(u.x, s[p + 0]), x.x = Math.max(x.x, s[p + 0]), u.y = Math.min(u.y, s[p + 1]), x.y = Math.max(x.y, s[p + 1]), u.z = Math.min(u.z, s[p + 2]), x.z = Math.max(x.z, s[p + 2]);
1899
+ if (z && r && r.length > 0) {
1900
+ h.x = p.x = r[0], h.y = p.y = r[1], h.z = p.z = r[2];
1901
+ for (let E = 1; E < r.length / 3; E++) {
1902
+ const y = E * 3;
1903
+ h.x = Math.min(h.x, r[y + 0]), p.x = Math.max(p.x, r[y + 0]), h.y = Math.min(h.y, r[y + 1]), p.y = Math.max(p.y, r[y + 1]), h.z = Math.min(h.z, r[y + 2]), p.z = Math.max(p.z, r[y + 2]);
1759
1904
  }
1760
- } else _ && s && s.length === 0 && (u.x = x.x = u.y = x.y = u.z = x.z = 0);
1761
- C.cameraPosition && (i = C.cameraPosition), C.cameraDirection && (m = C.cameraDirection), L();
1905
+ } else z && r && r.length === 0 && (h.x = p.x = h.y = p.y = h.z = p.z = 0);
1906
+ S.cameraPosition && (c = S.cameraPosition), S.cameraDirection && (m = S.cameraDirection), W();
1762
1907
  };
1763
1908
  }).toString()})();`;
1764
1909
  }
1765
1910
  }
1766
- class kt {
1911
+ class zt {
1767
1912
  constructor(e) {
1768
- M(this, "packedGeometry");
1913
+ w(this, "packedGeometry");
1769
1914
  // RGBA32UI
1770
- M(this, "packedColor");
1915
+ w(this, "packedColor");
1771
1916
  // RGBA8
1772
- M(this, "orderTexture");
1917
+ w(this, "orderTexture");
1773
1918
  // RB32UI
1774
- M(this, "width");
1775
- M(this, "height");
1919
+ w(this, "width");
1920
+ w(this, "height");
1776
1921
  this.width = e.textureWidth, this.height = e.textureHeight, this.packedColor = this.createColorTexture(e), this.packedGeometry = this.createGeometryTexture(e), this.orderTexture = this.createOrderTexture(e.numSplats);
1777
1922
  }
1778
1923
  createGeometryTexture(e) {
1779
- const t = new h.DataTexture(
1924
+ const t = new u.DataTexture(
1780
1925
  e.packedGeometry,
1781
1926
  this.width,
1782
1927
  this.height,
1783
- h.RGBAIntegerFormat,
1784
- h.UnsignedIntType
1928
+ u.RGBAIntegerFormat,
1929
+ u.UnsignedIntType
1785
1930
  );
1786
- return t.internalFormat = "RGBA32UI", t.minFilter = h.NearestFilter, t.magFilter = h.NearestFilter, t.needsUpdate = !0, t;
1931
+ return t.internalFormat = "RGBA32UI", t.minFilter = u.NearestFilter, t.magFilter = u.NearestFilter, t.needsUpdate = !0, t;
1787
1932
  }
1788
1933
  createColorTexture(e) {
1789
- const t = new h.DataTexture(
1934
+ const t = new u.DataTexture(
1790
1935
  e.packedColor,
1791
1936
  this.width,
1792
1937
  this.height,
1793
- h.RGBAFormat,
1794
- h.UnsignedByteType
1938
+ u.RGBAFormat,
1939
+ u.UnsignedByteType
1795
1940
  );
1796
- return t.minFilter = h.NearestFilter, t.magFilter = h.NearestFilter, t.needsUpdate = !0, t;
1941
+ return t.minFilter = u.NearestFilter, t.magFilter = u.NearestFilter, t.needsUpdate = !0, t;
1797
1942
  }
1798
1943
  createOrderTexture(e) {
1799
1944
  const t = new Uint32Array(this.width * this.height);
1800
- for (let s = 0; s < e; s++) t[s] = s;
1801
- const r = new h.DataTexture(
1945
+ for (let r = 0; r < e; r++) t[r] = r;
1946
+ const s = new u.DataTexture(
1802
1947
  t,
1803
1948
  this.width,
1804
1949
  this.height,
1805
- h.RedIntegerFormat,
1806
- h.UnsignedIntType
1950
+ u.RedIntegerFormat,
1951
+ u.UnsignedIntType
1807
1952
  );
1808
- return r.minFilter = h.NearestFilter, r.magFilter = h.NearestFilter, r.needsUpdate = !0, r;
1953
+ return s.minFilter = u.NearestFilter, s.magFilter = u.NearestFilter, s.needsUpdate = !0, s;
1809
1954
  }
1810
1955
  dispose() {
1811
1956
  this.packedGeometry.dispose(), this.packedColor.dispose(), this.orderTexture.dispose();
1812
1957
  }
1813
1958
  }
1814
- const Et = (
1959
+ const Bt = (
1815
1960
  /* glsl */
1816
1961
  `
1817
1962
  precision highp float;
@@ -2036,7 +2181,7 @@ void main() {
2036
2181
  vColor = vec4(max(clr.rgb, vec3(0.0)), clr.a);
2037
2182
  }
2038
2183
  `
2039
- ), Ct = (
2184
+ ), Pt = (
2040
2185
  /* glsl */
2041
2186
  `
2042
2187
  precision highp float;
@@ -2072,7 +2217,7 @@ void main(void) {
2072
2217
  }
2073
2218
  `
2074
2219
  );
2075
- class It extends h.ShaderMaterial {
2220
+ class Dt extends u.ShaderMaterial {
2076
2221
  constructor(e = {}) {
2077
2222
  const t = {
2078
2223
  // Packed Textures
@@ -2083,36 +2228,36 @@ class It extends h.ShaderMaterial {
2083
2228
  splatOrder: { value: null },
2084
2229
  // Index map
2085
2230
  // Decompression Ranges
2086
- meansMin: { value: new h.Vector3() },
2087
- meansMax: { value: new h.Vector3() },
2088
- scalesMin: { value: new h.Vector3() },
2089
- scalesMax: { value: new h.Vector3() },
2090
- sh0Min: { value: new h.Vector3() },
2091
- sh0Max: { value: new h.Vector3() },
2231
+ meansMin: { value: new u.Vector3() },
2232
+ meansMax: { value: new u.Vector3() },
2233
+ scalesMin: { value: new u.Vector3() },
2234
+ scalesMax: { value: new u.Vector3() },
2235
+ sh0Min: { value: new u.Vector3() },
2236
+ sh0Max: { value: new u.Vector3() },
2092
2237
  // Render State
2093
2238
  texWidth: { value: 0 },
2094
- viewport: { value: new h.Vector2(1, 1) },
2239
+ viewport: { value: new u.Vector2(1, 1) },
2095
2240
  numSplats: { value: 0 }
2096
2241
  };
2097
2242
  super({
2098
2243
  uniforms: t,
2099
- vertexShader: Et,
2100
- fragmentShader: Ct,
2244
+ vertexShader: Bt,
2245
+ fragmentShader: Pt,
2101
2246
  transparent: !0,
2102
- glslVersion: h.GLSL3,
2103
- blendSrc: h.OneFactor,
2104
- blendSrcAlpha: h.OneFactor,
2105
- blending: h.CustomBlending,
2106
- blendEquation: h.AddEquation,
2107
- blendEquationAlpha: h.AddEquation,
2108
- blendDst: h.OneMinusSrcAlphaFactor,
2109
- blendDstAlpha: h.OneMinusSrcAlphaFactor,
2247
+ glslVersion: u.GLSL3,
2248
+ blendSrc: u.OneFactor,
2249
+ blendSrcAlpha: u.OneFactor,
2250
+ blending: u.CustomBlending,
2251
+ blendEquation: u.AddEquation,
2252
+ blendEquationAlpha: u.AddEquation,
2253
+ blendDst: u.OneMinusSrcAlphaFactor,
2254
+ blendDstAlpha: u.OneMinusSrcAlphaFactor,
2110
2255
  depthTest: !0,
2111
2256
  depthWrite: !1,
2112
- side: h.DoubleSide,
2257
+ side: u.DoubleSide,
2113
2258
  alphaTest: e.alphaTest ?? 0,
2114
2259
  toneMapped: e.toneMapped ?? !1
2115
- }), e.alphaHash && (this.alphaHash = !0, this.depthWrite = !0, this.blending = h.NoBlending);
2260
+ }), e.alphaHash && (this.alphaHash = !0, this.depthWrite = !0, this.blending = u.NoBlending);
2116
2261
  }
2117
2262
  setTexWidth(e) {
2118
2263
  this.uniforms.texWidth.value = e | 0;
@@ -2157,40 +2302,40 @@ class It extends h.ShaderMaterial {
2157
2302
  this.uniforms.numSplats.value = e;
2158
2303
  }
2159
2304
  }
2160
- const de = class de extends h.Mesh {
2305
+ const xe = class xe extends u.Mesh {
2161
2306
  // Match shader constant
2162
2307
  /**
2163
2308
  * Create a new SplatMesh for rendering Gaussian splats
2164
2309
  * @param splatData The splat data to render
2165
2310
  * @param options Rendering options
2166
2311
  */
2167
- constructor(t, r = {}) {
2168
- const s = new It(r), a = de.createInstancedGeometry(t.numSplats, de.INSTANCE_SIZE);
2169
- super(a, s);
2170
- M(this, "sorter");
2171
- M(this, "options");
2172
- M(this, "splatData");
2173
- M(this, "textureManager");
2174
- M(this, "material");
2175
- M(this, "geometry");
2176
- M(this, "lastCameraPositionLocal", new h.Vector3());
2177
- M(this, "lastCameraDirectionLocal", new h.Vector3());
2178
- M(this, "invModelMatrix", new h.Matrix4());
2312
+ constructor(t, s = {}) {
2313
+ const r = new Dt(s), n = xe.createInstancedGeometry(t.numSplats, xe.INSTANCE_SIZE);
2314
+ super(n, r);
2315
+ w(this, "sorter");
2316
+ w(this, "options");
2317
+ w(this, "splatData");
2318
+ w(this, "textureManager");
2319
+ w(this, "material");
2320
+ w(this, "geometry");
2321
+ w(this, "lastCameraPositionLocal", new u.Vector3());
2322
+ w(this, "lastCameraDirectionLocal", new u.Vector3());
2323
+ w(this, "invModelMatrix", new u.Matrix4());
2179
2324
  // Cached inverse matrix
2180
- M(this, "_vpW", -1);
2181
- M(this, "_vpH", -1);
2182
- M(this, "_size", new h.Vector2());
2183
- M(this, "_camPosW", new h.Vector3());
2184
- M(this, "_camDirW", new h.Vector3());
2185
- M(this, "_camPosL", new h.Vector3());
2186
- M(this, "_camDirL", new h.Vector3());
2187
- M(this, "onSorterUpdated", (t) => {
2188
- const r = t.count;
2189
- this.geometry.instanceCount = Math.ceil(r / de.INSTANCE_SIZE), this.material.setNumSplats(r);
2325
+ w(this, "_vpW", -1);
2326
+ w(this, "_vpH", -1);
2327
+ w(this, "_size", new u.Vector2());
2328
+ w(this, "_camPosW", new u.Vector3());
2329
+ w(this, "_camDirW", new u.Vector3());
2330
+ w(this, "_camPosL", new u.Vector3());
2331
+ w(this, "_camDirL", new u.Vector3());
2332
+ w(this, "onSorterUpdated", (t) => {
2333
+ const s = t.count;
2334
+ this.geometry.instanceCount = Math.ceil(s / xe.INSTANCE_SIZE), this.material.setNumSplats(s);
2190
2335
  });
2191
- this.geometry = a, this.material = s, this.options = { autoSort: !0, ...r }, this.splatData = t, this.frustumCulled = !1, this.sorter = new At(), this.textureManager = new kt(t);
2336
+ this.geometry = n, this.material = r, this.options = { autoSort: !0, ...s }, this.splatData = t, this.frustumCulled = !1, this.sorter = new Tt(), this.textureManager = new zt(t);
2192
2337
  let o = this.createChunks() || void 0;
2193
- o === null && console.warn("Visus: Could not create sorter chunks, bounding box might be invalid."), o = void 0, this.sorter.addEventListener("updated", this.onSorterUpdated), this.sorter.init(this.textureManager.orderTexture, this.splatData.centers, o ?? void 0, !this.options.keepSplatData), this.material.setRanges(t.ranges), this.material.setTexWidth(t.textureWidth), this.material.setPackedColor(this.textureManager.packedColor), this.material.setOrderTexture(this.textureManager.orderTexture), this.material.setPackedGeometry(this.textureManager.packedGeometry), this.material.setNumSplats(0), this.geometry.boundingBox = t.boundingBox.toBox3(), this.geometry.boundingSphere = new h.Sphere(), this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere), this.options.keepSplatData || (this.splatData = null);
2338
+ o === null && console.warn("Visus: Could not create sorter chunks, bounding box might be invalid."), o = void 0, this.sorter.addEventListener("updated", this.onSorterUpdated), this.sorter.init(this.textureManager.orderTexture, this.splatData.centers, o ?? void 0, !this.options.keepSplatData), this.material.setRanges(t.ranges), this.material.setTexWidth(t.textureWidth), this.material.setPackedColor(this.textureManager.packedColor), this.material.setOrderTexture(this.textureManager.orderTexture), this.material.setPackedGeometry(this.textureManager.packedGeometry), this.material.setNumSplats(0), this.geometry.boundingBox = t.boundingBox.toBox3(), this.geometry.boundingSphere = new u.Sphere(), this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere), this.options.keepSplatData || (this.splatData = null);
2194
2339
  }
2195
2340
  /**
2196
2341
  * Creates the instanced geometry for rendering splats.
@@ -2198,8 +2343,8 @@ const de = class de extends h.Mesh {
2198
2343
  * @param instanceSize Number of splats per instance.
2199
2344
  * @returns InstancedBufferGeometry
2200
2345
  */
2201
- static createInstancedGeometry(t, r) {
2202
- const s = Math.ceil(t / r), a = new h.BufferGeometry(), o = new Float32Array([
2346
+ static createInstancedGeometry(t, s) {
2347
+ const r = Math.ceil(t / s), n = new u.BufferGeometry(), o = new Float32Array([
2203
2348
  // x, y, splat_index_in_instance
2204
2349
  -1,
2205
2350
  -1,
@@ -2213,24 +2358,24 @@ const de = class de extends h.Mesh {
2213
2358
  -1,
2214
2359
  1,
2215
2360
  0
2216
- ]), i = new Uint16Array([0, 1, 2, 0, 2, 3]), m = new Float32Array(4 * 3 * r);
2217
- for (let u = 0; u < r; u++) {
2218
- const x = u * 4 * 3;
2219
- for (let g = 0; g < 4; g++)
2220
- m[x + g * 3 + 0] = o[g * 3 + 0], m[x + g * 3 + 1] = o[g * 3 + 1], m[x + g * 3 + 2] = u;
2361
+ ]), c = new Uint16Array([0, 1, 2, 0, 2, 3]), m = new Float32Array(4 * 3 * s);
2362
+ for (let h = 0; h < s; h++) {
2363
+ const p = h * 4 * 3;
2364
+ for (let v = 0; v < 4; v++)
2365
+ m[p + v * 3 + 0] = o[v * 3 + 0], m[p + v * 3 + 1] = o[v * 3 + 1], m[p + v * 3 + 2] = h;
2221
2366
  }
2222
- const f = new Uint32Array(6 * r);
2223
- for (let u = 0; u < r; u++) {
2224
- const x = u * 6, g = u * 4;
2225
- f[x + 0] = i[0] + g, f[x + 1] = i[1] + g, f[x + 2] = i[2] + g, f[x + 3] = i[3] + g, f[x + 4] = i[4] + g, f[x + 5] = i[5] + g;
2367
+ const g = new Uint32Array(6 * s);
2368
+ for (let h = 0; h < s; h++) {
2369
+ const p = h * 6, v = h * 4;
2370
+ g[p + 0] = c[0] + v, g[p + 1] = c[1] + v, g[p + 2] = c[2] + v, g[p + 3] = c[3] + v, g[p + 4] = c[4] + v, g[p + 5] = c[5] + v;
2226
2371
  }
2227
- a.setAttribute("position", new h.BufferAttribute(m, 3)), a.setIndex(new h.BufferAttribute(f, 1));
2228
- const y = new h.InstancedBufferGeometry();
2229
- y.index = a.index, y.setAttribute("position", a.getAttribute("position"));
2230
- const l = new Uint32Array(s);
2231
- for (let u = 0; u < s; u++)
2232
- l[u] = u * r;
2233
- return y.setAttribute("splatInstanceIndex", new h.InstancedBufferAttribute(l, 1, !1)), y.instanceCount = 0, y;
2372
+ n.setAttribute("position", new u.BufferAttribute(m, 3)), n.setIndex(new u.BufferAttribute(g, 1));
2373
+ const f = new u.InstancedBufferGeometry();
2374
+ f.index = n.index, f.setAttribute("position", n.getAttribute("position"));
2375
+ const l = new Uint32Array(r);
2376
+ for (let h = 0; h < r; h++)
2377
+ l[h] = h * s;
2378
+ return f.setAttribute("splatInstanceIndex", new u.InstancedBufferAttribute(l, 1, !1)), f.instanceCount = 0, f;
2234
2379
  }
2235
2380
  /**
2236
2381
  * Create chunks data (bounding box min/max) for the sorter.
@@ -2254,8 +2399,8 @@ const de = class de extends h.Mesh {
2254
2399
  * @param width Viewport width
2255
2400
  * @param height Viewport height
2256
2401
  */
2257
- updateViewport(t, r) {
2258
- t === this._vpW && r === this._vpH || (this._vpW = t, this._vpH = r, this.material.updateViewport(t, r));
2402
+ updateViewport(t, s) {
2403
+ t === this._vpW && s === this._vpH || (this._vpW = t, this._vpH = s, this.material.updateViewport(t, s));
2259
2404
  }
2260
2405
  /**
2261
2406
  * Sorts splats based on camera position and direction.
@@ -2263,8 +2408,8 @@ const de = class de extends h.Mesh {
2263
2408
  */
2264
2409
  sort(t) {
2265
2410
  t.getWorldPosition(this._camPosW), t.getWorldDirection(this._camDirW), this.invModelMatrix.copy(this.matrixWorld).invert(), this._camPosL.copy(this._camPosW).applyMatrix4(this.invModelMatrix), this._camDirL.copy(this._camDirW).transformDirection(this.invModelMatrix);
2266
- const r = this.lastCameraPositionLocal.distanceToSquared(this._camPosL) > 1e-6, s = this.lastCameraDirectionLocal.dot(this._camDirL) < 0.999;
2267
- this.options.autoSort && (r || s) && (this.lastCameraPositionLocal.copy(this._camPosL), this.lastCameraDirectionLocal.copy(this._camDirL), this.sorter.setCamera(this._camPosL, this._camDirL));
2411
+ const s = this.lastCameraPositionLocal.distanceToSquared(this._camPosL) > 1e-6, r = this.lastCameraDirectionLocal.dot(this._camDirL) < 0.999;
2412
+ this.options.autoSort && (s || r) && (this.lastCameraPositionLocal.copy(this._camPosL), this.lastCameraDirectionLocal.copy(this._camDirL), this.sorter.setCamera(this._camPosL, this._camDirL));
2268
2413
  }
2269
2414
  /**
2270
2415
  * THREE.js hook called before rendering the object.
@@ -2275,8 +2420,8 @@ const de = class de extends h.Mesh {
2275
2420
  */
2276
2421
  // prettier-ignore
2277
2422
  // @ts-expect-error scene is not used
2278
- onBeforeRender(t, r, s) {
2279
- this.sort(s), t.getSize(this._size), this.updateViewport(this._size.x, this._size.y);
2423
+ onBeforeRender(t, s, r) {
2424
+ this.sort(r), t.getSize(this._size), this.updateViewport(this._size.x, this._size.y);
2280
2425
  }
2281
2426
  /**
2282
2427
  * Dispose of resources
@@ -2286,51 +2431,55 @@ const de = class de extends h.Mesh {
2286
2431
  }
2287
2432
  };
2288
2433
  /** Number of splats combined into a single instanced draw call. */
2289
- M(de, "INSTANCE_SIZE", 128);
2290
- let Te = de;
2291
- const ve = /* @__PURE__ */ new Map(), Ft = ({
2292
- url: n,
2434
+ w(xe, "INSTANCE_SIZE", 128);
2435
+ let De = xe;
2436
+ const Ae = /* @__PURE__ */ new Map(), jt = ({
2437
+ url: a,
2293
2438
  type: e,
2294
2439
  debug: t = !1,
2440
+ withCredentials: s = !1,
2295
2441
  splatOptions: r = {},
2296
- ...s
2442
+ ...n
2297
2443
  }) => {
2298
- if (!n) throw new Error('Splat component requires either "url" or "plyUrl" prop');
2299
- const a = Tt(n, e);
2300
- t && console.debug("SPLAT: rendering", { url: n, type: a, splatOptions: r, meshProps: s });
2301
- const [o, i] = Xe(null), m = Ze(null);
2302
- return Je(() => {
2303
- const f = Ne(n, a, r);
2304
- return _t(n, a, r).then(
2305
- (y) => {
2306
- i(y);
2307
- }
2308
- ), () => {
2309
- t && console.debug("SPLAT: releasing mesh for", n), zt(f);
2444
+ if (!a) throw new Error('Splat component requires either "url" or "plyUrl" prop');
2445
+ const o = Ft(a, e);
2446
+ t && console.debug("SPLAT: rendering", { url: a, type: o, splatOptions: r, meshProps: n });
2447
+ const [c, m] = tt(null), g = st(null);
2448
+ return rt(() => {
2449
+ const f = Je(a, o, r, s);
2450
+ return Ot(
2451
+ a,
2452
+ o,
2453
+ r,
2454
+ s
2455
+ ).then((l) => {
2456
+ m(l);
2457
+ }), () => {
2458
+ t && console.debug("SPLAT: releasing mesh for", a), Ut(f);
2310
2459
  };
2311
- }, [n, a, r, t]), o ? /* @__PURE__ */ tt.jsx("primitive", { ref: m, object: o, ...s }) : null;
2312
- }, Rt = (n) => {
2313
- const e = n.toLowerCase();
2314
- return e.endsWith(".ply") ? "ply" : e.endsWith(".sogs") || e.endsWith(".zip") || e.endsWith(".json") ? "sogs" : null;
2315
- }, Tt = (n, e) => {
2460
+ }, [a, o, r, s, t]), c ? /* @__PURE__ */ it.jsx("primitive", { ref: g, object: c, ...n }) : null;
2461
+ }, qt = (a) => {
2462
+ const e = a.toLowerCase();
2463
+ return e.endsWith(".ply") ? "ply" : e.endsWith(".sogs") || e.endsWith(".zip") || e.endsWith(".json") || e.endsWith(".sog") || e.endsWith(".sogs") || e.endsWith(".zip") ? "sogs" : null;
2464
+ }, Ft = (a, e) => {
2316
2465
  if (e) return e;
2317
- const t = Rt(n);
2466
+ const t = qt(a);
2318
2467
  if (t) return t;
2319
- throw new Error(`Cannot determine file type from URL: "${n}". `);
2320
- }, Ne = (n, e, t) => `${n}:${e}:${JSON.stringify(t)}`, _t = async (n, e, t) => {
2321
- const r = Ne(n, e, t), s = ve.get(r);
2322
- if (s)
2323
- return s.refCount++, s.mesh;
2324
- const o = await (e === "ply" ? new st() : new St()).loadAsync(n), i = new Te(o, t);
2325
- return ve.set(r, { mesh: i, refCount: 1 }), i;
2468
+ throw new Error(`Cannot determine file type from URL: "${a}". `);
2469
+ }, Je = (a, e, t, s) => `${a}:${e}:${JSON.stringify(t)}:${s}`, Ot = async (a, e, t, s) => {
2470
+ const r = Je(a, e, t, s), n = Ae.get(r);
2471
+ if (n)
2472
+ return n.refCount++, n.mesh;
2473
+ const c = await (e === "ply" ? new lt(void 0, { withCredentials: s }) : new _t(void 0, { withCredentials: s })).loadAsync(a), m = new De(c, t);
2474
+ return Ae.set(r, { mesh: m, refCount: 1 }), m;
2326
2475
  };
2327
- function zt(n) {
2328
- const e = ve.get(n);
2329
- e && (e.refCount--, e.refCount <= 0 && (e.mesh.dispose(), ve.delete(n)));
2476
+ function Ut(a) {
2477
+ const e = Ae.get(a);
2478
+ e && (e.refCount--, e.refCount <= 0 && (e.mesh.dispose(), Ae.delete(a)));
2330
2479
  }
2331
2480
  export {
2332
- st as PlyLoader,
2333
- St as SogsLoader,
2334
- Ft as Splat,
2335
- Te as SplatMesh
2481
+ lt as PlyLoader,
2482
+ _t as SogsLoader,
2483
+ jt as Splat,
2484
+ De as SplatMesh
2336
2485
  };