@niccolofanton/corkboard 0.2.0 → 0.2.1

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.
@@ -1,13 +1,13 @@
1
- import { p as ji, P as Qi, n as ai, d as Zi, C as $, e as Ji, w as tn, f as en, b as li, M as hi, g as Ve, h as sn, D as Ke, a as De } from "./chunk-values-D2mwqJ9D.js";
2
- import { Container as yt, Graphics as be, TextStyle as nn, Text as rn, ImageSource as on, Texture as it, Rectangle as an, TextureSource as ln, Sprite as hn, Ticker as je, Application as cn, RendererType as dn, TilingSprite as un } from "pixi.js";
3
- import fn from "rbush";
4
- const U = Math.PI / 180, ci = () => ({
1
+ import { p as Qi, P as Zi, n as li, d as Ji, C as $, e as tn, w as en, f as sn, b as hi, M as ci, g as Ke, h as nn, D as je, a as Fe } from "./chunk-values-D2mwqJ9D.js";
2
+ import { Container as yt, Graphics as xe, TextStyle as rn, Text as on, ImageSource as an, Texture as it, Rectangle as ln, TextureSource as hn, Sprite as cn, Ticker as Qe, Application as dn, RendererType as un, TilingSprite as fn } from "pixi.js";
3
+ import pn from "rbush";
4
+ const U = Math.PI / 180, di = () => ({
5
5
  minX: 1 / 0,
6
6
  minY: 1 / 0,
7
7
  maxX: -1 / 0,
8
8
  maxY: -1 / 0
9
9
  }), Qt = (n) => n.maxX - n.minX, Zt = (n) => n.maxY - n.minY, rt = (n) => (n.minX + n.maxX) / 2, ot = (n) => (n.minY + n.maxY) / 2;
10
- function xe(n, t) {
10
+ function Me(n, t) {
11
11
  return {
12
12
  minX: Math.min(n.minX, t.minX),
13
13
  minY: Math.min(n.minY, t.minY),
@@ -15,19 +15,19 @@ function xe(n, t) {
15
15
  maxY: Math.max(n.maxY, t.maxY)
16
16
  };
17
17
  }
18
- function pn(n) {
18
+ function mn(n) {
19
19
  return { minX: n.x, minY: n.y, maxX: n.x + n.w, maxY: n.y + n.h };
20
20
  }
21
21
  function K(n) {
22
22
  return { x: n.x, y: n.y, w: n.w, h: n.h, rot: n.rot };
23
23
  }
24
- function mn(n, t, e) {
24
+ function gn(n, t, e) {
25
25
  if (e === 0) return { w: n, h: t };
26
26
  const s = e * U, i = Math.abs(Math.cos(s)), r = Math.abs(Math.sin(s));
27
27
  return { w: n * i + t * r, h: n * r + t * i };
28
28
  }
29
29
  function q(n) {
30
- const t = K(n), e = t.x + t.w / 2, s = t.y + t.h / 2, i = mn(t.w, t.h, t.rot);
30
+ const t = K(n), e = t.x + t.w / 2, s = t.y + t.h / 2, i = gn(t.w, t.h, t.rot);
31
31
  return { minX: e - i.w / 2, minY: s - i.h / 2, maxX: e + i.w / 2, maxY: s + i.h / 2 };
32
32
  }
33
33
  function Yt(n) {
@@ -41,19 +41,19 @@ function Yt(n) {
41
41
  l.push(t + h * o - c * a, e + h * a + c * o);
42
42
  return l;
43
43
  }
44
- function di(n, t, e) {
44
+ function ui(n, t, e) {
45
45
  const s = n.x + n.w / 2, i = n.y + n.h / 2, r = -n.rot * U, o = Math.cos(r), a = Math.sin(r), l = t - s, h = e - i;
46
46
  return { x: l * o - h * a + n.w / 2, y: l * a + h * o + n.h / 2 };
47
47
  }
48
- function ui(n, t, e) {
48
+ function fi(n, t, e) {
49
49
  const s = n.x + n.w / 2, i = n.y + n.h / 2, r = n.rot * U, o = Math.cos(r), a = Math.sin(r), l = t - n.w / 2, h = e - n.h / 2;
50
50
  return { x: s + l * o - h * a, y: i + l * a + h * o };
51
51
  }
52
- function gn(n, t, e, s = 0) {
53
- const i = di(n, t, e);
52
+ function yn(n, t, e, s = 0) {
53
+ const i = ui(n, t, e);
54
54
  return i.x >= -s && i.y >= -s && i.x <= n.w + s && i.y <= n.h + s;
55
55
  }
56
- function yn(n, t) {
56
+ function wn(n, t) {
57
57
  const e = Yt(n), s = Yt(t), i = [];
58
58
  for (const r of [e, s])
59
59
  for (let o = 0; o < 2; o++) {
@@ -70,13 +70,13 @@ function yn(n, t) {
70
70
  }
71
71
  return !0;
72
72
  }
73
- function wn(n, t) {
74
- return yn(
73
+ function vn(n, t) {
74
+ return wn(
75
75
  { x: n.minX, y: n.minY, w: n.maxX - n.minX, h: n.maxY - n.minY, rot: 0 },
76
76
  t
77
77
  );
78
78
  }
79
- function vn(n, t) {
79
+ function bn(n, t) {
80
80
  const e = Yt(n);
81
81
  for (let s = 0; s < 4; s++) {
82
82
  const i = e[s * 2], r = e[s * 2 + 1];
@@ -84,8 +84,8 @@ function vn(n, t) {
84
84
  }
85
85
  return !0;
86
86
  }
87
- const bn = 1e3, xn = 40, Mn = 55, Me = 2, Qe = 60, kn = 2500, Sn = 4, Tn = 2, An = 1e4;
88
- class En {
87
+ const xn = 1e3, Mn = 40, kn = 55, ke = 2, Ze = 60, Sn = 2500, Tn = 4, An = 2, En = 1e4;
88
+ class Pn {
89
89
  rafFn;
90
90
  cafFn;
91
91
  doc;
@@ -106,7 +106,7 @@ class En {
106
106
  cleanups = [];
107
107
  constructor(t = {}) {
108
108
  const e = t.doc ?? (typeof document < "u" ? document : void 0), s = e?.defaultView ?? (typeof window < "u" ? window : void 0);
109
- if (this.doc = e, this.rafFn = t.raf ?? (s ? (i) => s.requestAnimationFrame(i) : void 0), this.cafFn = t.caf ?? (s ? (i) => s.cancelAnimationFrame(i) : void 0), this.burstWindows = t.burstWindows ?? Sn, this.agreeWindows = t.agreeWindows ?? Tn, this.heartbeatMs = t.heartbeatMs ?? An, e) {
109
+ if (this.doc = e, this.rafFn = t.raf ?? (s ? (i) => s.requestAnimationFrame(i) : void 0), this.cafFn = t.caf ?? (s ? (i) => s.cancelAnimationFrame(i) : void 0), this.burstWindows = t.burstWindows ?? Tn, this.agreeWindows = t.agreeWindows ?? An, this.heartbeatMs = t.heartbeatMs ?? En, e) {
110
110
  const i = () => this.poke();
111
111
  e.addEventListener("visibilitychange", i), this.cleanups.push(() => e.removeEventListener("visibilitychange", i));
112
112
  }
@@ -181,11 +181,11 @@ class En {
181
181
  for (const r of [...this.startFns]) r();
182
182
  const i = (r) => {
183
183
  if (this.run === s) {
184
- if (Number.isNaN(s.start) || r - s.last > kn)
184
+ if (Number.isNaN(s.start) || r - s.last > Sn)
185
185
  Number.isNaN(s.start) || (s.discard = !0), s.start = r, s.frames = 0, s.deltas.length = 0;
186
- else if (s.frames++, s.deltas.push(r - s.last), r - s.start >= bn) {
186
+ else if (s.frames++, s.deltas.push(r - s.last), r - s.start >= xn) {
187
187
  const o = s.frames * 1e3 / (r - s.start), a = s.discard;
188
- s.start = r, s.frames = 0, s.discard = !1, this.peakFps = Math.max(this.peakFps, o, Pn(s.deltas)), s.deltas.length = 0, a || this.window(o);
188
+ s.start = r, s.frames = 0, s.discard = !1, this.peakFps = Math.max(this.peakFps, o, Ln(s.deltas)), s.deltas.length = 0, a || this.window(o);
189
189
  }
190
190
  s.last = r, this.run === s && (s.id = e(i));
191
191
  }
@@ -197,26 +197,26 @@ class En {
197
197
  t && (this.run = null, this.cafFn?.(t.id));
198
198
  }
199
199
  window(t) {
200
- const e = Math.min(1, (this.peakFps > 0 ? this.peakFps : Qe) / Qe), s = { fps: t, slow: t < xn * e, smooth: t > Mn * e }, i = s.slow ? "slow" : s.smooth ? "smooth" : "mid";
200
+ const e = Math.min(1, (this.peakFps > 0 ? this.peakFps : Ze) / Ze), s = { fps: t, slow: t < Mn * e, smooth: t > kn * e }, i = s.slow ? "slow" : s.smooth ? "smooth" : "mid";
201
201
  this.counted++, this.streak = i === this.verdict ? this.streak + 1 : 1, this.verdict = i;
202
202
  for (const r of [...this.windowFns]) r(s);
203
203
  this.run && (this.counted >= this.burstWindows || this.streak >= this.agreeWindows) && this.stop();
204
204
  }
205
205
  }
206
- function Pn(n) {
206
+ function Ln(n) {
207
207
  if (n.length < 10) return 0;
208
208
  const t = [...n].sort((e, s) => e - s)[Math.floor(n.length * 0.1)];
209
209
  return t > 0 ? Math.min(240, 1e3 / t) : 0;
210
210
  }
211
- const bt = (n) => Math.round(n * 1e3) / 1e3, Ze = (n) => Math.round(n * 1e6) / 1e6;
212
- function fi(n, t) {
211
+ const bt = (n) => Math.round(n * 1e3) / 1e3, Je = (n) => Math.round(n * 1e6) / 1e6;
212
+ function pi(n, t) {
213
213
  const e = n.rot ?? 0, s = n.x + n.w / 2, i = n.y + n.h / 2;
214
214
  let r = n.x, o = n.y;
215
215
  if (e !== 0) {
216
216
  const d = e * U, u = Math.cos(d), f = Math.sin(d), m = n.x - s, p = n.y - i;
217
217
  r = s + m * u - p * f, o = i + m * f + p * u;
218
218
  }
219
- const a = bt(t.tx + r * t.scale), l = bt(t.ty + o * t.scale), h = Ze(t.scale), c = Ze(e);
219
+ const a = bt(t.tx + r * t.scale), l = bt(t.ty + o * t.scale), h = Je(t.scale), c = Je(e);
220
220
  return {
221
221
  x: a,
222
222
  y: l,
@@ -227,13 +227,13 @@ function fi(n, t) {
227
227
  transform: `translate(${a}px, ${l}px) scale(${h})` + (c === 0 ? "" : ` rotate(${c}deg)`)
228
228
  };
229
229
  }
230
- const Ln = 4096, pi = "720p";
231
- function In(n) {
230
+ const In = 4096, mi = "720p";
231
+ function Rn(n) {
232
232
  return n === "native" ? null : n === "720p" ? 720 : n === "1080p" ? 1080 : Number.isFinite(n) && n > 0 ? n : 720;
233
233
  }
234
- const xt = (n) => Math.round(n * 1e3) / 1e3, Rn = (n) => Math.round(n * 1e6) / 1e6;
235
- function Je(n, t, e = pi) {
236
- const s = fi(n, t), i = In(e), r = i === null ? 1 : i / Math.max(Math.min(n.w, n.h), 1), o = Math.min(r, Ln / Math.max(n.w, n.h, 1)), a = Rn(t.scale / o), l = (n.rot ?? 0) * Math.PI / 180, h = xt(s.x + n.w * t.scale * Math.cos(l)), c = xt(s.y + n.w * t.scale * Math.sin(l));
234
+ const xt = (n) => Math.round(n * 1e3) / 1e3, Cn = (n) => Math.round(n * 1e6) / 1e6;
235
+ function ts(n, t, e = mi) {
236
+ const s = pi(n, t), i = Rn(e), r = i === null ? 1 : i / Math.max(Math.min(n.w, n.h), 1), o = Math.min(r, In / Math.max(n.w, n.h, 1)), a = Cn(t.scale / o), l = (n.rot ?? 0) * Math.PI / 180, h = xt(s.x + n.w * t.scale * Math.cos(l)), c = xt(s.y + n.w * t.scale * Math.sin(l));
237
237
  return {
238
238
  width: xt(n.w * o),
239
239
  height: xt(n.h * o),
@@ -246,17 +246,17 @@ function Je(n, t, e = pi) {
246
246
  transform: `translate(${s.x}px, ${s.y}px) scale(${a})` + (s.rot === 0 ? "" : ` rotate(${s.rot}deg)`)
247
247
  };
248
248
  }
249
- const Cn = 12, _n = 3, On = 24, Nn = 6, Dn = 64, Fn = 12, mi = 320, gi = 200, Fe = 0.25, Bn = 0.6;
250
- function Xn(n, t, e) {
251
- if (!n.frameable || !n.onScreen || n.screenW < 0 || n.screenH < 0 || t < (e.minScale ?? Fe)) return !1;
249
+ const _n = 12, On = 3, Nn = 24, Dn = 6, Fn = 64, Bn = 12, gi = 320, yi = 200, Be = 0.25, Xn = 0.6;
250
+ function qn(n, t, e) {
251
+ if (!n.frameable || !n.onScreen || n.screenW < 0 || n.screenH < 0 || t < (e.minScale ?? Be)) return !1;
252
252
  if (n.interacting || n.selected) return !0;
253
- const s = n.live ? Bn : 1;
254
- return n.screenW >= (e.minW ?? mi) * s && n.screenH >= (e.minH ?? gi) * s;
253
+ const s = n.live ? Xn : 1;
254
+ return n.screenW >= (e.minW ?? gi) * s && n.screenH >= (e.minH ?? yi) * s;
255
255
  }
256
- function qn(n) {
256
+ function Un(n) {
257
257
  const t = { mount: [], destroy: [], parked: [], culled: [] };
258
258
  if (n.cameraMoving) return t;
259
- const e = Math.max(0, Math.floor(n.max)), s = Math.max(0, Math.floor(n.maxMounted ?? e * 3)), i = n.cards.filter((m) => Xn(m, n.scale, n));
259
+ const e = Math.max(0, Math.floor(n.max)), s = Math.max(0, Math.floor(n.maxMounted ?? e * 3)), i = n.cards.filter((m) => qn(m, n.scale, n));
260
260
  i.sort(
261
261
  (m, p) => Number(p.interacting) - Number(m.interacting) || Number(p.selected) - Number(m.selected) || Number(p.live) - Number(m.live) || p.lastUsed - m.lastUsed || p.screenW * p.screenH - m.screenW * m.screenH || (m.id < p.id ? -1 : 1)
262
262
  );
@@ -273,8 +273,8 @@ function qn(n) {
273
273
  r.has(m.id) ? m.live || t.mount.push(m.id) : f.has(m.id) ? (t.parked.push(m.id), u.has(m.id) && t.culled.push(m.id)) : m.live && t.destroy.push(m.id);
274
274
  return t;
275
275
  }
276
- const Un = 160;
277
- async function Yn(n, t = 8e3) {
276
+ const Yn = 160;
277
+ async function zn(n, t = 8e3) {
278
278
  const e = new AbortController(), s = setTimeout(() => e.abort(), t);
279
279
  try {
280
280
  const i = await fetch(n, { mode: "cors", credentials: "omit", signal: e.signal });
@@ -282,7 +282,7 @@ async function Yn(n, t = 8e3) {
282
282
  const r = await i.blob();
283
283
  if (!r.type.startsWith("image/")) return null;
284
284
  if (typeof createImageBitmap == "function") {
285
- const o = await createImageBitmap(r), a = o.width >= Un;
285
+ const o = await createImageBitmap(r), a = o.width >= Yn;
286
286
  if (o.close(), !a) return null;
287
287
  }
288
288
  return URL.createObjectURL(r);
@@ -292,7 +292,7 @@ async function Yn(n, t = 8e3) {
292
292
  clearTimeout(s);
293
293
  }
294
294
  }
295
- function zn(n) {
295
+ function Wn(n) {
296
296
  if (n.html !== void 0)
297
297
  return {
298
298
  kind: "html",
@@ -305,13 +305,13 @@ function zn(n) {
305
305
  frameable: !0,
306
306
  posters: []
307
307
  };
308
- const t = ji(n.url ?? "");
308
+ const t = Qi(n.url ?? "");
309
309
  return t ? {
310
310
  kind: "url",
311
311
  provider: t.provider,
312
312
  url: t.url,
313
313
  host: t.host,
314
- label: t.provider === "generic" ? t.host : Qi[t.provider],
314
+ label: t.provider === "generic" ? t.host : Zi[t.provider],
315
315
  title: n.title,
316
316
  iframeSrc: t.iframeSrc,
317
317
  frameable: !0,
@@ -329,17 +329,17 @@ function zn(n) {
329
329
  posters: []
330
330
  };
331
331
  }
332
- const Wn = (n) => typeof n == "number" && Number.isFinite(n) && n > 0;
333
- function Hn(n, t) {
332
+ const Hn = (n) => typeof n == "number" && Number.isFinite(n) && n > 0;
333
+ function $n(n, t) {
334
334
  if (!t || n.kind === "html") return n;
335
335
  const e = { ...n };
336
- if (typeof t.title == "string" && t.title !== "" && (e.title = n.title ?? t.title), Wn(t.aspect) && (e.aspect = t.aspect), typeof t.iframeSrc == "string" && e.iframeSrc !== null) {
337
- const s = ai(t.iframeSrc);
336
+ if (typeof t.title == "string" && t.title !== "" && (e.title = n.title ?? t.title), Hn(t.aspect) && (e.aspect = t.aspect), typeof t.iframeSrc == "string" && e.iframeSrc !== null) {
337
+ const s = li(t.iframeSrc);
338
338
  s !== null && (e.iframeSrc = s);
339
339
  }
340
340
  return t.frameable === !1 && (e.frameable = !1), typeof t.poster == "string" && t.poster !== "" && (e.posters = [t.poster, ...n.posters.filter((s) => s !== t.poster)]), e;
341
341
  }
342
- const $n = (n) => n.frameable && (n.kind === "html" || n.iframeSrc !== null), Gn = (n, t) => n.url === t.url && n.html === t.html, ct = "corkboard-embed", ts = 640, Vn = 4e3, Kn = `(function () {
342
+ const Gn = (n) => n.frameable && (n.kind === "html" || n.iframeSrc !== null), Vn = (n, t) => n.url === t.url && n.html === t.html, ct = "corkboard-embed", es = 640, Kn = 4e3, jn = `(function () {
343
343
  var CB = '${ct}';
344
344
  var raf = requestAnimationFrame.bind(window), caf = cancelAnimationFrame.bind(window);
345
345
  var paused = false, n = 0, pend = {}, hand = {}, stopped = [];
@@ -494,9 +494,9 @@ addEventListener('message', function (e) {
494
494
  parent.postMessage({ cb: CB, op: 'snapshot', id: d.id, ok: !!svg, svg: svg || undefined }, e.origin === 'null' ? '*' : e.origin);
495
495
  }
496
496
  });
497
- })();`, jn = Kn.replace(/^[ \t]*\/\/.*\n/gm, "").replace(/^[ \t]+/gm, "").replace(/\n{2,}/g, `
498
- `), zt = "corkboard-previews-v2", ke = "corkboard-previews-v1", Qn = 400, te = 1e3;
499
- function Zn(n) {
497
+ })();`, Qn = jn.replace(/^[ \t]*\/\/.*\n/gm, "").replace(/^[ \t]+/gm, "").replace(/\n{2,}/g, `
498
+ `), zt = "corkboard-previews-v2", Se = "corkboard-previews-v1", Zn = 400, te = 1e3;
499
+ function Jn(n) {
500
500
  let t = 2166136261, e = -1623754710;
501
501
  for (let s = 0; s < n.length; s++) {
502
502
  const i = n.charCodeAt(s);
@@ -504,13 +504,13 @@ function Zn(n) {
504
504
  }
505
505
  return (t >>> 0).toString(16).padStart(8, "0") + (e >>> 0).toString(16).padStart(8, "0");
506
506
  }
507
- function yi(n, t, e, s, i) {
507
+ function wi(n, t, e, s, i) {
508
508
  return `${e}|${t}|${s}x${i}|${n}`;
509
509
  }
510
- function Jn(n, t, e, s, i) {
511
- return Zn(yi(n, t, e, s, i));
510
+ function tr(n, t, e, s, i) {
511
+ return Jn(wi(n, t, e, s, i));
512
512
  }
513
- async function es(n) {
513
+ async function ss(n) {
514
514
  try {
515
515
  const t = typeof crypto > "u" ? void 0 : crypto.subtle;
516
516
  if (!t) return null;
@@ -522,17 +522,17 @@ async function es(n) {
522
522
  return null;
523
523
  }
524
524
  }
525
- const tr = () => typeof crypto < "u" && typeof crypto.subtle?.digest == "function";
526
- async function ql(n = zt) {
525
+ const er = () => typeof crypto < "u" && typeof crypto.subtle?.digest == "function";
526
+ async function Yl(n = zt) {
527
527
  if (typeof caches > "u") return;
528
- const t = n === zt ? [n, ke] : [n];
528
+ const t = n === zt ? [n, Se] : [n];
529
529
  for (const e of t)
530
530
  try {
531
531
  await caches.delete(e);
532
532
  } catch {
533
533
  }
534
534
  }
535
- class er {
535
+ class sr {
536
536
  memory = /* @__PURE__ */ new Map();
537
537
  // null: Cache Storage is not usable here (private mode, file://, no support): memory only from then on.
538
538
  cache = null;
@@ -554,7 +554,7 @@ class er {
554
554
  // Whether `getPersistent` can find anything: asked for, Cache Storage exists, and there is a SHA-256 to name
555
555
  // the entries with (an insecure context has none: memory only then).
556
556
  get persistent() {
557
- return this.wantsPersistent && typeof caches < "u" && tr();
557
+ return this.wantsPersistent && typeof caches < "u" && er();
558
558
  }
559
559
  getMemory(t) {
560
560
  const e = this.memory.get(t);
@@ -564,9 +564,9 @@ class er {
564
564
  async getPersistent(t) {
565
565
  try {
566
566
  if (!this.persistent) return null;
567
- const e = await es(t);
567
+ const e = await ss(t);
568
568
  if (e === null) return null;
569
- const i = await (await this.open())?.match(ss(e)), r = i ? await i.blob() : null;
569
+ const i = await (await this.open())?.match(is(e)), r = i ? await i.blob() : null;
570
570
  return r && r.size > 0 ? r : null;
571
571
  } catch {
572
572
  return null;
@@ -574,7 +574,7 @@ class er {
574
574
  }
575
575
  // `material`: also write it to Cache Storage, named by its SHA-256 (not when it came from there).
576
576
  put(t, e, s) {
577
- for (this.memory.delete(t), this.memory.set(t, e); this.memory.size > Qn; ) this.memory.delete(this.memory.keys().next().value);
577
+ for (this.memory.delete(t), this.memory.set(t, e); this.memory.size > Zn; ) this.memory.delete(this.memory.keys().next().value);
578
578
  s !== void 0 && this.persistent && this.putPersistent(s, e);
579
579
  }
580
580
  clear() {
@@ -582,11 +582,11 @@ class er {
582
582
  }
583
583
  async putPersistent(t, e) {
584
584
  try {
585
- const s = await es(t);
585
+ const s = await ss(t);
586
586
  if (s === null) return;
587
587
  const i = await this.open();
588
588
  if (!i) return;
589
- await i.put(ss(s), new Response(e, { headers: { "content-type": e.type || "image/webp" } })), ++this.stored > te && await this.trim(i);
589
+ await i.put(is(s), new Response(e, { headers: { "content-type": e.type || "image/webp" } })), ++this.stored > te && await this.trim(i);
590
590
  } catch {
591
591
  }
592
592
  }
@@ -594,7 +594,7 @@ class er {
594
594
  return this.cache === null && (this.cache = (async () => {
595
595
  try {
596
596
  if (typeof caches > "u") return null;
597
- this.name !== ke && Promise.resolve(caches.delete?.(ke)).catch(() => {
597
+ this.name !== Se && Promise.resolve(caches.delete?.(Se)).catch(() => {
598
598
  });
599
599
  const t = await caches.open(this.name);
600
600
  return await this.trim(t), t;
@@ -613,29 +613,29 @@ class er {
613
613
  }
614
614
  }
615
615
  }
616
- const ss = (n) => new URL(`/__corkboard_preview/${n}`, location.href).href, sr = "allow-scripts allow-same-origin allow-forms allow-popups allow-presentation", ir = "allow-scripts allow-same-origin allow-forms allow-popups", nr = "allow-scripts", rr = "default-src 'none'; img-src data: https:; style-src 'unsafe-inline'; script-src 'unsafe-inline'; font-src https: data:", or = "default-src 'none'; img-src data: blob:; style-src 'unsafe-inline'; script-src 'unsafe-inline'; font-src data:", wi = (n = "images") => n === "none" ? or : rr, is = "strict-origin-when-cross-origin", ns = "autoplay; encrypted-media; fullscreen; picture-in-picture", ar = {
617
- youtube: ns,
618
- vimeo: ns,
616
+ const is = (n) => new URL(`/__corkboard_preview/${n}`, location.href).href, ir = "allow-scripts allow-same-origin allow-forms allow-popups allow-presentation", nr = "allow-scripts allow-same-origin allow-forms allow-popups", rr = "allow-scripts", or = "default-src 'none'; img-src data: https:; style-src 'unsafe-inline'; script-src 'unsafe-inline'; font-src https: data:", ar = "default-src 'none'; img-src data: blob:; style-src 'unsafe-inline'; script-src 'unsafe-inline'; font-src data:", vi = (n = "images") => n === "none" ? ar : or, ns = "strict-origin-when-cross-origin", rs = "autoplay; encrypted-media; fullscreen; picture-in-picture", lr = {
617
+ youtube: rs,
618
+ vimeo: rs,
619
619
  // Audio: full playback needs EME, there is no picture to pop out.
620
620
  spotify: "autoplay; encrypted-media",
621
621
  codepen: "",
622
622
  figma: "",
623
623
  generic: ""
624
624
  };
625
- function lr(n, t = "images") {
626
- return `<!doctype html><meta http-equiv="Content-Security-Policy" content="${wi(t)}"><meta charset="utf-8"><script>${jn}<\/script>${n}`;
625
+ function hr(n, t = "images") {
626
+ return `<!doctype html><meta http-equiv="Content-Security-Policy" content="${vi(t)}"><meta charset="utf-8"><script>${Qn}<\/script>${n}`;
627
627
  }
628
- const hr = (n) => {
628
+ const cr = (n) => {
629
629
  try {
630
630
  return new URL(n).origin;
631
631
  } catch {
632
632
  return null;
633
633
  }
634
- }, cr = /^\d{1,3}(?:\.\d{1,3}){3}$/, dr = /^[a-z0-9_](?:[a-z0-9_.-]*[a-z0-9_])?$/, ur = /^[a-z][a-z0-9+.-]*:\/\//i, vi = (n) => cr.test(n) || n.startsWith("["), at = (n, t) => new $("invalid", `isolatedHosts: "${n}" is not a host (${t})`);
635
- function fr(n) {
634
+ }, dr = /^\d{1,3}(?:\.\d{1,3}){3}$/, ur = /^[a-z0-9_](?:[a-z0-9_.-]*[a-z0-9_])?$/, fr = /^[a-z][a-z0-9+.-]*:\/\//i, bi = (n) => dr.test(n) || n.startsWith("["), at = (n, t) => new $("invalid", `isolatedHosts: "${n}" is not a host (${t})`);
635
+ function pr(n) {
636
636
  const t = n.trim();
637
637
  let e = t;
638
- const s = ur.test(e);
638
+ const s = fr.test(e);
639
639
  if (s || (e = e.replace(/^(?:\*\.|\.+)/, "")), e === "" || e === ".") return null;
640
640
  if (!s) {
641
641
  if (e.split(":").length > 2 && !e.includes("[") && (e = `[${e}]`), /[\s/\\?#@*]/.test(e)) throw at(t, "only a host, optionally with a port");
@@ -650,20 +650,20 @@ function fr(n) {
650
650
  if (i.username !== "" || i.password !== "") throw at(t, "credentials");
651
651
  if (i.pathname !== "" && i.pathname !== "/" || i.search !== "" || i.hash !== "") throw at(t, "a path, query or fragment");
652
652
  const r = i.hostname.toLowerCase().replace(/\.$/, "");
653
- if (r === "" || !vi(r) && (!dr.test(r) || r.includes(".."))) throw at(t, "it cannot be parsed");
653
+ if (r === "" || !bi(r) && (!ur.test(r) || r.includes(".."))) throw at(t, "it cannot be parsed");
654
654
  return r;
655
655
  }
656
- function Se(n) {
656
+ function Te(n) {
657
657
  const t = [];
658
658
  for (const e of n ?? []) {
659
- const s = fr(e);
659
+ const s = pr(e);
660
660
  s !== null && t.push(s);
661
661
  }
662
662
  return t;
663
663
  }
664
- function pr(n, t) {
664
+ function mr(n, t) {
665
665
  if (!t || t.length === 0) return !1;
666
- const e = Se(t);
666
+ const e = Te(t);
667
667
  let s;
668
668
  try {
669
669
  s = new URL(n).hostname.toLowerCase().replace(/\.$/, "");
@@ -671,47 +671,47 @@ function pr(n, t) {
671
671
  return !1;
672
672
  }
673
673
  for (const i of e)
674
- if (s === i || !vi(i) && s.endsWith(`.${i}`)) return !0;
674
+ if (s === i || !bi(i) && s.endsWith(`.${i}`)) return !0;
675
675
  return !1;
676
676
  }
677
- function mr(n) {
677
+ function gr(n) {
678
678
  const { source: t } = n, e = t.title ?? (t.url !== void 0 ? "Embedded page" : "Embedded HTML");
679
679
  if (t.html !== void 0)
680
680
  return {
681
681
  profile: "snippet",
682
682
  provider: "generic",
683
- srcdoc: lr(t.html, n.snippetNetwork),
684
- sandbox: nr,
685
- csp: wi(n.snippetNetwork),
683
+ srcdoc: hr(t.html, n.snippetNetwork),
684
+ sandbox: rr,
685
+ csp: vi(n.snippetNetwork),
686
686
  allow: "",
687
- referrerPolicy: is,
687
+ referrerPolicy: ns,
688
688
  loading: "lazy",
689
689
  title: e
690
690
  };
691
- const s = ai(n.iframeSrc ?? t.url ?? "");
691
+ const s = li(n.iframeSrc ?? t.url ?? "");
692
692
  if (s === null) return null;
693
- const i = Zi(s), r = i !== "generic";
694
- let o = r ? sr : ir;
695
- !r && n.arbitrarySameOrigin === !1 && (o = o.replace(" allow-same-origin", "")), n.appOrigin !== void 0 && hr(s) === n.appOrigin && (o = o.replace(" allow-same-origin", "")), pr(s, n.isolatedHosts) && (o = o.replace(" allow-same-origin", ""));
696
- const a = ar[i];
693
+ const i = Ji(s), r = i !== "generic";
694
+ let o = r ? ir : nr;
695
+ !r && n.arbitrarySameOrigin === !1 && (o = o.replace(" allow-same-origin", "")), n.appOrigin !== void 0 && cr(s) === n.appOrigin && (o = o.replace(" allow-same-origin", "")), mr(s, n.isolatedHosts) && (o = o.replace(" allow-same-origin", ""));
696
+ const a = lr[i];
697
697
  return {
698
698
  profile: r ? "provider" : "arbitrary",
699
699
  provider: i,
700
700
  src: s,
701
701
  sandbox: o,
702
702
  allow: a,
703
- referrerPolicy: is,
703
+ referrerPolicy: ns,
704
704
  loading: "lazy",
705
705
  title: e
706
706
  };
707
707
  }
708
- function gr(n) {
708
+ function yr(n) {
709
709
  let t = 2166136261;
710
710
  for (let e = 0; e < n.length; e++)
711
711
  t ^= n.charCodeAt(e), t = Math.imul(t, 16777619);
712
712
  return (t >>> 0) % 360;
713
713
  }
714
- const yr = {
714
+ const wr = {
715
715
  youtube: "play",
716
716
  vimeo: "play",
717
717
  spotify: "music",
@@ -719,13 +719,13 @@ const yr = {
719
719
  figma: "design",
720
720
  generic: "globe"
721
721
  };
722
- function wr(n) {
723
- let t = n.kind === "html" ? null : yr[n.provider];
722
+ function vr(n) {
723
+ let t = n.kind === "html" ? null : wr[n.provider];
724
724
  (n.kind === "url" && n.iframeSrc === null || n.kind === "url" && !n.frameable && n.provider === "generic") && (t = "link-off");
725
- const e = n.title ?? (n.kind === "html" ? "HTML snippet" : n.provider === "generic" ? vr(n.url) : "");
726
- return { glyph: t, label: n.label, title: e, hue: n.kind === "html" ? null : gr(n.host) };
725
+ const e = n.title ?? (n.kind === "html" ? "HTML snippet" : n.provider === "generic" ? br(n.url) : "");
726
+ return { glyph: t, label: n.label, title: e, hue: n.kind === "html" ? null : yr(n.host) };
727
727
  }
728
- function vr(n) {
728
+ function br(n) {
729
729
  try {
730
730
  const t = new URL(n), e = decodeURIComponent(t.pathname).replace(/^\/+|\/+$/g, "");
731
731
  return e === "" ? "" : e.replace(/[_-]+/g, " ").split("/").pop() ?? "";
@@ -733,12 +733,12 @@ function vr(n) {
733
733
  return "";
734
734
  }
735
735
  }
736
- const rs = 640, br = 1024;
737
- function xr(n) {
738
- const t = Math.min(br, Math.max(120, Math.round(rs * n)));
739
- return { w: rs, h: t };
736
+ const os = 640, xr = 1024;
737
+ function Mr(n) {
738
+ const t = Math.min(xr, Math.max(120, Math.round(os * n)));
739
+ return { w: os, h: t };
740
740
  }
741
- function Mr(n, t, e, s) {
741
+ function kr(n, t, e, s) {
742
742
  const i = t.split(/\s+/).filter(Boolean), r = [];
743
743
  let o = "";
744
744
  for (const a of i) {
@@ -752,7 +752,7 @@ function Mr(n, t, e, s) {
752
752
  }
753
753
  return r;
754
754
  }
755
- function kr(n, t, e, s, i, r) {
755
+ function Sr(n, t, e, s, i, r) {
756
756
  if (n.save(), n.fillStyle = r, n.strokeStyle = r, n.lineWidth = i * 0.07, n.lineCap = "round", n.lineJoin = "round", n.beginPath(), t === "play")
757
757
  n.arc(e, s, i * 0.5, 0, Math.PI * 2), n.stroke(), n.beginPath(), n.moveTo(e - i * 0.14, s - i * 0.24), n.lineTo(e + i * 0.26, s), n.lineTo(e - i * 0.14, s + i * 0.24), n.closePath(), n.fill();
758
758
  else if (t === "globe" || t === "link-off")
@@ -768,35 +768,35 @@ function kr(n, t, e, s, i, r) {
768
768
  n.restore();
769
769
  }
770
770
  const ee = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif";
771
- function os(n, t, e, s, i) {
771
+ function as(n, t, e, s, i) {
772
772
  const r = i.dark, o = (v, w) => `hsl(${s.hue ?? 0} ${s.hue === null ? 0 : v}% ${w}%)`, a = n.createLinearGradient(0, 0, t, e);
773
773
  a.addColorStop(0, r ? o(34, 20) : o(40, 90)), a.addColorStop(1, r ? o(30, 12) : o(34, 82)), n.fillStyle = a, n.fillRect(0, 0, t, e);
774
774
  const l = r ? o(30, 88) : o(50, 24), h = r ? o(20, 70) : o(30, 38), c = Math.round(t * 0.06), d = s.glyph === null ? 0 : Math.round(Math.min(t * 0.2, e * 0.34)), u = Math.round(t * 0.04), f = Math.round(t * 0.055);
775
775
  n.textBaseline = "alphabetic", n.textAlign = "center", n.font = `600 ${f}px ${ee}`;
776
- const m = s.title === "" ? [] : Mr(n, s.title, t - c * 2, e < 260 ? 1 : 2), p = Math.round(d * 0.28), g = d + p + u + (m.length > 0 ? Math.round(f * 0.5) + m.length * f * 1.2 : 0);
776
+ const m = s.title === "" ? [] : kr(n, s.title, t - c * 2, e < 260 ? 1 : 2), p = Math.round(d * 0.28), g = d + p + u + (m.length > 0 ? Math.round(f * 0.5) + m.length * f * 1.2 : 0);
777
777
  let y = Math.max(c * 0.5, (e - g) / 2);
778
- if (s.glyph !== null && kr(n, s.glyph, t / 2, y + d / 2, d, Ji(i.accent)), y += d + p + u, n.fillStyle = h, n.font = `700 ${u}px ${ee}`, n.fillText(s.label.toUpperCase(), t / 2, y, t - c * 2), m.length > 0) {
778
+ if (s.glyph !== null && Sr(n, s.glyph, t / 2, y + d / 2, d, tn(i.accent)), y += d + p + u, n.fillStyle = h, n.font = `700 ${u}px ${ee}`, n.fillText(s.label.toUpperCase(), t / 2, y, t - c * 2), m.length > 0) {
779
779
  n.fillStyle = l, n.font = `600 ${f}px ${ee}`, y += Math.round(f * 0.5);
780
780
  for (const v of m)
781
781
  y += f * 1.2, n.fillText(v, t / 2, y - f * 0.2, t - c * 2);
782
782
  }
783
783
  }
784
- async function Sr(n, t, e) {
785
- const { w: s, h: i } = xr(t);
784
+ async function Tr(n, t, e) {
785
+ const { w: s, h: i } = Mr(t);
786
786
  if (typeof OffscreenCanvas < "u") {
787
787
  const a = new OffscreenCanvas(s, i), l = a.getContext("2d");
788
- return l ? (os(l, s, i, n, e), a.convertToBlob({ type: "image/png" })) : null;
788
+ return l ? (as(l, s, i, n, e), a.convertToBlob({ type: "image/png" })) : null;
789
789
  }
790
790
  if (typeof document > "u") return null;
791
791
  const r = document.createElement("canvas");
792
792
  r.width = s, r.height = i;
793
793
  const o = r.getContext("2d");
794
- return o ? (os(o, s, i, n, e), new Promise((a) => r.toBlob((l) => a(l), "image/png"))) : null;
794
+ return o ? (as(o, s, i, n, e), new Promise((a) => r.toBlob((l) => a(l), "image/png"))) : null;
795
795
  }
796
- const as = /* @__PURE__ */ new WeakMap();
797
- function bi(n, t, e) {
798
- let s = as.get(n);
799
- s || (s = /* @__PURE__ */ new Map(), as.set(n, s));
796
+ const ls = /* @__PURE__ */ new WeakMap();
797
+ function xi(n, t, e) {
798
+ let s = ls.get(n);
799
+ s || (s = /* @__PURE__ */ new Map(), ls.set(n, s));
800
800
  const i = s;
801
801
  let r = i.get(t.selector);
802
802
  r || (r = { count: 0, own: null }, i.set(t.selector, r));
@@ -811,7 +811,7 @@ function bi(n, t, e) {
811
811
  l || (l = !0, !(--o.count > 0) && (o.own?.remove(), i.delete(t.selector)));
812
812
  };
813
813
  }
814
- const Tr = 3, Ar = 1e4, Er = 6, Pr = 8e3, Lr = 0.5, ls = 140, se = 1.4, hs = 1.5, Ir = 4, cs = 6, Rr = 400, Cr = 3e3, _r = 2, Or = 1.5, Nr = 100, Dr = 1e3, Fr = Vn, Br = 2e3, Xr = 3, qr = 200, Ur = 100, Yr = 30, ds = 6, zr = 1500, xi = 3, Wr = 400, Hr = 4e3, $r = 3e3, Gr = 2, us = 50, fs = 1e3, Vr = "position:fixed;left:0;top:0;opacity:0;pointer-events:none;z-index:-1;overflow:hidden;", ps = "cb-embed-styles", Kr = `
814
+ const Ar = 3, Er = 1e4, Pr = 6, Lr = 8e3, Ir = 0.5, hs = 140, se = 1.4, cs = 1.5, Rr = 4, ds = 6, Cr = 400, _r = 3e3, Or = 2, Nr = 1.5, Dr = 100, Fr = 1e3, Br = Kn, Xr = 2e3, qr = 3, Ur = 200, Yr = 100, zr = 30, us = 6, Wr = 1500, Mi = 3, Hr = 400, $r = 4e3, Gr = 3e3, Vr = 2, fs = 50, ps = 1e3, Kr = "position:fixed;left:0;top:0;opacity:0;pointer-events:none;z-index:-1;overflow:hidden;", ms = "cb-embed-styles", jr = `
815
815
  .cb-embed{position:absolute;left:0;top:0;transform-origin:0 0;overflow:hidden;background:rgba(0,0,0,.28);pointer-events:none;container-type:size;transition:background-color .2s ease}
816
816
  .cb-embed[data-ready]{background:transparent}
817
817
  .cb-embed[data-culled]{display:none}
@@ -827,14 +827,14 @@ const Tr = 3, Ar = 1e4, Er = 6, Pr = 8e3, Lr = 0.5, ls = 140, se = 1.4, hs = 1.5
827
827
  .cb-embed-done:hover{background:rgba(48,48,52,.95)}
828
828
  .cb-embed-done:focus-visible{outline:2px solid #6aa6ff;outline-offset:2px}
829
829
  @media (prefers-reduced-motion:reduce){.cb-embed,.cb-embed iframe{transition:none}.cb-embed-spin::after{animation-duration:3s}}
830
- `, jr = {
831
- selector: `style#${ps}`,
830
+ `, Qr = {
831
+ selector: `style#${ms}`,
832
832
  mark: (n) => {
833
- n.id = ps;
833
+ n.id = ms;
834
834
  },
835
- css: Kr
836
- }, ms = 10, ie = 48, gs = Fe * 1.05, Qr = 15e3, ne = (n, t) => n.maxX >= t.x0 && n.minX <= t.x1 && n.maxY >= t.y0 && n.minY <= t.y1, ys = (n) => n === void 0 ? { w: 0, h: 0 } : typeof n == "number" ? { w: n, h: n * gi / mi } : n;
837
- class Ul {
835
+ css: jr
836
+ }, gs = 10, ie = 48, ys = Be * 1.05, Zr = 15e3, ne = (n, t) => n.maxX >= t.x0 && n.minX <= t.x1 && n.maxY >= t.y0 && n.minY <= t.y1, ws = (n) => n === void 0 ? { w: 0, h: 0 } : typeof n == "number" ? { w: n, h: n * yi / gi } : n;
837
+ class zl {
838
838
  root;
839
839
  host;
840
840
  store;
@@ -888,39 +888,39 @@ class Ul {
888
888
  constructor(t, e = {}) {
889
889
  this.host = t.host, this.store = t.store, this.stage = t.stage, this.emit = t.emit, this.doc = t.root.ownerDocument;
890
890
  const s = this.doc.defaultView;
891
- this.monitor = t.frameRate ?? new En({ raf: t.raf, caf: t.caf, doc: this.doc }), t.frameRate || this.cleanups.push(() => this.monitor.dispose()), this.cleanups.push(
891
+ this.monitor = t.frameRate ?? new Pn({ raf: t.raf, caf: t.caf, doc: this.doc }), t.frameRate || this.cleanups.push(() => this.monitor.dispose()), this.cleanups.push(
892
892
  this.monitor.load(() => this.opts.adaptive && !this.disposed && this.renderCount > 0),
893
893
  this.monitor.onWindow((l) => this.onWindow(l)),
894
894
  // A new burst: the windows before it are no "in a row" with the ones to come.
895
895
  this.monitor.onStart(() => {
896
896
  this.smooth = 0, this.freezeSmooth = 0;
897
897
  })
898
- ), this.rasterize = t.rasterize ?? ((l, h, c) => eo(this.doc, l, h, c)), this.appOrigin = typeof location < "u" ? location.origin : void 0, this.opts = {
899
- maxLive: e.maxLive ?? Cn,
900
- maxLiveTouch: e.maxLiveTouch ?? _n,
901
- maxMounted: e.maxMounted ?? On,
902
- maxMountedTouch: e.maxMountedTouch ?? Nn,
903
- maxOffscreen: e.maxOffscreen ?? Dn,
904
- maxOffscreenTouch: e.maxOffscreenTouch ?? Fn,
905
- cullMargin: e.cullMargin ?? Lr,
898
+ ), this.rasterize = t.rasterize ?? ((l, h, c) => so(this.doc, l, h, c)), this.appOrigin = typeof location < "u" ? location.origin : void 0, this.opts = {
899
+ maxLive: e.maxLive ?? _n,
900
+ maxLiveTouch: e.maxLiveTouch ?? On,
901
+ maxMounted: e.maxMounted ?? Nn,
902
+ maxMountedTouch: e.maxMountedTouch ?? Dn,
903
+ maxOffscreen: e.maxOffscreen ?? Fn,
904
+ maxOffscreenTouch: e.maxOffscreenTouch ?? Bn,
905
+ cullMargin: e.cullMargin ?? Ir,
906
906
  resolveTimeoutMs: e.resolveTimeoutMs ?? 4e3,
907
- minLive: ys(e.minLivePx),
907
+ minLive: ws(e.minLivePx),
908
908
  minLiveScale: e.minLiveScale ?? 0,
909
909
  resolve: e.resolve,
910
- resolution: e.resolution ?? pi,
910
+ resolution: e.resolution ?? mi,
911
911
  arbitrarySameOrigin: e.arbitrarySameOrigin ?? !0,
912
- isolatedHosts: Se(e.isolatedHosts),
912
+ isolatedHosts: Te(e.isolatedHosts),
913
913
  snippetNetwork: e.snippetNetwork ?? "images",
914
914
  autoplay: e.autoplay ?? !1,
915
- maxLoading: e.maxLoading ?? Er,
916
- freezePx: e.freezePx ?? ls,
917
- maxAnimating: bs(e.maxAnimating ?? 1 / 0),
915
+ maxLoading: e.maxLoading ?? Pr,
916
+ freezePx: e.freezePx ?? hs,
917
+ maxAnimating: xs(e.maxAnimating ?? 1 / 0),
918
918
  adaptive: e.adaptive ?? !0,
919
- previewWorkers: vs(e.previewWorkers ?? xi)
920
- }, this.previews = new er(e.previewCache ?? "memory"), this.cleanups.push(bi(this.doc, jr, t.nonce)), this.root = this.doc.createElement("div"), this.root.style.cssText = "position:absolute;inset:0;overflow:hidden;pointer-events:none;", t.root.appendChild(this.root), this.done = this.doc.createElement("button"), this.done.type = "button", this.done.className = "cb-embed-done", this.done.textContent = "Done", this.done.setAttribute("aria-label", "Done interacting with the embed");
919
+ previewWorkers: bs(e.previewWorkers ?? Mi)
920
+ }, this.previews = new sr(e.previewCache ?? "memory"), this.cleanups.push(xi(this.doc, Qr, t.nonce)), this.root = this.doc.createElement("div"), this.root.style.cssText = "position:absolute;inset:0;overflow:hidden;pointer-events:none;", t.root.appendChild(this.root), this.done = this.doc.createElement("button"), this.done.type = "button", this.done.className = "cb-embed-done", this.done.textContent = "Done", this.done.setAttribute("aria-label", "Done interacting with the embed");
921
921
  for (const l of ["pointerdown", "pointerup", "dblclick", "wheel", "keydown"])
922
922
  this.done.addEventListener(l, (h) => {
923
- l === "keydown" && h.key === "Escape" || h.stopPropagation();
923
+ l === "keydown" && h.key === "Escape" || (l === "wheel" && h.preventDefault(), h.stopPropagation());
924
924
  });
925
925
  this.done.addEventListener("click", () => this.exitInteract()), this.root.appendChild(this.done);
926
926
  const i = (l) => {
@@ -1021,13 +1021,13 @@ class Ul {
1021
1021
  return t;
1022
1022
  }
1023
1023
  setOptions(t) {
1024
- const e = t.isolatedHosts === void 0 ? void 0 : Se(t.isolatedHosts);
1025
- if (t.maxLive !== void 0 && (this.opts.maxLive = t.maxLive), t.maxLoading !== void 0 && (this.opts.maxLoading = t.maxLoading), t.freezePx !== void 0 && (this.opts.freezePx = Math.max(0, t.freezePx)), t.maxAnimating !== void 0 && (this.opts.maxAnimating = bs(t.maxAnimating)), t.adaptive !== void 0 && t.adaptive !== this.opts.adaptive && (this.opts.adaptive = t.adaptive, t.adaptive || (this.adaptiveN = 1 / 0, this.freezeMul = 1, this.requestPlan()), this.smooth = 0, this.freezeSmooth = 0), t.maxLiveTouch !== void 0 && (this.opts.maxLiveTouch = t.maxLiveTouch), t.maxMounted !== void 0 && (this.opts.maxMounted = t.maxMounted), t.maxMountedTouch !== void 0 && (this.opts.maxMountedTouch = t.maxMountedTouch), t.maxOffscreen !== void 0 && (this.opts.maxOffscreen = t.maxOffscreen), t.cullMargin !== void 0 && (this.opts.cullMargin = t.cullMargin), t.maxOffscreenTouch !== void 0 && (this.opts.maxOffscreenTouch = t.maxOffscreenTouch), t.minLivePx !== void 0 && (this.opts.minLive = ys(t.minLivePx)), t.minLiveScale !== void 0 && (this.opts.minLiveScale = t.minLiveScale), t.resolution !== void 0) {
1024
+ const e = t.isolatedHosts === void 0 ? void 0 : Te(t.isolatedHosts);
1025
+ if (t.maxLive !== void 0 && (this.opts.maxLive = t.maxLive), t.maxLoading !== void 0 && (this.opts.maxLoading = t.maxLoading), t.freezePx !== void 0 && (this.opts.freezePx = Math.max(0, t.freezePx)), t.maxAnimating !== void 0 && (this.opts.maxAnimating = xs(t.maxAnimating)), t.adaptive !== void 0 && t.adaptive !== this.opts.adaptive && (this.opts.adaptive = t.adaptive, t.adaptive || (this.adaptiveN = 1 / 0, this.freezeMul = 1, this.requestPlan()), this.smooth = 0, this.freezeSmooth = 0), t.maxLiveTouch !== void 0 && (this.opts.maxLiveTouch = t.maxLiveTouch), t.maxMounted !== void 0 && (this.opts.maxMounted = t.maxMounted), t.maxMountedTouch !== void 0 && (this.opts.maxMountedTouch = t.maxMountedTouch), t.maxOffscreen !== void 0 && (this.opts.maxOffscreen = t.maxOffscreen), t.cullMargin !== void 0 && (this.opts.cullMargin = t.cullMargin), t.maxOffscreenTouch !== void 0 && (this.opts.maxOffscreenTouch = t.maxOffscreenTouch), t.minLivePx !== void 0 && (this.opts.minLive = ws(t.minLivePx)), t.minLiveScale !== void 0 && (this.opts.minLiveScale = t.minLiveScale), t.resolution !== void 0) {
1026
1026
  this.opts.resolution = t.resolution;
1027
1027
  for (const [a, l] of this.frames) this.place(a, l);
1028
1028
  }
1029
1029
  t.resolve !== void 0 && (this.opts.resolve = t.resolve), t.resolveTimeoutMs !== void 0 && (this.opts.resolveTimeoutMs = t.resolveTimeoutMs);
1030
- const s = t.arbitrarySameOrigin !== void 0 && t.arbitrarySameOrigin !== this.opts.arbitrarySameOrigin, i = t.autoplay !== void 0 && t.autoplay !== this.opts.autoplay, r = e !== void 0 && !Jr(e, this.opts.isolatedHosts), o = t.snippetNetwork !== void 0 && t.snippetNetwork !== this.opts.snippetNetwork;
1030
+ const s = t.arbitrarySameOrigin !== void 0 && t.arbitrarySameOrigin !== this.opts.arbitrarySameOrigin, i = t.autoplay !== void 0 && t.autoplay !== this.opts.autoplay, r = e !== void 0 && !to(e, this.opts.isolatedHosts), o = t.snippetNetwork !== void 0 && t.snippetNetwork !== this.opts.snippetNetwork;
1031
1031
  if (s || i || r || o) {
1032
1032
  t.arbitrarySameOrigin !== void 0 && (this.opts.arbitrarySameOrigin = t.arbitrarySameOrigin), t.autoplay !== void 0 && (this.opts.autoplay = t.autoplay), e !== void 0 && (this.opts.isolatedHosts = e), t.snippetNetwork !== void 0 && (this.opts.snippetNetwork = t.snippetNetwork);
1033
1033
  for (const [a, l] of this.entries) {
@@ -1037,7 +1037,7 @@ class Ul {
1037
1037
  }
1038
1038
  }
1039
1039
  if (t.previewCache !== void 0 && (this.previews.mode = t.previewCache), t.previewWorkers !== void 0) {
1040
- const a = vs(t.previewWorkers);
1040
+ const a = bs(t.previewWorkers);
1041
1041
  a === 0 && this.opts.previewWorkers > 0 && this.stopPreviews(), this.opts.previewWorkers = a, this.previewScan = !0;
1042
1042
  }
1043
1043
  this.rerank(), this.requestPlan(), this.monitor.poke();
@@ -1093,7 +1093,7 @@ class Ul {
1093
1093
  if (this.lastCam = e, !s) return;
1094
1094
  const i = e.at - s.at;
1095
1095
  if (i <= 0) return;
1096
- if (i > Nr) {
1096
+ if (i > Dr) {
1097
1097
  this.camSpeed = 0;
1098
1098
  return;
1099
1099
  }
@@ -1153,7 +1153,7 @@ class Ul {
1153
1153
  return;
1154
1154
  }
1155
1155
  const s = this.entries.get(t.id);
1156
- if (s && Gn(s.embed, e)) {
1156
+ if (s && Vn(s.embed, e)) {
1157
1157
  if (s.embed !== e) {
1158
1158
  const a = s.embed.title !== e.title;
1159
1159
  s.embed = e, a && this.retitle(t.id, s);
@@ -1173,7 +1173,7 @@ class Ul {
1173
1173
  for (const a of i) this.retire(a);
1174
1174
  i.clear();
1175
1175
  }
1176
- const r = zn(e), o = {
1176
+ const r = Wn(e), o = {
1177
1177
  embed: e,
1178
1178
  info: r,
1179
1179
  ready: !1,
@@ -1205,8 +1205,8 @@ class Ul {
1205
1205
  t.ready = !0, t.spec = this.specFor(t), t.spec === null && t.info.kind === "url" && (t.info = { ...t.info, frameable: !1 }), this.previewScan = !0, this.requestPlan();
1206
1206
  }
1207
1207
  specFor(t) {
1208
- if (!$n(t.info)) return null;
1209
- const e = mr({
1208
+ if (!Gn(t.info)) return null;
1209
+ const e = gr({
1210
1210
  source: t.embed,
1211
1211
  iframeSrc: t.info.iframeSrc ?? void 0,
1212
1212
  appOrigin: this.appOrigin,
@@ -1214,7 +1214,7 @@ class Ul {
1214
1214
  isolatedHosts: this.opts.isolatedHosts,
1215
1215
  snippetNetwork: this.opts.snippetNetwork
1216
1216
  });
1217
- return e?.src !== void 0 && (e.src = tn(e.provider, e.src, this.appOrigin), this.opts.autoplay && (e.src = en(e.provider, e.src))), e;
1217
+ return e?.src !== void 0 && (e.src = en(e.provider, e.src, this.appOrigin), this.opts.autoplay && (e.src = sn(e.provider, e.src))), e;
1218
1218
  }
1219
1219
  async resolve(t, e) {
1220
1220
  await Promise.resolve();
@@ -1224,12 +1224,12 @@ class Ul {
1224
1224
  const d = this.opts.resolve;
1225
1225
  if (d)
1226
1226
  try {
1227
- c = await so(Promise.resolve(d(e.info.url)), this.opts.resolveTimeoutMs);
1227
+ c = await io(Promise.resolve(d(e.info.url)), this.opts.resolveTimeoutMs);
1228
1228
  } catch (u) {
1229
1229
  console.warn("[corkboard] embed resolver failed:", u), i() && this.emit("error", { kind: "embed", id: t, url: e.info.url, cause: u });
1230
1230
  }
1231
1231
  if (!i()) return;
1232
- typeof c?.title == "string" && c.title !== "" && (e.resolverTitle = c.title), e.info = Hn(e.info, c), this.settle(e);
1232
+ typeof c?.title == "string" && c.title !== "" && (e.resolverTitle = c.title), e.info = $n(e.info, c), this.settle(e);
1233
1233
  }
1234
1234
  const r = this.store.get(t);
1235
1235
  if (!r || !i()) return;
@@ -1259,7 +1259,7 @@ class Ul {
1259
1259
  async loadPoster(t, e, s) {
1260
1260
  const i = () => !this.disposed && this.entries.get(t) === e && e.token === s;
1261
1261
  for (const r of e.info.posters) {
1262
- const o = await Yn(r);
1262
+ const o = await zn(r);
1263
1263
  if (!i())
1264
1264
  return o && URL.revokeObjectURL(o), null;
1265
1265
  if (o)
@@ -1270,7 +1270,7 @@ class Ul {
1270
1270
  async makeTile(t, e, s) {
1271
1271
  const i = this.store.get(t);
1272
1272
  if (!i) return;
1273
- const r = this.stage.activeTheme, o = await Sr(wr(e.info), i.w > 0 ? i.h / i.w : 0.5625, r);
1273
+ const r = this.stage.activeTheme, o = await Tr(vr(e.info), i.w > 0 ? i.h / i.w : 0.5625, r);
1274
1274
  o && (this.disposed || this.entries.get(t) !== e || e.token !== s || this.applyPoster(t, e, URL.createObjectURL(o), "tile"));
1275
1275
  }
1276
1276
  applyPoster(t, e, s, i) {
@@ -1301,7 +1301,7 @@ class Ul {
1301
1301
  retire(t) {
1302
1302
  const e = setTimeout(() => {
1303
1303
  this.timers.delete(e), URL.revokeObjectURL(t);
1304
- }, Qr);
1304
+ }, Zr);
1305
1305
  this.timers.set(e, t);
1306
1306
  }
1307
1307
  // ── Live iframes ───────────────────────────────────────────────────────────
@@ -1336,7 +1336,7 @@ class Ul {
1336
1336
  }
1337
1337
  runPlan(t = !1) {
1338
1338
  this.planDirty = !1;
1339
- const e = qn({
1339
+ const e = Un({
1340
1340
  cards: this.cards(),
1341
1341
  cameraMoving: this.moving && !t,
1342
1342
  scale: this.stage.cam.scale,
@@ -1396,7 +1396,7 @@ class Ul {
1396
1396
  parked: !1,
1397
1397
  kind: s.profile === "snippet" ? "snippet" : s.provider === "youtube" || s.provider === "vimeo" ? "video" : "page",
1398
1398
  provider: s.provider,
1399
- origin: to(s.src),
1399
+ origin: eo(s.src),
1400
1400
  small: !1,
1401
1401
  frozen: !1,
1402
1402
  snapFailed: !1,
@@ -1413,10 +1413,10 @@ class Ul {
1413
1413
  loadTimer: null,
1414
1414
  overBudget: !1
1415
1415
  };
1416
- o.slotTimer = setTimeout(() => this.releaseSlot(o), Pr), r.addEventListener("load", () => {
1416
+ o.slotTimer = setTimeout(() => this.releaseSlot(o), Lr), r.addEventListener("load", () => {
1417
1417
  o.kind === "snippet" && this.frames.get(t) === o && !this.guardLoad(t, e, o) || (o.loaded = !0, i.dataset.ready = "", this.releaseSlot(o), o.paused = !1, this.dropRequest(o), o.snapFailed = !1, o.snapTries = 0, o.retry !== null && clearTimeout(o.retry), o.retry = null, o.loadTimer !== null && clearTimeout(o.loadTimer), o.loadTimer = null, this.syncPause(t, o, !1), o.kind === "video" && (o.loadTimer = setTimeout(() => {
1418
1418
  o.loadTimer = null, this.syncPause(t, o, !0);
1419
- }, zr)), this.requestPlan());
1419
+ }, Wr)), this.requestPlan());
1420
1420
  });
1421
1421
  const a = this.doc.createElement("div");
1422
1422
  a.className = "cb-embed-spin", a.setAttribute("role", "progressbar"), a.setAttribute("aria-label", "Loading embed"), i.append(a, r), this.frames.set(t, o), e.lastUsed = ++this.clock, this.place(t, o), this.root.insertBefore(i, this.done), this.emit("embedLive", { id: t, live: !0 });
@@ -1440,7 +1440,7 @@ class Ul {
1440
1440
  if (s.restoring)
1441
1441
  return s.restoring = !1, !0;
1442
1442
  const r = Date.now();
1443
- return s.strikes = s.strikes.filter((o) => r - o < Ar), s.strikes.push(r), s.strikes.length >= Tr ? this.blockSnippet(t, e) : (s.restoring = !0, s.iframe.srcdoc = s.iframe.srcdoc), !1;
1443
+ return s.strikes = s.strikes.filter((o) => r - o < Er), s.strikes.push(r), s.strikes.length >= Ar ? this.blockSnippet(t, e) : (s.restoring = !0, s.iframe.srcdoc = s.iframe.srcdoc), !1;
1444
1444
  }
1445
1445
  blockSnippet(t, e) {
1446
1446
  this.disposed || this.entries.get(t) !== e || (e.blocked = !0, this.destroyFrame(t), this.emit("error", { kind: "embed", id: t, cause: new Error("snippet navigated away from its document") }), this.requestPlan());
@@ -1459,13 +1459,13 @@ class Ul {
1459
1459
  const f = this.entries.get(t);
1460
1460
  f && (f.lastSeen = i);
1461
1461
  }
1462
- const a = this.stage.cam.cam, l = this.entries.get(t)?.embed.resolution ?? this.opts.resolution, h = Je({ x: r.x, y: r.y, w: r.w, h: r.h, rot: r.rot }, a, l), c = e.wrapper.style;
1462
+ const a = this.stage.cam.cam, l = this.entries.get(t)?.embed.resolution ?? this.opts.resolution, h = ts({ x: r.x, y: r.y, w: r.w, h: r.h, rot: r.rot }, a, l), c = e.wrapper.style;
1463
1463
  h.width !== e.w && (e.w = h.width, c.width = `${h.width}px`), h.height !== e.h && (e.h = h.height, c.height = `${h.height}px`), h.transform !== e.transform && (e.transform = h.transform, c.transform = h.transform);
1464
1464
  const d = Math.round((this.store.get(t)?.radius ?? 0) * h.width / Math.max(r.w, 1) * 100) / 100;
1465
1465
  d !== e.radius && (e.radius = d, c.borderRadius = `${d}px`);
1466
1466
  const u = this.store.rank(t) + 1;
1467
1467
  if (u !== e.z && (e.z = u, c.zIndex = String(u)), this.interactId === t) {
1468
- const f = this.stage.cam.width, m = this.stage.cam.height, p = Math.min(Math.max(h.topRightX, 90), f) - ms, g = Math.min(Math.max(h.topRightY, 0), m - 40) + ms;
1468
+ const f = this.stage.cam.width, m = this.stage.cam.height, p = Math.min(Math.max(h.topRightX, 90), f) - gs, g = Math.min(Math.max(h.topRightY, 0), m - 40) + gs;
1469
1469
  this.done.style.transform = `translate(${Math.round(p)}px, ${Math.round(g)}px) translateX(-100%)`;
1470
1470
  }
1471
1471
  this.tune(t, e, r, !1);
@@ -1478,10 +1478,10 @@ class Ul {
1478
1478
  e.wrapper.dataset.culled = "";
1479
1479
  return;
1480
1480
  }
1481
- e.wrapper.dataset.culling = "", e.cullTimer = setTimeout(() => this.finishCull(e), Rr), e.cullSnapAt = Date.now();
1481
+ e.wrapper.dataset.culling = "", e.cullTimer = setTimeout(() => this.finishCull(e), Cr), e.cullSnapAt = Date.now();
1482
1482
  }
1483
1483
  canSnapCull(t, e) {
1484
- return e.kind === "snippet" && e.loaded && !e.frozen && !e.snap && !e.drawing && e.landTimer === null && this.camSpeed < Or && this.snapping < cs - _r && Date.now() - e.cullSnapAt >= Cr && this.entries.has(t);
1484
+ return e.kind === "snippet" && e.loaded && !e.frozen && !e.snap && !e.drawing && e.landTimer === null && this.camSpeed < Nr && this.snapping < ds - Or && Date.now() - e.cullSnapAt >= _r && this.entries.has(t);
1485
1485
  }
1486
1486
  // The snapshot is in (or took too long): hide the frame, if its card is still away.
1487
1487
  finishCull(t) {
@@ -1508,7 +1508,7 @@ class Ul {
1508
1508
  const l = Math.min(s.w, s.h) * this.stage.cam.scale;
1509
1509
  a ? a = l < o * se : i && (a = l < o);
1510
1510
  }
1511
- a !== e.small && (e.small = a, a || (e.snapFailed = !1, e.snapTries = 0, e.retry !== null && clearTimeout(e.retry), e.retry = null, this.cancelSnapshot(e), e.frozen && this.setFrozen(e, !1))), a && i && e.kind === "snippet" && e.loaded && !e.culled && !e.frozen && !e.snap && !e.drawing && e.landTimer === null && !e.snapFailed && this.snapping < cs && this.requestSnapshot(t, e), this.syncPause(t, e, !1);
1511
+ a !== e.small && (e.small = a, a || (e.snapFailed = !1, e.snapTries = 0, e.retry !== null && clearTimeout(e.retry), e.retry = null, this.cancelSnapshot(e), e.frozen && this.setFrozen(e, !1))), a && i && e.kind === "snippet" && e.loaded && !e.culled && !e.frozen && !e.snap && !e.drawing && e.landTimer === null && !e.snapFailed && this.snapping < ds && this.requestSnapshot(t, e), this.syncPause(t, e, !1);
1512
1512
  }
1513
1513
  setFrozen(t, e) {
1514
1514
  t.frozen = e, this.rankDirty = !0, e ? t.wrapper.dataset.frozen = "" : delete t.wrapper.dataset.frozen;
@@ -1585,9 +1585,9 @@ class Ul {
1585
1585
  let s = this.adaptiveN;
1586
1586
  if (t.slow) {
1587
1587
  this.smooth = 0, this.adaptFreeze(!0);
1588
- const i = Math.max(ds, Math.floor(this.animatingIds.size * 0.7));
1588
+ const i = Math.max(us, Math.floor(this.animatingIds.size * 0.7));
1589
1589
  i < e && (s = i);
1590
- } else t.smooth ? (this.adaptFreeze(!1), ++this.smooth >= Me && this.adaptiveN < this.opts.maxAnimating && (this.smooth = 0, s = Math.ceil(this.adaptiveN * 1.25) + 2, s >= Math.min(this.opts.maxAnimating, this.candidates) && (s = 1 / 0))) : (this.smooth = 0, this.adaptFreeze(null));
1590
+ } else t.smooth ? (this.adaptFreeze(!1), ++this.smooth >= ke && this.adaptiveN < this.opts.maxAnimating && (this.smooth = 0, s = Math.ceil(this.adaptiveN * 1.25) + 2, s >= Math.min(this.opts.maxAnimating, this.candidates) && (s = 1 / 0))) : (this.smooth = 0, this.adaptFreeze(null));
1591
1591
  s !== this.adaptiveN && (this.adaptiveN = s, this.rerank(), this.monitor.poke());
1592
1592
  }
1593
1593
  // Hiding frames is what frees the most, so once the animating budget cannot go lower and windows are still
@@ -1596,7 +1596,7 @@ class Ul {
1596
1596
  adaptFreeze(t) {
1597
1597
  if (this.opts.freezePx <= 0) return;
1598
1598
  let e = this.freezeMul;
1599
- t === !0 ? (this.freezeSmooth = 0, this.animatingBudget <= ds && (e = Math.min(Ir, e * hs))) : t === !1 ? ++this.freezeSmooth >= Me && e > 1 && (this.freezeSmooth = 0, e = Math.max(1, e / hs)) : this.freezeSmooth = 0, e !== this.freezeMul && (this.freezeMul = e, this.requestPlan(), this.monitor.poke());
1599
+ t === !0 ? (this.freezeSmooth = 0, this.animatingBudget <= us && (e = Math.min(Rr, e * cs))) : t === !1 ? ++this.freezeSmooth >= ke && e > 1 && (this.freezeSmooth = 0, e = Math.max(1, e / cs)) : this.freezeSmooth = 0, e !== this.freezeMul && (this.freezeMul = e, this.requestPlan(), this.monitor.poke());
1600
1600
  }
1601
1601
  // ── Snapshots ──────────────────────────────────────────────────────────────
1602
1602
  // `cull`: the card left the view, so the picture is its last frame at full size rather than a small one.
@@ -1606,9 +1606,9 @@ class Ul {
1606
1606
  if (!i || i.w <= 0 || i.h <= 0) return !1;
1607
1607
  const r = this.doc.defaultView?.devicePixelRatio || 1, o = Math.min(
1608
1608
  s ? 2 * r : this.freezeThreshold * se * r / Math.min(i.w, i.h),
1609
- ts / Math.max(i.w, i.h)
1609
+ es / Math.max(i.w, i.h)
1610
1610
  ), a = ++this.snapSeq, l = Math.max(1, Math.round(i.w * o)), h = Math.max(1, Math.round(i.h * o));
1611
- return e.snap = { id: a, timer: setTimeout(() => this.snapshotFailed(e, a), Fr), w: l, h, cull: s }, this.snapping++, this.post(e, { cb: ct, op: "snapshot", id: a, w: l, h, vw: e.w, vh: e.h }, "*"), !0;
1611
+ return e.snap = { id: a, timer: setTimeout(() => this.snapshotFailed(e, a), Br), w: l, h, cull: s }, this.snapping++, this.post(e, { cb: ct, op: "snapshot", id: a, w: l, h, vw: e.w, vh: e.h }, "*"), !0;
1612
1612
  }
1613
1613
  // Forgets the request in flight: a reply to it is ignored.
1614
1614
  dropRequest(t) {
@@ -1625,9 +1625,9 @@ class Ul {
1625
1625
  }
1626
1626
  // A busy page can miss a snapshot that would work a moment later: try again, a few times, further apart.
1627
1627
  markSnapFailed(t) {
1628
- t.snapFailed = !0, ++t.snapTries < Xr && t.retry === null && (t.retry = setTimeout(() => {
1628
+ t.snapFailed = !0, ++t.snapTries < qr && t.retry === null && (t.retry = setTimeout(() => {
1629
1629
  t.retry = null, !this.disposed && (t.snapFailed = !1, this.requestPlan());
1630
- }, Br * t.snapTries)), this.requestPlan();
1630
+ }, Xr * t.snapTries)), this.requestPlan();
1631
1631
  }
1632
1632
  onMessage(t) {
1633
1633
  const e = t.data;
@@ -1635,11 +1635,11 @@ class Ul {
1635
1635
  for (const s of this.studios) {
1636
1636
  const i = s.job;
1637
1637
  if (!(!i || i.seq !== e.id || t.source !== s.iframe?.contentWindow))
1638
- return ws(e) ? this.previewReply(i, e.svg) : this.previewFailed(i);
1638
+ return vs(e) ? this.previewReply(i, e.svg) : this.previewFailed(i);
1639
1639
  }
1640
1640
  for (const [s, i] of this.frames) {
1641
1641
  if (t.source !== i.iframe.contentWindow || !i.snap || i.snap.id !== e.id) continue;
1642
- if (!ws(e)) return this.snapshotFailed(i, i.snap.id);
1642
+ if (!vs(e)) return this.snapshotFailed(i, i.snap.id);
1643
1643
  const r = e.svg, { w: o, h: a, cull: l } = i.snap, h = this.entries.get(s);
1644
1644
  this.cancelSnapshot(i), i.drawing = !0, l && this.finishCull(i), this.requestPlan();
1645
1645
  const c = () => Promise.resolve(this.rasterize(r, o, a)).catch(() => null), d = (u) => {
@@ -1657,7 +1657,7 @@ class Ul {
1657
1657
  }
1658
1658
  whenIdle(t) {
1659
1659
  const e = this.doc.defaultView;
1660
- e && typeof e.requestIdleCallback == "function" ? e.requestIdleCallback(t, { timeout: Dr }) : setTimeout(t, 0);
1660
+ e && typeof e.requestIdleCallback == "function" ? e.requestIdleCallback(t, { timeout: Fr }) : setTimeout(t, 0);
1661
1661
  }
1662
1662
  showSnapshot(t, e, s, i = !1) {
1663
1663
  const r = this.entries.get(t);
@@ -1674,9 +1674,9 @@ class Ul {
1674
1674
  awaitPoster(t, e, s) {
1675
1675
  e.landTimer !== null && clearTimeout(e.landTimer), e.landTimer = setTimeout(
1676
1676
  () => {
1677
- e.landTimer = null, !(this.disposed || this.frames.get(t) !== e || !e.small) && (this.posterShown(t) ? (this.setFrozen(e, !0), this.syncPause(t, e, !1)) : s + 1 < Yr ? this.awaitPoster(t, e, s + 1) : e.snapFailed = !0);
1677
+ e.landTimer = null, !(this.disposed || this.frames.get(t) !== e || !e.small) && (this.posterShown(t) ? (this.setFrozen(e, !0), this.syncPause(t, e, !1)) : s + 1 < zr ? this.awaitPoster(t, e, s + 1) : e.snapFailed = !0);
1678
1678
  },
1679
- s === 0 ? qr : Ur
1679
+ s === 0 ? Ur : Yr
1680
1680
  );
1681
1681
  }
1682
1682
  // The card's sprite shows a rendition of its current poster (not the placeholder, the ThumbHash or the
@@ -1695,13 +1695,13 @@ class Ul {
1695
1695
  previewPlan(t, e) {
1696
1696
  const s = e.embed.html, i = this.store.get(t);
1697
1697
  if (s === void 0 || !i || i.w <= 0 || i.h <= 0 || e.blocked) return null;
1698
- const r = Math.max(1, Math.round(i.h / i.w * us)), o = { x: 0, y: 0, w: fs, h: fs * r / us }, a = e.embed.resolution ?? this.opts.resolution, l = Je(o, { tx: 0, ty: 0, scale: 1 }, a), h = this.doc.defaultView?.devicePixelRatio || 1, c = Math.min(
1699
- Math.max(this.opts.freezePx, ls) * se * h / Math.min(o.w, o.h),
1700
- ts / Math.max(o.w, o.h)
1698
+ const r = Math.max(1, Math.round(i.h / i.w * fs)), o = { x: 0, y: 0, w: ps, h: ps * r / fs }, a = e.embed.resolution ?? this.opts.resolution, l = ts(o, { tx: 0, ty: 0, scale: 1 }, a), h = this.doc.defaultView?.devicePixelRatio || 1, c = Math.min(
1699
+ Math.max(this.opts.freezePx, hs) * se * h / Math.min(o.w, o.h),
1700
+ es / Math.max(o.w, o.h)
1701
1701
  ), d = Math.max(1, Math.round(o.w * c)), u = Math.max(1, Math.round(o.h * c));
1702
1702
  return {
1703
- key: Jn(s, r, String(a), d, u),
1704
- material: yi(s, r, String(a), d, u),
1703
+ key: tr(s, r, String(a), d, u),
1704
+ material: wi(s, r, String(a), d, u),
1705
1705
  vw: l.width,
1706
1706
  vh: l.height,
1707
1707
  w: d,
@@ -1780,7 +1780,7 @@ class Ul {
1780
1780
  makeStudio() {
1781
1781
  if (!this.doc.body) return null;
1782
1782
  const e = this.doc.createElement("div");
1783
- e.style.cssText = Vr, e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", "");
1783
+ e.style.cssText = Kr, e.setAttribute("aria-hidden", "true"), e.setAttribute("inert", "");
1784
1784
  const s = { box: e, iframe: null, job: null };
1785
1785
  return this.studios.push(s), s;
1786
1786
  }
@@ -1792,12 +1792,12 @@ class Ul {
1792
1792
  const r = s.spec;
1793
1793
  if (!r || r.srcdoc === void 0) return;
1794
1794
  const o = { id: e, entry: s, token: s.token, studio: t, plan: i, seq: 0, loaded: !1, settle: null, timer: null };
1795
- o.timer = setTimeout(() => this.previewFailed(o), Hr), s.pv = "running", t.job = o;
1795
+ o.timer = setTimeout(() => this.previewFailed(o), $r), s.pv = "running", t.job = o;
1796
1796
  const a = t.iframe;
1797
1797
  a && (a.removeAttribute("srcdoc"), a.src = "about:blank", a.remove());
1798
1798
  const l = this.doc.createElement("iframe");
1799
1799
  t.iframe = l, l.tabIndex = -1, l.setAttribute("aria-hidden", "true"), l.style.cssText = "border:0;display:block;", l.addEventListener("load", () => {
1800
- t.job !== o || t.iframe !== l || o.loaded || (o.loaded = !0, o.settle = setTimeout(() => this.askPreview(o), Wr));
1800
+ t.job !== o || t.iframe !== l || o.loaded || (o.loaded = !0, o.settle = setTimeout(() => this.askPreview(o), Hr));
1801
1801
  }), l.title = r.title, l.setAttribute("sandbox", r.sandbox), l.setAttribute("allow", r.allow), l.setAttribute("referrerpolicy", r.referrerPolicy), r.csp !== void 0 && l.setAttribute("csp", r.csp), l.style.width = t.box.style.width = `${i.vw}px`, l.style.height = t.box.style.height = `${i.vh}px`, l.srcdoc = r.srcdoc, t.box.appendChild(l), t.box.isConnected || this.doc.body.appendChild(t.box);
1802
1802
  }
1803
1803
  // Loaded and given time to move on from its first frame: ask for the picture.
@@ -1820,12 +1820,12 @@ class Ul {
1820
1820
  }
1821
1821
  // No picture: the tile stays. One more try, after everything else.
1822
1822
  previewFailed(t) {
1823
- this.endJob(t), this.jobAlive(t) && (t.entry.pvTries++, t.entry.pv = t.entry.pvTries < Gr ? "queued" : "failed"), this.pumpPreviews();
1823
+ this.endJob(t), this.jobAlive(t) && (t.entry.pvTries++, t.entry.pv = t.entry.pvTries < Vr ? "queued" : "failed"), this.pumpPreviews();
1824
1824
  }
1825
1825
  // The frame answered: it is free for the next job while the markup is drawn here.
1826
1826
  previewReply(t, e) {
1827
1827
  this.endJob(t);
1828
- const s = setTimeout(() => this.previewFailed(t), $r);
1828
+ const s = setTimeout(() => this.previewFailed(t), Gr);
1829
1829
  t.timer = s, this.drawing.add(t), this.pumpPreviews(), Promise.resolve().then(() => this.rasterize(e, t.plan.w, t.plan.h)).catch(() => null).then((i) => {
1830
1830
  if (t.timer !== s || (this.endJob(t), !this.jobAlive(t))) return;
1831
1831
  if (!i || i.size === 0) return this.previewFailed(t);
@@ -1853,7 +1853,7 @@ class Ul {
1853
1853
  flyIn(t) {
1854
1854
  const e = this.stage.cam, s = this.stage.boundsOf([t]);
1855
1855
  if (!s) return;
1856
- const i = Math.min(s.x1 - s.x0, Math.max(1, e.width - ie * 2) / gs), r = Math.min(s.y1 - s.y0, Math.max(1, e.height - ie * 2) / gs), o = (s.x0 + s.x1) / 2, a = (s.y0 + s.y1) / 2;
1856
+ const i = Math.min(s.x1 - s.x0, Math.max(1, e.width - ie * 2) / ys), r = Math.min(s.y1 - s.y0, Math.max(1, e.height - ie * 2) / ys), o = (s.x0 + s.x1) / 2, a = (s.y0 + s.y1) / 2;
1857
1857
  this.stage.fitRect({ x0: o - i / 2, y0: a - r / 2, x1: o + i / 2, y1: a + r / 2 }, !0, ie);
1858
1858
  }
1859
1859
  // `flown`: the camera has already flown in for this card, so it does not fly again.
@@ -1864,22 +1864,22 @@ class Ul {
1864
1864
  if (i.blocked) return !1;
1865
1865
  if (i.spec === null)
1866
1866
  return i.info.url !== "" && window.open(i.info.url, "_blank", "noopener,noreferrer"), !0;
1867
- if (this.stage.cam.scale < Fe)
1867
+ if (this.stage.cam.scale < Be)
1868
1868
  return s ? !1 : (this.pendingInteract = t, this.flyIn(t), !0);
1869
1869
  this.interactId !== null && this.exitInteract(), i.lastUsed = ++this.clock, this.interactId = t, this.runPlan(!0);
1870
1870
  const o = this.frames.get(t);
1871
1871
  return o ? (o.wrapper.dataset.interact = "", this.done.style.display = "block", this.place(t, o), e && this.done.focus({ preventScroll: !0 }), this.emit("embedInteract", { id: t, active: !0 }), !0) : (this.interactId = null, !1);
1872
1872
  }
1873
1873
  }
1874
- const Zr = 2 * 1024 * 1024, ws = (n) => n.ok !== !1 && typeof n.svg == "string" && n.svg !== "" && n.svg.length <= Zr, Jr = (n, t) => n.length === t.length && n.every((e, s) => e === t[s]), vs = (n) => Number.isNaN(n) ? xi : Math.min(8, Math.max(0, Math.floor(n))), bs = (n) => Number.isNaN(n) ? 1 / 0 : Math.max(0, Math.floor(n));
1875
- function to(n) {
1874
+ const Jr = 2 * 1024 * 1024, vs = (n) => n.ok !== !1 && typeof n.svg == "string" && n.svg !== "" && n.svg.length <= Jr, to = (n, t) => n.length === t.length && n.every((e, s) => e === t[s]), bs = (n) => Number.isNaN(n) ? Mi : Math.min(8, Math.max(0, Math.floor(n))), xs = (n) => Number.isNaN(n) ? 1 / 0 : Math.max(0, Math.floor(n));
1875
+ function eo(n) {
1876
1876
  try {
1877
1877
  return n === void 0 ? "" : new URL(n).origin;
1878
1878
  } catch {
1879
1879
  return "";
1880
1880
  }
1881
1881
  }
1882
- async function eo(n, t, e, s) {
1882
+ async function so(n, t, e, s) {
1883
1883
  try {
1884
1884
  const i = new Image();
1885
1885
  i.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`, await i.decode();
@@ -1891,7 +1891,7 @@ async function eo(n, t, e, s) {
1891
1891
  return null;
1892
1892
  }
1893
1893
  }
1894
- function so(n, t) {
1894
+ function io(n, t) {
1895
1895
  return new Promise((e, s) => {
1896
1896
  const i = setTimeout(() => s(new Error(`timed out after ${t} ms`)), t);
1897
1897
  n.then(
@@ -1904,10 +1904,10 @@ function so(n, t) {
1904
1904
  );
1905
1905
  });
1906
1906
  }
1907
- function Mi(n, t) {
1907
+ function ki(n, t) {
1908
1908
  console.error(`[corkboard] ${n} threw`, t);
1909
1909
  }
1910
- class io {
1910
+ class no {
1911
1911
  map = /* @__PURE__ */ new Map();
1912
1912
  delivering = !1;
1913
1913
  queue = [];
@@ -1938,7 +1938,7 @@ class io {
1938
1938
  try {
1939
1939
  i(e);
1940
1940
  } catch (r) {
1941
- Mi(`"${String(t)}" listener`, r);
1941
+ ki(`"${String(t)}" listener`, r);
1942
1942
  }
1943
1943
  }
1944
1944
  clear() {
@@ -1947,29 +1947,29 @@ class io {
1947
1947
  }
1948
1948
  const F = (n, t) => {
1949
1949
  throw new $("invalid", `${n}: ${t}`);
1950
- }, B = (n) => typeof n == "string" ? JSON.stringify(n) : typeof n == "object" && n !== null ? Array.isArray(n) ? "an array" : "an object" : String(n), ki = (n) => typeof n == "object" && n !== null, Dt = (n, t, e) => {
1950
+ }, B = (n) => typeof n == "string" ? JSON.stringify(n) : typeof n == "object" && n !== null ? Array.isArray(n) ? "an array" : "an object" : String(n), Si = (n) => typeof n == "object" && n !== null, Dt = (n, t, e) => {
1951
1951
  (typeof e != "number" || !Number.isFinite(e)) && F(n, `${t} must be a finite number (got ${B(e)})`);
1952
- }, xs = (n, t, e) => {
1952
+ }, Ms = (n, t, e) => {
1953
1953
  (typeof e != "number" || !Number.isFinite(e) || e <= 0) && F(n, `${t} must be a finite number > 0 (got ${B(e)})`);
1954
- }, Yl = (n, t, e) => {
1954
+ }, Wl = (n, t, e) => {
1955
1955
  (typeof e != "number" || !Number.isFinite(e) || e < 0) && F(n, `${t} must be a finite number >= 0 (got ${B(e)})`);
1956
- }, zl = (n, t, e) => {
1956
+ }, Hl = (n, t, e) => {
1957
1957
  typeof e != "boolean" && F(n, `${t} must be a boolean (got ${B(e)})`);
1958
- }, Wl = (n, t, e, s) => {
1958
+ }, $l = (n, t, e, s) => {
1959
1959
  (typeof e != "number" || !Number.isInteger(e) || e < s) && F(n, `${t} must be an integer >= ${s} (got ${B(e)})`);
1960
- }, Hl = (n, t, e) => {
1960
+ }, Gl = (n, t, e) => {
1961
1961
  (typeof e != "number" || Number.isNaN(e) || e < 0) && F(n, `${t} must be a number >= 0, or Infinity for no cap (got ${B(e)})`);
1962
1962
  };
1963
- function $l(n, t, e, s) {
1963
+ function Vl(n, t, e, s) {
1964
1964
  s.includes(e) || F(n, `${t} must be one of ${s.map((i) => `'${i}'`).join(", ")} (got ${B(e)})`);
1965
1965
  }
1966
- function Gl(n, t, e) {
1967
- return !ki(e) || Array.isArray(e) ? F(n, `${t} must be an object (got ${B(e)})`) : e;
1966
+ function Kl(n, t, e) {
1967
+ return !Si(e) || Array.isArray(e) ? F(n, `${t} must be an object (got ${B(e)})`) : e;
1968
1968
  }
1969
- function Te(n, t) {
1970
- t.x !== void 0 && Dt(n, "x", t.x), t.y !== void 0 && Dt(n, "y", t.y), t.w !== void 0 && xs(n, "w", t.w), t.h !== void 0 && xs(n, "h", t.h), t.rot !== void 0 && Dt(n, "rot", t.rot);
1969
+ function Ae(n, t) {
1970
+ t.x !== void 0 && Dt(n, "x", t.x), t.y !== void 0 && Dt(n, "y", t.y), t.w !== void 0 && Ms(n, "w", t.w), t.h !== void 0 && Ms(n, "h", t.h), t.rot !== void 0 && Dt(n, "rot", t.rot);
1971
1971
  }
1972
- function Vl(n, t, e = !1) {
1972
+ function jl(n, t, e = !1) {
1973
1973
  if (!(t === void 0 && e)) {
1974
1974
  if (typeof t == "string") return [t];
1975
1975
  if (!Array.isArray(t)) return F(n, `ids must be a card id or an array of card ids (got ${B(t)})`);
@@ -1978,8 +1978,8 @@ function Vl(n, t, e = !1) {
1978
1978
  return t;
1979
1979
  }
1980
1980
  }
1981
- function Kl(n, t) {
1982
- if (!ki(t)) return F(n, `needs a rectangle { x0, y0, x1, y1 } (got ${B(t)})`);
1981
+ function Ql(n, t) {
1982
+ if (!Si(t)) return F(n, `needs a rectangle { x0, y0, x1, y1 } (got ${B(t)})`);
1983
1983
  for (const e of ["x0", "y0", "x1", "y1"]) Dt(n, e, t[e]);
1984
1984
  }
1985
1985
  const V = (n, t, e) => Math.max(t, Math.min(e, n));
@@ -1987,12 +1987,12 @@ function J(n, t, e, s) {
1987
1987
  const i = s / n.scale;
1988
1988
  return { tx: t - (t - n.tx) * i, ty: e - (e - n.ty) * i, scale: s };
1989
1989
  }
1990
- const no = 0.012, Ms = 20;
1991
- function ro(n, t = 0) {
1990
+ const ro = 0.012, ks = 20;
1991
+ function oo(n, t = 0) {
1992
1992
  const e = t === 1 ? n * 16 : t === 2 ? n * 800 : n;
1993
- return Math.exp(-V(e, -Ms, Ms) * no);
1993
+ return Math.exp(-V(e, -ks, ks) * ro);
1994
1994
  }
1995
- function oo(n, t, e) {
1995
+ function ao(n, t, e) {
1996
1996
  return {
1997
1997
  x0: -n.tx / n.scale,
1998
1998
  y0: -n.ty / n.scale,
@@ -2000,9 +2000,9 @@ function oo(n, t, e) {
2000
2000
  y1: (e - n.ty) / n.scale
2001
2001
  };
2002
2002
  }
2003
- const ao = 0.935, Mt = 0.012;
2004
- class lo {
2005
- constructor(t, e = { min: hi, max: li }) {
2003
+ const lo = 0.935, Mt = 0.012;
2004
+ class ho {
2005
+ constructor(t, e = { min: ci, max: hi }) {
2006
2006
  this.wake = t, this.bounds = e;
2007
2007
  }
2008
2008
  cam = { tx: 0, ty: 0, scale: 1 };
@@ -2062,13 +2062,13 @@ class lo {
2062
2062
  return this.dragging || this.fly !== null || Math.abs(this.vel.vx) > Mt || Math.abs(this.vel.vy) > Mt || this.cam.scale !== this.targetScale;
2063
2063
  }
2064
2064
  visibleRect() {
2065
- return oo(this.cam, this.width, this.height);
2065
+ return ao(this.cam, this.width, this.height);
2066
2066
  }
2067
2067
  // ── Input ──────────────────────────────────────────────────────────────────
2068
2068
  wheel(t) {
2069
2069
  if (this.fly = null, t.zoom)
2070
2070
  this.targetScale = V(
2071
- this.targetScale * ro(t.deltaY, t.deltaMode),
2071
+ this.targetScale * oo(t.deltaY, t.deltaMode),
2072
2072
  this.bounds.min,
2073
2073
  this.bounds.max
2074
2074
  ), this.anchor = { x: t.x, y: t.y };
@@ -2181,7 +2181,7 @@ class lo {
2181
2181
  const i = this.vel;
2182
2182
  if (!this.dragging && (Math.abs(i.vx) > Mt || Math.abs(i.vy) > Mt)) {
2183
2183
  e.tx += i.vx * t, e.ty += i.vy * t;
2184
- const o = Math.pow(ao, t / (1e3 / 60));
2184
+ const o = Math.pow(lo, t / (1e3 / 60));
2185
2185
  i.vx *= o, i.vy *= o, this.version++, s = !0;
2186
2186
  } else this.dragging || (i.vx = 0, i.vy = 0);
2187
2187
  const r = this.targetScale;
@@ -2195,42 +2195,42 @@ class lo {
2195
2195
  return s || this.dragging;
2196
2196
  }
2197
2197
  }
2198
- const ho = 24, co = 128, uo = 480, fo = [
2199
- ho,
2198
+ const co = 24, uo = 128, fo = 480, po = [
2200
2199
  co,
2201
- uo
2202
- ], po = 1.25, mo = 0.8, go = 3, yo = 12;
2203
- function wo(n, t = null, e = fo) {
2200
+ uo,
2201
+ fo
2202
+ ], mo = 1.25, go = 0.8, yo = 3, wo = 12;
2203
+ function vo(n, t = null, e = po) {
2204
2204
  const s = n < e[0] ? 0 : n < e[1] ? 1 : n < e[2] ? 2 : 3;
2205
2205
  let i = t ?? s;
2206
- for (; i < go && n > e[i] * po; ) i++;
2207
- for (; i > 0 && n < e[i - 1] * mo; ) i--;
2206
+ for (; i < yo && n > e[i] * mo; ) i++;
2207
+ for (; i > 0 && n < e[i - 1] * go; ) i--;
2208
2208
  return i;
2209
2209
  }
2210
2210
  const re = [256, 512], oe = [1024, 1600];
2211
2211
  function ae(n) {
2212
2212
  return n <= re[0] / 0.9 ? re[0] : re[1];
2213
2213
  }
2214
- function vo(n) {
2214
+ function bo(n) {
2215
2215
  return n <= oe[0] / 0.9 ? oe[0] : oe[1];
2216
2216
  }
2217
- const Be = (n, t, e) => Math.min(e, Math.max(t, n));
2217
+ const Xe = (n, t, e) => Math.min(e, Math.max(t, n));
2218
2218
  function le(n, t) {
2219
- return { ...t, radius: Be(n.radius, 0, Math.min(t.w, t.h) / 2) };
2219
+ return { ...t, radius: Xe(n.radius, 0, Math.min(t.w, t.h) / 2) };
2220
2220
  }
2221
- function bo(n) {
2222
- return Be(Math.ceil(n / 2), 3, 14);
2221
+ function xo(n) {
2222
+ return Xe(Math.ceil(n / 2), 3, 14);
2223
2223
  }
2224
- function xo(n, t, e = 0, s = []) {
2224
+ function Mo(n, t, e = 0, s = []) {
2225
2225
  s.length = 0;
2226
2226
  const i = n.w * t.scale / 2 + e, r = n.h * t.scale / 2 + e;
2227
2227
  if (i <= 0 || r <= 0) return s;
2228
2228
  const o = t.tx + (n.x + n.w / 2) * t.scale, a = t.ty + (n.y + n.h / 2) * t.scale, l = n.rot * U, h = Math.cos(l), c = Math.sin(l), d = (p, g) => {
2229
2229
  s.push(o + p * h - g * c, a + p * c + g * h);
2230
- }, u = Be((n.radius ?? 0) * t.scale + e, 0, Math.min(i, r));
2230
+ }, u = Xe((n.radius ?? 0) * t.scale + e, 0, Math.min(i, r));
2231
2231
  if (u < 0.5)
2232
2232
  return d(-i, -r), d(i, -r), d(i, r), d(-i, r), s;
2233
- const f = bo(u), m = [
2233
+ const f = xo(u), m = [
2234
2234
  [i - u, -(r - u), -Math.PI / 2],
2235
2235
  [i - u, r - u, 0],
2236
2236
  [-(i - u), r - u, Math.PI / 2],
@@ -2243,29 +2243,29 @@ function xo(n, t, e = 0, s = []) {
2243
2243
  }
2244
2244
  return s;
2245
2245
  }
2246
- const Mo = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", ko = 80, So = 3, Y = 3.5, ks = 16, To = 5, Ao = 4, Ss = 4, Eo = 11, Po = "=", Lo = [
2246
+ const ko = "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif", So = 80, To = 3, Y = 3.5, Ss = 16, Ao = 5, Eo = 4, Ts = 4, Po = 11, Lo = "=", Io = [
2247
2247
  [-1, -1],
2248
2248
  [1, -1],
2249
2249
  [1, 1],
2250
2250
  [-1, 1]
2251
- ], Xe = (n) => n.kind === "gap" || n.kind === "width", he = (n) => Math.round(n * 100);
2252
- function Io(n) {
2253
- return Xe(n) ? `${n.kind}|${n.axis}|${he(n.from)}|${he(n.to)}` : `${n.kind}|${n.axis}|${he(n.at)}`;
2251
+ ], qe = (n) => n.kind === "gap" || n.kind === "width", he = (n) => Math.round(n * 100);
2252
+ function Ro(n) {
2253
+ return qe(n) ? `${n.kind}|${n.axis}|${he(n.from)}|${he(n.to)}` : `${n.kind}|${n.axis}|${he(n.at)}`;
2254
2254
  }
2255
- function Ro(n, t) {
2255
+ function Co(n, t) {
2256
2256
  if (n.at !== t.at || n.from !== t.from || n.to !== t.to) return !1;
2257
- if (Xe(n)) return n.label === t.label;
2257
+ if (qe(n)) return n.label === t.label;
2258
2258
  const e = n.marks, s = t.marks;
2259
2259
  if (e === s) return !0;
2260
2260
  if (!e || !s || e.length !== s.length) return !1;
2261
2261
  for (let i = 0; i < e.length; i++) if (e[i] !== s[i]) return !1;
2262
2262
  return !0;
2263
2263
  }
2264
- class Co {
2264
+ class _o {
2265
2265
  container = new yt();
2266
2266
  // Lines, caps and marks; the pills go on top of them, then the labels.
2267
- lines = new be();
2268
- pillBg = new be();
2267
+ lines = new xe();
2268
+ pillBg = new xe();
2269
2269
  pillStyle;
2270
2270
  pills = [];
2271
2271
  pillsUsed = 0;
@@ -2279,9 +2279,9 @@ class Co {
2279
2279
  // The renderer's pixel ratio (a hairline is one device pixel wide).
2280
2280
  dpr;
2281
2281
  constructor(t, e = 1) {
2282
- this.dpr = e, this.container.eventMode = "none", this.lines.eventMode = "none", this.pillBg.eventMode = "none", this.container.addChild(this.lines, this.pillBg), this.color = Ve(t), this.pillStyle = new nn({
2283
- fontFamily: Mo,
2284
- fontSize: Eo,
2282
+ this.dpr = e, this.container.eventMode = "none", this.lines.eventMode = "none", this.pillBg.eventMode = "none", this.container.addChild(this.lines, this.pillBg), this.color = Ke(t), this.pillStyle = new rn({
2283
+ fontFamily: ko,
2284
+ fontSize: Po,
2285
2285
  fontWeight: "600",
2286
2286
  fill: t.onGuide ?? 16777215
2287
2287
  });
@@ -2291,7 +2291,7 @@ class Co {
2291
2291
  t !== this.dpr && (this.dpr = t, this.dirty = !0);
2292
2292
  }
2293
2293
  setTheme(t) {
2294
- this.color = Ve(t), this.pillStyle.fill = t.onGuide ?? 16777215, this.dirty = !0;
2294
+ this.color = Ke(t), this.pillStyle.fill = t.onGuide ?? 16777215, this.dirty = !0;
2295
2295
  }
2296
2296
  // The guides to show now. Returns true when that changes anything on screen (the caller asks for a
2297
2297
  // frame); the same guides again (a pointer move that stays snapped) change nothing.
@@ -2300,11 +2300,11 @@ class Co {
2300
2300
  const s = /* @__PURE__ */ new Set(), i = [], r = /* @__PURE__ */ new Map();
2301
2301
  for (const o of this.entries) r.set(o.key, o);
2302
2302
  for (const o of t) {
2303
- const a = Io(o);
2303
+ const a = Ro(o);
2304
2304
  if (s.has(a)) continue;
2305
2305
  s.add(a);
2306
2306
  const l = r.get(a);
2307
- l ? ((l.target !== 1 || !Ro(l.guide, o)) && (e = !0), l.guide = o, l.target = 1, i.push(l), r.delete(a)) : (i.push({ key: a, guide: o, alpha: 0, target: 1 }), e = !0);
2307
+ l ? ((l.target !== 1 || !Co(l.guide, o)) && (e = !0), l.guide = o, l.target = 1, i.push(l), r.delete(a)) : (i.push({ key: a, guide: o, alpha: 0, target: 1 }), e = !0);
2308
2308
  }
2309
2309
  for (const o of r.values())
2310
2310
  o.target !== 0 && (e = !0), o.target = 0, i.push(o);
@@ -2336,7 +2336,7 @@ class Co {
2336
2336
  const s = Number.isFinite(this.lastNow) ? Math.min(50, Math.max(0, e - this.lastNow)) : 16;
2337
2337
  this.lastNow = e;
2338
2338
  let i = !1;
2339
- const r = s / ko;
2339
+ const r = s / So;
2340
2340
  let o = 0;
2341
2341
  for (const h of this.entries)
2342
2342
  h.alpha !== h.target && (h.alpha = h.target === 1 ? Math.min(1, h.alpha + r) : Math.max(0, h.alpha - r), i = !0), !(h.target === 0 && h.alpha === 0) && (this.entries[o++] = h);
@@ -2352,7 +2352,7 @@ class Co {
2352
2352
  let i = 0;
2353
2353
  for (let r = 0; r < 2; r++)
2354
2354
  for (const o of this.entries) {
2355
- const a = o.guide, l = Xe(a) ? 1 : 0;
2355
+ const a = o.guide, l = qe(a) ? 1 : 0;
2356
2356
  l !== r || o.alpha <= 0 || (l === 1 ? i = this.measure(a, t, o.alpha, i) : this.line(a, t, o.alpha));
2357
2357
  }
2358
2358
  for (let r = i; r < this.pillsUsed; r++) this.pills[r].text.visible = !1;
@@ -2381,13 +2381,13 @@ class Co {
2381
2381
  this.hairline(t.axis, o, l, h), i.fill({ color: this.color, alpha: s });
2382
2382
  const c = t.marks;
2383
2383
  if (!c || c.length === 0) return;
2384
- const d = 1 / this.dpr, u = this.dpr >= 2 ? 2 : 1, f = Math.max(2, Math.round(So * this.dpr) - (u - 1)), m = u === 1 ? 0.5 : 1.5, p = u === 1 ? 2 * f + 0.5 : 2 * f + 1.5, g = u === 1 ? d / 2 : d, y = this.cell(o) + g;
2384
+ const d = 1 / this.dpr, u = this.dpr >= 2 ? 2 : 1, f = Math.max(2, Math.round(To * this.dpr) - (u - 1)), m = u === 1 ? 0.5 : 1.5, p = u === 1 ? 2 * f + 0.5 : 2 * f + 1.5, g = u === 1 ? d / 2 : d, y = this.cell(o) + g;
2385
2385
  for (const v of c) {
2386
2386
  const w = this.cell(a + v * e.scale) + g, b = r ? y : w, k = r ? w : y;
2387
2387
  for (const x of [1, -1]) {
2388
2388
  const M = new Array(8);
2389
2389
  let T = 0;
2390
- for (const [S, L] of Lo)
2390
+ for (const [S, L] of Io)
2391
2391
  M[T++] = b + (S * m + L * p) / 2 * d, M[T++] = k + x * (L * p - S * m) / 2 * d;
2392
2392
  i.poly(M, !0);
2393
2393
  }
@@ -2400,13 +2400,13 @@ class Co {
2400
2400
  this.hairline(d, a, h, c);
2401
2401
  const f = 1 / this.dpr, m = this.snap(Math.min(h, c)), p = this.snap(Math.max(h, c)), g = this.cell(a) + f / 2;
2402
2402
  this.hairline(u, m, g - Y, g + Y), this.hairline(u, p, g - Y, g + Y), r.fill({ color: this.color, alpha: s });
2403
- const y = t.kind === "width" ? Po : String(t.label), v = this.pill(i, y), w = v.w, b = ks, k = p - m;
2403
+ const y = t.kind === "width" ? Lo : String(t.label), v = this.pill(i, y), w = v.w, b = Ss, k = p - m;
2404
2404
  let x, M;
2405
- o ? (x = (m + p) / 2, M = k >= w + 4 * Y ? g : g + Y + Ss + b / 2) : (M = (m + p) / 2, x = k >= b + 4 * Y ? g : g + Y + Ss + w / 2);
2405
+ o ? (x = (m + p) / 2, M = k >= w + 4 * Y ? g : g + Y + Ts + b / 2) : (M = (m + p) / 2, x = k >= b + 4 * Y ? g : g + Y + Ts + w / 2);
2406
2406
  const T = this.snap(x - w / 2), S = this.snap(M - b / 2);
2407
2407
  if (this.overlapsPlaced(T, S, w, b))
2408
2408
  return i;
2409
- this.placed.push(T, S, w, b), this.pillBg.roundRect(T, S, w, b, Ao).fill({ color: this.color, alpha: s });
2409
+ this.placed.push(T, S, w, b), this.pillBg.roundRect(T, S, w, b, Eo).fill({ color: this.color, alpha: s });
2410
2410
  const L = v.text;
2411
2411
  return L.position.set(this.snap(T + (w - L.width) / 2), this.snap(S + (b - L.height) / 2)), L.alpha = s, L.visible = !0, i + 1;
2412
2412
  }
@@ -2421,20 +2421,20 @@ class Co {
2421
2421
  pill(t, e) {
2422
2422
  let s = this.pills[t];
2423
2423
  if (!s) {
2424
- const i = new rn({ text: "", style: this.pillStyle });
2424
+ const i = new on({ text: "", style: this.pillStyle });
2425
2425
  i.eventMode = "none", i.visible = !1, this.container.addChild(i), s = { text: i, label: "", w: 0 }, this.pills.push(s);
2426
2426
  }
2427
- return s.label !== e && (s.text.text = e, s.label = e, s.w = Math.max(ks, Math.ceil(s.text.width + 2 * To))), s;
2427
+ return s.label !== e && (s.text.text = e, s.label = e, s.w = Math.max(Ss, Math.ceil(s.text.width + 2 * Ao))), s;
2428
2428
  }
2429
2429
  }
2430
- const _o = 8, Ts = 1.5, Oo = () => {
2430
+ const Oo = 8, As = 1.5, No = () => {
2431
2431
  };
2432
- class No {
2433
- constructor(t, e = Oo, s = 1) {
2434
- this.wake = e, this.theme = t, this.container.eventMode = "none", this.g.eventMode = "none", this.guides = new Co(t, s), this.container.addChild(this.g, this.guides.container);
2432
+ class Do {
2433
+ constructor(t, e = No, s = 1) {
2434
+ this.wake = e, this.theme = t, this.container.eventMode = "none", this.g.eventMode = "none", this.guides = new _o(t, s), this.container.addChild(this.g, this.guides.container);
2435
2435
  }
2436
2436
  container = new yt();
2437
- g = new be();
2437
+ g = new xe();
2438
2438
  theme;
2439
2439
  selection = null;
2440
2440
  hover = null;
@@ -2494,11 +2494,11 @@ class No {
2494
2494
  if (l) {
2495
2495
  for (const h of l.members)
2496
2496
  this.rectPath(i, h, t), i.stroke({ width: 1, color: r.accent, alpha: 0.85 });
2497
- if (this.rectPath(i, l.frame, t), i.stroke({ width: Ts, color: r.accent }), l.showHandles) {
2498
- const h = _o;
2497
+ if (this.rectPath(i, l.frame, t), i.stroke({ width: As, color: r.accent }), l.showHandles) {
2498
+ const h = Oo;
2499
2499
  for (const c of l.handles) {
2500
2500
  const d = o(c.x), u = a(c.y);
2501
- i.rect(d - h / 2, u - h / 2, h, h), i.fill({ color: 16777215 }).stroke({ width: Ts, color: r.accent });
2501
+ i.rect(d - h / 2, u - h / 2, h, h), i.fill({ color: 16777215 }).stroke({ width: As, color: r.accent });
2502
2502
  }
2503
2503
  }
2504
2504
  }
@@ -2511,11 +2511,11 @@ class No {
2511
2511
  // A closed path along the outline of a world rect, in screen space: square or rounded corners (the
2512
2512
  // element's own radius scaled with the zoom).
2513
2513
  rectPath(t, e, s) {
2514
- t.poly(xo(e, s, 0, this.pts), !0);
2514
+ t.poly(Mo(e, s, 0, this.pts), !0);
2515
2515
  }
2516
2516
  }
2517
2517
  const kt = /* @__PURE__ */ new WeakMap();
2518
- function Do(n) {
2518
+ function Fo(n) {
2519
2519
  let t = kt.get(n);
2520
2520
  t || (t = { count: 0, autoStart: n.autoStart, started: n.started }, kt.set(n, t)), t.count++, n.autoStart = !1, n.stop();
2521
2521
  let e = !1;
@@ -2526,7 +2526,7 @@ function Do(n) {
2526
2526
  !s || --s.count > 0 || (kt.delete(n), n.autoStart = s.autoStart, s.started && n.start());
2527
2527
  };
2528
2528
  }
2529
- const Si = `function Z(t) {
2529
+ const Ti = `function Z(t) {
2530
2530
  let { PI: l, min: o, max: e, cos: i, round: f } = Math, n = t[0] | t[1] << 8 | t[2] << 16, r = t[3] | t[4] << 8, c = (n & 63) / 63, s = (n >> 6 & 63) / 31.5 - 1, E = (n >> 12 & 63) / 31.5 - 1, d = (n >> 18 & 31) / 31, h = n >> 23, I = (r >> 3 & 63) / 63, z = (r >> 9 & 63) / 63, T = r >> 15, R = e(3, T ? h ? 5 : 7 : r & 7), x = e(3, T ? r & 7 : h ? 5 : 7), G = h ? (t[5] & 15) / 15 : 1, Q = (t[5] >> 4) / 15, V = h ? 6 : 5, B = 0, C = (M, p, _) => {
2531
2531
  let u = [];
2532
2532
  for (let b = 0; b < p; b++)
@@ -2644,12 +2644,12 @@ self.onmessage = (t) => {
2644
2644
  };
2645
2645
 
2646
2646
  `;
2647
- let Fo;
2648
- const Bo = () => Fo ??= typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", Si], { type: "text/javascript;charset=utf-8" });
2649
- function Xo(n) {
2647
+ let Bo;
2648
+ const Xo = () => Bo ??= typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", Ti], { type: "text/javascript;charset=utf-8" });
2649
+ function qo(n) {
2650
2650
  let t;
2651
2651
  try {
2652
- const e = Bo();
2652
+ const e = Xo();
2653
2653
  if (t = e && (self.URL || self.webkitURL).createObjectURL(e), !t) throw "";
2654
2654
  const s = new Worker(t, {
2655
2655
  type: "module",
@@ -2660,7 +2660,7 @@ function Xo(n) {
2660
2660
  }), s;
2661
2661
  } catch {
2662
2662
  return new Worker(
2663
- "data:text/javascript;charset=utf-8," + encodeURIComponent(Si),
2663
+ "data:text/javascript;charset=utf-8," + encodeURIComponent(Ti),
2664
2664
  {
2665
2665
  type: "module",
2666
2666
  name: n?.name
@@ -2668,16 +2668,16 @@ function Xo(n) {
2668
2668
  );
2669
2669
  }
2670
2670
  }
2671
- function Ti(n) {
2671
+ function Ai(n) {
2672
2672
  return Math.floor(n.pageSize / (n.cell + 2 * n.gutter));
2673
2673
  }
2674
- function qo(n) {
2675
- const t = Ti(n);
2674
+ function Uo(n) {
2675
+ const t = Ai(n);
2676
2676
  return t * t;
2677
2677
  }
2678
- class As {
2678
+ class Es {
2679
2679
  constructor(t, e, s) {
2680
- this.createPage = e, this.destroyPage = s, this.spec = t, this.stride = t.cell + 2 * t.gutter, this.perRow = Ti(t);
2680
+ this.createPage = e, this.destroyPage = s, this.spec = t, this.stride = t.cell + 2 * t.gutter, this.perRow = Ai(t);
2681
2681
  }
2682
2682
  spec;
2683
2683
  perRow;
@@ -2724,7 +2724,7 @@ class As {
2724
2724
  this.pages = [];
2725
2725
  }
2726
2726
  }
2727
- function Es(n, t, e, s = 0.85) {
2727
+ function Ps(n, t, e, s = 0.85) {
2728
2728
  if (t <= e) return [];
2729
2729
  const i = e * s, r = [], o = n.filter((l) => !l.pinned).sort((l, h) => l.last - h.last);
2730
2730
  let a = t;
@@ -2734,7 +2734,7 @@ function Es(n, t, e, s = 0.85) {
2734
2734
  }
2735
2735
  return r;
2736
2736
  }
2737
- class Uo {
2737
+ class Yo {
2738
2738
  constructor(t = 2) {
2739
2739
  this.delay = t;
2740
2740
  }
@@ -2777,13 +2777,13 @@ class Uo {
2777
2777
  }
2778
2778
  }
2779
2779
  }
2780
- const Ae = 4 / 3, ce = { pageSize: 1024, cell: 32, gutter: 2 }, st = { pageSize: 2048, cell: 128, gutter: 4 }, Yo = 4, zo = 3e4, Ee = 1e6, Wo = st.pageSize ** 2 * 4 * Ae;
2781
- function Ho(n) {
2780
+ const Ee = 4 / 3, ce = { pageSize: 1024, cell: 32, gutter: 2 }, st = { pageSize: 2048, cell: 128, gutter: 4 }, zo = 4, Wo = 3e4, Pe = 1e6, Ho = st.pageSize ** 2 * 4 * Ee;
2781
+ function $o(n) {
2782
2782
  const t = n;
2783
2783
  return !!t && typeof t._activateLocation == "function" && typeof t._setBoundTexture == "function" && typeof t._premultiplyAlpha == "boolean";
2784
2784
  }
2785
- let Ps = !1;
2786
- function $o(n) {
2785
+ let Ls = !1;
2786
+ function Go(n) {
2787
2787
  if (n !== void 0)
2788
2788
  try {
2789
2789
  return new URL(n, typeof document < "u" ? document.baseURI : void 0).href;
@@ -2793,15 +2793,15 @@ function $o(n) {
2793
2793
  }
2794
2794
  const z = (n, t) => n.id * 4 + t;
2795
2795
  let de = new Uint8Array(0);
2796
- function Go(n) {
2796
+ function Vo(n) {
2797
2797
  return de.length < n && (de = new Uint8Array(n)), de;
2798
2798
  }
2799
- const Ls = (n) => n >= 2;
2800
- class Vo {
2799
+ const Is = (n) => n >= 2;
2800
+ class Ko {
2801
2801
  constructor(t, e) {
2802
- this.opts = e, this.texSys = t.texture, this.gl = t.gl, this.privateUpload = Ho(this.texSys), !this.privateUpload && !Ps && (Ps = !0, console.warn(
2802
+ this.opts = e, this.texSys = t.texture, this.gl = t.gl, this.privateUpload = $o(this.texSys), !this.privateUpload && !Ls && (Ls = !0, console.warn(
2803
2803
  "corkboard: the Pixi texture system lacks the internals the fast upload path uses; falling back to the public (slower) path."
2804
- )), this.retire = new Uo(e.retireDelay ?? 2), this.border = e.border ?? "", this.atlas0 = this.makeAtlas0(), this.atlas1 = this.makeAtlas1();
2804
+ )), this.retire = new Yo(e.retireDelay ?? 2), this.border = e.border ?? "", this.atlas0 = this.makeAtlas0(), this.atlas1 = this.makeAtlas1();
2805
2805
  try {
2806
2806
  this.spawnWorkers(e.workers);
2807
2807
  } catch (s) {
@@ -2863,14 +2863,14 @@ class Vo {
2863
2863
  peakBytes: 0
2864
2864
  };
2865
2865
  makeAtlas0() {
2866
- return new As(
2866
+ return new Es(
2867
2867
  ce,
2868
2868
  () => this.createPage(ce.pageSize, !1, "l0-page"),
2869
2869
  (t) => this.destroyPage(t)
2870
2870
  );
2871
2871
  }
2872
2872
  makeAtlas1() {
2873
- return new As(
2873
+ return new Es(
2874
2874
  st,
2875
2875
  () => this.createPage(st.pageSize, !0, "l1-page"),
2876
2876
  (t) => this.destroyPage(t)
@@ -2878,7 +2878,7 @@ class Vo {
2878
2878
  }
2879
2879
  spawnWorkers(t) {
2880
2880
  for (let e = 0; e < t; e++) {
2881
- const s = this.opts.workerUrl ? new Worker(this.opts.workerUrl, { type: "module" }) : new Xo();
2881
+ const s = this.opts.workerUrl ? new Worker(this.opts.workerUrl, { type: "module" }) : new qo();
2882
2882
  s.onmessage = (i) => this.onWorker(e, i.data), s.onerror = (i) => this.onWorkerError(e, i), this.workers.push(s), this.workerLoad.push(0), this.workerDead.push(!1), this.liveWorkers++;
2883
2883
  }
2884
2884
  }
@@ -3003,11 +3003,11 @@ class Vo {
3003
3003
  if (this.liveWorkers === 0 && this.workers.length > 0) return;
3004
3004
  const s = /* @__PURE__ */ new Set();
3005
3005
  for (const i of t) {
3006
- const r = z(i.card, i.level), o = this.cards.get(i.card.id), a = o?.tex[i.level], l = Ls(i.level) && i.bucket ? !o?.ownCapped[i.level] && (o?.ownLong[i.level] ?? 0) < i.bucket : !1;
3006
+ const r = z(i.card, i.level), o = this.cards.get(i.card.id), a = o?.tex[i.level], l = Is(i.level) && i.bucket ? !o?.ownCapped[i.level] && (o?.ownLong[i.level] ?? 0) < i.bucket : !1;
3007
3007
  if (a && !l || this.decodedKeys.has(r) || (i.level === 0 ? !i.card.thumbhash : !this.urlOf(i.card, i.level))) continue;
3008
3008
  const h = this.failedAt.get(r);
3009
3009
  if (h !== void 0) {
3010
- if (e - h < zo) continue;
3010
+ if (e - h < Wo) continue;
3011
3011
  this.failedAt.delete(r);
3012
3012
  }
3013
3013
  s.add(r);
@@ -3044,10 +3044,10 @@ class Vo {
3044
3044
  this.reqs.delete(t.rid);
3045
3045
  }
3046
3046
  pump() {
3047
- const t = this.liveWorkers * Yo;
3047
+ const t = this.liveWorkers * zo;
3048
3048
  if (!(this.inflight >= t || this.queue.length === 0))
3049
3049
  for (this.queue.sort(
3050
- (e, s) => +(e.dist >= Ee) - +(s.dist >= Ee) || e.level - s.level || e.dist - s.dist
3050
+ (e, s) => +(e.dist >= Pe) - +(s.dist >= Pe) || e.level - s.level || e.dist - s.dist
3051
3051
  ); this.inflight < t && this.queue.length > 0; ) {
3052
3052
  const e = this.queue.shift();
3053
3053
  let s = -1;
@@ -3059,7 +3059,7 @@ class Vo {
3059
3059
  rid: e.rid,
3060
3060
  level: e.level,
3061
3061
  hash: e.level === 0 ? i.thumbhash : void 0,
3062
- url: $o(this.urlOf(i, e.level)),
3062
+ url: Go(this.urlOf(i, e.level)),
3063
3063
  maxLong: e.maxLong,
3064
3064
  soft: this.opts.softCanvas,
3065
3065
  radiusWorld: i.radius,
@@ -3134,9 +3134,9 @@ class Vo {
3134
3134
  const { req: s, bitmap: i, w: r, h: o } = t, a = s.card, l = this.cardTex(a.id);
3135
3135
  l.last = e;
3136
3136
  const h = s.level;
3137
- if (Ls(h)) {
3137
+ if (Is(h)) {
3138
3138
  l.last2 = e;
3139
- const f = new on({
3139
+ const f = new an({
3140
3140
  resource: i,
3141
3141
  width: r,
3142
3142
  height: o,
@@ -3147,7 +3147,7 @@ class Vo {
3147
3147
  });
3148
3148
  this.texSys.initSource(f), i.close();
3149
3149
  const m = l.tex[h];
3150
- m && (this.retireTexture(m, !0), this.ownBytes -= l.ownBytes[h]), l.tex[h] = new it({ source: f }), l.ownLong[h] = Math.max(r, o), l.ownCapped[h] = l.ownLong[h] < s.maxLong, l.ownBytes[h] = r * o * 4 * Ae, this.ownBytes += l.ownBytes[h], this.releaseOutgoing(l);
3150
+ m && (this.retireTexture(m, !0), this.ownBytes -= l.ownBytes[h]), l.tex[h] = new it({ source: f }), l.ownLong[h] = Math.max(r, o), l.ownCapped[h] = l.ownLong[h] < s.maxLong, l.ownBytes[h] = r * o * 4 * Ee, this.ownBytes += l.ownBytes[h], this.releaseOutgoing(l);
3151
3151
  return;
3152
3152
  }
3153
3153
  const c = h === 0 ? this.atlas0 : this.atlas1, d = l.cell[h];
@@ -3158,7 +3158,7 @@ class Vo {
3158
3158
  const u = c.alloc();
3159
3159
  this.uploadCell(u, i, r, o, h === 0 ? ce.cell : st.cell), i.close(), u.page.dirty = !0, l.cell[h] = u, l.tex[h] = new it({
3160
3160
  source: u.page.source,
3161
- frame: new an(u.x, u.y, r, o)
3161
+ frame: new ln(u.x, u.y, r, o)
3162
3162
  }), h === 1 && this.releaseOutgoing(l);
3163
3163
  }
3164
3164
  cardTex(t) {
@@ -3248,7 +3248,7 @@ class Vo {
3248
3248
  }
3249
3249
  // ── GL ─────────────────────────────────────────────────────────────────────
3250
3250
  createPage(t, e, s) {
3251
- const i = new ln({
3251
+ const i = new hn({
3252
3252
  width: t,
3253
3253
  height: t,
3254
3254
  format: "rgba8unorm",
@@ -3262,7 +3262,7 @@ class Vo {
3262
3262
  label: s
3263
3263
  });
3264
3264
  this.texSys.initSource(i);
3265
- const r = t * t * 4 * (e ? Ae : 1);
3265
+ const r = t * t * 4 * (e ? Ee : 1);
3266
3266
  return this.pageBytes += r, { source: i, bytes: r, mips: e, dirty: !1 };
3267
3267
  }
3268
3268
  destroyPage(t) {
@@ -3277,7 +3277,7 @@ class Vo {
3277
3277
  const o = this.gl, { x: a, y: l } = t, h = this.bindPage(t.page);
3278
3278
  let c = !1;
3279
3279
  if (this.privateUpload ? this.texSys._premultiplyAlpha || (o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0), this.texSys._premultiplyAlpha = !0) : o.getParameter(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL) || (o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0), c = !0), t.reused && (s < r || i < r)) {
3280
- const d = Go(r * r * 4);
3280
+ const d = Vo(r * r * 4);
3281
3281
  s < r && o.texSubImage2D(h.target, 0, a + s, l, r - s, r, o.RGBA, o.UNSIGNED_BYTE, d), i < r && o.texSubImage2D(h.target, 0, a, l + i, s, r - i, o.RGBA, o.UNSIGNED_BYTE, d);
3282
3282
  }
3283
3283
  o.texSubImage2D(h.target, 0, a, l, o.RGBA, o.UNSIGNED_BYTE, e), c && o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1);
@@ -3308,15 +3308,15 @@ class Vo {
3308
3308
  bytes: r.ownBytes[o],
3309
3309
  pinned: this.keep(i, o)
3310
3310
  });
3311
- for (const i of Es(s, e, this.opts.budgetBytes)) {
3311
+ for (const i of Ps(s, e, this.opts.budgetBytes)) {
3312
3312
  const r = i >> 2, o = i & 3, a = this.cards.get(r);
3313
3313
  this.retireTexture(a.tex[o], !0), a.tex[o] = null, this.ownBytes -= a.ownBytes[o], a.ownBytes[o] = 0, a.ownLong[o] = 0, a.ownCapped[o] = !1, this.evicted.push(r), o === 2 ? this.stats.evictedL2++ : this.stats.evictedL3++;
3314
3314
  }
3315
3315
  if (this.totalBytes > this.opts.budgetBytes * 0.85) {
3316
- const i = Wo / qo(st), r = [];
3316
+ const i = Ho / Uo(st), r = [];
3317
3317
  for (const [o, a] of this.cards)
3318
3318
  a.cell[1] && r.push({ id: o, last: a.last, bytes: i, pinned: this.keep(o, 1) });
3319
- for (const o of Es(r, this.totalBytes, this.opts.budgetBytes)) {
3319
+ for (const o of Ps(r, this.totalBytes, this.opts.budgetBytes)) {
3320
3320
  const a = this.cards.get(o);
3321
3321
  this.retireTexture(a.tex[1], !1), a.tex[1] = null, this.releaseCell(this.atlas1, a.cell[1]), a.cell[1] = null, this.evicted.push(o), this.stats.evictedL1++;
3322
3322
  }
@@ -3362,7 +3362,7 @@ class X {
3362
3362
  placedW = Number.NaN;
3363
3363
  placedH = Number.NaN;
3364
3364
  constructor() {
3365
- this.sprite = new hn(it.WHITE), this.sprite.anchor.set(0.5), this.sprite.eventMode = "none", this.display.eventMode = "none", this.display.addChild(this.sprite);
3365
+ this.sprite = new cn(it.WHITE), this.sprite.anchor.set(0.5), this.sprite.eventMode = "none", this.display.eventMode = "none", this.display.addChild(this.sprite);
3366
3366
  }
3367
3367
  get kind() {
3368
3368
  return this.el?.kind ?? "image";
@@ -3406,24 +3406,24 @@ class X {
3406
3406
  // A flat well: the media's own `color` when it has one, else the theme's.
3407
3407
  paintPlaceholder(t) {
3408
3408
  const e = this.sprite, s = e.width, i = e.height, r = this.el?.media.color;
3409
- e.texture = it.WHITE, e.tint = (r !== void 0 ? sn(r) : null) ?? t.theme.well, e.width = s, e.height = i, this.shown = -1;
3409
+ e.texture = it.WHITE, e.tint = (r !== void 0 ? nn(r) : null) ?? t.theme.well, e.width = s, e.height = i, this.shown = -1;
3410
3410
  }
3411
3411
  unmount() {
3412
3412
  this.el = null, this.card = null, this.shown = -1, this.placedW = Number.NaN, this.placedH = Number.NaN;
3413
3413
  }
3414
3414
  }
3415
- const Ai = {
3415
+ const Ei = {
3416
3416
  image: { variant: "media", create: () => new X(), textured: !0 },
3417
3417
  video: { variant: "media", create: () => new X(), textured: !0 },
3418
3418
  // The poster of an embed is its texture; the live iframe is a DOM layer (src/embed/*).
3419
3419
  embed: { variant: "media", create: () => new X(), textured: !0 }
3420
3420
  };
3421
- class Ko {
3421
+ class jo {
3422
3422
  pools = /* @__PURE__ */ new Map();
3423
3423
  created = 0;
3424
3424
  reused = 0;
3425
3425
  acquire(t) {
3426
- const e = Ai[t], s = this.pools.get(e.variant)?.pop();
3426
+ const e = Ei[t], s = this.pools.get(e.variant)?.pop();
3427
3427
  return s ? (this.reused++, s) : (this.created++, e.create());
3428
3428
  }
3429
3429
  release(t) {
@@ -3439,31 +3439,31 @@ class Ko {
3439
3439
  this.pools.clear();
3440
3440
  }
3441
3441
  }
3442
- const tt = (n) => Ai[n], jo = 100, Qo = 140, pt = 24, Is = 0.1, Zo = 5, Jo = 1, ta = 0.01, R = (n) => Math.round(n * 100) / 100;
3442
+ const tt = (n) => Ei[n], Qo = 100, Zo = 140, pt = 24, Rs = 0.1, Jo = 5, ta = 1, ea = 0.01, R = (n) => Math.round(n * 100) / 100;
3443
3443
  function St(n, t) {
3444
3444
  if (t === 0) return null;
3445
3445
  const e = Array.from(n.subarray(0, t)).sort((i, r) => i - r), s = (i) => R(e[Math.min(t - 1, Math.floor((t - 1) * i))]);
3446
3446
  return { n: t, p50: s(0.5), p95: s(0.95), max: R(e[t - 1]) };
3447
3447
  }
3448
- const ea = Object.freeze([]);
3449
- function sa(n, t) {
3448
+ const sa = Object.freeze([]);
3449
+ function ia(n, t) {
3450
3450
  if (n === t) return !0;
3451
3451
  if (!n || !t || n.length !== t.length) return !1;
3452
3452
  for (let e = 0; e < n.length; e++) if (n[e] !== t[e]) return !1;
3453
3453
  return !0;
3454
3454
  }
3455
- function ia(n) {
3455
+ function na(n) {
3456
3456
  const t = atob(n.replace(/-/g, "+").replace(/_/g, "/")), e = new Uint8Array(t.length);
3457
3457
  for (let s = 0; s < t.length; s++) e[s] = t.charCodeAt(s);
3458
3458
  return e;
3459
3459
  }
3460
- function na(n) {
3461
- const t = n.minScale !== void 0 && n.minScale > 0 ? n.minScale : hi, e = n.maxScale !== void 0 && n.maxScale >= t ? n.maxScale : Math.max(li, t);
3460
+ function ra(n) {
3461
+ const t = n.minScale !== void 0 && n.minScale > 0 ? n.minScale : ci, e = n.maxScale !== void 0 && n.maxScale >= t ? n.maxScale : Math.max(hi, t);
3462
3462
  return { min: t, max: e };
3463
3463
  }
3464
- class Pe {
3464
+ class Le {
3465
3465
  constructor(t, e, s, i, r) {
3466
- this.unparkTicker = r, this.app = t, this.hostEl = e, this.onError = s.onError, this.onContextLost = s.onContextLost, this.onContextRestored = s.onContextRestored, this.onRender = s.onRender, this.dpr = i, this.theme = s.theme ?? Ke, this.showGrid = s.grid ?? !0, this.renderer = t.renderer, this.canvas = t.canvas, this.opts = {
3466
+ this.unparkTicker = r, this.app = t, this.hostEl = e, this.onError = s.onError, this.onContextLost = s.onContextLost, this.onContextRestored = s.onContextRestored, this.onRender = s.onRender, this.dpr = i, this.theme = s.theme ?? je, this.showGrid = s.grid ?? !0, this.renderer = t.renderer, this.canvas = t.canvas, this.opts = {
3467
3467
  budgetBytes: s.budgetBytes ?? 256 * 1024 * 1024,
3468
3468
  workers: s.workers ?? Math.max(1, Math.min(4, Math.floor((navigator.hardwareConcurrency || 4) / 4))),
3469
3469
  uploadBudgetMs: s.uploadBudgetMs ?? 4,
@@ -3479,7 +3479,7 @@ class Pe {
3479
3479
  invalidate: () => {
3480
3480
  this.dirty = !0;
3481
3481
  }
3482
- }, this.bg = this.makeBackground(), this.world = new yt({ isRenderGroup: !0 }), this.world.sortableChildren = !0, this.world.eventMode = "none", this.overlay = new No(this.theme, () => this.requestFrame(), i), this.bg.eventMode = "none", t.stage.eventMode = "none", t.stage.addChild(this.bg, this.world, this.overlay.container), this.cam = new lo(() => this.requestFrame(), na(s)), this.tm = new Vo(this.renderer, {
3482
+ }, this.bg = this.makeBackground(), this.world = new yt({ isRenderGroup: !0 }), this.world.sortableChildren = !0, this.world.eventMode = "none", this.overlay = new Do(this.theme, () => this.requestFrame(), i), this.bg.eventMode = "none", t.stage.eventMode = "none", t.stage.addChild(this.bg, this.world, this.overlay.container), this.cam = new ho(() => this.requestFrame(), ra(s)), this.tm = new Ko(this.renderer, {
3483
3483
  budgetBytes: this.opts.budgetBytes,
3484
3484
  workers: this.opts.workers,
3485
3485
  workerUrl: s.workerUrl,
@@ -3489,7 +3489,7 @@ class Pe {
3489
3489
  onRetire: () => this.rebuildBatches(),
3490
3490
  onWake: () => this.requestFrame(),
3491
3491
  onError: (l) => this.reportTextureError(l)
3492
- }), this.tm.keep = (l, h) => h === 1 ? this.slotOnScreen[l] === 1 : h === 2 ? this.slotOwn[l] >= 2 : this.slotOwn[l] === 3, this.opts.gpuTimer && (this.gpu = qe.create(this.renderer)), this.applyThemeToScene();
3492
+ }), this.tm.keep = (l, h) => h === 1 ? this.slotOnScreen[l] === 1 : h === 2 ? this.slotOwn[l] >= 2 : this.slotOwn[l] === 3, this.opts.gpuTimer && (this.gpu = Ue.create(this.renderer)), this.applyThemeToScene();
3493
3493
  const o = () => {
3494
3494
  const l = e.getBoundingClientRect(), h = Math.round(l.width) < 1 || Math.round(l.height) < 1, c = Math.max(1, Math.round(l.width)), d = Math.max(1, Math.round(l.height));
3495
3495
  !this.setDpr(window.devicePixelRatio || 1) && c === this.cam.width && d === this.cam.height && h === this.cam.isEmpty || (this.renderer.resize(c, d, this.dpr), this.bg.width = c, this.bg.height = d, this.cam.setViewport(c, d, h), this.mountedWin = null, this.dirty = !0, a && !this.lost && !this.disposed && this.render(), this.requestFrame());
@@ -3502,7 +3502,7 @@ class Pe {
3502
3502
  overlay;
3503
3503
  cam;
3504
3504
  tm;
3505
- pools = new Ko();
3505
+ pools = new jo();
3506
3506
  renderer;
3507
3507
  bg;
3508
3508
  canvas;
@@ -3616,9 +3616,9 @@ class Pe {
3616
3616
  gpuMs = new Float32Array(4096);
3617
3617
  nGpu = 0;
3618
3618
  static async create(t, e = {}) {
3619
- const s = Do(je.system);
3619
+ const s = Fo(Qe.system);
3620
3620
  try {
3621
- return await Pe.createParked(t, e, s);
3621
+ return await Le.createParked(t, e, s);
3622
3622
  } catch (i) {
3623
3623
  throw s(), i;
3624
3624
  }
@@ -3627,7 +3627,7 @@ class Pe {
3627
3627
  const { signal: i } = e;
3628
3628
  if (e.cspSafe && (await import("pixi.js/unsafe-eval"), i?.aborted))
3629
3629
  throw i.reason;
3630
- const r = new cn(), o = () => {
3630
+ const r = new dn(), o = () => {
3631
3631
  let a = null;
3632
3632
  try {
3633
3633
  a = r.canvas;
@@ -3647,7 +3647,7 @@ class Pe {
3647
3647
  resolution: l,
3648
3648
  autoDensity: !0,
3649
3649
  antialias: !1,
3650
- backgroundColor: (e.theme ?? Ke).canvas,
3650
+ backgroundColor: (e.theme ?? je).canvas,
3651
3651
  preference: "webgl",
3652
3652
  powerPreference: "high-performance",
3653
3653
  autoStart: !1,
@@ -3656,9 +3656,9 @@ class Pe {
3656
3656
  gcActive: !1,
3657
3657
  eventFeatures: { move: !1, globalMove: !1, click: !1, wheel: !1 }
3658
3658
  }), i?.aborted) throw i.reason;
3659
- if (r.renderer.type !== dn.WEBGL || !ra(r.renderer))
3659
+ if (r.renderer.type !== un.WEBGL || !oa(r.renderer))
3660
3660
  throw new $("unsupported", "Corkboard needs WebGL2, which this browser did not provide");
3661
- return je.system.stop(), r.ticker.stop(), new Pe(r, t, e, l, s);
3661
+ return Qe.system.stop(), r.ticker.stop(), new Le(r, t, e, l, s);
3662
3662
  } catch (a) {
3663
3663
  throw o(), a;
3664
3664
  }
@@ -3818,7 +3818,7 @@ class Pe {
3818
3818
  let e = this.hashCache.get(t);
3819
3819
  if (!e) {
3820
3820
  try {
3821
- e = ia(t);
3821
+ e = na(t);
3822
3822
  } catch {
3823
3823
  return;
3824
3824
  }
@@ -3847,7 +3847,7 @@ class Pe {
3847
3847
  l1Url: void 0,
3848
3848
  l2Url: void 0,
3849
3849
  l3Url: void 0,
3850
- radius: De.cardRadius
3850
+ radius: Fe.cardRadius
3851
3851
  };
3852
3852
  return this.fillCard(s, e), this.slotBaked[t] = Math.max(e.w, e.h), this.slotBakedAspect[t] = e.w > 0 ? e.h / e.w : 0, s;
3853
3853
  }
@@ -3864,7 +3864,7 @@ class Pe {
3864
3864
  // (cover) to another shape.
3865
3865
  // Only committed store changes get here: a live drag / resize preview never touches the card.
3866
3866
  refreshCard(t, e) {
3867
- const s = e.media, [i, r, o] = this.urlsOf(e), a = Math.max(e.w, e.h), l = this.slotBaked[t.id], h = e.w > 0 ? e.h / e.w : 0, c = this.slotBakedAspect[t.id], d = t.l1Url !== void 0 && t.l1Url !== i || t.l2Url !== void 0 && t.l2Url !== r || t.l3Url !== void 0 && t.l3Url !== o || t.thumbhash !== void 0 && !sa(t.thumbhash, this.hashOf(s.thumbhash)) || t.radius !== e.radius || l > 0 && e.radius * Math.abs(a - l) / l > Jo || c > 0 && Math.abs(h - c) / c > ta;
3867
+ const s = e.media, [i, r, o] = this.urlsOf(e), a = Math.max(e.w, e.h), l = this.slotBaked[t.id], h = e.w > 0 ? e.h / e.w : 0, c = this.slotBakedAspect[t.id], d = t.l1Url !== void 0 && t.l1Url !== i || t.l2Url !== void 0 && t.l2Url !== r || t.l3Url !== void 0 && t.l3Url !== o || t.thumbhash !== void 0 && !ia(t.thumbhash, this.hashOf(s.thumbhash)) || t.radius !== e.radius || l > 0 && e.radius * Math.abs(a - l) / l > ta || c > 0 && Math.abs(h - c) / c > ea;
3868
3868
  return this.fillCard(t, e), d && (this.tm.forget(t.id), this.slotLevel[t.id] = -1, this.slotBaked[t.id] = a, this.slotBakedAspect[t.id] = h, this.l0Missing++), d;
3869
3869
  }
3870
3870
  // The element's size or media changed: keep the BoardCard current, and show the placeholder again when
@@ -3931,7 +3931,7 @@ class Pe {
3931
3931
  const o = t.pop();
3932
3932
  this.queued.delete(o.id);
3933
3933
  const a = e.get(o.id);
3934
- if (!(!a || this.views.has(o.id)) && !(i && !this.forceMount(o.id) && !this.inWindow(a, i)) && (this.mount(a), r++, performance.now() - s >= Zo))
3934
+ if (!(!a || this.views.has(o.id)) && !(i && !this.forceMount(o.id) && !this.inWindow(a, i)) && (this.mount(a), r++, performance.now() - s >= Jo))
3935
3935
  break;
3936
3936
  }
3937
3937
  r > 0 && (this.dirty = !0, this.lodDirty = !0);
@@ -4029,7 +4029,7 @@ class Pe {
4029
4029
  // match no card).
4030
4030
  boundsOf(t) {
4031
4031
  const e = this.store;
4032
- let s = ci(), i = !1;
4032
+ let s = di(), i = !1;
4033
4033
  if (e) {
4034
4034
  const r = t ? (function* () {
4035
4035
  for (const o of t) yield e.get(o);
@@ -4157,7 +4157,7 @@ class Pe {
4157
4157
  a[d] = u - l, l = u;
4158
4158
  };
4159
4159
  try {
4160
- if (this.where = "store", this.flushStore() && (r = !0), h("store"), this.where = "camera", this.cam.version !== this.renderedVersion ? (this.renderedVersion = this.cam.version, this.applyCamera(), r = !0, o = !0, (e - this.lastLod >= jo || this.mountedWin === null) && this.cullAndLod(e, !1)) : this.lodDirty && this.cullAndLod(e, !1), this.drainMounts(), this.dirty && (r = !0, this.dirty = !1), h("camera"), this.where = "upload", !this.lost) {
4160
+ if (this.where = "store", this.flushStore() && (r = !0), h("store"), this.where = "camera", this.cam.version !== this.renderedVersion ? (this.renderedVersion = this.cam.version, this.applyCamera(), r = !0, o = !0, (e - this.lastLod >= Qo || this.mountedWin === null) && this.cullAndLod(e, !1)) : this.lodDirty && this.cullAndLod(e, !1), this.drainMounts(), this.dirty && (r = !0, this.dirty = !1), h("camera"), this.where = "upload", !this.lost) {
4161
4161
  const d = this.tm.frame(this.opts.uploadBudgetMs, e);
4162
4162
  if (d.length > 0) {
4163
4163
  for (const u of d) this.applySlot(u);
@@ -4183,7 +4183,7 @@ class Pe {
4183
4183
  upload: R(a.upload),
4184
4184
  overlay: R(a.overlay),
4185
4185
  render: R(a.render)
4186
- }), this.slowTicks.length > 40 && this.slowTicks.shift()), i || this.uploadsPending() || this.lodDirty || this.dirty || this.mountQueue.length > 0 ? this.requestFrame() : (this.lastTs = 0, this.settleTimer = window.setTimeout(this.settle, Qo));
4186
+ }), this.slowTicks.length > 40 && this.slowTicks.shift()), i || this.uploadsPending() || this.lodDirty || this.dirty || this.mountQueue.length > 0 ? this.requestFrame() : (this.lastTs = 0, this.settleTimer = window.setTimeout(this.settle, Zo));
4187
4187
  };
4188
4188
  settle = () => {
4189
4189
  if (this.settleTimer = 0, !this.disposed) {
@@ -4212,7 +4212,7 @@ class Pe {
4212
4212
  this.gpu?.begin(), this.app.render(), this.gpu?.end();
4213
4213
  const e = performance.now() - t;
4214
4214
  this.renderMs[this.nRender++ & 4095] = e, this.counters.renders++;
4215
- let s = ea;
4215
+ let s = sa;
4216
4216
  if (this.gpu) {
4217
4217
  s = this.gpu.poll();
4218
4218
  for (const i of s) this.gpuMs[this.nGpu++ & 4095] = i;
@@ -4290,12 +4290,12 @@ class Pe {
4290
4290
  this.counters.lodPasses++, this.ctx.scale = s;
4291
4291
  const i = s * this.dpr, r = (e.x0 + e.x1) / 2, o = (e.y0 + e.y1) / 2, a = [], l = this.tm;
4292
4292
  let h = 0, c = !1;
4293
- const d = (e.x1 - e.x0) * Is, u = (e.y1 - e.y0) * Is, f = [], m = l.hasHeadroom();
4293
+ const d = (e.x1 - e.x0) * Rs, u = (e.y1 - e.y0) * Rs, f = [], m = l.hasHeadroom();
4294
4294
  for (const g of this.mediaViews) {
4295
4295
  const y = g.card, v = g.el;
4296
4296
  if (!y || !v) continue;
4297
4297
  const w = y.id, b = Math.max(v.w, v.h) * i, k = this.slotLevel[w];
4298
- let x = wo(b, k < 0 ? null : k);
4298
+ let x = vo(b, k < 0 ? null : k);
4299
4299
  x === 0 && !y.thumbhash && (x = 1);
4300
4300
  const M = this.rectOf(v), T = M.x < e.x1 + d && M.x + M.w > e.x0 - d && M.y < e.y1 + u && M.y + M.h > e.y0 - u, S = Math.hypot(M.x + M.w / 2 - r, M.y + M.h / 2 - o) * s;
4301
4301
  (x === 0 || !T) && l.hasOutgoing(y) && l.dropOutgoing(y), x === 3 && (T && f.push({ slot: w, dist: S, d: b }), x = 2), this.slotLevel[w] = x, this.slotOnScreen[w] = T ? 1 : 0, this.slotOwn[w] = T && x >= 2 ? x : 0, T && l.touch(y, t, x >= 2), y.thumbhash && !l.has(y, 0) && (a.push({ card: y, level: 0, dist: S }), h++), x >= 1 && !l.has(y, 1) && (T || m) && a.push({ card: y, level: 1, dist: S }), x === 2 && T && a.push({ card: y, level: 2, dist: S, bucket: ae(b) });
@@ -4304,7 +4304,7 @@ class Pe {
4304
4304
  f.sort((g, y) => g.dist - y.dist);
4305
4305
  for (let g = 0; g < f.length; g++) {
4306
4306
  const { slot: y, dist: v, d: w } = f[g], b = this.slotCard[y];
4307
- g < yo ? (this.slotLevel[y] = 3, this.slotOwn[y] = 3, l.has(b, 2) || a.push({ card: b, level: 2, dist: v, bucket: ae(480) }), a.push({ card: b, level: 3, dist: v, bucket: vo(w) })) : a.push({ card: b, level: 2, dist: v, bucket: ae(w) });
4307
+ g < wo ? (this.slotLevel[y] = 3, this.slotOwn[y] = 3, l.has(b, 2) || a.push({ card: b, level: 2, dist: v, bucket: ae(480) }), a.push({ card: b, level: 3, dist: v, bucket: bo(w) })) : a.push({ card: b, level: 2, dist: v, bucket: ae(w) });
4308
4308
  }
4309
4309
  }
4310
4310
  const p = this.store;
@@ -4320,7 +4320,7 @@ class Pe {
4320
4320
  if (this.slotView[v] || l.has(w, 0) || !w.thumbhash) continue;
4321
4321
  g++;
4322
4322
  const b = p.get(y), k = this.rectOf(b), x = Math.hypot(k.x + k.w / 2 - r, k.y + k.h / 2 - o) * s;
4323
- a.push({ card: w, level: 0, dist: x + Ee });
4323
+ a.push({ card: w, level: 0, dist: x + Pe });
4324
4324
  }
4325
4325
  this.l0Missing = g + h;
4326
4326
  } else this.l0Missing = h;
@@ -4488,7 +4488,7 @@ class Pe {
4488
4488
  lodPassMs: St(this.lodPassMs, Math.min(this.nLodPass, 1024)),
4489
4489
  worldChildren: this.world.children.length,
4490
4490
  viewPool: this.pools.stats(),
4491
- glRenderer: oa(this.renderer)
4491
+ glRenderer: aa(this.renderer)
4492
4492
  }
4493
4493
  };
4494
4494
  }
@@ -4517,17 +4517,17 @@ class Pe {
4517
4517
  const e = t.getContext("2d");
4518
4518
  e.fillStyle = "#ffffff", e.beginPath(), e.arc(32, 32, 3, 0, Math.PI * 2), e.fill();
4519
4519
  const s = it.from(t, !0);
4520
- return new un({ texture: s, width: 1, height: 1 });
4520
+ return new fn({ texture: s, width: 1, height: 1 });
4521
4521
  }
4522
4522
  }
4523
- function ra(n) {
4523
+ function oa(n) {
4524
4524
  return typeof WebGL2RenderingContext < "u" && n.gl instanceof WebGL2RenderingContext;
4525
4525
  }
4526
- function oa(n) {
4526
+ function aa(n) {
4527
4527
  const t = n.gl, e = t.getExtension("WEBGL_debug_renderer_info");
4528
4528
  return String(e ? t.getParameter(e.UNMASKED_RENDERER_WEBGL) : t.getParameter(t.RENDERER));
4529
4529
  }
4530
- class qe {
4530
+ class Ue {
4531
4531
  constructor(t) {
4532
4532
  this.gl = t;
4533
4533
  }
@@ -4536,7 +4536,7 @@ class qe {
4536
4536
  pending = [];
4537
4537
  current = null;
4538
4538
  static create(t) {
4539
- const e = new qe(t.gl);
4539
+ const e = new Ue(t.gl);
4540
4540
  return e.ext = e.gl.getExtension("EXT_disjoint_timer_query_webgl2"), e.supported = !!e.ext, e;
4541
4541
  }
4542
4542
  begin() {
@@ -4557,7 +4557,7 @@ class qe {
4557
4557
  return t;
4558
4558
  }
4559
4559
  }
4560
- const aa = 10, Rs = 24, la = 8, Wt = {
4560
+ const la = 10, Cs = 24, ha = 8, Wt = {
4561
4561
  nw: [-1, -1],
4562
4562
  n: [0, -1],
4563
4563
  ne: [1, -1],
@@ -4566,7 +4566,7 @@ const aa = 10, Rs = 24, la = 8, Wt = {
4566
4566
  s: [0, 1],
4567
4567
  sw: [-1, 1],
4568
4568
  w: [-1, 0]
4569
- }, ha = {
4569
+ }, ca = {
4570
4570
  e: 0,
4571
4571
  w: 0,
4572
4572
  se: 45,
@@ -4575,10 +4575,10 @@ const aa = 10, Rs = 24, la = 8, Wt = {
4575
4575
  n: 90,
4576
4576
  sw: 135,
4577
4577
  ne: 135
4578
- }, ca = ["ew-resize", "nwse-resize", "ns-resize", "nesw-resize"];
4579
- function Ei(n, t) {
4580
- const e = Math.round((ha[n] + t) / 45);
4581
- return ca[(e % 4 + 4) % 4];
4578
+ }, da = ["ew-resize", "nwse-resize", "ns-resize", "nesw-resize"];
4579
+ function Pi(n, t) {
4580
+ const e = Math.round((ca[n] + t) / 45);
4581
+ return da[(e % 4 + 4) % 4];
4582
4582
  }
4583
4583
  function mt(n) {
4584
4584
  let t = null;
@@ -4586,7 +4586,7 @@ function mt(n) {
4586
4586
  const s = n[e];
4587
4587
  let i;
4588
4588
  if (s.rot === 0)
4589
- i = pn(s);
4589
+ i = mn(s);
4590
4590
  else {
4591
4591
  const r = Yt(s);
4592
4592
  i = {
@@ -4596,13 +4596,13 @@ function mt(n) {
4596
4596
  maxY: Math.max(r[1], r[3], r[5], r[7])
4597
4597
  };
4598
4598
  }
4599
- t = t === null ? i : xe(t, i);
4599
+ t = t === null ? i : Me(t, i);
4600
4600
  }
4601
4601
  return t;
4602
4602
  }
4603
- function Cs(n, t, e) {
4604
- const s = Wt[t], i = ui(n, (s[0] + 1) / 2 * n.w, (s[1] + 1) / 2 * n.h);
4605
- return { id: t, x: i.x, y: i.y, cursor: Ei(t, e) };
4603
+ function _s(n, t, e) {
4604
+ const s = Wt[t], i = fi(n, (s[0] + 1) / 2 * n.w, (s[1] + 1) / 2 * n.h);
4605
+ return { id: t, x: i.x, y: i.y, cursor: Pi(t, e) };
4606
4606
  }
4607
4607
  function ue(n, t, e) {
4608
4608
  const s = [], i = [];
@@ -4621,18 +4621,18 @@ function ue(n, t, e) {
4621
4621
  const c = { x: h.minX, y: h.minY, w: h.maxX - h.minX, h: h.maxY - h.minY, rot: 0 };
4622
4622
  return {
4623
4623
  rect: c,
4624
- handles: ["nw", "ne", "se", "sw"].map((d) => Cs(c, d, 0)),
4624
+ handles: ["nw", "ne", "se", "sw"].map((d) => _s(c, d, 0)),
4625
4625
  edges: []
4626
4626
  };
4627
4627
  }
4628
4628
  const a = i[0], l = [];
4629
- return o && (a.w * r >= Rs && l.push("n", "s"), a.h * r >= Rs && l.push("e", "w")), {
4629
+ return o && (a.w * r >= Cs && l.push("n", "s"), a.h * r >= Cs && l.push("e", "w")), {
4630
4630
  rect: a,
4631
- handles: ["nw", "ne", "se", "sw"].map((h) => Cs(a, h, a.rot)),
4631
+ handles: ["nw", "ne", "se", "sw"].map((h) => _s(a, h, a.rot)),
4632
4632
  edges: l
4633
4633
  };
4634
4634
  }
4635
- function _s(n, t, e, s, i = aa) {
4635
+ function Os(n, t, e, s, i = la) {
4636
4636
  const r = i / 2 / (s > 0 ? s : 1);
4637
4637
  let o = null, a = 1 / 0;
4638
4638
  for (let l = 0; l < n.handles.length; l++) {
@@ -4641,61 +4641,61 @@ function _s(n, t, e, s, i = aa) {
4641
4641
  const u = c * c + d * d;
4642
4642
  u < a && (o = h, a = u);
4643
4643
  }
4644
- return o ?? da(n, t, e, s);
4644
+ return o ?? ua(n, t, e, s);
4645
4645
  }
4646
- function da(n, t, e, s) {
4646
+ function ua(n, t, e, s) {
4647
4647
  if (n.edges.length === 0) return null;
4648
- const i = s > 0 ? s : 1, r = n.rect, o = Math.min(la / 2 / i, r.w / 4, r.h / 4), a = di(r, t, e), l = a.x >= -o && a.x <= r.w + o, h = a.y >= -o && a.y <= r.h + o;
4648
+ const i = s > 0 ? s : 1, r = n.rect, o = Math.min(ha / 2 / i, r.w / 4, r.h / 4), a = ui(r, t, e), l = a.x >= -o && a.x <= r.w + o, h = a.y >= -o && a.y <= r.h + o;
4649
4649
  let c = null, d = 1 / 0;
4650
4650
  for (const g of n.edges) {
4651
4651
  const y = Wt[g], v = y[1] !== 0, w = Math.abs(v ? a.y - (y[1] > 0 ? r.h : 0) : a.x - (y[0] > 0 ? r.w : 0));
4652
4652
  w > o || !(v ? l : h) || w < d && (d = w, c = g);
4653
4653
  }
4654
4654
  if (c === null) return null;
4655
- const u = Wt[c], f = u[0] === 0 ? Math.min(Math.max(a.x, 0), r.w) : (u[0] + 1) / 2 * r.w, m = u[1] === 0 ? Math.min(Math.max(a.y, 0), r.h) : (u[1] + 1) / 2 * r.h, p = ui(r, f, m);
4656
- return { id: c, x: p.x, y: p.y, cursor: Ei(c, r.rot) };
4655
+ const u = Wt[c], f = u[0] === 0 ? Math.min(Math.max(a.x, 0), r.w) : (u[0] + 1) / 2 * r.w, m = u[1] === 0 ? Math.min(Math.max(a.y, 0), r.h) : (u[1] + 1) / 2 * r.h, p = fi(r, f, m);
4656
+ return { id: c, x: p.x, y: p.y, cursor: Pi(c, r.rot) };
4657
4657
  }
4658
- const ua = 4, fa = [], lt = { minX: 0, minY: 0, maxX: 0, maxY: 0 }, pa = (n) => n > 0 && Number.isFinite(n) ? n : 1;
4659
- function ma(n, t) {
4658
+ const fa = 4, pa = [], lt = { minX: 0, minY: 0, maxX: 0, maxY: 0 }, ma = (n) => n > 0 && Number.isFinite(n) ? n : 1;
4659
+ function ga(n, t) {
4660
4660
  return t.skipLocked && n.locked ? !1 : t.filter === void 0 || t.filter(n);
4661
4661
  }
4662
- function ga(n, t, e, s) {
4663
- return lt.minX = t - s, lt.minY = e - s, lt.maxX = t + s, lt.maxY = e + s, n.searchInto(lt, fa);
4662
+ function ya(n, t, e, s) {
4663
+ return lt.minX = t - s, lt.minY = e - s, lt.maxX = t + s, lt.maxY = e + s, n.searchInto(lt, pa);
4664
4664
  }
4665
- const ya = (n, t, e, s) => gn({ x: n.x, y: n.y, w: n.w, h: n.h, rot: n.rot }, t, e, s);
4665
+ const wa = (n, t, e, s) => yn({ x: n.x, y: n.y, w: n.w, h: n.h, rot: n.rot }, t, e, s);
4666
4666
  function fe(n, t, e, s) {
4667
- const i = (s.tolerancePx ?? ua) / pa(s.zoom), r = ga(n, t, e, i);
4667
+ const i = (s.tolerancePx ?? fa) / ma(s.zoom), r = ya(n, t, e, i);
4668
4668
  let o = null, a = -1 / 0;
4669
4669
  for (let l = 0; l < r.length; l++) {
4670
4670
  const h = r[l];
4671
- if (!ma(h, s)) continue;
4671
+ if (!ga(h, s)) continue;
4672
4672
  const c = n.rank(h.id);
4673
- c <= a || ya(h, t, e, i) && (o = h, a = c);
4673
+ c <= a || wa(h, t, e, i) && (o = h, a = c);
4674
4674
  }
4675
4675
  return r.length = 0, o;
4676
4676
  }
4677
- const W = [], wa = [];
4678
- function va(n, t, e, s = {}) {
4679
- const i = s.skipLocked ?? !0, r = s.filter, o = n.searchInto(t, wa);
4677
+ const W = [], va = [];
4678
+ function ba(n, t, e, s = {}) {
4679
+ const i = s.skipLocked ?? !0, r = s.filter, o = n.searchInto(t, va);
4680
4680
  W.length = 0;
4681
4681
  for (let l = 0; l < o.length; l++) {
4682
4682
  const h = o[l];
4683
4683
  if (i && h.locked || r !== void 0 && !r(h)) continue;
4684
4684
  const c = K(h);
4685
- (e === "contain" ? vn(c, t) : wn(t, c)) && W.push(h);
4685
+ (e === "contain" ? bn(c, t) : vn(t, c)) && W.push(h);
4686
4686
  }
4687
4687
  o.length = 0, W.length > 1 && W.sort((l, h) => n.rank(l.id) - n.rank(h.id));
4688
4688
  const a = new Array(W.length);
4689
4689
  for (let l = 0; l < W.length; l++) a[l] = W[l].id;
4690
4690
  return W.length = 0, a;
4691
4691
  }
4692
- const Tt = 24, ba = 4e3, A = { l: 0, t: 0, w: 0, h: 0 };
4692
+ const Tt = 24, xa = 4e3, A = { l: 0, t: 0, w: 0, h: 0 };
4693
4693
  function At(n, t, e, s, i) {
4694
4694
  if (n === 0 || s) return (t - e) / 2;
4695
4695
  const r = n > 0 ? 0 : t, o = r + n * e;
4696
4696
  return o < r ? o : r;
4697
4697
  }
4698
- function Os(n, t, e, s, i, r, o, a, l, h, c) {
4698
+ function Ns(n, t, e, s, i, r, o, a, l, h, c) {
4699
4699
  const d = o ? 2 : 1;
4700
4700
  if (a && n > 0 && t > 0) {
4701
4701
  const u = e !== 0 ? (n + d * e * i) / n : 0, f = s !== 0 ? (t + d * s * r) / t : 0;
@@ -4722,7 +4722,7 @@ function Os(n, t, e, s, i, r, o, a, l, h, c) {
4722
4722
  function Et(n, t, e) {
4723
4723
  return t === void 0 || e === 0 || t === "min" == e < 0 ? n : -n;
4724
4724
  }
4725
- class xa {
4725
+ class Ma {
4726
4726
  handle;
4727
4727
  affected;
4728
4728
  mode;
@@ -4783,7 +4783,7 @@ class xa {
4783
4783
  // ── single element ─────────────────────────────────────────────────────────
4784
4784
  solveSingle(t, e, s, i) {
4785
4785
  const r = e - this.start.x, o = s - this.start.y, a = r * t.cos + o * t.sin, l = -r * t.sin + o * t.cos, h = Math.max(t.w, t.h);
4786
- Os(
4786
+ Ns(
4787
4787
  t.w,
4788
4788
  t.h,
4789
4789
  this.fx,
@@ -4794,7 +4794,7 @@ class xa {
4794
4794
  t.aspectLocked || i.shift,
4795
4795
  Tt,
4796
4796
  Tt,
4797
- h > 0 ? ba / h : 1 / 0
4797
+ h > 0 ? xa / h : 1 / 0
4798
4798
  );
4799
4799
  }
4800
4800
  // World centre of the solved rect.
@@ -4826,7 +4826,7 @@ class xa {
4826
4826
  }
4827
4827
  // ── several elements ───────────────────────────────────────────────────────
4828
4828
  solveMulti(t, e, s) {
4829
- Os(
4829
+ Ns(
4830
4830
  this.bw,
4831
4831
  this.bh,
4832
4832
  this.fx,
@@ -4857,22 +4857,22 @@ class xa {
4857
4857
  }
4858
4858
  }
4859
4859
  }
4860
- const Ns = 6, Ds = 3, Ma = 1.5, ka = 0.5, E = 0.01, D = 0, O = 1, P = 0, Sa = 1, dt = 2, ut = 3, Ta = 400, pe = 64, gt = 3, Aa = 3, Ea = 256, Pi = ["x", "y"], Pa = {
4860
+ const Ds = 6, Fs = 3, ka = 1.5, Sa = 0.5, E = 0.01, D = 0, O = 1, P = 0, Ta = 1, dt = 2, ut = 3, Aa = 400, pe = 64, gt = 3, Ea = 3, Pa = 256, Li = ["x", "y"], La = {
4861
4861
  v: new Float64Array(0),
4862
4862
  owner: new Int32Array(0),
4863
4863
  kind: new Uint8Array(0)
4864
- }, Fs = {
4864
+ }, Bs = {
4865
4865
  v: new Float64Array(0),
4866
4866
  before: new Int32Array(0),
4867
4867
  after: new Int32Array(0)
4868
- }, La = { v: new Float64Array(0), owner: new Int32Array(0) };
4868
+ }, Ia = { v: new Float64Array(0), owner: new Int32Array(0) };
4869
4869
  function Ht(n, t) {
4870
4870
  const e = new Uint32Array(t);
4871
4871
  for (let s = 0; s < t; s++) e[s] = s;
4872
4872
  return e.sort((s, i) => n[s] - n[i]), e;
4873
4873
  }
4874
- function Bs(n, t, e, s) {
4875
- if (s === 0) return Pa;
4874
+ function Xs(n, t, e, s) {
4875
+ if (s === 0) return La;
4876
4876
  const i = Ht(n, s), r = new Float64Array(s), o = new Int32Array(s), a = new Uint8Array(s);
4877
4877
  for (let l = 0; l < s; l++) {
4878
4878
  const h = i[l];
@@ -4880,11 +4880,11 @@ function Bs(n, t, e, s) {
4880
4880
  }
4881
4881
  return { v: r, owner: o, kind: a };
4882
4882
  }
4883
- function Ia(n) {
4883
+ function Ra(n) {
4884
4884
  return Number.isFinite(n.minX) && Number.isFinite(n.minY) && Number.isFinite(n.maxX) && Number.isFinite(n.maxY) && n.maxX >= n.minX && n.maxY >= n.minY;
4885
4885
  }
4886
- function Xs(n, t, e) {
4887
- if (t === 0) return La;
4886
+ function qs(n, t, e) {
4887
+ if (t === 0) return Ia;
4888
4888
  const s = new Float64Array(t);
4889
4889
  for (let a = 0; a < t; a++) s[a] = n[a * 4 + e + 2] - n[a * 4 + e];
4890
4890
  const i = Ht(s, t), r = new Float64Array(t), o = new Int32Array(t);
@@ -4892,8 +4892,8 @@ function Xs(n, t, e) {
4892
4892
  r[a] = s[i[a]], o[a] = i[a];
4893
4893
  return { v: r, owner: o };
4894
4894
  }
4895
- function qs(n, t, e) {
4896
- if (t < 2) return Fs;
4895
+ function Us(n, t, e) {
4896
+ if (t < 2) return Bs;
4897
4897
  const s = 1 - e, i = new Float64Array(t);
4898
4898
  for (let y = 0; y < t; y++) i[y] = n[y * 4 + e];
4899
4899
  const r = Ht(i, t), o = new Float64Array(t);
@@ -4907,19 +4907,19 @@ function qs(n, t, e) {
4907
4907
  if (Q === v) continue;
4908
4908
  const _ = Q * 4, C = Math.max(k, n[_ + s]), Z = Math.min(x, n[_ + s + 2]);
4909
4909
  if (!(Z > C)) continue;
4910
- let $e = !1;
4910
+ let Ge = !1;
4911
4911
  for (let vt = 0; vt < M; vt++)
4912
4912
  if (a[vt] <= C + E && l[vt] >= Z - E) {
4913
- $e = !0;
4913
+ Ge = !0;
4914
4914
  break;
4915
4915
  }
4916
- if ($e) continue;
4917
- const Ge = n[_ + e] - b;
4918
- if (Ge > E && (h.push(Ge), c.push(v), d.push(Q)), M === pe || (a[M] = n[_ + s], l[M] = n[_ + s + 2], M++, S < T ? (T = C, S = Z) : C <= S + E && Z >= T - E && (C < T && (T = C), Z > S && (S = Z)), T <= k + E && S >= x - E)) break;
4916
+ if (Ge) continue;
4917
+ const Ve = n[_ + e] - b;
4918
+ if (Ve > E && (h.push(Ve), c.push(v), d.push(Q)), M === pe || (a[M] = n[_ + s], l[M] = n[_ + s + 2], M++, S < T ? (T = C, S = Z) : C <= S + E && Z >= T - E && (C < T && (T = C), Z > S && (S = Z)), T <= k + E && S >= x - E)) break;
4919
4919
  }
4920
4920
  }
4921
4921
  const u = h.length;
4922
- if (u === 0) return Fs;
4922
+ if (u === 0) return Bs;
4923
4923
  const f = Ht(h, u), m = new Float64Array(u), p = new Int32Array(u), g = new Int32Array(u);
4924
4924
  for (let y = 0; y < u; y++) {
4925
4925
  const v = f[y];
@@ -4927,27 +4927,27 @@ function qs(n, t, e) {
4927
4927
  }
4928
4928
  return { v: m, before: p, after: g };
4929
4929
  }
4930
- function Ra(n) {
4930
+ function Ca(n) {
4931
4931
  const t = n.length, e = new Float64Array(t * 4), s = [], i = n.length * 3, r = new Float64Array(i), o = new Int32Array(i), a = new Uint8Array(i), l = new Float64Array(i), h = new Int32Array(i), c = new Uint8Array(i);
4932
4932
  let d = 0, u = 0, f = 0;
4933
4933
  for (let g = 0; g < n.length; g++) {
4934
4934
  const y = n[g], v = y.box;
4935
- if (!Ia(v)) continue;
4935
+ if (!Ra(v)) continue;
4936
4936
  const w = d++;
4937
4937
  s.push(y.id), e[w * 4] = v.minX, e[w * 4 + 1] = v.minY, e[w * 4 + 2] = v.maxX, e[w * 4 + 3] = v.maxY, r[u] = v.minX, o[u] = w, a[u++] = D, r[u] = (v.minX + v.maxX) / 2, o[u] = w, a[u++] = O, r[u] = v.maxX, o[u] = w, a[u++] = D, l[f] = v.minY, h[f] = w, c[f++] = D, l[f] = (v.minY + v.maxY) / 2, h[f] = w, c[f++] = O, l[f] = v.maxY, h[f] = w, c[f++] = D;
4938
4938
  }
4939
- const m = d, p = Math.min(m, Ta);
4939
+ const m = d, p = Math.min(m, Aa);
4940
4940
  return {
4941
4941
  count: d,
4942
4942
  candCount: m,
4943
4943
  ids: s,
4944
4944
  boxes: e,
4945
- x: Bs(r, o, a, u),
4946
- y: Bs(l, h, c, f),
4947
- gapsX: qs(e, p, 0),
4948
- gapsY: qs(e, p, 1),
4949
- widths: Xs(e, m, 0),
4950
- heights: Xs(e, m, 1)
4945
+ x: Xs(r, o, a, u),
4946
+ y: Xs(l, h, c, f),
4947
+ gapsX: Us(e, p, 0),
4948
+ gapsY: Us(e, p, 1),
4949
+ widths: qs(e, m, 0),
4950
+ heights: qs(e, m, 1)
4951
4951
  };
4952
4952
  }
4953
4953
  function j(n, t) {
@@ -4958,18 +4958,18 @@ function j(n, t) {
4958
4958
  }
4959
4959
  return e;
4960
4960
  }
4961
- function Ca(n, t) {
4961
+ function _a(n, t) {
4962
4962
  return n === O ? t === O ? 0 : 2 : t === O ? 2 : 1;
4963
4963
  }
4964
- let $t = !1, Ft = 0, Li = 0, Us = 0, Ii = 0;
4965
- function Ys(n, t, e, s, i, r, o) {
4964
+ let $t = !1, Ft = 0, Ii = 0, Ys = 0, Ri = 0;
4965
+ function zs(n, t, e, s, i, r, o) {
4966
4966
  const a = n.v, l = a[t];
4967
4967
  let h = 4;
4968
4968
  for (let c = t; c >= 0 && c < a.length && Math.abs(a[c] - l) <= E; c += e) {
4969
- const d = Ca(r, n.kind[c]);
4969
+ const d = _a(r, n.kind[c]);
4970
4970
  d < h && (h = d);
4971
4971
  }
4972
- (!$t || s < Ft - E || s <= Ft + E && h < Us) && ($t = !0, Ft = s, Li = i, Us = h, Ii = o);
4972
+ (!$t || s < Ft - E || s <= Ft + E && h < Ys) && ($t = !0, Ft = s, Ii = i, Ys = h, Ri = o);
4973
4973
  }
4974
4974
  function me(n, t, e, s, i) {
4975
4975
  const r = n.v, o = r.length;
@@ -4977,16 +4977,16 @@ function me(n, t, e, s, i) {
4977
4977
  const a = j(r, t);
4978
4978
  if (a < o) {
4979
4979
  const l = r[a] - t;
4980
- l <= i && Ys(n, a, 1, l, r[a] - t, e, s);
4980
+ l <= i && zs(n, a, 1, l, r[a] - t, e, s);
4981
4981
  }
4982
4982
  if (a > 0) {
4983
4983
  const l = t - r[a - 1];
4984
- l <= i && Ys(n, a - 1, -1, l, r[a - 1] - t, e, s);
4984
+ l <= i && zs(n, a - 1, -1, l, r[a - 1] - t, e, s);
4985
4985
  }
4986
4986
  }
4987
4987
  const N = new Float64Array(4), I = new Float64Array(4);
4988
- let Ue = -1, Ye = -1, Ri = 0, Ci = 0;
4989
- function _a(n, t, e, s, i, r) {
4988
+ let Ye = -1, ze = -1, Ci = 0, _i = 0;
4989
+ function Oa(n, t, e, s, i, r) {
4990
4990
  const o = n.boxes, a = 1 - t, l = n.candCount;
4991
4991
  let h = -1, c = -1, d = -1 / 0, u = 1 / 0;
4992
4992
  for (let f = 0; f < l; f++) {
@@ -5000,60 +5000,60 @@ function _a(n, t, e, s, i, r) {
5000
5000
  g >= s - E && g < u && (u = g, c = f);
5001
5001
  }
5002
5002
  }
5003
- Ue = h, Ye = c, Ri = d, Ci = u;
5003
+ Ye = h, ze = c, Ci = d, _i = u;
5004
5004
  }
5005
- function Le(n, t, e, s, i, r) {
5005
+ function Ie(n, t, e, s, i, r) {
5006
5006
  const o = n.boxes, a = t.before[e] * 4, l = t.after[e] * 4, h = Math.max(o[a + s], o[l + s]);
5007
5007
  return Math.min(o[a + s + 2], o[l + s + 2]) > i && h < r;
5008
5008
  }
5009
- let Gt = !1, Vt = 0, _i = 0, Oi = 0, Ni = 0;
5010
- function Ie(n, t, e, s) {
5011
- (!Gt || n < Vt - E) && (Gt = !0, Vt = n, _i = t, Oi = e, Ni = s);
5009
+ let Gt = !1, Vt = 0, Oi = 0, Ni = 0, Di = 0;
5010
+ function Re(n, t, e, s) {
5011
+ (!Gt || n < Vt - E) && (Gt = !0, Vt = n, Oi = t, Ni = e, Di = s);
5012
5012
  }
5013
- function zs(n, t, e, s, i, r, o, a, l) {
5013
+ function Ws(n, t, e, s, i, r, o, a, l) {
5014
5014
  const h = t.v, c = h.length;
5015
5015
  if (c === 0) return;
5016
5016
  const d = j(h, e);
5017
5017
  for (let u = d; u < c; u++) {
5018
5018
  const f = h[u] - e;
5019
5019
  if (f > l) break;
5020
- if (Le(n, t, u, r, o, a)) {
5021
- Ie(f, s * f, i, h[u]);
5020
+ if (Ie(n, t, u, r, o, a)) {
5021
+ Re(f, s * f, i, h[u]);
5022
5022
  break;
5023
5023
  }
5024
5024
  }
5025
5025
  for (let u = d - 1; u >= 0; u--) {
5026
5026
  const f = e - h[u];
5027
5027
  if (f > l) break;
5028
- if (Le(n, t, u, r, o, a)) {
5029
- Ie(f, -s * f, i, h[u]);
5028
+ if (Ie(n, t, u, r, o, a)) {
5029
+ Re(f, -s * f, i, h[u]);
5030
5030
  break;
5031
5031
  }
5032
5032
  }
5033
5033
  }
5034
- function Oa(n, t, e, s, i) {
5034
+ function Na(n, t, e, s, i) {
5035
5035
  if (Gt = !1, n.candCount === 0) return;
5036
5036
  const r = 1 - t, o = N[t], a = N[t + 2], l = N[r], h = N[r + 2];
5037
- _a(n, t, o, a, l, h);
5038
- const c = Ue, d = Ye, u = Ri, f = Ci, m = t === 0 ? n.gapsX : n.gapsY;
5037
+ Oa(n, t, o, a, l, h);
5038
+ const c = Ye, d = ze, u = Ci, f = _i, m = t === 0 ? n.gapsX : n.gapsY;
5039
5039
  if (s && c >= 0 && d >= 0) {
5040
5040
  const p = f - u - (a - o);
5041
5041
  if (p > 2 * E) {
5042
5042
  const g = u + p / 2 - o, y = Math.abs(g);
5043
- y <= i && Ie(y, g, 0, p / 2);
5043
+ y <= i && Re(y, g, 0, p / 2);
5044
5044
  }
5045
5045
  }
5046
- c >= 0 && (s || e === 1) && zs(n, m, o - u, 1, 0, r, l, h, i), d >= 0 && (s || e === 4) && zs(n, m, f - a, -1, 2, r, l, h, i);
5046
+ c >= 0 && (s || e === 1) && Ws(n, m, o - u, 1, 0, r, l, h, i), d >= 0 && (s || e === 4) && Ws(n, m, f - a, -1, 2, r, l, h, i);
5047
5047
  }
5048
- let Kt = !1, jt = 0, Di = 0, Fi = -1;
5049
- function Ws(n, t, e) {
5050
- (!Kt || n < jt - E) && (Kt = !0, jt = n, Di = t, Fi = e);
5048
+ let Kt = !1, jt = 0, Fi = 0, Bi = -1;
5049
+ function Hs(n, t, e) {
5050
+ (!Kt || n < jt - E) && (Kt = !0, jt = n, Fi = t, Bi = e);
5051
5051
  }
5052
- function Re(n, t, e, s, i, r, o) {
5052
+ function Ce(n, t, e, s, i, r, o) {
5053
5053
  const a = t * 4, l = 1 - e;
5054
5054
  return n[a + l + 2] > r && n[a + l] < o || n[a + e + 2] > s && n[a + e] < i;
5055
5055
  }
5056
- function Na(n, t, e, s) {
5056
+ function Da(n, t, e, s) {
5057
5057
  Kt = !1;
5058
5058
  const i = t === 0 ? n.widths : n.heights, r = i.v, o = r.length;
5059
5059
  if (o === 0) return;
@@ -5061,33 +5061,33 @@ function Na(n, t, e, s) {
5061
5061
  for (let p = m; p < o; p++) {
5062
5062
  const g = r[p] - u;
5063
5063
  if (g > s) break;
5064
- if (Re(f, i.owner[p], t, l, h, c, d)) {
5065
- Ws(g, e === 2 ? g : -g, i.owner[p]);
5064
+ if (Ce(f, i.owner[p], t, l, h, c, d)) {
5065
+ Hs(g, e === 2 ? g : -g, i.owner[p]);
5066
5066
  break;
5067
5067
  }
5068
5068
  }
5069
5069
  for (let p = m - 1; p >= 0; p--) {
5070
5070
  const g = u - r[p];
5071
5071
  if (g > s) break;
5072
- if (Re(f, i.owner[p], t, l, h, c, d)) {
5073
- Ws(g, e === 2 ? -g : g, i.owner[p]);
5072
+ if (Ce(f, i.owner[p], t, l, h, c, d)) {
5073
+ Hs(g, e === 2 ? -g : g, i.owner[p]);
5074
5074
  break;
5075
5075
  }
5076
5076
  }
5077
5077
  }
5078
- const ft = new Uint8Array(2), Ce = new Int8Array(2), _e = new Float64Array(2), Bt = new Float64Array(2), Xt = new Int32Array(2), qt = new Int32Array(2), Ut = new Int32Array(2);
5079
- function Hs(n, t, e, s, i, r) {
5078
+ const ft = new Uint8Array(2), _e = new Int8Array(2), Oe = new Float64Array(2), Bt = new Float64Array(2), Xt = new Int32Array(2), qt = new Int32Array(2), Ut = new Int32Array(2);
5079
+ function $s(n, t, e, s, i, r) {
5080
5080
  const o = t === 0 ? n.x : n.y, a = N[t], l = N[t + 2];
5081
5081
  let h = P, c = 0, d = 0, u = -1;
5082
- if ($t = !1, e & 1 && me(o, a, D, 0, i), e & 2 && me(o, (a + l) / 2, O, 1, i), e & 4 && me(o, l, D, 2, i), $t && (h = Sa, c = Ft, d = Li, u = Ii), !s && (e === 1 || e === 4) && (Na(n, t, e === 1 ? 0 : 2, i), Kt && (h === P || jt < c - E) && (h = dt, c = jt, d = Di, u = e === 1 ? 0 : 2, Xt[t] = Fi)), (s || e === 1 || e === 4) && (Oa(n, t, e, s, i), Gt && (h === P || Vt < c - E) && (h = ut, c = Vt, d = _i, u = Oi, Bt[t] = Ni, qt[t] = Ue, Ut[t] = Ye)), r !== null && r.win[t] !== P && e & Da[r.line[t]]) {
5082
+ if ($t = !1, e & 1 && me(o, a, D, 0, i), e & 2 && me(o, (a + l) / 2, O, 1, i), e & 4 && me(o, l, D, 2, i), $t && (h = Ta, c = Ft, d = Ii, u = Ri), !s && (e === 1 || e === 4) && (Da(n, t, e === 1 ? 0 : 2, i), Kt && (h === P || jt < c - E) && (h = dt, c = jt, d = Fi, u = e === 1 ? 0 : 2, Xt[t] = Bi)), (s || e === 1 || e === 4) && (Na(n, t, e, s, i), Gt && (h === P || Vt < c - E) && (h = ut, c = Vt, d = Oi, u = Ni, Bt[t] = Di, qt[t] = Ye, Ut[t] = ze)), r !== null && r.win[t] !== P && e & Fa[r.line[t]]) {
5083
5083
  const f = r.line[t], m = f === 0 ? a : f === 2 ? l : (a + l) / 2, p = r.target[t] - m, g = Math.abs(p);
5084
- g <= i * Ma && (h === P || c > g - i * ka) && (h = r.win[t], d = p, u = f, Bt[t] = r.gap[t], Xt[t] = r.owner[t], qt[t] = r.before[t], Ut[t] = r.after[t]);
5084
+ g <= i * ka && (h === P || c > g - i * Sa) && (h = r.win[t], d = p, u = f, Bt[t] = r.gap[t], Xt[t] = r.owner[t], qt[t] = r.before[t], Ut[t] = r.after[t]);
5085
5085
  }
5086
- r !== null && (r.win[t] = h, h !== P && (r.line[t] = u, r.target[t] = (u === 0 ? a : u === 2 ? l : (a + l) / 2) + d, r.gap[t] = Bt[t], r.owner[t] = Xt[t], r.before[t] = qt[t], r.after[t] = Ut[t])), ft[t] = h, _e[t] = d, Ce[t] = u;
5086
+ r !== null && (r.win[t] = h, h !== P && (r.line[t] = u, r.target[t] = (u === 0 ? a : u === 2 ? l : (a + l) / 2) + d, r.gap[t] = Bt[t], r.owner[t] = Xt[t], r.before[t] = qt[t], r.after[t] = Ut[t])), ft[t] = h, Oe[t] = d, _e[t] = u;
5087
5087
  }
5088
- const Da = [1, 2, 4], Oe = /* @__PURE__ */ new WeakMap();
5089
- function Fa(n, t) {
5090
- let e = Oe.get(n);
5088
+ const Fa = [1, 2, 4], Ne = /* @__PURE__ */ new WeakMap();
5089
+ function Ba(n, t) {
5090
+ let e = Ne.get(n);
5091
5091
  return e ? e.index !== t && (e.index = t, e.win[0] = P, e.win[1] = P) : (e = {
5092
5092
  index: t,
5093
5093
  win: new Uint8Array(2),
@@ -5097,29 +5097,29 @@ function Fa(n, t) {
5097
5097
  owner: new Int32Array(2),
5098
5098
  before: new Int32Array(2),
5099
5099
  after: new Int32Array(2)
5100
- }, Oe.set(n, e)), e;
5100
+ }, Ne.set(n, e)), e;
5101
5101
  }
5102
- function Ba(n) {
5103
- const t = Oe.get(n);
5102
+ function Xa(n) {
5103
+ const t = Ne.get(n);
5104
5104
  t && (t.win[0] = P, t.win[1] = P);
5105
5105
  }
5106
- function $s(n) {
5106
+ function Gs(n) {
5107
5107
  n.sort((e, s) => e - s);
5108
5108
  let t = 0;
5109
5109
  for (let e = 0; e < n.length; e++)
5110
5110
  (t === 0 || n[e] - n[t - 1] > E) && (n[t++] = n[e]);
5111
5111
  return n.length = t, n;
5112
5112
  }
5113
- function Xa(n, t, e, s, i, r) {
5113
+ function qa(n, t, e, s, i, r) {
5114
5114
  for (let o = 0; o < n.length; o++) {
5115
5115
  const a = n[o];
5116
5116
  if (a.axis === t && a.kind === r && Math.abs(a.at - e) <= E) {
5117
- const l = $s([...a.marks ?? [], ...s]);
5117
+ const l = Gs([...a.marks ?? [], ...s]);
5118
5118
  a.marks = l, a.from = Math.min(a.from, l[0] - i), a.to = Math.max(a.to, l[l.length - 1] + i);
5119
5119
  return;
5120
5120
  }
5121
5121
  }
5122
- $s(s), n.push({
5122
+ Gs(s), n.push({
5123
5123
  axis: t,
5124
5124
  at: e,
5125
5125
  from: s[0] - i,
@@ -5152,11 +5152,11 @@ function H(n, t, e, s, i, r, o, a, l, h = NaN, c = NaN) {
5152
5152
  }
5153
5153
  if (w === null) return;
5154
5154
  const b = r === O ? (o + a) / 2 : o, k = r === O ? b : a;
5155
- w.push(b, k), Xa(n, t, i, w, l, r === O ? "center" : "edge");
5155
+ w.push(b, k), qa(n, t, i, w, l, r === O ? "center" : "edge");
5156
5156
  }
5157
5157
  const nt = 6, Pt = new Float64Array(nt), Lt = new Float64Array(nt), It = new Float64Array(nt);
5158
- function Gs(n, t, e) {
5159
- const s = t.boxes, i = 1 - e, r = Pi[e], o = Bt[e], a = Math.round(o), l = I[e], h = I[e + 2], c = I[i], d = I[i + 2], u = qt[e], f = Ut[e];
5158
+ function Vs(n, t, e) {
5159
+ const s = t.boxes, i = 1 - e, r = Li[e], o = Bt[e], a = Math.round(o), l = I[e], h = I[e + 2], c = I[i], d = I[i + 2], u = qt[e], f = Ut[e];
5160
5160
  if (u >= 0) {
5161
5161
  const w = u * 4, b = s[w + e + 2];
5162
5162
  if (Math.abs(l - b - o) <= E) {
@@ -5173,8 +5173,8 @@ function Gs(n, t, e) {
5173
5173
  }
5174
5174
  const m = e === 0 ? t.gapsX : t.gapsY, p = m.v, g = (l + h) / 2;
5175
5175
  let y = 0, v = 0;
5176
- for (let w = j(p, o - E); w < p.length && p[w] <= o + E && v < Ea; w++, v++) {
5177
- if (!Le(t, m, w, i, c, d)) continue;
5176
+ for (let w = j(p, o - E); w < p.length && p[w] <= o + E && v < Pa; w++, v++) {
5177
+ if (!Ie(t, m, w, i, c, d)) continue;
5178
5178
  const b = Math.abs((s[m.before[w] * 4 + e + 2] + s[m.after[w] * 4 + e]) / 2 - g);
5179
5179
  let k = y;
5180
5180
  for (; k > 0 && Rt[k - 1] > b; ) k--;
@@ -5206,29 +5206,29 @@ function ge(n, t, e, s, i) {
5206
5206
  const c = s * 4;
5207
5207
  o = t.boxes[c + e], a = t.boxes[c + e + 2], l = t.boxes[c + r], h = t.boxes[c + r + 2];
5208
5208
  }
5209
- n.push({ axis: Pi[e], at: (l + h) / 2, from: o, to: a, kind: "width", label: i });
5209
+ n.push({ axis: Li[e], at: (l + h) / 2, from: o, to: a, kind: "width", label: i });
5210
5210
  }
5211
- function Vs(n, t, e) {
5211
+ function Ks(n, t, e) {
5212
5212
  const s = I[e + 2] - I[e], i = Math.round(s), r = Xt[e];
5213
5213
  ge(n, t, e, -1, i), ge(n, t, e, r, i);
5214
5214
  const o = e === 0 ? t.widths : t.heights, a = o.v, l = 1 - e;
5215
5215
  let h = 1;
5216
- for (let c = j(a, s - E); c < a.length && a[c] <= s + E && h < Aa; c++) {
5216
+ for (let c = j(a, s - E); c < a.length && a[c] <= s + E && h < Ea; c++) {
5217
5217
  const d = o.owner[c];
5218
- d !== r && Re(t.boxes, d, e, I[e], I[e + 2], I[l], I[l + 2]) && (ge(n, t, e, d, i), h++);
5218
+ d !== r && Ce(t.boxes, d, e, I[e], I[e + 2], I[l], I[l + 2]) && (ge(n, t, e, d, i), h++);
5219
5219
  }
5220
5220
  }
5221
- function Bi() {
5221
+ function Xi() {
5222
5222
  return { dx: 0, dy: 0, guides: [] };
5223
5223
  }
5224
- function Xi(n, t, e, s, i, r, o, a) {
5224
+ function qi(n, t, e, s, i, r, o, a) {
5225
5225
  if (a.dx = 0, a.dy = 0, a.edgeX = void 0, a.edgeY = void 0, a.guides.length = 0, !(r > 0) || n.count === 0 || e === 0 && s === 0) return a;
5226
5226
  N[0] = t.minX, N[1] = t.minY, N[2] = t.maxX, N[3] = t.maxY, ft[0] = P, ft[1] = P;
5227
- const l = Fa(a, n);
5228
- e !== 0 ? Hs(n, 0, e, i, r, l) : l.win[0] = P, s !== 0 ? Hs(n, 1, s, i, r, l) : l.win[1] = P;
5227
+ const l = Ba(a, n);
5228
+ e !== 0 ? $s(n, 0, e, i, r, l) : l.win[0] = P, s !== 0 ? $s(n, 1, s, i, r, l) : l.win[1] = P;
5229
5229
  const h = ft[0], c = ft[1];
5230
5230
  if (h === P && c === P) return a;
5231
- const d = h !== P ? Ce[0] : -1, u = c !== P ? Ce[1] : -1, f = h !== P ? _e[0] : 0, m = c !== P ? _e[1] : 0;
5231
+ const d = h !== P ? _e[0] : -1, u = c !== P ? _e[1] : -1, f = h !== P ? Oe[0] : 0, m = c !== P ? Oe[1] : 0;
5232
5232
  a.dx = f, a.dy = m, i || (d >= 0 && (a.edgeX = d === 0 ? "min" : "max"), u >= 0 && (a.edgeY = u === 0 ? "min" : "max"));
5233
5233
  const p = d >= 0 && (i || d === 0), g = d >= 0 && (i || d === 2), y = u >= 0 && (i || u === 0), v = u >= 0 && (i || u === 2), w = p ? t.minX + f : t.minX, b = g ? t.maxX + f : t.maxX, k = y ? t.minY + m : t.minY, x = v ? t.maxY + m : t.maxY, M = a.guides;
5234
5234
  if (d >= 0)
@@ -5249,17 +5249,17 @@ function Xi(n, t, e, s, i, r, o, a) {
5249
5249
  const T = u === 0 ? k : x;
5250
5250
  H(M, "y", n, n.y, T, D, w, b, o);
5251
5251
  }
5252
- return (h === ut || h === dt || c === ut || c === dt) && (I[0] = w, I[1] = k, I[2] = b, I[3] = x, h === ut ? Gs(M, n, 0) : h === dt && Vs(M, n, 0), c === ut ? Gs(M, n, 1) : c === dt && Vs(M, n, 1)), a;
5252
+ return (h === ut || h === dt || c === ut || c === dt) && (I[0] = w, I[1] = k, I[2] = b, I[3] = x, h === ut ? Vs(M, n, 0) : h === dt && Ks(M, n, 0), c === ut ? Vs(M, n, 1) : c === dt && Ks(M, n, 1)), a;
5253
5253
  }
5254
- function qa(n, t, e, s, i = Bi()) {
5255
- return Xi(n, t, 7, 7, !0, e, s, i);
5254
+ function Ua(n, t, e, s, i = Xi()) {
5255
+ return qi(n, t, 7, 7, !0, e, s, i);
5256
5256
  }
5257
- function Ua(n, t, e, s, i, r = Bi()) {
5257
+ function Ya(n, t, e, s, i, r = Xi()) {
5258
5258
  const o = (e.left ? 1 : 0) | (e.right ? 4 : 0), a = (e.top ? 1 : 0) | (e.bottom ? 4 : 0);
5259
- return Xi(n, t, o, a, !1, s, i, r);
5259
+ return qi(n, t, o, a, !1, s, i, r);
5260
5260
  }
5261
- const Ks = 400, js = 0.25, jl = { guides: !0, grid: !1 }, _t = (n, t) => n.axis === t;
5262
- class Qs {
5261
+ const js = 400, Qs = 0.25, Zl = { guides: !0, grid: !1 }, _t = (n, t) => n.axis === t;
5262
+ class Zs {
5263
5263
  constructor(t, e) {
5264
5264
  this.settings = t, this.gridSize = e;
5265
5265
  }
@@ -5269,14 +5269,14 @@ class Qs {
5269
5269
  hits = [];
5270
5270
  // `view` is the visible world rect; `exclude` are the cards being moved.
5271
5271
  begin(t, e, s, i) {
5272
- if (this.zoom = s > 0 ? s : 1, this.index = null, Ba(this.result), !this.settings.guides) return;
5273
- const r = (e.x1 - e.x0) * js, o = (e.y1 - e.y0) * js, a = { minX: e.x0 - r, minY: e.y0 - o, maxX: e.x1 + r, maxY: e.y1 + o }, l = (e.x0 + e.x1) / 2, h = (e.y0 + e.y1) / 2, c = [];
5272
+ if (this.zoom = s > 0 ? s : 1, this.index = null, Xa(this.result), !this.settings.guides) return;
5273
+ const r = (e.x1 - e.x0) * Qs, o = (e.y1 - e.y0) * Qs, a = { minX: e.x0 - r, minY: e.y0 - o, maxX: e.x1 + r, maxY: e.y1 + o }, l = (e.x0 + e.x1) / 2, h = (e.y0 + e.y1) / 2, c = [];
5274
5274
  for (const d of t.searchInto(a, this.hits)) {
5275
5275
  if (i.has(d.id)) continue;
5276
5276
  const u = q(d);
5277
5277
  c.push({ id: d.id, box: u, d: Math.hypot(rt(u) - l, ot(u) - h) });
5278
5278
  }
5279
- c.length > Ks && (c.sort((d, u) => d.d - u.d), c.length = Ks), this.index = Ra(c);
5279
+ c.length > js && (c.sort((d, u) => d.d - u.d), c.length = js), this.index = Ca(c);
5280
5280
  }
5281
5281
  end() {
5282
5282
  this.index = null;
@@ -5287,10 +5287,10 @@ class Qs {
5287
5287
  }
5288
5288
  // The correction to add to a box being moved, and the guides to draw.
5289
5289
  move(t) {
5290
- const e = Ns / this.zoom;
5290
+ const e = Ds / this.zoom;
5291
5291
  let s = 0, i = 0, r = [];
5292
5292
  if (this.index) {
5293
- const o = qa(this.index, t, e, Ds / this.zoom, this.result);
5293
+ const o = Ua(this.index, t, e, Fs / this.zoom, this.result);
5294
5294
  s = o.dx, i = o.dy, r = o.guides;
5295
5295
  }
5296
5296
  if (this.settings.grid) {
@@ -5302,15 +5302,15 @@ class Qs {
5302
5302
  // The correction to add to the dragged edges of a box being resized. A symmetric resize flags both
5303
5303
  // edges of an axis: `edgeX` / `edgeY` then say which one the correction belongs to.
5304
5304
  resize(t, e) {
5305
- const s = Ns / this.zoom;
5305
+ const s = Ds / this.zoom;
5306
5306
  let i = 0, r = 0, o, a, l = [];
5307
5307
  if (this.index) {
5308
- const h = Ua(
5308
+ const h = Ya(
5309
5309
  this.index,
5310
5310
  t,
5311
5311
  e,
5312
5312
  s,
5313
- Ds / this.zoom,
5313
+ Fs / this.zoom,
5314
5314
  this.result
5315
5315
  );
5316
5316
  i = h.dx, r = h.dy, o = h.edgeX, a = h.edgeY, l = h.guides;
@@ -5333,8 +5333,8 @@ class Qs {
5333
5333
  return Math.abs(l) <= r ? { delta: l, edge: l === o ? "min" : "max" } : null;
5334
5334
  }
5335
5335
  }
5336
- const ye = 3, Ya = 1, za = 10, et = (n) => Math.round(n * 100) / 100;
5337
- class Ql {
5336
+ const ye = 3, za = 1, Wa = 10, et = (n) => Math.round(n * 100) / 100;
5337
+ class Jl {
5338
5338
  constructor(t, e, s, i, r = {}) {
5339
5339
  this.host = t, this.stage = e, this.store = s, this.snapping = i, this.opts = {
5340
5340
  select: r.select ?? !0,
@@ -5353,7 +5353,7 @@ class Ql {
5353
5353
  this.stage.onFrame(() => this.onFrame())
5354
5354
  );
5355
5355
  }
5356
- events = new io();
5356
+ events = new no();
5357
5357
  selection = [];
5358
5358
  snapping;
5359
5359
  opts;
@@ -5419,7 +5419,7 @@ class Ql {
5419
5419
  let i = null;
5420
5420
  for (const r of e.rects.values()) {
5421
5421
  const o = mt([r]);
5422
- i = i ? xe(i, o) : o;
5422
+ i = i ? Me(i, o) : o;
5423
5423
  }
5424
5424
  e.box = i;
5425
5425
  } else if (e?.kind === "resize") {
@@ -5467,7 +5467,7 @@ class Ql {
5467
5467
  // ── Input ──────────────────────────────────────────────────────────────────
5468
5468
  bind() {
5469
5469
  const t = this.host;
5470
- t.tabIndex = 0, t.style.outline = "none", t.style.touchAction = "none";
5470
+ t.tabIndex = 0, t.style.outline = "none", t.style.touchAction = "none", t.style.setProperty("overscroll-behavior", "none"), this.cleanups.push(Ha(t.ownerDocument));
5471
5471
  const e = (r, o, a) => {
5472
5472
  t.addEventListener(r, o, a), this.cleanups.push(() => t.removeEventListener(r, o, a));
5473
5473
  };
@@ -5539,11 +5539,11 @@ class Ql {
5539
5539
  }
5540
5540
  const o = this.selection.length > 0 ? ue(this.store, this.selection, i.cam.scale) : null;
5541
5541
  if (o) {
5542
- const h = _s(o, r.x, r.y, i.cam.scale);
5542
+ const h = Os(o, r.x, r.y, i.cam.scale);
5543
5543
  if (h) {
5544
- const c = new xa(this.store, this.selection, h.id, r);
5544
+ const c = new Ma(this.store, this.selection, h.id, r);
5545
5545
  if (c.affected.length > 0) {
5546
- const d = new Qs(this.snapping, pt);
5546
+ const d = new Zs(this.snapping, pt);
5547
5547
  d.begin(this.store, i.cam.visibleRect(), i.cam.scale, new Set(c.affected)), this.startGesture({ kind: "resize", session: c, snap: d, handle: h.id });
5548
5548
  for (const u of c.affected) i.pin(u, !0);
5549
5549
  this.selDirty = !0;
@@ -5606,7 +5606,7 @@ class Ql {
5606
5606
  maxY: Math.max(i.sy, o.y)
5607
5607
  };
5608
5608
  r.overlay.setMarquee(a);
5609
- const l = va(this.store, a, "touch");
5609
+ const l = ba(this.store, a, "touch");
5610
5610
  this.setSelection(i.additive ? [.../* @__PURE__ */ new Set([...i.base, ...l])] : l);
5611
5611
  break;
5612
5612
  }
@@ -5638,9 +5638,9 @@ class Ql {
5638
5638
  const c = this.store.get(h), d = K(c);
5639
5639
  r.set(h, d), s.pin(h, !0);
5640
5640
  const u = mt([d]);
5641
- o = o ? xe(o, u) : u;
5641
+ o = o ? Me(o, u) : u;
5642
5642
  }
5643
- const a = new Qs(this.snapping, pt);
5643
+ const a = new Zs(this.snapping, pt);
5644
5644
  a.begin(this.store, s.cam.visibleRect(), s.cam.scale, new Set(i));
5645
5645
  const l = s.screenToWorld(t.x, t.y);
5646
5646
  this.startGesture({ kind: "drag", ids: i, start: l, rects: r, box: o, snap: a, moved: !1 }), this.host.style.cursor = "grabbing", this.store.lift(i), s.requestFrame(), this.updateDrag(this.gesture, e, this.lastMods);
@@ -5744,7 +5744,7 @@ class Ql {
5744
5744
  let o;
5745
5745
  if (this.opts.commit)
5746
5746
  try {
5747
- for (const [a, l] of s) Te(`${t}: card "${a}"`, l);
5747
+ for (const [a, l] of s) Ae(`${t}: card "${a}"`, l);
5748
5748
  this.store.batch(() => {
5749
5749
  for (const [a, l] of s)
5750
5750
  this.store.update(a, { x: l.x, y: l.y, w: l.w, h: l.h }, "user");
@@ -5782,7 +5782,7 @@ class Ql {
5782
5782
  // ── Hover and cursor ───────────────────────────────────────────────────────
5783
5783
  updateHover(t) {
5784
5784
  if (this.gesture || !this.opts.select || this.panMode) return;
5785
- const e = this.stage, s = e.screenToWorld(t.x, t.y), i = this.handles ? _s(this.handles, s.x, s.y, e.cam.scale) : null;
5785
+ const e = this.stage, s = e.screenToWorld(t.x, t.y), i = this.handles ? Os(this.handles, s.x, s.y, e.cam.scale) : null;
5786
5786
  if (i) {
5787
5787
  this.host.style.cursor = i.cursor, this.setHover(null);
5788
5788
  return;
@@ -5815,7 +5815,7 @@ class Ql {
5815
5815
  if (i.length === 0) return;
5816
5816
  this.opts.commit && this.store.remove(i, "user"), this.events.emit("delete", { ids: i });
5817
5817
  } else if (t.key.startsWith("Arrow") && this.selection.length > 0 && !s) {
5818
- const i = t.shiftKey ? za : Ya, r = t.key === "ArrowLeft" ? -i : t.key === "ArrowRight" ? i : 0, o = t.key === "ArrowUp" ? -i : t.key === "ArrowDown" ? i : 0, a = /* @__PURE__ */ new Map();
5818
+ const i = t.shiftKey ? Wa : za, r = t.key === "ArrowLeft" ? -i : t.key === "ArrowRight" ? i : 0, o = t.key === "ArrowUp" ? -i : t.key === "ArrowDown" ? i : 0, a = /* @__PURE__ */ new Map();
5819
5819
  this.store.batch(() => {
5820
5820
  for (const l of this.selection) {
5821
5821
  const h = this.store.get(l);
@@ -5845,20 +5845,31 @@ class Ql {
5845
5845
  }
5846
5846
  }
5847
5847
  }
5848
- const qi = /* @__PURE__ */ new WeakMap();
5849
- function Zl(n, t) {
5850
- qi.set(n, t);
5848
+ const we = /* @__PURE__ */ new WeakMap();
5849
+ function Ha(n) {
5850
+ const t = n.documentElement;
5851
+ let e = we.get(t);
5852
+ e || (e = { count: 0, prev: t.style.getPropertyValue("overscroll-behavior-x") }, we.set(t, e), t.style.setProperty("overscroll-behavior-x", "none")), e.count++;
5853
+ const s = e;
5854
+ let i = !1;
5855
+ return () => {
5856
+ i || (i = !0, !(--s.count > 0) && (s.prev ? t.style.setProperty("overscroll-behavior-x", s.prev) : t.style.removeProperty("overscroll-behavior-x"), we.delete(t)));
5857
+ };
5851
5858
  }
5852
- function Jl(n) {
5853
- const t = qi.get(n);
5859
+ const Ui = /* @__PURE__ */ new WeakMap();
5860
+ function th(n, t) {
5861
+ Ui.set(n, t);
5862
+ }
5863
+ function eh(n) {
5864
+ const t = Ui.get(n);
5854
5865
  if (!t) throw new TypeError("getInternals: not a Corkboard");
5855
5866
  return t;
5856
5867
  }
5857
- const Ui = De.cardWidth, Yi = De.cardAspect;
5868
+ const Yi = Fe.cardWidth, zi = Fe.cardAspect;
5858
5869
  function Jt(n) {
5859
- return n !== void 0 && Number.isFinite(n) && n > 0 ? n : Yi;
5870
+ return n !== void 0 && Number.isFinite(n) && n > 0 ? n : zi;
5860
5871
  }
5861
- function zi(n, t) {
5872
+ function Wi(n, t) {
5862
5873
  let e = t;
5863
5874
  for (let s = 0; s < n.length; s++) {
5864
5875
  const i = n[s].w;
@@ -5866,7 +5877,7 @@ function zi(n, t) {
5866
5877
  }
5867
5878
  return e;
5868
5879
  }
5869
- function Wi(n, t) {
5880
+ function Hi(n, t) {
5870
5881
  const e = Math.max(1, Math.floor(t.columns)), s = (t.slot ?? t.width) + t.gap, i = new Float64Array(e), r = new Array(n.length);
5871
5882
  let o = 0, a = 0;
5872
5883
  for (let l = 0; l < n.length; l++) {
@@ -5879,16 +5890,16 @@ function Wi(n, t) {
5879
5890
  }
5880
5891
  return { rects: r, width: o, height: a };
5881
5892
  }
5882
- const ze = (n, t, e) => n < t ? t : n > e ? e : n;
5893
+ const We = (n, t, e) => n < t ? t : n > e ? e : n;
5883
5894
  function wt(n) {
5884
5895
  const t = n.length;
5885
5896
  if (t === 0) return 0;
5886
5897
  const e = Float64Array.from(n).sort(), s = t >> 1;
5887
5898
  return t % 2 === 1 ? e[s] : (e[s - 1] + e[s]) / 2;
5888
5899
  }
5889
- const Zs = (n, t) => n.id < t.id ? -1 : n.id > t.id ? 1 : 0;
5890
- function We(n, t = "y") {
5891
- const e = t === "y" ? ot : rt, s = (c) => t === "y" ? c.minX : c.minY, i = wt(n.map((c) => t === "y" ? Zt(c.box) : Qt(c.box))) / 2, r = n.slice().sort((c, d) => e(c.box) - e(d.box) || Zs(c, d)), o = [];
5900
+ const Js = (n, t) => n.id < t.id ? -1 : n.id > t.id ? 1 : 0;
5901
+ function He(n, t = "y") {
5902
+ const e = t === "y" ? ot : rt, s = (c) => t === "y" ? c.minX : c.minY, i = wt(n.map((c) => t === "y" ? Zt(c.box) : Qt(c.box))) / 2, r = n.slice().sort((c, d) => e(c.box) - e(d.box) || Js(c, d)), o = [];
5892
5903
  let a = [], l = 0;
5893
5904
  for (const c of r) {
5894
5905
  const d = e(c.box);
@@ -5897,31 +5908,31 @@ function We(n, t = "y") {
5897
5908
  a.length > 0 && o.push(a);
5898
5909
  const h = [];
5899
5910
  for (const c of o) {
5900
- c.sort((d, u) => s(d.box) - s(u.box) || Zs(d, u));
5911
+ c.sort((d, u) => s(d.box) - s(u.box) || Js(d, u));
5901
5912
  for (const d of c) h.push(d);
5902
5913
  }
5903
5914
  return h;
5904
5915
  }
5905
- const Wa = 3, Ha = 12, $a = 48, Ga = 2, Va = 10;
5906
- function Ka(n) {
5916
+ const $a = 3, Ga = 12, Va = 48, Ka = 2, ja = 10;
5917
+ function Qa(n) {
5907
5918
  const t = [];
5908
5919
  for (let e = 0; e < n.length; e++) {
5909
5920
  const s = n[e];
5910
5921
  Number.isFinite(s) && s > 0 && t.push(s);
5911
5922
  }
5912
- return t.length >= Wa ? wt(t) : Ui;
5923
+ return t.length >= $a ? wt(t) : Yi;
5913
5924
  }
5914
- function He(n) {
5915
- return ze(Math.round(n / 10), Ha, $a);
5925
+ function $e(n) {
5926
+ return We(Math.round(n / 10), Ga, Va);
5916
5927
  }
5917
- function ja(n, t, e = !1) {
5918
- return n <= 1 ? 1 : e ? n : ze(Math.round(Math.sqrt(n * Jt(t))), Ga, Va);
5928
+ function Za(n, t, e = !1) {
5929
+ return n <= 1 ? 1 : e ? n : We(Math.round(Math.sqrt(n * Jt(t))), Ka, ja);
5919
5930
  }
5920
- function th(n) {
5921
- const { items: t, anchor: e } = n, s = t.length, i = Ka(n.existingCardWidths), r = He(i);
5931
+ function sh(n) {
5932
+ const { items: t, anchor: e } = n, s = t.length, i = Qa(n.existingCardWidths), r = $e(i);
5922
5933
  let o = 0;
5923
5934
  for (let f = 0; f < s; f++) o += Jt(t[f].aspect);
5924
- const a = s > 0 ? o / s : Yi, l = ja(s, a, n.singleRow), h = Wi(t, { width: i, gap: r, columns: l, slot: zi(t, i) }), c = e.kind === "center" ? e.x - h.width / 2 : e.x, d = e.kind === "center" ? e.y - h.height / 2 : e.y, u = h.rects;
5935
+ const a = s > 0 ? o / s : zi, l = Za(s, a, n.singleRow), h = Hi(t, { width: i, gap: r, columns: l, slot: Wi(t, i) }), c = e.kind === "center" ? e.x - h.width / 2 : e.x, d = e.kind === "center" ? e.y - h.height / 2 : e.y, u = h.rects;
5925
5936
  for (let f = 0; f < u.length; f++)
5926
5937
  u[f].x += c, u[f].y += d;
5927
5938
  return {
@@ -5932,7 +5943,7 @@ function th(n) {
5932
5943
  columns: l
5933
5944
  };
5934
5945
  }
5935
- function eh(n, t, e) {
5946
+ function ih(n, t, e) {
5936
5947
  const s = new Array(n.rects.length);
5937
5948
  for (let r = 0; r < s.length; r++) {
5938
5949
  const o = n.rects[r];
@@ -5945,7 +5956,7 @@ function eh(n, t, e) {
5945
5956
  bounds: { minX: i.minX + t, minY: i.minY + e, maxX: i.maxX + t, maxY: i.maxY + e }
5946
5957
  };
5947
5958
  }
5948
- function sh(n, t, e) {
5959
+ function nh(n, t, e) {
5949
5960
  const s = n.rects;
5950
5961
  for (let r = 0; r < s.length; r++)
5951
5962
  s[r].x += t, s[r].y += e;
@@ -5953,18 +5964,18 @@ function sh(n, t, e) {
5953
5964
  return i.minX += t, i.maxX += t, i.minY += e, i.maxY += e, n;
5954
5965
  }
5955
5966
  const G = 1e-9, Ot = 1e-6;
5956
- function ih(n) {
5967
+ function rh(n) {
5957
5968
  const t = wt(n.filter((e) => Number.isFinite(e) && e > 0));
5958
- return He(t > 0 ? t : Ui);
5969
+ return $e(t > 0 ? t : Yi);
5959
5970
  }
5960
- const Hi = (n, t) => t === void 0 ? n : { minX: n.minX + t.dx, minY: n.minY + t.dy, maxX: n.maxX + t.dx, maxY: n.maxY + t.dy }, Qa = (n, t, e) => {
5971
+ const $i = (n, t) => t === void 0 ? n : { minX: n.minX + t.dx, minY: n.minY + t.dy, maxX: n.maxX + t.dx, maxY: n.maxY + t.dy }, Ja = (n, t, e) => {
5961
5972
  const s = n.get(t), i = (s?.dx ?? 0) + e.dx, r = (s?.dy ?? 0) + e.dy;
5962
5973
  Math.abs(i) > G || Math.abs(r) > G ? n.set(t, { dx: i, dy: r }) : n.delete(t);
5963
5974
  };
5964
- function Za(n, t, e, s = !1) {
5975
+ function tl(n, t, e, s = !1) {
5965
5976
  const i = /* @__PURE__ */ new Map();
5966
5977
  if (n.length < 2) return i;
5967
- const o = Number.isFinite(t) && t > 0 ? t : 0, a = s ? n : We(n, e ?? "y"), l = [];
5978
+ const o = Number.isFinite(t) && t > 0 ? t : 0, a = s ? n : He(n, e ?? "y"), l = [];
5968
5979
  for (const h of a) {
5969
5980
  let c = h.box, d = 0, u = 0;
5970
5981
  for (let f = 0; f <= l.length; f++) {
@@ -5973,13 +5984,13 @@ function Za(n, t, e, s = !1) {
5973
5984
  c.minX < b.maxX + o - Ot && b.minX < c.maxX + o - Ot && c.minY < b.maxY + o - Ot && b.minY < c.maxY + o - Ot && (b.maxX > m && (m = b.maxX), b.maxY > p && (p = b.maxY));
5974
5985
  if (m === -1 / 0) break;
5975
5986
  const g = m + o - c.minX, y = p + o - c.minY, w = e === "x" || e === void 0 && g <= y ? { dx: g, dy: 0 } : { dx: 0, dy: y };
5976
- c = Hi(c, w), d += w.dx, u += w.dy;
5987
+ c = $i(c, w), d += w.dx, u += w.dy;
5977
5988
  }
5978
5989
  l.push(c), (Math.abs(d) > G || Math.abs(u) > G) && i.set(h.id, { dx: d, dy: u });
5979
5990
  }
5980
5991
  return i;
5981
5992
  }
5982
- function nh(n, t, e = {}) {
5993
+ function oh(n, t, e = {}) {
5983
5994
  const s = /* @__PURE__ */ new Map();
5984
5995
  if (n.length < 2) return s;
5985
5996
  let i = 1 / 0, r = 1 / 0, o = -1 / 0, a = -1 / 0;
@@ -6010,15 +6021,15 @@ function nh(n, t, e = {}) {
6010
6021
  (Math.abs(c) > G || Math.abs(d) > G) && s.set(l, { dx: c, dy: d });
6011
6022
  }
6012
6023
  if (e.gap !== void 0) {
6013
- const l = t === "left" || t === "centerX" || t === "right" ? "y" : "x", h = We(n, l).map((c) => ({
6024
+ const l = t === "left" || t === "centerX" || t === "right" ? "y" : "x", h = He(n, l).map((c) => ({
6014
6025
  id: c.id,
6015
- box: Hi(c.box, s.get(c.id))
6026
+ box: $i(c.box, s.get(c.id))
6016
6027
  }));
6017
- for (const [c, d] of Za(h, e.gap, l, !0)) Qa(s, c, d);
6028
+ for (const [c, d] of tl(h, e.gap, l, !0)) Ja(s, c, d);
6018
6029
  }
6019
6030
  return s;
6020
6031
  }
6021
- function rh(n, t, e = {}) {
6032
+ function ah(n, t, e = {}) {
6022
6033
  const s = /* @__PURE__ */ new Map(), i = n.length;
6023
6034
  if (i < 3) return s;
6024
6035
  const r = t === "x", o = (p) => r ? p.minX : p.minY, a = (p) => r ? p.maxX : p.maxY, l = (p) => r ? Qt(p) : Zt(p), h = (p) => r ? rt(p) : ot(p), c = n.slice().sort((p, g) => {
@@ -6037,7 +6048,7 @@ function rh(n, t, e = {}) {
6037
6048
  }
6038
6049
  return s;
6039
6050
  }
6040
- function oh(n) {
6051
+ function lh(n) {
6041
6052
  const t = /* @__PURE__ */ new Map();
6042
6053
  if (n.length === 0) return t;
6043
6054
  const e = wt(n.map((s) => s.w));
@@ -6048,30 +6059,30 @@ function oh(n) {
6048
6059
  });
6049
6060
  return t;
6050
6061
  }
6051
- const Ja = 48, tl = 2, el = 8, we = 160, Nt = 1e-9;
6052
- function $i(n, t, e) {
6053
- const s = e.step !== void 0 && e.step > 0 ? e.step : Ja, i = e.maxRadiusFactor ?? tl, r = rt(t) - n.w / 2, o = ot(t) - n.h / 2, a = i * Math.hypot(Qt(t), Zt(t));
6062
+ const el = 48, sl = 2, il = 8, ve = 160, Nt = 1e-9;
6063
+ function Gi(n, t, e) {
6064
+ const s = e.step !== void 0 && e.step > 0 ? e.step : el, i = e.maxRadiusFactor ?? sl, r = rt(t) - n.w / 2, o = ot(t) - n.h / 2, a = i * Math.hypot(Qt(t), Zt(t));
6054
6065
  let l = s, h = Math.max(1, Math.floor(a / l));
6055
- return h > we && (h = we, l = a / we), { ox: r, oy: o, step: l, maxRings: h, maxRadius: a };
6066
+ return h > ve && (h = ve, l = a / ve), { ox: r, oy: o, step: l, maxRings: h, maxRadius: a };
6056
6067
  }
6057
- function ah(n, t, e = {}) {
6058
- const { ox: s, oy: i, step: r, maxRings: o } = $i(n, t, e), a = r * o;
6068
+ function hh(n, t, e = {}) {
6069
+ const { ox: s, oy: i, step: r, maxRings: o } = Gi(n, t, e), a = r * o;
6059
6070
  return { minX: s - a, minY: i - a, maxX: s + n.w + a, maxY: i + n.h + a };
6060
6071
  }
6061
- function lh(n, t, e, s = {}) {
6062
- const { ox: i, oy: r, step: o, maxRings: a, maxRadius: l } = $i(n, t, s);
6072
+ function ch(n, t, e, s = {}) {
6073
+ const { ox: i, oy: r, step: o, maxRings: a, maxRadius: l } = Gi(n, t, s);
6063
6074
  if (!Number.isFinite(l) || !Number.isFinite(i) || !Number.isFinite(r))
6064
6075
  return { x: Number.isFinite(i) ? i : 0, y: Number.isFinite(r) ? r : 0 };
6065
- let h = Math.min(a, el), c = 0;
6076
+ let h = Math.min(a, il), c = 0;
6066
6077
  for (; ; ) {
6067
- const d = sl(n, i, r, o, e, h, c);
6078
+ const d = nl(n, i, r, o, e, h, c);
6068
6079
  if (d) return { x: i + d.i * o, y: r + d.j * o };
6069
6080
  if (h >= a) break;
6070
6081
  c = h + 1, h = Math.min(a, h * 2);
6071
6082
  }
6072
6083
  return { x: i, y: r };
6073
6084
  }
6074
- function sl(n, t, e, s, i, r, o) {
6085
+ function nl(n, t, e, s, i, r, o) {
6075
6086
  const a = r, l = 2 * a + 1, h = l + 1, c = new Int32Array(h * h);
6076
6087
  for (let u = 0; u < i.length; u++) {
6077
6088
  const f = i[u];
@@ -6101,7 +6112,7 @@ function sl(n, t, e, s, i, r, o) {
6101
6112
  }
6102
6113
  return null;
6103
6114
  }
6104
- function hh(n, t) {
6115
+ function dh(n, t) {
6105
6116
  const e = Qt(n) * Zt(n);
6106
6117
  if (e <= 0) {
6107
6118
  const o = rt(n), a = ot(n);
@@ -6110,12 +6121,12 @@ function hh(n, t) {
6110
6121
  const s = Math.min(n.maxX, t.maxX) - Math.max(n.minX, t.minX), i = Math.min(n.maxY, t.maxY) - Math.max(n.minY, t.minY);
6111
6122
  return (s > 0 && i > 0 ? s * i : 0) < e / 2;
6112
6123
  }
6113
- const il = 10;
6114
- function nl(n) {
6124
+ const rl = 10;
6125
+ function ol(n) {
6115
6126
  return !n.fixed && Number.isFinite(n.w) && Number.isFinite(n.h) && n.w > 0 && n.h > 0;
6116
6127
  }
6117
- function ch(n, t = {}) {
6118
- const e = n.filter(nl);
6128
+ function uh(n, t = {}) {
6129
+ const e = n.filter(ol);
6119
6130
  if (e.length < 2) {
6120
6131
  const p = t.anchor ?? (e.length === 1 ? { x: e[0].box.minX, y: e[0].box.minY } : { x: 0, y: 0 });
6121
6132
  return {
@@ -6124,20 +6135,20 @@ function ch(n, t = {}) {
6124
6135
  bounds: { minX: p.x, minY: p.y, maxX: p.x, maxY: p.y }
6125
6136
  };
6126
6137
  }
6127
- const s = We(e, "y"), i = s.length, r = [];
6138
+ const s = He(e, "y"), i = s.length, r = [];
6128
6139
  for (const p of s) p.free || r.push(p.w);
6129
- const o = wt(r.length > 0 ? r : s.map((p) => p.w)), a = t.gap ?? He(o), l = new Array(i);
6140
+ const o = wt(r.length > 0 ? r : s.map((p) => p.w)), a = t.gap ?? $e(o), l = new Array(i);
6130
6141
  let h = 0;
6131
6142
  for (let p = 0; p < i; p++) {
6132
6143
  const g = s[p], y = Jt(g.h / g.w);
6133
6144
  h += y, l[p] = g.free ? { aspect: y, w: g.w, h: g.h } : { aspect: y };
6134
6145
  }
6135
- const c = t.columns ?? ze(Math.round(Math.sqrt(i * (h / i))), 1, il), d = Wi(l, { width: o, gap: a, columns: c, slot: zi(l, o) });
6146
+ const c = t.columns ?? We(Math.round(Math.sqrt(i * (h / i))), 1, rl), d = Hi(l, { width: o, gap: a, columns: c, slot: Wi(l, o) });
6136
6147
  let u, f;
6137
6148
  if (t.anchor)
6138
6149
  u = t.anchor.x, f = t.anchor.y;
6139
6150
  else {
6140
- const p = ci();
6151
+ const p = di();
6141
6152
  for (const g of s)
6142
6153
  g.box.minX < p.minX && (p.minX = g.box.minX), g.box.minY < p.minY && (p.minY = g.box.minY);
6143
6154
  u = p.minX, f = p.minY;
@@ -6153,7 +6164,7 @@ function ch(n, t = {}) {
6153
6164
  bounds: { minX: u, minY: f, maxX: u + d.width, maxY: f + d.height }
6154
6165
  };
6155
6166
  }
6156
- function rl(n) {
6167
+ function al(n) {
6157
6168
  const t = n.length, e = new Uint8Array(t), s = [], i = new Int32Array(t).fill(-1);
6158
6169
  for (let r = 0; r < t; r++) {
6159
6170
  let o = 0, a = s.length;
@@ -6166,7 +6177,7 @@ function rl(n) {
6166
6177
  for (let r = s.length > 0 ? s[s.length - 1] : -1; r >= 0; r = i[r]) e[r] = 1;
6167
6178
  return e;
6168
6179
  }
6169
- function ol(n, t, e, s) {
6180
+ function ll(n, t, e, s) {
6170
6181
  const i = n.length;
6171
6182
  if (t.length === i + e.length) {
6172
6183
  let c = !0;
@@ -6186,7 +6197,7 @@ function ol(n, t, e, s) {
6186
6197
  const f = t[u];
6187
6198
  d[u] = r.get(f) ?? i + (c.get(f) ?? e.length);
6188
6199
  }
6189
- h = rl(d);
6200
+ h = al(d);
6190
6201
  }
6191
6202
  for (let c = 0; c < t.length; c++) {
6192
6203
  const d = t[c];
@@ -6198,7 +6209,7 @@ function ol(n, t, e, s) {
6198
6209
  o.has(n[c]) || a.push({ id: n[c], prevBelow: l(n, c), nextBelow: null });
6199
6210
  return a.length > 0 ? a : void 0;
6200
6211
  }
6201
- function al(n, t) {
6212
+ function hl(n, t) {
6202
6213
  const e = new Set(n), s = /* @__PURE__ */ new Map();
6203
6214
  for (const a of t)
6204
6215
  e.has(a.id) && (a.nextBelow !== null && (a.nextBelow === a.id || !e.has(a.nextBelow)) || s.set(a.id, a));
@@ -6224,7 +6235,7 @@ function al(n, t) {
6224
6235
  for (let a = 0; a < r.length; a++) if (r[a] !== n[a]) return r;
6225
6236
  }
6226
6237
  }
6227
- const Js = ["x", "y", "w", "h", "rot"], ti = [
6238
+ const ti = ["x", "y", "w", "h", "rot"], ei = [
6228
6239
  "x",
6229
6240
  "y",
6230
6241
  "w",
@@ -6237,9 +6248,9 @@ const Js = ["x", "y", "w", "h", "rot"], ti = [
6237
6248
  "data",
6238
6249
  "kind"
6239
6250
  ];
6240
- class dh {
6251
+ class fh {
6241
6252
  map = /* @__PURE__ */ new Map();
6242
- tree = new fn();
6253
+ tree = new pn();
6243
6254
  entries = /* @__PURE__ */ new Map();
6244
6255
  // Draw order, bottom first, and each id's index in it (rebuilt lazily after a removal or a reorder).
6245
6256
  // A removal does not shrink `_order` at once (that would cost O(board) per call): it records the id in `dead`,
@@ -6339,7 +6350,7 @@ class dh {
6339
6350
  for (const i of t) {
6340
6351
  if (this.map.has(i.id) || s.has(i.id))
6341
6352
  throw new $("invalid", `duplicate element id "${i.id}"`);
6342
- s.add(i.id), Te(`add: card "${i.id}"`, i);
6353
+ s.add(i.id), Ae(`add: card "${i.id}"`, i);
6343
6354
  }
6344
6355
  this.batch(() => {
6345
6356
  this.note(e), this.markOrder(!0);
@@ -6357,10 +6368,10 @@ class dh {
6357
6368
  const i = this.map.get(t);
6358
6369
  if (!i) return [];
6359
6370
  const r = [], o = { ...i }, a = e;
6360
- for (const l of ti)
6371
+ for (const l of ei)
6361
6372
  !(l in a) || a[l] === void 0 && l !== "data" || Object.is(o[l], a[l]) || (o[l] = a[l], r.push(l));
6362
- return r.length === 0 || (r.some((l) => Js.includes(l)) && Te(`update: card "${t}"`, o), this.batch(() => {
6363
- if (this.note(s), this.touch(t), this.map.set(t, o), r.some((l) => Js.includes(l))) {
6373
+ return r.length === 0 || (r.some((l) => ti.includes(l)) && Ae(`update: card "${t}"`, o), this.batch(() => {
6374
+ if (this.note(s), this.touch(t), this.map.set(t, o), r.some((l) => ti.includes(l))) {
6364
6375
  const l = this.entries.get(t);
6365
6376
  l && this.tree.remove(l);
6366
6377
  const h = this.entryOf(o);
@@ -6419,7 +6430,7 @@ class dh {
6419
6430
  // Replays an `order.moved`: each card goes directly above its `nextBelow` (see `placeMoves`). Entries naming a
6420
6431
  // card that is not here are skipped.
6421
6432
  applyOrderMoves(t, e) {
6422
- const s = al(this.order, t);
6433
+ const s = hl(this.order, t);
6423
6434
  s && this.reorder(s, e);
6424
6435
  }
6425
6436
  // Empties the store.
@@ -6501,13 +6512,13 @@ class dh {
6501
6512
  else if (!f)
6502
6513
  l.push(u);
6503
6514
  else if (f !== u) {
6504
- const m = ti.filter((p) => !Object.is(u[p], f[p]));
6515
+ const m = ei.filter((p) => !Object.is(u[p], f[p]));
6505
6516
  m.length > 0 && h.push({ el: f, prev: u, props: m });
6506
6517
  }
6507
6518
  }
6508
6519
  const c = { source: r, added: a, removed: l, updated: h };
6509
6520
  if (e !== null) {
6510
- const d = !i && a.length === 0 && l.length === 0 ? s : null, u = ol(e, this.order, a.map((f) => f.id), d);
6521
+ const d = !i && a.length === 0 && l.length === 0 ? s : null, u = ll(e, this.order, a.map((f) => f.id), d);
6511
6522
  u && (c.order = { moved: u });
6512
6523
  }
6513
6524
  if (!(a.length === 0 && l.length === 0 && h.length === 0 && !c.order) && (o && (c.reload = !0), this.queue.push({ type: "change", change: c }), !this.dispatching)) {
@@ -6519,7 +6530,7 @@ class dh {
6519
6530
  try {
6520
6531
  f(u);
6521
6532
  } catch (m) {
6522
- Mi("change listener", m);
6533
+ ki("change listener", m);
6523
6534
  }
6524
6535
  }
6525
6536
  } finally {
@@ -6528,7 +6539,7 @@ class dh {
6528
6539
  }
6529
6540
  }
6530
6541
  }
6531
- const ei = "data-corkboard-video", ll = `
6542
+ const si = "data-corkboard-video", cl = `
6532
6543
  .cb-video{opacity:0;--cb-in:240ms;--cb-out:150ms;--cb-ease:cubic-bezier(0.2,0,0,1);--cb-dur:var(--cb-out);transition:opacity var(--cb-dur) var(--cb-ease)}
6533
6544
  [data-state='playing'] .cb-video,[data-state='stalled'] .cb-video{opacity:1;--cb-dur:var(--cb-in)}
6534
6545
  .cb-spinner{display:flex;align-items:center;justify-content:center;width:52px;height:52px;border-radius:50%;background:rgb(0 0 0 / 0.4);opacity:0;pointer-events:none;transition:opacity 160ms ease}
@@ -6537,15 +6548,15 @@ const ei = "data-corkboard-video", ll = `
6537
6548
  [data-busy='true'] .cb-ring{animation-play-state:running}
6538
6549
  @keyframes cb-spin{to{transform:rotate(360deg)}}
6539
6550
  @media (prefers-reduced-motion:reduce){.cb-video,.cb-spinner{transition:none}.cb-ring{animation:none}}
6540
- `, hl = {
6541
- selector: `style[${ei}]`,
6542
- mark: (n) => n.setAttribute(ei, ""),
6543
- css: ll
6551
+ `, dl = {
6552
+ selector: `style[${si}]`,
6553
+ mark: (n) => n.setAttribute(si, ""),
6554
+ css: cl
6544
6555
  };
6545
- function cl(n = document, t) {
6546
- return bi(n, hl, t);
6556
+ function ul(n = document, t) {
6557
+ return xi(n, dl, t);
6547
6558
  }
6548
- const dl = 250, ul = 120, fl = 600, si = 2, ve = 3, ii = [
6559
+ const fl = 250, pl = 120, ml = 600, ii = 2, be = 3, ni = [
6549
6560
  "loadstart",
6550
6561
  "emptied",
6551
6562
  "loadeddata",
@@ -6557,8 +6568,8 @@ const dl = 250, ul = 120, fl = 600, si = 2, ve = 3, ii = [
6557
6568
  "timeupdate",
6558
6569
  "error"
6559
6570
  ];
6560
- function pl(n, t = {}) {
6561
- const e = n, s = cl(e.ownerDocument, t.nonce), i = t.host === void 0 ? n.parentElement : t.host, r = typeof e.requestVideoFrameCallback == "function";
6571
+ function gl(n, t = {}) {
6572
+ const e = n, s = ul(e.ownerDocument, t.nonce), i = t.host === void 0 ? n.parentElement : t.host, r = typeof e.requestVideoFrameCallback == "function";
6562
6573
  let o = !1, a = !1, l = !1, h = !1, c = "poster", d = !1, u = !1, f = 0, m = null, p = null, g = null;
6563
6574
  const y = () => {
6564
6575
  i && (i.dataset.state !== c && (i.dataset.state = c), d ? i.dataset.busy !== "true" && (i.dataset.busy = "true") : i.hasAttribute("data-busy") && i.removeAttribute("data-busy"));
@@ -6567,7 +6578,7 @@ function pl(n, t = {}) {
6567
6578
  const S = !o || h ? "poster" : a ? l ? "stalled" : "playing" : "loading", L = S === "loading" || S === "stalled";
6568
6579
  S !== c && (c = S, t.onState?.(c)), L ? !d && g === null && (g = setTimeout(() => {
6569
6580
  g = null, d = !0, y();
6570
- }, dl)) : (g !== null && clearTimeout(g), g = null, d = !1), y();
6581
+ }, fl)) : (g !== null && clearTimeout(g), g = null, d = !1), y();
6571
6582
  }, w = () => {
6572
6583
  m !== null && e.cancelVideoFrameCallback?.(m), m = null, p !== null && clearTimeout(p), p = null;
6573
6584
  }, b = () => {
@@ -6579,7 +6590,7 @@ function pl(n, t = {}) {
6579
6590
  () => {
6580
6591
  p = null, S === f && o && !e.paused && b();
6581
6592
  },
6582
- r ? fl : ul
6593
+ r ? ml : pl
6583
6594
  );
6584
6595
  }, x = () => {
6585
6596
  if (!o || a || !r || m !== null) return;
@@ -6603,25 +6614,25 @@ function pl(n, t = {}) {
6603
6614
  l = !1, a || (!r && e.currentTime > 0 ? b() : k()), v();
6604
6615
  break;
6605
6616
  case "timeupdate":
6606
- !a && o && !e.paused && e.currentTime > 0 ? r ? k() : b() : l && e.readyState >= ve && (l = !1, v());
6617
+ !a && o && !e.paused && e.currentTime > 0 ? r ? k() : b() : l && e.readyState >= be && (l = !1, v());
6607
6618
  break;
6608
6619
  case "waiting":
6609
6620
  case "stalled":
6610
- a && e.readyState < ve && (l = !0, v());
6621
+ a && e.readyState < be && (l = !0, v());
6611
6622
  break;
6612
6623
  case "canplay":
6613
6624
  case "seeked":
6614
- l && e.readyState >= ve && (l = !1, v());
6625
+ l && e.readyState >= be && (l = !1, v());
6615
6626
  break;
6616
6627
  }
6617
6628
  };
6618
- for (const S of ii) e.addEventListener(S, T);
6629
+ for (const S of ni) e.addEventListener(S, T);
6619
6630
  return y(), {
6620
6631
  get state() {
6621
6632
  return c;
6622
6633
  },
6623
6634
  request() {
6624
- u || (o = !0, e.readyState < si && (a = !1, l = !1), h = !!e.error, x(), !e.paused && e.readyState >= si && k(), v());
6635
+ u || (o = !0, e.readyState < ii && (a = !1, l = !1), h = !!e.error, x(), !e.paused && e.readyState >= ii && k(), v());
6625
6636
  },
6626
6637
  release() {
6627
6638
  u || (o = !1, f++, w(), v());
@@ -6629,20 +6640,20 @@ function pl(n, t = {}) {
6629
6640
  dispose() {
6630
6641
  if (!u) {
6631
6642
  u = !0, s(), f++, w(), g !== null && clearTimeout(g), g = null;
6632
- for (const S of ii) e.removeEventListener(S, T);
6643
+ for (const S of ni) e.removeEventListener(S, T);
6633
6644
  i && (delete i.dataset.state, delete i.dataset.busy);
6634
6645
  }
6635
6646
  }
6636
6647
  };
6637
6648
  }
6638
- function ml(n) {
6649
+ function yl(n) {
6639
6650
  const t = n.createElement("span");
6640
6651
  t.className = "cb-spinner", t.setAttribute("aria-hidden", "true");
6641
6652
  const e = n.createElement("span");
6642
6653
  return e.className = "cb-ring", t.appendChild(e), t;
6643
6654
  }
6644
- const gl = 150, yl = gl + 30, ni = 52, ht = (n) => Math.round(n * 1e3) / 1e3, wl = { tx: 0, ty: 0, scale: 1 };
6645
- class Gi {
6655
+ const wl = 150, vl = wl + 30, ri = 52, ht = (n) => Math.round(n * 1e3) / 1e3, bl = { tx: 0, ty: 0, scale: 1 };
6656
+ class Vi {
6646
6657
  video;
6647
6658
  // Carries data-state / data-busy (reveal.ts); `display: contents`, it has no box of its own.
6648
6659
  host;
@@ -6667,8 +6678,8 @@ class Gi {
6667
6678
  i.style.display = "contents";
6668
6679
  const r = s.createElement("video");
6669
6680
  r.className = "cb-video", r.muted = !0, r.loop = !0, r.playsInline = !0, r.preload = "metadata", r.setAttribute("muted", ""), r.setAttribute("playsinline", ""), r.setAttribute("loop", ""), r.setAttribute("disablepictureinpicture", ""), r.style.cssText = "position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;max-width:none;max-height:none;object-fit:cover;display:none;";
6670
- const o = ml(s);
6671
- o.style.cssText = "position:absolute;left:0;top:0;" + (e.spinner === !1 ? "display:none;" : ""), i.append(r, o), t.append(i), this.video = r, this.host = i, this.disc = o, this.reveal = pl(r, { host: i, nonce: e.nonce });
6681
+ const o = yl(s);
6682
+ o.style.cssText = "position:absolute;left:0;top:0;" + (e.spinner === !1 ? "display:none;" : ""), i.append(r, o), t.append(i), this.video = r, this.host = i, this.disc = o, this.reveal = gl(r, { host: i, nonce: e.nonce });
6672
6683
  const a = e.onError;
6673
6684
  a && r.addEventListener("error", (l) => {
6674
6685
  const h = this.target;
@@ -6722,7 +6733,7 @@ class Gi {
6722
6733
  // Fades back to the thumbnail (the card keeps playing under the fade), then releases the network.
6723
6734
  hide() {
6724
6735
  if (this.disposed || !this.target || this.hideTimer !== null) return;
6725
- this.reveal.release(), typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches ? this.teardown() : this.hideTimer = setTimeout(() => this.teardown(), yl);
6736
+ this.reveal.release(), typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches ? this.teardown() : this.hideTimer = setTimeout(() => this.teardown(), vl);
6726
6737
  }
6727
6738
  dispose() {
6728
6739
  this.disposed || (this.teardown(), this.disposed = !0, this.reveal.dispose(), this.host.remove());
@@ -6756,9 +6767,9 @@ class Gi {
6756
6767
  }
6757
6768
  writeTransform(t) {
6758
6769
  if (!this.target) return;
6759
- const e = this.worldSpace ? wl : t, s = fi(this.rect, e);
6770
+ const e = this.worldSpace ? bl : t, s = pi(this.rect, e);
6760
6771
  if (s.transform !== this.wroteTransform && (this.wroteTransform = s.transform, this.video.style.transform = s.transform), this.worldSpace) return;
6761
- const i = `translate(${ht(s.cx - ni / 2)}px, ${ht(s.cy - ni / 2)}px)`;
6772
+ const i = `translate(${ht(s.cx - ri / 2)}px, ${ht(s.cy - ri / 2)}px)`;
6762
6773
  i !== this.wroteDisc && (this.wroteDisc = i, this.disc.style.transform = i);
6763
6774
  }
6764
6775
  // Autoplay can be refused (no user gesture yet, data saver) or aborted by a quick hide(): both are
@@ -6777,8 +6788,8 @@ class Gi {
6777
6788
  }
6778
6789
  }
6779
6790
  }
6780
- const Ne = 96, Vi = 8, vl = 2, Ki = 160, bl = 0.25, xl = 1.25;
6781
- function Ml(n, t) {
6791
+ const De = 96, Ki = 8, xl = 2, ji = 160, Ml = 0.25, kl = 1.25;
6792
+ function Sl(n, t) {
6782
6793
  const e = n.rot ?? 0;
6783
6794
  let s = n.x, i = n.y, r = n.x + n.w, o = n.y + n.h;
6784
6795
  if (e !== 0) {
@@ -6792,14 +6803,14 @@ function Ml(n, t) {
6792
6803
  y1: t.ty + o * t.scale
6793
6804
  };
6794
6805
  }
6795
- const ri = (n, t) => {
6806
+ const oi = (n, t) => {
6796
6807
  const e = Math.min(n.x1, t.x1) - Math.max(n.x0, t.x0), s = Math.min(n.y1, t.y1) - Math.max(n.y0, t.y0);
6797
6808
  return e > 0 && s > 0 ? e * s : 0;
6798
6809
  };
6799
- function kl(n) {
6800
- const { camera: t, viewport: e } = n, s = Math.min(n.cap ?? Vi, Ne);
6810
+ function Tl(n) {
6811
+ const { camera: t, viewport: e } = n, s = Math.min(n.cap ?? Ki, De);
6801
6812
  if (!(s > 0) || e.w <= 0 || e.h <= 0) return [];
6802
- const i = n.minPlayPx ?? Ki, r = n.margin ?? bl, o = { x0: 0, y0: 0, x1: e.w, y1: e.h }, a = {
6813
+ const i = n.minPlayPx ?? ji, r = n.margin ?? Ml, o = { x0: 0, y0: 0, x1: e.w, y1: e.h }, a = {
6803
6814
  x0: -e.w * r,
6804
6815
  y0: -e.h * r,
6805
6816
  x1: e.w * (1 + r),
@@ -6807,11 +6818,11 @@ function kl(n) {
6807
6818
  }, l = e.w / 2, h = e.h / 2, c = [];
6808
6819
  for (const d of n.cards) {
6809
6820
  if (Math.max(d.w, d.h) * t.scale < i) continue;
6810
- const u = Ml(d, t), f = ri(u, o), m = f > 0;
6811
- if (!m && ri(u, a) === 0) continue;
6821
+ const u = Sl(d, t), f = oi(u, o), m = f > 0;
6822
+ if (!m && oi(u, a) === 0) continue;
6812
6823
  const p = (u.x1 - u.x0) * (u.y1 - u.y0);
6813
6824
  let g = m ? f : p;
6814
- n.playing?.has(d.id) && (g *= xl);
6825
+ n.playing?.has(d.id) && (g *= kl);
6815
6826
  const y = Math.hypot((u.x0 + u.x1) / 2 - l, (u.y0 + u.y1) / 2 - h);
6816
6827
  c.push({ id: d.id, inView: m, score: g, dist: y });
6817
6828
  }
@@ -6819,16 +6830,16 @@ function kl(n) {
6819
6830
  (d, u) => Number(u.inView) - Number(d.inView) || u.score - d.score || d.dist - u.dist || (d.id < u.id ? -1 : d.id > u.id ? 1 : 0)
6820
6831
  ), (c.length > s ? c.slice(0, s) : c).map((d) => d.id);
6821
6832
  }
6822
- const Sl = {
6833
+ const Al = {
6823
6834
  reducedMotion: () => typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches,
6824
6835
  saveData: () => navigator.connection?.saveData === !0,
6825
6836
  hidden: () => typeof document < "u" && document.visibilityState === "hidden"
6826
6837
  };
6827
- function Tl(n) {
6838
+ function El(n) {
6828
6839
  return !n.reducedMotion() && !n.saveData();
6829
6840
  }
6830
- const Al = 150, El = 6, Pl = 50, Ll = 16, Il = 0.6, Rl = 1.5;
6831
- class Cl {
6841
+ const Pl = 150, Ll = 6, Il = 50, Rl = 16, Cl = 0.6, _l = 1.5;
6842
+ class Ol {
6832
6843
  deps;
6833
6844
  env;
6834
6845
  // Playing cards -> their element.
@@ -6847,9 +6858,9 @@ class Cl {
6847
6858
  paused = !1;
6848
6859
  suspended = !1;
6849
6860
  touch = !1;
6850
- minPlayPx = Ki;
6851
- maxPlaying = Vi;
6852
- maxPlayingTouch = vl;
6861
+ minPlayPx = ji;
6862
+ maxPlaying = Ki;
6863
+ maxPlayingTouch = xl;
6853
6864
  excluded = null;
6854
6865
  // The cap the frame rate allows (Infinity: none); the effective one also honours maxPlaying.
6855
6866
  adaptiveCap = 1 / 0;
@@ -6859,7 +6870,7 @@ class Cl {
6859
6870
  disposed = !1;
6860
6871
  cleanups = [];
6861
6872
  constructor(t) {
6862
- this.deps = t, this.env = t.env ?? Sl, this.suspended = this.env.hidden();
6873
+ this.deps = t, this.env = t.env ?? Al, this.suspended = this.env.hidden();
6863
6874
  const e = t.root.ownerDocument.createElement("div");
6864
6875
  e.style.cssText = "position:absolute;left:0;top:0;width:0;height:0;transform-origin:0 0;pointer-events:none;", t.root.append(e), this.world = e, this.writeWorld(t.camera()), t.watch && this.cleanups.push(t.watch(() => this.schedule()));
6865
6876
  const s = t.frameRate;
@@ -6881,7 +6892,7 @@ class Cl {
6881
6892
  }
6882
6893
  // How many clips may play now: `maxPlaying` (`maxPlayingTouch` on touch), lowered while the page runs slow.
6883
6894
  get cap() {
6884
- return Math.min(this.touch ? this.maxPlayingTouch : this.maxPlaying, this.adaptiveCap, Ne);
6895
+ return Math.min(this.touch ? this.maxPlayingTouch : this.maxPlaying, this.adaptiveCap, De);
6885
6896
  }
6886
6897
  // The ids that play now.
6887
6898
  get playingIds() {
@@ -6923,13 +6934,13 @@ class Cl {
6923
6934
  // SMOOTH_WINDOWS in a row: give back 50%, up to `maxPlaying`.
6924
6935
  onWindow(t) {
6925
6936
  if (this.disposed || !this.on || this.active.size === 0) return;
6926
- const e = this.cap, s = Math.min(this.touch ? this.maxPlayingTouch : this.maxPlaying, Ne);
6937
+ const e = this.cap, s = Math.min(this.touch ? this.maxPlayingTouch : this.maxPlaying, De);
6927
6938
  let i = this.adaptiveCap;
6928
6939
  if (t.slow) {
6929
6940
  this.smooth = 0;
6930
- const r = Math.max(1, Math.floor(Math.min(e, this.active.size) * Il));
6941
+ const r = Math.max(1, Math.floor(Math.min(e, this.active.size) * Cl));
6931
6942
  r < e && (i = r);
6932
- } else t.smooth ? ++this.smooth >= Me && this.adaptiveCap < s && (this.smooth = 0, i = Math.ceil(this.adaptiveCap * Rl), i >= s && (i = 1 / 0)) : this.smooth = 0;
6943
+ } else t.smooth ? ++this.smooth >= ke && this.adaptiveCap < s && (this.smooth = 0, i = Math.ceil(this.adaptiveCap * _l), i >= s && (i = 1 / 0)) : this.smooth = 0;
6933
6944
  i !== this.adaptiveCap && (this.adaptiveCap = i, this.replan(), this.deps.frameRate?.poke());
6934
6945
  }
6935
6946
  // The camera moved: the elements go with it (a transform each), and the plan is refreshed, throttled.
@@ -6973,7 +6984,7 @@ class Cl {
6973
6984
  e !== this.wroteWorld && (this.wroteWorld = e, this.world.style.transform = e);
6974
6985
  }
6975
6986
  canPlay() {
6976
- return this.on && !this.paused && !this.disposed && Tl(this.env) && !this.reduced();
6987
+ return this.on && !this.paused && !this.disposed && El(this.env) && !this.reduced();
6977
6988
  }
6978
6989
  reduced() {
6979
6990
  return this.deps.reducedMotion?.() === !0;
@@ -6992,7 +7003,7 @@ class Cl {
6992
7003
  }
6993
7004
  schedule() {
6994
7005
  if (this.disposed || this.timer !== null || !this.on && this.active.size === 0) return;
6995
- const t = this.deps.setTimer ?? setTimeout, e = (this.deps.now ?? Date.now)(), s = Math.max(0, this.lastPlan + Al - e);
7006
+ const t = this.deps.setTimer ?? setTimeout, e = (this.deps.now ?? Date.now)(), s = Math.max(0, this.lastPlan + Pl - e);
6996
7007
  this.timer = t(() => {
6997
7008
  this.timer = null, this.replan();
6998
7009
  }, s);
@@ -7008,7 +7019,7 @@ class Cl {
7008
7019
  let t = !1;
7009
7020
  const e = [];
7010
7021
  if (this.canPlay()) {
7011
- const o = [...this.deps.candidates()].filter((l) => l.id !== this.excluded), a = kl({
7022
+ const o = [...this.deps.candidates()].filter((l) => l.id !== this.excluded), a = Tl({
7012
7023
  cards: o,
7013
7024
  camera: this.deps.camera(),
7014
7025
  viewport: this.deps.viewport(),
@@ -7031,19 +7042,19 @@ class Cl {
7031
7042
  l.activeSrc !== null && l.activeSrc !== a.src && l.show(a, this.deps.camera());
7032
7043
  continue;
7033
7044
  }
7034
- if (i >= El) {
7045
+ if (i >= Ll) {
7035
7046
  r = !0;
7036
7047
  continue;
7037
7048
  }
7038
7049
  const h = this.take();
7039
7050
  this.active.set(o, h), this.writeWorld(this.deps.camera()), h.show(a, this.deps.camera()), this.suspended && h.suspend(), i++, t = !0;
7040
7051
  }
7041
- for (; this.idle.length > Ll; ) this.idle.shift()?.dispose();
7052
+ for (; this.idle.length > Rl; ) this.idle.shift()?.dispose();
7042
7053
  if (r) {
7043
7054
  const o = this.deps.setTimer ?? setTimeout;
7044
7055
  this.timer = o(() => {
7045
7056
  this.timer = null, this.replan();
7046
- }, Pl);
7057
+ }, Il);
7047
7058
  }
7048
7059
  t && (this.deps.onChange?.(), this.deps.frameRate?.poke());
7049
7060
  }
@@ -7051,7 +7062,7 @@ class Cl {
7051
7062
  take() {
7052
7063
  const t = this.idle.pop();
7053
7064
  if (t) return t;
7054
- const e = new Gi(this.world, {
7065
+ const e = new Vi(this.world, {
7055
7066
  spinner: !1,
7056
7067
  worldSpace: !0,
7057
7068
  nonce: this.deps.nonce,
@@ -7060,21 +7071,21 @@ class Cl {
7060
7071
  return this.configure(e), e;
7061
7072
  }
7062
7073
  }
7063
- const _l = 300, Ol = 160;
7064
- function oi(n) {
7065
- return n !== null && n.hasVideo && n.covered !== !0 && n.screenWidth >= Ol;
7074
+ const Nl = 300, Dl = 160;
7075
+ function ai(n) {
7076
+ return n !== null && n.hasVideo && n.covered !== !0 && n.screenWidth >= Dl;
7066
7077
  }
7067
- function Nl(n) {
7078
+ function Fl(n) {
7068
7079
  const t = { immediate: null, delayed: null };
7069
7080
  if (!n.enabled || n.touch || n.cameraMoving) return t;
7070
7081
  if (n.selection.length === 1) {
7071
7082
  const s = n.selection[0];
7072
- if (oi(n.card(s))) return { immediate: s, delayed: null };
7083
+ if (ai(n.card(s))) return { immediate: s, delayed: null };
7073
7084
  }
7074
7085
  const e = n.hoverId;
7075
- return n.hoverPlay === !1 ? t : e !== null && oi(n.card(e)) ? { immediate: null, delayed: e } : t;
7086
+ return n.hoverPlay === !1 ? t : e !== null && ai(n.card(e)) ? { immediate: null, delayed: e } : t;
7076
7087
  }
7077
- class Dl {
7088
+ class Bl {
7078
7089
  deps;
7079
7090
  selection = [];
7080
7091
  hoverId = null;
@@ -7119,7 +7130,7 @@ class Dl {
7119
7130
  this.clearTimer(), this.stop();
7120
7131
  }
7121
7132
  want() {
7122
- return Nl({
7133
+ return Fl({
7123
7134
  enabled: this.enabled,
7124
7135
  touch: this.touch,
7125
7136
  hoverPlay: this.hoverPlay,
@@ -7154,14 +7165,14 @@ class Dl {
7154
7165
  const e = this.deps.setTimer ?? setTimeout;
7155
7166
  this.timer = e(() => {
7156
7167
  this.timer = null, this.timerFor = null, this.want().delayed === t ? this.start(t) : (this.deps.pending?.(null), this.reconcile());
7157
- }, _l);
7168
+ }, Nl);
7158
7169
  }
7159
7170
  // `notify`: tell the deps the pending card is gone (false when another card takes its place at once).
7160
7171
  clearTimer(t = !0) {
7161
7172
  this.timer !== null && ((this.deps.clearTimer ?? clearTimeout)(this.timer), this.timer = null, t && this.deps.pending?.(null)), this.timerFor = null;
7162
7173
  }
7163
7174
  }
7164
- class uh {
7175
+ class ph {
7165
7176
  overlay;
7166
7177
  controller;
7167
7178
  ambient;
@@ -7181,11 +7192,11 @@ class uh {
7181
7192
  const p = `${f.id}|${f.src}`;
7182
7193
  h.has(p) || (h.add(p), a({ kind: "video", id: f.id, url: f.src, cause: m }));
7183
7194
  });
7184
- this.overlay = new Gi(s, { nonce: l, onError: c });
7195
+ this.overlay = new Vi(s, { nonce: l, onError: c });
7185
7196
  const d = s.ownerDocument;
7186
7197
  this.hidden = d.visibilityState === "hidden";
7187
7198
  const u = () => this.setHidden(d.visibilityState === "hidden");
7188
- d.addEventListener("visibilitychange", u), this.cleanups.push(() => d.removeEventListener("visibilitychange", u)), this.ambient = new Cl({
7199
+ d.addEventListener("visibilitychange", u), this.cleanups.push(() => d.removeEventListener("visibilitychange", u)), this.ambient = new Ol({
7189
7200
  root: s,
7190
7201
  camera: () => r.cam.cam,
7191
7202
  viewport: () => ({ w: r.cam.width, h: r.cam.height }),
@@ -7200,7 +7211,7 @@ class uh {
7200
7211
  frameRate: o,
7201
7212
  nonce: l,
7202
7213
  onError: c
7203
- }), this.controller = new Dl({
7214
+ }), this.controller = new Bl({
7204
7215
  show: (f) => {
7205
7216
  this.showOverlay(f), this.ambient.exclude(f);
7206
7217
  },
@@ -7304,91 +7315,91 @@ class uh {
7304
7315
  }
7305
7316
  }
7306
7317
  export {
7307
- Yi as $,
7308
- th as A,
7309
- ah as B,
7310
- lh as C,
7311
- Te as D,
7312
- pn as E,
7318
+ zi as $,
7319
+ sh as A,
7320
+ hh as B,
7321
+ ch as C,
7322
+ Ae as D,
7323
+ mn as E,
7313
7324
  V as F,
7314
- En as G,
7315
- ql as H,
7316
- Pe as I,
7317
- io as J,
7318
- jl as K,
7319
- Ul as L,
7320
- Ql as M,
7321
- Zl as N,
7322
- Jl as O,
7323
- pi as P,
7325
+ Pn as G,
7326
+ Yl as H,
7327
+ Le as I,
7328
+ no as J,
7329
+ Zl as K,
7330
+ zl as L,
7331
+ Jl as M,
7332
+ th as N,
7333
+ eh as O,
7334
+ mi as P,
7324
7335
  pt as Q,
7325
- Ds as R,
7326
- dh as S,
7327
- Bn as T,
7328
- Ln as U,
7329
- uh as V,
7330
- Cn as W,
7331
- _n as X,
7332
- gi as Y,
7333
- Fe as Z,
7334
- mi as _,
7335
- zl as a,
7336
- Ui as a0,
7336
+ Fs as R,
7337
+ fh as S,
7338
+ Xn as T,
7339
+ In as U,
7340
+ ph as V,
7341
+ _n as W,
7342
+ On as X,
7343
+ yi as Y,
7344
+ Be as Z,
7345
+ gi as _,
7346
+ Hl as a,
7347
+ Yi as a0,
7337
7348
  zt as a1,
7338
- ir as a2,
7339
- sr as a3,
7340
- nr as a4,
7341
- Ns as a5,
7342
- rr as a6,
7343
- or as a7,
7344
- We as a8,
7345
- zn as a9,
7346
- Ra as aa,
7347
- $n as ab,
7348
- va as ac,
7349
- Je as ad,
7349
+ nr as a2,
7350
+ ir as a3,
7351
+ rr as a4,
7352
+ Ds as a5,
7353
+ or as a6,
7354
+ ar as a7,
7355
+ He as a8,
7356
+ Wn as a9,
7357
+ Ca as aa,
7358
+ Gn as ab,
7359
+ ba as ac,
7360
+ ts as ad,
7350
7361
  fe as ae,
7351
- gr as af,
7352
- pr as ag,
7353
- mr as ah,
7354
- Xn as ai,
7355
- Hn as aj,
7356
- Ka as ak,
7357
- qn as al,
7358
- In as am,
7359
- Gn as an,
7360
- hh as ao,
7361
- qa as ap,
7362
- Ua as aq,
7363
- wi as ar,
7364
- lr as as,
7365
- wr as at,
7366
- eh as au,
7367
- sh as av,
7362
+ yr as af,
7363
+ mr as ag,
7364
+ gr as ah,
7365
+ qn as ai,
7366
+ $n as aj,
7367
+ Qa as ak,
7368
+ Un as al,
7369
+ Rn as am,
7370
+ Vn as an,
7371
+ dh as ao,
7372
+ Ua as ap,
7373
+ Ya as aq,
7374
+ vi as ar,
7375
+ hr as as,
7376
+ vr as at,
7377
+ ih as au,
7378
+ nh as av,
7368
7379
  F as b,
7369
- Wl as c,
7370
- Vl as d,
7371
- Kl as e,
7380
+ $l as c,
7381
+ jl as d,
7382
+ Ql as e,
7372
7383
  Dt as f,
7373
7384
  q as g,
7374
- He as h,
7375
- ki as i,
7385
+ $e as h,
7386
+ Si as i,
7376
7387
  Jt as j,
7377
- ja as k,
7378
- Hl as l,
7388
+ Za as k,
7389
+ Gl as l,
7379
7390
  wt as m,
7380
- Yl as n,
7381
- $l as o,
7382
- xs as p,
7383
- Wi as q,
7384
- Gl as r,
7391
+ Wl as n,
7392
+ Vl as o,
7393
+ Ms as p,
7394
+ Hi as q,
7395
+ Kl as r,
7385
7396
  B as s,
7386
- ch as t,
7387
- zi as u,
7388
- ih as v,
7389
- nh as w,
7390
- rh as x,
7391
- oh as y,
7392
- Za as z
7397
+ uh as t,
7398
+ Wi as u,
7399
+ rh as v,
7400
+ oh as w,
7401
+ ah as x,
7402
+ lh as y,
7403
+ tl as z
7393
7404
  };
7394
- //# sourceMappingURL=chunk-layer-CRDYkQT5.js.map
7405
+ //# sourceMappingURL=chunk-layer-9my2O3ye.js.map