@nebula-spatial/cad-loader 0.2.4 → 0.3.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/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- var Or = Object.defineProperty;
1
+ var _r = Object.defineProperty;
2
2
  var sn = (t) => {
3
3
  throw TypeError(t);
4
4
  };
5
- var _r = (t, n, e) => n in t ? Or(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
6
- var f = (t, n, e) => _r(t, typeof n != "symbol" ? n + "" : n, e), it = (t, n, e) => n.has(t) || sn("Cannot " + e);
5
+ var Gr = (t, n, e) => n in t ? _r(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
6
+ var f = (t, n, e) => Gr(t, typeof n != "symbol" ? n + "" : n, e), it = (t, n, e) => n.has(t) || sn("Cannot " + e);
7
7
  var g = (t, n, e) => (it(t, n, "read from private field"), e ? e.call(t) : n.get(t)), k = (t, n, e) => n.has(t) ? sn("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(t) : n.set(t, e), G = (t, n, e, r) => (it(t, n, "write to private field"), r ? r.call(t, e) : n.set(t, e), e), V = (t, n, e) => (it(t, n, "access private method"), e);
8
- import { CadPackError as U, normalizeGeometrySegments as Gr, normalizeViewportRect as Ft, cloneViewportRect as qe, mergeViewportRects as fe, readGroup as Ur, transformBBoxByInstance as Nr, parseBinStreaming as Ot, isStrictTextRoundtripEnabled as zr, assertStrictTextRoundtrip as Hr, computeViewportRectFromPositions as _e, expandViewportRect as Je, viewportRectEquals as qr, viewportRectIntersects as Kn, viewportRectContains as _t, transformViewportRect as Kr, readExternalVariantDependencyPlan as Ke, readExternalAnnotationManifest as Gt, readExternalBlockAnnotations as Ut, readSceneAnnotationSidecar as Wr, parseBinPayload as Xr, parseBinBounds as Yr, readExternalVariantManifest as Qr } from "./core/index.js";
8
+ import { CadPackError as U, normalizeGeometrySegments as Ur, normalizeViewportRect as Ft, cloneViewportRect as qe, mergeViewportRects as fe, readGroup as Nr, transformBBoxByInstance as zr, parseBinStreaming as Ot, isStrictTextRoundtripEnabled as Hr, assertStrictTextRoundtrip as qr, computeViewportRectFromPositions as _e, expandViewportRect as Je, viewportRectEquals as Kr, viewportRectIntersects as Wn, viewportRectContains as _t, transformViewportRect as Wr, readExternalVariantDependencyPlan as Ke, readExternalAnnotationManifest as Gt, readExternalBlockAnnotations as Ut, readSceneAnnotationSidecar as Xr, parseBinPayload as Yr, parseBinBounds as Qr, readExternalVariantManifest as $r } from "./core/index.js";
9
9
  import { readBlockAnnotationSidecar as Yo } from "./core/index.js";
10
- import { BufferAttribute as $, RawShaderMaterial as $r, Color as Wn, Vector2 as Xn, DoubleSide as vt, BufferGeometry as Nt, LineSegments as zt, InstancedInterleavedBuffer as an, InstancedBufferGeometry as Yn, Float32BufferAttribute as Qn, InterleavedBufferAttribute as De, Mesh as Ht, Vector3 as st, Box3 as jr, Sphere as Zr, Object3D as Rt, InstancedBufferAttribute as de, Points as $n, Group as ee, PointsMaterial as on, LineBasicMaterial as ln, MeshBasicMaterial as dn } from "three";
11
- import { BatchedText as cn, Text as Jr, configureTextBuilder as ei, preloadFont as We } from "troika-three-text";
12
- import ti from "rbush";
13
- const qt = 16.7, Kt = 6, Wt = 128 * 1024 * 1024, Xt = 64 * 1024 * 1024, Yt = 2, Qt = 1, ni = 3e5, ri = 22e4, un = 2;
10
+ import { BufferAttribute as $, RawShaderMaterial as jr, Color as Xn, Vector2 as Yn, DoubleSide as vt, BufferGeometry as Nt, LineSegments as zt, InstancedInterleavedBuffer as an, InstancedBufferGeometry as Qn, Float32BufferAttribute as $n, InterleavedBufferAttribute as De, Mesh as Ht, Vector3 as st, Box3 as Zr, Sphere as Jr, Object3D as Rt, InstancedBufferAttribute as ce, Points as jn, Group as ee, PointsMaterial as on, LineBasicMaterial as ln, MeshBasicMaterial as cn } from "three";
11
+ import { BatchedText as dn, Text as ei, configureTextBuilder as ti, preloadFont as We } from "troika-three-text";
12
+ import ni from "rbush";
13
+ const qt = 16.7, Kt = 6, Wt = 128 * 1024 * 1024, Xt = 64 * 1024 * 1024, Yt = 2, Qt = 1, ri = 3e5, ii = 22e4, un = 2;
14
14
  function W(t, n = "CAD load aborted") {
15
15
  if (t instanceof Error && t.name === "AbortError") return t;
16
16
  const e = typeof t == "string" && t.length > 0 ? t : n, r = new Error(e, t === void 0 ? void 0 : { cause: t });
@@ -25,7 +25,7 @@ function ue(t, n) {
25
25
  const e = () => n.abort(t.reason);
26
26
  return t.addEventListener("abort", e, { once: !0 }), () => t.removeEventListener("abort", e);
27
27
  }
28
- function jn(t, n, e = "CAD load aborted") {
28
+ function Zn(t, n, e = "CAD load aborted") {
29
29
  return n.aborted ? Promise.reject(W(n.reason, e)) : new Promise((r, i) => {
30
30
  const s = () => {
31
31
  a(), i(W(n.reason, e));
@@ -46,16 +46,16 @@ function et(t) {
46
46
  function hn(t) {
47
47
  return et(t) && typeof t.arrayBuffer == "function";
48
48
  }
49
- function ii(t) {
49
+ function si(t) {
50
50
  return typeof URL == "function" && t instanceof URL;
51
51
  }
52
- function si(t) {
52
+ function ai(t) {
53
53
  return et(t) && typeof t.aborted == "boolean" && typeof t.addEventListener == "function" && typeof t.removeEventListener == "function";
54
54
  }
55
55
  function tt(t, n) {
56
56
  if (t instanceof ArrayBuffer)
57
57
  return { source: { kind: "buffer", buffer: t } };
58
- if (typeof t == "string" || ii(t)) {
58
+ if (typeof t == "string" || si(t)) {
59
59
  const r = String(t);
60
60
  if (r.trim().length === 0)
61
61
  throw new U("E_SOURCE", "URL source must include a non-empty URL");
@@ -78,7 +78,7 @@ function tt(t, n) {
78
78
  case "url": {
79
79
  if (typeof e.url != "string" || e.url.trim().length === 0)
80
80
  throw new U("E_SOURCE", "URL source must include a non-empty URL");
81
- const r = si(e.signal) ? e.signal : void 0;
81
+ const r = ai(e.signal) ? e.signal : void 0;
82
82
  return {
83
83
  source: { kind: "url", url: e.url, signal: n },
84
84
  sourceSignal: r
@@ -88,22 +88,22 @@ function tt(t, n) {
88
88
  throw new U("E_SOURCE", `Unsupported CAD load source kind: ${String(e.kind)}`);
89
89
  }
90
90
  }
91
- function ai(t) {
91
+ function oi(t) {
92
92
  if (!et(t) || typeof t.kind != "string")
93
93
  throw new U("E_SOURCE", "Geo source must be an object");
94
94
  tt(t, new AbortController().signal);
95
95
  }
96
- function Ae() {
96
+ function Be() {
97
97
  return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
98
98
  }
99
- function oi(t) {
99
+ function li(t) {
100
100
  if (typeof queueMicrotask == "function") {
101
101
  queueMicrotask(t);
102
102
  return;
103
103
  }
104
104
  Promise.resolve().then(t);
105
105
  }
106
- class Zn {
106
+ class Jn {
107
107
  constructor(n) {
108
108
  f(this, "highWatermarkBytes");
109
109
  f(this, "lowWatermarkBytes");
@@ -150,17 +150,17 @@ async function Xe(t) {
150
150
  const l = r.get(o);
151
151
  if (!l)
152
152
  throw new Error(`External block ${o} is missing from manifest`);
153
- const d = new URL(l.href, t.baseUrl).href, u = await e(d, { signal: t.signal });
153
+ const c = new URL(l.href, t.baseUrl).href, u = await e(c, { signal: t.signal });
154
154
  if (!u.ok) {
155
155
  const y = "status" in u ? u.status : void 0, x = "statusText" in u ? u.statusText : void 0, m = [y, x].filter((b) => b !== void 0 && b !== "").join(" ");
156
156
  throw new Error(`External block ${o} fetch failed${m ? `: ${m}` : ""}`);
157
157
  }
158
- const c = await u.arrayBuffer();
159
- if (c.byteLength !== l.raw_size)
158
+ const d = await u.arrayBuffer();
159
+ if (d.byteLength !== l.raw_size)
160
160
  throw new Error(
161
- `External block ${o} raw_size mismatch: manifest=${l.raw_size}, response=${c.byteLength}`
161
+ `External block ${o} raw_size mismatch: manifest=${l.raw_size}, response=${d.byteLength}`
162
162
  );
163
- s.set(o, c), await ((h = t.onBuffer) == null ? void 0 : h.call(t, o, c));
163
+ s.set(o, d), await ((h = t.onBuffer) == null ? void 0 : h.call(t, o, d));
164
164
  }
165
165
  return await Promise.all(i.map(a)), { buffers: s, fetchMs: fn() - n };
166
166
  }
@@ -169,7 +169,7 @@ function fn() {
169
169
  return ((n = (t = globalThis.performance) == null ? void 0 : t.now) == null ? void 0 : n.call(t)) ?? Date.now();
170
170
  }
171
171
  var te;
172
- class li {
172
+ class ci {
173
173
  constructor() {
174
174
  k(this, te, /* @__PURE__ */ new Map());
175
175
  }
@@ -180,10 +180,10 @@ class li {
180
180
  let e = 0;
181
181
  for (const r of n) {
182
182
  if (r.count <= 0) continue;
183
- const i = At(r.layerIndex, r.lineweightPx);
183
+ const i = Bt(r.layerIndex, r.lineweightPx);
184
184
  let s = g(this, te).get(i), a = r.pos, o = r.positionItemSize;
185
185
  const l = r.linePositionKind ?? null;
186
- s ? s.positionItemSize !== o && (yn(s), o !== 3 && (a = er(a, r.count, o)), s.positionItemSize = 3, o = 3, s.linePositionKind = null) : (s = {
186
+ s ? s.positionItemSize !== o && (yn(s), o !== 3 && (a = tr(a, r.count, o)), s.positionItemSize = 3, o = 3, s.linePositionKind = null) : (s = {
187
187
  layerIndex: r.layerIndex,
188
188
  ...r.lineweightPx === void 0 ? {} : { lineweightPx: r.lineweightPx },
189
189
  posParts: [],
@@ -194,13 +194,13 @@ class li {
194
194
  count: 0,
195
195
  bbox: null
196
196
  }, g(this, te).set(i, s));
197
- const d = s.count > 0;
197
+ const c = s.count > 0;
198
198
  s.posParts.push(a), s.colParts.push(r.col);
199
- const u = mi(
200
- r.colorRuns ?? pi(r.col),
199
+ const u = pi(
200
+ r.colorRuns ?? xi(r.col),
201
201
  s.count
202
202
  );
203
- s.colorRunParts.push(u), s.linePositionKind !== l && (s.linePositionKind = null), s.positionItemSize === 2 && s.linePositionKind === null && yn(s), s.count += r.count, s.bbox = d && s.bbox === null ? null : ci(s.bbox, r.bbox), e += r.count;
203
+ s.colorRunParts.push(u), s.linePositionKind !== l && (s.linePositionKind = null), s.positionItemSize === 2 && s.linePositionKind === null && yn(s), s.count += r.count, s.bbox = c && s.bbox === null ? null : ui(s.bbox, r.bbox), e += r.count;
204
204
  }
205
205
  return e;
206
206
  }
@@ -208,7 +208,7 @@ class li {
208
208
  const n = [];
209
209
  for (const e of g(this, te).values()) {
210
210
  if (e.count <= 0) continue;
211
- const r = e.posParts.length === 1 ? e.posParts[0] : fi(e.posParts, e.count * e.positionItemSize), i = e.colParts.length === 1 ? e.colParts[0] : yi(e.colParts, e.count * 3), s = tr(e.colorRunParts.flat()), a = {
211
+ const r = e.posParts.length === 1 ? e.posParts[0] : yi(e.posParts, e.count * e.positionItemSize), i = e.colParts.length === 1 ? e.colParts[0] : mi(e.colParts, e.count * 3), s = nr(e.colorRunParts.flat()), a = {
212
212
  layerIndex: e.layerIndex,
213
213
  pos: r,
214
214
  positionItemSize: e.positionItemSize,
@@ -224,7 +224,7 @@ class li {
224
224
  }
225
225
  te = new WeakMap();
226
226
  function at() {
227
- return new li();
227
+ return new ci();
228
228
  }
229
229
  function di() {
230
230
  return {
@@ -233,7 +233,7 @@ function di() {
233
233
  dot: at()
234
234
  };
235
235
  }
236
- function ci(t, n) {
236
+ function ui(t, n) {
237
237
  const e = Ft(n);
238
238
  return t ? e ? {
239
239
  minX: Math.min(t.minX, e.minX),
@@ -244,13 +244,13 @@ function ci(t, n) {
244
244
  }
245
245
  function he(t, n = {}) {
246
246
  if (t.count <= 0) return [];
247
- const e = Gr(t), r = [], i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = n.markLinePositionXy === !0 || n.splitLineweight === !0;
247
+ const e = Ur(t), r = [], i = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = n.markLinePositionXy === !0 || n.splitLineweight === !0;
248
248
  for (const m of e) {
249
249
  if (m.vertexCount <= 0) continue;
250
- const b = m.layerIndex, R = o ? m.lineweightPx : void 0, I = At(b, R), w = i.get(I);
250
+ const b = m.layerIndex, R = o ? m.lineweightPx : void 0, I = Bt(b, R), w = i.get(I);
251
251
  w === void 0 ? (i.set(I, m.vertexCount), s.set(I, b), a.set(I, R), r.push(I)) : i.set(I, w + m.vertexCount);
252
252
  }
253
- const l = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), h = n.markLinePositionXy === !0 ? "xy-zero-z" : void 0, y = h ? 2 : 3;
253
+ const l = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set(), h = n.markLinePositionXy === !0 ? "xy-zero-z" : void 0, y = h ? 2 : 3;
254
254
  for (const m of r) {
255
255
  const b = s.get(m), R = a.get(m), I = i.get(m) ?? 0, w = {
256
256
  layerIndex: b,
@@ -262,50 +262,50 @@ function he(t, n = {}) {
262
262
  bbox: null,
263
263
  colorRuns: []
264
264
  };
265
- h && (w.linePositionKind = h), l.set(m, w), d.set(m, 0), u.set(m, null);
265
+ h && (w.linePositionKind = h), l.set(m, w), c.set(m, 0), u.set(m, null);
266
266
  }
267
267
  for (const m of e) {
268
268
  if (m.vertexCount <= 0) continue;
269
- const b = m.layerIndex, R = o ? m.lineweightPx : void 0, I = At(b, R), w = l.get(I), T = d.get(I), A = T, B = m.color[0], E = m.color[1], S = m.color[2];
269
+ const b = m.layerIndex, R = o ? m.lineweightPx : void 0, I = Bt(b, R), w = l.get(I), T = c.get(I), B = T, A = m.color[0], E = m.color[1], S = m.color[2];
270
270
  for (let P = 0; P < m.vertexCount; P += 1) {
271
271
  const O = m.startVertex + P, K = T + P, M = K * y, _ = K * 3, X = O * 2, N = t.pos[X], C = t.pos[X + 1];
272
- w.pos[M] = N, w.pos[M + 1] = C, y === 3 && (w.pos[M + 2] = 0), w.col[_] = B, w.col[_ + 1] = E, w.col[_ + 2] = S;
272
+ w.pos[M] = N, w.pos[M + 1] = C, y === 3 && (w.pos[M + 2] = 0), w.col[_] = A, w.col[_ + 1] = E, w.col[_ + 2] = S;
273
273
  const L = u.get(I);
274
- !Number.isFinite(N) || !Number.isFinite(C) ? c.add(I) : L ? (N < L.minX && (L.minX = N), C < L.minY && (L.minY = C), N > L.maxX && (L.maxX = N), C > L.maxY && (L.maxY = C)) : u.set(I, { minX: N, minY: C, maxX: N, maxY: C });
274
+ !Number.isFinite(N) || !Number.isFinite(C) ? d.add(I) : L ? (N < L.minX && (L.minX = N), C < L.minY && (L.minY = C), N > L.maxX && (L.maxX = N), C > L.maxY && (L.maxY = C)) : u.set(I, { minX: N, minY: C, maxX: N, maxY: C });
275
275
  }
276
276
  w.colorRuns.push({
277
- startVertex: A,
277
+ startVertex: B,
278
278
  vertexCount: m.vertexCount,
279
- color: [B, E, S]
280
- }), d.set(I, T + m.vertexCount);
279
+ color: [A, E, S]
280
+ }), c.set(I, T + m.vertexCount);
281
281
  }
282
282
  const x = [];
283
283
  for (const m of r) {
284
284
  const b = l.get(m);
285
- b && (b.bbox = c.has(m) ? null : Ft(u.get(m) ?? null), b.colorRuns = tr(b.colorRuns ?? []), x.push(b));
285
+ b && (b.bbox = d.has(m) ? null : Ft(u.get(m) ?? null), b.colorRuns = nr(b.colorRuns ?? []), x.push(b));
286
286
  }
287
287
  return x;
288
288
  }
289
- function At(t, n) {
289
+ function Bt(t, n) {
290
290
  return n === void 0 ? `${t}:` : `${t}:${n}`;
291
291
  }
292
- function ui(t, n) {
292
+ function hi(t, n) {
293
293
  return t.append(n);
294
294
  }
295
- function hi(t) {
295
+ function fi(t) {
296
296
  return t.drain();
297
297
  }
298
- function Jn(t) {
298
+ function er(t) {
299
299
  return t.reduce((n, e) => n + e.pos.byteLength + e.col.byteLength, 0);
300
300
  }
301
- function fi(t, n) {
301
+ function yi(t, n) {
302
302
  const e = new Float32Array(n);
303
303
  let r = 0;
304
304
  for (const i of t)
305
305
  e.set(i, r), r += i.length;
306
306
  return e;
307
307
  }
308
- function er(t, n, e) {
308
+ function tr(t, n, e) {
309
309
  if (e === 3) return t;
310
310
  const r = new Float32Array(n * 3);
311
311
  for (let i = 0; i < n; i += 1) {
@@ -317,23 +317,23 @@ function er(t, n, e) {
317
317
  function yn(t) {
318
318
  if (t.positionItemSize === 3) return;
319
319
  const n = t.positionItemSize;
320
- t.posParts = t.posParts.map((e) => er(e, e.length / n, n)), t.positionItemSize = 3, t.linePositionKind = null;
320
+ t.posParts = t.posParts.map((e) => tr(e, e.length / n, n)), t.positionItemSize = 3, t.linePositionKind = null;
321
321
  }
322
- function yi(t, n) {
322
+ function mi(t, n) {
323
323
  const e = new Uint8Array(n);
324
324
  let r = 0;
325
325
  for (const i of t)
326
326
  e.set(i, r), r += i.length;
327
327
  return e;
328
328
  }
329
- function mi(t, n) {
329
+ function pi(t, n) {
330
330
  return t.map((e) => ({
331
331
  startVertex: e.startVertex + n,
332
332
  vertexCount: e.vertexCount,
333
333
  color: [e.color[0], e.color[1], e.color[2]]
334
334
  }));
335
335
  }
336
- function tr(t) {
336
+ function nr(t) {
337
337
  const n = [];
338
338
  for (const e of t) {
339
339
  const r = n[n.length - 1];
@@ -352,25 +352,25 @@ function tr(t) {
352
352
  }
353
353
  return n;
354
354
  }
355
- function pi(t) {
355
+ function xi(t) {
356
356
  const n = Math.floor(t.length / 3), e = [];
357
357
  let r = 0;
358
358
  for (; r < n; ) {
359
359
  const i = r * 3, s = t[i] ?? 0, a = t[i + 1] ?? 0, o = t[i + 2] ?? 0;
360
360
  let l = r + 1;
361
361
  for (; l < n; ) {
362
- const d = l * 3;
363
- if (t[d] !== s || t[d + 1] !== a || t[d + 2] !== o) break;
362
+ const c = l * 3;
363
+ if (t[c] !== s || t[c + 1] !== a || t[c + 2] !== o) break;
364
364
  l += 1;
365
365
  }
366
366
  e.push({ startVertex: r, vertexCount: l - r, color: [s, a, o] }), r = l;
367
367
  }
368
368
  return e;
369
369
  }
370
- function xi(t, n, e = "u8") {
370
+ function gi(t, n, e = "u8") {
371
371
  if (n <= 0 && t.byteLength === 0)
372
372
  return { pos: new Float32Array(0), count: 0, segments: [] };
373
- const { buffer: r, startOffset: i, endOffset: s } = Ci(t), a = new DataView(r), o = Ur(r, a, i, n, s, e);
373
+ const { buffer: r, startOffset: i, endOffset: s } = wi(t), a = new DataView(r), o = Nr(r, a, i, n, s, e);
374
374
  if (o.offset !== s)
375
375
  throw new U(
376
376
  "E_GROUP_RANGE",
@@ -378,15 +378,15 @@ function xi(t, n, e = "u8") {
378
378
  );
379
379
  return o.chunk;
380
380
  }
381
- function gi(t) {
381
+ function bi(t) {
382
382
  const n = (e) => {
383
- const r = t[e], i = xi(
383
+ const r = t[e], i = gi(
384
384
  r.raw,
385
385
  r.count,
386
386
  r.groupLayerEncoding
387
387
  ), s = he(i, { splitLineweight: e === "line" }), a = /* @__PURE__ */ new Map();
388
388
  for (const o of s)
389
- a.set(bi(o.layerIndex, o.lineweightPx), {
389
+ a.set(Ii(o.layerIndex, o.lineweightPx), {
390
390
  layerIndex: o.layerIndex,
391
391
  ...o.lineweightPx === void 0 ? {} : { lineweightPx: o.lineweightPx },
392
392
  pos: o.pos,
@@ -402,17 +402,17 @@ function gi(t) {
402
402
  dot: n("dot")
403
403
  };
404
404
  }
405
- function bi(t, n) {
405
+ function Ii(t, n) {
406
406
  return n === void 0 ? `${t}:` : `${t}:${n}`;
407
407
  }
408
- function Ii(t, n) {
408
+ function Ci(t, n) {
409
409
  let e = n ? qe(n) : null;
410
410
  for (const r of ["line", "fill", "dot"])
411
411
  for (const i of t[r].values())
412
412
  e = fe(e, i.bbox);
413
413
  return e;
414
414
  }
415
- function Ci(t) {
415
+ function wi(t) {
416
416
  if (t.buffer instanceof ArrayBuffer)
417
417
  return {
418
418
  buffer: t.buffer,
@@ -426,22 +426,22 @@ function Ci(t) {
426
426
  endOffset: n.byteOffset + n.byteLength
427
427
  };
428
428
  }
429
- function wi(t) {
429
+ function vi(t) {
430
430
  const n = t.insertRuntime;
431
431
  if (!n || n.instances.length === 0) return null;
432
432
  const e = [], r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
433
433
  for (const l of n.variants) {
434
- const d = gi(l), u = ot(d.line), c = ot(d.fill), h = ot(d.dot), y = u.length > 0 || c.length > 0 || h.length > 0;
435
- r.set(l.id, y ? Ii(d, null) : null), y && (i.add(l.id), e.push({
434
+ const c = bi(l), u = ot(c.line), d = ot(c.fill), h = ot(c.dot), y = u.length > 0 || d.length > 0 || h.length > 0;
435
+ r.set(l.id, y ? Ci(c, null) : null), y && (i.add(l.id), e.push({
436
436
  variantId: l.id,
437
437
  line: u,
438
- fill: c,
438
+ fill: d,
439
439
  dot: h
440
440
  }));
441
441
  }
442
442
  const s = n.instances.filter((l) => i.has(l.variantId));
443
443
  if (s.length === 0) return null;
444
- const a = Ri(s, r), o = Bi(e, a);
444
+ const a = Bi(s, r), o = Vi(e, a);
445
445
  return {
446
446
  variants: e,
447
447
  instances: a,
@@ -452,10 +452,10 @@ function wi(t) {
452
452
  function ot(t) {
453
453
  const n = [];
454
454
  for (const e of t.values())
455
- e.count <= 0 || n.push(vi(e));
455
+ e.count <= 0 || n.push(Ri(e));
456
456
  return n;
457
457
  }
458
- function vi(t) {
458
+ function Ri(t) {
459
459
  return {
460
460
  pos: t.pos,
461
461
  col: t.col,
@@ -465,14 +465,14 @@ function vi(t) {
465
465
  bbox: t.bbox
466
466
  };
467
467
  }
468
- function Ri(t, n) {
468
+ function Bi(t, n) {
469
469
  const e = t.length, r = new Uint32Array(e * 3), i = new Float32Array(e * 6), s = new Float32Array(e * 4);
470
470
  for (let a = 0; a < e; a += 1) {
471
471
  const o = t[a], l = a * 3;
472
472
  r[l] = o.instanceId, r[l + 1] = o.variantId, r[l + 2] = o.insLayerIdx;
473
- const d = a * 6;
474
- i[d] = o.matA, i[d + 1] = o.matB, i[d + 2] = o.matC, i[d + 3] = o.matD, i[d + 4] = o.tx, i[d + 5] = o.ty;
475
- const u = Nr(n.get(o.variantId) ?? null, o);
473
+ const c = a * 6;
474
+ i[c] = o.matA, i[c + 1] = o.matB, i[c + 2] = o.matC, i[c + 3] = o.matD, i[c + 4] = o.tx, i[c + 5] = o.ty;
475
+ const u = zr(n.get(o.variantId) ?? null, o);
476
476
  Ai(s, a * 4, u);
477
477
  }
478
478
  return { meta: r, mats: i, bboxes: s, count: e };
@@ -484,7 +484,7 @@ function Ai(t, n, e) {
484
484
  }
485
485
  t[n] = e.minX, t[n + 1] = e.minY, t[n + 2] = e.maxX, t[n + 3] = e.maxY;
486
486
  }
487
- function Bi(t, n) {
487
+ function Vi(t, n) {
488
488
  let e = n.meta.byteLength + n.mats.byteLength + n.bboxes.byteLength;
489
489
  for (const r of t)
490
490
  e += lt(r.line), e += lt(r.fill), e += lt(r.dot);
@@ -493,27 +493,27 @@ function Bi(t, n) {
493
493
  function lt(t) {
494
494
  return t.reduce((n, e) => n + e.pos.byteLength + e.col.byteLength, 0);
495
495
  }
496
- const mn = 262144, Vi = Number.MAX_SAFE_INTEGER, pn = 524288, Ei = Number.MAX_SAFE_INTEGER, Si = 5e6, ki = 64;
497
- function Ti(t) {
496
+ const mn = 262144, Ei = Number.MAX_SAFE_INTEGER, pn = 524288, Si = Number.MAX_SAFE_INTEGER, ki = 5e6, Ti = 64;
497
+ function Pi(t) {
498
498
  return t.lineCount + t.fillCount + t.dotCount;
499
499
  }
500
- function Pi(t, n) {
501
- return Ti(t) >= Si ? {
500
+ function Li(t, n) {
501
+ return Pi(t) >= ki ? {
502
502
  initial: pn,
503
- steady: n ? pn : Ei
503
+ steady: n ? pn : Si
504
504
  } : {
505
505
  initial: mn,
506
- steady: n ? mn : Vi
506
+ steady: n ? mn : Ei
507
507
  };
508
508
  }
509
- function Li(t) {
510
- const n = !!(t.hiddenInstanceIds && t.hiddenInstanceIds.size > 0), e = t.keepTextsForHiddenInstances === !0, r = t.loadBlocks !== !1, i = t.suppressExpandedInsertGeometry === !0, s = t.maxExpandedInstanceVertices, a = typeof s == "number" && Number.isFinite(s) && s >= 0, o = !!(t.externalVariantBuffers && t.externalVariantBuffers.size > 0), l = t.requiredExternalVariantIds !== void 0, d = t.externalVariantDeltaOnly === !0, u = t.deferExternalVariantGeometry === !0;
511
- if (!n && !e && r && !i && !a && !o && !l && !u && !d)
509
+ function Mi(t) {
510
+ const n = !!(t.hiddenInstanceIds && t.hiddenInstanceIds.size > 0), e = t.keepTextsForHiddenInstances === !0, r = t.loadBlocks !== !1, i = t.suppressExpandedInsertGeometry === !0, s = t.maxExpandedInstanceVertices, a = typeof s == "number" && Number.isFinite(s) && s >= 0, o = !!(t.externalVariantBuffers && t.externalVariantBuffers.size > 0), l = t.requiredExternalVariantIds !== void 0, c = t.externalVariantDeltaOnly === !0, u = t.deferExternalVariantGeometry === !0;
511
+ if (!n && !e && r && !i && !a && !o && !l && !u && !c)
512
512
  return;
513
- const c = {};
514
- return n && (c.hiddenInstanceIds = t.hiddenInstanceIds), e && (c.keepTextsForHiddenInstances = !0), r || (c.loadBlocks = !1), i && (c.suppressExpandedInsertGeometry = !0), a && (c.maxExpandedInstanceVertices = s), o && (c.externalVariantBuffers = t.externalVariantBuffers), l && (c.requiredExternalVariantIds = t.requiredExternalVariantIds), u && (c.deferExternalVariantGeometry = !0), d && (c.externalVariantDeltaOnly = !0), c;
513
+ const d = {};
514
+ return n && (d.hiddenInstanceIds = t.hiddenInstanceIds), e && (d.keepTextsForHiddenInstances = !0), r || (d.loadBlocks = !1), i && (d.suppressExpandedInsertGeometry = !0), a && (d.maxExpandedInstanceVertices = s), o && (d.externalVariantBuffers = t.externalVariantBuffers), l && (d.requiredExternalVariantIds = t.requiredExternalVariantIds), u && (d.deferExternalVariantGeometry = !0), c && (d.externalVariantDeltaOnly = !0), d;
515
515
  }
516
- async function Mi(t) {
516
+ async function Di(t) {
517
517
  if (!t.externalVariantFetchSource || !t.externalVariantGeometryFetchIds || t.externalVariantGeometryFetchIds.size === 0)
518
518
  return t;
519
519
  const n = Array.from(t.externalVariantGeometryFetchIds).filter((i) => {
@@ -534,12 +534,12 @@ async function Mi(t) {
534
534
  externalVariantBuffers: r
535
535
  };
536
536
  }
537
- function Di(t) {
537
+ function Fi(t) {
538
538
  return t.reduce((n, e) => n + e.t.length * 2 + 128, 0);
539
539
  }
540
- async function dt(t, n, e, r) {
540
+ async function ct(t, n, e, r) {
541
541
  if (r()) return 0;
542
- const i = hi(n);
542
+ const i = fi(n);
543
543
  if (!i.length || r()) return 0;
544
544
  const s = i.reduce((a, o) => a + o.count, 0);
545
545
  return await e({
@@ -547,11 +547,11 @@ async function dt(t, n, e, r) {
547
547
  kind: t,
548
548
  layers: i,
549
549
  cost: s,
550
- bytes: Jn(i)
550
+ bytes: er(i)
551
551
  }), s;
552
552
  }
553
- async function Fi(t, n, e) {
554
- return await dt("line", t.line, n, e) + await dt("fill", t.fill, n, e) + await dt("dot", t.dot, n, e);
553
+ async function Oi(t, n, e) {
554
+ return await ct("line", t.line, n, e) + await ct("fill", t.fill, n, e) + await ct("dot", t.dot, n, e);
555
555
  }
556
556
  async function xn(t, n, e) {
557
557
  if (!t.length || e()) return 0;
@@ -560,7 +560,7 @@ async function xn(t, n, e) {
560
560
  type: "text",
561
561
  texts: r,
562
562
  cost: r.length,
563
- bytes: Di(r)
563
+ bytes: Fi(r)
564
564
  }), r.length;
565
565
  }
566
566
  function $t() {
@@ -574,16 +574,16 @@ function $t() {
574
574
  const s = di(), a = [];
575
575
  let o = 0, l = !1;
576
576
  if (r()) return;
577
- const d = await Mi(t);
577
+ const c = await Di(t);
578
578
  if (r()) return;
579
- const u = Ot(d.buffer, Li(d)), c = Pi(
579
+ const u = Ot(c.buffer, Mi(c)), d = Li(
580
580
  u.header,
581
581
  t.externalVariantDeltaOnly === !0
582
582
  );
583
583
  if (r()) return;
584
584
  await n({ type: "header", header: u.header });
585
585
  const h = async () => {
586
- const m = await Fi(s, n, r);
586
+ const m = await Oi(s, n, r);
587
587
  return o = 0, m > 0 && (l = !0), m;
588
588
  };
589
589
  try {
@@ -591,27 +591,27 @@ function $t() {
591
591
  if (r()) return;
592
592
  if (m.kind === "text") {
593
593
  if (o > 0 && await h(), r()) return;
594
- a.push(m.payload), a.length >= ki && await xn(a, n, r);
594
+ a.push(m.payload), a.length >= Ti && await xn(a, n, r);
595
595
  continue;
596
596
  }
597
597
  const b = he(m.payload, {
598
598
  markLinePositionXy: m.kind === "line"
599
599
  });
600
- o += ui(s[m.kind], b);
601
- const R = l ? c.steady : c.initial;
600
+ o += hi(s[m.kind], b);
601
+ const R = l ? d.steady : d.initial;
602
602
  o >= R && await h();
603
603
  }
604
604
  } catch (m) {
605
605
  throw await h(), m;
606
606
  }
607
607
  await h(), await xn(a, n, r), r() || await n({ type: "done" });
608
- const y = Ae(), x = wi(u.header);
608
+ const y = Be(), x = vi(u.header);
609
609
  x && !r() && await n({
610
610
  type: "insertModel",
611
611
  variants: x.variants,
612
612
  instances: x.instances,
613
613
  bytes: x.bytes,
614
- planMs: Ae() - y
614
+ planMs: Be() - y
615
615
  });
616
616
  }),
617
617
  cancel() {
@@ -623,10 +623,10 @@ function $t() {
623
623
  }
624
624
  };
625
625
  }
626
- function Oi(t) {
626
+ function _i(t) {
627
627
  return t.reduce((n, e) => n + e.t.length * 2 + 128, 0);
628
628
  }
629
- function _i(t, n) {
629
+ function Gi(t, n) {
630
630
  const e = n ? {
631
631
  type: "parse",
632
632
  useRetainedMainBuffer: !0
@@ -639,14 +639,14 @@ function _i(t, n) {
639
639
  buffer: i
640
640
  }))), t.requiredExternalVariantIds !== void 0 && (e.requiredExternalVariantIds = Array.from(t.requiredExternalVariantIds)), t.externalVariantGeometryFetchIds !== void 0 && (e.externalVariantGeometryFetchIds = Array.from(t.externalVariantGeometryFetchIds)), t.deferExternalVariantGeometry === !0 && (e.deferExternalVariantGeometry = !0), t.externalVariantDeltaOnly === !0 && (e.externalVariantDeltaOnly = !0), t.cacheDocument === !0 && (e.cacheDocument = !0), e;
641
641
  }
642
- function Gi(t, n) {
642
+ function Ui(t, n) {
643
643
  const e = n ? [] : [t.buffer];
644
644
  if (t.externalVariantBuffers && t.externalVariantBuffers.size > 0)
645
645
  for (const r of t.externalVariantBuffers.values())
646
646
  e.push(r);
647
647
  return e;
648
648
  }
649
- function Ui(t) {
649
+ function Ni(t) {
650
650
  const n = new Error(t.message);
651
651
  return typeof t.code == "string" && (n.code = t.code), n;
652
652
  }
@@ -657,43 +657,43 @@ function nt(t) {
657
657
  return typeof t == "function" || typeof Worker == "function" && typeof globalThis.document < "u";
658
658
  }
659
659
  function jt(t = {}) {
660
- return nr(t, !1);
660
+ return rr(t, !1);
661
661
  }
662
- function Ni(t = {}) {
663
- return nr(t, !0);
662
+ function zi(t = {}) {
663
+ return rr(t, !0);
664
664
  }
665
- function nr(t, n) {
665
+ function rr(t, n) {
666
666
  let e = null, r = !1, i = null, s = !1;
667
667
  const a = () => {
668
- var d;
668
+ var c;
669
669
  if (s)
670
670
  throw new Error("Geo prepare worker adapter is disposed");
671
671
  if (i)
672
672
  throw new Error("Geo prepare worker adapter already has an active run");
673
673
  if (n && e)
674
674
  return e;
675
- const l = ((d = t.workerFactory) == null ? void 0 : d.call(t)) ?? (t.workerUrl ? new Worker(t.workerUrl, { type: "module" }) : new Worker(new URL(
675
+ const l = ((c = t.workerFactory) == null ? void 0 : c.call(t)) ?? (t.workerUrl ? new Worker(t.workerUrl, { type: "module" }) : new Worker(new URL(
676
676
  /* @vite-ignore */
677
677
  "" + new URL("workers/geo-prepare.worker.js", import.meta.url).href,
678
678
  import.meta.url
679
679
  ), { type: "module" }));
680
680
  return n && (e = l, r = !1), l;
681
- }, o = (l, d) => {
682
- i = null, !(n && d && !s) && (e === l && (e = null, r = !1), l.terminate());
681
+ }, o = (l, c) => {
682
+ i = null, !(n && c && !s) && (e === l && (e = null, r = !1), l.terminate());
683
683
  };
684
684
  return {
685
685
  get mainBufferReuseReady() {
686
686
  return n && e !== null && r;
687
687
  },
688
- start(l, d) {
689
- const u = a(), c = n && l.externalVariantDeltaOnly === !0 && e === u && r;
688
+ start(l, c) {
689
+ const u = a(), d = n && l.externalVariantDeltaOnly === !0 && e === u && r;
690
690
  let h = !1, y = !1, x = !1, m = !1, b = Promise.resolve(), R, I, w, T;
691
- const A = new Promise((C, L) => {
691
+ const B = new Promise((C, L) => {
692
692
  R = C, I = L;
693
- }), B = new Promise((C, L) => {
693
+ }), A = new Promise((C, L) => {
694
694
  w = C, T = L;
695
695
  });
696
- B.catch(() => {
696
+ A.catch(() => {
697
697
  });
698
698
  const E = () => {
699
699
  typeof u.removeEventListener == "function" && (u.removeEventListener("message", _), u.removeEventListener("error", X), u.removeEventListener("messageerror", N));
@@ -709,27 +709,27 @@ function nr(t, n) {
709
709
  }, M = async (C) => {
710
710
  if (!y) {
711
711
  if (C.type === "error")
712
- throw Ui(C);
712
+ throw Ni(C);
713
713
  if (C.type === "complete") {
714
714
  x = !0, n && (r = !0), P(), O();
715
715
  return;
716
716
  }
717
717
  if (C.type === "header") {
718
- await d({ type: "header", header: C.header });
718
+ await c({ type: "header", header: C.header });
719
719
  return;
720
720
  }
721
721
  if (C.type === "geometry") {
722
- await d({
722
+ await c({
723
723
  type: "geometry",
724
724
  kind: C.kind,
725
725
  layers: C.layers,
726
726
  cost: C.cost,
727
- bytes: Jn(C.layers)
727
+ bytes: er(C.layers)
728
728
  });
729
729
  return;
730
730
  }
731
731
  if (C.type === "insertModel") {
732
- await d({
732
+ await c({
733
733
  type: "insertModel",
734
734
  variants: C.variants,
735
735
  instances: C.instances,
@@ -739,15 +739,15 @@ function nr(t, n) {
739
739
  return;
740
740
  }
741
741
  if (C.type === "text") {
742
- await d({
742
+ await c({
743
743
  type: "text",
744
744
  texts: C.texts,
745
745
  cost: C.cost,
746
- bytes: Oi(C.texts)
746
+ bytes: _i(C.texts)
747
747
  });
748
748
  return;
749
749
  }
750
- await d({ type: "done" }), P();
750
+ await c({ type: "done" }), P();
751
751
  }
752
752
  }, _ = (C) => {
753
753
  b = b.then(() => M(C.data)), b.catch((L) => {
@@ -765,15 +765,15 @@ function nr(t, n) {
765
765
  };
766
766
  try {
767
767
  u.postMessage(
768
- _i(l, c),
769
- Gi(l, c)
768
+ Gi(l, d),
769
+ Ui(l, d)
770
770
  );
771
771
  } catch (C) {
772
772
  throw K(C), S(!1), gn(C);
773
773
  }
774
774
  return {
775
- completion: A,
776
- backgroundCompletion: B,
775
+ completion: B,
776
+ backgroundCompletion: A,
777
777
  grant(C) {
778
778
  y || u.postMessage({ type: "grant", ...C });
779
779
  },
@@ -792,7 +792,7 @@ function nr(t, n) {
792
792
  }
793
793
  };
794
794
  }
795
- async function zi(t) {
795
+ async function Hi(t) {
796
796
  if (!t.ok)
797
797
  throw new U("E_PACK_HTTP", t.statusText || `Pack request failed with HTTP ${t.status}`);
798
798
  return t.arrayBuffer();
@@ -806,7 +806,7 @@ async function Zt(t) {
806
806
  return t.file.arrayBuffer();
807
807
  case "url":
808
808
  try {
809
- return await zi(await fetch(t.url, { signal: t.signal }));
809
+ return await Hi(await fetch(t.url, { signal: t.signal }));
810
810
  } catch (e) {
811
811
  throw e instanceof U || e instanceof Error && e.name === "AbortError" ? e : (n = t.signal) != null && n.aborted ? W(t.signal.reason, "CAD pack request aborted") : new U("E_PACK_NETWORK", `Pack request failed: ${e.message}`);
812
812
  }
@@ -817,7 +817,7 @@ async function Zt(t) {
817
817
  }
818
818
  }
819
819
  var me, se, pe, ae;
820
- class Hi {
820
+ class qi {
821
821
  constructor(n) {
822
822
  k(this, me, []);
823
823
  k(this, se, []);
@@ -859,13 +859,13 @@ function bn() {
859
859
  t = r, n = i;
860
860
  }), resolve: t, reject: n };
861
861
  }
862
- function qi(t) {
862
+ function Ki(t) {
863
863
  return t instanceof Error ? t : new Error(String(t));
864
864
  }
865
- function ct(t) {
865
+ function dt(t) {
866
866
  return t === void 0 ? void 0 : new Set(t);
867
867
  }
868
- function Ki(t) {
868
+ function Wi(t) {
869
869
  return {
870
870
  highWatermarkBytes: (t == null ? void 0 : t.highWatermarkBytes) ?? Wt,
871
871
  lowWatermarkBytes: (t == null ? void 0 : t.lowWatermarkBytes) ?? Xt,
@@ -873,15 +873,15 @@ function Ki(t) {
873
873
  initialTextCredits: (t == null ? void 0 : t.initialTextCredits) ?? Qt
874
874
  };
875
875
  }
876
- function Wi(t) {
876
+ function Xi(t) {
877
877
  if (t.positionItemSize === 2) return t.pos;
878
878
  const n = new Float32Array(t.count * 2);
879
879
  for (let e = 0; e < t.count; e += 1)
880
880
  n[e * 2] = t.pos[e * 3] ?? 0, n[e * 2 + 1] = t.pos[e * 3 + 1] ?? 0;
881
881
  return n;
882
882
  }
883
- function Xi(t) {
884
- return (t.colorRuns ?? Yi(t)).map((e) => ({
883
+ function Yi(t) {
884
+ return (t.colorRuns ?? Qi(t)).map((e) => ({
885
885
  startVertex: e.startVertex,
886
886
  vertexCount: e.vertexCount,
887
887
  color: [e.color[0], e.color[1], e.color[2]],
@@ -889,24 +889,24 @@ function Xi(t) {
889
889
  ...t.lineweightPx === void 0 ? {} : { lineweightPx: t.lineweightPx }
890
890
  }));
891
891
  }
892
- function Yi(t) {
892
+ function Qi(t) {
893
893
  return t.count <= 0 ? [] : [{
894
894
  startVertex: 0,
895
895
  vertexCount: t.count,
896
896
  color: [t.col[0] ?? 0, t.col[1] ?? 0, t.col[2] ?? 0]
897
897
  }];
898
898
  }
899
- function Qi(t) {
899
+ function $i(t) {
900
900
  const n = t.layerIndex <= 255 ? new Uint8Array(t.count).fill(t.layerIndex) : new Uint16Array(t.count).fill(t.layerIndex);
901
901
  return {
902
- pos: Wi(t),
902
+ pos: Xi(t),
903
903
  col: t.col,
904
904
  lay: n,
905
905
  count: t.count,
906
- segments: Xi(t)
906
+ segments: Yi(t)
907
907
  };
908
908
  }
909
- function $i(t) {
909
+ function ji(t) {
910
910
  const n = [];
911
911
  for (let e = 0; e < t.count; e += 1) {
912
912
  const r = e * 3, i = e * 6;
@@ -934,7 +934,7 @@ function ut(t) {
934
934
  ...t.bbox === void 0 ? {} : { bounds: t.bbox }
935
935
  };
936
936
  }
937
- function ji(t) {
937
+ function Zi(t) {
938
938
  return {
939
939
  variantId: t.variantId,
940
940
  line: t.line.map(ut),
@@ -942,14 +942,14 @@ function ji(t) {
942
942
  dot: t.dot.map(ut)
943
943
  };
944
944
  }
945
- var F, Be, Ve, Ee, xe, ne, q, ge, re, be, Se, Q, Ie, ke, Te, z, Pe, Le, v, rr, ir, sr, ce, Bt, ar, Re, Vt, Ge, Ue, Ne;
946
- class Zi {
945
+ var F, Ae, Ve, Ee, xe, ne, q, ge, re, be, Se, Q, Ie, ke, Te, z, Pe, Le, v, ir, sr, ar, de, At, or, Re, Vt, Ge, Ue, Ne;
946
+ class Ji {
947
947
  constructor(n, e) {
948
948
  k(this, v);
949
949
  f(this, "events");
950
950
  f(this, "ready");
951
951
  k(this, F);
952
- k(this, Be);
952
+ k(this, Ae);
953
953
  k(this, Ve);
954
954
  k(this, Ee, new AbortController());
955
955
  k(this, xe, bn());
@@ -965,12 +965,12 @@ class Zi {
965
965
  k(this, Te, !1);
966
966
  k(this, z, !1);
967
967
  k(this, Pe, !1);
968
- k(this, Le, Ae());
968
+ k(this, Le, Be());
969
969
  G(this, F, e);
970
970
  const r = tt(n, g(this, Ee).signal);
971
- G(this, Be, r.source), G(this, Ve, r.sourceSignal), G(this, re, new Zn(Ki(e.flowControl))), G(this, q, new Hi((i) => V(this, v, ar).call(this, i))), this.events = g(this, q), this.ready = g(this, xe).promise, this.ready.catch(() => {
971
+ G(this, Ae, r.source), G(this, Ve, r.sourceSignal), G(this, re, new Jn(Wi(e.flowControl))), G(this, q, new qi((i) => V(this, v, or).call(this, i))), this.events = g(this, q), this.ready = g(this, xe).promise, this.ready.catch(() => {
972
972
  }), g(this, ne).promise.catch(() => {
973
- }), V(this, v, Vt).call(this, e.signal), V(this, v, Vt).call(this, g(this, Ve)), g(this, z) || V(this, v, rr).call(this);
973
+ }), V(this, v, Vt).call(this, e.signal), V(this, v, Vt).call(this, g(this, Ve)), g(this, z) || V(this, v, ir).call(this);
974
974
  }
975
975
  abort(n) {
976
976
  g(this, z) || V(this, v, Ge).call(this, W(n, "CAD load session aborted"));
@@ -986,27 +986,27 @@ class Zi {
986
986
  }
987
987
  }
988
988
  }
989
- F = new WeakMap(), Be = new WeakMap(), Ve = new WeakMap(), Ee = new WeakMap(), xe = new WeakMap(), ne = new WeakMap(), q = new WeakMap(), ge = new WeakMap(), re = new WeakMap(), be = new WeakMap(), Se = new WeakMap(), Q = new WeakMap(), Ie = new WeakMap(), ke = new WeakMap(), Te = new WeakMap(), z = new WeakMap(), Pe = new WeakMap(), Le = new WeakMap(), v = new WeakSet(), rr = async function() {
989
+ F = new WeakMap(), Ae = new WeakMap(), Ve = new WeakMap(), Ee = new WeakMap(), xe = new WeakMap(), ne = new WeakMap(), q = new WeakMap(), ge = new WeakMap(), re = new WeakMap(), be = new WeakMap(), Se = new WeakMap(), Q = new WeakMap(), Ie = new WeakMap(), ke = new WeakMap(), Te = new WeakMap(), z = new WeakMap(), Pe = new WeakMap(), Le = new WeakMap(), v = new WeakSet(), ir = async function() {
990
990
  var n, e;
991
991
  try {
992
992
  const r = await Promise.race([
993
- Zt(g(this, Be)),
993
+ Zt(g(this, Ae)),
994
994
  g(this, ne).promise
995
995
  ]);
996
996
  if (g(this, z)) return;
997
997
  G(this, ke, r.byteLength);
998
- const s = V(this, v, ir).call(this).start({
998
+ const s = V(this, v, sr).call(this).start({
999
999
  buffer: r,
1000
- hiddenInstanceIds: ct(g(this, F).hiddenInstanceIds),
1000
+ hiddenInstanceIds: dt(g(this, F).hiddenInstanceIds),
1001
1001
  keepTextsForHiddenInstances: g(this, F).keepTextsForHiddenInstances || void 0,
1002
1002
  loadBlocks: g(this, F).loadBlocks,
1003
1003
  suppressExpandedInsertGeometry: g(this, F).loadBlocks !== !1,
1004
1004
  maxExpandedInstanceVertices: g(this, F).maxExpandedInstanceVertices,
1005
1005
  externalVariantFetchSource: g(this, F).externalVariantFetchSource,
1006
1006
  externalVariantBuffers: g(this, F).externalVariantBuffers,
1007
- requiredExternalVariantIds: ct(g(this, F).requiredExternalVariantIds),
1008
- externalVariantGeometryFetchIds: ct(g(this, F).externalVariantGeometryFetchIds)
1009
- }, (o) => V(this, v, sr).call(this, o));
1007
+ requiredExternalVariantIds: dt(g(this, F).requiredExternalVariantIds),
1008
+ externalVariantGeometryFetchIds: dt(g(this, F).externalVariantGeometryFetchIds)
1009
+ }, (o) => V(this, v, ar).call(this, o));
1010
1010
  if (G(this, Q, s), s.completion.catch(() => {
1011
1011
  }), (n = s.backgroundCompletion) == null || n.catch(() => {
1012
1012
  }), V(this, v, Re).call(this, g(this, re).takeInitialGrant()), await Promise.race([s.completion, g(this, ne).promise]), s.backgroundCompletion && await Promise.race([s.backgroundCompletion, g(this, ne).promise]), g(this, z)) return;
@@ -1021,26 +1021,26 @@ F = new WeakMap(), Be = new WeakMap(), Ve = new WeakMap(), Ee = new WeakMap(), x
1021
1021
  };
1022
1022
  G(this, z, !0), g(this, q).push({ event: { type: "ready", document: a } }), g(this, q).close(), g(this, xe).resolve(a), V(this, v, Ne).call(this);
1023
1023
  } catch (r) {
1024
- g(this, z) || V(this, v, Ge).call(this, qi(r));
1024
+ g(this, z) || V(this, v, Ge).call(this, Ki(r));
1025
1025
  } finally {
1026
1026
  (e = g(this, Q)) == null || e.dispose(), V(this, v, Ue).call(this);
1027
1027
  }
1028
- }, ir = function() {
1028
+ }, sr = function() {
1029
1029
  return g(this, F).preferWorker !== !1 && nt(g(this, F).workerFactory) ? jt({
1030
1030
  workerUrl: g(this, F).workerUrl,
1031
1031
  workerFactory: g(this, F).workerFactory
1032
1032
  }) : $t();
1033
- }, sr = async function(n) {
1033
+ }, ar = async function(n) {
1034
1034
  if (!g(this, z)) {
1035
1035
  if (n.type === "header") {
1036
1036
  G(this, Ie, n.header), g(this, q).push({
1037
1037
  event: { type: "meta", meta: n.header, header: n.header }
1038
- }), await V(this, v, ce).call(this);
1038
+ }), await V(this, v, de).call(this);
1039
1039
  return;
1040
1040
  }
1041
1041
  if (n.type === "geometry") {
1042
1042
  const e = n.layers.map((r) => {
1043
- const i = Qi(r);
1043
+ const i = $i(r);
1044
1044
  return g(this, ge).push({ kind: n.kind, payload: i }), {
1045
1045
  event: {
1046
1046
  type: "geometry",
@@ -1052,32 +1052,32 @@ F = new WeakMap(), Be = new WeakMap(), Ve = new WeakMap(), Ee = new WeakMap(), x
1052
1052
  }
1053
1053
  };
1054
1054
  });
1055
- await V(this, v, Bt).call(this, e, "geometry", n.bytes), await V(this, v, ce).call(this);
1055
+ await V(this, v, At).call(this, e, "geometry", n.bytes), await V(this, v, de).call(this);
1056
1056
  return;
1057
1057
  }
1058
1058
  if (n.type === "text") {
1059
1059
  const e = n.texts.map((r) => (g(this, ge).push({ kind: "text", payload: r }), { event: { type: "text", chunk: r } }));
1060
- await V(this, v, Bt).call(this, e, "text", n.bytes), await V(this, v, ce).call(this);
1060
+ await V(this, v, At).call(this, e, "text", n.bytes), await V(this, v, de).call(this);
1061
1061
  return;
1062
1062
  }
1063
1063
  if (n.type === "insertModel") {
1064
1064
  g(this, q).push({
1065
1065
  event: {
1066
1066
  type: "insert",
1067
- instances: $i(n.instances),
1068
- variants: n.variants.map(ji)
1067
+ instances: ji(n.instances),
1068
+ variants: n.variants.map(Zi)
1069
1069
  }
1070
- }), await V(this, v, ce).call(this);
1070
+ }), await V(this, v, de).call(this);
1071
1071
  return;
1072
1072
  }
1073
- G(this, Te, !0), await V(this, v, ce).call(this);
1073
+ G(this, Te, !0), await V(this, v, de).call(this);
1074
1074
  }
1075
- }, ce = async function() {
1075
+ }, de = async function() {
1076
1076
  const n = Math.max(0, (g(this, F).frameBudgetMs ?? qt) - (g(this, F).frameReserveMs ?? Kt));
1077
1077
  typeof performance > "u" || typeof performance.now != "function" || performance.now() - g(this, Le) < n || (await new Promise((e) => {
1078
1078
  typeof globalThis.requestAnimationFrame == "function" ? globalThis.requestAnimationFrame(() => e()) : setTimeout(e, 0);
1079
1079
  }), G(this, Le, performance.now()));
1080
- }, Bt = function(n, e, r) {
1080
+ }, At = function(n, e, r) {
1081
1081
  if (n.length === 0) {
1082
1082
  V(this, v, Re).call(this, e === "geometry" ? { geometryCredits: 1, textCredits: 0 } : { geometryCredits: 0, textCredits: 1 });
1083
1083
  return;
@@ -1095,7 +1095,7 @@ F = new WeakMap(), Be = new WeakMap(), Ve = new WeakMap(), Ee = new WeakMap(), x
1095
1095
  return new Promise((a) => {
1096
1096
  g(this, be).add(a);
1097
1097
  });
1098
- }, ar = function(n) {
1098
+ }, or = function(n) {
1099
1099
  if (!n.batch || !n.accountsBatch) return;
1100
1100
  const e = g(this, re).onConsumed(n.batch.kind, n.batch.bytes);
1101
1101
  n.batch.creditReplaced || (n.batch.creditReplaced = V(this, v, Re).call(this, e)), e.paused || V(this, v, Ue).call(this);
@@ -1123,9 +1123,9 @@ F = new WeakMap(), Be = new WeakMap(), Ve = new WeakMap(), Ee = new WeakMap(), x
1123
1123
  for (const n of g(this, Se).splice(0)) n();
1124
1124
  };
1125
1125
  function Vo(t, n = {}) {
1126
- return new Zi(t, n);
1126
+ return new Ji(t, n);
1127
1127
  }
1128
- class Ji {
1128
+ class es {
1129
1129
  constructor(n) {
1130
1130
  f(this, "queue", []);
1131
1131
  f(this, "budgetMs");
@@ -1162,13 +1162,13 @@ class Ji {
1162
1162
  };
1163
1163
  }
1164
1164
  }
1165
- function es(t) {
1165
+ function ts(t) {
1166
1166
  return t.lineCount + t.fillCount + t.dotCount;
1167
1167
  }
1168
- function ts(t) {
1168
+ function ns(t) {
1169
1169
  return t instanceof Error ? t : new Error(String(t));
1170
1170
  }
1171
- class ns {
1171
+ class rs {
1172
1172
  constructor(n) {
1173
1173
  f(this, "headerSeen", !1);
1174
1174
  f(this, "headerTexts", []);
@@ -1176,7 +1176,7 @@ class ns {
1176
1176
  }
1177
1177
  initFromHeader(n) {
1178
1178
  this.node._initFromHeader(n), this.node.updateAutoQualityContext({
1179
- visibleVertexCount: es(n),
1179
+ visibleVertexCount: ts(n),
1180
1180
  zoom: 1
1181
1181
  }), this.headerSeen = !0, this.headerTexts = n.texts;
1182
1182
  }
@@ -1196,9 +1196,9 @@ class ns {
1196
1196
  try {
1197
1197
  if (!this.headerSeen)
1198
1198
  throw new Error("Geo loader pipeline completed without header");
1199
- zr() && Hr("Boundary-3:header->node", this.headerTexts, this.node._collectTextUserDataForDebug()), await this.node._finalizeIncrementally(n);
1199
+ Hr() && qr("Boundary-3:header->node", this.headerTexts, this.node._collectTextUserDataForDebug()), await this.node._finalizeIncrementally(n);
1200
1200
  } catch (e) {
1201
- const r = ts(e);
1201
+ const r = ns(e);
1202
1202
  throw this.fail(r), r;
1203
1203
  }
1204
1204
  }
@@ -1209,17 +1209,17 @@ class ns {
1209
1209
  function In(t) {
1210
1210
  return t instanceof Error ? t : new Error(String(t));
1211
1211
  }
1212
- function rs() {
1212
+ function is() {
1213
1213
  return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
1214
1214
  }
1215
- function is(t) {
1215
+ function ss(t) {
1216
1216
  return {
1217
1217
  frameBudgetMs: (t == null ? void 0 : t.frameBudgetMs) ?? qt,
1218
1218
  reserveMs: (t == null ? void 0 : t.reserveMs) ?? Kt,
1219
- now: (t == null ? void 0 : t.now) ?? rs
1219
+ now: (t == null ? void 0 : t.now) ?? is
1220
1220
  };
1221
1221
  }
1222
- function ss(t) {
1222
+ function as(t) {
1223
1223
  return {
1224
1224
  highWatermarkBytes: (t == null ? void 0 : t.highWatermarkBytes) ?? Wt,
1225
1225
  lowWatermarkBytes: (t == null ? void 0 : t.lowWatermarkBytes) ?? Xt,
@@ -1227,7 +1227,7 @@ function ss(t) {
1227
1227
  initialTextCredits: (t == null ? void 0 : t.initialTextCredits) ?? Qt
1228
1228
  };
1229
1229
  }
1230
- function as() {
1230
+ function os() {
1231
1231
  return new Promise((t) => {
1232
1232
  if (typeof globalThis.requestAnimationFrame == "function") {
1233
1233
  globalThis.requestAnimationFrame(() => t());
@@ -1237,21 +1237,21 @@ function as() {
1237
1237
  });
1238
1238
  }
1239
1239
  async function ht(t) {
1240
- await as(), await (t == null ? void 0 : t());
1240
+ await os(), await (t == null ? void 0 : t());
1241
1241
  }
1242
- async function or(t) {
1242
+ async function lr(t) {
1243
1243
  var tn, nn;
1244
- const { node: n } = t, e = new ns(n), r = t.appendExternalVariantDelta === !0, i = new Ji(is(t.scheduler));
1245
- let s = null, a = !0, o = null, l = !1, d = !1, u = !1, c = null, h = !1, y = null, x = null, m = null, b = !1;
1244
+ const { node: n } = t, e = new rs(n), r = t.appendExternalVariantDelta === !0, i = new es(ss(t.scheduler));
1245
+ let s = null, a = !0, o = null, l = !1, c = !1, u = !1, d = null, h = !1, y = null, x = null, m = null, b = !1;
1246
1246
  const R = [], I = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), T = () => {
1247
1247
  var p;
1248
1248
  b || (b = !0, (p = t.onFirstRenderableAppend) == null || p.call(t));
1249
- }, A = new Promise((p, D) => {
1249
+ }, B = new Promise((p, D) => {
1250
1250
  y = D;
1251
1251
  });
1252
- A.catch(() => {
1252
+ B.catch(() => {
1253
1253
  });
1254
- const B = (p) => {
1254
+ const A = (p) => {
1255
1255
  var oe;
1256
1256
  const D = In(p);
1257
1257
  if (!u) {
@@ -1288,7 +1288,7 @@ async function or(t) {
1288
1288
  }
1289
1289
  p.resolve();
1290
1290
  }
1291
- }, _ = () => (h = !0, c || (c = Promise.resolve().then(async () => {
1291
+ }, _ = () => (h = !0, d || (d = Promise.resolve().then(async () => {
1292
1292
  for (; !u; ) {
1293
1293
  for (h = !1; !u && i.hasPending(); ) {
1294
1294
  const p = await i.runFrame();
@@ -1298,11 +1298,11 @@ async function or(t) {
1298
1298
  break;
1299
1299
  }
1300
1300
  }).catch((p) => {
1301
- throw B(p);
1301
+ throw A(p);
1302
1302
  }).finally(() => {
1303
- c = null, !u && h && i.hasPending() && _();
1304
- }), c.catch(() => {
1305
- }), c)), X = (p, D, oe) => {
1303
+ d = null, !u && h && i.hasPending() && _();
1304
+ }), d.catch(() => {
1305
+ }), d)), X = (p, D, oe) => {
1306
1306
  let j = null, rn = null;
1307
1307
  const le = new Promise((Me, rt) => {
1308
1308
  j = Me, rn = rt;
@@ -1325,14 +1325,14 @@ async function or(t) {
1325
1325
  ), le.catch(() => {
1326
1326
  }), O(Z), i.enqueue(() => {
1327
1327
  if (u) {
1328
- M(Z, B(new Error("Geo loader pipeline failed before append task ran")));
1328
+ M(Z, A(new Error("Geo loader pipeline failed before append task ran")));
1329
1329
  return;
1330
1330
  }
1331
1331
  try {
1332
1332
  Z.append(), o && Z.flowQueued && P(o.onConsumed(Z.kind, Z.bytes), !0), M(Z);
1333
1333
  } catch (Me) {
1334
1334
  const rt = In(Me);
1335
- throw M(Z, rt), B(Me);
1335
+ throw M(Z, rt), A(Me);
1336
1336
  }
1337
1337
  }), _(), le;
1338
1338
  }, N = (p) => {
@@ -1353,7 +1353,7 @@ async function or(t) {
1353
1353
  return;
1354
1354
  }
1355
1355
  }, C = (p) => X(p.type === "text" ? "text" : "geometry", p.bytes, () => {
1356
- if (d) {
1356
+ if (c) {
1357
1357
  N(p);
1358
1358
  return;
1359
1359
  }
@@ -1363,10 +1363,10 @@ async function or(t) {
1363
1363
  var j;
1364
1364
  await ((j = t.beforeTextAppend) == null ? void 0 : j.call(t, p)), await D();
1365
1365
  }).catch((j) => {
1366
- throw B(j);
1366
+ throw A(j);
1367
1367
  });
1368
1368
  return E(oe);
1369
- }, Fr = (p) => {
1369
+ }, Or = (p) => {
1370
1370
  if (!u) {
1371
1371
  if (p.type === "header") {
1372
1372
  if (r) {
@@ -1429,15 +1429,15 @@ async function or(t) {
1429
1429
  externalVariantDeltaOnly: t.externalVariantDeltaOnly,
1430
1430
  cacheDocument: t.cacheDocument
1431
1431
  },
1432
- Fr
1432
+ Or
1433
1433
  ), s.completion.catch(() => {
1434
1434
  }), t.signal) {
1435
1435
  const p = t.signal, D = () => {
1436
- B(W(p.reason));
1436
+ A(W(p.reason));
1437
1437
  };
1438
1438
  p.addEventListener("abort", D, { once: !0 }), x = () => p.removeEventListener("abort", D), p.aborted && D();
1439
1439
  }
1440
- if (s.grant && (o = new Zn(ss(t.flowControl)), K(), P(o.takeInitialGrant(), !1)), await Promise.race([s.completion, A]), s.backgroundCompletion && await Promise.race([s.backgroundCompletion, A]), await _(), await Promise.all(Array.from(w)), !l)
1440
+ if (s.grant && (o = new Jn(as(t.flowControl)), K(), P(o.takeInitialGrant(), !1)), await Promise.race([s.completion, B]), s.backgroundCompletion && await Promise.race([s.backgroundCompletion, B]), await _(), await Promise.all(Array.from(w)), !l)
1441
1441
  throw new Error("Geo loader pipeline completed without done event");
1442
1442
  if (await ((nn = t.beforeFinalize) == null ? void 0 : nn.call(t)), r) {
1443
1443
  if (!m)
@@ -1450,7 +1450,7 @@ async function or(t) {
1450
1450
  await _(), await Promise.all(Array.from(w)), await n._finalizeIncrementally(() => ht(t.onYield));
1451
1451
  } else
1452
1452
  await e.finalize(() => ht(t.onYield));
1453
- if (d = !0, s.backgroundCompletion) {
1453
+ if (c = !0, s.backgroundCompletion) {
1454
1454
  const p = s;
1455
1455
  a = !1, s.backgroundCompletion.then(async () => {
1456
1456
  await _(), await Promise.all(Array.from(w));
@@ -1460,15 +1460,15 @@ async function or(t) {
1460
1460
  });
1461
1461
  }
1462
1462
  } catch (p) {
1463
- throw B(p);
1463
+ throw A(p);
1464
1464
  } finally {
1465
1465
  x == null || x(), a && (s == null || s.dispose());
1466
1466
  }
1467
1467
  }
1468
- function lr(t) {
1468
+ function cr(t) {
1469
1469
  return t instanceof Error ? t : new Error(String(t));
1470
1470
  }
1471
- function os(t) {
1471
+ function ls(t) {
1472
1472
  if (!t || t.size === 0)
1473
1473
  return t;
1474
1474
  const n = /* @__PURE__ */ new Map();
@@ -1476,22 +1476,22 @@ function os(t) {
1476
1476
  n.set(e, r.slice(0));
1477
1477
  return n;
1478
1478
  }
1479
- function ls() {
1479
+ function cs() {
1480
1480
  return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
1481
1481
  }
1482
1482
  function dr(t = {}) {
1483
- var a, o, l, d, u, c, h;
1483
+ var a, o, l, c, u, d, h;
1484
1484
  const n = t.hiddenInstanceIds ? new Set(t.hiddenInstanceIds) : /* @__PURE__ */ new Set(), e = t.requiredExternalVariantIds !== void 0, r = e ? new Set(t.requiredExternalVariantIds) : /* @__PURE__ */ new Set(), i = t.externalVariantGeometryFetchIds !== void 0, s = i ? new Set(t.externalVariantGeometryFetchIds) : /* @__PURE__ */ new Set();
1485
1485
  return {
1486
1486
  scheduler: {
1487
1487
  frameBudgetMs: ((a = t.scheduler) == null ? void 0 : a.frameBudgetMs) ?? qt,
1488
1488
  reserveMs: ((o = t.scheduler) == null ? void 0 : o.reserveMs) ?? Kt,
1489
- now: ((l = t.scheduler) == null ? void 0 : l.now) ?? ls
1489
+ now: ((l = t.scheduler) == null ? void 0 : l.now) ?? cs
1490
1490
  },
1491
1491
  flowControl: {
1492
- highWatermarkBytes: ((d = t.flowControl) == null ? void 0 : d.highWatermarkBytes) ?? Wt,
1492
+ highWatermarkBytes: ((c = t.flowControl) == null ? void 0 : c.highWatermarkBytes) ?? Wt,
1493
1493
  lowWatermarkBytes: ((u = t.flowControl) == null ? void 0 : u.lowWatermarkBytes) ?? Xt,
1494
- initialGeometryCredits: ((c = t.flowControl) == null ? void 0 : c.initialGeometryCredits) ?? Yt,
1494
+ initialGeometryCredits: ((d = t.flowControl) == null ? void 0 : d.initialGeometryCredits) ?? Yt,
1495
1495
  initialTextCredits: ((h = t.flowControl) == null ? void 0 : h.initialTextCredits) ?? Qt
1496
1496
  },
1497
1497
  beforeTextAppend: t.beforeTextAppend,
@@ -1516,13 +1516,13 @@ function dr(t = {}) {
1516
1516
  onFirstRenderableAppend: t.onFirstRenderableAppend
1517
1517
  };
1518
1518
  }
1519
- async function cr(t, n, e, r = {}) {
1519
+ async function ur(t, n, e, r = {}) {
1520
1520
  const i = dr(r), s = i.hiddenInstanceIds ?? /* @__PURE__ */ new Set(), a = i.preferWorker && i.workerAdapter ? i.workerAdapter : i.preferWorker && nt(i.workerFactory) ? jt({
1521
1521
  workerUrl: i.workerUrl,
1522
1522
  workerFactory: i.workerFactory
1523
1523
  }) : $t();
1524
1524
  try {
1525
- await or({
1525
+ await lr({
1526
1526
  node: t,
1527
1527
  buffer: n,
1528
1528
  adapter: a,
@@ -1547,24 +1547,24 @@ async function cr(t, n, e, r = {}) {
1547
1547
  onFirstRenderableAppend: i.onFirstRenderableAppend
1548
1548
  });
1549
1549
  } catch (o) {
1550
- const l = lr(o);
1550
+ const l = cr(o);
1551
1551
  throw t.ready.catch(() => {
1552
1552
  }), l;
1553
1553
  }
1554
1554
  }
1555
1555
  async function Et(t, n, e, r = {}) {
1556
- var c;
1556
+ var d;
1557
1557
  const i = dr({
1558
1558
  ...r,
1559
1559
  externalVariantDeltaOnly: !0
1560
1560
  }), s = i.hiddenInstanceIds ?? /* @__PURE__ */ new Set(), a = i.preferWorker && (i.workerAdapter !== void 0 || nt(i.workerFactory)), o = i.preferWorker && i.workerAdapter ? i.workerAdapter : a ? jt({
1561
1561
  workerUrl: i.workerUrl,
1562
1562
  workerFactory: i.workerFactory
1563
- }) : $t(), l = a && i.externalVariantDeltaOnly && ((c = i.workerAdapter) == null ? void 0 : c.mainBufferReuseReady) === !0, d = a && !l ? n.slice(0) : n, u = a ? os(i.externalVariantBuffers) : i.externalVariantBuffers;
1563
+ }) : $t(), l = a && i.externalVariantDeltaOnly && ((d = i.workerAdapter) == null ? void 0 : d.mainBufferReuseReady) === !0, c = a && !l ? n.slice(0) : n, u = a ? ls(i.externalVariantBuffers) : i.externalVariantBuffers;
1564
1564
  try {
1565
- await or({
1565
+ await lr({
1566
1566
  node: t,
1567
- buffer: d,
1567
+ buffer: c,
1568
1568
  adapter: o,
1569
1569
  scheduler: i.scheduler,
1570
1570
  flowControl: i.flowControl,
@@ -1586,35 +1586,35 @@ async function Et(t, n, e, r = {}) {
1586
1586
  onFirstRenderableAppend: i.onFirstRenderableAppend
1587
1587
  });
1588
1588
  } catch (h) {
1589
- throw lr(h);
1589
+ throw cr(h);
1590
1590
  }
1591
1591
  }
1592
- const ds = "?", cs = {
1592
+ const ds = "?", us = {
1593
1593
  "℄": "CL",
1594
1594
  "∅": "Ø",
1595
1595
  "⌀": "Ø"
1596
1596
  };
1597
- function us(t) {
1597
+ function hs(t) {
1598
1598
  return t >= 0 && t <= 8 || t >= 11 && t <= 31 || t >= 127 && t <= 159 || t >= 65024 && t <= 65039 || t >= 917760 && t <= 917999;
1599
1599
  }
1600
- function hs(t) {
1600
+ function fs(t) {
1601
1601
  return t >= 13312 && t <= 19903 || t >= 131072 && t <= 173791 || t >= 173824 && t <= 177983 || t >= 177984 && t <= 178207 || t >= 178208 && t <= 183983 || t >= 183984 && t <= 191471 || t >= 191472 && t <= 192095 || t >= 196608 && t <= 201551 || t >= 201552 && t <= 205743 || t >= 194560 && t <= 195103;
1602
1602
  }
1603
- function fs(t) {
1603
+ function ys(t) {
1604
1604
  let n = !1, e = "";
1605
1605
  for (const r of t) {
1606
1606
  const i = r.codePointAt(0);
1607
1607
  if (i === void 0) continue;
1608
- const s = cs[r];
1608
+ const s = us[r];
1609
1609
  if (s !== void 0) {
1610
1610
  e += s, n = !0;
1611
1611
  continue;
1612
1612
  }
1613
- if (us(i)) {
1613
+ if (hs(i)) {
1614
1614
  n = !0;
1615
1615
  continue;
1616
1616
  }
1617
- if (hs(i)) {
1617
+ if (fs(i)) {
1618
1618
  e += ds, n = !0;
1619
1619
  continue;
1620
1620
  }
@@ -1622,26 +1622,26 @@ function fs(t) {
1622
1622
  }
1623
1623
  return { text: e, replacedUnsupported: n };
1624
1624
  }
1625
- function ur(t) {
1626
- return fs(t);
1625
+ function hr(t) {
1626
+ return ys(t);
1627
1627
  }
1628
1628
  function Cn(t) {
1629
1629
  if (!Number.isFinite(t)) return 0;
1630
1630
  const n = Math.round(t);
1631
1631
  return n < 0 ? 0 : n > 255 ? 255 : n;
1632
1632
  }
1633
- function hr(t) {
1633
+ function fr(t) {
1634
1634
  return Number.isFinite(t) ? t >= 0 && t <= 1 ? Cn(t * 255) : Cn(t) : 0;
1635
1635
  }
1636
- function fr(t) {
1636
+ function yr(t) {
1637
1637
  if (t instanceof Uint8Array)
1638
1638
  return t;
1639
1639
  const n = new Uint8Array(t.length);
1640
1640
  for (let e = 0; e < t.length; e += 1)
1641
- n[e] = hr(t[e] ?? 0);
1641
+ n[e] = fr(t[e] ?? 0);
1642
1642
  return n;
1643
1643
  }
1644
- function ys(t) {
1644
+ function ms(t) {
1645
1645
  const n = new Float32Array(t.length);
1646
1646
  for (let e = 0; e < t.length; e += 1)
1647
1647
  n[e] = (t[e] ?? 0) / 255;
@@ -1650,15 +1650,15 @@ function ys(t) {
1650
1650
  function wn(t) {
1651
1651
  return new $(t, 3, !0);
1652
1652
  }
1653
- function ms(t) {
1653
+ function ps(t) {
1654
1654
  const n = t.array;
1655
1655
  if (n instanceof Uint8Array)
1656
1656
  return n;
1657
1657
  if (n instanceof Float32Array)
1658
- return fr(n);
1658
+ return yr(n);
1659
1659
  const e = new Uint8Array(n.length);
1660
1660
  for (let r = 0; r < n.length; r += 1)
1661
- e[r] = hr(Number(n[r] ?? 0));
1661
+ e[r] = fr(Number(n[r] ?? 0));
1662
1662
  return e;
1663
1663
  }
1664
1664
  function Ye(t, n) {
@@ -1670,21 +1670,21 @@ function Ye(t, n) {
1670
1670
  return !1;
1671
1671
  return e === t;
1672
1672
  }
1673
- function ps(t, n) {
1673
+ function xs(t, n) {
1674
1674
  if (!Ye(t, n))
1675
1675
  throw new Error("Source color runs must be positive, contiguous, and cover the vertex count exactly.");
1676
1676
  }
1677
- function yr(t, n, e) {
1677
+ function mr(t, n, e) {
1678
1678
  return (t & 255) << 16 | (n & 255) << 8 | e & 255;
1679
1679
  }
1680
- function xs(t, n) {
1680
+ function gs(t, n) {
1681
1681
  const e = new Uint8Array(t.length), r = Math.floor(t.length / 3), i = /* @__PURE__ */ new Map();
1682
- let s = -1, a = [0, 0, 0], o = 0, l = 0, d = 0;
1682
+ let s = -1, a = [0, 0, 0], o = 0, l = 0, c = 0;
1683
1683
  for (let u = 0; u < r; u += 1) {
1684
- const c = u * 3, h = t[c] ?? 0, y = t[c + 1] ?? 0, x = t[c + 2] ?? 0, m = yr(h, y, x);
1684
+ const d = u * 3, h = t[d] ?? 0, y = t[d + 1] ?? 0, x = t[d + 2] ?? 0, m = mr(h, y, x);
1685
1685
  let b;
1686
1686
  if (m === s)
1687
- b = a, d += 1;
1687
+ b = a, c += 1;
1688
1688
  else {
1689
1689
  o += 1;
1690
1690
  const R = i.get(m);
@@ -1696,7 +1696,7 @@ function xs(t, n) {
1696
1696
  }
1697
1697
  s = m, a = b;
1698
1698
  }
1699
- e[c] = b[0], e[c + 1] = b[1], e[c + 2] = b[2];
1699
+ e[d] = b[0], e[d + 1] = b[1], e[d + 2] = b[2];
1700
1700
  }
1701
1701
  return {
1702
1702
  color: e,
@@ -1705,7 +1705,7 @@ function xs(t, n) {
1705
1705
  runCount: o,
1706
1706
  uniqueColorCount: i.size,
1707
1707
  cacheHitCount: l,
1708
- repeatedRunVertexCount: d
1708
+ repeatedRunVertexCount: c
1709
1709
  }
1710
1710
  };
1711
1711
  }
@@ -1716,52 +1716,52 @@ function vn(t, n, e) {
1716
1716
  stats: i
1717
1717
  };
1718
1718
  }
1719
- function gs(t, n, e) {
1720
- const r = new Float32Array(t * 3), i = bs(r, t, n, e);
1719
+ function bs(t, n, e) {
1720
+ const r = new Float32Array(t * 3), i = Is(r, t, n, e);
1721
1721
  return {
1722
1722
  color: r,
1723
1723
  stats: i
1724
1724
  };
1725
1725
  }
1726
1726
  function St(t, n, e, r) {
1727
- return mr(t, n, e, r, 1);
1727
+ return pr(t, n, e, r, 1);
1728
1728
  }
1729
- function bs(t, n, e, r) {
1730
- return mr(t, n, e, r, 1 / 255);
1729
+ function Is(t, n, e, r) {
1730
+ return pr(t, n, e, r, 1 / 255);
1731
1731
  }
1732
- function mr(t, n, e, r, i) {
1733
- ps(n, e);
1732
+ function pr(t, n, e, r, i) {
1733
+ xs(n, e);
1734
1734
  const s = n * 3;
1735
1735
  if (t.length !== s)
1736
1736
  throw new Error("Display color target must cover the vertex count exactly.");
1737
1737
  const a = /* @__PURE__ */ new Map();
1738
1738
  let o = 0, l = 0;
1739
- for (const d of e) {
1740
- if (d.vertexCount <= 0) continue;
1741
- const u = d.color[0] ?? 0, c = d.color[1] ?? 0, h = d.color[2] ?? 0, y = yr(u, c, h);
1739
+ for (const c of e) {
1740
+ if (c.vertexCount <= 0) continue;
1741
+ const u = c.color[0] ?? 0, d = c.color[1] ?? 0, h = c.color[2] ?? 0, y = mr(u, d, h);
1742
1742
  let x = a.get(y);
1743
1743
  if (x)
1744
1744
  o += 1;
1745
1745
  else {
1746
- const b = r([u, c, h]);
1746
+ const b = r([u, d, h]);
1747
1747
  x = [b[0], b[1], b[2]], a.set(y, x);
1748
1748
  }
1749
- l += Math.max(0, d.vertexCount - 1);
1750
- const m = Math.min(n, d.startVertex + d.vertexCount);
1751
- for (let b = d.startVertex; b < m; b += 1) {
1749
+ l += Math.max(0, c.vertexCount - 1);
1750
+ const m = Math.min(n, c.startVertex + c.vertexCount);
1751
+ for (let b = c.startVertex; b < m; b += 1) {
1752
1752
  const R = b * 3;
1753
1753
  t[R] = x[0] * i, t[R + 1] = x[1] * i, t[R + 2] = x[2] * i;
1754
1754
  }
1755
1755
  }
1756
1756
  return {
1757
1757
  vertexCount: n,
1758
- runCount: e.filter((d) => d.vertexCount > 0).length,
1758
+ runCount: e.filter((c) => c.vertexCount > 0).length,
1759
1759
  uniqueColorCount: a.size,
1760
1760
  cacheHitCount: o,
1761
1761
  repeatedRunVertexCount: l
1762
1762
  };
1763
1763
  }
1764
- const Is = {
1764
+ const Cs = {
1765
1765
  dark: {
1766
1766
  background: [12, 12, 20],
1767
1767
  foreground: [242, 244, 248],
@@ -1784,7 +1784,7 @@ const Is = {
1784
1784
  xrefOpacity: 0.32,
1785
1785
  hatchOpacity: 0.28
1786
1786
  }
1787
- }, Cs = {
1787
+ }, ws = {
1788
1788
  1: [255, 0, 0],
1789
1789
  2: [255, 255, 0],
1790
1790
  3: [0, 255, 0],
@@ -1793,19 +1793,19 @@ const Is = {
1793
1793
  6: [255, 0, 255],
1794
1794
  8: [128, 128, 128],
1795
1795
  9: [192, 192, 192]
1796
- }, ws = 8;
1797
- function pr(t) {
1798
- return Is[t];
1796
+ }, vs = 8;
1797
+ function xr(t) {
1798
+ return Cs[t];
1799
1799
  }
1800
1800
  function Rn(t, n) {
1801
- const e = pr(n.theme), r = n.elementKind ?? "line", i = n.state ?? "normal", s = ze(t, n, 0);
1802
- let a = Bs(s, e, r), o = s.kind === "aci" && xr(s.index) === 7;
1801
+ const e = xr(n.theme), r = n.elementKind ?? "line", i = n.state ?? "normal", s = ze(t, n, 0);
1802
+ let a = Vs(s, e, r), o = s.kind === "aci" && gr(s.index) === 7;
1803
1803
  if (n.enhanceContrast) {
1804
- const d = vs(a, {
1804
+ const c = Rs(a, {
1805
1805
  theme: n.theme,
1806
1806
  elementKind: r
1807
1807
  });
1808
- o || (o = !Es(a, d)), a = d;
1808
+ o || (o = !Ss(a, c)), a = c;
1809
1809
  }
1810
1810
  let l = r === "hatch" ? e.hatchOpacity : 1;
1811
1811
  return i === "hidden" && (l = 0), i === "locked" && (l *= e.lockedOpacity), i === "xrefFaded" && (l *= e.xrefOpacity), i === "hover" && (a = e.hover, o = !0), i === "selected" && (a = e.selected, o = !0), {
@@ -1816,12 +1816,12 @@ function Rn(t, n) {
1816
1816
  adapted: o
1817
1817
  };
1818
1818
  }
1819
- function vs(t, n) {
1820
- const e = pr(n.theme), r = n.elementKind === "text" ? 4.5 : n.elementKind === "hatch" ? 1.6 : 2.2;
1821
- return gr(t, e.background) >= r ? Ce(t) : Ss(t, e.background, r, n.theme);
1819
+ function Rs(t, n) {
1820
+ const e = xr(n.theme), r = n.elementKind === "text" ? 4.5 : n.elementKind === "hatch" ? 1.6 : 2.2;
1821
+ return br(t, e.background) >= r ? Ce(t) : ks(t, e.background, r, n.theme);
1822
1822
  }
1823
1823
  function ze(t, n, e = 0) {
1824
- return e > ws ? n.fallbackColor ?? { kind: "aci", index: 7 } : t.kind === "bylayer" ? ze(n.layerColor ?? n.fallbackColor ?? { kind: "aci", index: 7 }, n, e + 1) : t.kind === "byblock" ? ze(
1824
+ return e > vs ? n.fallbackColor ?? { kind: "aci", index: 7 } : t.kind === "bylayer" ? ze(n.layerColor ?? n.fallbackColor ?? { kind: "aci", index: 7 }, n, e + 1) : t.kind === "byblock" ? ze(
1825
1825
  n.byBlockColor ?? n.parentByBlockColor ?? n.fallbackColor ?? { kind: "aci", index: 7 },
1826
1826
  {
1827
1827
  ...n,
@@ -1830,69 +1830,69 @@ function ze(t, n, e = 0) {
1830
1830
  e + 1
1831
1831
  ) : t.kind === "none" ? ze(n.fallbackColor ?? { kind: "aci", index: 7 }, n, e + 1) : t;
1832
1832
  }
1833
- function Rs(t) {
1833
+ function Bs(t) {
1834
1834
  return Jt(t);
1835
1835
  }
1836
1836
  function Jt(t) {
1837
1837
  return Math.abs(t[0] - 200) <= 2 && Math.abs(t[1] - 200) <= 2 && Math.abs(t[2] - 200) <= 2;
1838
1838
  }
1839
1839
  function As(t, n = {}) {
1840
- return n.treatLegacyForegroundAsAci7 && Rs(t) ? { kind: "aci", index: 7 } : { kind: "truecolor", rgb: Ce(t) };
1840
+ return n.treatLegacyForegroundAsAci7 && Bs(t) ? { kind: "aci", index: 7 } : { kind: "truecolor", rgb: Ce(t) };
1841
1841
  }
1842
- function Bs(t, n, e) {
1843
- return t.kind === "truecolor" ? Ce(t.rgb) : t.kind === "aci" ? Vs(t.index, n) : (t.kind === "none", e === "text" ? n.defaultText : n.defaultLine);
1842
+ function Vs(t, n, e) {
1843
+ return t.kind === "truecolor" ? Ce(t.rgb) : t.kind === "aci" ? Es(t.index, n) : (t.kind === "none", e === "text" ? n.defaultText : n.defaultLine);
1844
1844
  }
1845
- function Vs(t, n) {
1846
- const e = xr(t);
1847
- return Ce(e === 7 || e === 0 || e === 256 ? n.foreground : Cs[e] ?? n.defaultLine);
1845
+ function Es(t, n) {
1846
+ const e = gr(t);
1847
+ return Ce(e === 7 || e === 0 || e === 256 ? n.foreground : ws[e] ?? n.defaultLine);
1848
1848
  }
1849
- function xr(t) {
1849
+ function gr(t) {
1850
1850
  return Number.isFinite(t) ? Math.abs(Math.trunc(t)) : 7;
1851
1851
  }
1852
1852
  function Ce(t) {
1853
1853
  return [Y(t[0]), Y(t[1]), Y(t[2])];
1854
1854
  }
1855
- function Es(t, n) {
1855
+ function Ss(t, n) {
1856
1856
  return t[0] === n[0] && t[1] === n[1] && t[2] === n[2];
1857
1857
  }
1858
1858
  function Y(t) {
1859
1859
  return Number.isFinite(t) ? Math.max(0, Math.min(255, Math.round(t))) : 0;
1860
1860
  }
1861
- function An(t) {
1861
+ function Bn(t) {
1862
1862
  const [n, e, r] = t.map((i) => {
1863
1863
  const s = Y(i) / 255;
1864
1864
  return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
1865
1865
  });
1866
1866
  return 0.2126 * (n ?? 0) + 0.7152 * (e ?? 0) + 0.0722 * (r ?? 0);
1867
1867
  }
1868
- function gr(t, n) {
1869
- const e = An(t), r = An(n), i = Math.max(e, r), s = Math.min(e, r);
1868
+ function br(t, n) {
1869
+ const e = Bn(t), r = Bn(n), i = Math.max(e, r), s = Math.min(e, r);
1870
1870
  return (i + 0.05) / (s + 0.05);
1871
1871
  }
1872
- function Ss(t, n, e, r) {
1873
- const i = ks(t);
1872
+ function ks(t, n, e, r) {
1873
+ const i = Ts(t);
1874
1874
  let s = 0, a = 1, o = Ce(t);
1875
1875
  for (let l = 0; l < 16; l += 1) {
1876
- const d = (s + a) / 2, u = r === "light" ? i.l * (1 - d) : i.l + (1 - i.l) * d, c = Ts(i.h, i.s, u);
1877
- gr(c, n) >= e ? (o = c, a = d) : s = d;
1876
+ const c = (s + a) / 2, u = r === "light" ? i.l * (1 - c) : i.l + (1 - i.l) * c, d = Ps(i.h, i.s, u);
1877
+ br(d, n) >= e ? (o = d, a = c) : s = c;
1878
1878
  }
1879
1879
  return o;
1880
1880
  }
1881
- function ks(t) {
1881
+ function Ts(t) {
1882
1882
  const n = Y(t[0]) / 255, e = Y(t[1]) / 255, r = Y(t[2]) / 255, i = Math.max(n, e, r), s = Math.min(n, e, r), a = (i + s) / 2;
1883
1883
  if (i === s) return { h: 0, s: 0, l: a };
1884
1884
  const o = i - s, l = a > 0.5 ? o / (2 - i - s) : o / (i + s);
1885
- let d = 0;
1886
- return i === n ? d = (e - r) / o + (e < r ? 6 : 0) : i === e ? d = (r - n) / o + 2 : d = (n - e) / o + 4, d /= 6, { h: d, s: l, l: a };
1885
+ let c = 0;
1886
+ return i === n ? c = (e - r) / o + (e < r ? 6 : 0) : i === e ? c = (r - n) / o + 2 : c = (n - e) / o + 4, c /= 6, { h: c, s: l, l: a };
1887
1887
  }
1888
- function Ts(t, n, e) {
1888
+ function Ps(t, n, e) {
1889
1889
  if (n === 0) {
1890
1890
  const a = Y(e * 255);
1891
1891
  return [a, a, a];
1892
1892
  }
1893
1893
  const r = (a, o, l) => {
1894
- let d = l;
1895
- return d < 0 && (d += 1), d > 1 && (d -= 1), d < 1 / 6 ? a + (o - a) * 6 * d : d < 1 / 2 ? o : d < 2 / 3 ? a + (o - a) * (2 / 3 - d) * 6 : a;
1894
+ let c = l;
1895
+ return c < 0 && (c += 1), c > 1 && (c -= 1), c < 1 / 6 ? a + (o - a) * 6 * c : c < 1 / 2 ? o : c < 2 / 3 ? a + (o - a) * (2 / 3 - c) * 6 : a;
1896
1896
  }, i = e < 0.5 ? e * (1 + n) : e + n - e * n, s = 2 * e - i;
1897
1897
  return [
1898
1898
  Y(r(s, i, t + 1 / 3) * 255),
@@ -1900,7 +1900,7 @@ function Ts(t, n, e) {
1900
1900
  Y(r(s, i, t - 1 / 3) * 255)
1901
1901
  ];
1902
1902
  }
1903
- const Ps = "dark", Ls = `
1903
+ const Ls = "dark", Ms = `
1904
1904
  precision highp float;
1905
1905
 
1906
1906
  uniform mat4 modelViewMatrix;
@@ -1951,7 +1951,7 @@ void main() {
1951
1951
  #endif
1952
1952
  vColor = mix(sourceColor, uLayerColor, uUseLayerColor);
1953
1953
  }
1954
- `, Ms = `
1954
+ `, Ds = `
1955
1955
  precision highp float;
1956
1956
 
1957
1957
  uniform float uOpacity;
@@ -1969,10 +1969,10 @@ void main() {
1969
1969
  gl_FragColor = vec4(linearToOutputSrgb(vColor), uOpacity);
1970
1970
  }
1971
1971
  `;
1972
- class br extends $r {
1972
+ class Ir extends jr {
1973
1973
  constructor(e) {
1974
1974
  var a, o;
1975
- const r = new Wn(16777215), i = new Xn(1, 1), s = e.variant === "fat";
1975
+ const r = new Xn(16777215), i = new Yn(1, 1), s = e.variant === "fat";
1976
1976
  super({
1977
1977
  glslVersion: null,
1978
1978
  defines: s ? { CAD_LINE_FAT: 1 } : {},
@@ -1984,8 +1984,8 @@ class br extends $r {
1984
1984
  uLayerColor: { value: r },
1985
1985
  uOpacity: { value: 1 }
1986
1986
  },
1987
- vertexShader: Ls,
1988
- fragmentShader: Ms,
1987
+ vertexShader: Ms,
1988
+ fragmentShader: Ds,
1989
1989
  vertexColors: !0
1990
1990
  });
1991
1991
  f(this, "color");
@@ -2016,7 +2016,7 @@ class br extends $r {
2016
2016
  this.uniforms.uResolution.value.set(Math.max(1, e), Math.max(1, r));
2017
2017
  }
2018
2018
  }
2019
- const Ds = new Float32Array([
2019
+ const Fs = new Float32Array([
2020
2020
  -1,
2021
2021
  1,
2022
2022
  1,
@@ -2041,7 +2041,7 @@ const Ds = new Float32Array([
2041
2041
  1,
2042
2042
  0,
2043
2043
  -1
2044
- ]), Fs = [
2044
+ ]), Os = [
2045
2045
  0,
2046
2046
  2,
2047
2047
  1,
@@ -2061,24 +2061,24 @@ const Ds = new Float32Array([
2061
2061
  7,
2062
2062
  5
2063
2063
  ];
2064
- function Os(t) {
2065
- const n = new st(t.minX, t.minY, 0), e = new st(t.maxX, t.maxY, 0), r = new jr(n, e), i = new st((t.minX + t.maxX) / 2, (t.minY + t.maxY) / 2, 0), s = Math.hypot(t.maxX - t.minX, t.maxY - t.minY) / 2;
2066
- return { box: r, sphere: new Zr(i, s) };
2064
+ function _s(t) {
2065
+ const n = new st(t.minX, t.minY, 0), e = new st(t.maxX, t.maxY, 0), r = new Zr(n, e), i = new st((t.minX + t.maxX) / 2, (t.minY + t.maxY) / 2, 0), s = Math.hypot(t.maxX - t.minX, t.maxY - t.minY) / 2;
2066
+ return { box: r, sphere: new Jr(i, s) };
2067
2067
  }
2068
- function Ir(t, n) {
2069
- const e = Os(n);
2068
+ function Cr(t, n) {
2069
+ const e = _s(n);
2070
2070
  t.boundingBox = e.box, t.boundingSphere = e.sphere;
2071
2071
  }
2072
- function _s(t) {
2072
+ function Gs(t) {
2073
2073
  const n = new Nt();
2074
- n.setAttribute("position", new $(t.position, t.positionItemSize)), n.setAttribute("color", new $(t.color, 3, !0)), Ir(n, t.bbox);
2075
- const e = new br({ variant: "thin" }), r = new zt(n, e);
2074
+ n.setAttribute("position", new $(t.position, t.positionItemSize)), n.setAttribute("color", new $(t.color, 3, !0)), Cr(n, t.bbox);
2075
+ const e = new Ir({ variant: "thin" }), r = new zt(n, e);
2076
2076
  return r.name = "cad-thin-line", r.renderOrder = 1, r.userData.kind = "line", r.userData.mode = "thin", r.userData.vertexCount = t.vertexCount, r.userData.bbox = t.bbox, r;
2077
2077
  }
2078
- function Gs(t) {
2079
- const n = Math.floor(t.vertexCount / 2), e = t.positionItemSize * 2, r = new an(t.position, e, 1), i = new an(t.color, 6, 1), s = new Yn();
2080
- s.setIndex(Fs), s.setAttribute("position", new Qn(Ds.slice(), 3)), s.setAttribute("instanceStart", new De(r, t.positionItemSize, 0)), s.setAttribute("instanceEnd", new De(r, t.positionItemSize, t.positionItemSize)), s.setAttribute("instanceColorStart", new De(i, 3, 0, !0)), s.setAttribute("instanceColorEnd", new De(i, 3, 3, !0)), s.instanceCount = n, Ir(s, t.bbox);
2081
- const a = new br({
2078
+ function Us(t) {
2079
+ const n = Math.floor(t.vertexCount / 2), e = t.positionItemSize * 2, r = new an(t.position, e, 1), i = new an(t.color, 6, 1), s = new Qn();
2080
+ s.setIndex(Os), s.setAttribute("position", new $n(Fs.slice(), 3)), s.setAttribute("instanceStart", new De(r, t.positionItemSize, 0)), s.setAttribute("instanceEnd", new De(r, t.positionItemSize, t.positionItemSize)), s.setAttribute("instanceColorStart", new De(i, 3, 0, !0)), s.setAttribute("instanceColorEnd", new De(i, 3, 3, !0)), s.instanceCount = n, Cr(s, t.bbox);
2081
+ const a = new Ir({
2082
2082
  variant: "fat",
2083
2083
  linewidthPx: t.linewidthPx,
2084
2084
  resolution: t.resolution
@@ -2091,8 +2091,8 @@ function ft(t) {
2091
2091
  const e = t.getAttribute("instanceColorStart"), r = t.getAttribute("instanceColorEnd");
2092
2092
  e && (e.needsUpdate = !0), r && (r.needsUpdate = !0);
2093
2093
  }
2094
- const Us = 65536;
2095
- class Ns {
2094
+ const Ns = 65536;
2095
+ class zs {
2096
2096
  constructor(n) {
2097
2097
  this.variants = n;
2098
2098
  }
@@ -2105,16 +2105,16 @@ class Ns {
2105
2105
  appendVariants(n) {
2106
2106
  const e = [];
2107
2107
  for (const r of n) {
2108
- const i = wr(r);
2108
+ const i = vr(r);
2109
2109
  if (!i) continue;
2110
2110
  const s = this.variants.get(i.variantId);
2111
- s && Bn(s), this.variants.set(i.variantId, i), e.push(i);
2111
+ s && An(s), this.variants.set(i.variantId, i), e.push(i);
2112
2112
  }
2113
2113
  return e;
2114
2114
  }
2115
2115
  dispose() {
2116
2116
  for (const n of this.variants.values())
2117
- Bn(n);
2117
+ An(n);
2118
2118
  this.variants.clear();
2119
2119
  }
2120
2120
  }
@@ -2122,12 +2122,12 @@ function yt(t, n) {
2122
2122
  const e = [];
2123
2123
  for (const r of n) {
2124
2124
  if (r.count <= 0) continue;
2125
- const i = r.bbox !== void 0 ? qs(r.bbox) : _e(r.pos, r.count, 3), s = zs(t);
2125
+ const i = r.bbox !== void 0 ? Ks(r.bbox) : _e(r.pos, r.count, 3), s = Hs(t);
2126
2126
  for (let a = 0; a < r.count; ) {
2127
- const o = Hs(a, r.count, s, Cr(t)), l = new Nt(), d = r.pos.subarray(a * 3, o * 3), u = r.col.subarray(a * 3, o * 3), c = o - a;
2128
- l.setAttribute("position", new $(d, 3)), l.setAttribute("color", new $(u, 3, !0)), e.push({
2127
+ const o = qs(a, r.count, s, wr(t)), l = new Nt(), c = r.pos.subarray(a * 3, o * 3), u = r.col.subarray(a * 3, o * 3), d = o - a;
2128
+ l.setAttribute("position", new $(c, 3)), l.setAttribute("color", new $(u, 3, !0)), e.push({
2129
2129
  geometry: l,
2130
- vertexCount: c,
2130
+ vertexCount: d,
2131
2131
  layerIndex: r.layerIndex ?? 0,
2132
2132
  ...r.lineweightPx === void 0 ? {} : { lineweightPx: r.lineweightPx },
2133
2133
  bbox: i
@@ -2136,14 +2136,14 @@ function yt(t, n) {
2136
2136
  }
2137
2137
  return e;
2138
2138
  }
2139
- function Cr(t) {
2139
+ function wr(t) {
2140
2140
  return t === "line" ? 2 : t === "fill" ? 3 : 1;
2141
2141
  }
2142
- function zs(t) {
2143
- const n = Cr(t);
2144
- return Math.max(n, Math.floor(Us / n) * n);
2142
+ function Hs(t) {
2143
+ const n = wr(t);
2144
+ return Math.max(n, Math.floor(Ns / n) * n);
2145
2145
  }
2146
- function Hs(t, n, e, r) {
2146
+ function qs(t, n, e, r) {
2147
2147
  let i = Math.min(n, t + e);
2148
2148
  if (i < n) {
2149
2149
  const s = t + Math.floor((i - t) / r) * r;
@@ -2151,18 +2151,18 @@ function Hs(t, n, e, r) {
2151
2151
  }
2152
2152
  return i > t ? i : n;
2153
2153
  }
2154
- function qs(t) {
2154
+ function Ks(t) {
2155
2155
  return t ? { minX: t.minX, minY: t.minY, maxX: t.maxX, maxY: t.maxY } : null;
2156
2156
  }
2157
- function Ks(t) {
2157
+ function Ws(t) {
2158
2158
  const n = /* @__PURE__ */ new Map();
2159
2159
  for (const e of t) {
2160
- const r = wr(e);
2160
+ const r = vr(e);
2161
2161
  r && n.set(r.variantId, r);
2162
2162
  }
2163
- return new Ns(n);
2163
+ return new zs(n);
2164
2164
  }
2165
- function wr(t) {
2165
+ function vr(t) {
2166
2166
  const n = /* @__PURE__ */ new Map(), e = yt("line", t.line);
2167
2167
  e.length > 0 && n.set("line", e);
2168
2168
  const r = yt("fill", t.fill);
@@ -2170,12 +2170,12 @@ function wr(t) {
2170
2170
  const i = yt("dot", t.dot);
2171
2171
  return i.length > 0 && n.set("dot", i), n.size > 0 ? { variantId: t.variantId, byKind: n } : null;
2172
2172
  }
2173
- function Bn(t) {
2173
+ function An(t) {
2174
2174
  for (const n of t.byKind.values())
2175
2175
  for (const e of n)
2176
2176
  e.geometry.dispose();
2177
2177
  }
2178
- class Ws {
2178
+ class Xs {
2179
2179
  constructor(n, e) {
2180
2180
  f(this, "mutableRecords");
2181
2181
  f(this, "indexByRecordKey", /* @__PURE__ */ new Map());
@@ -2241,14 +2241,14 @@ function kt(t, n) {
2241
2241
  };
2242
2242
  }
2243
2243
  function Vn(t) {
2244
- const n = new ti();
2244
+ const n = new ni();
2245
2245
  if (t.length > 0) {
2246
2246
  const e = new Array(t.length);
2247
2247
  for (let r = 0; r < t.length; r++)
2248
2248
  e[r] = kt(t[r], r);
2249
2249
  n.load(e);
2250
2250
  }
2251
- return new Ws(t, n);
2251
+ return new Xs(t, n);
2252
2252
  }
2253
2253
  class En {
2254
2254
  constructor(n) {
@@ -2278,11 +2278,11 @@ class En {
2278
2278
  this.removeVariantSlots(n.variantId);
2279
2279
  for (const [e, r] of n.byKind)
2280
2280
  for (const i of r) {
2281
- const s = this.initialCapacity, a = new Yn(), o = i.geometry.getAttribute("position"), l = i.geometry.getAttribute("color");
2281
+ const s = this.initialCapacity, a = new Qn(), o = i.geometry.getAttribute("position"), l = i.geometry.getAttribute("color");
2282
2282
  o && a.setAttribute("position", o), l && a.setAttribute("color", l), a.instanceCount = 0;
2283
- const d = new de(new Float32Array(s * 4), 4), u = new de(new Float32Array(s * 4), 4), c = new de(new Float32Array(s), 1);
2284
- a.setAttribute("promotedInstMatRow0", d), a.setAttribute("promotedInstMatRow1", u), a.setAttribute("promotedInstVisible", c);
2285
- const h = Ys(e, a, this.materialFactory(e));
2283
+ const c = new ce(new Float32Array(s * 4), 4), u = new ce(new Float32Array(s * 4), 4), d = new ce(new Float32Array(s), 1);
2284
+ a.setAttribute("promotedInstMatRow0", c), a.setAttribute("promotedInstMatRow1", u), a.setAttribute("promotedInstVisible", d);
2285
+ const h = Qs(e, a, this.materialFactory(e));
2286
2286
  h.visible = !1, h.frustumCulled = !1, h.userData.kind = e, h.userData.variantId = n.variantId, h.userData.insertPresenterMesh = !0, h.userData.vertexCount = 0, this.slots.push({
2287
2287
  variantId: n.variantId,
2288
2288
  kind: e,
@@ -2290,9 +2290,9 @@ class En {
2290
2290
  perVertexCount: i.vertexCount,
2291
2291
  localBBox: i.bbox,
2292
2292
  mesh: h,
2293
- matRow0Attr: d,
2293
+ matRow0Attr: c,
2294
2294
  matRow1Attr: u,
2295
- visibleAttr: c,
2295
+ visibleAttr: d,
2296
2296
  capacity: s
2297
2297
  }), this.group.add(h);
2298
2298
  }
@@ -2308,23 +2308,23 @@ class En {
2308
2308
  this.lastQueryAll = !1, this.lastQueryRect = null, this.lastQueryHits = [], this.invalidateFilteredQueryCache();
2309
2309
  }
2310
2310
  refresh(n, e, r, i) {
2311
- const s = n ? Je(n, this.marginRatio) : null, a = !s, o = i === void 0 ? `signature:${Xs(r)}` : `revision:${i}`;
2312
- if (this.cacheValid && this.lastLayerVersion === e.version && this.lastUserHiddenCacheKey === o && this.lastFilteredQueryAll === a && qr(this.lastFilteredQueryRect, s))
2311
+ const s = n ? Je(n, this.marginRatio) : null, a = !s, o = i === void 0 ? `signature:${Ys(r)}` : `revision:${i}`;
2312
+ if (this.cacheValid && this.lastLayerVersion === e.version && this.lastUserHiddenCacheKey === o && this.lastFilteredQueryAll === a && Kr(this.lastFilteredQueryRect, s))
2313
2313
  return;
2314
- const l = this.resolveQueryHits(s), d = /* @__PURE__ */ new Map();
2315
- for (const c of l) {
2316
- if (s && !Kn(s, c.bbox) || r.has(c.instanceId)) continue;
2317
- let h = d.get(c.variantId);
2318
- h || (h = [], d.set(c.variantId, h)), h.push(c);
2314
+ const l = this.resolveQueryHits(s), c = /* @__PURE__ */ new Map();
2315
+ for (const d of l) {
2316
+ if (s && !Wn(s, d.bbox) || r.has(d.instanceId)) continue;
2317
+ let h = c.get(d.variantId);
2318
+ h || (h = [], c.set(d.variantId, h)), h.push(d);
2319
2319
  }
2320
2320
  let u = 0;
2321
- for (const c of this.slots) {
2322
- const h = d.get(c.variantId), y = h == null ? void 0 : h.filter((x) => this.slotVisibleForRecord(c, x, e));
2321
+ for (const d of this.slots) {
2322
+ const h = c.get(d.variantId), y = h == null ? void 0 : h.filter((x) => this.slotVisibleForRecord(d, x, e));
2323
2323
  if (!y || y.length === 0) {
2324
- Sn(c.mesh, 0), c.mesh.userData.vertexCount = 0, c.mesh.visible = !1;
2324
+ Sn(d.mesh, 0), d.mesh.userData.vertexCount = 0, d.mesh.visible = !1;
2325
2325
  continue;
2326
2326
  }
2327
- this.ensureCapacity(c, y.length), this.writeMatRows(c, y), Sn(c.mesh, y.length), c.mesh.userData.vertexCount = y.length * c.perVertexCount, c.mesh.visible = !0, u += y.length * c.perVertexCount;
2327
+ this.ensureCapacity(d, y.length), this.writeMatRows(d, y), Sn(d.mesh, y.length), d.mesh.userData.vertexCount = y.length * d.perVertexCount, d.mesh.visible = !0, u += y.length * d.perVertexCount;
2328
2328
  }
2329
2329
  this.visibleVertexCount = u, this.lastLayerVersion = e.version, this.lastUserHiddenCacheKey = o, this.lastFilteredQueryAll = a, this.lastFilteredQueryRect = s ? {
2330
2330
  minX: s.minX,
@@ -2367,13 +2367,13 @@ class En {
2367
2367
  ensureCapacity(n, e) {
2368
2368
  if (n.capacity >= e) return;
2369
2369
  const r = Math.max(e, n.capacity * 2);
2370
- n.matRow0Attr = new de(new Float32Array(r * 4), 4), n.matRow1Attr = new de(new Float32Array(r * 4), 4), n.visibleAttr = new de(new Float32Array(r), 1), n.mesh.geometry.setAttribute("promotedInstMatRow0", n.matRow0Attr), n.mesh.geometry.setAttribute("promotedInstMatRow1", n.matRow1Attr), n.mesh.geometry.setAttribute("promotedInstVisible", n.visibleAttr), n.capacity = r;
2370
+ n.matRow0Attr = new ce(new Float32Array(r * 4), 4), n.matRow1Attr = new ce(new Float32Array(r * 4), 4), n.visibleAttr = new ce(new Float32Array(r), 1), n.mesh.geometry.setAttribute("promotedInstMatRow0", n.matRow0Attr), n.mesh.geometry.setAttribute("promotedInstMatRow1", n.matRow1Attr), n.mesh.geometry.setAttribute("promotedInstVisible", n.visibleAttr), n.capacity = r;
2371
2371
  }
2372
2372
  writeMatRows(n, e) {
2373
2373
  const r = n.matRow0Attr.array, i = n.matRow1Attr.array, s = n.visibleAttr.array;
2374
2374
  for (let o = 0; o < e.length; o += 1) {
2375
- const l = e[o], d = o * 4;
2376
- r[d] = l.matA, r[d + 1] = l.matC, r[d + 2] = l.tx, r[d + 3] = 0, i[d] = l.matB, i[d + 1] = l.matD, i[d + 2] = l.ty, i[d + 3] = 0, s[o] = 1;
2375
+ const l = e[o], c = o * 4;
2376
+ r[c] = l.matA, r[c + 1] = l.matC, r[c + 2] = l.tx, r[c + 3] = 0, i[c] = l.matB, i[c + 1] = l.matD, i[c + 2] = l.ty, i[c + 3] = 0, s[o] = 1;
2377
2377
  }
2378
2378
  const a = e.length * 4;
2379
2379
  n.matRow0Attr.clearUpdateRanges(), n.matRow1Attr.clearUpdateRanges(), n.visibleAttr.clearUpdateRanges(), n.matRow0Attr.addUpdateRange(0, a), n.matRow1Attr.addUpdateRange(0, a), n.visibleAttr.addUpdateRange(0, e.length), n.matRow0Attr.needsUpdate = !0, n.matRow1Attr.needsUpdate = !0, n.visibleAttr.needsUpdate = !0;
@@ -2383,11 +2383,11 @@ class En {
2383
2383
  return r.isVisible(i);
2384
2384
  }
2385
2385
  }
2386
- function Xs(t) {
2386
+ function Ys(t) {
2387
2387
  return t.size === 0 ? "0:" : `${t.size}:${Array.from(t).sort((n, e) => n - e).join(",")}`;
2388
2388
  }
2389
- function Ys(t, n, e) {
2390
- const r = t === "line" ? new zt(n, e) : t === "fill" ? new Ht(n, e) : new $n(n, e);
2389
+ function Qs(t, n, e) {
2390
+ const r = t === "line" ? new zt(n, e) : t === "fill" ? new Ht(n, e) : new jn(n, e);
2391
2391
  return r.count = 0, r;
2392
2392
  }
2393
2393
  function Sn(t, n) {
@@ -2400,36 +2400,36 @@ function kn(t) {
2400
2400
  }
2401
2401
  t.dispose();
2402
2402
  }
2403
- const vr = 64, Rr = 8;
2404
- function Qs() {
2403
+ const Rr = 64, Br = 8;
2404
+ function $s() {
2405
2405
  return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
2406
2406
  }
2407
- async function $s(t, n = {}) {
2408
- const e = Math.max(1, Math.floor(n.opsPerPass ?? vr) || 1), r = Math.max(0, n.frameBudgetMs ?? Rr), i = n.now ?? Qs, s = i();
2409
- let a = s, o = 0, l = 0, d = 0, u = 0;
2410
- for (let c = 0; c < t.length; c += 1) {
2411
- const h = t[c];
2412
- l += 1, h.run() && (d += 1, o += 1), n.onYield && c < t.length - 1 && (o >= e || i() - a >= r) && (await n.onYield(), u += 1, a = i(), o = 0);
2407
+ async function js(t, n = {}) {
2408
+ const e = Math.max(1, Math.floor(n.opsPerPass ?? Rr) || 1), r = Math.max(0, n.frameBudgetMs ?? Br), i = n.now ?? $s, s = i();
2409
+ let a = s, o = 0, l = 0, c = 0, u = 0;
2410
+ for (let d = 0; d < t.length; d += 1) {
2411
+ const h = t[d];
2412
+ l += 1, h.run() && (c += 1, o += 1), n.onYield && d < t.length - 1 && (o >= e || i() - a >= r) && (await n.onYield(), u += 1, a = i(), o = 0);
2413
2413
  }
2414
2414
  return {
2415
2415
  visited: l,
2416
- compacted: d,
2416
+ compacted: c,
2417
2417
  yielded: u,
2418
2418
  elapsedMs: i() - s
2419
2419
  };
2420
2420
  }
2421
- function js(t, n) {
2422
- return n.zoom, t === "full" && n.visibleVertexCount >= ni ? "stress" : t === "stress" && n.visibleVertexCount <= ri ? "full" : t;
2421
+ function Zs(t, n) {
2422
+ return n.zoom, t === "full" && n.visibleVertexCount >= ri ? "stress" : t === "stress" && n.visibleVertexCount <= ii ? "full" : t;
2423
2423
  }
2424
- function Zs(t, n, e) {
2425
- return t === "full" || t === "stress" ? t : js(n, e);
2424
+ function Js(t, n, e) {
2425
+ return t === "full" || t === "stress" ? t : Zs(n, e);
2426
2426
  }
2427
- const Js = 1e-6;
2428
- function ea(t, n) {
2427
+ const ea = 1e-6;
2428
+ function ta(t, n) {
2429
2429
  let e = !0;
2430
2430
  for (let i = 0; i < n; i += 1) {
2431
2431
  const s = t[i * 3 + 2] ?? 0;
2432
- if (Math.abs(s) > Js) {
2432
+ if (Math.abs(s) > ea) {
2433
2433
  e = !1;
2434
2434
  break;
2435
2435
  }
@@ -2441,7 +2441,7 @@ function ea(t, n) {
2441
2441
  r[i * 2] = t[i * 3] ?? 0, r[i * 2 + 1] = t[i * 3 + 1] ?? 0;
2442
2442
  return { kind: "xy", xy: r };
2443
2443
  }
2444
- function ta(t, n, e = 3) {
2444
+ function na(t, n, e = 3) {
2445
2445
  if (e === 2) {
2446
2446
  const i = n * 2;
2447
2447
  if (t.length === i)
@@ -2456,7 +2456,7 @@ function ta(t, n, e = 3) {
2456
2456
  r[i * 2] = t[i * 3] ?? 0, r[i * 2 + 1] = t[i * 3 + 1] ?? 0;
2457
2457
  return { kind: "xy", xy: r };
2458
2458
  }
2459
- function na(t, n, e, r) {
2459
+ function ra(t, n, e, r) {
2460
2460
  const i = r * 3;
2461
2461
  if (t.kind === "xyz") {
2462
2462
  e.set(t.xyz.subarray(0, n * 3), i);
@@ -2467,9 +2467,9 @@ function na(t, n, e, r) {
2467
2467
  e[o] = t.xy[a] ?? 0, e[o + 1] = t.xy[a + 1] ?? 0, e[o + 2] = 0;
2468
2468
  }
2469
2469
  }
2470
- function ra(t, n, e, r, i) {
2470
+ function ia(t, n, e, r, i) {
2471
2471
  if (i === 3) {
2472
- na(t, n, e, r);
2472
+ ra(t, n, e, r);
2473
2473
  return;
2474
2474
  }
2475
2475
  const s = r * 2;
@@ -2482,7 +2482,7 @@ function ra(t, n, e, r, i) {
2482
2482
  e[l] = t.xyz[o] ?? 0, e[l + 1] = t.xyz[o + 1] ?? 0;
2483
2483
  }
2484
2484
  }
2485
- function ia(t, n, e) {
2485
+ function sa(t, n, e) {
2486
2486
  const r = t.kind === "xy" ? e * 2 * Float32Array.BYTES_PER_ELEMENT : e * 3 * Float32Array.BYTES_PER_ELEMENT, i = Math.min(n.byteLength, e * 3);
2487
2487
  return {
2488
2488
  recordCount: 1,
@@ -2509,7 +2509,7 @@ function Tn() {
2509
2509
  totalBytes: 0
2510
2510
  };
2511
2511
  }
2512
- function sa(t, n) {
2512
+ function aa(t, n) {
2513
2513
  return {
2514
2514
  recordCount: t.recordCount + n.recordCount,
2515
2515
  vertexCount: t.vertexCount + n.vertexCount,
@@ -2522,7 +2522,7 @@ function sa(t, n) {
2522
2522
  totalBytes: t.totalBytes + n.totalBytes
2523
2523
  };
2524
2524
  }
2525
- function aa(t, n) {
2525
+ function oa(t, n) {
2526
2526
  return {
2527
2527
  recordCount: J(t.recordCount, n.recordCount, "recordCount"),
2528
2528
  vertexCount: J(t.vertexCount, n.vertexCount, "vertexCount"),
@@ -2541,10 +2541,10 @@ function J(t, n, e) {
2541
2541
  throw new Error(`Line canonical memory stat ${String(e)} became negative: ${t} - ${n}`);
2542
2542
  return Object.is(r, -0) ? 0 : r;
2543
2543
  }
2544
- const oa = {
2544
+ const la = {
2545
2545
  visibleVertexCount: 0,
2546
2546
  zoom: 1
2547
- }, Pn = /* @__PURE__ */ new Set(), la = Object.freeze({ kind: "structure" }), Eo = Object.freeze({ kind: "visual" });
2547
+ }, Pn = /* @__PURE__ */ new Set(), ca = Object.freeze({ kind: "structure" }), Eo = Object.freeze({ kind: "visual" });
2548
2548
  function da(t) {
2549
2549
  let n = null;
2550
2550
  for (const e of t)
@@ -2557,11 +2557,11 @@ function Tt(t) {
2557
2557
  function Ar(t, n, e) {
2558
2558
  return `${t}:${n}:${e}`;
2559
2559
  }
2560
- function ca(t) {
2560
+ function ua(t) {
2561
2561
  return t.recordKey ?? Ar(t.instanceId, t.variantId, 0);
2562
2562
  }
2563
- const pt = "geo-node:promoted-instanced-v1", Ln = "geo-node:text-batch-static-bounds-v1", Fe = "geo-node:text-batch-bounds-dirty-v1", Mn = 1.5, ua = 1, Dn = "geo-node:world-sized-points-v1", Br = "geo-node:world-sized-points-uniforms", ha = 16777216, fa = 25, ya = 28, ma = 29;
2564
- function pa() {
2563
+ const pt = "geo-node:promoted-instanced-v1", Ln = "geo-node:text-batch-static-bounds-v1", Fe = "geo-node:text-batch-bounds-dirty-v1", Mn = 1.5, ha = 1, Dn = "geo-node:world-sized-points-v1", Vr = "geo-node:world-sized-points-uniforms", fa = 16777216, ya = 25, ma = 28, pa = 29;
2564
+ function xa() {
2565
2565
  return {
2566
2566
  activeThinCount: 0,
2567
2567
  activeFatCount: 0,
@@ -2572,13 +2572,13 @@ function pa() {
2572
2572
  function we(t) {
2573
2573
  return [t[0], t[1], t[2], t[3]];
2574
2574
  }
2575
- function xa(t, n) {
2575
+ function ga(t, n) {
2576
2576
  return [Math.min(t[0], n[0]), Math.min(t[1], n[1]), Math.max(t[2], n[2]), Math.max(t[3], n[3])];
2577
2577
  }
2578
2578
  function H(t) {
2579
2579
  return [t[0], t[1], t[2]];
2580
2580
  }
2581
- function ga(t, n) {
2581
+ function ba(t, n) {
2582
2582
  return t[0] === n[0] && t[1] === n[1] && t[2] === n[2];
2583
2583
  }
2584
2584
  function Fn(t, n, e) {
@@ -2598,7 +2598,7 @@ function Pt(t) {
2598
2598
  vertexCount: e.vertexCount,
2599
2599
  color: H(e.color)
2600
2600
  }, i = n[n.length - 1];
2601
- if (i && i.startVertex + i.vertexCount === r.startVertex && ga(i.color, r.color)) {
2601
+ if (i && i.startVertex + i.vertexCount === r.startVertex && ba(i.color, r.color)) {
2602
2602
  n[n.length - 1] = {
2603
2603
  ...i,
2604
2604
  vertexCount: i.vertexCount + r.vertexCount
@@ -2615,16 +2615,16 @@ function On(t, n) {
2615
2615
  const e = Pt(t);
2616
2616
  return e.length <= Math.ceil(n / 2) ? e : void 0;
2617
2617
  }
2618
- function ba(t, n) {
2618
+ function Ia(t, n) {
2619
2619
  if (!n || n.size === 0) return t;
2620
2620
  const e = /* @__PURE__ */ new Map();
2621
2621
  for (const [r, i] of t)
2622
2622
  e.set(r, [...i]);
2623
2623
  for (const [r, i] of n)
2624
- e.set(r, Ia(e.get(r) ?? [], i));
2624
+ e.set(r, Ca(e.get(r) ?? [], i));
2625
2625
  return e;
2626
2626
  }
2627
- function Ia(t, n) {
2627
+ function Ca(t, n) {
2628
2628
  const e = /* @__PURE__ */ new Map();
2629
2629
  for (const r of t)
2630
2630
  e.set(r.variantId, {
@@ -2646,7 +2646,7 @@ function Ia(t, n) {
2646
2646
  for (const o of r.inserts)
2647
2647
  s.set(
2648
2648
  o.instanceId,
2649
- Ca(s.get(o.instanceId), o)
2649
+ wa(s.get(o.instanceId), o)
2650
2650
  );
2651
2651
  const a = Array.from(s.values()).sort((o, l) => o.instanceId - l.instanceId);
2652
2652
  e.set(r.variantId, {
@@ -2659,7 +2659,7 @@ function Ia(t, n) {
2659
2659
  }
2660
2660
  return Array.from(e.values()).sort((r, i) => i.instanceCount - r.instanceCount);
2661
2661
  }
2662
- function Ca(t, n) {
2662
+ function wa(t, n) {
2663
2663
  const e = fe((t == null ? void 0 : t.bbox) ?? null, n.bbox ?? null);
2664
2664
  if (e)
2665
2665
  return {
@@ -2673,7 +2673,7 @@ function Ca(t, n) {
2673
2673
  canHighlight: !1
2674
2674
  };
2675
2675
  }
2676
- function wa(t) {
2676
+ function va(t) {
2677
2677
  return t.line.count > 0 || t.fill.count > 0 || t.dot.count > 0 || t.line.raw.byteLength > 0 || t.fill.raw.byteLength > 0 || t.dot.raw.byteLength > 0;
2678
2678
  }
2679
2679
  function _n(t, n) {
@@ -2686,7 +2686,7 @@ function _n(t, n) {
2686
2686
  );
2687
2687
  return e;
2688
2688
  }
2689
- function va(t, n, e) {
2689
+ function Ra(t, n, e) {
2690
2690
  if (!n) return t;
2691
2691
  if (!t)
2692
2692
  return {
@@ -2696,7 +2696,7 @@ function va(t, n, e) {
2696
2696
  };
2697
2697
  const r = t.variants.slice();
2698
2698
  for (const s of n.variants)
2699
- (!r[s.id] || wa(s)) && (r[s.id] = s);
2699
+ (!r[s.id] || va(s)) && (r[s.id] = s);
2700
2700
  const i = /* @__PURE__ */ new Map();
2701
2701
  for (const [s, a] of t.textIndexesByInstanceId)
2702
2702
  i.set(s, [...a]);
@@ -2713,7 +2713,7 @@ function va(t, n, e) {
2713
2713
  ])
2714
2714
  };
2715
2715
  }
2716
- function Ra(t) {
2716
+ function Ba(t) {
2717
2717
  return {
2718
2718
  index: t.index,
2719
2719
  name: t.name,
@@ -2726,7 +2726,7 @@ function Aa(t) {
2726
2726
  const n = t >>> 0;
2727
2727
  return [n >> 16 & 255, n >> 8 & 255, n & 255];
2728
2728
  }
2729
- function Ba(t) {
2729
+ function Va(t) {
2730
2730
  return t[0] << 16 | t[1] << 8 | t[2];
2731
2731
  }
2732
2732
  function xt(t) {
@@ -2734,7 +2734,7 @@ function xt(t) {
2734
2734
  const n = Math.round(t);
2735
2735
  return n < 0 ? 0 : n > 255 ? 255 : n;
2736
2736
  }
2737
- function Va(t) {
2737
+ function Ea(t) {
2738
2738
  switch (t) {
2739
2739
  case "fill":
2740
2740
  return 1;
@@ -2751,11 +2751,11 @@ function Va(t) {
2751
2751
  return 0;
2752
2752
  }
2753
2753
  }
2754
- function Ea(t, n, e, r, i) {
2755
- return (n !== null && Jt(t) ? ha : xt(t[0]) << 16 | xt(t[1]) << 8 | xt(t[2])) | Va(e) << fa | (r === "light" ? 1 : 0) << ya | (i ? 1 : 0) << ma;
2754
+ function Sa(t, n, e, r, i) {
2755
+ return (n !== null && Jt(t) ? fa : xt(t[0]) << 16 | xt(t[1]) << 8 | xt(t[2])) | Ea(e) << ya | (r === "light" ? 1 : 0) << ma | (i ? 1 : 0) << pa;
2756
2756
  }
2757
2757
  function gt(t) {
2758
- return "color" in t && t.color instanceof Wn;
2758
+ return "color" in t && t.color instanceof Xn;
2759
2759
  }
2760
2760
  function bt(t) {
2761
2761
  const n = /* @__PURE__ */ new Set();
@@ -2772,7 +2772,7 @@ function bt(t) {
2772
2772
  i && !n.has(i) && (n.add(i), i.dispose()), e !== t && ((s = e.dispose) == null || s.call(e));
2773
2773
  });
2774
2774
  }
2775
- function Sa(t) {
2775
+ function ka(t) {
2776
2776
  var i;
2777
2777
  const n = t.userData;
2778
2778
  if (n[pt] === !0)
@@ -2813,13 +2813,13 @@ function Sa(t) {
2813
2813
  const r = (i = t.customProgramCacheKey) == null ? void 0 : i.bind(t);
2814
2814
  t.customProgramCacheKey = () => `${r ? r() : ""}|${pt}`, n[pt] = !0, t.needsUpdate = !0;
2815
2815
  }
2816
- function ka(t) {
2817
- const n = t.userData[Br];
2816
+ function Ta(t) {
2817
+ const n = t.userData[Vr];
2818
2818
  return n && typeof n == "object" ? n : null;
2819
2819
  }
2820
- function Ta(t, n) {
2820
+ function Pa(t, n) {
2821
2821
  var o;
2822
- const e = t.userData, r = ka(t);
2822
+ const e = t.userData, r = Ta(t);
2823
2823
  if (r)
2824
2824
  return r.uGeoPointWorldSize.value = n.pointWorldSize, r.uGeoPointViewportHeight.value = Math.max(1, Math.floor(n.viewportHeight) || 1), r.uGeoPointMinVisiblePixelSize.value = Mn, r;
2825
2825
  const i = {
@@ -2827,10 +2827,10 @@ function Ta(t, n) {
2827
2827
  uGeoPointViewportHeight: { value: Math.max(1, Math.floor(n.viewportHeight) || 1) },
2828
2828
  uGeoPointMinVisiblePixelSize: { value: Mn }
2829
2829
  };
2830
- e[Br] = i;
2830
+ e[Vr] = i;
2831
2831
  const s = t.onBeforeCompile;
2832
- t.onBeforeCompile = (l, d) => {
2833
- s == null || s(l, d), l.uniforms.uGeoPointWorldSize = i.uGeoPointWorldSize, l.uniforms.uGeoPointViewportHeight = i.uGeoPointViewportHeight, l.uniforms.uGeoPointMinVisiblePixelSize = i.uGeoPointMinVisiblePixelSize, l.vertexShader.includes("uGeoPointWorldSize") || (l.vertexShader = l.vertexShader.replace(
2832
+ t.onBeforeCompile = (l, c) => {
2833
+ s == null || s(l, c), l.uniforms.uGeoPointWorldSize = i.uGeoPointWorldSize, l.uniforms.uGeoPointViewportHeight = i.uGeoPointViewportHeight, l.uniforms.uGeoPointMinVisiblePixelSize = i.uGeoPointMinVisiblePixelSize, l.vertexShader.includes("uGeoPointWorldSize") || (l.vertexShader = l.vertexShader.replace(
2834
2834
  "#include <common>",
2835
2835
  [
2836
2836
  "#include <common>",
@@ -2878,7 +2878,7 @@ class ye extends ee {
2878
2878
  f(this, "bounds", [0, 0, 0, 0]);
2879
2879
  f(this, "originalLayerColorsByIndex", /* @__PURE__ */ new Map());
2880
2880
  f(this, "colorOverridesByIndex", /* @__PURE__ */ new Map());
2881
- f(this, "displayThemeName", Ps);
2881
+ f(this, "displayThemeName", Ls);
2882
2882
  f(this, "displayContrastEnhancement", !0);
2883
2883
  f(this, "displayHexMemo", /* @__PURE__ */ new Map());
2884
2884
  f(this, "layerStateRevision", 0);
@@ -2912,7 +2912,7 @@ class ye extends ee {
2912
2912
  f(this, "effectiveRenderQuality", "full");
2913
2913
  f(this, "interactionRenderQualityOverride", null);
2914
2914
  f(this, "lineModeSwitchingEnabled", !1);
2915
- f(this, "autoQualityContext", { ...oa });
2915
+ f(this, "autoQualityContext", { ...la });
2916
2916
  f(this, "lineChunkRecords", []);
2917
2917
  f(this, "lineCanonicalMemoryStats", Tn());
2918
2918
  f(this, "nonLineChunkStats", []);
@@ -2936,7 +2936,7 @@ class ye extends ee {
2936
2936
  f(this, "resolveReady");
2937
2937
  f(this, "rejectReady");
2938
2938
  f(this, "resolveTextFont");
2939
- this.name = "GeoNode", this.resolveTextFont = e.resolveTextFont ?? ur, this.startReadyCycle();
2939
+ this.name = "GeoNode", this.resolveTextFont = e.resolveTextFont ?? hr, this.startReadyCycle();
2940
2940
  }
2941
2941
  get ready() {
2942
2942
  return this.readyPromise;
@@ -2960,6 +2960,26 @@ class ye extends ee {
2960
2960
  const a = i.visible !== r;
2961
2961
  a && (this.layerStateRevision += 1, (o = this.viewportInstancePresenter) == null || o.invalidateQueryCache()), i.visible = r, s && (s.visible = r), this.refreshAnnotationTextVisibilityForLayer(e), a && this.refreshDefaultInsertPresenterIfUnmanaged(), a && this.notifyInternalChange();
2962
2962
  }
2963
+ setLayerVisibleBatch(e) {
2964
+ var s;
2965
+ if (e.length === 0) return 0;
2966
+ const r = /* @__PURE__ */ new Map();
2967
+ for (const a of e)
2968
+ Number.isInteger(a.layerIndex) && r.set(a.layerIndex, a.visible);
2969
+ const i = [];
2970
+ for (const [a, o] of r) {
2971
+ const l = this.layerStatesByIndex.get(a);
2972
+ if (!l || l.visible === o) continue;
2973
+ l.visible = o;
2974
+ const c = this.layerGroupsByIndex.get(a);
2975
+ c && (c.visible = o), i.push(a);
2976
+ }
2977
+ if (i.length === 0) return 0;
2978
+ this.layerStateRevision += 1, (s = this.viewportInstancePresenter) == null || s.invalidateQueryCache();
2979
+ for (const a of i)
2980
+ this.refreshAnnotationTextVisibilityForLayer(a);
2981
+ return this.refreshDefaultInsertPresenterIfUnmanaged(), this.notifyInternalChange(), i.length;
2982
+ }
2963
2983
  setAnnotationOverlayVisible(e) {
2964
2984
  if (this.annotationOverlayVisible !== e) {
2965
2985
  this.annotationOverlayVisible = e;
@@ -2978,10 +2998,10 @@ class ye extends ee {
2978
2998
  const o = r === null ? null : Aa(r);
2979
2999
  o ? this.colorOverridesByIndex.set(e, H(o)) : this.colorOverridesByIndex.delete(e), this.displayHexMemo.clear(), i.color = H(o ?? a), this.layerStateRevision += 1, s.traverse((l) => {
2980
3000
  var h;
2981
- const d = (h = l.userData) == null ? void 0 : h.kind;
2982
- if (d === "text" || d === "text-batch") return;
2983
- const u = l.material, c = Array.isArray(u) ? u : u ? [u] : [];
2984
- for (const y of c)
3001
+ const c = (h = l.userData) == null ? void 0 : h.kind;
3002
+ if (c === "text" || c === "text-batch") return;
3003
+ const u = l.material, d = Array.isArray(u) ? u : u ? [u] : [];
3004
+ for (const y of d)
2985
3005
  gt(y) && (this.applyLayerColorState(y, o, this.displayElementKindForObject(l)), y.needsUpdate = !0);
2986
3006
  }), this.applyCachedLineChunkColors(e, o), this.applyLayerTextColors(e, o), this.notifyInternalChange();
2987
3007
  }
@@ -3016,7 +3036,7 @@ class ye extends ee {
3016
3036
  if (((r = this.layersSnapshotCache) == null ? void 0 : r.revision) === this.layerStateRevision)
3017
3037
  return this.layersSnapshotCache.value;
3018
3038
  const e = Object.freeze(
3019
- this.layerOrder.map((i) => this.layerStatesByIndex.get(i)).filter((i) => i !== void 0).map((i) => Object.freeze(Ra(i)))
3039
+ this.layerOrder.map((i) => this.layerStatesByIndex.get(i)).filter((i) => i !== void 0).map((i) => Object.freeze(Ba(i)))
3020
3040
  );
3021
3041
  return this.layersSnapshotCache = { revision: this.layerStateRevision, value: e }, e;
3022
3042
  }
@@ -3122,7 +3142,7 @@ class ye extends ee {
3122
3142
  const o = new En({
3123
3143
  registry: r,
3124
3144
  table: Vn(i),
3125
- materialFactory: (d) => this.createInsertPresenterMaterial(d),
3145
+ materialFactory: (c) => this.createInsertPresenterMaterial(c),
3126
3146
  initialCapacity: Math.max(1, i.length),
3127
3147
  marginRatio: 0
3128
3148
  });
@@ -3159,7 +3179,7 @@ class ye extends ee {
3159
3179
  if (!this.insertInstanceTable) return !1;
3160
3180
  const i = this.insertPresenterRecordKeysByInstanceId.get(e);
3161
3181
  if (!i || i.size === 0) return !1;
3162
- const s = r.rotation * Math.PI / 180, a = Math.cos(s), o = Math.sin(s), l = r.scaleX * a, d = r.scaleX * o, u = -r.scaleY * o, c = r.scaleY * a;
3182
+ const s = r.rotation * Math.PI / 180, a = Math.cos(s), o = Math.sin(s), l = r.scaleX * a, c = r.scaleX * o, u = -r.scaleY * o, d = r.scaleY * a;
3163
3183
  let h = !0;
3164
3184
  for (const x of i) {
3165
3185
  const m = this.insertPresenterRecordsByKey.get(x);
@@ -3167,16 +3187,16 @@ class ye extends ee {
3167
3187
  const b = {
3168
3188
  ...m,
3169
3189
  matA: l,
3170
- matB: d,
3190
+ matB: c,
3171
3191
  matC: u,
3172
- matD: c,
3192
+ matD: d,
3173
3193
  tx: r.tx,
3174
3194
  ty: r.ty,
3175
3195
  bbox: this.computeInsertPresenterWorldBBox(m.variantId, {
3176
3196
  matA: l,
3177
- matB: d,
3197
+ matB: c,
3178
3198
  matC: u,
3179
- matD: c,
3199
+ matD: d,
3180
3200
  tx: r.tx,
3181
3201
  ty: r.ty
3182
3202
  }) ?? m.bbox
@@ -3209,8 +3229,8 @@ class ye extends ee {
3209
3229
  return this.traverse((a) => {
3210
3230
  const o = a.geometry;
3211
3231
  if (!o) return;
3212
- const l = o.userData.cadDisplaySourceColor, d = o.userData.cadDisplayColorRuns;
3213
- l instanceof Uint8Array ? (e += 1, r += l.byteLength) : d && d.length > 0 && (e += 1);
3232
+ const l = o.userData.cadDisplaySourceColor, c = o.userData.cadDisplayColorRuns;
3233
+ l instanceof Uint8Array ? (e += 1, r += l.byteLength) : c && c.length > 0 && (e += 1);
3214
3234
  const u = o.getAttribute("color");
3215
3235
  u instanceof $ && ArrayBuffer.isView(u.array) && (i += u.array.byteLength, u.array instanceof Float32Array && (s += u.array.byteLength));
3216
3236
  }), Object.freeze({
@@ -3236,8 +3256,8 @@ class ye extends ee {
3236
3256
  for (const [s, a] of this.annotationTextRecordsByOwnerKey) {
3237
3257
  const o = e.get(s);
3238
3258
  if (o === void 0) continue;
3239
- const l = r.get(o), d = a.map((u) => this.createInsertVisibilityHandleForAnnotationText(u));
3240
- l ? l.push(...d) : r.set(o, [...d]);
3259
+ const l = r.get(o), c = a.map((u) => this.createInsertVisibilityHandleForAnnotationText(u));
3260
+ l ? l.push(...c) : r.set(o, [...c]);
3241
3261
  }
3242
3262
  return r;
3243
3263
  }
@@ -3350,10 +3370,10 @@ class ye extends ee {
3350
3370
  this.insertPresenterVariantInputs.has(o.variantId) && (s = !0), this.insertPresenterVariantInputs.set(o.variantId, l), r.push(l);
3351
3371
  }
3352
3372
  for (const o of i) {
3353
- const l = ca(o);
3373
+ const l = ua(o);
3354
3374
  this.insertPresenterRecordsByKey.has(l) && (a = !0), this.insertPresenterRecordsByKey.set(l, o);
3355
- let d = this.insertPresenterRecordKeysByInstanceId.get(o.instanceId);
3356
- d || (d = /* @__PURE__ */ new Set(), this.insertPresenterRecordKeysByInstanceId.set(o.instanceId, d)), d.add(l);
3375
+ let c = this.insertPresenterRecordKeysByInstanceId.get(o.instanceId);
3376
+ c || (c = /* @__PURE__ */ new Set(), this.insertPresenterRecordKeysByInstanceId.set(o.instanceId, c)), c.add(l);
3357
3377
  }
3358
3378
  return { variantInputs: r, records: i, replacedVariant: s, replacedRecord: a };
3359
3379
  }
@@ -3386,7 +3406,7 @@ class ye extends ee {
3386
3406
  }
3387
3407
  rebuildViewportInsertPresenterFromAccumulatedModel() {
3388
3408
  var e, r;
3389
- (e = this.viewportInstancePresenter) == null || e.dispose(), this.viewportInstancePresenter = null, this.insertInstanceTable = null, (r = this.blockGeometryRegistry) == null || r.dispose(), this.blockGeometryRegistry = Ks([...this.insertPresenterVariantInputs.values()]), this.rebuildViewportInsertPresenter([...this.insertPresenterRecordsByKey.values()]);
3409
+ (e = this.viewportInstancePresenter) == null || e.dispose(), this.viewportInstancePresenter = null, this.insertInstanceTable = null, (r = this.blockGeometryRegistry) == null || r.dispose(), this.blockGeometryRegistry = Ws([...this.insertPresenterVariantInputs.values()]), this.rebuildViewportInsertPresenter([...this.insertPresenterRecordsByKey.values()]);
3390
3410
  }
3391
3411
  rebuildViewportInsertPresenter(e) {
3392
3412
  var r;
@@ -3404,10 +3424,10 @@ class ye extends ee {
3404
3424
  if (!i) return null;
3405
3425
  let s = null;
3406
3426
  for (const l of i.byKind.values())
3407
- for (const d of l)
3408
- s = fe(s, d.bbox);
3427
+ for (const c of l)
3428
+ s = fe(s, c.bbox);
3409
3429
  if (!s) return null;
3410
- const a = Kr(s, r);
3430
+ const a = Wr(s, r);
3411
3431
  return Tt(a) ? a : null;
3412
3432
  }
3413
3433
  _debugHasInsertPresenter() {
@@ -3435,7 +3455,7 @@ class ye extends ee {
3435
3455
  }
3436
3456
  appendExternalVariantDeltaHeader(e) {
3437
3457
  if (this.disposed) return;
3438
- const r = this.meta.textCount, i = xa(this.bounds, e.bounds);
3458
+ const r = this.meta.textCount, i = ga(this.bounds, e.bounds);
3439
3459
  this.bounds = i, this.meta = {
3440
3460
  bounds: we(i),
3441
3461
  entityCount: this.meta.entityCount + e.entityCount,
@@ -3443,7 +3463,7 @@ class ye extends ee {
3443
3463
  fillCount: this.meta.fillCount + e.fillCount,
3444
3464
  dotCount: this.meta.dotCount + e.dotCount,
3445
3465
  textCount: this.meta.textCount + e.textCount
3446
- }, this.metaRevision += 1, this.layerBlockUsages = ba(this.layerBlockUsages, e.layerBlockUsages), this.insertRuntime = va(this.insertRuntime, e.insertRuntime, r), this.rebuildInsertRuntimeInstanceIndex(), this.updateAutoQualityContext({
3466
+ }, this.metaRevision += 1, this.layerBlockUsages = Ia(this.layerBlockUsages, e.layerBlockUsages), this.insertRuntime = Ra(this.insertRuntime, e.insertRuntime, r), this.rebuildInsertRuntimeInstanceIndex(), this.updateAutoQualityContext({
3447
3467
  visibleVertexCount: this.meta.lineCount + this.meta.fillCount + this.meta.dotCount,
3448
3468
  zoom: this.autoQualityContext.zoom
3449
3469
  }), this.notifyInternalChange();
@@ -3455,7 +3475,7 @@ class ye extends ee {
3455
3475
  }
3456
3476
  this.compactGeometryByLayer(), this.refreshDefaultInsertPresenterIfUnmanaged(), this.resolveReadyOnce();
3457
3477
  }
3458
- async _finalizeIncrementally(e, r = vr, i = {}) {
3478
+ async _finalizeIncrementally(e, r = Rr, i = {}) {
3459
3479
  if (this.disposed) {
3460
3480
  this.rejectReadyOnce(new U("E_DISPOSED", "GeoNode disposed before completion"));
3461
3481
  return;
@@ -3498,18 +3518,18 @@ class ye extends ee {
3498
3518
  sizeAttenuation: !1,
3499
3519
  depthTest: !1,
3500
3520
  depthWrite: !1
3501
- }), l = Ta(o, {
3521
+ }), l = Pa(o, {
3502
3522
  pointWorldSize: a,
3503
3523
  viewportHeight: this.lineResolution.height
3504
3524
  });
3505
3525
  this.worldSizedPointUniforms.add(l);
3506
- const d = o.dispose.bind(o);
3526
+ const c = o.dispose.bind(o);
3507
3527
  return o.dispose = () => {
3508
- this.worldSizedPointUniforms.delete(l), d();
3528
+ this.worldSizedPointUniforms.delete(l), c();
3509
3529
  }, this.applyLayerColorState(o, r, i), o;
3510
3530
  }
3511
3531
  resolvePointWorldSize(e) {
3512
- return !Number.isFinite(e) || e <= 0 ? 1 : e * ua;
3532
+ return !Number.isFinite(e) || e <= 0 ? 1 : e * ha;
3513
3533
  }
3514
3534
  appendTextChunk(e) {
3515
3535
  const r = this.getOrCreateTextBatch(e.li), i = this.createRenderableTextChunk(e);
@@ -3540,13 +3560,13 @@ class ye extends ee {
3540
3560
  u.push(o), this.annotationTextRecordsByOwnerKey.set(a, u);
3541
3561
  }
3542
3562
  this.applyAnnotationTextRenderableVisibility(o);
3543
- const d = Number(r.userData.textCount || 0);
3544
- r.userData.textCount = d + 1, this.textUserDataByAppendOrder.push({ ...i.userData.text, c: H(i.userData.text.c) }), typeof globalThis.self < "u" && this.scheduleTextBatchSync(r);
3563
+ const c = Number(r.userData.textCount || 0);
3564
+ r.userData.textCount = c + 1, this.textUserDataByAppendOrder.push({ ...i.userData.text, c: H(i.userData.text.c) }), typeof globalThis.self < "u" && this.scheduleTextBatchSync(r);
3545
3565
  }
3546
3566
  getOrCreateTextBatch(e) {
3547
3567
  const r = this.textBatchByLayerIndex.get(e);
3548
3568
  if (r) return r;
3549
- const i = cn, s = new i();
3569
+ const i = dn, s = new i();
3550
3570
  return this.configureTextBatchForStaticBounds(s), s.name = "text-batch", s.renderOrder = 3, s.depthOffset = -0.1, s.userData.kind = "text-batch", s.userData.layerIndex = e, s.userData.textCount = 0, typeof globalThis.self < "u" && s.addEventListener("synccomplete", () => {
3551
3571
  this.markTextBatchBoundsClean(s), this.notifyInternalChange();
3552
3572
  }), this.getOrCreateKindGroup(e, "text").add(s), this.textBatchByLayerIndex.set(e, s), s;
@@ -3554,7 +3574,7 @@ class ye extends ee {
3554
3574
  getOrCreateAnnotationTextBatch(e) {
3555
3575
  const r = this.annotationTextBatchByLayerIndex.get(e);
3556
3576
  if (r) return r;
3557
- const i = cn, s = new i();
3577
+ const i = dn, s = new i();
3558
3578
  return this.configureTextBatchForStaticBounds(s), s.name = "annotation-text-batch", s.renderOrder = 4, s.depthOffset = -0.2, s.visible = this.annotationOverlayVisible && this.isLayerVisible(e), s.userData.kind = "text-batch", s.userData.layerIndex = e, s.userData.textCount = 0, s.userData.annotationOverlay = !0, typeof globalThis.self < "u" && s.addEventListener("synccomplete", () => {
3559
3579
  this.markTextBatchBoundsClean(s), this.notifyInternalChange();
3560
3580
  }), this.getOrCreateAnnotationKindGroup(e, "text").add(s), this.annotationTextBatchByLayerIndex.set(e, s), s;
@@ -3573,7 +3593,7 @@ class ye extends ee {
3573
3593
  e && (e.userData[Fe] = !1);
3574
3594
  }
3575
3595
  scheduleTextBatchSync(e) {
3576
- this.pendingTextBatchSync.add(e), !this.textBatchSyncScheduled && (this.textBatchSyncScheduled = !0, oi(() => {
3596
+ this.pendingTextBatchSync.add(e), !this.textBatchSyncScheduled && (this.textBatchSyncScheduled = !0, li(() => {
3577
3597
  if (this.textBatchSyncScheduled = !1, this.disposed) {
3578
3598
  this.pendingTextBatchSync.clear();
3579
3599
  return;
@@ -3585,39 +3605,39 @@ class ye extends ee {
3585
3605
  }));
3586
3606
  }
3587
3607
  createRenderableChunk(e, r, i, s, a, o, l) {
3588
- const d = new Nt();
3589
- d.setAttribute("position", new Qn(i, 3)), this.registerGeometryDisplayColors(
3590
- d,
3608
+ const c = new Nt();
3609
+ c.setAttribute("position", new $n(i, 3)), this.registerGeometryDisplayColors(
3610
+ c,
3591
3611
  s,
3592
3612
  r,
3593
3613
  e === "fill" ? "fill" : e === "dot" ? "dot" : "line",
3594
3614
  l
3595
3615
  );
3596
3616
  const u = this.colorOverridesByIndex.get(r) ?? null;
3597
- let c;
3617
+ let d;
3598
3618
  if (e === "line") {
3599
3619
  const y = new ln({ vertexColors: !0 });
3600
3620
  this.applyLayerColorState(y, u, e);
3601
- const x = new zt(d, y);
3602
- x.renderOrder = 1, c = x;
3621
+ const x = new zt(c, y);
3622
+ x.renderOrder = 1, d = x;
3603
3623
  } else if (e === "fill") {
3604
- const y = new dn({
3624
+ const y = new cn({
3605
3625
  vertexColors: !0,
3606
3626
  side: vt,
3607
3627
  depthWrite: !1
3608
3628
  });
3609
3629
  this.applyLayerColorState(y, u, e);
3610
- const x = new Ht(d, y);
3611
- x.renderOrder = 0, c = x;
3630
+ const x = new Ht(c, y);
3631
+ x.renderOrder = 0, d = x;
3612
3632
  } else {
3613
- const y = this.createPointMaterial(r, u, e), x = new $n(d, y);
3614
- x.renderOrder = 2, c = x;
3633
+ const y = this.createPointMaterial(r, u, e), x = new jn(c, y);
3634
+ x.renderOrder = 2, d = x;
3615
3635
  }
3616
- c.name = `${e}-chunk`, c.userData.kind = e, c.userData.layerIndex = r, c.userData.vertexCount = a;
3636
+ d.name = `${e}-chunk`, d.userData.kind = e, d.userData.layerIndex = r, d.userData.vertexCount = a;
3617
3637
  const h = o === void 0 ? _e(i, Math.floor(i.length / 3), 3) : o;
3618
- return c.userData.bbox = h, this.nonLineChunkStats.push({ layerIndex: r, vertexCount: a, bbox: h }), c;
3638
+ return d.userData.bbox = h, this.nonLineChunkStats.push({ layerIndex: r, vertexCount: a, bbox: h }), d;
3619
3639
  }
3620
- createRenderableLineChunk(e, r, i, s, a, o, l, d, u = 3, c) {
3640
+ createRenderableLineChunk(e, r, i, s, a, o, l, c, u = 3, d) {
3621
3641
  const h = this.makeLineChunkRecord(
3622
3642
  e,
3623
3643
  r,
@@ -3626,14 +3646,14 @@ class ye extends ee {
3626
3646
  a,
3627
3647
  o,
3628
3648
  l,
3629
- d,
3649
+ c,
3630
3650
  u,
3631
- c
3651
+ d
3632
3652
  );
3633
3653
  return this.registerLineChunkRecord(h), h.renderable;
3634
3654
  }
3635
- makeLineChunkRecord(e, r, i, s, a, o, l, d, u = 3, c) {
3636
- const h = this.resolveLineweightPx(r, c), y = a < 2 || a % 2 !== 0 || h <= 1, x = On(d, a), m = l === "xy-zero-z" || u === 2 ? ta(i, a, u) : ea(i, a), b = o === void 0 ? _e(i, a, u) : o, R = this.resolveInitialLineChunkVariant(r, a, y, c), I = this.buildLineRenderableViews(
3655
+ makeLineChunkRecord(e, r, i, s, a, o, l, c, u = 3, d) {
3656
+ const h = this.resolveLineweightPx(r, d), y = a < 2 || a % 2 !== 0 || h <= 1, x = On(c, a), m = l === "xy-zero-z" || u === 2 ? na(i, a, u) : ta(i, a), b = o === void 0 ? _e(i, a, u) : o, R = this.resolveInitialLineChunkVariant(r, a, y, d), I = this.buildLineRenderableViews(
3637
3657
  r,
3638
3658
  m,
3639
3659
  s,
@@ -3641,13 +3661,13 @@ class ye extends ee {
3641
3661
  y,
3642
3662
  b,
3643
3663
  x,
3644
- c
3664
+ d
3645
3665
  ), w = R === "fat" && I.fatRenderable ? I.fatRenderable : I.thinRenderable, T = {
3646
3666
  layerIndex: r,
3647
- ...c === void 0 ? {} : { lineweightPx: c },
3667
+ ...d === void 0 ? {} : { lineweightPx: d },
3648
3668
  parent: e,
3649
3669
  position: m,
3650
- canonicalMemoryStats: ia(m, s, a),
3670
+ canonicalMemoryStats: sa(m, s, a),
3651
3671
  col: s,
3652
3672
  colorRuns: x,
3653
3673
  vertexCount: a,
@@ -3666,19 +3686,19 @@ class ye extends ee {
3666
3686
  this.lineChunkRecords.push(e), this.addLineCanonicalStats(e);
3667
3687
  }
3668
3688
  addLineCanonicalStats(e) {
3669
- this.lineCanonicalMemoryStats = sa(
3689
+ this.lineCanonicalMemoryStats = aa(
3670
3690
  this.lineCanonicalMemoryStats,
3671
3691
  e.canonicalMemoryStats
3672
3692
  );
3673
3693
  }
3674
3694
  subtractLineCanonicalStats(e) {
3675
- this.lineCanonicalMemoryStats = aa(
3695
+ this.lineCanonicalMemoryStats = oa(
3676
3696
  this.lineCanonicalMemoryStats,
3677
3697
  e.canonicalMemoryStats
3678
3698
  );
3679
3699
  }
3680
3700
  rebuildLineVariantStats() {
3681
- const e = pa();
3701
+ const e = xa();
3682
3702
  for (const r of this.lineChunkRecords)
3683
3703
  r.activeVariant === "thin" && (e.activeThinCount += 1), r.activeVariant === "fat" && (e.activeFatCount += 1), r.thinRenderable && r.thinRenderable !== r.renderable && (e.cachedThinCount += 1), r.fatRenderable && r.fatRenderable !== r.renderable && (e.cachedFatCount += 1);
3684
3704
  return e;
@@ -3698,14 +3718,14 @@ class ye extends ee {
3698
3718
  shouldUseThinLineVariant(e, r, i) {
3699
3719
  return i || r < 2 || r % 2 !== 0 ? !0 : this.lineModeSwitchingEnabled ? this.effectiveRenderQuality === "stress" && e < un : e < un;
3700
3720
  }
3701
- buildLineRenderableViews(e, r, i, s, a, o, l, d) {
3702
- const u = this.resolveLineweightPx(e, d), c = r.kind === "xy" ? r.xy : r.xyz, h = r.kind === "xy" ? 2 : 3, y = o ?? _e(c, s, h) ?? {
3721
+ buildLineRenderableViews(e, r, i, s, a, o, l, c) {
3722
+ const u = this.resolveLineweightPx(e, c), d = r.kind === "xy" ? r.xy : r.xyz, h = r.kind === "xy" ? 2 : 3, y = o ?? _e(d, s, h) ?? {
3703
3723
  minX: 0,
3704
3724
  minY: 0,
3705
3725
  maxX: 0,
3706
3726
  maxY: 0
3707
- }, x = i.slice(), m = _s({
3708
- position: c,
3727
+ }, x = i.slice(), m = Gs({
3728
+ position: d,
3709
3729
  positionItemSize: h,
3710
3730
  color: i,
3711
3731
  vertexCount: s,
@@ -3713,13 +3733,13 @@ class ye extends ee {
3713
3733
  });
3714
3734
  this.finalizeCadLineRenderable(m, e, s, y, i, x, l);
3715
3735
  let b = null;
3716
- return !a && s >= 2 && s % 2 === 0 && (b = Gs({
3717
- position: c,
3736
+ return !a && s >= 2 && s % 2 === 0 && (b = Us({
3737
+ position: d,
3718
3738
  positionItemSize: h,
3719
3739
  color: i,
3720
3740
  vertexCount: s,
3721
3741
  linewidthPx: u,
3722
- resolution: new Xn(this.lineResolution.width, this.lineResolution.height),
3742
+ resolution: new Yn(this.lineResolution.width, this.lineResolution.height),
3723
3743
  bbox: y
3724
3744
  }), this.finalizeCadLineRenderable(b, e, s, y, i, x, l)), {
3725
3745
  thinRenderable: m,
@@ -3730,11 +3750,11 @@ class ye extends ee {
3730
3750
  }
3731
3751
  finalizeCadLineRenderable(e, r, i, s, a, o, l) {
3732
3752
  e.name = "line-chunk", e.renderOrder = 1, e.userData.kind = "line", e.userData.layerIndex = r, e.userData.vertexCount = i, e.userData.bbox = s;
3733
- const d = e.geometry;
3734
- d.userData.cadDisplayColorTarget = {
3753
+ const c = e.geometry;
3754
+ c.userData.cadDisplayColorTarget = {
3735
3755
  array: a,
3736
- markNeedsUpdate: () => ft(d)
3737
- }, this.installGeometryDisplayColorMetadata(d, o, r, "line", l);
3756
+ markNeedsUpdate: () => ft(c)
3757
+ }, this.installGeometryDisplayColorMetadata(c, o, r, "line", l);
3738
3758
  const u = this.colorOverridesByIndex.get(r) ?? null;
3739
3759
  this.applyLayerColorState(e.material, u, "line"), e.material.needsUpdate = !0;
3740
3760
  }
@@ -3756,7 +3776,7 @@ class ye extends ee {
3756
3776
  this.applyDisplayColorsToGeometry(r.geometry);
3757
3777
  }
3758
3778
  createRenderableTextChunk(e) {
3759
- const r = Jr, i = this.resolveTextFont(e.t), s = new r();
3779
+ const r = ei, i = this.resolveTextFont(e.t), s = new r();
3760
3780
  s.text = i.text, s.fontSize = e.h, s.position.set(e.x, e.y, 0), s.rotation.z = (e.r || 0) * Math.PI / 180, s.color = this.resolveDisplayHexForRgb(e.c, e.li, "text"), s.anchorX = ye.resolveTextAnchorX(e.ha), s.anchorY = ye.resolveTextAnchorY(e.va), i.fontUrl && (s.font = i.fontUrl), e.w && (s.maxWidth = e.w), e.lh && (s.lineHeight = e.lh);
3761
3781
  const a = e.wf || 1;
3762
3782
  return s.scale.x = (e.mx ? -1 : 1) * a, e.my && (s.scale.y = -1), this.commitTroikaTextTransform(s), s.name = "text-chunk", s.userData.kind = "text", s.userData.layerIndex = e.li, s.userData.text = { ...e, c: H(e.c) }, s.userData.renderedText = i.text, s.userData.fontKind = i.kind ?? "default", s.userData.replacedUnsupportedText = i.replacedUnsupported === !0, s;
@@ -3882,9 +3902,9 @@ class ye extends ee {
3882
3902
  run: () => this.compactNonLineChunksForSingleLayer(s, "dot")
3883
3903
  }
3884
3904
  );
3885
- await $s(i, {
3905
+ await js(i, {
3886
3906
  opsPerPass: e,
3887
- frameBudgetMs: Rr,
3907
+ frameBudgetMs: Br,
3888
3908
  onYield: r
3889
3909
  }), this.rebuildNonLineChunkStats(), this.notifyInternalChange();
3890
3910
  }
@@ -3898,16 +3918,16 @@ class ye extends ee {
3898
3918
  return !1;
3899
3919
  const i = /* @__PURE__ */ new Set(), s = [];
3900
3920
  for (const o of r) {
3901
- let l = 0, d = null;
3921
+ let l = 0, c = null;
3902
3922
  for (const I of o.records)
3903
- l += I.vertexCount, d = fe(d, I.bbox);
3904
- const u = o.canonicalKind === "xy" ? 2 : 3, c = new Float32Array(l * u), h = new Uint8Array(l * 3), y = [];
3923
+ l += I.vertexCount, c = fe(c, I.bbox);
3924
+ const u = o.canonicalKind === "xy" ? 2 : 3, d = new Float32Array(l * u), h = new Uint8Array(l * 3), y = [];
3905
3925
  let x = !0, m = 0;
3906
3926
  for (const I of o.records)
3907
- ra(
3927
+ ia(
3908
3928
  I.position,
3909
3929
  I.vertexCount,
3910
- c,
3930
+ d,
3911
3931
  m,
3912
3932
  u
3913
3933
  ), h.set(I.col, m * 3), I.colorRuns && I.colorRuns.length > 0 ? Fn(y, I.colorRuns, m) : x = !1, m += I.vertexCount;
@@ -3916,10 +3936,10 @@ class ye extends ee {
3916
3936
  const b = x ? Pt(y) : void 0, R = this.makeLineChunkRecord(
3917
3937
  o.parent,
3918
3938
  e,
3919
- c,
3939
+ d,
3920
3940
  h,
3921
3941
  l,
3922
- d,
3942
+ c,
3923
3943
  u === 2 ? "xy-zero-z" : void 0,
3924
3944
  b,
3925
3945
  u,
@@ -3959,17 +3979,17 @@ class ye extends ee {
3959
3979
  if (s.length <= 1)
3960
3980
  return !1;
3961
3981
  let a = 0, o = null;
3962
- const l = [], d = [], u = [];
3963
- let c = !0;
3982
+ const l = [], c = [], u = [];
3983
+ let d = !0;
3964
3984
  for (const w of s) {
3965
- const A = w.geometry;
3966
- if (!A) continue;
3967
- const B = A.getAttribute("position"), E = A.getAttribute("color");
3968
- if (!(B instanceof $) || !(E instanceof $) || !(B.array instanceof Float32Array)) continue;
3985
+ const B = w.geometry;
3986
+ if (!B) continue;
3987
+ const A = B.getAttribute("position"), E = B.getAttribute("color");
3988
+ if (!(A instanceof $) || !(E instanceof $) || !(A.array instanceof Float32Array)) continue;
3969
3989
  const S = Number(((R = w.userData) == null ? void 0 : R.vertexCount) || 0);
3970
3990
  if (S <= 0) continue;
3971
- const P = A.userData.cadDisplaySourceColor, O = A.userData.cadDisplayColorRuns;
3972
- O && O.length > 0 ? Fn(u, O, a) : c = !1, a += S, l.push(B.array), d.push(P instanceof Uint8Array ? P : ms(E)), o = fe(o, ((I = w.userData) == null ? void 0 : I.bbox) ?? null);
3991
+ const P = B.userData.cadDisplaySourceColor, O = B.userData.cadDisplayColorRuns;
3992
+ O && O.length > 0 ? Fn(u, O, a) : d = !1, a += S, l.push(A.array), c.push(P instanceof Uint8Array ? P : ps(E)), o = fe(o, ((I = w.userData) == null ? void 0 : I.bbox) ?? null);
3973
3993
  }
3974
3994
  for (const w of s)
3975
3995
  i.remove(w), bt(w);
@@ -3978,10 +3998,10 @@ class ye extends ee {
3978
3998
  const h = new Float32Array(a * 3), y = new Uint8Array(a * 3);
3979
3999
  let x = 0;
3980
4000
  for (let w = 0; w < l.length; w += 1) {
3981
- const T = Math.floor(l[w].length / 3), A = x * 3;
3982
- h.set(l[w], A), y.set(d[w], A), x += T;
4001
+ const T = Math.floor(l[w].length / 3), B = x * 3;
4002
+ h.set(l[w], B), y.set(c[w], B), x += T;
3983
4003
  }
3984
- const m = c ? Pt(u) : void 0, b = this.createRenderableChunk(
4004
+ const m = d ? Pt(u) : void 0, b = this.createRenderableChunk(
3985
4005
  r,
3986
4006
  e,
3987
4007
  h,
@@ -4001,8 +4021,8 @@ class ye extends ee {
4001
4021
  const o = this.findKindGroup(a, s);
4002
4022
  if (o)
4003
4023
  for (const l of o.children) {
4004
- const d = Number(((r = l.userData) == null ? void 0 : r.vertexCount) || 0), u = ((i = l.userData) == null ? void 0 : i.bbox) ?? null;
4005
- this.nonLineChunkStats.push({ layerIndex: a, vertexCount: d, bbox: u });
4024
+ const c = Number(((r = l.userData) == null ? void 0 : r.vertexCount) || 0), u = ((i = l.userData) == null ? void 0 : i.bbox) ?? null;
4025
+ this.nonLineChunkStats.push({ layerIndex: a, vertexCount: c, bbox: u });
4006
4026
  }
4007
4027
  }
4008
4028
  }
@@ -4030,13 +4050,13 @@ class ye extends ee {
4030
4050
  }
4031
4051
  refreshDisplayColors() {
4032
4052
  this.traverse((e) => {
4033
- var u, c;
4053
+ var u, d;
4034
4054
  const r = (u = e.userData) == null ? void 0 : u.kind;
4035
4055
  if (r === "text" || r === "text-batch") return;
4036
4056
  const i = e.geometry;
4037
4057
  i && this.applyDisplayColorsToGeometry(i);
4038
- const s = e.material, a = Number.isInteger((c = e.userData) == null ? void 0 : c.layerIndex) ? Number(e.userData.layerIndex) : null, o = a === null ? null : this.colorOverridesByIndex.get(a) ?? null, l = this.displayElementKindForObject(e), d = Array.isArray(s) ? s : s ? [s] : [];
4039
- for (const h of d)
4058
+ const s = e.material, a = Number.isInteger((d = e.userData) == null ? void 0 : d.layerIndex) ? Number(e.userData.layerIndex) : null, o = a === null ? null : this.colorOverridesByIndex.get(a) ?? null, l = this.displayElementKindForObject(e), c = Array.isArray(s) ? s : s ? [s] : [];
4059
+ for (const h of c)
4040
4060
  gt(h) && (this.applyLayerColorState(h, o, l), h.needsUpdate = !0);
4041
4061
  });
4042
4062
  for (const e of this.layerOrder)
@@ -4053,13 +4073,13 @@ class ye extends ee {
4053
4073
  this.applyDisplayColorsToGeometry(o);
4054
4074
  }
4055
4075
  installGeometryDisplayColorMetadata(e, r, i, s, a) {
4056
- const o = e, l = Math.floor(r.length / 3), d = On(a, l);
4057
- return d ? (delete o.userData.cadDisplaySourceColor, o.userData.cadDisplayColorRuns = d) : (o.userData.cadDisplaySourceColor = fr(r).slice(), delete o.userData.cadDisplayColorRuns), o.userData.cadDisplayVertexCount = l, o.userData.cadDisplayLayerIndex = i, o.userData.cadDisplayElementKind = s, o;
4076
+ const o = e, l = Math.floor(r.length / 3), c = On(a, l);
4077
+ return c ? (delete o.userData.cadDisplaySourceColor, o.userData.cadDisplayColorRuns = c) : (o.userData.cadDisplaySourceColor = yr(r).slice(), delete o.userData.cadDisplayColorRuns), o.userData.cadDisplayVertexCount = l, o.userData.cadDisplayLayerIndex = i, o.userData.cadDisplayElementKind = s, o;
4058
4078
  }
4059
4079
  applyDisplayColorsToGeometry(e) {
4060
- const r = e, i = r.userData.cadDisplaySourceColor, s = r.userData.cadDisplayColorRuns, a = Number(r.userData.cadDisplayVertexCount ?? 0), o = Number(r.userData.cadDisplayLayerIndex ?? 0), l = r.userData.cadDisplayElementKind ?? "line", d = s && s.length > 0 && Ye(a, s), u = r.userData.cadDisplayColorTarget;
4080
+ const r = e, i = r.userData.cadDisplaySourceColor, s = r.userData.cadDisplayColorRuns, a = Number(r.userData.cadDisplayVertexCount ?? 0), o = Number(r.userData.cadDisplayLayerIndex ?? 0), l = r.userData.cadDisplayElementKind ?? "line", c = s && s.length > 0 && Ye(a, s), u = r.userData.cadDisplayColorTarget;
4061
4081
  if (u) {
4062
- if (d) {
4082
+ if (c) {
4063
4083
  const y = a * 3;
4064
4084
  if (u.array.length !== y)
4065
4085
  throw new Error(
@@ -4085,8 +4105,8 @@ class ye extends ee {
4085
4105
  }
4086
4106
  return;
4087
4107
  }
4088
- if (d && typeof r.setColors == "function") {
4089
- const y = gs(
4108
+ if (c && typeof r.setColors == "function") {
4109
+ const y = bs(
4090
4110
  a,
4091
4111
  s,
4092
4112
  (x) => this.resolveDisplayRgbForLegacyRgb(x, o, l)
@@ -4094,7 +4114,7 @@ class ye extends ee {
4094
4114
  this.recordDisplayColorBuildStats(y.stats), r.setColors(y.color), r.getAttribute("instanceColorStart") && (r.getAttribute("instanceColorStart").needsUpdate = !0), r.getAttribute("instanceColorEnd") && (r.getAttribute("instanceColorEnd").needsUpdate = !0);
4095
4115
  return;
4096
4116
  }
4097
- if (d) {
4117
+ if (c) {
4098
4118
  const y = r.getAttribute("color");
4099
4119
  if (y instanceof $ && y.array instanceof Uint8Array && y.array.length === a * 3) {
4100
4120
  const m = St(
@@ -4115,26 +4135,26 @@ class ye extends ee {
4115
4135
  return;
4116
4136
  }
4117
4137
  if (!(i instanceof Uint8Array) || i.length === 0) return;
4118
- const c = this.buildDisplayColorBytes(i, o, l);
4138
+ const d = this.buildDisplayColorBytes(i, o, l);
4119
4139
  if (typeof r.setColors == "function") {
4120
- r.setColors(ys(c)), r.getAttribute("instanceColorStart") && (r.getAttribute("instanceColorStart").needsUpdate = !0), r.getAttribute("instanceColorEnd") && (r.getAttribute("instanceColorEnd").needsUpdate = !0);
4140
+ r.setColors(ms(d)), r.getAttribute("instanceColorStart") && (r.getAttribute("instanceColorStart").needsUpdate = !0), r.getAttribute("instanceColorEnd") && (r.getAttribute("instanceColorEnd").needsUpdate = !0);
4121
4141
  return;
4122
4142
  }
4123
4143
  const h = r.getAttribute("color");
4124
- if (h instanceof $ && h.array instanceof Uint8Array && h.array.length === c.length) {
4125
- h.array.set(c), h.normalized = !0, h.needsUpdate = !0;
4144
+ if (h instanceof $ && h.array instanceof Uint8Array && h.array.length === d.length) {
4145
+ h.array.set(d), h.normalized = !0, h.needsUpdate = !0;
4126
4146
  return;
4127
4147
  }
4128
- r.setAttribute("color", wn(c));
4148
+ r.setAttribute("color", wn(d));
4129
4149
  }
4130
4150
  buildDisplayColorBytes(e, r, i, s, a) {
4131
4151
  const l = s && s.length > 0 && typeof a == "number" && Ye(a, s) ? vn(
4132
4152
  a,
4133
4153
  s,
4134
- (d) => this.resolveDisplayRgbForLegacyRgb(d, r, i)
4135
- ) : xs(
4154
+ (c) => this.resolveDisplayRgbForLegacyRgb(c, r, i)
4155
+ ) : gs(
4136
4156
  e,
4137
- (d) => this.resolveDisplayRgbForLegacyRgb(d, r, i)
4157
+ (c) => this.resolveDisplayRgbForLegacyRgb(c, r, i)
4138
4158
  );
4139
4159
  return this.recordDisplayColorBuildStats(l.stats), l.color;
4140
4160
  }
@@ -4142,9 +4162,9 @@ class ye extends ee {
4142
4162
  this.colorRefreshStats.displayRefreshVertexTotal += e.vertexCount, this.colorRefreshStats.displayRefreshRunTotal += e.runCount, this.colorRefreshStats.displayRefreshUniqueColorTotal += e.uniqueColorCount, this.colorRefreshStats.displayRefreshCacheHitTotal += e.cacheHitCount, this.colorRefreshStats.displayRefreshRepeatedRunVertexTotal += e.repeatedRunVertexCount;
4143
4163
  }
4144
4164
  resolveDisplayHexForRgb(e, r, i) {
4145
- const s = Ea(e, r, i, this.displayThemeName, this.displayContrastEnhancement), a = this.displayHexMemo.get(s);
4165
+ const s = Sa(e, r, i, this.displayThemeName, this.displayContrastEnhancement), a = this.displayHexMemo.get(s);
4146
4166
  if (a !== void 0) return a;
4147
- const o = Ba(this.resolveDisplayRgbForLegacyRgb(e, r, i));
4167
+ const o = Va(this.resolveDisplayRgbForLegacyRgb(e, r, i));
4148
4168
  return this.displayHexMemo.set(s, o), o;
4149
4169
  }
4150
4170
  resolveDisplayRgbForLegacyRgb(e, r, i) {
@@ -4162,26 +4182,26 @@ class ye extends ee {
4162
4182
  }
4163
4183
  createInsertInstanceRecords(e) {
4164
4184
  const r = [], { meta: i, mats: s, bboxes: a, count: o } = e, l = /* @__PURE__ */ new Map();
4165
- for (let d = 0; d < o; d += 1) {
4166
- const u = i[d * 3], c = i[d * 3 + 1], h = `${u}:${c}`, y = l.get(h) ?? 0;
4185
+ for (let c = 0; c < o; c += 1) {
4186
+ const u = i[c * 3], d = i[c * 3 + 1], h = `${u}:${d}`, y = l.get(h) ?? 0;
4167
4187
  l.set(h, y + 1);
4168
4188
  const x = {
4169
- minX: a[d * 4],
4170
- minY: a[d * 4 + 1],
4171
- maxX: a[d * 4 + 2],
4172
- maxY: a[d * 4 + 3]
4189
+ minX: a[c * 4],
4190
+ minY: a[c * 4 + 1],
4191
+ maxX: a[c * 4 + 2],
4192
+ maxY: a[c * 4 + 3]
4173
4193
  };
4174
4194
  Tt(x) && r.push({
4175
- recordKey: Ar(u, c, y),
4195
+ recordKey: Ar(u, d, y),
4176
4196
  instanceId: u,
4177
- variantId: c,
4178
- layerIdx: i[d * 3 + 2],
4179
- matA: s[d * 6],
4180
- matB: s[d * 6 + 1],
4181
- matC: s[d * 6 + 2],
4182
- matD: s[d * 6 + 3],
4183
- tx: s[d * 6 + 4],
4184
- ty: s[d * 6 + 5],
4197
+ variantId: d,
4198
+ layerIdx: i[c * 3 + 2],
4199
+ matA: s[c * 6],
4200
+ matB: s[c * 6 + 1],
4201
+ matC: s[c * 6 + 2],
4202
+ matD: s[c * 6 + 3],
4203
+ tx: s[c * 6 + 4],
4204
+ ty: s[c * 6 + 5],
4185
4205
  bbox: x
4186
4206
  });
4187
4207
  }
@@ -4189,7 +4209,7 @@ class ye extends ee {
4189
4209
  }
4190
4210
  createInsertPresenterMaterial(e) {
4191
4211
  let r;
4192
- return e === "line" ? r = new ln({ vertexColors: !0 }) : e === "fill" ? r = new dn({
4212
+ return e === "line" ? r = new ln({ vertexColors: !0 }) : e === "fill" ? r = new cn({
4193
4213
  vertexColors: !0,
4194
4214
  side: vt,
4195
4215
  depthWrite: !1
@@ -4197,7 +4217,7 @@ class ye extends ee {
4197
4217
  vertexColors: !0,
4198
4218
  size: 2,
4199
4219
  sizeAttenuation: !1
4200
- }), Sa(r), r;
4220
+ }), ka(r), r;
4201
4221
  }
4202
4222
  clearViewportInsertPresenter() {
4203
4223
  var e, r;
@@ -4276,9 +4296,9 @@ class ye extends ee {
4276
4296
  e === this.effectiveRenderQuality && !r.forceLineRebuild || (this.effectiveRenderQuality = e, this.rebuildLineChunks(), this.notifyInternalChange());
4277
4297
  }
4278
4298
  resolveCurrentEffectiveRenderQuality() {
4279
- return this.interactionRenderQualityOverride ?? Zs(this.renderQualityMode, this.effectiveRenderQuality, this.autoQualityContext);
4299
+ return this.interactionRenderQualityOverride ?? Js(this.renderQualityMode, this.effectiveRenderQuality, this.autoQualityContext);
4280
4300
  }
4281
- notifyInternalChange(e = la) {
4301
+ notifyInternalChange(e = ca) {
4282
4302
  if (this.disposed) return;
4283
4303
  this.renderDebugRevision += 1;
4284
4304
  const r = this.internalChangeHook ? [this.internalChangeHook, ...this.changeListeners] : [...this.changeListeners];
@@ -4310,7 +4330,7 @@ class ye extends ee {
4310
4330
  this.readySettled || (this.readySettled = !0, this.rejectReady(e));
4311
4331
  }
4312
4332
  }
4313
- function Vr(t) {
4333
+ function Er(t) {
4314
4334
  if (t.kind !== "url") return null;
4315
4335
  try {
4316
4336
  const n = typeof document > "u" ? void 0 : document.baseURI;
@@ -4322,7 +4342,7 @@ function Vr(t) {
4322
4342
  function je(t) {
4323
4343
  return !!(t && (t.line.count > 0 || t.fill.count > 0 || t.dot.count > 0 || t.texts.length > 0));
4324
4344
  }
4325
- async function Er(t, n, e) {
4345
+ async function Sr(t, n, e) {
4326
4346
  if (!n) return null;
4327
4347
  const r = new URL(n.href, t).href, i = await fetch(r, { signal: e });
4328
4348
  if (!i.ok) {
@@ -4334,15 +4354,15 @@ async function Er(t, n, e) {
4334
4354
  throw new Error(
4335
4355
  `Scene annotation raw_size mismatch: manifest=${n.raw_size}, response=${s.byteLength}`
4336
4356
  );
4337
- const a = Wr(s);
4357
+ const a = Xr(s);
4338
4358
  if (a.line.count !== n.line_count || a.fill.count !== n.fill_count || a.dot.count !== n.dot_count || a.texts.length !== n.text_count)
4339
4359
  throw new Error(`Scene annotation count mismatch for ${r}`);
4340
4360
  return a;
4341
4361
  }
4342
- async function Pa(t, n, e, r, i) {
4362
+ async function La(t, n, e, r, i) {
4343
4363
  if (e.externalVariantFetchSource !== void 0 || e.externalVariantBuffers !== void 0 || e.requiredExternalVariantIds !== void 0 || e.externalVariantGeometryFetchIds !== void 0)
4344
4364
  return { annotations: [] };
4345
- const s = Vr(t);
4365
+ const s = Er(t);
4346
4366
  if (!s) return { annotations: [] };
4347
4367
  const a = Ke(n, {
4348
4368
  hiddenInstanceIds: r,
@@ -4352,22 +4372,22 @@ async function Pa(t, n, e, r, i) {
4352
4372
  entries: a.manifest,
4353
4373
  requiredVariantIds: a.requiredVariantIds,
4354
4374
  signal: i
4355
- }) : Promise.resolve({ buffers: /* @__PURE__ */ new Map(), fetchMs: 0 }), l = e.loadAnnotations === !1 ? null : Gt(n), [d, u] = await Promise.all([
4375
+ }) : Promise.resolve({ buffers: /* @__PURE__ */ new Map(), fetchMs: 0 }), l = e.loadAnnotations === !1 ? null : Gt(n), [c, u] = await Promise.all([
4356
4376
  o,
4357
- l != null && l.scene ? Er(s, l.scene, i) : Promise.resolve(null)
4358
- ]), c = [];
4359
- if (je(u) && c.push(u), e.loadAnnotations !== !1 && e.loadBlocks !== !1) {
4377
+ l != null && l.scene ? Sr(s, l.scene, i) : Promise.resolve(null)
4378
+ ]), d = [];
4379
+ if (je(u) && d.push(u), e.loadAnnotations !== !1 && e.loadBlocks !== !1) {
4360
4380
  const h = Ut(n, {
4361
- externalVariantBuffers: d.buffers,
4381
+ externalVariantBuffers: c.buffers,
4362
4382
  hiddenInstanceIds: r
4363
4383
  });
4364
- je(h) && c.push(h);
4384
+ je(h) && d.push(h);
4365
4385
  }
4366
4386
  return {
4367
- externalVariantBuffers: d.buffers,
4387
+ externalVariantBuffers: c.buffers,
4368
4388
  requiredExternalVariantIds: a.requiredVariantIds,
4369
4389
  externalVariantGeometryFetchIds: a.requiredVariantIds,
4370
- annotations: c
4390
+ annotations: d
4371
4391
  };
4372
4392
  }
4373
4393
  function Gn(t) {
@@ -4395,19 +4415,19 @@ async function So(t, n, e) {
4395
4415
  });
4396
4416
  }
4397
4417
  function ko(t) {
4398
- return Xr(t);
4418
+ return Yr(t);
4399
4419
  }
4400
- const La = {
4420
+ const Ma = {
4401
4421
  deferExternalVariantGeometry: !0
4402
4422
  };
4403
- function Ma(t) {
4404
- return Ot(t, La).header;
4423
+ function Da(t) {
4424
+ return Ot(t, Ma).header;
4405
4425
  }
4406
4426
  function To(t) {
4407
- return Yr(t);
4427
+ return Qr(t);
4408
4428
  }
4409
4429
  function Po(t) {
4410
- return Qr(t);
4430
+ return $r(t);
4411
4431
  }
4412
4432
  function Lo(t, n) {
4413
4433
  return Ke(t, n);
@@ -4433,9 +4453,9 @@ function Fo(t, n) {
4433
4453
  };
4434
4454
  }
4435
4455
  function Oo(t) {
4436
- ai(t);
4456
+ oi(t);
4437
4457
  }
4438
- function Da(t) {
4458
+ function Fa(t) {
4439
4459
  return t instanceof Error ? t : typeof t == "string" ? new Error(t) : new Error(`Unknown geo load error: ${String(t)}`);
4440
4460
  }
4441
4461
  function en(t) {
@@ -4456,13 +4476,13 @@ function _o(t, n = {}) {
4456
4476
  });
4457
4477
  const a = en(n.hiddenInstanceIds), o = ie(n.requiredExternalVariantIds), l = ie(n.externalVariantGeometryFetchIds);
4458
4478
  return (async () => {
4459
- var d;
4479
+ var c;
4460
4480
  try {
4461
- const u = await jn(
4481
+ const u = await Zn(
4462
4482
  Zt(r.source),
4463
4483
  e.signal,
4464
4484
  "CAD load aborted before decoding"
4465
- ), c = await Pa(
4485
+ ), d = await La(
4466
4486
  r.source,
4467
4487
  u,
4468
4488
  n,
@@ -4471,20 +4491,20 @@ function _o(t, n = {}) {
4471
4491
  ), h = {
4472
4492
  signal: e.signal,
4473
4493
  hiddenInstanceIds: a,
4474
- requiredExternalVariantIds: o ?? ie(c.requiredExternalVariantIds),
4475
- externalVariantGeometryFetchIds: l ?? ie(c.externalVariantGeometryFetchIds),
4494
+ requiredExternalVariantIds: o ?? ie(d.requiredExternalVariantIds),
4495
+ externalVariantGeometryFetchIds: l ?? ie(d.externalVariantGeometryFetchIds),
4476
4496
  beforeTextAppend: n.beforeTextAppend,
4477
4497
  beforeFinalize: async () => {
4478
4498
  var y;
4479
- for (const x of c.annotations)
4499
+ for (const x of d.annotations)
4480
4500
  await ((y = n.beforeTextAppend) == null ? void 0 : y.call(n, x.texts)), i.appendAnnotationOverlay(x);
4481
4501
  }
4482
4502
  };
4483
- n.loadBlocks === !1 && (h.loadBlocks = !1), typeof n.maxExpandedInstanceVertices == "number" && Number.isFinite(n.maxExpandedInstanceVertices) && n.maxExpandedInstanceVertices >= 0 && (h.maxExpandedInstanceVertices = n.maxExpandedInstanceVertices), n.preferWorker === !1 && (h.preferWorker = !1), n.workerUrl !== void 0 && (h.workerUrl = n.workerUrl), n.workerFactory && (h.workerFactory = n.workerFactory), n.externalVariantFetchSource && (h.externalVariantFetchSource = n.externalVariantFetchSource), n.externalVariantBuffers && n.externalVariantBuffers.size > 0 ? h.externalVariantBuffers = n.externalVariantBuffers : (d = c.externalVariantBuffers) != null && d.size && (h.externalVariantBuffers = c.externalVariantBuffers), await cr(i, u, void 0, {
4503
+ n.loadBlocks === !1 && (h.loadBlocks = !1), typeof n.maxExpandedInstanceVertices == "number" && Number.isFinite(n.maxExpandedInstanceVertices) && n.maxExpandedInstanceVertices >= 0 && (h.maxExpandedInstanceVertices = n.maxExpandedInstanceVertices), n.preferWorker === !1 && (h.preferWorker = !1), n.workerUrl !== void 0 && (h.workerUrl = n.workerUrl), n.workerFactory && (h.workerFactory = n.workerFactory), n.externalVariantFetchSource && (h.externalVariantFetchSource = n.externalVariantFetchSource), n.externalVariantBuffers && n.externalVariantBuffers.size > 0 ? h.externalVariantBuffers = n.externalVariantBuffers : (c = d.externalVariantBuffers) != null && c.size && (h.externalVariantBuffers = d.externalVariantBuffers), await ur(i, u, void 0, {
4484
4504
  ...h
4485
4505
  });
4486
4506
  } catch (u) {
4487
- i._fail(Da(u));
4507
+ i._fail(Fa(u));
4488
4508
  } finally {
4489
4509
  for (const u of s) u();
4490
4510
  $e(i, null);
@@ -4492,42 +4512,42 @@ function _o(t, n = {}) {
4492
4512
  })(), i;
4493
4513
  }
4494
4514
  function Go(t) {
4495
- ei(t);
4515
+ ti(t);
4496
4516
  }
4497
- const Fa = 40;
4498
- function Sr(t) {
4517
+ const Oa = 40;
4518
+ function kr(t) {
4499
4519
  return !!(t && Number.isFinite(t.minX) && Number.isFinite(t.minY) && Number.isFinite(t.maxX) && Number.isFinite(t.maxY) && t.maxX >= t.minX && t.maxY >= t.minY);
4500
4520
  }
4501
- function Oa(t, n, e) {
4521
+ function _a(t, n, e) {
4502
4522
  return n.x >= t.minX - e && n.x <= t.maxX + e && n.y >= t.minY - e && n.y <= t.maxY + e;
4503
4523
  }
4504
- function _a(t, n) {
4524
+ function Ga(t, n) {
4505
4525
  return n.minX >= t.minX && n.maxX <= t.maxX && n.minY >= t.minY && n.maxY <= t.maxY;
4506
4526
  }
4507
4527
  function Uo(t, n) {
4508
4528
  return t.layerIndex === n.layerIndex && t.variantId === n.variantId && t.instanceId === n.instanceId;
4509
4529
  }
4510
- function Ga(t, n, e = {}) {
4530
+ function Ua(t, n, e = {}) {
4511
4531
  var a;
4512
4532
  if (!Number.isFinite(n.x) || !Number.isFinite(n.y)) return null;
4513
- const r = Math.max(0, e.padding ?? Fa), i = t.getLayers();
4533
+ const r = Math.max(0, e.padding ?? Oa), i = t.getLayers();
4514
4534
  let s = null;
4515
4535
  for (let o = i.length - 1; o >= 0; o -= 1) {
4516
4536
  const l = i[o];
4517
4537
  if (!l || !l.visible) continue;
4518
- const d = t.getLayerBlockUsages(l.index);
4519
- for (let u = d.length - 1; u >= 0; u -= 1) {
4520
- const c = d[u];
4521
- for (let h = c.inserts.length - 1; h >= 0; h -= 1) {
4522
- const y = c.inserts[h];
4523
- if (!y.canHighlight || !Sr(y.bbox) || ((a = e.isInstanceVisible) == null ? void 0 : a.call(e, y.instanceId)) === !1 || !Oa(y.bbox, n, r)) continue;
4538
+ const c = t.getLayerBlockUsages(l.index);
4539
+ for (let u = c.length - 1; u >= 0; u -= 1) {
4540
+ const d = c[u];
4541
+ for (let h = d.inserts.length - 1; h >= 0; h -= 1) {
4542
+ const y = d.inserts[h];
4543
+ if (!y.canHighlight || !kr(y.bbox) || ((a = e.isInstanceVisible) == null ? void 0 : a.call(e, y.instanceId)) === !1 || !_a(y.bbox, n, r)) continue;
4524
4544
  const x = {
4525
4545
  kind: "insert",
4526
4546
  layerIndex: l.index,
4527
- variantId: c.variantId,
4547
+ variantId: d.variantId,
4528
4548
  instanceId: y.instanceId
4529
4549
  };
4530
- if (s || (s = x), !e.viewport || _a(e.viewport, y.bbox)) return x;
4550
+ if (s || (s = x), !e.viewport || Ga(e.viewport, y.bbox)) return x;
4531
4551
  }
4532
4552
  }
4533
4553
  }
@@ -4535,7 +4555,7 @@ function Ga(t, n, e = {}) {
4535
4555
  }
4536
4556
  function It(t, n) {
4537
4557
  const e = t.getLayerBlockUsages(n.layerIndex).find((a) => a.variantId === n.variantId), r = e == null ? void 0 : e.inserts.find((a) => a.instanceId === n.instanceId);
4538
- if (!e || !r || !Sr(r.bbox)) return null;
4558
+ if (!e || !r || !kr(r.bbox)) return null;
4539
4559
  const i = t.getLayers().find((a) => a.index === n.layerIndex), s = t.getInsertInstanceBaseTransform(n.instanceId, n.variantId);
4540
4560
  return {
4541
4561
  id: { ...n },
@@ -4551,31 +4571,31 @@ function It(t, n) {
4551
4571
  bbox: Object.freeze({ ...r.bbox })
4552
4572
  };
4553
4573
  }
4554
- const Ua = 0.6;
4555
- function Na(t) {
4556
- const n = t.w ?? t.t.length * t.h * Ua, e = t.h * (t.lh || 1);
4574
+ const Na = 0.6;
4575
+ function za(t) {
4576
+ const n = t.w ?? t.t.length * t.h * Na, e = t.h * (t.lh || 1);
4557
4577
  let r = 0;
4558
4578
  t.ha === "center" ? r = -n / 2 : t.ha === "right" && (r = -n);
4559
4579
  let i = 0;
4560
4580
  return t.va === "middle" ? i = -e / 2 : t.va === "top" && (i = -e), { x0: r, y0: i, x1: r + n, y1: i + e };
4561
4581
  }
4562
- function za(t, n, e) {
4563
- const r = t.x - n.x, i = t.y - n.y, s = (n.r || 0) * Math.PI / 180, a = Math.cos(-s), o = Math.sin(-s), l = r * a - i * o, d = r * o + i * a;
4564
- return l >= e.x0 && l <= e.x1 && d >= e.y0 && d <= e.y1;
4582
+ function Ha(t, n, e) {
4583
+ const r = t.x - n.x, i = t.y - n.y, s = (n.r || 0) * Math.PI / 180, a = Math.cos(-s), o = Math.sin(-s), l = r * a - i * o, c = r * o + i * a;
4584
+ return l >= e.x0 && l <= e.x1 && c >= e.y0 && c <= e.y1;
4565
4585
  }
4566
- function Ha(t, n, e = {}) {
4586
+ function qa(t, n, e = {}) {
4567
4587
  if (!Number.isFinite(n.x) || !Number.isFinite(n.y)) return null;
4568
4588
  const r = t.getTextEntries(), i = e.maxTextCount;
4569
4589
  if (r.length === 0) return null;
4570
4590
  const s = t.getLayers(), a = i === void 0 ? r.length - 1 : Math.min(r.length, Math.max(0, Math.floor(i))) - 1;
4571
4591
  for (let o = a; o >= 0; o -= 1) {
4572
- const l = r[o], d = s.find((u) => u.index === l.li);
4573
- if (!(d && d.visible === !1) && za(n, l, Na(l)))
4592
+ const l = r[o], c = s.find((u) => u.index === l.li);
4593
+ if (!(c && c.visible === !1) && Ha(n, l, za(l)))
4574
4594
  return { kind: "text", textId: o };
4575
4595
  }
4576
4596
  return null;
4577
4597
  }
4578
- function qa(t, n) {
4598
+ function Un(t, n) {
4579
4599
  if (n.kind !== "text" || !Number.isInteger(n.textId) || n.textId < 0) return null;
4580
4600
  const e = t.getTextEntries()[n.textId];
4581
4601
  if (!e) return null;
@@ -4605,7 +4625,7 @@ const zo = [
4605
4625
  function Ka(t) {
4606
4626
  return `${Lt}${t.layerIndex}:${t.variantId}:${t.instanceId}`;
4607
4627
  }
4608
- function kr(t) {
4628
+ function Tr(t) {
4609
4629
  if (t.startsWith(Lt)) {
4610
4630
  const e = t.slice(Lt.length).split(":");
4611
4631
  if (e.length !== 3) return null;
@@ -4616,7 +4636,7 @@ function kr(t) {
4616
4636
  return Number.isInteger(n) ? { instanceId: n } : null;
4617
4637
  }
4618
4638
  function Wa(t) {
4619
- const n = kr(t);
4639
+ const n = Tr(t);
4620
4640
  return n ? n.instanceId : null;
4621
4641
  }
4622
4642
  function He(t) {
@@ -4632,7 +4652,7 @@ function He(t) {
4632
4652
  planar: !0
4633
4653
  } : null;
4634
4654
  }
4635
- function Un(t, n) {
4655
+ function Nn(t, n) {
4636
4656
  return t ? n ? {
4637
4657
  minX: Math.min(t.minX, n.minX),
4638
4658
  minY: Math.min(t.minY, n.minY),
@@ -4646,7 +4666,7 @@ function Un(t, n) {
4646
4666
  function Xa(t) {
4647
4667
  let n = 0, e = 0;
4648
4668
  return t.traverse((r) => {
4649
- if (!Pr(r) || !Tr(r)) return;
4669
+ if (!Lr(r) || !Pr(r)) return;
4650
4670
  n += 1;
4651
4671
  const i = Number(r.userData.vertexCount);
4652
4672
  Number.isFinite(i) && i > 0 && (e += i);
@@ -4676,7 +4696,7 @@ function $a(t) {
4676
4696
  function ja(t) {
4677
4697
  const n = /* @__PURE__ */ new Map();
4678
4698
  return t.traverse((e) => {
4679
- if (!Pr(e) || !Tr(e)) return;
4699
+ if (!Lr(e) || !Pr(e)) return;
4680
4700
  const r = $a(e), i = n.get(r) ?? {
4681
4701
  kind: r,
4682
4702
  label: Ya[r],
@@ -4690,11 +4710,11 @@ function ja(t) {
4690
4710
  renderDebugBreakdown: Qa.map((e) => n.get(e)).filter((e) => e !== void 0)
4691
4711
  };
4692
4712
  }
4693
- function Tr(t) {
4713
+ function Pr(t) {
4694
4714
  const n = t;
4695
4715
  return !!(n.isLine || n.isLineSegments || n.isMesh || n.isPoints || n.isInstancedMesh);
4696
4716
  }
4697
- function Pr(t) {
4717
+ function Lr(t) {
4698
4718
  let n = t;
4699
4719
  for (; n; ) {
4700
4720
  if (!n.visible) return !1;
@@ -4711,13 +4731,13 @@ function Ja(t) {
4711
4731
  const l = e.get(o.variantId) ?? /* @__PURE__ */ new Set();
4712
4732
  l.add(a.index), e.set(o.variantId, l);
4713
4733
  for (const u of o.inserts) r.add(u.instanceId);
4714
- let d = i.get(o.variantId);
4715
- d || (d = {
4734
+ let c = i.get(o.variantId);
4735
+ c || (c = {
4716
4736
  variantId: o.variantId,
4717
4737
  blockName: o.blockName,
4718
4738
  instanceCount: 0,
4719
4739
  layers: /* @__PURE__ */ new Map()
4720
- }, i.set(o.variantId, d)), d.instanceCount += o.instanceCount, d.layers.set(a.index, a.name);
4740
+ }, i.set(o.variantId, c)), c.instanceCount += o.instanceCount, c.layers.set(a.index, a.name);
4721
4741
  }
4722
4742
  const s = [...i.values()].filter((a) => a.layers.size > 1).map((a) => ({
4723
4743
  variantId: a.variantId,
@@ -4742,27 +4762,27 @@ function eo(t) {
4742
4762
  s,
4743
4763
  r
4744
4764
  );
4745
- }, o = (c, h) => {
4765
+ }, o = (d, h) => {
4746
4766
  var y, x, m, b, R, I, w, T;
4747
- return c !== null && ((y = c.documentRect) == null ? void 0 : y.minX) === ((x = h.documentRect) == null ? void 0 : x.minX) && ((m = c.documentRect) == null ? void 0 : m.minY) === ((b = h.documentRect) == null ? void 0 : b.minY) && ((R = c.documentRect) == null ? void 0 : R.maxX) === ((I = h.documentRect) == null ? void 0 : I.maxX) && ((w = c.documentRect) == null ? void 0 : w.maxY) === ((T = h.documentRect) == null ? void 0 : T.maxY) && c.viewportWidthPx === h.viewportWidthPx && c.viewportHeightPx === h.viewportHeightPx && c.devicePixelRatio === h.devicePixelRatio && c.worldUnitsPerPixel === h.worldUnitsPerPixel && c.viewMode === h.viewMode && c.quality === h.quality;
4748
- }, l = (c) => {
4767
+ return d !== null && ((y = d.documentRect) == null ? void 0 : y.minX) === ((x = h.documentRect) == null ? void 0 : x.minX) && ((m = d.documentRect) == null ? void 0 : m.minY) === ((b = h.documentRect) == null ? void 0 : b.minY) && ((R = d.documentRect) == null ? void 0 : R.maxX) === ((I = h.documentRect) == null ? void 0 : I.maxX) && ((w = d.documentRect) == null ? void 0 : w.maxY) === ((T = h.documentRect) == null ? void 0 : T.maxY) && d.viewportWidthPx === h.viewportWidthPx && d.viewportHeightPx === h.viewportHeightPx && d.devicePixelRatio === h.devicePixelRatio && d.worldUnitsPerPixel === h.worldUnitsPerPixel && d.viewMode === h.viewMode && d.quality === h.quality;
4768
+ }, l = (d) => {
4749
4769
  var y;
4750
4770
  let h = !1;
4751
- for (const x of c) {
4771
+ for (const x of d) {
4752
4772
  const m = Wa(x.insertId);
4753
4773
  m !== null && (x.visible ? s.delete(m) && (h = !0) : s.has(m) || (s.add(m), h = !0));
4754
4774
  }
4755
4775
  h && (r += 1, i.invalidateInsertPresenterQueryCache(), a(), t.onInsertVisibilityChange(), (y = i._notifyStructureChange) == null || y.call(i));
4756
- }, d = (c, h) => {
4776
+ }, c = (d, h) => {
4757
4777
  if (!h) return null;
4758
4778
  const y = i.getLayers();
4759
- return y.length === 0 || y.some((m) => typeof c.layerVisible == "function" ? c.layerVisible(m.index) : c.layerVisible ? c.layerVisible.get(m.index) ?? m.visible : m.visible) ? h : null;
4760
- }, u = (c) => {
4779
+ return y.length === 0 || y.some((m) => typeof d.layerVisible == "function" ? d.layerVisible(m.index) : d.layerVisible ? d.layerVisible.get(m.index) ?? m.visible : m.visible) ? h : null;
4780
+ }, u = (d) => {
4761
4781
  var x;
4762
4782
  const h = new Map(i.getLayers().map((m) => [m.index, m.visible]));
4763
4783
  let y = null;
4764
4784
  for (const m of i.getGeometryChunkStats())
4765
- !(typeof c.layerVisible == "function" ? c.layerVisible(m.layerIndex) : ((x = c.layerVisible) == null ? void 0 : x.get(m.layerIndex)) ?? h.get(m.layerIndex) ?? !0) || !m.bbox || (y = Un(y, He([
4785
+ !(typeof d.layerVisible == "function" ? d.layerVisible(m.layerIndex) : ((x = d.layerVisible) == null ? void 0 : x.get(m.layerIndex)) ?? h.get(m.layerIndex) ?? !0) || !m.bbox || (y = Nn(y, He([
4766
4786
  m.bbox.minX,
4767
4787
  m.bbox.minY,
4768
4788
  m.bbox.maxX,
@@ -4777,41 +4797,44 @@ function eo(t) {
4777
4797
  get contentRevision() {
4778
4798
  return n;
4779
4799
  },
4780
- getAuthoritativeBounds(c) {
4781
- return d(
4782
- c,
4783
- Un(t.getHeaderBounds(), He(i.getBounds()))
4800
+ getAuthoritativeBounds(d) {
4801
+ return c(
4802
+ d,
4803
+ Nn(t.getHeaderBounds(), He(i.getBounds()))
4784
4804
  );
4785
4805
  },
4786
- getMountedBounds(c) {
4787
- return u(c) ?? d(c, He(i.getBounds()));
4806
+ getMountedBounds(d) {
4807
+ return u(d) ?? c(d, He(i.getBounds()));
4788
4808
  },
4789
- getUnmountedExternalBounds(c) {
4790
- return c.includeUnmountedExternal === !1 ? null : d(c, t.getUnmountedBounds());
4809
+ getUnmountedExternalBounds(d) {
4810
+ return d.includeUnmountedExternal === !1 ? null : c(d, t.getUnmountedBounds());
4791
4811
  },
4792
- appendContent(c) {
4812
+ appendContent(d) {
4793
4813
  return n += 1, a(), !0;
4794
4814
  },
4795
- setDisplayContext(c) {
4796
- o(e, c) || (e = c, i.setViewportSize(c.viewportWidthPx, c.viewportHeightPx), c.quality === "auto" ? i.setInteractionRenderQualityOverride(null) : i.setInteractionRenderQualityOverride(c.quality), i.updateAutoQualityContext({
4815
+ setDisplayContext(d) {
4816
+ o(e, d) || (e = d, i.setViewportSize(d.viewportWidthPx, d.viewportHeightPx), d.quality === "auto" ? i.setInteractionRenderQualityOverride(null) : i.setInteractionRenderQualityOverride(d.quality), i.updateAutoQualityContext({
4797
4817
  visibleVertexCount: i.getMeta().lineCount + i.getMeta().fillCount + i.getMeta().dotCount,
4798
- zoom: c.worldUnitsPerPixel
4818
+ zoom: d.worldUnitsPerPixel
4799
4819
  }), a());
4800
4820
  },
4801
- setLayerVisible(c, h) {
4802
- i.setLayerVisible(c, h), a();
4821
+ setLayerVisible(d, h) {
4822
+ i.setLayerVisible(d, h), a();
4823
+ },
4824
+ setLayerVisibleBatch(d) {
4825
+ i.setLayerVisibleBatch(d) > 0 && a();
4803
4826
  },
4804
- setLayerColorOverride(c, h) {
4805
- i.setLayerColor(c, h);
4827
+ setLayerColorOverride(d, h) {
4828
+ i.setLayerColor(d, h);
4806
4829
  },
4807
- setInsertVisible(c, h) {
4808
- l([{ insertId: c, visible: h }]);
4830
+ setInsertVisible(d, h) {
4831
+ l([{ insertId: d, visible: h }]);
4809
4832
  },
4810
- setInsertVisibleBatch(c) {
4811
- l(c);
4833
+ setInsertVisibleBatch(d) {
4834
+ l(d);
4812
4835
  },
4813
- createInsertPreview(c) {
4814
- const h = i.createInsertPreviewResource(c);
4836
+ createInsertPreview(d) {
4837
+ const h = i.createInsertPreviewResource(d);
4815
4838
  return h ? {
4816
4839
  object: h.object,
4817
4840
  bounds: {
@@ -4827,58 +4850,58 @@ function eo(t) {
4827
4850
  } : null;
4828
4851
  },
4829
4852
  getDiagnostics() {
4830
- const c = i.getMeta(), h = Xa(i), y = ja(i), x = Ja(i);
4853
+ const d = i.getMeta(), h = Xa(i), y = ja(i), x = Ja(i);
4831
4854
  return {
4832
- entityCount: c.entityCount,
4833
- lineCount: c.lineCount,
4834
- fillCount: c.fillCount,
4835
- dotCount: c.dotCount,
4836
- textCount: c.textCount,
4855
+ entityCount: d.entityCount,
4856
+ lineCount: d.lineCount,
4857
+ fillCount: d.fillCount,
4858
+ dotCount: d.dotCount,
4859
+ textCount: d.textCount,
4837
4860
  lineRenderMode: i.getLineRenderMode(),
4838
4861
  ...h,
4839
4862
  ...y,
4840
4863
  ...x
4841
4864
  };
4842
4865
  },
4843
- onChange(c) {
4844
- return i.onChange(() => c());
4866
+ onChange(d) {
4867
+ return i.onChange(() => d());
4845
4868
  },
4846
4869
  dispose() {
4847
4870
  i.dispose();
4848
4871
  }
4849
4872
  };
4850
4873
  }
4851
- const to = 450, Lr = 250, no = 0.25;
4852
- function Nn(t) {
4853
- return !t.manifestBBox || !t.viewport || !Number.isFinite(t.worldUnitsPerPixel) || t.worldUnitsPerPixel <= 0 || t.worldUnitsPerPixel > Lr ? !1 : Kn(
4874
+ const to = 450, Mr = 250, no = 0.25;
4875
+ function zn(t) {
4876
+ return !t.manifestBBox || !t.viewport || !Number.isFinite(t.worldUnitsPerPixel) || t.worldUnitsPerPixel <= 0 || t.worldUnitsPerPixel > Mr ? !1 : Wn(
4854
4877
  Je(t.viewport, no),
4855
4878
  t.manifestBBox
4856
4879
  );
4857
4880
  }
4858
- function zn(t) {
4881
+ function Hn(t) {
4859
4882
  const n = t == null ? void 0 : t.bbox;
4860
4883
  return n ? { minX: n[0], minY: n[1], maxX: n[2], maxY: n[3] } : null;
4861
4884
  }
4862
4885
  function Ct(t) {
4863
4886
  return "annotation" in t && (t.annotation.line_count > 0 || t.annotation.fill_count > 0 || t.annotation.dot_count > 0 || t.annotation.text_count > 0);
4864
4887
  }
4865
- function Hn(t) {
4866
- return Number.isFinite(t) && t > 0 && t <= Lr;
4888
+ function qn(t) {
4889
+ return Number.isFinite(t) && t > 0 && t <= Mr;
4867
4890
  }
4868
4891
  function ro(t) {
4869
4892
  const n = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Set();
4870
4893
  let r = !1;
4871
4894
  return {
4872
4895
  resolveTextFont: (s) => {
4873
- var c;
4874
- const a = ur(s), o = t.fontResolver;
4896
+ var d;
4897
+ const a = hr(s), o = t.fontResolver;
4875
4898
  if (!o || r) return a;
4876
- const l = { family: void 0 }, d = "";
4877
- if (e.has(d)) return a;
4878
- let u = n.get(d);
4899
+ const l = { family: void 0 }, c = "";
4900
+ if (e.has(c)) return a;
4901
+ let u = n.get(c);
4879
4902
  return u || (u = { promise: o.resolve(l, t.signal).then((y) => (u && (u.resolved = y), y != null && y.fontUrl && ao(y.fontUrl, a.text, t.signal).catch((x) => {
4880
4903
  t.onNonFatalError(x instanceof Error ? x : new Error(String(x)));
4881
- }), y)).catch((y) => (e.add(d), t.onNonFatalError(y instanceof Error ? y : new Error(String(y))), null)), resolved: null }, n.set(d, u)), (c = u.resolved) != null && c.fontUrl ? { ...a, fontUrl: u.resolved.fontUrl, kind: u.resolved.family } : a;
4904
+ }), y)).catch((y) => (e.add(c), t.onNonFatalError(y instanceof Error ? y : new Error(String(y))), null)), resolved: null }, n.set(c, u)), (d = u.resolved) != null && d.fontUrl ? { ...a, fontUrl: u.resolved.fontUrl, kind: u.resolved.family } : a;
4882
4905
  },
4883
4906
  dispose() {
4884
4907
  r = !0, n.clear();
@@ -4901,7 +4924,7 @@ function ao(t, n, e) {
4901
4924
  const l = We({ font: t, characters: n }, () => a(r));
4902
4925
  so(l) && l.then(
4903
4926
  () => a(r),
4904
- (d) => a(() => i(d instanceof Error ? d : new Error(String(d))))
4927
+ (c) => a(() => i(c instanceof Error ? c : new Error(String(c))))
4905
4928
  );
4906
4929
  } catch (l) {
4907
4930
  a(() => i(l instanceof Error ? l : new Error(String(l))));
@@ -4924,7 +4947,7 @@ function yo() {
4924
4947
  function mo(t) {
4925
4948
  var R, I, w, T;
4926
4949
  const n = ((R = t.options) == null ? void 0 : R.idleDelayMs) ?? oo, e = ((I = t.options) == null ? void 0 : I.maxUniqueCharsPerFont) ?? lo, r = ((w = t.options) == null ? void 0 : w.timeoutMs) ?? co, i = ((T = t.options) == null ? void 0 : T.signatureCacheLimit) ?? uo, s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
4927
- let l = null, d = !1;
4950
+ let l = null, c = !1;
4928
4951
  const u = {
4929
4952
  scheduledTexts: 0,
4930
4953
  preloadCalls: 0,
@@ -4933,23 +4956,23 @@ function mo(t) {
4933
4956
  timedOutWarmups: 0,
4934
4957
  evictedSignatures: 0
4935
4958
  };
4936
- function c(A) {
4937
- for (a.add(A); a.size > i; ) {
4938
- const B = a.values().next().value;
4939
- if (B === void 0) break;
4940
- a.delete(B), u.evictedSignatures += 1;
4959
+ function d(B) {
4960
+ for (a.add(B); a.size > i; ) {
4961
+ const A = a.values().next().value;
4962
+ if (A === void 0) break;
4963
+ a.delete(A), u.evictedSignatures += 1;
4941
4964
  }
4942
4965
  }
4943
- function h(A, B) {
4966
+ function h(B, A) {
4944
4967
  return new Promise((E, S) => {
4945
4968
  let P = !1;
4946
4969
  const O = (M) => {
4947
4970
  P || (P = !0, globalThis.clearTimeout(K), M());
4948
4971
  }, K = globalThis.setTimeout(() => {
4949
- u.timedOutWarmups += 1, O(() => S(new Error(`Troika font warmup timed out for ${A}`)));
4972
+ u.timedOutWarmups += 1, O(() => S(new Error(`Troika font warmup timed out for ${B}`)));
4950
4973
  }, r);
4951
4974
  try {
4952
- const M = We({ font: A, characters: B }, () => O(E));
4975
+ const M = We({ font: B, characters: A }, () => O(E));
4953
4976
  fo(M) && M.then(
4954
4977
  () => O(E),
4955
4978
  (_) => O(() => S(_ instanceof Error ? _ : new Error(String(_))))
@@ -4959,17 +4982,17 @@ function mo(t) {
4959
4982
  }
4960
4983
  });
4961
4984
  }
4962
- function y(A, B) {
4963
- const E = `${A}
4964
- ${B}`;
4985
+ function y(B, A) {
4986
+ const E = `${B}
4987
+ ${A}`;
4965
4988
  if (a.has(E))
4966
4989
  return u.skippedRepeatedSignatures += 1, Promise.resolve();
4967
4990
  const S = o.get(E);
4968
4991
  if (S !== void 0)
4969
4992
  return u.skippedRepeatedSignatures += 1, S;
4970
4993
  u.preloadCalls += 1;
4971
- const P = h(A, B).then(() => {
4972
- c(E);
4994
+ const P = h(B, A).then(() => {
4995
+ d(E);
4973
4996
  }).catch(() => {
4974
4997
  u.failedWarmups += 1;
4975
4998
  }).finally(() => {
@@ -4978,17 +5001,17 @@ ${B}`;
4978
5001
  return o.set(E, P), P;
4979
5002
  }
4980
5003
  function x() {
4981
- if (l = null, d || s.size === 0) return;
4982
- const A = [...s.entries()];
5004
+ if (l = null, c || s.size === 0) return;
5005
+ const B = [...s.entries()];
4983
5006
  s.clear();
4984
- for (const [B, E] of A)
4985
- E.size !== 0 && y(B, ho([...E].join("")));
4986
- }
4987
- function m(A) {
4988
- if (!(d || A.length === 0) && yo() && !t.signal.aborted) {
4989
- u.scheduledTexts += A.length;
4990
- for (const B of A) {
4991
- const E = t.resolveTextFont(B);
5007
+ for (const [A, E] of B)
5008
+ E.size !== 0 && y(A, ho([...E].join("")));
5009
+ }
5010
+ function m(B) {
5011
+ if (!(c || B.length === 0) && yo() && !t.signal.aborted) {
5012
+ u.scheduledTexts += B.length;
5013
+ for (const A of B) {
5014
+ const E = t.resolveTextFont(A);
4992
5015
  if (!E.fontUrl) continue;
4993
5016
  const S = s.get(E.fontUrl) ?? /* @__PURE__ */ new Set();
4994
5017
  if (s.set(E.fontUrl, S), !(S.size >= e))
@@ -5001,7 +5024,7 @@ ${B}`;
5001
5024
  }
5002
5025
  }
5003
5026
  function b() {
5004
- d = !0, l !== null && (globalThis.clearTimeout(l), l = null), s.clear();
5027
+ c = !0, l !== null && (globalThis.clearTimeout(l), l = null), s.clear();
5005
5028
  }
5006
5029
  return {
5007
5030
  scheduleForTexts: m,
@@ -5015,7 +5038,7 @@ ${B}`;
5015
5038
  }
5016
5039
  };
5017
5040
  }
5018
- const Mr = 0.25, qn = 0.125;
5041
+ const Dr = 0.25, Kn = 0.125;
5019
5042
  function po(t) {
5020
5043
  const { viewport: n, worldUnitsPerPixel: e } = t;
5021
5044
  if (!n || !Number.isFinite(e) || e <= 0 || !Number.isFinite(n.minX) || !Number.isFinite(n.minY) || !Number.isFinite(n.maxX) || !Number.isFinite(n.maxY) || n.maxX <= n.minX || n.maxY <= n.minY)
@@ -5032,23 +5055,23 @@ function po(t) {
5032
5055
  function wt(t) {
5033
5056
  return Array.from(t).sort((n, e) => n - e).join(",");
5034
5057
  }
5035
- function Dr(t, n) {
5058
+ function Fr(t, n) {
5036
5059
  if (t === null || !Number.isFinite(t) || t <= 0 || !Number.isFinite(n) || n <= 0) return !1;
5037
5060
  const e = n / t;
5038
- return e >= 1 - qn && e <= 1 + qn;
5061
+ return e >= 1 - Kn && e <= 1 + Kn;
5039
5062
  }
5040
5063
  function xo(t) {
5041
- return !t.viewport || !t.coverage || !_t(t.coverage, t.viewport) || !Dr(t.coverageWorldUnitsPerPixel, t.worldUnitsPerPixel) ? !1 : t.coverageHiddenSignature === t.hiddenSignature;
5064
+ return !t.viewport || !t.coverage || !_t(t.coverage, t.viewport) || !Fr(t.coverageWorldUnitsPerPixel, t.worldUnitsPerPixel) ? !1 : t.coverageHiddenSignature === t.hiddenSignature;
5042
5065
  }
5043
5066
  function go(t) {
5044
5067
  return !t.latestViewport || !_t(
5045
- Je(t.requestedViewport, Mr),
5068
+ Je(t.requestedViewport, Dr),
5046
5069
  t.latestViewport
5047
- ) || !Dr(t.requestedWorldUnitsPerPixel, t.latestWorldUnitsPerPixel) ? !1 : t.requestedHiddenSignature === t.latestHiddenSignature;
5070
+ ) || !Fr(t.requestedWorldUnitsPerPixel, t.latestWorldUnitsPerPixel) ? !1 : t.requestedHiddenSignature === t.latestHiddenSignature;
5048
5071
  }
5049
5072
  function Oe(t, n, e) {
5050
5073
  return {
5051
- coverage: Je(t, Mr),
5074
+ coverage: Je(t, Dr),
5052
5075
  worldUnitsPerPixel: n,
5053
5076
  hiddenSignature: e
5054
5077
  };
@@ -5068,7 +5091,7 @@ const Ze = class Ze {
5068
5091
  f(this, "phase", "created");
5069
5092
  f(this, "headerReady");
5070
5093
  f(this, "initialContentReady");
5071
- f(this, "loadStartedAtMs", Ae());
5094
+ f(this, "loadStartedAtMs", Be());
5072
5095
  f(this, "loadTimingState", {
5073
5096
  startedAtMs: this.loadStartedAtMs,
5074
5097
  initialRequiredVariantCount: 0,
@@ -5137,7 +5160,7 @@ const Ze = class Ze {
5137
5160
  f(this, "handleBeforeTextAppend", (n) => {
5138
5161
  this.scheduleTextWarmup(n);
5139
5162
  });
5140
- this.sessionEpoch = Ze.nextEpoch++, this.documentKey = e.documentKey ?? null, this.filename = e.filename ?? null, this.loadAnnotations = e.loadAnnotations !== !1, this.workerUrl = e.workerUrl, this.workerFactory = e.workerFactory, this.workerAdapter = nt(this.workerFactory) ? Ni({
5163
+ this.sessionEpoch = Ze.nextEpoch++, this.documentKey = e.documentKey ?? null, this.filename = e.filename ?? null, this.loadAnnotations = e.loadAnnotations !== !1, this.workerUrl = e.workerUrl, this.workerFactory = e.workerFactory, this.workerAdapter = nt(this.workerFactory) ? zi({
5141
5164
  workerUrl: this.workerUrl,
5142
5165
  workerFactory: this.workerFactory
5143
5166
  }) : null, this.fontRuntime = ro({
@@ -5180,7 +5203,7 @@ const Ze = class Ze {
5180
5203
  markLoadTiming(n) {
5181
5204
  this.loadTimingState[n] === void 0 && (this.loadTimingState = {
5182
5205
  ...this.loadTimingState,
5183
- [n]: Ae() - this.loadStartedAtMs
5206
+ [n]: Be() - this.loadStartedAtMs
5184
5207
  }, this.emit("load-timing", { timing: this.loadTimingState }));
5185
5208
  }
5186
5209
  updateLoadTimingCounters(n) {
@@ -5255,11 +5278,11 @@ const Ze = class Ze {
5255
5278
  return n;
5256
5279
  }
5257
5280
  getBlockDetails(n) {
5258
- const e = kr(n);
5281
+ const e = Tr(n);
5259
5282
  return e ? "kind" in e ? It(this.node, e) : this.findInsertDetailsByInstanceId(e.instanceId) : null;
5260
5283
  }
5261
5284
  pickInsertAtPoint(n, e) {
5262
- const r = Ga(
5285
+ const r = Ua(
5263
5286
  this.node,
5264
5287
  { x: n.x, y: n.y },
5265
5288
  {
@@ -5274,11 +5297,11 @@ const Ze = class Ze {
5274
5297
  } : null;
5275
5298
  }
5276
5299
  pickTextAtPoint(n) {
5277
- const e = Ha(this.node, { x: n.x, y: n.y });
5300
+ const e = qa(this.node, { x: n.x, y: n.y });
5278
5301
  return e ? {
5279
5302
  documentKey: this.documentKey,
5280
5303
  id: e,
5281
- details: qa(this.node, e)
5304
+ details: Un(this.node, e)
5282
5305
  } : null;
5283
5306
  }
5284
5307
  abort(n) {
@@ -5299,17 +5322,17 @@ const Ze = class Ze {
5299
5322
  async runLoad() {
5300
5323
  const n = this.sessionEpoch;
5301
5324
  try {
5302
- const e = await jn(
5325
+ const e = await Zn(
5303
5326
  Zt(this.normalizedSource),
5304
5327
  this.sessionAbort.signal,
5305
5328
  "CAD load aborted before decoding"
5306
5329
  );
5307
5330
  if (!this.isCurrent(n)) return;
5308
- this.mainBuffer = e, this.markLoadTiming("mainBufferLoadedMs"), this.sourceFingerprint = this.documentKey ?? Io(e), this.baseUrl = this.normalizedSource ? Vr(this.normalizedSource) : null;
5309
- const r = Ma(e), i = this.toDocumentHeader(r);
5331
+ this.mainBuffer = e, this.markLoadTiming("mainBufferLoadedMs"), this.sourceFingerprint = this.documentKey ?? Io(e), this.baseUrl = this.normalizedSource ? Er(this.normalizedSource) : null;
5332
+ const r = Da(e), i = this.toDocumentHeader(r);
5310
5333
  if (this.header = i, this.headerBounds = i.bounds, this.annotationManifest = this.loadAnnotations ? Gt(e) : null, this.setPhase("header-ready"), this.markLoadTiming("headerReadyMs"), this.emit("header", { header: i }), this.setPhase("initial-loading"), this.resolveHeader(i), await Promise.resolve(), !this.isCurrent(n)) return;
5311
5334
  const s = this.latestDemand ?? this.pendingDemand, a = this.planInitialExternalVariants(s);
5312
- if (this.initialViewportDemand = s, this.beginInitialExternalVariantLoad(a.requiredVariantIds), await cr(this.node, e.slice(0), void 0, {
5335
+ if (this.initialViewportDemand = s, this.beginInitialExternalVariantLoad(a.requiredVariantIds), await ur(this.node, e.slice(0), void 0, {
5313
5336
  signal: this.sessionAbort.signal,
5314
5337
  workerUrl: this.workerUrl,
5315
5338
  workerFactory: this.workerFactory,
@@ -5369,13 +5392,13 @@ const Ze = class Ze {
5369
5392
  });
5370
5393
  }
5371
5394
  async refreshExternalSidecarsForViewport(n, e) {
5372
- var c;
5395
+ var d;
5373
5396
  const r = this.sessionEpoch, i = this.mainBuffer;
5374
5397
  if (!i || !this.baseUrl) {
5375
5398
  this.emitDemandProgress(!0);
5376
5399
  return;
5377
5400
  }
5378
- if (((c = this.latestDemand) == null ? void 0 : c.interaction) === "active") {
5401
+ if (((d = this.latestDemand) == null ? void 0 : d.interaction) === "active") {
5379
5402
  this.externalViewportQueued = !0;
5380
5403
  return;
5381
5404
  }
@@ -5422,13 +5445,13 @@ const Ze = class Ze {
5422
5445
  this.externalViewportQueued = !0, this.emitDemandProgress(!0);
5423
5446
  return;
5424
5447
  }
5425
- const d = a.filter((h) => !this.renderedRequiredVariantIds.has(h));
5426
- if (d.length === 0) {
5448
+ const c = a.filter((h) => !this.renderedRequiredVariantIds.has(h));
5449
+ if (c.length === 0) {
5427
5450
  this.lastCoverage = Oe(l.documentRect, l.worldUnitsPerPixel, e), this.emitDemandProgress(!0);
5428
5451
  return;
5429
5452
  }
5430
5453
  const u = /* @__PURE__ */ new Map();
5431
- for (const h of d) {
5454
+ for (const h of c) {
5432
5455
  const y = this.loadedSidecarBuffers.get(h);
5433
5456
  if (!y)
5434
5457
  throw this.variantCoverage.set(h, "rejected"), new Error(`External block ${h} 尚未加载。`);
@@ -5441,12 +5464,12 @@ const Ze = class Ze {
5441
5464
  workerAdapter: this.workerAdapter ?? void 0,
5442
5465
  hiddenInstanceIds: this.hiddenInstanceIds,
5443
5466
  externalVariantBuffers: u,
5444
- requiredExternalVariantIds: d,
5467
+ requiredExternalVariantIds: c,
5445
5468
  beforeTextAppend: this.handleBeforeTextAppend
5446
5469
  }), !!this.isCurrent(r)) {
5447
- for (const h of d)
5470
+ for (const h of c)
5448
5471
  this.renderedRequiredVariantIds.add(h), this.variantCoverage.set(h, "loaded");
5449
- this.bumpContent("geometry"), this.lastCoverage = Oe(l.documentRect, l.worldUnitsPerPixel, e), this.emitDemandProgress(!0), d.some((h) => {
5472
+ this.bumpContent("geometry"), this.lastCoverage = Oe(l.documentRect, l.worldUnitsPerPixel, e), this.emitDemandProgress(!0), c.some((h) => {
5450
5473
  const y = this.variantManifest.find((x) => x.id === h);
5451
5474
  return y ? Ct(y) : !1;
5452
5475
  }) && (this.blockAnnotationsLoaded = !1), this.maybeLoadVisibleAnnotations();
@@ -5476,10 +5499,10 @@ const Ze = class Ze {
5476
5499
  }
5477
5500
  shouldScheduleAnnotationLoad(n) {
5478
5501
  var i;
5479
- if (!Hn(n.worldUnitsPerPixel)) return !1;
5502
+ if (!qn(n.worldUnitsPerPixel)) return !1;
5480
5503
  const e = (i = this.annotationManifest) == null ? void 0 : i.scene;
5481
- return e && !this.sceneAnnotationsLoaded && !this.sceneAnnotationsLoading && Nn({
5482
- manifestBBox: zn(e),
5504
+ return e && !this.sceneAnnotationsLoaded && !this.sceneAnnotationsLoading && zn({
5505
+ manifestBBox: Hn(e),
5483
5506
  viewport: n.documentRect,
5484
5507
  worldUnitsPerPixel: n.worldUnitsPerPixel
5485
5508
  }) ? !0 : !!(!this.blockAnnotationsLoaded && !this.blockAnnotationsLoading && this.variantManifest.some(Ct));
@@ -5513,14 +5536,14 @@ const Ze = class Ze {
5513
5536
  async loadSceneAnnotations(n) {
5514
5537
  var r;
5515
5538
  const e = (r = this.annotationManifest) == null ? void 0 : r.scene;
5516
- if (!(!e || this.sceneAnnotationsLoaded || this.sceneAnnotationsLoading) && this.baseUrl && Nn({
5517
- manifestBBox: zn(e),
5539
+ if (!(!e || this.sceneAnnotationsLoaded || this.sceneAnnotationsLoading) && this.baseUrl && zn({
5540
+ manifestBBox: Hn(e),
5518
5541
  viewport: n.documentRect,
5519
5542
  worldUnitsPerPixel: n.worldUnitsPerPixel
5520
5543
  })) {
5521
5544
  this.sceneAnnotationsLoading = !0;
5522
5545
  try {
5523
- const i = await Er(this.baseUrl, e, this.annotationAbort.signal);
5546
+ const i = await Sr(this.baseUrl, e, this.annotationAbort.signal);
5524
5547
  if (!this.isCurrent(this.sessionEpoch) || !je(i)) {
5525
5548
  this.sceneAnnotationsLoaded = !0;
5526
5549
  return;
@@ -5532,7 +5555,7 @@ const Ze = class Ze {
5532
5555
  }
5533
5556
  }
5534
5557
  async loadBlockAnnotations(n) {
5535
- if (!(this.blockAnnotationsLoaded || this.blockAnnotationsLoading) && this.mainBuffer && this.variantManifest.some(Ct) && Hn(n.worldUnitsPerPixel)) {
5558
+ if (!(this.blockAnnotationsLoaded || this.blockAnnotationsLoading) && this.mainBuffer && this.variantManifest.some(Ct) && qn(n.worldUnitsPerPixel)) {
5536
5559
  this.blockAnnotationsLoading = !0;
5537
5560
  try {
5538
5561
  const e = Ut(this.mainBuffer, {
@@ -5552,6 +5575,9 @@ const Ze = class Ze {
5552
5575
  for (const r of n.manifest) e.set(r.id, r);
5553
5576
  this.variantManifest = Array.from(e.values());
5554
5577
  }
5578
+ getTextDetails(n) {
5579
+ return Un(this.node, n);
5580
+ }
5555
5581
  planInitialExternalVariants(n) {
5556
5582
  const e = this.mainBuffer;
5557
5583
  if (!e || !n || !this.baseUrl)
@@ -5675,17 +5701,25 @@ const Ze = class Ze {
5675
5701
  });
5676
5702
  }
5677
5703
  toDocumentHeader(n) {
5704
+ var i, s, a;
5705
+ const e = typeof ((i = n.units) == null ? void 0 : i.source) == "string" && n.units.source.trim().length > 0 ? n.units.source.trim() : null, r = ((s = n.units) == null ? void 0 : s.scaleToMeters) ?? ((a = n.units) == null ? void 0 : a.scale_to_meters);
5678
5706
  return {
5679
5707
  bounds: He(n.bounds),
5680
- layers: n.layers.map((e) => ({
5681
- index: e.index,
5682
- name: e.name,
5683
- color: e.color,
5684
- visible: e.visible ?? !0
5708
+ layers: n.layers.map((o) => ({
5709
+ index: o.index,
5710
+ name: o.name,
5711
+ color: o.color,
5712
+ visible: o.visible ?? !0
5685
5713
  })),
5686
5714
  sourceFingerprint: this.sourceFingerprint,
5687
5715
  format: "dxb3",
5688
- filename: this.filename
5716
+ filename: this.filename,
5717
+ ...e ? {
5718
+ units: {
5719
+ source: e,
5720
+ ...Number.isFinite(r) ? { scaleToMeters: r } : {}
5721
+ }
5722
+ } : {}
5689
5723
  };
5690
5724
  }
5691
5725
  findInsertDetailsByInstanceId(n) {
@@ -5756,7 +5790,7 @@ function Ko(t) {
5756
5790
  export {
5757
5791
  Co as CAD_RENDER_NODE_EDIT_METHODS,
5758
5792
  zo as CAD_SESSION_PHASES,
5759
- la as GEO_NODE_STRUCTURE_CHANGE,
5793
+ ca as GEO_NODE_STRUCTURE_CHANGE,
5760
5794
  Eo as GEO_NODE_VISUAL_CHANGE,
5761
5795
  U as GeoLoaderError,
5762
5796
  ye as GeoNode,
@@ -5774,22 +5808,22 @@ export {
5774
5808
  Fo as loadExternalVariantDeltaFromBuffer,
5775
5809
  _o as loadGeo,
5776
5810
  fe as mergeViewportRects,
5777
- Da as normalizeGeoError,
5811
+ Fa as normalizeGeoError,
5778
5812
  ko as parseBuffer,
5779
5813
  To as parseBufferBounds,
5780
- Ma as parseBufferHeader,
5781
- kr as parseCadInsertId,
5782
- Ga as pickCadInsertAtPoint,
5783
- Ha as pickCadTextAtPoint,
5814
+ Da as parseBufferHeader,
5815
+ Tr as parseCadInsertId,
5816
+ Ua as pickCadInsertAtPoint,
5817
+ qa as pickCadTextAtPoint,
5784
5818
  Yo as readBlockAnnotationSidecar,
5785
5819
  Mo as readBufferExternalAnnotationManifest,
5786
5820
  Do as readBufferExternalBlockAnnotations,
5787
5821
  Lo as readBufferExternalVariantDependencyPlan,
5788
5822
  Po as readBufferExternalVariantManifest,
5789
- Wr as readSceneAnnotationSidecar,
5823
+ Xr as readSceneAnnotationSidecar,
5790
5824
  It as resolveCadInsertDetails,
5791
- qa as resolveCadTextDetails,
5792
- Nr as transformBBoxByInstance,
5825
+ Un as resolveCadTextDetails,
5826
+ zr as transformBBoxByInstance,
5793
5827
  _t as viewportRectContains,
5794
- Kn as viewportRectIntersects
5828
+ Wn as viewportRectIntersects
5795
5829
  };