@takram/three-geospatial 0.0.1-alpha.8 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1,625 +1,2584 @@
1
- import { Loader as z, FileLoader as Y, BufferGeometry as J, BufferAttribute as _, Box3 as Z, Vector3 as u, Sphere as K, UnsignedByteType as tt, ByteType as et, FloatType as st, LinearFilter as B, ClampToEdgeWrapping as C, RGBAFormat as nt, Data3DTexture as it, DataTexture as rt, MathUtils as l, Material as M, Quaternion as ot, Matrix4 as at, Ray as ht, RepeatWrapping as F, NearestFilter as R, RedFormat as ct, Vector2 as v } from "three";
2
- import { E as j, G as w } from "./shared.js";
3
- import { a as xe } from "./shared.js";
4
- var lt = process.env.NODE_ENV === "production", G = "Invariant failed";
5
- function H(s, t) {
6
- if (!s) {
7
- if (lt)
8
- throw new Error(G);
9
- var e = G;
10
- throw new Error(e);
11
- }
12
- }
13
- class dt extends z {
14
- load(t, e, n, i) {
15
- const r = new Y(this.manager);
16
- r.setResponseType("arraybuffer"), r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
17
- t,
18
- (o) => {
19
- H(o instanceof ArrayBuffer);
1
+ import { Loader as Vt, FileLoader as _i, BufferGeometry as bi, BufferAttribute as Zr, Box3 as Ni, Vector3 as Re, Sphere as Oi, ByteType as Ui, UnsignedByteType as Hr, ShortType as mi, UnsignedShortType as Ci, IntType as Ri, UnsignedIntType as xi, HalfFloatType as lt, FloatType as ft, LinearFilter as kt, RGBAFormat as hn, Data3DTexture as fn, DataTexture as Fi, MathUtils as ye, Material as Jt, REVISION as Li, DataTextureLoader as Pi, RedFormat as vn, DataUtils as Gr, Quaternion as Mi, Matrix4 as Di, Ray as Bi, RepeatWrapping as or, NearestFilter as Wr, Vector2 as yn } from "three";
2
+ import { E as Xr, G as st } from "./shared.js";
3
+ import { a as la } from "./shared.js";
4
+ var zi = process.env.NODE_ENV === "production", Yr = "Invariant failed";
5
+ function _r(r, e) {
6
+ if (!r) {
7
+ if (zi)
8
+ throw new Error(Yr);
9
+ var i = Yr;
10
+ throw new Error(i);
11
+ }
12
+ }
13
+ class ki extends Vt {
14
+ load(e, i, s, o) {
15
+ const c = new _i(this.manager);
16
+ c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setPath(this.path), c.setWithCredentials(this.withCredentials), c.load(
17
+ e,
18
+ (l) => {
19
+ _r(l instanceof ArrayBuffer);
20
20
  try {
21
- e(o);
22
- } catch (a) {
23
- i != null ? i(a) : console.error(a), this.manager.itemError(t);
21
+ i(l);
22
+ } catch (v) {
23
+ o != null ? o(v) : console.error(v), this.manager.itemError(e);
24
24
  }
25
25
  },
26
- n,
27
- i
26
+ s,
27
+ o
28
28
  );
29
29
  }
30
30
  }
31
- function Dt(s) {
31
+ function To(r) {
32
32
  }
33
- function zt(s) {
34
- var r;
35
- const { attributes: t, index: e, boundingBox: n, boundingSphere: i } = s;
33
+ function Eo(r) {
34
+ var c;
35
+ const { attributes: e, index: i, boundingBox: s, boundingSphere: o } = r;
36
36
  return [
37
- { attributes: t, index: e, boundingBox: n, boundingSphere: i },
37
+ { attributes: e, index: i, boundingBox: s, boundingSphere: o },
38
38
  [
39
- ...Object.values(s.attributes).map(
40
- (o) => o.array.buffer
39
+ ...Object.values(r.attributes).map(
40
+ (l) => l.array.buffer
41
41
  ),
42
- (r = s.index) == null ? void 0 : r.array.buffer
43
- ].filter((o) => o != null)
42
+ (c = r.index) == null ? void 0 : c.array.buffer
43
+ ].filter((l) => l != null)
44
44
  ];
45
45
  }
46
- function Ot(s, t = new J()) {
47
- for (const [e, n] of Object.entries(s.attributes))
48
- t.setAttribute(
49
- e,
50
- new _(
51
- n.array,
52
- n.itemSize,
53
- n.normalized
46
+ function Io(r, e = new bi()) {
47
+ for (const [i, s] of Object.entries(r.attributes))
48
+ e.setAttribute(
49
+ i,
50
+ new Zr(
51
+ s.array,
52
+ s.itemSize,
53
+ s.normalized
54
54
  )
55
55
  );
56
- if (t.index = s.index != null ? new _(
57
- s.index.array,
58
- s.index.itemSize,
59
- s.index.normalized
60
- ) : null, s.boundingBox != null) {
61
- const { min: e, max: n } = s.boundingBox;
62
- t.boundingBox = new Z(
63
- new u(e.x, e.y, e.z),
64
- new u(n.x, n.y, n.z)
56
+ if (e.index = r.index != null ? new Zr(
57
+ r.index.array,
58
+ r.index.itemSize,
59
+ r.index.normalized
60
+ ) : null, r.boundingBox != null) {
61
+ const { min: i, max: s } = r.boundingBox;
62
+ e.boundingBox = new Ni(
63
+ new Re(i.x, i.y, i.z),
64
+ new Re(s.x, s.y, s.z)
65
+ );
66
+ }
67
+ if (r.boundingSphere != null) {
68
+ const { center: i, radius: s } = r.boundingSphere;
69
+ e.boundingSphere = new Oi(
70
+ new Re(i.x, i.y, i.z),
71
+ s
65
72
  );
66
73
  }
67
- if (s.boundingSphere != null) {
68
- const { center: e, radius: n } = s.boundingSphere;
69
- t.boundingSphere = new K(
70
- new u(e.x, e.y, e.z),
71
- n
74
+ return e;
75
+ }
76
+ const Zi = 128, Hi = 128, Gi = 64, _o = "https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/9627216cc50057994c98a2118f3c4a23765d43b9/packages/core/assets/stbn.bin", Wi = "This is not an object", Xi = "This is not a Float16Array object", qr = "This constructor is not a subclass of Float16Array", pn = "The constructor property value is not an object", Yi = "Species constructor didn't return TypedArray object", qi = "Derived constructor created TypedArray object which was too small length", vt = "Attempting to access detached ArrayBuffer", pr = "Cannot convert undefined or null to object", dr = "Cannot mix BigInt and other types, use explicit conversions", Vr = "@@iterator property is not callable", Jr = "Reduce of empty array with no initial value", Vi = "The comparison function must be either a function or undefined", ar = "Offset is out of bounds";
77
+ function Z(r) {
78
+ return (e, ...i) => ie(r, e, i);
79
+ }
80
+ function $e(r, e) {
81
+ return Z(
82
+ Ye(
83
+ r,
84
+ e
85
+ ).get
86
+ );
87
+ }
88
+ const {
89
+ apply: ie,
90
+ construct: ut,
91
+ defineProperty: $r,
92
+ get: cr,
93
+ getOwnPropertyDescriptor: Ye,
94
+ getPrototypeOf: At,
95
+ has: wr,
96
+ ownKeys: dn,
97
+ set: Qr,
98
+ setPrototypeOf: wn
99
+ } = Reflect, Ji = Proxy, {
100
+ EPSILON: $i,
101
+ MAX_SAFE_INTEGER: jr,
102
+ isFinite: An,
103
+ isNaN: qe
104
+ } = Number, {
105
+ iterator: Ie,
106
+ species: Qi,
107
+ toStringTag: br,
108
+ for: ji
109
+ } = Symbol, Ve = Object, {
110
+ create: $t,
111
+ defineProperty: gt,
112
+ freeze: Ki,
113
+ is: Kr
114
+ } = Ve, Ar = Ve.prototype, es = (
115
+ /** @type {any} */
116
+ Ar.__lookupGetter__ ? Z(
117
+ /** @type {any} */
118
+ Ar.__lookupGetter__
119
+ ) : (r, e) => {
120
+ if (r == null)
121
+ throw X(
122
+ pr
123
+ );
124
+ let i = Ve(r);
125
+ do {
126
+ const s = Ye(i, e);
127
+ if (s !== void 0)
128
+ return Ce(s, "get") ? s.get : void 0;
129
+ } while ((i = At(i)) !== null);
130
+ }
131
+ ), Ce = (
132
+ /** @type {any} */
133
+ Ve.hasOwn || Z(Ar.hasOwnProperty)
134
+ ), gn = Array, Sn = gn.isArray, Qt = gn.prototype, ts = Z(Qt.join), rs = Z(Qt.push), ns = Z(
135
+ Qt.toLocaleString
136
+ ), Nr = Qt[Ie], is = Z(Nr), {
137
+ abs: ss,
138
+ trunc: Tn
139
+ } = Math, jt = ArrayBuffer, os = jt.isView, En = jt.prototype, as = Z(En.slice), cs = $e(En, "byteLength"), gr = typeof SharedArrayBuffer < "u" ? SharedArrayBuffer : null, ls = gr && $e(gr.prototype, "byteLength"), Or = At(Uint8Array), us = Or.from, Q = Or.prototype, hs = Q[Ie], fs = Z(Q.keys), vs = Z(
140
+ Q.values
141
+ ), ys = Z(
142
+ Q.entries
143
+ ), ps = Z(Q.set), en = Z(
144
+ Q.reverse
145
+ ), ds = Z(Q.fill), ws = Z(
146
+ Q.copyWithin
147
+ ), tn = Z(Q.sort), ot = Z(Q.slice), As = Z(
148
+ Q.subarray
149
+ ), $ = $e(
150
+ Q,
151
+ "buffer"
152
+ ), Be = $e(
153
+ Q,
154
+ "byteOffset"
155
+ ), x = $e(
156
+ Q,
157
+ "length"
158
+ ), In = $e(
159
+ Q,
160
+ br
161
+ ), gs = Uint8Array, ce = Uint16Array, rn = (...r) => ie(us, ce, r), Ur = Uint32Array, Ss = Float32Array, ze = At([][Ie]()), Kt = Z(ze.next), Ts = Z(function* () {
162
+ }().next), Es = At(ze), Is = DataView.prototype, _s = Z(
163
+ Is.getUint16
164
+ ), X = TypeError, lr = RangeError, _n = WeakSet, bn = _n.prototype, bs = Z(bn.add), Ns = Z(bn.has), er = WeakMap, mr = er.prototype, Zt = Z(mr.get), Os = Z(mr.has), Cr = Z(mr.set), Nn = new er(), Us = $t(null, {
165
+ next: {
166
+ value: function() {
167
+ const e = Zt(Nn, this);
168
+ return Kt(e);
169
+ }
170
+ },
171
+ [Ie]: {
172
+ value: function() {
173
+ return this;
174
+ }
175
+ }
176
+ });
177
+ function ht(r) {
178
+ if (r[Ie] === Nr && ze.next === Kt)
179
+ return r;
180
+ const e = $t(Us);
181
+ return Cr(Nn, e, is(r)), e;
182
+ }
183
+ const On = new er(), Un = $t(Es, {
184
+ next: {
185
+ value: function() {
186
+ const e = Zt(On, this);
187
+ return Ts(e);
188
+ },
189
+ writable: !0,
190
+ configurable: !0
191
+ }
192
+ });
193
+ for (const r of dn(ze))
194
+ r !== "next" && gt(Un, r, Ye(ze, r));
195
+ function nn(r) {
196
+ const e = $t(Un);
197
+ return Cr(On, e, r), e;
198
+ }
199
+ function Ht(r) {
200
+ return r !== null && typeof r == "object" || typeof r == "function";
201
+ }
202
+ function sn(r) {
203
+ return r !== null && typeof r == "object";
204
+ }
205
+ function Gt(r) {
206
+ return In(r) !== void 0;
207
+ }
208
+ function Sr(r) {
209
+ const e = In(r);
210
+ return e === "BigInt64Array" || e === "BigUint64Array";
211
+ }
212
+ function ms(r) {
213
+ try {
214
+ return Sn(r) ? !1 : (cs(
215
+ /** @type {any} */
216
+ r
217
+ ), !0);
218
+ } catch {
219
+ return !1;
220
+ }
221
+ }
222
+ function mn(r) {
223
+ if (gr === null)
224
+ return !1;
225
+ try {
226
+ return ls(
227
+ /** @type {any} */
228
+ r
229
+ ), !0;
230
+ } catch {
231
+ return !1;
232
+ }
233
+ }
234
+ function Cs(r) {
235
+ return ms(r) || mn(r);
236
+ }
237
+ function on(r) {
238
+ return Sn(r) ? r[Ie] === Nr && ze.next === Kt : !1;
239
+ }
240
+ function Rs(r) {
241
+ return Gt(r) ? r[Ie] === hs && ze.next === Kt : !1;
242
+ }
243
+ function Ft(r) {
244
+ if (typeof r != "string")
245
+ return !1;
246
+ const e = +r;
247
+ return r !== e + "" || !An(e) ? !1 : e === Tn(e);
248
+ }
249
+ const Wt = ji("__Float16Array__");
250
+ function xs(r) {
251
+ if (!sn(r))
252
+ return !1;
253
+ const e = At(r);
254
+ if (!sn(e))
255
+ return !1;
256
+ const i = e.constructor;
257
+ if (i === void 0)
258
+ return !1;
259
+ if (!Ht(i))
260
+ throw X(pn);
261
+ return wr(i, Wt);
262
+ }
263
+ const Tr = 1 / $i;
264
+ function Fs(r) {
265
+ return r + Tr - Tr;
266
+ }
267
+ const Cn = 6103515625e-14, Ls = 65504, Rn = 9765625e-10, an = Rn * Cn, Ps = Rn * Tr;
268
+ function Ms(r) {
269
+ const e = +r;
270
+ if (!An(e) || e === 0)
271
+ return e;
272
+ const i = e > 0 ? 1 : -1, s = ss(e);
273
+ if (s < Cn)
274
+ return i * Fs(s / an) * an;
275
+ const o = (1 + Ps) * s, c = o - (o - s);
276
+ return c > Ls || qe(c) ? i * (1 / 0) : i * c;
277
+ }
278
+ const xn = new jt(4), Fn = new Ss(xn), Ln = new Ur(xn), we = new ce(512), Ae = new gs(512);
279
+ for (let r = 0; r < 256; ++r) {
280
+ const e = r - 127;
281
+ e < -24 ? (we[r] = 0, we[r | 256] = 32768, Ae[r] = 24, Ae[r | 256] = 24) : e < -14 ? (we[r] = 1024 >> -e - 14, we[r | 256] = 1024 >> -e - 14 | 32768, Ae[r] = -e - 1, Ae[r | 256] = -e - 1) : e <= 15 ? (we[r] = e + 15 << 10, we[r | 256] = e + 15 << 10 | 32768, Ae[r] = 13, Ae[r | 256] = 13) : e < 128 ? (we[r] = 31744, we[r | 256] = 64512, Ae[r] = 24, Ae[r | 256] = 24) : (we[r] = 31744, we[r | 256] = 64512, Ae[r] = 13, Ae[r | 256] = 13);
282
+ }
283
+ function Ee(r) {
284
+ Fn[0] = Ms(r);
285
+ const e = Ln[0], i = e >> 23 & 511;
286
+ return we[i] + ((e & 8388607) >> Ae[i]);
287
+ }
288
+ const Rr = new Ur(2048);
289
+ for (let r = 1; r < 1024; ++r) {
290
+ let e = r << 13, i = 0;
291
+ for (; !(e & 8388608); )
292
+ e <<= 1, i -= 8388608;
293
+ e &= -8388609, i += 947912704, Rr[r] = e | i;
294
+ }
295
+ for (let r = 1024; r < 2048; ++r)
296
+ Rr[r] = 939524096 + (r - 1024 << 13);
297
+ const Qe = new Ur(64);
298
+ for (let r = 1; r < 31; ++r)
299
+ Qe[r] = r << 23;
300
+ Qe[31] = 1199570944;
301
+ Qe[32] = 2147483648;
302
+ for (let r = 33; r < 63; ++r)
303
+ Qe[r] = 2147483648 + (r - 32 << 23);
304
+ Qe[63] = 3347054592;
305
+ const Pn = new ce(64);
306
+ for (let r = 1; r < 64; ++r)
307
+ r !== 32 && (Pn[r] = 1024);
308
+ function L(r) {
309
+ const e = r >> 10;
310
+ return Ln[0] = Rr[Pn[e] + (r & 1023)] + Qe[e], Fn[0];
311
+ }
312
+ function me(r) {
313
+ const e = +r;
314
+ return qe(e) || e === 0 ? 0 : Tn(e);
315
+ }
316
+ function ur(r) {
317
+ const e = me(r);
318
+ return e < 0 ? 0 : e < jr ? e : jr;
319
+ }
320
+ function Lt(r, e) {
321
+ if (!Ht(r))
322
+ throw X(Wi);
323
+ const i = r.constructor;
324
+ if (i === void 0)
325
+ return e;
326
+ if (!Ht(i))
327
+ throw X(pn);
328
+ const s = i[Qi];
329
+ return s ?? e;
330
+ }
331
+ function yt(r) {
332
+ if (mn(r))
333
+ return !1;
334
+ try {
335
+ return as(r, 0, 0), !1;
336
+ } catch {
337
+ }
338
+ return !0;
339
+ }
340
+ function cn(r, e) {
341
+ const i = qe(r), s = qe(e);
342
+ if (i && s)
343
+ return 0;
344
+ if (i)
345
+ return 1;
346
+ if (s || r < e)
347
+ return -1;
348
+ if (r > e)
349
+ return 1;
350
+ if (r === 0 && e === 0) {
351
+ const o = Kr(r, 0), c = Kr(e, 0);
352
+ if (!o && c)
353
+ return -1;
354
+ if (o && !c)
355
+ return 1;
356
+ }
357
+ return 0;
358
+ }
359
+ const xr = 2, Xt = new er();
360
+ function Xe(r) {
361
+ return Os(Xt, r) || !os(r) && xs(r);
362
+ }
363
+ function R(r) {
364
+ if (!Xe(r))
365
+ throw X(Xi);
366
+ }
367
+ function Pt(r, e) {
368
+ const i = Xe(r), s = Gt(r);
369
+ if (!i && !s)
370
+ throw X(Yi);
371
+ if (typeof e == "number") {
372
+ let o;
373
+ if (i) {
374
+ const c = O(r);
375
+ o = x(c);
376
+ } else
377
+ o = x(r);
378
+ if (o < e)
379
+ throw X(
380
+ qi
381
+ );
382
+ }
383
+ if (Sr(r))
384
+ throw X(dr);
385
+ }
386
+ function O(r) {
387
+ const e = Zt(Xt, r);
388
+ if (e !== void 0) {
389
+ const o = $(e);
390
+ if (yt(o))
391
+ throw X(vt);
392
+ return e;
393
+ }
394
+ const i = (
395
+ /** @type {any} */
396
+ r.buffer
397
+ );
398
+ if (yt(i))
399
+ throw X(vt);
400
+ const s = ut(P, [
401
+ i,
402
+ /** @type {any} */
403
+ r.byteOffset,
404
+ /** @type {any} */
405
+ r.length
406
+ ], r.constructor);
407
+ return Zt(Xt, s);
408
+ }
409
+ function ln(r) {
410
+ const e = x(r), i = [];
411
+ for (let s = 0; s < e; ++s)
412
+ i[s] = L(r[s]);
413
+ return i;
414
+ }
415
+ const Mn = new _n();
416
+ for (const r of dn(Q)) {
417
+ if (r === br)
418
+ continue;
419
+ const e = Ye(Q, r);
420
+ Ce(e, "get") && typeof e.get == "function" && bs(Mn, e.get);
421
+ }
422
+ const Ds = Ki(
423
+ /** @type {ProxyHandler<Float16BitsArray>} */
424
+ {
425
+ get(r, e, i) {
426
+ return Ft(e) && Ce(r, e) ? L(cr(r, e)) : Ns(Mn, es(r, e)) ? cr(r, e) : cr(r, e, i);
427
+ },
428
+ set(r, e, i, s) {
429
+ return Ft(e) && Ce(r, e) ? Qr(r, e, Ee(i)) : Qr(r, e, i, s);
430
+ },
431
+ getOwnPropertyDescriptor(r, e) {
432
+ if (Ft(e) && Ce(r, e)) {
433
+ const i = Ye(r, e);
434
+ return i.value = L(i.value), i;
435
+ }
436
+ return Ye(r, e);
437
+ },
438
+ defineProperty(r, e, i) {
439
+ return Ft(e) && Ce(r, e) && Ce(i, "value") && (i.value = Ee(i.value)), $r(r, e, i);
440
+ }
441
+ }
442
+ );
443
+ class P {
444
+ /** @see https://tc39.es/ecma262/#sec-typedarray */
445
+ constructor(e, i, s) {
446
+ let o;
447
+ if (Xe(e))
448
+ o = ut(ce, [O(e)], new.target);
449
+ else if (Ht(e) && !Cs(e)) {
450
+ let l, v;
451
+ if (Gt(e)) {
452
+ l = e, v = x(e);
453
+ const y = $(e);
454
+ if (yt(y))
455
+ throw X(vt);
456
+ if (Sr(e))
457
+ throw X(dr);
458
+ const E = new jt(
459
+ v * xr
460
+ );
461
+ o = ut(ce, [E], new.target);
462
+ } else {
463
+ const y = e[Ie];
464
+ if (y != null && typeof y != "function")
465
+ throw X(Vr);
466
+ y != null ? on(e) ? (l = e, v = e.length) : (l = [.../** @type {Iterable<unknown>} */
467
+ e], v = l.length) : (l = /** @type {ArrayLike<unknown>} */
468
+ e, v = ur(l.length)), o = ut(ce, [v], new.target);
469
+ }
470
+ for (let y = 0; y < v; ++y)
471
+ o[y] = Ee(l[y]);
472
+ } else
473
+ o = ut(ce, arguments, new.target);
474
+ const c = (
475
+ /** @type {any} */
476
+ new Ji(o, Ds)
72
477
  );
478
+ return Cr(Xt, c, o), c;
479
+ }
480
+ /**
481
+ * limitation: `Object.getOwnPropertyNames(Float16Array)` or `Reflect.ownKeys(Float16Array)` include this key
482
+ * @see https://tc39.es/ecma262/#sec-%typedarray%.from
483
+ */
484
+ static from(e, ...i) {
485
+ const s = this;
486
+ if (!wr(s, Wt))
487
+ throw X(
488
+ qr
489
+ );
490
+ if (s === P) {
491
+ if (Xe(e) && i.length === 0) {
492
+ const b = O(e), m = new ce(
493
+ $(b),
494
+ Be(b),
495
+ x(b)
496
+ );
497
+ return new P(
498
+ $(ot(m))
499
+ );
500
+ }
501
+ if (i.length === 0)
502
+ return new P(
503
+ $(
504
+ rn(e, Ee)
505
+ )
506
+ );
507
+ const y = i[0], E = i[1];
508
+ return new P(
509
+ $(
510
+ rn(e, function(b, ...m) {
511
+ return Ee(
512
+ ie(y, this, [b, ...ht(m)])
513
+ );
514
+ }, E)
515
+ )
516
+ );
517
+ }
518
+ let o, c;
519
+ const l = e[Ie];
520
+ if (l != null && typeof l != "function")
521
+ throw X(Vr);
522
+ if (l != null)
523
+ on(e) ? (o = e, c = e.length) : Rs(e) ? (o = e, c = x(e)) : (o = [...e], c = o.length);
524
+ else {
525
+ if (e == null)
526
+ throw X(
527
+ pr
528
+ );
529
+ o = Ve(e), c = ur(o.length);
530
+ }
531
+ const v = new s(c);
532
+ if (i.length === 0)
533
+ for (let y = 0; y < c; ++y)
534
+ v[y] = /** @type {number} */
535
+ o[y];
536
+ else {
537
+ const y = i[0], E = i[1];
538
+ for (let b = 0; b < c; ++b)
539
+ v[b] = ie(y, E, [o[b], b]);
540
+ }
541
+ return v;
542
+ }
543
+ /**
544
+ * limitation: `Object.getOwnPropertyNames(Float16Array)` or `Reflect.ownKeys(Float16Array)` include this key
545
+ * @see https://tc39.es/ecma262/#sec-%typedarray%.of
546
+ */
547
+ static of(...e) {
548
+ const i = this;
549
+ if (!wr(i, Wt))
550
+ throw X(
551
+ qr
552
+ );
553
+ const s = e.length;
554
+ if (i === P) {
555
+ const c = new P(s), l = O(c);
556
+ for (let v = 0; v < s; ++v)
557
+ l[v] = Ee(e[v]);
558
+ return c;
559
+ }
560
+ const o = new i(s);
561
+ for (let c = 0; c < s; ++c)
562
+ o[c] = e[c];
563
+ return o;
564
+ }
565
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys */
566
+ keys() {
567
+ R(this);
568
+ const e = O(this);
569
+ return fs(e);
570
+ }
571
+ /**
572
+ * limitation: returns a object whose prototype is not `%ArrayIteratorPrototype%`
573
+ * @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.values
574
+ */
575
+ values() {
576
+ R(this);
577
+ const e = O(this);
578
+ return nn(function* () {
579
+ for (const i of vs(e))
580
+ yield L(i);
581
+ }());
73
582
  }
74
- return t;
75
- }
76
- const ut = 128, ft = 128, pt = 64, Nt = "https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/9627216cc50057994c98a2118f3c4a23765d43b9/packages/core/assets/stbn.bin";
77
- function gt(s) {
78
- const t = s instanceof Int8Array ? "int8" : s instanceof Uint8Array || s instanceof Uint8ClampedArray ? "uint8" : s instanceof Int16Array ? "int16" : s instanceof Uint16Array ? "uint16" : s instanceof Int32Array ? "int32" : s instanceof Uint32Array ? "uint32" : s instanceof Float32Array ? "float32" : s instanceof Float64Array ? "float64" : null;
79
- return H(t != null), t;
80
- }
81
- let L;
82
- function yt() {
83
- if (L != null)
84
- return L;
85
- const s = new Uint32Array([268435456]);
86
- return L = new Uint8Array(s.buffer, s.byteOffset, s.byteLength)[0] === 0, L;
87
- }
88
- function g(s, t, e, n = !0) {
89
- if (n === yt())
90
- return new t(s);
91
- const i = new DataView(s), r = new t(i.byteLength / t.BYTES_PER_ELEMENT);
92
- for (let o = 0, a = 0; o < r.length; ++o, a += t.BYTES_PER_ELEMENT)
93
- r[o] = i[e](a, n);
94
- return r;
95
- }
96
- const wt = (s) => new Uint8Array(s), _t = (s) => new Int8Array(s), V = (s, t) => g(s, Uint16Array, "getUint16", t), X = (s, t) => g(s, Int16Array, "getInt16", t), Bt = (s, t) => g(s, Int32Array, "getInt32", t), Ct = (s, t) => g(s, Uint32Array, "getUint32", t), O = (s, t) => g(s, Float32Array, "getFloat32", t), Rt = (s, t) => g(s, Float64Array, "getFloat64", t);
97
- class mt extends z {
98
- load(t, e, n, i) {
99
- const r = new dt(this.manager);
100
- r.setRequestHeader(this.requestHeader), r.setPath(this.path), r.setWithCredentials(this.withCredentials), r.load(
101
- t,
102
- (o) => {
583
+ /**
584
+ * limitation: returns a object whose prototype is not `%ArrayIteratorPrototype%`
585
+ * @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries
586
+ */
587
+ entries() {
588
+ R(this);
589
+ const e = O(this);
590
+ return nn(function* () {
591
+ for (const [i, s] of ys(e))
592
+ yield (
593
+ /** @type {[number, number]} */
594
+ [i, L(s)]
595
+ );
596
+ }());
597
+ }
598
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.at */
599
+ at(e) {
600
+ R(this);
601
+ const i = O(this), s = x(i), o = me(e), c = o >= 0 ? o : s + o;
602
+ if (!(c < 0 || c >= s))
603
+ return L(i[c]);
604
+ }
605
+ /** @see https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.with */
606
+ with(e, i) {
607
+ R(this);
608
+ const s = O(this), o = x(s), c = me(e), l = c >= 0 ? c : o + c, v = +i;
609
+ if (l < 0 || l >= o)
610
+ throw lr(ar);
611
+ const y = new ce(
612
+ $(s),
613
+ Be(s),
614
+ x(s)
615
+ ), E = new P(
616
+ $(
617
+ ot(y)
618
+ )
619
+ ), b = O(E);
620
+ return b[l] = Ee(v), E;
621
+ }
622
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.map */
623
+ map(e, ...i) {
624
+ R(this);
625
+ const s = O(this), o = x(s), c = i[0], l = Lt(s, P);
626
+ if (l === P) {
627
+ const y = new P(o), E = O(y);
628
+ for (let b = 0; b < o; ++b) {
629
+ const m = L(s[b]);
630
+ E[b] = Ee(
631
+ ie(e, c, [m, b, this])
632
+ );
633
+ }
634
+ return y;
635
+ }
636
+ const v = new l(o);
637
+ Pt(v, o);
638
+ for (let y = 0; y < o; ++y) {
639
+ const E = L(s[y]);
640
+ v[y] = ie(e, c, [E, y, this]);
641
+ }
642
+ return (
643
+ /** @type {any} */
644
+ v
645
+ );
646
+ }
647
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter */
648
+ filter(e, ...i) {
649
+ R(this);
650
+ const s = O(this), o = x(s), c = i[0], l = [];
651
+ for (let E = 0; E < o; ++E) {
652
+ const b = L(s[E]);
653
+ ie(e, c, [b, E, this]) && rs(l, b);
654
+ }
655
+ const v = Lt(s, P), y = new v(l);
656
+ return Pt(y), /** @type {any} */
657
+ y;
658
+ }
659
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce */
660
+ reduce(e, ...i) {
661
+ R(this);
662
+ const s = O(this), o = x(s);
663
+ if (o === 0 && i.length === 0)
664
+ throw X(Jr);
665
+ let c, l;
666
+ i.length === 0 ? (c = L(s[0]), l = 1) : (c = i[0], l = 0);
667
+ for (let v = l; v < o; ++v)
668
+ c = e(
669
+ c,
670
+ L(s[v]),
671
+ v,
672
+ this
673
+ );
674
+ return c;
675
+ }
676
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright */
677
+ reduceRight(e, ...i) {
678
+ R(this);
679
+ const s = O(this), o = x(s);
680
+ if (o === 0 && i.length === 0)
681
+ throw X(Jr);
682
+ let c, l;
683
+ i.length === 0 ? (c = L(s[o - 1]), l = o - 2) : (c = i[0], l = o - 1);
684
+ for (let v = l; v >= 0; --v)
685
+ c = e(
686
+ c,
687
+ L(s[v]),
688
+ v,
689
+ this
690
+ );
691
+ return c;
692
+ }
693
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach */
694
+ forEach(e, ...i) {
695
+ R(this);
696
+ const s = O(this), o = x(s), c = i[0];
697
+ for (let l = 0; l < o; ++l)
698
+ ie(e, c, [
699
+ L(s[l]),
700
+ l,
701
+ this
702
+ ]);
703
+ }
704
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.find */
705
+ find(e, ...i) {
706
+ R(this);
707
+ const s = O(this), o = x(s), c = i[0];
708
+ for (let l = 0; l < o; ++l) {
709
+ const v = L(s[l]);
710
+ if (ie(e, c, [v, l, this]))
711
+ return v;
712
+ }
713
+ }
714
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex */
715
+ findIndex(e, ...i) {
716
+ R(this);
717
+ const s = O(this), o = x(s), c = i[0];
718
+ for (let l = 0; l < o; ++l) {
719
+ const v = L(s[l]);
720
+ if (ie(e, c, [v, l, this]))
721
+ return l;
722
+ }
723
+ return -1;
724
+ }
725
+ /** @see https://tc39.es/proposal-array-find-from-last/index.html#sec-%typedarray%.prototype.findlast */
726
+ findLast(e, ...i) {
727
+ R(this);
728
+ const s = O(this), o = x(s), c = i[0];
729
+ for (let l = o - 1; l >= 0; --l) {
730
+ const v = L(s[l]);
731
+ if (ie(e, c, [v, l, this]))
732
+ return v;
733
+ }
734
+ }
735
+ /** @see https://tc39.es/proposal-array-find-from-last/index.html#sec-%typedarray%.prototype.findlastindex */
736
+ findLastIndex(e, ...i) {
737
+ R(this);
738
+ const s = O(this), o = x(s), c = i[0];
739
+ for (let l = o - 1; l >= 0; --l) {
740
+ const v = L(s[l]);
741
+ if (ie(e, c, [v, l, this]))
742
+ return l;
743
+ }
744
+ return -1;
745
+ }
746
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.every */
747
+ every(e, ...i) {
748
+ R(this);
749
+ const s = O(this), o = x(s), c = i[0];
750
+ for (let l = 0; l < o; ++l)
751
+ if (!ie(e, c, [
752
+ L(s[l]),
753
+ l,
754
+ this
755
+ ]))
756
+ return !1;
757
+ return !0;
758
+ }
759
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.some */
760
+ some(e, ...i) {
761
+ R(this);
762
+ const s = O(this), o = x(s), c = i[0];
763
+ for (let l = 0; l < o; ++l)
764
+ if (ie(e, c, [
765
+ L(s[l]),
766
+ l,
767
+ this
768
+ ]))
769
+ return !0;
770
+ return !1;
771
+ }
772
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.set */
773
+ set(e, ...i) {
774
+ R(this);
775
+ const s = O(this), o = me(i[0]);
776
+ if (o < 0)
777
+ throw lr(ar);
778
+ if (e == null)
779
+ throw X(
780
+ pr
781
+ );
782
+ if (Sr(e))
783
+ throw X(
784
+ dr
785
+ );
786
+ if (Xe(e))
787
+ return ps(
788
+ O(this),
789
+ O(e),
790
+ o
791
+ );
792
+ if (Gt(e)) {
793
+ const y = $(e);
794
+ if (yt(y))
795
+ throw X(vt);
796
+ }
797
+ const c = x(s), l = Ve(e), v = ur(l.length);
798
+ if (o === 1 / 0 || v + o > c)
799
+ throw lr(ar);
800
+ for (let y = 0; y < v; ++y)
801
+ s[y + o] = Ee(l[y]);
802
+ }
803
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse */
804
+ reverse() {
805
+ R(this);
806
+ const e = O(this);
807
+ return en(e), this;
808
+ }
809
+ /** @see https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toReversed */
810
+ toReversed() {
811
+ R(this);
812
+ const e = O(this), i = new ce(
813
+ $(e),
814
+ Be(e),
815
+ x(e)
816
+ ), s = new P(
817
+ $(
818
+ ot(i)
819
+ )
820
+ ), o = O(s);
821
+ return en(o), s;
822
+ }
823
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill */
824
+ fill(e, ...i) {
825
+ R(this);
826
+ const s = O(this);
827
+ return ds(
828
+ s,
829
+ Ee(e),
830
+ ...ht(i)
831
+ ), this;
832
+ }
833
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin */
834
+ copyWithin(e, i, ...s) {
835
+ R(this);
836
+ const o = O(this);
837
+ return ws(o, e, i, ...ht(s)), this;
838
+ }
839
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort */
840
+ sort(e) {
841
+ R(this);
842
+ const i = O(this), s = e !== void 0 ? e : cn;
843
+ return tn(i, (o, c) => s(L(o), L(c))), this;
844
+ }
845
+ /** @see https://tc39.es/proposal-change-array-by-copy/#sec-%typedarray%.prototype.toSorted */
846
+ toSorted(e) {
847
+ R(this);
848
+ const i = O(this);
849
+ if (e !== void 0 && typeof e != "function")
850
+ throw new X(Vi);
851
+ const s = e !== void 0 ? e : cn, o = new ce(
852
+ $(i),
853
+ Be(i),
854
+ x(i)
855
+ ), c = new P(
856
+ $(
857
+ ot(o)
858
+ )
859
+ ), l = O(c);
860
+ return tn(l, (v, y) => s(L(v), L(y))), c;
861
+ }
862
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice */
863
+ slice(e, i) {
864
+ R(this);
865
+ const s = O(this), o = Lt(s, P);
866
+ if (o === P) {
867
+ const Ze = new ce(
868
+ $(s),
869
+ Be(s),
870
+ x(s)
871
+ );
872
+ return new P(
873
+ $(
874
+ ot(Ze, e, i)
875
+ )
876
+ );
877
+ }
878
+ const c = x(s), l = me(e), v = i === void 0 ? c : me(i);
879
+ let y;
880
+ l === -1 / 0 ? y = 0 : l < 0 ? y = c + l > 0 ? c + l : 0 : y = c < l ? c : l;
881
+ let E;
882
+ v === -1 / 0 ? E = 0 : v < 0 ? E = c + v > 0 ? c + v : 0 : E = c < v ? c : v;
883
+ const b = E - y > 0 ? E - y : 0, m = new o(b);
884
+ if (Pt(m, b), b === 0)
885
+ return m;
886
+ const q = $(s);
887
+ if (yt(q))
888
+ throw X(vt);
889
+ let se = 0;
890
+ for (; y < E; )
891
+ m[se] = L(s[y]), ++y, ++se;
892
+ return (
893
+ /** @type {any} */
894
+ m
895
+ );
896
+ }
897
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray */
898
+ subarray(e, i) {
899
+ R(this);
900
+ const s = O(this), o = Lt(s, P), c = new ce(
901
+ $(s),
902
+ Be(s),
903
+ x(s)
904
+ ), l = As(c, e, i), v = new o(
905
+ $(l),
906
+ Be(l),
907
+ x(l)
908
+ );
909
+ return Pt(v), /** @type {any} */
910
+ v;
911
+ }
912
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof */
913
+ indexOf(e, ...i) {
914
+ R(this);
915
+ const s = O(this), o = x(s);
916
+ let c = me(i[0]);
917
+ if (c === 1 / 0)
918
+ return -1;
919
+ c < 0 && (c += o, c < 0 && (c = 0));
920
+ for (let l = c; l < o; ++l)
921
+ if (Ce(s, l) && L(s[l]) === e)
922
+ return l;
923
+ return -1;
924
+ }
925
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof */
926
+ lastIndexOf(e, ...i) {
927
+ R(this);
928
+ const s = O(this), o = x(s);
929
+ let c = i.length >= 1 ? me(i[0]) : o - 1;
930
+ if (c === -1 / 0)
931
+ return -1;
932
+ c >= 0 ? c = c < o - 1 ? c : o - 1 : c += o;
933
+ for (let l = c; l >= 0; --l)
934
+ if (Ce(s, l) && L(s[l]) === e)
935
+ return l;
936
+ return -1;
937
+ }
938
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes */
939
+ includes(e, ...i) {
940
+ R(this);
941
+ const s = O(this), o = x(s);
942
+ let c = me(i[0]);
943
+ if (c === 1 / 0)
944
+ return !1;
945
+ c < 0 && (c += o, c < 0 && (c = 0));
946
+ const l = qe(e);
947
+ for (let v = c; v < o; ++v) {
948
+ const y = L(s[v]);
949
+ if (l && qe(y) || y === e)
950
+ return !0;
951
+ }
952
+ return !1;
953
+ }
954
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.join */
955
+ join(e) {
956
+ R(this);
957
+ const i = O(this), s = ln(i);
958
+ return ts(s, e);
959
+ }
960
+ /** @see https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring */
961
+ toLocaleString(...e) {
962
+ R(this);
963
+ const i = O(this), s = ln(i);
964
+ return ns(s, ...ht(e));
965
+ }
966
+ /** @see https://tc39.es/ecma262/#sec-get-%typedarray%.prototype-@@tostringtag */
967
+ get [br]() {
968
+ if (Xe(this))
969
+ return (
970
+ /** @type {any} */
971
+ "Float16Array"
972
+ );
973
+ }
974
+ }
975
+ gt(P, "BYTES_PER_ELEMENT", {
976
+ value: xr
977
+ });
978
+ gt(P, Wt, {});
979
+ wn(P, Or);
980
+ const Yt = P.prototype;
981
+ gt(Yt, "BYTES_PER_ELEMENT", {
982
+ value: xr
983
+ });
984
+ gt(Yt, Ie, {
985
+ value: Yt.values,
986
+ writable: !0,
987
+ configurable: !0
988
+ });
989
+ wn(Yt, Q);
990
+ function Bs(r, e, ...i) {
991
+ return L(
992
+ _s(r, e, ...ht(i))
993
+ );
994
+ }
995
+ function bo(r) {
996
+ const e = r instanceof Int8Array ? "int8" : r instanceof Uint8Array || r instanceof Uint8ClampedArray ? "uint8" : r instanceof Int16Array ? "int16" : r instanceof Uint16Array ? "uint16" : r instanceof Int32Array ? "int32" : r instanceof Uint32Array ? "uint32" : r instanceof P ? "float16" : r instanceof Float32Array ? "float32" : r instanceof Float64Array ? "float64" : null;
997
+ return _r(e != null), e;
998
+ }
999
+ function No(r) {
1000
+ return r instanceof Int8Array || r instanceof Uint8Array || r instanceof Uint8ClampedArray || r instanceof Int16Array || r instanceof Uint16Array || r instanceof Int32Array || r instanceof Uint32Array || r instanceof P || r instanceof Float32Array || r instanceof Float64Array;
1001
+ }
1002
+ let Mt;
1003
+ function zs() {
1004
+ if (Mt != null)
1005
+ return Mt;
1006
+ const r = new Uint32Array([268435456]);
1007
+ return Mt = new Uint8Array(r.buffer, r.byteOffset, r.byteLength)[0] === 0, Mt;
1008
+ }
1009
+ function ke(r, e, i, s = !0) {
1010
+ if (s === zs())
1011
+ return new e(r);
1012
+ const o = Object.assign(new DataView(r), {
1013
+ getFloat16(l, v) {
1014
+ return Bs(this, l, v);
1015
+ }
1016
+ }), c = new e(o.byteLength / e.BYTES_PER_ELEMENT);
1017
+ for (let l = 0, v = 0; l < c.length; ++l, v += e.BYTES_PER_ELEMENT)
1018
+ c[l] = o[i](v, s);
1019
+ return c;
1020
+ }
1021
+ const ks = (r) => new Uint8Array(r), Oo = (r) => new Int8Array(r), Zs = (r, e) => ke(r, Uint16Array, "getUint16", e), Hs = (r, e) => ke(r, Int16Array, "getInt16", e), Uo = (r, e) => ke(r, Int32Array, "getInt32", e), mo = (r, e) => ke(r, Uint32Array, "getUint32", e), Co = (r, e) => ke(r, P, "getFloat16", e), Gs = (r, e) => ke(r, Float32Array, "getFloat32", e), Ro = (r, e) => ke(r, Float64Array, "getFloat64", e);
1022
+ class Ws extends Vt {
1023
+ load(e, i, s, o) {
1024
+ const c = new ki(this.manager);
1025
+ c.setRequestHeader(this.requestHeader), c.setPath(this.path), c.setWithCredentials(this.withCredentials), c.load(
1026
+ e,
1027
+ (l) => {
103
1028
  try {
104
- e(this.parseTypedArray(o));
105
- } catch (a) {
106
- i != null ? i(a) : console.error(a), this.manager.itemError(t);
1029
+ i(this.parseTypedArray(l));
1030
+ } catch (v) {
1031
+ o != null ? o(v) : console.error(v), this.manager.itemError(e);
107
1032
  }
108
1033
  },
109
- n,
110
- i
1034
+ s,
1035
+ o
111
1036
  );
112
1037
  }
113
1038
  }
114
- function b(s) {
115
- return class extends mt {
1039
+ function St(r) {
1040
+ return class extends Ws {
116
1041
  constructor() {
117
- super(...arguments), this.parseTypedArray = s;
1042
+ super(...arguments), this.parseTypedArray = r;
118
1043
  }
119
1044
  };
120
1045
  }
121
- function jt(s) {
122
- return new (b(s))();
1046
+ function xo(r) {
1047
+ return new (St(r))();
1048
+ }
1049
+ const Fo = /* @__PURE__ */ St(Hs), Lo = /* @__PURE__ */ St(Zs), Po = /* @__PURE__ */ St(Gs);
1050
+ function Xs(r) {
1051
+ const e = r instanceof Int8Array ? Ui : r instanceof Uint8Array ? Hr : r instanceof Uint8ClampedArray ? Hr : r instanceof Int16Array ? mi : r instanceof Uint16Array ? Ci : r instanceof Int32Array ? Ri : r instanceof Uint32Array ? xi : r instanceof P ? lt : r instanceof Float32Array ? ft : r instanceof Float64Array ? ft : null;
1052
+ return _r(e != null), e;
123
1053
  }
124
- const Gt = /* @__PURE__ */ b(X), qt = /* @__PURE__ */ b(V), vt = /* @__PURE__ */ b(O), xt = {
125
- format: nt,
126
- wrapS: C,
127
- wrapT: C,
128
- minFilter: B,
129
- magFilter: B
1054
+ const Ys = {
1055
+ format: hn,
1056
+ minFilter: kt,
1057
+ magFilter: kt
130
1058
  };
131
- class Tt extends z {
1059
+ class qs extends Vt {
132
1060
  constructor() {
133
1061
  super(...arguments), this.parameters = {};
134
1062
  }
135
- load(t, e, n, i) {
136
- const r = new this.Texture(), o = new this.TypedArrayLoader(this.manager);
137
- o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(this.withCredentials), o.load(
138
- t,
139
- (a) => {
140
- r.image.data = a;
141
- const { width: h, height: c, depth: f, ...y } = this.parameters;
142
- h != null && (r.image.width = h), c != null && (r.image.height = c), "depth" in r.image && f != null && (r.image.depth = f);
143
- const A = gt(a);
144
- r.type = A === "uint8" ? tt : A === "int8" ? et : st, Object.assign(r, y), r.needsUpdate = !0, e(r);
1063
+ load(e, i, s, o) {
1064
+ const c = new this.Texture(), l = new this.TypedArrayLoader(this.manager);
1065
+ l.setRequestHeader(this.requestHeader), l.setPath(this.path), l.setWithCredentials(this.withCredentials), l.load(
1066
+ e,
1067
+ (v) => {
1068
+ c.image.data = v instanceof P ? new Uint16Array(v.buffer) : v;
1069
+ const { width: y, height: E, depth: b, ...m } = this.parameters;
1070
+ y != null && (c.image.width = y), E != null && (c.image.height = E), "depth" in c.image && b != null && (c.image.depth = b), c.type = Xs(v), Object.assign(c, m), c.needsUpdate = !0, i(c);
145
1071
  },
146
- n,
147
- i
1072
+ s,
1073
+ o
148
1074
  );
149
1075
  }
150
1076
  }
151
- function W(s, t, e) {
152
- return class extends Tt {
1077
+ function Dn(r, e, i) {
1078
+ return class extends qs {
153
1079
  constructor() {
154
- super(...arguments), this.Texture = s, this.TypedArrayLoader = b(t), this.parameters = {
155
- ...xt,
156
- ...e
1080
+ super(...arguments), this.Texture = r, this.TypedArrayLoader = St(e), this.parameters = {
1081
+ ...Ys,
1082
+ ...i
157
1083
  };
158
1084
  }
159
1085
  };
160
1086
  }
161
- function N(s, t) {
162
- return W(it, s, t);
1087
+ function Bn(r, e) {
1088
+ return Dn(fn, r, e);
163
1089
  }
164
- function U(s, t) {
165
- return W(rt, s, t);
1090
+ function Vs(r, e) {
1091
+ return Dn(Fi, r, e);
166
1092
  }
167
- function Ht(s, t) {
168
- return new (N(s, t))();
1093
+ function Mo(r, e) {
1094
+ return new (Bn(r, e))();
169
1095
  }
170
- function Vt(s, t) {
171
- return new (U(s, t))();
1096
+ function Do(r, e) {
1097
+ return new (Vs(r, e))();
172
1098
  }
173
- const Xt = /* @__PURE__ */ U(X), Wt = /* @__PURE__ */ U(V), kt = /* @__PURE__ */ U(O), $t = /* @__PURE__ */ N(O), p = l.clamp, Qt = l.euclideanModulo, Yt = l.inverseLerp, Jt = l.lerp, Zt = l.degToRad, Kt = l.radToDeg, te = l.isPowerOfTwo, ee = l.ceilPowerOfTwo, se = l.floorPowerOfTwo, ne = l.normalize;
174
- function ie(s, t, e, n = 0, i = 1) {
175
- return l.mapLinear(s, t, e, n, i);
1099
+ const Je = ye.clamp, Bo = ye.euclideanModulo, zo = ye.inverseLerp, ko = ye.lerp, Zo = ye.degToRad, Ho = ye.radToDeg, Go = ye.isPowerOfTwo, Wo = ye.ceilPowerOfTwo, Xo = ye.floorPowerOfTwo, Yo = ye.normalize;
1100
+ function qo(r, e, i, s = 0, o = 1) {
1101
+ return ye.mapLinear(r, e, i, s, o);
176
1102
  }
177
- function re(s, t, e, n = 0, i = 1) {
178
- return p(l.mapLinear(s, t, e, n, i), n, i);
1103
+ function Vo(r, e, i, s = 0, o = 1) {
1104
+ return Je(ye.mapLinear(r, e, i, s, o), s, o);
179
1105
  }
180
- function oe(s, t, e) {
181
- return e <= s ? 0 : e >= t ? 1 : (e = (e - s) / (t - s), e * e * (3 - 2 * e));
1106
+ function Jo(r, e, i) {
1107
+ return i <= r ? 0 : i >= e ? 1 : (i = (i - r) / (e - r), i * i * (3 - 2 * i));
182
1108
  }
183
- function ae(s) {
184
- return Math.min(Math.max(s, 0), 1);
1109
+ function $o(r) {
1110
+ return Math.min(Math.max(r, 0), 1);
185
1111
  }
186
- function he(s, t, e, n = e) {
187
- const i = Math.abs(s - t);
188
- return i <= n || i <= e * Math.max(Math.abs(s), Math.abs(t));
1112
+ function Qo(r, e, i, s = i) {
1113
+ const o = Math.abs(r - e);
1114
+ return o <= s || o <= i * Math.max(Math.abs(r), Math.abs(e));
189
1115
  }
190
- function ce(s) {
191
- return (t, e) => {
192
- t instanceof M ? Object.defineProperty(t, e, {
1116
+ function jo(r) {
1117
+ return (e, i) => {
1118
+ e instanceof Jt ? Object.defineProperty(e, i, {
193
1119
  enumerable: !0,
194
1120
  get() {
195
- var n;
196
- return ((n = this.defines) == null ? void 0 : n[s]) != null;
1121
+ var s;
1122
+ return ((s = this.defines) == null ? void 0 : s[r]) != null;
197
1123
  },
198
- set(n) {
199
- var i;
200
- n !== this[e] && (n ? (this.defines ?? (this.defines = {}), this.defines[s] = "1") : (i = this.defines) == null || delete i[s], this.needsUpdate = !0);
1124
+ set(s) {
1125
+ var o;
1126
+ s !== this[i] && (s ? (this.defines ?? (this.defines = {}), this.defines[r] = "1") : (o = this.defines) == null || delete o[r], this.needsUpdate = !0);
201
1127
  }
202
- }) : Object.defineProperty(t, e, {
1128
+ }) : Object.defineProperty(e, i, {
203
1129
  enumerable: !0,
204
1130
  get() {
205
- return this.defines.has(s);
1131
+ return this.defines.has(r);
206
1132
  },
207
- set(n) {
208
- n !== this[e] && (n ? this.defines.set(s, "1") : this.defines.delete(s), this.setChanged());
1133
+ set(s) {
1134
+ s !== this[i] && (s ? this.defines.set(r, "1") : this.defines.delete(r), this.setChanged());
209
1135
  }
210
1136
  });
211
1137
  };
212
1138
  }
213
- function le(s, {
214
- min: t = Number.MIN_SAFE_INTEGER,
215
- max: e = Number.MAX_SAFE_INTEGER
1139
+ function Ko(r, {
1140
+ min: e = Number.MIN_SAFE_INTEGER,
1141
+ max: i = Number.MAX_SAFE_INTEGER
216
1142
  } = {}) {
217
- return (n, i) => {
218
- n instanceof M ? Object.defineProperty(n, i, {
1143
+ return (s, o) => {
1144
+ s instanceof Jt ? Object.defineProperty(s, o, {
219
1145
  enumerable: !0,
220
1146
  get() {
221
- var o;
222
- const r = (o = this.defines) == null ? void 0 : o[s];
223
- return r != null ? parseInt(r) : 0;
1147
+ var l;
1148
+ const c = (l = this.defines) == null ? void 0 : l[r];
1149
+ return c != null ? parseInt(c) : 0;
224
1150
  },
225
- set(r) {
226
- const o = this[i];
227
- r !== o && (this.defines ?? (this.defines = {}), this.defines[s] = p(r, t, e).toFixed(0), this.needsUpdate = !0);
1151
+ set(c) {
1152
+ const l = this[o];
1153
+ c !== l && (this.defines ?? (this.defines = {}), this.defines[r] = Je(c, e, i).toFixed(0), this.needsUpdate = !0);
228
1154
  }
229
- }) : Object.defineProperty(n, i, {
1155
+ }) : Object.defineProperty(s, o, {
230
1156
  enumerable: !0,
231
1157
  get() {
232
- const r = this.defines.get(s);
233
- return r != null ? parseInt(r) : 0;
1158
+ const c = this.defines.get(r);
1159
+ return c != null ? parseInt(c) : 0;
234
1160
  },
235
- set(r) {
236
- const o = this[i];
237
- r !== o && (this.defines.set(s, p(r, t, e).toFixed(0)), this.setChanged());
1161
+ set(c) {
1162
+ const l = this[o];
1163
+ c !== l && (this.defines.set(r, Je(c, e, i).toFixed(0)), this.setChanged());
238
1164
  }
239
1165
  });
240
1166
  };
241
1167
  }
242
- function de(s, {
243
- min: t = -1 / 0,
244
- max: e = 1 / 0,
245
- precision: n = 7
1168
+ function ea(r, {
1169
+ min: e = -1 / 0,
1170
+ max: i = 1 / 0,
1171
+ precision: s = 7
246
1172
  } = {}) {
247
- return (i, r) => {
248
- i instanceof M ? Object.defineProperty(i, r, {
1173
+ return (o, c) => {
1174
+ o instanceof Jt ? Object.defineProperty(o, c, {
249
1175
  enumerable: !0,
250
1176
  get() {
251
- var a;
252
- const o = (a = this.defines) == null ? void 0 : a[s];
253
- return o != null ? parseFloat(o) : 0;
1177
+ var v;
1178
+ const l = (v = this.defines) == null ? void 0 : v[r];
1179
+ return l != null ? parseFloat(l) : 0;
254
1180
  },
255
- set(o) {
256
- const a = this[r];
257
- o !== a && (this.defines ?? (this.defines = {}), this.defines[s] = p(o, t, e).toFixed(n), this.needsUpdate = !0);
1181
+ set(l) {
1182
+ const v = this[c];
1183
+ l !== v && (this.defines ?? (this.defines = {}), this.defines[r] = Je(l, e, i).toFixed(s), this.needsUpdate = !0);
258
1184
  }
259
- }) : Object.defineProperty(i, r, {
1185
+ }) : Object.defineProperty(o, c, {
260
1186
  enumerable: !0,
261
1187
  get() {
262
- const o = this.defines.get(s);
263
- return o != null ? parseFloat(o) : 0;
1188
+ const l = this.defines.get(r);
1189
+ return l != null ? parseFloat(l) : 0;
264
1190
  },
265
- set(o) {
266
- const a = this[r];
267
- o !== a && (this.defines.set(s, p(o, t, e).toFixed(n)), this.setChanged());
1191
+ set(l) {
1192
+ const v = this[c];
1193
+ l !== v && (this.defines.set(r, Je(l, e, i).toFixed(s)), this.setChanged());
268
1194
  }
269
1195
  });
270
1196
  };
271
1197
  }
272
- function ue(s, { validate: t } = {}) {
273
- return (e, n) => {
274
- e instanceof M ? Object.defineProperty(e, n, {
1198
+ function ta(r, { validate: e } = {}) {
1199
+ return (i, s) => {
1200
+ i instanceof Jt ? Object.defineProperty(i, s, {
275
1201
  enumerable: !0,
276
1202
  get() {
277
- var i;
278
- return ((i = this.defines) == null ? void 0 : i[s]) ?? "";
1203
+ var o;
1204
+ return ((o = this.defines) == null ? void 0 : o[r]) ?? "";
279
1205
  },
280
- set(i) {
281
- if (i !== this[n]) {
282
- if ((t == null ? void 0 : t(i)) === !1) {
283
- console.error(`Expression validation failed: ${i}`);
1206
+ set(o) {
1207
+ if (o !== this[s]) {
1208
+ if ((e == null ? void 0 : e(o)) === !1) {
1209
+ console.error(`Expression validation failed: ${o}`);
284
1210
  return;
285
1211
  }
286
- this.defines ?? (this.defines = {}), this.defines[s] = i, this.needsUpdate = !0;
1212
+ this.defines ?? (this.defines = {}), this.defines[r] = o, this.needsUpdate = !0;
287
1213
  }
288
1214
  }
289
- }) : Object.defineProperty(e, n, {
1215
+ }) : Object.defineProperty(i, s, {
290
1216
  enumerable: !0,
291
1217
  get() {
292
- return this.defines.get(s) ?? "";
1218
+ return this.defines.get(r) ?? "";
293
1219
  },
294
- set(i) {
295
- if (i !== this[n]) {
296
- if ((t == null ? void 0 : t(i)) === !1) {
297
- console.error(`Expression validation failed: ${i}`);
1220
+ set(o) {
1221
+ if (o !== this[s]) {
1222
+ if ((e == null ? void 0 : e(o)) === !1) {
1223
+ console.error(`Expression validation failed: ${o}`);
298
1224
  return;
299
1225
  }
300
- this.defines.set(s, i), this.setChanged();
1226
+ this.defines.set(r, o), this.setChanged();
301
1227
  }
302
1228
  }
303
1229
  });
304
1230
  };
305
1231
  }
306
- function fe(s, ...t) {
307
- const e = {};
308
- for (let n = 0; n < t.length; n += 2) {
309
- const i = t[n], r = t[n + 1];
310
- for (const o of r)
311
- e[o] = {
1232
+ function ra(r, ...e) {
1233
+ const i = {};
1234
+ for (let s = 0; s < e.length; s += 2) {
1235
+ const o = e[s], c = e[s + 1];
1236
+ for (const l of c)
1237
+ i[l] = {
312
1238
  enumerable: !0,
313
- get: () => i[o],
314
- set: (a) => {
315
- i[o] = a;
1239
+ get: () => o[l],
1240
+ set: (v) => {
1241
+ o[l] = v;
316
1242
  }
317
1243
  };
318
1244
  }
319
- return Object.defineProperties(s, e), s;
1245
+ return Object.defineProperties(r, i), r;
320
1246
  }
321
- function pe(s, t, e) {
322
- const n = {};
323
- for (const i of e)
324
- n[i] = {
1247
+ function na(r, e, i) {
1248
+ const s = {};
1249
+ for (const o of i)
1250
+ s[o] = {
325
1251
  enumerable: !0,
326
- get: () => t.uniforms[i].value,
327
- set: (r) => {
328
- t.uniforms[i].value = r;
1252
+ get: () => e.uniforms[o].value,
1253
+ set: (c) => {
1254
+ e.uniforms[o].value = c;
329
1255
  }
330
1256
  };
331
- return Object.defineProperties(s, n), s;
1257
+ return Object.defineProperties(r, s), r;
1258
+ }
1259
+ const Js = parseInt(Li.replace(/\D+/g, ""));
1260
+ var ve = Uint8Array, Le = Uint16Array, Er = Uint32Array, zn = new ve([
1261
+ 0,
1262
+ 0,
1263
+ 0,
1264
+ 0,
1265
+ 0,
1266
+ 0,
1267
+ 0,
1268
+ 0,
1269
+ 1,
1270
+ 1,
1271
+ 1,
1272
+ 1,
1273
+ 2,
1274
+ 2,
1275
+ 2,
1276
+ 2,
1277
+ 3,
1278
+ 3,
1279
+ 3,
1280
+ 3,
1281
+ 4,
1282
+ 4,
1283
+ 4,
1284
+ 4,
1285
+ 5,
1286
+ 5,
1287
+ 5,
1288
+ 5,
1289
+ 0,
1290
+ /* unused */
1291
+ 0,
1292
+ 0,
1293
+ /* impossible */
1294
+ 0
1295
+ ]), kn = new ve([
1296
+ 0,
1297
+ 0,
1298
+ 0,
1299
+ 0,
1300
+ 1,
1301
+ 1,
1302
+ 2,
1303
+ 2,
1304
+ 3,
1305
+ 3,
1306
+ 4,
1307
+ 4,
1308
+ 5,
1309
+ 5,
1310
+ 6,
1311
+ 6,
1312
+ 7,
1313
+ 7,
1314
+ 8,
1315
+ 8,
1316
+ 9,
1317
+ 9,
1318
+ 10,
1319
+ 10,
1320
+ 11,
1321
+ 11,
1322
+ 12,
1323
+ 12,
1324
+ 13,
1325
+ 13,
1326
+ /* unused */
1327
+ 0,
1328
+ 0
1329
+ ]), $s = new ve([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Zn = function(r, e) {
1330
+ for (var i = new Le(31), s = 0; s < 31; ++s)
1331
+ i[s] = e += 1 << r[s - 1];
1332
+ for (var o = new Er(i[30]), s = 1; s < 30; ++s)
1333
+ for (var c = i[s]; c < i[s + 1]; ++c)
1334
+ o[c] = c - i[s] << 5 | s;
1335
+ return [i, o];
1336
+ }, Hn = Zn(zn, 2), Gn = Hn[0], Qs = Hn[1];
1337
+ Gn[28] = 258, Qs[258] = 28;
1338
+ var js = Zn(kn, 0), Ks = js[0], Ir = new Le(32768);
1339
+ for (var G = 0; G < 32768; ++G) {
1340
+ var Fe = (G & 43690) >>> 1 | (G & 21845) << 1;
1341
+ Fe = (Fe & 52428) >>> 2 | (Fe & 13107) << 2, Fe = (Fe & 61680) >>> 4 | (Fe & 3855) << 4, Ir[G] = ((Fe & 65280) >>> 8 | (Fe & 255) << 8) >>> 1;
332
1342
  }
333
- const P = 1e-6, S = /* @__PURE__ */ new u(), E = /* @__PURE__ */ new u(), d = /* @__PURE__ */ new u(), m = /* @__PURE__ */ new u(), D = /* @__PURE__ */ new u(), bt = /* @__PURE__ */ new u(), At = /* @__PURE__ */ new at(), Lt = /* @__PURE__ */ new ot(), St = /* @__PURE__ */ new ht();
334
- class k {
335
- constructor(t = 0, e = 0, n = 0, i = 0) {
336
- this.distance = t, this.heading = e, this.pitch = n, this.roll = i;
1343
+ var pt = function(r, e, i) {
1344
+ for (var s = r.length, o = 0, c = new Le(e); o < s; ++o)
1345
+ ++c[r[o] - 1];
1346
+ var l = new Le(e);
1347
+ for (o = 0; o < e; ++o)
1348
+ l[o] = l[o - 1] + c[o - 1] << 1;
1349
+ var v;
1350
+ if (i) {
1351
+ v = new Le(1 << e);
1352
+ var y = 15 - e;
1353
+ for (o = 0; o < s; ++o)
1354
+ if (r[o])
1355
+ for (var E = o << 4 | r[o], b = e - r[o], m = l[r[o] - 1]++ << b, q = m | (1 << b) - 1; m <= q; ++m)
1356
+ v[Ir[m] >>> y] = E;
1357
+ } else
1358
+ for (v = new Le(s), o = 0; o < s; ++o)
1359
+ r[o] && (v[o] = Ir[l[r[o] - 1]++] >>> 15 - r[o]);
1360
+ return v;
1361
+ }, Tt = new ve(288);
1362
+ for (var G = 0; G < 144; ++G)
1363
+ Tt[G] = 8;
1364
+ for (var G = 144; G < 256; ++G)
1365
+ Tt[G] = 9;
1366
+ for (var G = 256; G < 280; ++G)
1367
+ Tt[G] = 7;
1368
+ for (var G = 280; G < 288; ++G)
1369
+ Tt[G] = 8;
1370
+ var Wn = new ve(32);
1371
+ for (var G = 0; G < 32; ++G)
1372
+ Wn[G] = 5;
1373
+ var eo = /* @__PURE__ */ pt(Tt, 9, 1), to = /* @__PURE__ */ pt(Wn, 5, 1), hr = function(r) {
1374
+ for (var e = r[0], i = 1; i < r.length; ++i)
1375
+ r[i] > e && (e = r[i]);
1376
+ return e;
1377
+ }, de = function(r, e, i) {
1378
+ var s = e / 8 | 0;
1379
+ return (r[s] | r[s + 1] << 8) >> (e & 7) & i;
1380
+ }, fr = function(r, e) {
1381
+ var i = e / 8 | 0;
1382
+ return (r[i] | r[i + 1] << 8 | r[i + 2] << 16) >> (e & 7);
1383
+ }, ro = function(r) {
1384
+ return (r / 8 | 0) + (r & 7 && 1);
1385
+ }, no = function(r, e, i) {
1386
+ (i == null || i > r.length) && (i = r.length);
1387
+ var s = new (r instanceof Le ? Le : r instanceof Er ? Er : ve)(i - e);
1388
+ return s.set(r.subarray(e, i)), s;
1389
+ }, io = function(r, e, i) {
1390
+ var s = r.length;
1391
+ if (!s || i && !i.l && s < 5)
1392
+ return e || new ve(0);
1393
+ var o = !e || i, c = !i || i.i;
1394
+ i || (i = {}), e || (e = new ve(s * 3));
1395
+ var l = function(M) {
1396
+ var be = e.length;
1397
+ if (M > be) {
1398
+ var Ne = new ve(Math.max(be * 2, M));
1399
+ Ne.set(e), e = Ne;
1400
+ }
1401
+ }, v = i.f || 0, y = i.p || 0, E = i.b || 0, b = i.l, m = i.d, q = i.m, se = i.n, Ze = s * 8;
1402
+ do {
1403
+ if (!b) {
1404
+ i.f = v = de(r, y, 1);
1405
+ var Et = de(r, y + 1, 3);
1406
+ if (y += 3, Et)
1407
+ if (Et == 1)
1408
+ b = eo, m = to, q = 9, se = 5;
1409
+ else if (Et == 2) {
1410
+ var bt = de(r, y, 31) + 257, tr = de(r, y + 10, 15) + 4, rr = bt + de(r, y + 5, 31) + 1;
1411
+ y += 14;
1412
+ for (var He = new ve(rr), Nt = new ve(19), oe = 0; oe < tr; ++oe)
1413
+ Nt[$s[oe]] = de(r, y + oe * 3, 7);
1414
+ y += tr * 3;
1415
+ for (var Ot = hr(Nt), nr = (1 << Ot) - 1, ir = pt(Nt, Ot, 1), oe = 0; oe < rr; ) {
1416
+ var le = ir[de(r, y, nr)];
1417
+ y += le & 15;
1418
+ var pe = le >>> 4;
1419
+ if (pe < 16)
1420
+ He[oe++] = pe;
1421
+ else {
1422
+ var _e = 0, ge = 0;
1423
+ for (pe == 16 ? (ge = 3 + de(r, y, 3), y += 2, _e = He[oe - 1]) : pe == 17 ? (ge = 3 + de(r, y, 7), y += 3) : pe == 18 && (ge = 11 + de(r, y, 127), y += 7); ge--; )
1424
+ He[oe++] = _e;
1425
+ }
1426
+ }
1427
+ var Ut = He.subarray(0, bt), Se = He.subarray(bt);
1428
+ q = hr(Ut), se = hr(Se), b = pt(Ut, q, 1), m = pt(Se, se, 1);
1429
+ } else
1430
+ throw "invalid block type";
1431
+ else {
1432
+ var pe = ro(y) + 4, It = r[pe - 4] | r[pe - 3] << 8, _t = pe + It;
1433
+ if (_t > s) {
1434
+ if (c)
1435
+ throw "unexpected EOF";
1436
+ break;
1437
+ }
1438
+ o && l(E + It), e.set(r.subarray(pe, _t), E), i.b = E += It, i.p = y = _t * 8;
1439
+ continue;
1440
+ }
1441
+ if (y > Ze) {
1442
+ if (c)
1443
+ throw "unexpected EOF";
1444
+ break;
1445
+ }
1446
+ }
1447
+ o && l(E + 131072);
1448
+ for (var mt = (1 << q) - 1, Ct = (1 << se) - 1, je = y; ; je = y) {
1449
+ var _e = b[fr(r, y) & mt], ee = _e >>> 4;
1450
+ if (y += _e & 15, y > Ze) {
1451
+ if (c)
1452
+ throw "unexpected EOF";
1453
+ break;
1454
+ }
1455
+ if (!_e)
1456
+ throw "invalid length/literal";
1457
+ if (ee < 256)
1458
+ e[E++] = ee;
1459
+ else if (ee == 256) {
1460
+ je = y, b = null;
1461
+ break;
1462
+ } else {
1463
+ var Ge = ee - 254;
1464
+ if (ee > 264) {
1465
+ var oe = ee - 257, re = zn[oe];
1466
+ Ge = de(r, y, (1 << re) - 1) + Gn[oe], y += re;
1467
+ }
1468
+ var Pe = m[fr(r, y) & Ct], Me = Pe >>> 4;
1469
+ if (!Pe)
1470
+ throw "invalid distance";
1471
+ y += Pe & 15;
1472
+ var Se = Ks[Me];
1473
+ if (Me > 3) {
1474
+ var re = kn[Me];
1475
+ Se += fr(r, y) & (1 << re) - 1, y += re;
1476
+ }
1477
+ if (y > Ze) {
1478
+ if (c)
1479
+ throw "unexpected EOF";
1480
+ break;
1481
+ }
1482
+ o && l(E + 131072);
1483
+ for (var Ke = E + Ge; E < Ke; E += 4)
1484
+ e[E] = e[E - Se], e[E + 1] = e[E + 1 - Se], e[E + 2] = e[E + 2 - Se], e[E + 3] = e[E + 3 - Se];
1485
+ E = Ke;
1486
+ }
1487
+ }
1488
+ i.l = b, i.p = je, i.b = E, b && (v = 1, i.m = q, i.d = m, i.n = se);
1489
+ } while (!v);
1490
+ return E == e.length ? e : no(e, 0, E);
1491
+ }, so = /* @__PURE__ */ new ve(0), oo = function(r) {
1492
+ if ((r[0] & 15) != 8 || r[0] >>> 4 > 7 || (r[0] << 8 | r[1]) % 31)
1493
+ throw "invalid zlib data";
1494
+ if (r[1] & 32)
1495
+ throw "invalid zlib data: preset dictionaries not supported";
1496
+ };
1497
+ function Dt(r, e) {
1498
+ return io((oo(r), r.subarray(2, -4)), e);
1499
+ }
1500
+ var ao = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), co = 0;
1501
+ try {
1502
+ ao.decode(so, { stream: !0 }), co = 1;
1503
+ } catch {
1504
+ }
1505
+ const at = Js >= 152;
1506
+ class lo extends Pi {
1507
+ constructor(e) {
1508
+ super(e), this.type = lt;
1509
+ }
1510
+ parse(e) {
1511
+ const Ot = Math.pow(2.7182818, 2.2);
1512
+ function nr(t, n) {
1513
+ for (var a = 0, u = 0; u < 65536; ++u)
1514
+ (u == 0 || t[u >> 3] & 1 << (u & 7)) && (n[a++] = u);
1515
+ for (var h = a - 1; a < 65536; )
1516
+ n[a++] = 0;
1517
+ return h;
1518
+ }
1519
+ function ir(t) {
1520
+ for (var n = 0; n < 16384; n++)
1521
+ t[n] = {}, t[n].len = 0, t[n].lit = 0, t[n].p = null;
1522
+ }
1523
+ const le = { l: 0, c: 0, lc: 0 };
1524
+ function _e(t, n, a, u, h) {
1525
+ for (; a < t; )
1526
+ n = n << 8 | zr(u, h), a += 8;
1527
+ a -= t, le.l = n >> a & (1 << t) - 1, le.c = n, le.lc = a;
1528
+ }
1529
+ const ge = new Array(59);
1530
+ function Ut(t) {
1531
+ for (var n = 0; n <= 58; ++n)
1532
+ ge[n] = 0;
1533
+ for (var n = 0; n < 65537; ++n)
1534
+ ge[t[n]] += 1;
1535
+ for (var a = 0, n = 58; n > 0; --n) {
1536
+ var u = a + ge[n] >> 1;
1537
+ ge[n] = a, a = u;
1538
+ }
1539
+ for (var n = 0; n < 65537; ++n) {
1540
+ var h = t[n];
1541
+ h > 0 && (t[n] = h | ge[h]++ << 6);
1542
+ }
1543
+ }
1544
+ function Se(t, n, a, u, h, f, d) {
1545
+ for (var p = a, g = 0, A = 0; h <= f; h++) {
1546
+ if (p.value - a.value > u)
1547
+ return !1;
1548
+ _e(6, g, A, t, p);
1549
+ var S = le.l;
1550
+ if (g = le.c, A = le.lc, d[h] = S, S == 63) {
1551
+ if (p.value - a.value > u)
1552
+ throw "Something wrong with hufUnpackEncTable";
1553
+ _e(8, g, A, t, p);
1554
+ var w = le.l + 6;
1555
+ if (g = le.c, A = le.lc, h + w > f + 1)
1556
+ throw "Something wrong with hufUnpackEncTable";
1557
+ for (; w--; )
1558
+ d[h++] = 0;
1559
+ h--;
1560
+ } else if (S >= 59) {
1561
+ var w = S - 59 + 2;
1562
+ if (h + w > f + 1)
1563
+ throw "Something wrong with hufUnpackEncTable";
1564
+ for (; w--; )
1565
+ d[h++] = 0;
1566
+ h--;
1567
+ }
1568
+ }
1569
+ Ut(d);
1570
+ }
1571
+ function mt(t) {
1572
+ return t & 63;
1573
+ }
1574
+ function Ct(t) {
1575
+ return t >> 6;
1576
+ }
1577
+ function je(t, n, a, u) {
1578
+ for (; n <= a; n++) {
1579
+ var h = Ct(t[n]), f = mt(t[n]);
1580
+ if (h >> f)
1581
+ throw "Invalid table entry";
1582
+ if (f > 14) {
1583
+ var d = u[h >> f - 14];
1584
+ if (d.len)
1585
+ throw "Invalid table entry";
1586
+ if (d.lit++, d.p) {
1587
+ var p = d.p;
1588
+ d.p = new Array(d.lit);
1589
+ for (var g = 0; g < d.lit - 1; ++g)
1590
+ d.p[g] = p[g];
1591
+ } else
1592
+ d.p = new Array(1);
1593
+ d.p[d.lit - 1] = n;
1594
+ } else if (f)
1595
+ for (var A = 0, g = 1 << 14 - f; g > 0; g--) {
1596
+ var d = u[(h << 14 - f) + A];
1597
+ if (d.len || d.p)
1598
+ throw "Invalid table entry";
1599
+ d.len = f, d.lit = n, A++;
1600
+ }
1601
+ }
1602
+ return !0;
1603
+ }
1604
+ const ee = { c: 0, lc: 0 };
1605
+ function Ge(t, n, a, u) {
1606
+ t = t << 8 | zr(a, u), n += 8, ee.c = t, ee.lc = n;
1607
+ }
1608
+ const re = { c: 0, lc: 0 };
1609
+ function Pe(t, n, a, u, h, f, d, p, g, A) {
1610
+ if (t == n) {
1611
+ u < 8 && (Ge(a, u, h, d), a = ee.c, u = ee.lc), u -= 8;
1612
+ var S = a >> u, S = new Uint8Array([S])[0];
1613
+ if (g.value + S > A)
1614
+ return !1;
1615
+ for (var w = p[g.value - 1]; S-- > 0; )
1616
+ p[g.value++] = w;
1617
+ } else if (g.value < A)
1618
+ p[g.value++] = t;
1619
+ else
1620
+ return !1;
1621
+ re.c = a, re.lc = u;
1622
+ }
1623
+ function Me(t) {
1624
+ return t & 65535;
1625
+ }
1626
+ function Ke(t) {
1627
+ var n = Me(t);
1628
+ return n > 32767 ? n - 65536 : n;
1629
+ }
1630
+ const M = { a: 0, b: 0 };
1631
+ function be(t, n) {
1632
+ var a = Ke(t), u = Ke(n), h = u, f = a + (h & 1) + (h >> 1), d = f, p = f - h;
1633
+ M.a = d, M.b = p;
1634
+ }
1635
+ function Ne(t, n) {
1636
+ var a = Me(t), u = Me(n), h = a - (u >> 1) & 65535, f = u + h - 32768 & 65535;
1637
+ M.a = f, M.b = h;
1638
+ }
1639
+ function Vn(t, n, a, u, h, f, d) {
1640
+ for (var p = d < 16384, g = a > h ? h : a, A = 1, S; A <= g; )
1641
+ A <<= 1;
1642
+ for (A >>= 1, S = A, A >>= 1; A >= 1; ) {
1643
+ for (var w = 0, Y = w + f * (h - S), I = f * A, _ = f * S, N = u * A, U = u * S, D, z, V, te; w <= Y; w += _) {
1644
+ for (var k = w, Te = w + u * (a - S); k <= Te; k += U) {
1645
+ var H = k + N, J = k + I, Oe = J + N;
1646
+ p ? (be(t[k + n], t[J + n]), D = M.a, V = M.b, be(t[H + n], t[Oe + n]), z = M.a, te = M.b, be(D, z), t[k + n] = M.a, t[H + n] = M.b, be(V, te), t[J + n] = M.a, t[Oe + n] = M.b) : (Ne(t[k + n], t[J + n]), D = M.a, V = M.b, Ne(t[H + n], t[Oe + n]), z = M.a, te = M.b, Ne(D, z), t[k + n] = M.a, t[H + n] = M.b, Ne(V, te), t[J + n] = M.a, t[Oe + n] = M.b);
1647
+ }
1648
+ if (a & A) {
1649
+ var J = k + I;
1650
+ p ? be(t[k + n], t[J + n]) : Ne(t[k + n], t[J + n]), D = M.a, t[J + n] = M.b, t[k + n] = D;
1651
+ }
1652
+ }
1653
+ if (h & A)
1654
+ for (var k = w, Te = w + u * (a - S); k <= Te; k += U) {
1655
+ var H = k + N;
1656
+ p ? be(t[k + n], t[H + n]) : Ne(t[k + n], t[H + n]), D = M.a, t[H + n] = M.b, t[k + n] = D;
1657
+ }
1658
+ S = A, A >>= 1;
1659
+ }
1660
+ return w;
1661
+ }
1662
+ function Jn(t, n, a, u, h, f, d, p, g, A) {
1663
+ for (var S = 0, w = 0, Y = p, I = Math.trunc(h.value + (f + 7) / 8); h.value < I; )
1664
+ for (Ge(S, w, a, h), S = ee.c, w = ee.lc; w >= 14; ) {
1665
+ var _ = S >> w - 14 & 16383, N = n[_];
1666
+ if (N.len)
1667
+ w -= N.len, Pe(N.lit, d, S, w, a, u, h, g, A, Y), S = re.c, w = re.lc;
1668
+ else {
1669
+ if (!N.p)
1670
+ throw "hufDecode issues";
1671
+ var U;
1672
+ for (U = 0; U < N.lit; U++) {
1673
+ for (var D = mt(t[N.p[U]]); w < D && h.value < I; )
1674
+ Ge(S, w, a, h), S = ee.c, w = ee.lc;
1675
+ if (w >= D && Ct(t[N.p[U]]) == (S >> w - D & (1 << D) - 1)) {
1676
+ w -= D, Pe(
1677
+ N.p[U],
1678
+ d,
1679
+ S,
1680
+ w,
1681
+ a,
1682
+ u,
1683
+ h,
1684
+ g,
1685
+ A,
1686
+ Y
1687
+ ), S = re.c, w = re.lc;
1688
+ break;
1689
+ }
1690
+ }
1691
+ if (U == N.lit)
1692
+ throw "hufDecode issues";
1693
+ }
1694
+ }
1695
+ var z = 8 - f & 7;
1696
+ for (S >>= z, w -= z; w > 0; ) {
1697
+ var N = n[S << 14 - w & 16383];
1698
+ if (N.len)
1699
+ w -= N.len, Pe(N.lit, d, S, w, a, u, h, g, A, Y), S = re.c, w = re.lc;
1700
+ else
1701
+ throw "hufDecode issues";
1702
+ }
1703
+ return !0;
1704
+ }
1705
+ function Fr(t, n, a, u, h, f) {
1706
+ var d = { value: 0 }, p = a.value, g = ne(n, a), A = ne(n, a);
1707
+ a.value += 4;
1708
+ var S = ne(n, a);
1709
+ if (a.value += 4, g < 0 || g >= 65537 || A < 0 || A >= 65537)
1710
+ throw "Something wrong with HUF_ENCSIZE";
1711
+ var w = new Array(65537), Y = new Array(16384);
1712
+ ir(Y);
1713
+ var I = u - (a.value - p);
1714
+ if (Se(t, n, a, I, g, A, w), S > 8 * (u - (a.value - p)))
1715
+ throw "Something wrong with hufUncompress";
1716
+ je(w, g, A, Y), Jn(w, Y, t, n, a, S, A, f, h, d);
1717
+ }
1718
+ function $n(t, n, a) {
1719
+ for (var u = 0; u < a; ++u)
1720
+ n[u] = t[n[u]];
1721
+ }
1722
+ function Lr(t) {
1723
+ for (var n = 1; n < t.length; n++) {
1724
+ var a = t[n - 1] + t[n] - 128;
1725
+ t[n] = a;
1726
+ }
1727
+ }
1728
+ function Pr(t, n) {
1729
+ for (var a = 0, u = Math.floor((t.length + 1) / 2), h = 0, f = t.length - 1; !(h > f || (n[h++] = t[a++], h > f)); )
1730
+ n[h++] = t[u++];
1731
+ }
1732
+ function Mr(t) {
1733
+ for (var n = t.byteLength, a = new Array(), u = 0, h = new DataView(t); n > 0; ) {
1734
+ var f = h.getInt8(u++);
1735
+ if (f < 0) {
1736
+ var d = -f;
1737
+ n -= d + 1;
1738
+ for (var p = 0; p < d; p++)
1739
+ a.push(h.getUint8(u++));
1740
+ } else {
1741
+ var d = f;
1742
+ n -= 2;
1743
+ for (var g = h.getUint8(u++), p = 0; p < d + 1; p++)
1744
+ a.push(g);
1745
+ }
1746
+ }
1747
+ return a;
1748
+ }
1749
+ function Qn(t, n, a, u, h, f) {
1750
+ var H = new DataView(f.buffer), d = a[t.idx[0]].width, p = a[t.idx[0]].height, g = 3, A = Math.floor(d / 8), S = Math.ceil(d / 8), w = Math.ceil(p / 8), Y = d - (S - 1) * 8, I = p - (w - 1) * 8, _ = { value: 0 }, N = new Array(g), U = new Array(g), D = new Array(g), z = new Array(g), V = new Array(g);
1751
+ for (let B = 0; B < g; ++B)
1752
+ V[B] = n[t.idx[B]], N[B] = B < 1 ? 0 : N[B - 1] + S * w, U[B] = new Float32Array(64), D[B] = new Uint16Array(64), z[B] = new Uint16Array(S * 64);
1753
+ for (let B = 0; B < w; ++B) {
1754
+ var te = 8;
1755
+ B == w - 1 && (te = I);
1756
+ var k = 8;
1757
+ for (let W = 0; W < S; ++W) {
1758
+ W == S - 1 && (k = Y);
1759
+ for (let F = 0; F < g; ++F)
1760
+ D[F].fill(0), D[F][0] = h[N[F]++], jn(_, u, D[F]), Kn(D[F], U[F]), ei(U[F]);
1761
+ ti(U);
1762
+ for (let F = 0; F < g; ++F)
1763
+ ri(U[F], z[F], W * 64);
1764
+ }
1765
+ let K = 0;
1766
+ for (let W = 0; W < g; ++W) {
1767
+ const F = a[t.idx[W]].type;
1768
+ for (let fe = 8 * B; fe < 8 * B + te; ++fe) {
1769
+ K = V[W][fe];
1770
+ for (let De = 0; De < A; ++De) {
1771
+ const ae = De * 64 + (fe & 7) * 8;
1772
+ H.setUint16(K + 0 * 2 * F, z[W][ae + 0], !0), H.setUint16(K + 1 * 2 * F, z[W][ae + 1], !0), H.setUint16(K + 2 * 2 * F, z[W][ae + 2], !0), H.setUint16(K + 3 * 2 * F, z[W][ae + 3], !0), H.setUint16(K + 4 * 2 * F, z[W][ae + 4], !0), H.setUint16(K + 5 * 2 * F, z[W][ae + 5], !0), H.setUint16(K + 6 * 2 * F, z[W][ae + 6], !0), H.setUint16(K + 7 * 2 * F, z[W][ae + 7], !0), K += 8 * 2 * F;
1773
+ }
1774
+ }
1775
+ if (A != S)
1776
+ for (let fe = 8 * B; fe < 8 * B + te; ++fe) {
1777
+ const De = V[W][fe] + 8 * A * 2 * F, ae = A * 64 + (fe & 7) * 8;
1778
+ for (let xe = 0; xe < k; ++xe)
1779
+ H.setUint16(De + xe * 2 * F, z[W][ae + xe], !0);
1780
+ }
1781
+ }
1782
+ }
1783
+ for (var Te = new Uint16Array(d), H = new DataView(f.buffer), J = 0; J < g; ++J) {
1784
+ a[t.idx[J]].decoded = !0;
1785
+ var Oe = a[t.idx[J]].type;
1786
+ if (a[J].type == 2)
1787
+ for (var it = 0; it < p; ++it) {
1788
+ const B = V[J][it];
1789
+ for (var he = 0; he < d; ++he)
1790
+ Te[he] = H.getUint16(B + he * 2 * Oe, !0);
1791
+ for (var he = 0; he < d; ++he)
1792
+ H.setFloat32(B + he * 2 * Oe, T(Te[he]), !0);
1793
+ }
1794
+ }
1795
+ }
1796
+ function jn(t, n, a) {
1797
+ for (var u, h = 1; h < 64; )
1798
+ u = n[t.value], u == 65280 ? h = 64 : u >> 8 == 255 ? h += u & 255 : (a[h] = u, h++), t.value++;
1799
+ }
1800
+ function Kn(t, n) {
1801
+ n[0] = T(t[0]), n[1] = T(t[1]), n[2] = T(t[5]), n[3] = T(t[6]), n[4] = T(t[14]), n[5] = T(t[15]), n[6] = T(t[27]), n[7] = T(t[28]), n[8] = T(t[2]), n[9] = T(t[4]), n[10] = T(t[7]), n[11] = T(t[13]), n[12] = T(t[16]), n[13] = T(t[26]), n[14] = T(t[29]), n[15] = T(t[42]), n[16] = T(t[3]), n[17] = T(t[8]), n[18] = T(t[12]), n[19] = T(t[17]), n[20] = T(t[25]), n[21] = T(t[30]), n[22] = T(t[41]), n[23] = T(t[43]), n[24] = T(t[9]), n[25] = T(t[11]), n[26] = T(t[18]), n[27] = T(t[24]), n[28] = T(t[31]), n[29] = T(t[40]), n[30] = T(t[44]), n[31] = T(t[53]), n[32] = T(t[10]), n[33] = T(t[19]), n[34] = T(t[23]), n[35] = T(t[32]), n[36] = T(t[39]), n[37] = T(t[45]), n[38] = T(t[52]), n[39] = T(t[54]), n[40] = T(t[20]), n[41] = T(t[22]), n[42] = T(t[33]), n[43] = T(t[38]), n[44] = T(t[46]), n[45] = T(t[51]), n[46] = T(t[55]), n[47] = T(t[60]), n[48] = T(t[21]), n[49] = T(t[34]), n[50] = T(t[37]), n[51] = T(t[47]), n[52] = T(t[50]), n[53] = T(t[56]), n[54] = T(t[59]), n[55] = T(t[61]), n[56] = T(t[35]), n[57] = T(t[36]), n[58] = T(t[48]), n[59] = T(t[49]), n[60] = T(t[57]), n[61] = T(t[58]), n[62] = T(t[62]), n[63] = T(t[63]);
1802
+ }
1803
+ function ei(t) {
1804
+ const n = 0.5 * Math.cos(0.7853975), a = 0.5 * Math.cos(3.14159 / 16), u = 0.5 * Math.cos(3.14159 / 8), h = 0.5 * Math.cos(3 * 3.14159 / 16), f = 0.5 * Math.cos(5 * 3.14159 / 16), d = 0.5 * Math.cos(3 * 3.14159 / 8), p = 0.5 * Math.cos(7 * 3.14159 / 16);
1805
+ for (var g = new Array(4), A = new Array(4), S = new Array(4), w = new Array(4), Y = 0; Y < 8; ++Y) {
1806
+ var I = Y * 8;
1807
+ g[0] = u * t[I + 2], g[1] = d * t[I + 2], g[2] = u * t[I + 6], g[3] = d * t[I + 6], A[0] = a * t[I + 1] + h * t[I + 3] + f * t[I + 5] + p * t[I + 7], A[1] = h * t[I + 1] - p * t[I + 3] - a * t[I + 5] - f * t[I + 7], A[2] = f * t[I + 1] - a * t[I + 3] + p * t[I + 5] + h * t[I + 7], A[3] = p * t[I + 1] - f * t[I + 3] + h * t[I + 5] - a * t[I + 7], S[0] = n * (t[I + 0] + t[I + 4]), S[3] = n * (t[I + 0] - t[I + 4]), S[1] = g[0] + g[3], S[2] = g[1] - g[2], w[0] = S[0] + S[1], w[1] = S[3] + S[2], w[2] = S[3] - S[2], w[3] = S[0] - S[1], t[I + 0] = w[0] + A[0], t[I + 1] = w[1] + A[1], t[I + 2] = w[2] + A[2], t[I + 3] = w[3] + A[3], t[I + 4] = w[3] - A[3], t[I + 5] = w[2] - A[2], t[I + 6] = w[1] - A[1], t[I + 7] = w[0] - A[0];
1808
+ }
1809
+ for (var _ = 0; _ < 8; ++_)
1810
+ g[0] = u * t[16 + _], g[1] = d * t[16 + _], g[2] = u * t[48 + _], g[3] = d * t[48 + _], A[0] = a * t[8 + _] + h * t[24 + _] + f * t[40 + _] + p * t[56 + _], A[1] = h * t[8 + _] - p * t[24 + _] - a * t[40 + _] - f * t[56 + _], A[2] = f * t[8 + _] - a * t[24 + _] + p * t[40 + _] + h * t[56 + _], A[3] = p * t[8 + _] - f * t[24 + _] + h * t[40 + _] - a * t[56 + _], S[0] = n * (t[_] + t[32 + _]), S[3] = n * (t[_] - t[32 + _]), S[1] = g[0] + g[3], S[2] = g[1] - g[2], w[0] = S[0] + S[1], w[1] = S[3] + S[2], w[2] = S[3] - S[2], w[3] = S[0] - S[1], t[0 + _] = w[0] + A[0], t[8 + _] = w[1] + A[1], t[16 + _] = w[2] + A[2], t[24 + _] = w[3] + A[3], t[32 + _] = w[3] - A[3], t[40 + _] = w[2] - A[2], t[48 + _] = w[1] - A[1], t[56 + _] = w[0] - A[0];
1811
+ }
1812
+ function ti(t) {
1813
+ for (var n = 0; n < 64; ++n) {
1814
+ var a = t[0][n], u = t[1][n], h = t[2][n];
1815
+ t[0][n] = a + 1.5747 * h, t[1][n] = a - 0.1873 * u - 0.4682 * h, t[2][n] = a + 1.8556 * u;
1816
+ }
1817
+ }
1818
+ function ri(t, n, a) {
1819
+ for (var u = 0; u < 64; ++u)
1820
+ n[a + u] = Gr.toHalfFloat(ni(t[u]));
1821
+ }
1822
+ function ni(t) {
1823
+ return t <= 1 ? Math.sign(t) * Math.pow(Math.abs(t), 2.2) : Math.sign(t) * Math.pow(Ot, Math.abs(t) - 1);
1824
+ }
1825
+ function Dr(t) {
1826
+ return new DataView(t.array.buffer, t.offset.value, t.size);
1827
+ }
1828
+ function ii(t) {
1829
+ var n = t.viewer.buffer.slice(t.offset.value, t.offset.value + t.size), a = new Uint8Array(Mr(n)), u = new Uint8Array(a.length);
1830
+ return Lr(a), Pr(a, u), new DataView(u.buffer);
1831
+ }
1832
+ function sr(t) {
1833
+ var n = t.array.slice(t.offset.value, t.offset.value + t.size), a = Dt(n), u = new Uint8Array(a.length);
1834
+ return Lr(a), Pr(a, u), new DataView(u.buffer);
1835
+ }
1836
+ function si(t) {
1837
+ for (var n = t.viewer, a = { value: t.offset.value }, u = new Uint16Array(t.width * t.scanlineBlockSize * (t.channels * t.type)), h = new Uint8Array(8192), f = 0, d = new Array(t.channels), p = 0; p < t.channels; p++)
1838
+ d[p] = {}, d[p].start = f, d[p].end = d[p].start, d[p].nx = t.width, d[p].ny = t.lines, d[p].size = t.type, f += d[p].nx * d[p].ny * d[p].size;
1839
+ var g = tt(n, a), A = tt(n, a);
1840
+ if (A >= 8192)
1841
+ throw "Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";
1842
+ if (g <= A)
1843
+ for (var p = 0; p < A - g + 1; p++)
1844
+ h[p + g] = We(n, a);
1845
+ var S = new Uint16Array(65536), w = nr(h, S), Y = ne(n, a);
1846
+ Fr(t.array, n, a, Y, u, f);
1847
+ for (var p = 0; p < t.channels; ++p)
1848
+ for (var I = d[p], _ = 0; _ < d[p].size; ++_)
1849
+ Vn(u, I.start + _, I.nx, I.size, I.ny, I.nx * I.size, w);
1850
+ $n(S, u, f);
1851
+ for (var N = 0, U = new Uint8Array(u.buffer.byteLength), D = 0; D < t.lines; D++)
1852
+ for (var z = 0; z < t.channels; z++) {
1853
+ var I = d[z], V = I.nx * I.size, te = new Uint8Array(u.buffer, I.end * 2, V * 2);
1854
+ U.set(te, N), N += V * 2, I.end += V;
1855
+ }
1856
+ return new DataView(U.buffer);
1857
+ }
1858
+ function oi(t) {
1859
+ var n = t.array.slice(t.offset.value, t.offset.value + t.size), a = Dt(n);
1860
+ const u = t.lines * t.channels * t.width, h = t.type == 1 ? new Uint16Array(u) : new Uint32Array(u);
1861
+ let f = 0, d = 0;
1862
+ const p = new Array(4);
1863
+ for (let g = 0; g < t.lines; g++)
1864
+ for (let A = 0; A < t.channels; A++) {
1865
+ let S = 0;
1866
+ switch (t.type) {
1867
+ case 1:
1868
+ p[0] = f, p[1] = p[0] + t.width, f = p[1] + t.width;
1869
+ for (let w = 0; w < t.width; ++w) {
1870
+ const Y = a[p[0]++] << 8 | a[p[1]++];
1871
+ S += Y, h[d] = S, d++;
1872
+ }
1873
+ break;
1874
+ case 2:
1875
+ p[0] = f, p[1] = p[0] + t.width, p[2] = p[1] + t.width, f = p[2] + t.width;
1876
+ for (let w = 0; w < t.width; ++w) {
1877
+ const Y = a[p[0]++] << 24 | a[p[1]++] << 16 | a[p[2]++] << 8;
1878
+ S += Y, h[d] = S, d++;
1879
+ }
1880
+ break;
1881
+ }
1882
+ }
1883
+ return new DataView(h.buffer);
1884
+ }
1885
+ function Br(t) {
1886
+ var n = t.viewer, a = { value: t.offset.value }, u = new Uint8Array(t.width * t.lines * (t.channels * t.type * 2)), h = {
1887
+ version: ue(n, a),
1888
+ unknownUncompressedSize: ue(n, a),
1889
+ unknownCompressedSize: ue(n, a),
1890
+ acCompressedSize: ue(n, a),
1891
+ dcCompressedSize: ue(n, a),
1892
+ rleCompressedSize: ue(n, a),
1893
+ rleUncompressedSize: ue(n, a),
1894
+ rleRawSize: ue(n, a),
1895
+ totalAcUncompressedCount: ue(n, a),
1896
+ totalDcUncompressedCount: ue(n, a),
1897
+ acCompression: ue(n, a)
1898
+ };
1899
+ if (h.version < 2)
1900
+ throw "EXRLoader.parse: " + nt.compression + " version " + h.version + " is unsupported";
1901
+ for (var f = new Array(), d = tt(n, a) - 2; d > 0; ) {
1902
+ var p = Rt(n.buffer, a), g = We(n, a), A = g >> 2 & 3, S = (g >> 4) - 1, w = new Int8Array([S])[0], Y = We(n, a);
1903
+ f.push({
1904
+ name: p,
1905
+ index: w,
1906
+ type: Y,
1907
+ compression: A
1908
+ }), d -= p.length + 3;
1909
+ }
1910
+ for (var I = nt.channels, _ = new Array(t.channels), N = 0; N < t.channels; ++N) {
1911
+ var U = _[N] = {}, D = I[N];
1912
+ U.name = D.name, U.compression = 0, U.decoded = !1, U.type = D.pixelType, U.pLinear = D.pLinear, U.width = t.width, U.height = t.lines;
1913
+ }
1914
+ for (var z = {
1915
+ idx: new Array(3)
1916
+ }, V = 0; V < t.channels; ++V)
1917
+ for (var U = _[V], N = 0; N < f.length; ++N) {
1918
+ var te = f[N];
1919
+ U.name == te.name && (U.compression = te.compression, te.index >= 0 && (z.idx[te.index] = V), U.offset = V);
1920
+ }
1921
+ if (h.acCompressedSize > 0)
1922
+ switch (h.acCompression) {
1923
+ case 0:
1924
+ var H = new Uint16Array(h.totalAcUncompressedCount);
1925
+ Fr(
1926
+ t.array,
1927
+ n,
1928
+ a,
1929
+ h.acCompressedSize,
1930
+ H,
1931
+ h.totalAcUncompressedCount
1932
+ );
1933
+ break;
1934
+ case 1:
1935
+ var k = t.array.slice(a.value, a.value + h.totalAcUncompressedCount), Te = Dt(k), H = new Uint16Array(Te.buffer);
1936
+ a.value += h.totalAcUncompressedCount;
1937
+ break;
1938
+ }
1939
+ if (h.dcCompressedSize > 0) {
1940
+ var J = {
1941
+ array: t.array,
1942
+ offset: a,
1943
+ size: h.dcCompressedSize
1944
+ }, Oe = new Uint16Array(sr(J).buffer);
1945
+ a.value += h.dcCompressedSize;
1946
+ }
1947
+ if (h.rleRawSize > 0) {
1948
+ var k = t.array.slice(a.value, a.value + h.rleCompressedSize), Te = Dt(k), it = Mr(Te.buffer);
1949
+ a.value += h.rleCompressedSize;
1950
+ }
1951
+ for (var he = 0, B = new Array(_.length), N = 0; N < B.length; ++N)
1952
+ B[N] = new Array();
1953
+ for (var K = 0; K < t.lines; ++K)
1954
+ for (var W = 0; W < _.length; ++W)
1955
+ B[W].push(he), he += _[W].width * t.type * 2;
1956
+ Qn(z, B, _, H, Oe, u);
1957
+ for (var N = 0; N < _.length; ++N) {
1958
+ var U = _[N];
1959
+ if (!U.decoded)
1960
+ switch (U.compression) {
1961
+ case 2:
1962
+ for (var F = 0, fe = 0, K = 0; K < t.lines; ++K) {
1963
+ for (var De = B[N][F], ae = 0; ae < U.width; ++ae) {
1964
+ for (var xe = 0; xe < 2 * U.type; ++xe)
1965
+ u[De++] = it[fe + xe * U.width * U.height];
1966
+ fe++;
1967
+ }
1968
+ F++;
1969
+ }
1970
+ break;
1971
+ case 1:
1972
+ default:
1973
+ throw "EXRLoader.parse: unsupported channel compression";
1974
+ }
1975
+ }
1976
+ return new DataView(u.buffer);
1977
+ }
1978
+ function Rt(t, n) {
1979
+ for (var a = new Uint8Array(t), u = 0; a[n.value + u] != 0; )
1980
+ u += 1;
1981
+ var h = new TextDecoder().decode(a.slice(n.value, n.value + u));
1982
+ return n.value = n.value + u + 1, h;
1983
+ }
1984
+ function ai(t, n, a) {
1985
+ var u = new TextDecoder().decode(new Uint8Array(t).slice(n.value, n.value + a));
1986
+ return n.value = n.value + a, u;
1987
+ }
1988
+ function ci(t, n) {
1989
+ var a = et(t, n), u = ne(t, n);
1990
+ return [a, u];
1991
+ }
1992
+ function li(t, n) {
1993
+ var a = ne(t, n), u = ne(t, n);
1994
+ return [a, u];
1995
+ }
1996
+ function et(t, n) {
1997
+ var a = t.getInt32(n.value, !0);
1998
+ return n.value = n.value + 4, a;
1999
+ }
2000
+ function ne(t, n) {
2001
+ var a = t.getUint32(n.value, !0);
2002
+ return n.value = n.value + 4, a;
2003
+ }
2004
+ function zr(t, n) {
2005
+ var a = t[n.value];
2006
+ return n.value = n.value + 1, a;
2007
+ }
2008
+ function We(t, n) {
2009
+ var a = t.getUint8(n.value);
2010
+ return n.value = n.value + 1, a;
2011
+ }
2012
+ const ue = function(t, n) {
2013
+ let a;
2014
+ return "getBigInt64" in DataView.prototype ? a = Number(t.getBigInt64(n.value, !0)) : a = t.getUint32(n.value + 4, !0) + Number(t.getUint32(n.value, !0) << 32), n.value += 8, a;
2015
+ };
2016
+ function j(t, n) {
2017
+ var a = t.getFloat32(n.value, !0);
2018
+ return n.value += 4, a;
2019
+ }
2020
+ function ui(t, n) {
2021
+ return Gr.toHalfFloat(j(t, n));
2022
+ }
2023
+ function T(t) {
2024
+ var n = (t & 31744) >> 10, a = t & 1023;
2025
+ return (t >> 15 ? -1 : 1) * (n ? n === 31 ? a ? NaN : 1 / 0 : Math.pow(2, n - 15) * (1 + a / 1024) : 6103515625e-14 * (a / 1024));
2026
+ }
2027
+ function tt(t, n) {
2028
+ var a = t.getUint16(n.value, !0);
2029
+ return n.value += 2, a;
2030
+ }
2031
+ function hi(t, n) {
2032
+ return T(tt(t, n));
2033
+ }
2034
+ function fi(t, n, a, u) {
2035
+ for (var h = a.value, f = []; a.value < h + u - 1; ) {
2036
+ var d = Rt(n, a), p = et(t, a), g = We(t, a);
2037
+ a.value += 3;
2038
+ var A = et(t, a), S = et(t, a);
2039
+ f.push({
2040
+ name: d,
2041
+ pixelType: p,
2042
+ pLinear: g,
2043
+ xSampling: A,
2044
+ ySampling: S
2045
+ });
2046
+ }
2047
+ return a.value += 1, f;
2048
+ }
2049
+ function vi(t, n) {
2050
+ var a = j(t, n), u = j(t, n), h = j(t, n), f = j(t, n), d = j(t, n), p = j(t, n), g = j(t, n), A = j(t, n);
2051
+ return {
2052
+ redX: a,
2053
+ redY: u,
2054
+ greenX: h,
2055
+ greenY: f,
2056
+ blueX: d,
2057
+ blueY: p,
2058
+ whiteX: g,
2059
+ whiteY: A
2060
+ };
2061
+ }
2062
+ function yi(t, n) {
2063
+ var a = [
2064
+ "NO_COMPRESSION",
2065
+ "RLE_COMPRESSION",
2066
+ "ZIPS_COMPRESSION",
2067
+ "ZIP_COMPRESSION",
2068
+ "PIZ_COMPRESSION",
2069
+ "PXR24_COMPRESSION",
2070
+ "B44_COMPRESSION",
2071
+ "B44A_COMPRESSION",
2072
+ "DWAA_COMPRESSION",
2073
+ "DWAB_COMPRESSION"
2074
+ ], u = We(t, n);
2075
+ return a[u];
2076
+ }
2077
+ function pi(t, n) {
2078
+ var a = ne(t, n), u = ne(t, n), h = ne(t, n), f = ne(t, n);
2079
+ return { xMin: a, yMin: u, xMax: h, yMax: f };
2080
+ }
2081
+ function di(t, n) {
2082
+ var a = ["INCREASING_Y"], u = We(t, n);
2083
+ return a[u];
2084
+ }
2085
+ function wi(t, n) {
2086
+ var a = j(t, n), u = j(t, n);
2087
+ return [a, u];
2088
+ }
2089
+ function Ai(t, n) {
2090
+ var a = j(t, n), u = j(t, n), h = j(t, n);
2091
+ return [a, u, h];
2092
+ }
2093
+ function gi(t, n, a, u, h) {
2094
+ if (u === "string" || u === "stringvector" || u === "iccProfile")
2095
+ return ai(n, a, h);
2096
+ if (u === "chlist")
2097
+ return fi(t, n, a, h);
2098
+ if (u === "chromaticities")
2099
+ return vi(t, a);
2100
+ if (u === "compression")
2101
+ return yi(t, a);
2102
+ if (u === "box2i")
2103
+ return pi(t, a);
2104
+ if (u === "lineOrder")
2105
+ return di(t, a);
2106
+ if (u === "float")
2107
+ return j(t, a);
2108
+ if (u === "v2f")
2109
+ return wi(t, a);
2110
+ if (u === "v3f")
2111
+ return Ai(t, a);
2112
+ if (u === "int")
2113
+ return et(t, a);
2114
+ if (u === "rational")
2115
+ return ci(t, a);
2116
+ if (u === "timecode")
2117
+ return li(t, a);
2118
+ if (u === "preview")
2119
+ return a.value += h, "skipped";
2120
+ a.value += h;
2121
+ }
2122
+ function Si(t, n, a) {
2123
+ const u = {};
2124
+ if (t.getUint32(0, !0) != 20000630)
2125
+ throw "THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";
2126
+ u.version = t.getUint8(4);
2127
+ const h = t.getUint8(5);
2128
+ u.spec = {
2129
+ singleTile: !!(h & 2),
2130
+ longName: !!(h & 4),
2131
+ deepFormat: !!(h & 8),
2132
+ multiPart: !!(h & 16)
2133
+ }, a.value = 8;
2134
+ for (var f = !0; f; ) {
2135
+ var d = Rt(n, a);
2136
+ if (d == 0)
2137
+ f = !1;
2138
+ else {
2139
+ var p = Rt(n, a), g = ne(t, a), A = gi(t, n, a, p, g);
2140
+ A === void 0 ? console.warn(`EXRLoader.parse: skipped unknown header attribute type '${p}'.`) : u[d] = A;
2141
+ }
2142
+ }
2143
+ if (h & -5)
2144
+ throw console.error("EXRHeader:", u), "THREE.EXRLoader: provided file is currently unsupported.";
2145
+ return u;
2146
+ }
2147
+ function Ti(t, n, a, u, h) {
2148
+ const f = {
2149
+ size: 0,
2150
+ viewer: n,
2151
+ array: a,
2152
+ offset: u,
2153
+ width: t.dataWindow.xMax - t.dataWindow.xMin + 1,
2154
+ height: t.dataWindow.yMax - t.dataWindow.yMin + 1,
2155
+ channels: t.channels.length,
2156
+ bytesPerLine: null,
2157
+ lines: null,
2158
+ inputSize: null,
2159
+ type: t.channels[0].pixelType,
2160
+ uncompress: null,
2161
+ getter: null,
2162
+ format: null,
2163
+ [at ? "colorSpace" : "encoding"]: null
2164
+ };
2165
+ switch (t.compression) {
2166
+ case "NO_COMPRESSION":
2167
+ f.lines = 1, f.uncompress = Dr;
2168
+ break;
2169
+ case "RLE_COMPRESSION":
2170
+ f.lines = 1, f.uncompress = ii;
2171
+ break;
2172
+ case "ZIPS_COMPRESSION":
2173
+ f.lines = 1, f.uncompress = sr;
2174
+ break;
2175
+ case "ZIP_COMPRESSION":
2176
+ f.lines = 16, f.uncompress = sr;
2177
+ break;
2178
+ case "PIZ_COMPRESSION":
2179
+ f.lines = 32, f.uncompress = si;
2180
+ break;
2181
+ case "PXR24_COMPRESSION":
2182
+ f.lines = 16, f.uncompress = oi;
2183
+ break;
2184
+ case "DWAA_COMPRESSION":
2185
+ f.lines = 32, f.uncompress = Br;
2186
+ break;
2187
+ case "DWAB_COMPRESSION":
2188
+ f.lines = 256, f.uncompress = Br;
2189
+ break;
2190
+ default:
2191
+ throw "EXRLoader.parse: " + t.compression + " is unsupported";
2192
+ }
2193
+ if (f.scanlineBlockSize = f.lines, f.type == 1)
2194
+ switch (h) {
2195
+ case ft:
2196
+ f.getter = hi, f.inputSize = 2;
2197
+ break;
2198
+ case lt:
2199
+ f.getter = tt, f.inputSize = 2;
2200
+ break;
2201
+ }
2202
+ else if (f.type == 2)
2203
+ switch (h) {
2204
+ case ft:
2205
+ f.getter = j, f.inputSize = 4;
2206
+ break;
2207
+ case lt:
2208
+ f.getter = ui, f.inputSize = 4;
2209
+ }
2210
+ else
2211
+ throw "EXRLoader.parse: unsupported pixelType " + f.type + " for " + t.compression + ".";
2212
+ f.blockCount = (t.dataWindow.yMax + 1) / f.scanlineBlockSize;
2213
+ for (var d = 0; d < f.blockCount; d++)
2214
+ ue(n, u);
2215
+ f.outputChannels = f.channels == 3 ? 4 : f.channels;
2216
+ const p = f.width * f.height * f.outputChannels;
2217
+ switch (h) {
2218
+ case ft:
2219
+ f.byteArray = new Float32Array(p), f.channels < f.outputChannels && f.byteArray.fill(1, 0, p);
2220
+ break;
2221
+ case lt:
2222
+ f.byteArray = new Uint16Array(p), f.channels < f.outputChannels && f.byteArray.fill(15360, 0, p);
2223
+ break;
2224
+ default:
2225
+ console.error("THREE.EXRLoader: unsupported type: ", h);
2226
+ break;
2227
+ }
2228
+ return f.bytesPerLine = f.width * f.inputSize * f.channels, f.outputChannels == 4 ? f.format = hn : f.format = vn, at ? f.colorSpace = "srgb-linear" : f.encoding = 3e3, f;
2229
+ }
2230
+ const xt = new DataView(e), Ei = new Uint8Array(e), rt = { value: 0 }, nt = Si(xt, e, rt), C = Ti(nt, xt, Ei, rt, this.type), kr = { value: 0 }, Ii = { R: 0, G: 1, B: 2, A: 3, Y: 0 };
2231
+ for (let t = 0; t < C.height / C.scanlineBlockSize; t++) {
2232
+ const n = ne(xt, rt);
2233
+ C.size = ne(xt, rt), C.lines = n + C.scanlineBlockSize > C.height ? C.height - n : C.scanlineBlockSize;
2234
+ const u = C.size < C.lines * C.bytesPerLine ? C.uncompress(C) : Dr(C);
2235
+ rt.value += C.size;
2236
+ for (let h = 0; h < C.scanlineBlockSize; h++) {
2237
+ const f = h + t * C.scanlineBlockSize;
2238
+ if (f >= C.height)
2239
+ break;
2240
+ for (let d = 0; d < C.channels; d++) {
2241
+ const p = Ii[nt.channels[d].name];
2242
+ for (let g = 0; g < C.width; g++) {
2243
+ kr.value = (h * (C.channels * C.width) + d * C.width + g) * C.inputSize;
2244
+ const A = (C.height - 1 - f) * (C.width * C.outputChannels) + g * C.outputChannels + p;
2245
+ C.byteArray[A] = C.getter(u, kr);
2246
+ }
2247
+ }
2248
+ }
2249
+ }
2250
+ return {
2251
+ header: nt,
2252
+ width: C.width,
2253
+ height: C.height,
2254
+ data: C.byteArray,
2255
+ format: C.format,
2256
+ [at ? "colorSpace" : "encoding"]: C[at ? "colorSpace" : "encoding"],
2257
+ type: this.type
2258
+ };
2259
+ }
2260
+ setDataType(e) {
2261
+ return this.type = e, this;
2262
+ }
2263
+ load(e, i, s, o) {
2264
+ function c(l, v) {
2265
+ at ? l.colorSpace = v.colorSpace : l.encoding = v.encoding, l.minFilter = kt, l.magFilter = kt, l.generateMipmaps = !1, l.flipY = !1, i && i(l, v);
2266
+ }
2267
+ return super.load(e, c, s, o);
2268
+ }
2269
+ }
2270
+ class ia extends Vt {
2271
+ setDepth(e) {
2272
+ return this.depth = e, this;
2273
+ }
2274
+ load(e, i, s, o) {
2275
+ const c = new lo(this.manager);
2276
+ c.setRequestHeader(this.requestHeader), c.setPath(this.path), c.setWithCredentials(this.withCredentials), c.load(
2277
+ e,
2278
+ (l) => {
2279
+ const { data: v, width: y, height: E } = l.image, b = this.depth ?? Math.sqrt(E), m = new fn(v, y, E / b, b);
2280
+ m.type = l.type, m.format = l.format, m.colorSpace = l.colorSpace, m.needsUpdate = !0;
2281
+ try {
2282
+ i(m);
2283
+ } catch (q) {
2284
+ o != null ? o(q) : console.error(q), this.manager.itemError(e);
2285
+ }
2286
+ },
2287
+ s,
2288
+ o
2289
+ );
2290
+ }
2291
+ }
2292
+ const vr = 1e-6, Bt = /* @__PURE__ */ new Re(), zt = /* @__PURE__ */ new Re(), Ue = /* @__PURE__ */ new Re(), ct = /* @__PURE__ */ new Re(), yr = /* @__PURE__ */ new Re(), uo = /* @__PURE__ */ new Re(), ho = /* @__PURE__ */ new Di(), fo = /* @__PURE__ */ new Mi(), vo = /* @__PURE__ */ new Bi();
2293
+ class Xn {
2294
+ constructor(e = 0, i = 0, s = 0, o = 0) {
2295
+ this.distance = e, this.heading = i, this.pitch = s, this.roll = o;
337
2296
  }
338
2297
  get distance() {
339
2298
  return this._distance;
340
2299
  }
341
- set distance(t) {
342
- this._distance = Math.max(t, P);
2300
+ set distance(e) {
2301
+ this._distance = Math.max(e, vr);
343
2302
  }
344
2303
  get pitch() {
345
2304
  return this._pitch;
346
2305
  }
347
- set pitch(t) {
348
- this._pitch = p(t, -Math.PI / 2 + P, Math.PI / 2 - P);
2306
+ set pitch(e) {
2307
+ this._pitch = Je(e, -Math.PI / 2 + vr, Math.PI / 2 - vr);
349
2308
  }
350
- set(t, e, n, i) {
351
- return this.distance = t, this.heading = e, this.pitch = n, i != null && (this.roll = i), this;
2309
+ set(e, i, s, o) {
2310
+ return this.distance = e, this.heading = i, this.pitch = s, o != null && (this.roll = o), this;
352
2311
  }
353
2312
  clone() {
354
- return new k(this.distance, this.heading, this.pitch, this.roll);
355
- }
356
- copy(t) {
357
- return this.distance = t.distance, this.heading = t.heading, this.pitch = t.pitch, this.roll = t.roll, this;
358
- }
359
- equals(t) {
360
- return t.distance === this.distance && t.heading === this.heading && t.pitch === this.pitch && t.roll === this.roll;
361
- }
362
- decompose(t, e, n, i, r = j.WGS84) {
363
- r.getEastNorthUpVectors(
364
- t,
365
- S,
366
- E,
367
- d
368
- ), i == null || i.copy(d);
369
- const o = m.copy(S).multiplyScalar(Math.cos(this.heading)).add(
370
- D.copy(E).multiplyScalar(Math.sin(this.heading))
371
- ).multiplyScalar(Math.cos(this.pitch)).add(D.copy(d).multiplyScalar(Math.sin(this.pitch))).normalize().multiplyScalar(this.distance);
372
- if (e.copy(t).sub(o), this.roll !== 0) {
373
- const a = m.copy(t).sub(e).normalize();
374
- d.applyQuaternion(
375
- Lt.setFromAxisAngle(a, this.roll)
2313
+ return new Xn(this.distance, this.heading, this.pitch, this.roll);
2314
+ }
2315
+ copy(e) {
2316
+ return this.distance = e.distance, this.heading = e.heading, this.pitch = e.pitch, this.roll = e.roll, this;
2317
+ }
2318
+ equals(e) {
2319
+ return e.distance === this.distance && e.heading === this.heading && e.pitch === this.pitch && e.roll === this.roll;
2320
+ }
2321
+ decompose(e, i, s, o, c = Xr.WGS84) {
2322
+ c.getEastNorthUpVectors(
2323
+ e,
2324
+ Bt,
2325
+ zt,
2326
+ Ue
2327
+ ), o == null || o.copy(Ue);
2328
+ const l = ct.copy(Bt).multiplyScalar(Math.cos(this.heading)).add(
2329
+ yr.copy(zt).multiplyScalar(Math.sin(this.heading))
2330
+ ).multiplyScalar(Math.cos(this.pitch)).add(yr.copy(Ue).multiplyScalar(Math.sin(this.pitch))).normalize().multiplyScalar(this.distance);
2331
+ if (i.copy(e).sub(l), this.roll !== 0) {
2332
+ const v = ct.copy(e).sub(i).normalize();
2333
+ Ue.applyQuaternion(
2334
+ fo.setFromAxisAngle(v, this.roll)
376
2335
  );
377
2336
  }
378
- n.setFromRotationMatrix(
379
- At.lookAt(e, t, d)
2337
+ s.setFromRotationMatrix(
2338
+ ho.lookAt(i, e, Ue)
380
2339
  );
381
2340
  }
382
- setFromCamera(t, e = j.WGS84) {
383
- const n = m.setFromMatrixPosition(t.matrixWorld), i = D.set(0, 0, 0.5).unproject(t).sub(n).normalize(), r = e.getIntersection(St.set(n, i));
384
- if (r == null)
2341
+ setFromCamera(e, i = Xr.WGS84) {
2342
+ const s = ct.setFromMatrixPosition(e.matrixWorld), o = yr.set(0, 0, 0.5).unproject(e).sub(s).normalize(), c = i.getIntersection(vo.set(s, o));
2343
+ if (c == null)
385
2344
  return;
386
- this.distance = n.distanceTo(r), e.getEastNorthUpVectors(
387
- r,
388
- S,
389
- E,
390
- d
2345
+ this.distance = s.distanceTo(c), i.getEastNorthUpVectors(
2346
+ c,
2347
+ Bt,
2348
+ zt,
2349
+ Ue
391
2350
  ), this.heading = Math.atan2(
392
- E.dot(i),
393
- S.dot(i)
394
- ), this.pitch = Math.asin(d.dot(i));
395
- const o = m.copy(t.up).applyQuaternion(t.quaternion), a = bt.copy(i).multiplyScalar(-o.dot(i)).add(o).normalize(), h = m.copy(i).multiplyScalar(-d.dot(i)).add(d).normalize(), c = h.dot(a), f = i.dot(h.cross(a));
396
- return this.roll = Math.atan2(f, c), this;
2351
+ zt.dot(o),
2352
+ Bt.dot(o)
2353
+ ), this.pitch = Math.asin(Ue.dot(o));
2354
+ const l = ct.copy(e.up).applyQuaternion(e.quaternion), v = uo.copy(o).multiplyScalar(-l.dot(o)).add(l).normalize(), y = ct.copy(o).multiplyScalar(-Ue.dot(o)).add(Ue).normalize(), E = y.dot(v), b = o.dot(y.cross(v));
2355
+ return this.roll = Math.atan2(b, E), this;
397
2356
  }
398
2357
  }
399
- const x = class x {
400
- constructor(t = 0, e = 0, n = 0, i = 0) {
401
- this.west = t, this.south = e, this.east = n, this.north = i;
2358
+ const dt = class dt {
2359
+ constructor(e = 0, i = 0, s = 0, o = 0) {
2360
+ this.west = e, this.south = i, this.east = s, this.north = o;
402
2361
  }
403
2362
  get width() {
404
- let t = this.east;
405
- return t < this.west && (t += Math.PI * 2), t - this.west;
2363
+ let e = this.east;
2364
+ return e < this.west && (e += Math.PI * 2), e - this.west;
406
2365
  }
407
2366
  get height() {
408
2367
  return this.north - this.south;
409
2368
  }
410
- set(t, e, n, i) {
411
- return this.west = t, this.south = e, this.east = n, this.north = i, this;
2369
+ set(e, i, s, o) {
2370
+ return this.west = e, this.south = i, this.east = s, this.north = o, this;
412
2371
  }
413
2372
  clone() {
414
- return new x(this.west, this.south, this.east, this.north);
2373
+ return new dt(this.west, this.south, this.east, this.north);
415
2374
  }
416
- copy(t) {
417
- return this.west = t.west, this.south = t.south, this.east = t.east, this.north = t.north, this;
2375
+ copy(e) {
2376
+ return this.west = e.west, this.south = e.south, this.east = e.east, this.north = e.north, this;
418
2377
  }
419
- equals(t) {
420
- return t.west === this.west && t.south === this.south && t.east === this.east && t.north === this.north;
2378
+ equals(e) {
2379
+ return e.west === this.west && e.south === this.south && e.east === this.east && e.north === this.north;
421
2380
  }
422
- at(t, e, n = new w()) {
423
- return n.set(
424
- this.west + (this.east - this.west) * t,
425
- this.north + (this.south - this.north) * e
2381
+ at(e, i, s = new st()) {
2382
+ return s.set(
2383
+ this.west + (this.east - this.west) * e,
2384
+ this.north + (this.south - this.north) * i
426
2385
  );
427
2386
  }
428
- fromArray(t, e = 0) {
429
- return this.west = t[e], this.south = t[e + 1], this.east = t[e + 2], this.north = t[e + 3], this;
2387
+ fromArray(e, i = 0) {
2388
+ return this.west = e[i], this.south = e[i + 1], this.east = e[i + 2], this.north = e[i + 3], this;
430
2389
  }
431
- toArray(t = [], e = 0) {
432
- return t[e] = this.west, t[e + 1] = this.south, t[e + 2] = this.east, t[e + 3] = this.north, t;
2390
+ toArray(e = [], i = 0) {
2391
+ return e[i] = this.west, e[i + 1] = this.south, e[i + 2] = this.east, e[i + 3] = this.north, e;
433
2392
  }
434
2393
  *[Symbol.iterator]() {
435
2394
  yield this.west, yield this.south, yield this.east, yield this.north;
436
2395
  }
437
2396
  };
438
- x.MAX = /* @__PURE__ */ new x(
439
- w.MIN_LONGITUDE,
440
- w.MIN_LATITUDE,
441
- w.MAX_LONGITUDE,
442
- w.MAX_LATITUDE
2397
+ dt.MAX = /* @__PURE__ */ new dt(
2398
+ st.MIN_LONGITUDE,
2399
+ st.MIN_LATITUDE,
2400
+ st.MAX_LONGITUDE,
2401
+ st.MAX_LATITUDE
443
2402
  );
444
- let I = x;
445
- const Et = /^[ \t]*#include +"([\w\d./]+)"/gm;
446
- function It(s, t) {
447
- return s.replace(Et, (e, n) => {
448
- const r = n.split("/").reduce(
449
- (o, a) => typeof o != "string" && o != null ? o[a] : void 0,
450
- t
2403
+ let qt = dt;
2404
+ const yo = /^[ \t]*#include +"([\w\d./]+)"/gm;
2405
+ function po(r, e) {
2406
+ return r.replace(yo, (i, s) => {
2407
+ const c = s.split("/").reduce(
2408
+ (l, v) => typeof l != "string" && l != null ? l[v] : void 0,
2409
+ e
451
2410
  );
452
- if (typeof r != "string")
453
- throw new Error(`Could not find include for ${n}.`);
454
- return It(r, t);
2411
+ if (typeof c != "string")
2412
+ throw new Error(`Could not find include for ${s}.`);
2413
+ return po(c, e);
455
2414
  });
456
2415
  }
457
- const ge = N(wt, {
458
- format: ct,
459
- minFilter: R,
460
- magFilter: R,
461
- wrapS: F,
462
- wrapT: F,
463
- wrapR: F,
464
- width: ut,
465
- height: ft,
466
- depth: pt
2416
+ const sa = Bn(ks, {
2417
+ format: vn,
2418
+ minFilter: Wr,
2419
+ magFilter: Wr,
2420
+ wrapS: or,
2421
+ wrapT: or,
2422
+ wrapR: or,
2423
+ width: Zi,
2424
+ height: Hi,
2425
+ depth: Gi
467
2426
  });
468
- function* $(s, t, e, n, i) {
469
- if (e >= n)
2427
+ function* Yn(r, e, i, s, o) {
2428
+ if (i >= s)
470
2429
  return;
471
- const r = 2 ** e, o = e + 1, a = 2 ** o, h = Math.floor(s / r * a), c = Math.floor(t / r * a), f = [
472
- [h, c, o],
473
- [h + 1, c, o],
474
- [h, c + 1, o],
475
- [h + 1, c + 1, o]
2430
+ const c = 2 ** i, l = i + 1, v = 2 ** l, y = Math.floor(r / c * v), E = Math.floor(e / c * v), b = [
2431
+ [y, E, l],
2432
+ [y + 1, E, l],
2433
+ [y, E + 1, l],
2434
+ [y + 1, E + 1, l]
476
2435
  ];
477
- if (o < n)
478
- for (const y of f)
479
- for (const A of $(...y, n, i))
480
- yield A;
2436
+ if (l < s)
2437
+ for (const m of b)
2438
+ for (const q of Yn(...m, s, o))
2439
+ yield q;
481
2440
  else
482
- for (const y of f)
483
- yield (i ?? new T()).set(...y);
2441
+ for (const m of b)
2442
+ yield (o ?? new wt()).set(...m);
484
2443
  }
485
- class T {
486
- constructor(t = 0, e = 0, n = 0) {
487
- this.x = t, this.y = e, this.z = n;
2444
+ class wt {
2445
+ constructor(e = 0, i = 0, s = 0) {
2446
+ this.x = e, this.y = i, this.z = s;
488
2447
  }
489
- set(t, e, n) {
490
- return this.x = t, this.y = e, n != null && (this.z = n), this;
2448
+ set(e, i, s) {
2449
+ return this.x = e, this.y = i, s != null && (this.z = s), this;
491
2450
  }
492
2451
  clone() {
493
- return new T(this.x, this.y, this.z);
2452
+ return new wt(this.x, this.y, this.z);
494
2453
  }
495
- copy(t) {
496
- return this.x = t.x, this.y = t.y, this.z = t.z, this;
2454
+ copy(e) {
2455
+ return this.x = e.x, this.y = e.y, this.z = e.z, this;
497
2456
  }
498
- equals(t) {
499
- return t.x === this.x && t.y === this.y && t.z === this.z;
2457
+ equals(e) {
2458
+ return e.x === this.x && e.y === this.y && e.z === this.z;
500
2459
  }
501
- getParent(t = new T()) {
502
- const e = 2 ** this.z, n = this.x / e, i = this.y / e, r = this.z - 1, o = 2 ** r;
503
- return t.set(Math.floor(n * o), Math.floor(i * o), r);
2460
+ getParent(e = new wt()) {
2461
+ const i = 2 ** this.z, s = this.x / i, o = this.y / i, c = this.z - 1, l = 2 ** c;
2462
+ return e.set(Math.floor(s * l), Math.floor(o * l), c);
504
2463
  }
505
- *traverseChildren(t, e) {
506
- const { x: n, y: i, z: r } = this;
507
- for (const o of $(n, i, r, r + t, e))
508
- yield o;
2464
+ *traverseChildren(e, i) {
2465
+ const { x: s, y: o, z: c } = this;
2466
+ for (const l of Yn(s, o, c, c + e, i))
2467
+ yield l;
509
2468
  }
510
- fromArray(t, e = 0) {
511
- return this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this;
2469
+ fromArray(e, i = 0) {
2470
+ return this.x = e[i], this.y = e[i + 1], this.z = e[i + 2], this;
512
2471
  }
513
- toArray(t = [], e = 0) {
514
- return t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t;
2472
+ toArray(e = [], i = 0) {
2473
+ return e[i] = this.x, e[i + 1] = this.y, e[i + 2] = this.z, e;
515
2474
  }
516
2475
  *[Symbol.iterator]() {
517
2476
  yield this.x, yield this.y, yield this.z;
518
2477
  }
519
2478
  }
520
- const q = /* @__PURE__ */ new v();
521
- class Q {
522
- constructor(t = 2, e = 1, n = I.MAX) {
523
- this.width = t, this.height = e, this.rectangle = n;
2479
+ const un = /* @__PURE__ */ new yn();
2480
+ class qn {
2481
+ constructor(e = 2, i = 1, s = qt.MAX) {
2482
+ this.width = e, this.height = i, this.rectangle = s;
524
2483
  }
525
2484
  clone() {
526
- return new Q(this.width, this.height, this.rectangle.clone());
2485
+ return new qn(this.width, this.height, this.rectangle.clone());
527
2486
  }
528
- copy(t) {
529
- return this.width = t.width, this.height = t.height, this.rectangle.copy(t.rectangle), this;
2487
+ copy(e) {
2488
+ return this.width = e.width, this.height = e.height, this.rectangle.copy(e.rectangle), this;
530
2489
  }
531
- getSize(t, e = new v()) {
532
- return e.set(this.width << t, this.height << t);
2490
+ getSize(e, i = new yn()) {
2491
+ return i.set(this.width << e, this.height << e);
533
2492
  }
534
2493
  // Reference: https://github.com/CesiumGS/cesium/blob/1.122/packages/engine/Source/Core/GeographicTilingScheme.js#L210
535
- getTile(t, e, n = new T()) {
536
- const i = this.getSize(e, q), r = this.rectangle.width / i.x, o = this.rectangle.height / i.y;
537
- let a = t.longitude;
538
- this.rectangle.east < this.rectangle.west && (a += Math.PI * 2);
539
- let h = Math.floor((a - this.rectangle.west) / r);
540
- h >= i.x && (h = i.x - 1);
541
- let c = Math.floor((t.latitude - this.rectangle.south) / o);
542
- return c >= i.y && (c = i.y - 1), n.x = h, n.y = c, n.z = e, n;
2494
+ getTile(e, i, s = new wt()) {
2495
+ const o = this.getSize(i, un), { rectangle: c } = this, l = c.width / o.x, v = c.height / o.y, { west: y, south: E, east: b } = c;
2496
+ let m = e.longitude;
2497
+ b < y && (m += Math.PI * 2);
2498
+ let q = Math.floor((m - y) / l);
2499
+ q >= o.x && (q = o.x - 1);
2500
+ let se = Math.floor((e.latitude - E) / v);
2501
+ return se >= o.y && (se = o.y - 1), s.x = q, s.y = se, s.z = i, s;
543
2502
  }
544
2503
  // Reference: https://github.com/CesiumGS/cesium/blob/1.122/packages/engine/Source/Core/GeographicTilingScheme.js#L169
545
- getRectangle(t, e = new I()) {
546
- const n = this.getSize(t.z, q), i = this.rectangle.width / n.x, r = this.rectangle.height / n.y;
547
- return e.west = t.x * i + this.rectangle.west, e.east = (t.x + 1) * i + this.rectangle.west, e.north = this.rectangle.north - (n.y - t.y - 1) * r, e.south = this.rectangle.north - (n.y - t.y) * r, e;
2504
+ getRectangle(e, i = new qt()) {
2505
+ const s = this.getSize(e.z, un), { rectangle: o } = this, c = o.width / s.x, l = o.height / s.y, { west: v, north: y } = o;
2506
+ return i.west = e.x * c + v, i.east = (e.x + 1) * c + v, i.north = y - (s.y - e.y - 1) * l, i.south = y - (s.y - e.y) * l, i;
548
2507
  }
549
2508
  }
550
- const Mt = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*(?:i\s*\+\+|\+\+\s*i)\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
551
- function Ut(s, t, e, n) {
552
- let i = "";
553
- for (let r = parseInt(t); r < parseInt(e); ++r)
554
- i += n.replace(/\[\s*i\s*\]/g, "[" + r + "]").replace(/UNROLLED_LOOP_INDEX/g, `${r}`);
555
- return i;
2509
+ const wo = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*(?:i\s*\+\+|\+\+\s*i)\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
2510
+ function Ao(r, e, i, s) {
2511
+ let o = "";
2512
+ for (let c = parseInt(e); c < parseInt(i); ++c)
2513
+ o += s.replace(/\[\s*i\s*\]/g, "[" + c + "]").replace(/UNROLLED_LOOP_INDEX/g, `${c}`);
2514
+ return o;
556
2515
  }
557
- function ye(s) {
558
- return s.replace(Mt, Ut);
2516
+ function oa(r) {
2517
+ return r.replace(wo, Ao);
559
2518
  }
560
2519
  export {
561
- dt as ArrayBufferLoader,
562
- Nt as DEFAULT_STBN_URL,
563
- Tt as DataLoader,
564
- j as Ellipsoid,
565
- xe as EllipsoidGeometry,
566
- vt as Float32ArrayLoader,
567
- kt as Float32Data2DLoader,
568
- $t as Float32Data3DLoader,
569
- w as Geodetic,
570
- Gt as Int16ArrayLoader,
571
- Xt as Int16Data2DLoader,
572
- k as PointOfView,
573
- I as Rectangle,
574
- ge as STBNLoader,
575
- pt as STBN_TEXTURE_DEPTH,
576
- ft as STBN_TEXTURE_HEIGHT,
577
- ut as STBN_TEXTURE_WIDTH,
578
- T as TileCoordinate,
579
- Q as TilingScheme,
580
- mt as TypedArrayLoader,
581
- qt as Uint16ArrayLoader,
582
- Wt as Uint16Data2DLoader,
583
- Dt as assertType,
584
- ee as ceilPowerOfTwo,
585
- p as clamp,
586
- he as closeTo,
587
- Ht as createData3DTextureLoader,
588
- N as createData3DTextureLoaderClass,
589
- Vt as createDataTextureLoader,
590
- U as createDataTextureLoaderClass,
591
- jt as createTypedArrayLoader,
592
- b as createTypedArrayLoaderClass,
593
- ce as define,
594
- ue as defineExpression,
595
- de as defineFloat,
596
- le as defineInt,
597
- fe as definePropertyShorthand,
598
- pe as defineUniformShorthand,
599
- Kt as degrees,
600
- Qt as euclideanModulo,
601
- se as floorPowerOfTwo,
602
- Ot as fromBufferGeometryLike,
603
- gt as getTypedArrayElementType,
604
- Yt as inverseLerp,
605
- te as isPowerOfTwo,
606
- Jt as lerp,
607
- ne as normalize,
608
- O as parseFloat32Array,
609
- Rt as parseFloat64Array,
610
- X as parseInt16Array,
611
- Bt as parseInt32Array,
612
- _t as parseInt8Array,
613
- V as parseUint16Array,
614
- Ct as parseUint32Array,
615
- wt as parseUint8Array,
616
- Zt as radians,
617
- ie as remap,
618
- re as remapClamped,
619
- It as resolveIncludes,
620
- ae as saturate,
621
- oe as smoothstep,
622
- zt as toBufferGeometryLike,
623
- ye as unrollLoops
2520
+ ki as ArrayBufferLoader,
2521
+ _o as DEFAULT_STBN_URL,
2522
+ qs as DataLoader,
2523
+ ia as EXR3DLoader,
2524
+ Xr as Ellipsoid,
2525
+ la as EllipsoidGeometry,
2526
+ P as Float16Array,
2527
+ Po as Float32ArrayLoader,
2528
+ st as Geodetic,
2529
+ Fo as Int16ArrayLoader,
2530
+ Xn as PointOfView,
2531
+ qt as Rectangle,
2532
+ sa as STBNLoader,
2533
+ Gi as STBN_TEXTURE_DEPTH,
2534
+ Hi as STBN_TEXTURE_HEIGHT,
2535
+ Zi as STBN_TEXTURE_WIDTH,
2536
+ wt as TileCoordinate,
2537
+ qn as TilingScheme,
2538
+ Ws as TypedArrayLoader,
2539
+ Lo as Uint16ArrayLoader,
2540
+ To as assertType,
2541
+ Wo as ceilPowerOfTwo,
2542
+ Je as clamp,
2543
+ Qo as closeTo,
2544
+ Mo as createData3DTextureLoader,
2545
+ Bn as createData3DTextureLoaderClass,
2546
+ Do as createDataTextureLoader,
2547
+ Vs as createDataTextureLoaderClass,
2548
+ xo as createTypedArrayLoader,
2549
+ St as createTypedArrayLoaderClass,
2550
+ jo as define,
2551
+ ta as defineExpression,
2552
+ ea as defineFloat,
2553
+ Ko as defineInt,
2554
+ ra as definePropertyShorthand,
2555
+ na as defineUniformShorthand,
2556
+ Ho as degrees,
2557
+ Bo as euclideanModulo,
2558
+ Xo as floorPowerOfTwo,
2559
+ Io as fromBufferGeometryLike,
2560
+ bo as getTypedArrayElementType,
2561
+ zo as inverseLerp,
2562
+ Go as isPowerOfTwo,
2563
+ No as isTypedArray,
2564
+ ko as lerp,
2565
+ Yo as normalize,
2566
+ Co as parseFloat16Array,
2567
+ Gs as parseFloat32Array,
2568
+ Ro as parseFloat64Array,
2569
+ Hs as parseInt16Array,
2570
+ Uo as parseInt32Array,
2571
+ Oo as parseInt8Array,
2572
+ Zs as parseUint16Array,
2573
+ mo as parseUint32Array,
2574
+ ks as parseUint8Array,
2575
+ Zo as radians,
2576
+ qo as remap,
2577
+ Vo as remapClamped,
2578
+ po as resolveIncludes,
2579
+ $o as saturate,
2580
+ Jo as smoothstep,
2581
+ Eo as toBufferGeometryLike,
2582
+ oa as unrollLoops
624
2583
  };
625
2584
  //# sourceMappingURL=index.js.map