@msb235/blits-panel 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.js +581 -577
- package/dist/index.js.map +1 -1
- package/dist/ui/path.d.ts +2 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var x = (e) => `hsl(${e} 70% 62%)`, S = (e) => e * 67 % 360, C = "http://www.w3.
|
|
|
30
30
|
clear() {
|
|
31
31
|
this.svg?.remove(), this.svg = null;
|
|
32
32
|
}
|
|
33
|
-
},
|
|
33
|
+
}, E = class {
|
|
34
34
|
weak = /* @__PURE__ */ new WeakMap();
|
|
35
35
|
strong = /* @__PURE__ */ new Map();
|
|
36
36
|
back = /* @__PURE__ */ new Map();
|
|
@@ -46,11 +46,11 @@ var x = (e) => `hsl(${e} 70% 62%)`, S = (e) => e * 67 % 360, C = "http://www.w3.
|
|
|
46
46
|
let t = this.back.get(e);
|
|
47
47
|
if (t !== void 0) return t instanceof WeakRef ? t.deref() : t.value;
|
|
48
48
|
}
|
|
49
|
-
},
|
|
49
|
+
}, D = 1e4, O = 1200, k = 2e3, A = 3e4, j = class {
|
|
50
50
|
windowMs;
|
|
51
51
|
cap;
|
|
52
52
|
list = [];
|
|
53
|
-
constructor(e =
|
|
53
|
+
constructor(e = D, t = O) {
|
|
54
54
|
this.windowMs = e, this.cap = t;
|
|
55
55
|
}
|
|
56
56
|
get length() {
|
|
@@ -97,12 +97,12 @@ var x = (e) => `hsl(${e} 70% 62%)`, S = (e) => e * 67 % 360, C = "http://www.w3.
|
|
|
97
97
|
};
|
|
98
98
|
//#endregion
|
|
99
99
|
//#region src/marks.ts
|
|
100
|
-
function
|
|
100
|
+
function M(e, t) {
|
|
101
101
|
let { now: n, timestamp: r } = e.mix;
|
|
102
102
|
if (!Number.isFinite(n) || !Number.isFinite(r)) return [];
|
|
103
103
|
let i = e.mix.rate > 0 ? e.mix.rate : 1, a = n - Math.max(e.reach, n - t);
|
|
104
104
|
try {
|
|
105
|
-
return e.mix.marks(r - a / i, r +
|
|
105
|
+
return e.mix.marks(r - a / i, r + A / i).map((e) => ({
|
|
106
106
|
at: n + (e.timestamp - r) * i,
|
|
107
107
|
mark: e.mark ?? null,
|
|
108
108
|
voice: e.voice ?? null,
|
|
@@ -116,16 +116,16 @@ function j(e, t) {
|
|
|
116
116
|
}
|
|
117
117
|
//#endregion
|
|
118
118
|
//#region src/offer.ts
|
|
119
|
-
var
|
|
120
|
-
function
|
|
121
|
-
N
|
|
119
|
+
var N = Symbol.for("@msb235/blits-panel/offer/1"), P = globalThis;
|
|
120
|
+
function F(e) {
|
|
121
|
+
P[N] = { ...e };
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return N
|
|
123
|
+
function I() {
|
|
124
|
+
return P[N] ?? {};
|
|
125
125
|
}
|
|
126
126
|
//#endregion
|
|
127
127
|
//#region src/outline.ts
|
|
128
|
-
var
|
|
128
|
+
var L = class {
|
|
129
129
|
el = null;
|
|
130
130
|
show(e) {
|
|
131
131
|
if (e === void 0) {
|
|
@@ -149,12 +149,12 @@ var I = class {
|
|
|
149
149
|
};
|
|
150
150
|
//#endregion
|
|
151
151
|
//#region src/picking.ts
|
|
152
|
-
function
|
|
153
|
-
let n = new
|
|
152
|
+
function ee(e, t) {
|
|
153
|
+
let n = new L(), r = (t) => {
|
|
154
154
|
let r;
|
|
155
|
-
t !== void 0 && (r = (e.outline ??
|
|
155
|
+
t !== void 0 && (r = (e.outline ?? I().outline)?.(t) ?? (t instanceof Element ? t.getBoundingClientRect() : void 0)), n.show(r);
|
|
156
156
|
}, i = (t) => e.ignore !== void 0 && t.composedPath().includes(e.ignore), a = (r, i) => {
|
|
157
|
-
let a = (e.pick ??
|
|
157
|
+
let a = (e.pick ?? I().pick)?.(r, i);
|
|
158
158
|
if (a !== void 0) {
|
|
159
159
|
let e = t.owner(a);
|
|
160
160
|
if (e !== void 0) return [a, e];
|
|
@@ -183,17 +183,17 @@ function te(e, t) {
|
|
|
183
183
|
}
|
|
184
184
|
//#endregion
|
|
185
185
|
//#region src/pose.ts
|
|
186
|
-
var
|
|
187
|
-
function
|
|
186
|
+
var te = 3;
|
|
187
|
+
function R(e, t = {}, n = "", r = 0) {
|
|
188
188
|
if (typeof e == "number") n !== "" && (t[n] = e);
|
|
189
|
-
else if (Array.isArray(e) || ArrayBuffer.isView(e)) r <
|
|
190
|
-
|
|
189
|
+
else if (Array.isArray(e) || ArrayBuffer.isView(e)) r < te && Array.from(e).forEach((e, i) => {
|
|
190
|
+
R(e, t, `${n}[${i}]`, r + 1);
|
|
191
191
|
});
|
|
192
|
-
else if (typeof e == "object" && e && r <
|
|
192
|
+
else if (typeof e == "object" && e && r < te) for (let [i, a] of Object.entries(e)) R(a, t, n === "" ? i : `${n}.${i}`, r + 1);
|
|
193
193
|
return t;
|
|
194
194
|
}
|
|
195
|
-
var
|
|
196
|
-
function
|
|
195
|
+
var z = (n) => [e(n), ...t(n) ?? []], B = (e) => e !== void 0 && /^(?:color|ink)\(/.test(e);
|
|
196
|
+
function ne(e, t) {
|
|
197
197
|
let r = {}, i = {};
|
|
198
198
|
if (typeof e != "object" || !e) return {
|
|
199
199
|
values: r,
|
|
@@ -204,19 +204,19 @@ function re(e, t) {
|
|
|
204
204
|
let s = a[e];
|
|
205
205
|
if (s === void 0) return;
|
|
206
206
|
let c = t.kinds[o];
|
|
207
|
-
if (
|
|
208
|
-
else if (c === "affine" &&
|
|
209
|
-
else
|
|
207
|
+
if (B(c) && re(s)) i[e] = z(s);
|
|
208
|
+
else if (c === "affine" && re(s)) for (let [t, i] of Object.entries(n(s))) r[`${e}.${t}`] = i;
|
|
209
|
+
else R(s, r, e, 1);
|
|
210
210
|
});
|
|
211
|
-
for (let [e, t] of Object.entries(a)) o.has(e) ||
|
|
211
|
+
for (let [e, t] of Object.entries(a)) o.has(e) || R(t, r, e, 1);
|
|
212
212
|
return {
|
|
213
213
|
values: r,
|
|
214
214
|
colors: i
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
|
-
var
|
|
218
|
-
function
|
|
219
|
-
let t = /* @__PURE__ */ new Set(), n = new
|
|
217
|
+
var re = (e) => Array.isArray(e) || ArrayBuffer.isView(e) && !(e instanceof DataView), ie = 1e4, ae = 100, oe = 500, se = 250;
|
|
218
|
+
function ce(e = {}) {
|
|
219
|
+
let t = /* @__PURE__ */ new Set(), n = new E(), i = r(), a = null, o, s = null, c = null, l = !1, u = "", d = -Infinity, f = "", p = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = new T(), g = !1, _ = (e) => {
|
|
220
220
|
for (let n of [...t]) n(e);
|
|
221
221
|
}, v = () => i.entries(), y = (e) => v().find((t) => t.id === e), b = () => a === null ? null : y(a) ?? null, x = (e) => ({
|
|
222
222
|
id: e.id,
|
|
@@ -244,7 +244,7 @@ function le(e = {}) {
|
|
|
244
244
|
}, w = () => _({
|
|
245
245
|
kind: "hold",
|
|
246
246
|
hold: C()
|
|
247
|
-
}),
|
|
247
|
+
}), D = () => {
|
|
248
248
|
let e = b();
|
|
249
249
|
if (e === null) return [];
|
|
250
250
|
let t = e.mix.voices(), n = new Set(t.map((e) => e.id));
|
|
@@ -274,12 +274,12 @@ function le(e = {}) {
|
|
|
274
274
|
bounded: n.within !== void 0
|
|
275
275
|
};
|
|
276
276
|
});
|
|
277
|
-
},
|
|
277
|
+
}, O = () => {
|
|
278
278
|
d = Date.now(), _({
|
|
279
279
|
kind: "voices",
|
|
280
|
-
voices:
|
|
281
|
-
}),
|
|
282
|
-
},
|
|
280
|
+
voices: D()
|
|
281
|
+
}), j();
|
|
282
|
+
}, k = () => {
|
|
283
283
|
let t = b();
|
|
284
284
|
if (!g || t === null) return h.clear();
|
|
285
285
|
let n = [];
|
|
@@ -292,32 +292,32 @@ function le(e = {}) {
|
|
|
292
292
|
r: t.r
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
|
-
h.draw(n, e.screen ??
|
|
296
|
-
},
|
|
297
|
-
g = e, e && m.clear(),
|
|
295
|
+
h.draw(n, e.screen ?? I().screen);
|
|
296
|
+
}, A = (e) => {
|
|
297
|
+
g = e, e && m.clear(), O(), k(), _({
|
|
298
298
|
kind: "circles",
|
|
299
299
|
on: e
|
|
300
300
|
});
|
|
301
|
-
},
|
|
302
|
-
let e = b(), t = e === null ? [] :
|
|
301
|
+
}, j = () => {
|
|
302
|
+
let e = b(), t = e === null ? [] : M(e, ie), n = JSON.stringify(t);
|
|
303
303
|
n !== f && (f = n, _({
|
|
304
304
|
kind: "marks",
|
|
305
305
|
marks: t
|
|
306
306
|
}));
|
|
307
|
-
},
|
|
307
|
+
}, N = (e) => e.subjects().map((t) => ({
|
|
308
308
|
id: n.of(t),
|
|
309
309
|
label: e.label(t)
|
|
310
|
-
})),
|
|
310
|
+
})), P = () => {
|
|
311
311
|
let e = /* @__PURE__ */ new Map(), t = b();
|
|
312
312
|
for (let t of v()) for (let n of t.subjects()) e.has(n) || e.set(n, t.id);
|
|
313
313
|
if (t !== null) for (let n of t.subjects()) e.set(n, t.id);
|
|
314
314
|
if (p = e, n.prune(), t === null) return;
|
|
315
|
-
let r =
|
|
315
|
+
let r = N(t), i = JSON.stringify(r);
|
|
316
316
|
i !== u && (u = i, _({
|
|
317
317
|
kind: "subjects",
|
|
318
318
|
subjects: r
|
|
319
319
|
}));
|
|
320
|
-
},
|
|
320
|
+
}, F = (e, t) => {
|
|
321
321
|
let n;
|
|
322
322
|
for (let e of t.probed) e.subject === o && (n = e.pose);
|
|
323
323
|
let r = n === void 0;
|
|
@@ -332,41 +332,41 @@ function le(e = {}) {
|
|
|
332
332
|
} catch {}
|
|
333
333
|
return {
|
|
334
334
|
now: t.now,
|
|
335
|
-
...
|
|
335
|
+
...ne(n, e),
|
|
336
336
|
weights: i,
|
|
337
337
|
read: r
|
|
338
338
|
};
|
|
339
|
-
},
|
|
339
|
+
}, L = (e) => {
|
|
340
340
|
let t = e.history, n = e.mix.now;
|
|
341
341
|
if (t === void 0 || !Number.isFinite(n)) return [];
|
|
342
|
-
let r = [], i = Math.max(e.reach, n - Math.min(
|
|
343
|
-
for (let t = i; t < n; t +=
|
|
342
|
+
let r = [], i = Math.max(e.reach, n - Math.min(ie, t.ms));
|
|
343
|
+
for (let t = i; t < n; t += ae) try {
|
|
344
344
|
r.push({
|
|
345
345
|
now: t,
|
|
346
|
-
...
|
|
346
|
+
...ne(e.read(o, t), e),
|
|
347
347
|
weights: {},
|
|
348
348
|
read: !0
|
|
349
349
|
});
|
|
350
350
|
} catch {}
|
|
351
351
|
return r;
|
|
352
|
-
},
|
|
352
|
+
}, te = (e) => {
|
|
353
353
|
let t = b();
|
|
354
354
|
if (t !== null) {
|
|
355
355
|
if (o !== void 0) {
|
|
356
|
-
let n =
|
|
356
|
+
let n = F(t, e);
|
|
357
357
|
n !== null && _({
|
|
358
358
|
kind: "samples",
|
|
359
359
|
samples: [n],
|
|
360
360
|
reset: !1
|
|
361
361
|
});
|
|
362
362
|
}
|
|
363
|
-
Date.now() - d >=
|
|
363
|
+
Date.now() - d >= se && O(), k(), w();
|
|
364
364
|
}
|
|
365
|
-
},
|
|
365
|
+
}, R = () => {
|
|
366
366
|
c?.free(), c = null;
|
|
367
|
-
},
|
|
367
|
+
}, z = (e) => {
|
|
368
368
|
let t = e === null ? void 0 : y(e);
|
|
369
|
-
c !== null && (t === void 0 || !c.mixes.includes(t.mix)) &&
|
|
369
|
+
c !== null && (t === void 0 || !c.mixes.includes(t.mix)) && R(), s?.(), s = null, a = t?.id ?? null, o = void 0, u = "", f = "", l = !1, m.clear(), t !== void 0 && (s = t.watch(te)), _({
|
|
370
370
|
kind: "picked",
|
|
371
371
|
mix: a,
|
|
372
372
|
subject: null
|
|
@@ -374,8 +374,8 @@ function le(e = {}) {
|
|
|
374
374
|
kind: "samples",
|
|
375
375
|
samples: [],
|
|
376
376
|
reset: !0
|
|
377
|
-
}),
|
|
378
|
-
},
|
|
377
|
+
}), P(), O(), k(), w();
|
|
378
|
+
}, B = (e) => {
|
|
379
379
|
o = e === null ? void 0 : n.get(e);
|
|
380
380
|
let t = b();
|
|
381
381
|
_({
|
|
@@ -384,10 +384,10 @@ function le(e = {}) {
|
|
|
384
384
|
subject: o === void 0 ? null : e
|
|
385
385
|
}), _({
|
|
386
386
|
kind: "samples",
|
|
387
|
-
samples: t !== null && o !== void 0 ?
|
|
387
|
+
samples: t !== null && o !== void 0 ? L(t) : [],
|
|
388
388
|
reset: !0
|
|
389
|
-
}),
|
|
390
|
-
}, { arm:
|
|
389
|
+
}), O();
|
|
390
|
+
}, { arm: re, outline: ce } = ee(e, {
|
|
391
391
|
owner: (e) => {
|
|
392
392
|
let t = p.get(e);
|
|
393
393
|
if (t !== void 0) return t;
|
|
@@ -395,24 +395,24 @@ function le(e = {}) {
|
|
|
395
395
|
return n?.knows?.(e) ? n.id : v().find((t) => t.knows?.(e))?.id;
|
|
396
396
|
},
|
|
397
397
|
arming: (e) => {
|
|
398
|
-
e &&
|
|
398
|
+
e && P(), _({
|
|
399
399
|
kind: "arming",
|
|
400
400
|
on: e
|
|
401
401
|
});
|
|
402
402
|
},
|
|
403
403
|
picked: (e, t) => {
|
|
404
|
-
a !== t &&
|
|
404
|
+
a !== t && z(t), P(), B(n.of(e));
|
|
405
405
|
}
|
|
406
|
-
}),
|
|
406
|
+
}), le = (e) => {
|
|
407
407
|
switch (e.kind) {
|
|
408
408
|
case "mix":
|
|
409
|
-
|
|
409
|
+
z(e.id);
|
|
410
410
|
return;
|
|
411
411
|
case "subject":
|
|
412
|
-
|
|
412
|
+
B(e.id);
|
|
413
413
|
return;
|
|
414
414
|
case "hold":
|
|
415
|
-
if (!e.on)
|
|
415
|
+
if (!e.on) R();
|
|
416
416
|
else if (c === null && b() !== null) try {
|
|
417
417
|
c = b().hold(), l = !1;
|
|
418
418
|
} catch {
|
|
@@ -436,23 +436,23 @@ function le(e = {}) {
|
|
|
436
436
|
w();
|
|
437
437
|
return;
|
|
438
438
|
case "arm":
|
|
439
|
-
|
|
439
|
+
re(e.on);
|
|
440
440
|
return;
|
|
441
441
|
case "circles":
|
|
442
|
-
|
|
442
|
+
A(e.on);
|
|
443
443
|
return;
|
|
444
444
|
case "outline":
|
|
445
|
-
|
|
445
|
+
ce(e.subject === null ? void 0 : n.get(e.subject));
|
|
446
446
|
return;
|
|
447
447
|
}
|
|
448
|
-
},
|
|
448
|
+
}, ue = () => {
|
|
449
449
|
let [e, ...t] = v();
|
|
450
|
-
a === null && e !== void 0 && t.length === 0 &&
|
|
451
|
-
},
|
|
452
|
-
S(), e.kind === "gone" && a === e.id &&
|
|
450
|
+
a === null && e !== void 0 && t.length === 0 && z(e.id);
|
|
451
|
+
}, de = i.on((e) => {
|
|
452
|
+
S(), e.kind === "gone" && a === e.id && z(null), ue();
|
|
453
453
|
});
|
|
454
|
-
|
|
455
|
-
let
|
|
454
|
+
ue();
|
|
455
|
+
let V = setInterval(P, oe);
|
|
456
456
|
return {
|
|
457
457
|
subscribe(e) {
|
|
458
458
|
t.add(e), e({
|
|
@@ -472,26 +472,26 @@ function le(e = {}) {
|
|
|
472
472
|
let r = b();
|
|
473
473
|
return r !== null && e({
|
|
474
474
|
kind: "subjects",
|
|
475
|
-
subjects:
|
|
475
|
+
subjects: N(r)
|
|
476
476
|
}), e({
|
|
477
477
|
kind: "voices",
|
|
478
|
-
voices:
|
|
478
|
+
voices: D()
|
|
479
479
|
}), e({
|
|
480
480
|
kind: "marks",
|
|
481
|
-
marks: r === null ? [] :
|
|
481
|
+
marks: r === null ? [] : M(r, ie)
|
|
482
482
|
}), () => {
|
|
483
483
|
t.delete(e);
|
|
484
484
|
};
|
|
485
485
|
},
|
|
486
|
-
send:
|
|
486
|
+
send: le,
|
|
487
487
|
dispose() {
|
|
488
|
-
|
|
488
|
+
re(!1), R(), s?.(), s = null, clearInterval(V), de(), ce(void 0), h.clear(), t.clear();
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region ../../node_modules/@weasel-js/history/node_modules/@weasel-js/registry/dist/index.js
|
|
494
|
-
function
|
|
494
|
+
function le() {
|
|
495
495
|
let e = /* @__PURE__ */ new Set(), t = null;
|
|
496
496
|
return {
|
|
497
497
|
subscribe(n) {
|
|
@@ -515,8 +515,8 @@ function ue() {
|
|
|
515
515
|
}
|
|
516
516
|
//#endregion
|
|
517
517
|
//#region ../../node_modules/@weasel-js/history/dist/index.js
|
|
518
|
-
function
|
|
519
|
-
let { undoStack: n, redoStack: r, forks: i, floorId: a, nextEntryId: o } = e, s = 0, c = (e) => (s += e.length, e.map((e) =>
|
|
518
|
+
function ue(e, t) {
|
|
519
|
+
let { undoStack: n, redoStack: r, forks: i, floorId: a, nextEntryId: o } = e, s = 0, c = (e) => (s += e.length, e.map((e) => pe(e, t))), l = (e) => {
|
|
520
520
|
let t = c(e);
|
|
521
521
|
return t.slice(t.lastIndexOf(null) + 1);
|
|
522
522
|
}, u = l(n), d = l(r), f = u.length === n.length ? a : n[n.length - u.length - 1].id, p = /* @__PURE__ */ new Set([f, ...[...u, ...d].map((e) => e.id)]), m = [...i].flatMap(([e, t]) => t.map((t) => {
|
|
@@ -551,8 +551,8 @@ function de(e, t) {
|
|
|
551
551
|
droppedEntries: s - g
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
|
-
function
|
|
555
|
-
let r = (e) =>
|
|
554
|
+
function de(e, t, n) {
|
|
555
|
+
let r = (e) => _e(e, t, n), i = e.undoStack.map(r), a = e.redoStack.map(r), o = /* @__PURE__ */ new Map();
|
|
556
556
|
for (let t of e.branches ?? []) {
|
|
557
557
|
let e = t.entries.map(r), n = o.get(t.at);
|
|
558
558
|
n ? n.push(e) : o.set(t.at, [e]);
|
|
@@ -571,7 +571,7 @@ function fe(e, t, n) {
|
|
|
571
571
|
nextEntryId: s
|
|
572
572
|
};
|
|
573
573
|
}
|
|
574
|
-
function
|
|
574
|
+
function V(e) {
|
|
575
575
|
let t = /* @__PURE__ */ new Set();
|
|
576
576
|
for (let n of e) {
|
|
577
577
|
if (n.args === null || typeof n.args != "object") continue;
|
|
@@ -587,22 +587,22 @@ function B(e) {
|
|
|
587
587
|
}
|
|
588
588
|
return t;
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function fe(e) {
|
|
591
591
|
return typeof e.name == "string" ? {
|
|
592
592
|
name: e.name,
|
|
593
593
|
args: e.args
|
|
594
594
|
} : null;
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function pe(e, t) {
|
|
597
597
|
let n = [];
|
|
598
598
|
for (let r of e.forwardOps) {
|
|
599
|
-
let i =
|
|
599
|
+
let i = fe(r);
|
|
600
600
|
if (i === null) return t.log(`serialize: dropping entry id=${e.id} "${e.label}" \u2014 forwardOp without name`), null;
|
|
601
601
|
n.push(i);
|
|
602
602
|
}
|
|
603
603
|
let r = [];
|
|
604
604
|
for (let n of e.baseOps) {
|
|
605
|
-
let i =
|
|
605
|
+
let i = fe(n);
|
|
606
606
|
if (i === null) return t.log(`serialize: dropping entry id=${e.id} "${e.label}" \u2014 baseOp without name`), null;
|
|
607
607
|
r.push(i);
|
|
608
608
|
}
|
|
@@ -617,7 +617,7 @@ function me(e, t) {
|
|
|
617
617
|
...e.selectionAfter ? { selectionAfter: e.selectionAfter } : {}
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function me(e, t, n) {
|
|
621
621
|
let r = {
|
|
622
622
|
name: e,
|
|
623
623
|
args: t,
|
|
@@ -627,11 +627,11 @@ function he(e, t, n) {
|
|
|
627
627
|
};
|
|
628
628
|
return r;
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function he(e, t, n, r) {
|
|
631
631
|
let i = n ? n(e.name, e.args) : null;
|
|
632
|
-
return i === null ? (r.log(`restore: unknown op name "${e.name}" \u2014 substituting no-op placeholder`),
|
|
632
|
+
return i === null ? (r.log(`restore: unknown op name "${e.name}" \u2014 substituting no-op placeholder`), me(e.name, e.args, t)) : i;
|
|
633
633
|
}
|
|
634
|
-
function
|
|
634
|
+
function ge(e, t) {
|
|
635
635
|
if (e === t) return !0;
|
|
636
636
|
if (e.length !== t.length) return !1;
|
|
637
637
|
try {
|
|
@@ -640,8 +640,8 @@ function _e(e, t) {
|
|
|
640
640
|
return !1;
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
function
|
|
644
|
-
let r = e.forwardOps.map((r) =>
|
|
643
|
+
function _e(e, t, n) {
|
|
644
|
+
let r = e.forwardOps.map((r) => he(r, e.label, t, n)), i = ge(e.forwardOps, e.baseOps) ? r : e.baseOps.map((r) => he(r, e.label, t, n));
|
|
645
645
|
return {
|
|
646
646
|
id: e.id,
|
|
647
647
|
label: e.label,
|
|
@@ -649,12 +649,12 @@ function ve(e, t, n) {
|
|
|
649
649
|
baseOps: i,
|
|
650
650
|
timestamp: e.timestamp ?? 0,
|
|
651
651
|
pushes: e.pushes ?? 1,
|
|
652
|
-
touchedIds:
|
|
652
|
+
touchedIds: V(r),
|
|
653
653
|
...e.selectionBefore ? { selectionBefore: [...e.selectionBefore] } : {},
|
|
654
654
|
...e.selectionAfter ? { selectionAfter: [...e.selectionAfter] } : {}
|
|
655
655
|
};
|
|
656
656
|
}
|
|
657
|
-
function
|
|
657
|
+
function ve(e, t) {
|
|
658
658
|
if (e.length === 0 || t.length === 0 || e.length !== t.length) return !1;
|
|
659
659
|
let n = /* @__PURE__ */ new Map();
|
|
660
660
|
for (let t of e) {
|
|
@@ -669,7 +669,7 @@ function ye(e, t) {
|
|
|
669
669
|
}
|
|
670
670
|
return !0;
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function ye(e) {
|
|
673
673
|
return {
|
|
674
674
|
id: e.id,
|
|
675
675
|
label: e.label,
|
|
@@ -680,7 +680,7 @@ function be(e) {
|
|
|
680
680
|
...e.selectionAfter ? { selectionAfter: e.selectionAfter } : {}
|
|
681
681
|
};
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function H(e, t = []) {
|
|
684
684
|
return {
|
|
685
685
|
kind: e,
|
|
686
686
|
entries: t.map((e) => ({
|
|
@@ -690,7 +690,7 @@ function V(e, t = []) {
|
|
|
690
690
|
}))
|
|
691
691
|
};
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function be(e, t) {
|
|
694
694
|
function n(n) {
|
|
695
695
|
for (let r of n) try {
|
|
696
696
|
r.apply(e);
|
|
@@ -712,18 +712,18 @@ function xe(e, t) {
|
|
|
712
712
|
}
|
|
713
713
|
return r;
|
|
714
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function xe(e, t, n) {
|
|
716
716
|
let r = e.forwardOps === e.baseOps;
|
|
717
717
|
e.forwardOps = [...e.forwardOps, ...t], e.baseOps = r ? e.forwardOps : [...e.baseOps, ...t], e.timestamp = n, e.pushes++;
|
|
718
718
|
let i = new Set(e.touchedIds);
|
|
719
|
-
for (let e of
|
|
719
|
+
for (let e of V(t)) i.add(e);
|
|
720
720
|
e.touchedIds = i;
|
|
721
721
|
}
|
|
722
|
-
function
|
|
722
|
+
function Se(e) {
|
|
723
723
|
for (let t = 0; t < e.length; t++) if (e[t].caused !== void 0) return !0;
|
|
724
724
|
return !1;
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function Ce(e) {
|
|
727
727
|
let t = e.flatMap((e) => e.forwardOps);
|
|
728
728
|
return e.every((e) => e.forwardOps === e.baseOps) ? {
|
|
729
729
|
forwardOps: t,
|
|
@@ -733,17 +733,17 @@ function we(e) {
|
|
|
733
733
|
baseOps: e.flatMap((e) => e.baseOps)
|
|
734
734
|
};
|
|
735
735
|
}
|
|
736
|
-
var
|
|
737
|
-
function
|
|
738
|
-
let t =
|
|
736
|
+
var we = /* @__PURE__ */ new WeakMap();
|
|
737
|
+
function Te(e) {
|
|
738
|
+
let t = we.get(e);
|
|
739
739
|
if (!t) throw Error("Journal is not resumable (already committed or cancelled)");
|
|
740
740
|
t();
|
|
741
741
|
}
|
|
742
|
-
function
|
|
743
|
-
let a =
|
|
742
|
+
function Ee(e, t, n, r, i = {}) {
|
|
743
|
+
let a = Ae(t, {
|
|
744
744
|
...i,
|
|
745
745
|
...n.coalesceWindowMs === void 0 ? {} : { coalesceWindowMs: n.coalesceWindowMs }
|
|
746
|
-
}), o = i.selection, s = 0, c =
|
|
746
|
+
}), o = i.selection, s = 0, c = le();
|
|
747
747
|
function l() {
|
|
748
748
|
s++, c.emit();
|
|
749
749
|
}
|
|
@@ -784,12 +784,12 @@ function De(e, t, n, r, i = {}) {
|
|
|
784
784
|
subscribe: c.subscribe,
|
|
785
785
|
commit(t) {
|
|
786
786
|
if (f !== "active") throw Error("Journal is not active");
|
|
787
|
-
let { forwardOps: n, baseOps: i } =
|
|
788
|
-
|
|
787
|
+
let { forwardOps: n, baseOps: i } = Oe(a).appliedOps();
|
|
788
|
+
Oe(e).record(n, i, t, d ? { selectionBefore: d } : void 0), f = "closed", we.delete(p), r?.(), l();
|
|
789
789
|
},
|
|
790
790
|
cancel() {
|
|
791
791
|
if (f !== "active") throw Error("Journal is not active");
|
|
792
|
-
a.goto(0), f = "closed",
|
|
792
|
+
a.goto(0), f = "closed", we.delete(p), r?.(), l();
|
|
793
793
|
},
|
|
794
794
|
suspend() {
|
|
795
795
|
if (f !== "active") throw Error("Journal is not active");
|
|
@@ -799,23 +799,23 @@ function De(e, t, n, r, i = {}) {
|
|
|
799
799
|
return f === "active";
|
|
800
800
|
}
|
|
801
801
|
};
|
|
802
|
-
return
|
|
802
|
+
return we.set(p, () => {
|
|
803
803
|
if (f !== "suspended") throw Error("Journal is not suspended");
|
|
804
804
|
f = "active", l();
|
|
805
805
|
}), p;
|
|
806
806
|
}
|
|
807
|
-
var
|
|
808
|
-
function
|
|
809
|
-
let t =
|
|
807
|
+
var De = /* @__PURE__ */ new WeakMap();
|
|
808
|
+
function Oe(e) {
|
|
809
|
+
let t = De.get(e);
|
|
810
810
|
if (!t) throw Error("Not a history built by createHistory");
|
|
811
811
|
return t;
|
|
812
812
|
}
|
|
813
|
-
var
|
|
813
|
+
var ke = {
|
|
814
814
|
log: () => {},
|
|
815
815
|
warn: () => {}
|
|
816
816
|
};
|
|
817
|
-
function
|
|
818
|
-
let n = [], r = [], i = null, a = t.coalesceWindowMs ?? 0, o = t.now ?? (() => Date.now()), s = Math.max(0, t.historyLimit ?? Infinity), c = t.onEvict, l = t.branching ?? !1, u = /* @__PURE__ */ new Map(), d = 0, f = t.rebuildOp, p = t.selection, m = t.debug ??
|
|
817
|
+
function Ae(e, t = {}) {
|
|
818
|
+
let n = [], r = [], i = null, a = t.coalesceWindowMs ?? 0, o = t.now ?? (() => Date.now()), s = Math.max(0, t.historyLimit ?? Infinity), c = t.onEvict, l = t.branching ?? !1, u = /* @__PURE__ */ new Map(), d = 0, f = t.rebuildOp, p = t.selection, m = t.debug ?? ke, h = 1, g = 0, _ = -1, v = le(), y = le();
|
|
819
819
|
function b(e) {
|
|
820
820
|
g++, e && y.size > 0 && y.emit(e), v.emit();
|
|
821
821
|
}
|
|
@@ -858,50 +858,50 @@ function je(e, t = {}) {
|
|
|
858
858
|
let n = u.get(e);
|
|
859
859
|
n ? n.push(t.reverse()) : u.set(e, [t.reverse()]);
|
|
860
860
|
}
|
|
861
|
-
function
|
|
861
|
+
function E() {
|
|
862
862
|
for (; n.length > s;) C([n.shift()]);
|
|
863
863
|
}
|
|
864
|
-
let
|
|
865
|
-
function
|
|
864
|
+
let D = be(e, m);
|
|
865
|
+
function O(e) {
|
|
866
866
|
return [...e.baseOps].reverse().map((e) => e.invert());
|
|
867
867
|
}
|
|
868
|
-
function
|
|
868
|
+
function k() {
|
|
869
869
|
return p ? [...p.get()] : void 0;
|
|
870
870
|
}
|
|
871
|
-
function k(e) {
|
|
872
|
-
let t = O(), n = e.forwardOps !== e.baseOps;
|
|
873
|
-
E(D(e), n ? () => e.forwardOps : void 0), t && (e.selectionAfter = t), p && e.selectionBefore && p.set(e.selectionBefore);
|
|
874
|
-
}
|
|
875
871
|
function A(e) {
|
|
876
|
-
let t =
|
|
877
|
-
|
|
872
|
+
let t = k(), n = e.forwardOps !== e.baseOps;
|
|
873
|
+
D(O(e), n ? () => e.forwardOps : void 0), t && (e.selectionAfter = t), p && e.selectionBefore && p.set(e.selectionBefore);
|
|
878
874
|
}
|
|
879
875
|
function j(e) {
|
|
876
|
+
let t = k(), n = e.forwardOps !== e.baseOps;
|
|
877
|
+
D(e.forwardOps, n ? () => O(e) : void 0), t && (e.selectionBefore = t), p && e.selectionAfter && p.set(e.selectionAfter);
|
|
878
|
+
}
|
|
879
|
+
function M(e) {
|
|
880
880
|
let t = [];
|
|
881
881
|
for (; n.length > e;) {
|
|
882
882
|
let e = n[n.length - 1];
|
|
883
|
-
|
|
883
|
+
A(e), n.pop(), r.push(e), t.push(e);
|
|
884
884
|
}
|
|
885
885
|
for (; n.length < e && r.length > 0;) {
|
|
886
886
|
let e = r[r.length - 1];
|
|
887
|
-
|
|
887
|
+
j(e), r.pop(), n.push(e), t.push(e);
|
|
888
888
|
}
|
|
889
889
|
return t;
|
|
890
890
|
}
|
|
891
|
-
function
|
|
891
|
+
function N(e, t) {
|
|
892
892
|
let n = typeof a == "function" ? a() : a;
|
|
893
|
-
return !(n > 0) || e.coalesceKey !== void 0 || g !== _ || o() - e.timestamp > n ? !1 :
|
|
893
|
+
return !(n > 0) || e.coalesceKey !== void 0 || g !== _ || o() - e.timestamp > n ? !1 : ve(e.forwardOps, t);
|
|
894
894
|
}
|
|
895
|
-
function
|
|
895
|
+
function P(e, t, r = !1) {
|
|
896
896
|
if (e.length === 0) return;
|
|
897
|
-
let i =
|
|
897
|
+
let i = k(), a = [], s = D(e, void 0, a), c = a.length === 0 ? e : e.filter((e) => !(e.elideNoop && a.includes(e))), l = Se(c) ? c.flatMap((e) => e.caused?.() ?? [e]) : r || c !== e ? c : c.slice();
|
|
898
898
|
if (!s) {
|
|
899
899
|
m.warn(`'${t}' batch was a no-op \u2014 every op reported false/'noop'. Skipping the undo entry; consider gating the dispatch upstream to avoid the wasted work.`);
|
|
900
900
|
return;
|
|
901
901
|
}
|
|
902
902
|
if (l.length === 0) return;
|
|
903
|
-
let u =
|
|
904
|
-
if (d &&
|
|
903
|
+
let u = V(l), d = n[n.length - 1];
|
|
904
|
+
if (d && N(d, l)) {
|
|
905
905
|
if (d.forwardOps = l, d.timestamp = o(), d.pushes++, u.size > 0) {
|
|
906
906
|
let e = new Set(d.touchedIds);
|
|
907
907
|
for (let t of u) e.add(t);
|
|
@@ -928,10 +928,10 @@ function je(e, t = {}) {
|
|
|
928
928
|
touchedIds: u,
|
|
929
929
|
...i ? { selectionBefore: i } : {}
|
|
930
930
|
};
|
|
931
|
-
n.push(p), T(f),
|
|
931
|
+
n.push(p), T(f), E(), b(y.size > 0 ? H("push", [p]) : void 0), _ = g;
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
|
|
933
|
+
function F(e, t) {
|
|
934
|
+
xe(e, t, o()), b(y.size > 0 ? {
|
|
935
935
|
kind: "coalesce",
|
|
936
936
|
entries: [{
|
|
937
937
|
id: e.id,
|
|
@@ -940,10 +940,10 @@ function je(e, t = {}) {
|
|
|
940
940
|
}]
|
|
941
941
|
} : void 0), _ = g;
|
|
942
942
|
}
|
|
943
|
-
function
|
|
943
|
+
function I(e, t, r, i = {}) {
|
|
944
944
|
if (e.length === 0) return;
|
|
945
945
|
let a = i.coalesceKey, s = n[n.length - 1];
|
|
946
|
-
if (a !== void 0 && s?.coalesceKey === a && g === _ && e === t) return
|
|
946
|
+
if (a !== void 0 && s?.coalesceKey === a && g === _ && e === t) return F(s, e);
|
|
947
947
|
let c = w(), l = {
|
|
948
948
|
id: h++,
|
|
949
949
|
forwardOps: e,
|
|
@@ -951,24 +951,24 @@ function je(e, t = {}) {
|
|
|
951
951
|
label: r,
|
|
952
952
|
timestamp: o(),
|
|
953
953
|
pushes: 1,
|
|
954
|
-
touchedIds:
|
|
954
|
+
touchedIds: V(e),
|
|
955
955
|
...i.selectionBefore ? { selectionBefore: [...i.selectionBefore] } : {},
|
|
956
956
|
...a === void 0 ? {} : { coalesceKey: a }
|
|
957
957
|
};
|
|
958
|
-
n.push(l), T(c),
|
|
958
|
+
n.push(l), T(c), E(), b(y.size > 0 ? H("push", [l]) : void 0), a !== void 0 && (_ = g);
|
|
959
959
|
}
|
|
960
|
-
let
|
|
960
|
+
let L = {
|
|
961
961
|
apply(e, t) {
|
|
962
|
-
|
|
962
|
+
P([e], t ?? e.label ?? "", !0);
|
|
963
963
|
},
|
|
964
964
|
applyOps(e, t) {
|
|
965
|
-
|
|
965
|
+
P(e, t);
|
|
966
966
|
},
|
|
967
967
|
undo() {
|
|
968
|
-
n.length !== 0 && b(
|
|
968
|
+
n.length !== 0 && b(H("undo", M(n.length - 1)));
|
|
969
969
|
},
|
|
970
970
|
redo() {
|
|
971
|
-
r.length !== 0 && b(
|
|
971
|
+
r.length !== 0 && b(H("redo", M(n.length + 1)));
|
|
972
972
|
},
|
|
973
973
|
seal() {
|
|
974
974
|
_ = -1;
|
|
@@ -979,12 +979,12 @@ function je(e, t = {}) {
|
|
|
979
979
|
redoDepth: () => r.length,
|
|
980
980
|
clear: () => {
|
|
981
981
|
let e = n.length > 0 || r.length > 0 || u.size > 0;
|
|
982
|
-
n.length = 0, r.length = 0, u.clear(), d = 0, e && b(
|
|
982
|
+
n.length = 0, r.length = 0, u.clear(), d = 0, e && b(H("clear"));
|
|
983
983
|
},
|
|
984
984
|
entries() {
|
|
985
985
|
return {
|
|
986
|
-
undo: n.map(
|
|
987
|
-
redo: [...r].reverse().map(
|
|
986
|
+
undo: n.map(ye),
|
|
987
|
+
redo: [...r].reverse().map(ye)
|
|
988
988
|
};
|
|
989
989
|
},
|
|
990
990
|
goto(e) {
|
|
@@ -992,16 +992,16 @@ function je(e, t = {}) {
|
|
|
992
992
|
if (e < 0 || e > t || e === n.length) return;
|
|
993
993
|
let i = n.length, a;
|
|
994
994
|
try {
|
|
995
|
-
a =
|
|
995
|
+
a = M(e);
|
|
996
996
|
} catch (e) {
|
|
997
997
|
try {
|
|
998
|
-
|
|
998
|
+
M(i);
|
|
999
999
|
} catch (e) {
|
|
1000
1000
|
m.warn(`goto: returning to depth ${i} threw: ${String(e)}`);
|
|
1001
1001
|
}
|
|
1002
1002
|
throw n.length !== i && b(), e;
|
|
1003
1003
|
}
|
|
1004
|
-
b(
|
|
1004
|
+
b(H("goto", a));
|
|
1005
1005
|
},
|
|
1006
1006
|
timestampAt(e) {
|
|
1007
1007
|
if (!(e < 0)) return e < n.length ? n[e].timestamp : r[r.length - 1 - (e - n.length)]?.timestamp;
|
|
@@ -1018,7 +1018,7 @@ function je(e, t = {}) {
|
|
|
1018
1018
|
for (; t < n.length && n[t].timestamp < e;) t++;
|
|
1019
1019
|
if (t === 0) return;
|
|
1020
1020
|
let r = n.splice(0, t);
|
|
1021
|
-
C(r), b(
|
|
1021
|
+
C(r), b(H("prune", r));
|
|
1022
1022
|
},
|
|
1023
1023
|
branches() {
|
|
1024
1024
|
let e = (e, t) => {
|
|
@@ -1038,12 +1038,12 @@ function je(e, t = {}) {
|
|
|
1038
1038
|
let t = w(), n = u.get(t) ?? [], i = n.findIndex((t) => t[0].id === e);
|
|
1039
1039
|
if (i < 0) throw Error(`No branch ${e} forks from entry ${t}`);
|
|
1040
1040
|
let [a] = n.splice(i, 1);
|
|
1041
|
-
r.length > 0 && n.push(r.splice(0).reverse()), n.length > 0 ? u.set(t, n) : u.delete(t), r.push(...[...a].reverse()), b(
|
|
1041
|
+
r.length > 0 && n.push(r.splice(0).reverse()), n.length > 0 ? u.set(t, n) : u.delete(t), r.push(...[...a].reverse()), b(H("branch", a));
|
|
1042
1042
|
},
|
|
1043
1043
|
getVersion: () => g,
|
|
1044
1044
|
subscribe: v.subscribe,
|
|
1045
1045
|
observe: y.subscribe,
|
|
1046
|
-
serialize: () =>
|
|
1046
|
+
serialize: () => ue({
|
|
1047
1047
|
undoStack: n,
|
|
1048
1048
|
redoStack: r,
|
|
1049
1049
|
forks: u,
|
|
@@ -1051,7 +1051,7 @@ function je(e, t = {}) {
|
|
|
1051
1051
|
nextEntryId: h
|
|
1052
1052
|
}, m),
|
|
1053
1053
|
recordEntry(e, t, n) {
|
|
1054
|
-
|
|
1054
|
+
I(e, e, t, n);
|
|
1055
1055
|
},
|
|
1056
1056
|
allForwardOps() {
|
|
1057
1057
|
let e = [];
|
|
@@ -1061,7 +1061,7 @@ function je(e, t = {}) {
|
|
|
1061
1061
|
currentEntryId: () => h,
|
|
1062
1062
|
beginJournal(t) {
|
|
1063
1063
|
if (i !== null && i.isActive()) throw Error("A journal is already active — commit, cancel, or suspend it first");
|
|
1064
|
-
let n =
|
|
1064
|
+
let n = Ee(L, e, t, () => {
|
|
1065
1065
|
i = null;
|
|
1066
1066
|
}, {
|
|
1067
1067
|
coalesceWindowMs: a,
|
|
@@ -1074,23 +1074,23 @@ function je(e, t = {}) {
|
|
|
1074
1074
|
activeJournal: () => i?.isActive() ? i : null,
|
|
1075
1075
|
resumeJournal(e) {
|
|
1076
1076
|
if (i !== null && i !== e && i.isActive()) throw Error("A journal is already active — commit, cancel, or suspend it first");
|
|
1077
|
-
|
|
1077
|
+
Te(e), i = e;
|
|
1078
1078
|
},
|
|
1079
1079
|
restore(e) {
|
|
1080
|
-
let t =
|
|
1080
|
+
let t = de(e, f, m);
|
|
1081
1081
|
n.splice(0, n.length, ...t.undoStack), r.splice(0, r.length, ...t.redoStack), u.clear();
|
|
1082
1082
|
for (let [e, n] of t.forks) u.set(e, n);
|
|
1083
|
-
d = t.floorId, h = t.nextEntryId, b(
|
|
1083
|
+
d = t.floorId, h = t.nextEntryId, b(H("restore"));
|
|
1084
1084
|
}
|
|
1085
1085
|
};
|
|
1086
|
-
return
|
|
1087
|
-
appliedOps: () =>
|
|
1088
|
-
record:
|
|
1089
|
-
}),
|
|
1090
|
-
}
|
|
1091
|
-
var
|
|
1092
|
-
function
|
|
1093
|
-
if (!
|
|
1086
|
+
return De.set(L, {
|
|
1087
|
+
appliedOps: () => Ce(n),
|
|
1088
|
+
record: I
|
|
1089
|
+
}), L;
|
|
1090
|
+
}
|
|
1091
|
+
var je = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
1092
|
+
function Me(e) {
|
|
1093
|
+
if (!je.test(e)) return null;
|
|
1094
1094
|
let t = e.slice(1), n = t.length <= 4 ? t.replace(/./g, "$&$&") : t, r = (e) => Number.parseInt(n.slice(e, e + 2), 16);
|
|
1095
1095
|
return [
|
|
1096
1096
|
r(0),
|
|
@@ -1099,8 +1099,8 @@ function Ne(e) {
|
|
|
1099
1099
|
n.length === 8 ? r(6) : 255
|
|
1100
1100
|
];
|
|
1101
1101
|
}
|
|
1102
|
-
function
|
|
1103
|
-
let t =
|
|
1102
|
+
function Ne(e) {
|
|
1103
|
+
let t = Me(e);
|
|
1104
1104
|
if (!t) throw Error(`not a hex color: "${e}"`);
|
|
1105
1105
|
return [
|
|
1106
1106
|
t[0],
|
|
@@ -1108,7 +1108,7 @@ function Pe(e) {
|
|
|
1108
1108
|
t[2]
|
|
1109
1109
|
];
|
|
1110
1110
|
}
|
|
1111
|
-
var
|
|
1111
|
+
var Pe = (() => {
|
|
1112
1112
|
let e = /* @__PURE__ */ new Float64Array(256);
|
|
1113
1113
|
for (let t = 0; t < 256; t++) {
|
|
1114
1114
|
let n = t / 255;
|
|
@@ -1116,16 +1116,16 @@ var Fe = (() => {
|
|
|
1116
1116
|
}
|
|
1117
1117
|
return e;
|
|
1118
1118
|
})();
|
|
1119
|
-
function
|
|
1119
|
+
function Fe(e) {
|
|
1120
1120
|
if (e <= 0) return 0;
|
|
1121
1121
|
if (e >= 1) return 255;
|
|
1122
1122
|
let t = e <= .0031308 ? e * 12.92 : 1.055 * e ** (1 / 2.4) - .055;
|
|
1123
1123
|
return Math.round(t * 255);
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1126
|
-
return
|
|
1125
|
+
function Ie(e, t, n) {
|
|
1126
|
+
return Le(Pe[e & 255], Pe[t & 255], Pe[n & 255]);
|
|
1127
1127
|
}
|
|
1128
|
-
function
|
|
1128
|
+
function Le(e, t, n) {
|
|
1129
1129
|
let r = .4122214708 * e + .5363325363 * t + .0514459929 * n, i = .2119034982 * e + .6806995451 * t + .1073969566 * n, a = .0883024619 * e + .2817188376 * t + .6299787005 * n, o = Math.cbrt(r), s = Math.cbrt(i), c = Math.cbrt(a);
|
|
1130
1130
|
return [
|
|
1131
1131
|
.2104542553 * o + .793617785 * s - .0040720468 * c,
|
|
@@ -1133,7 +1133,7 @@ function Re(e, t, n) {
|
|
|
1133
1133
|
.0259040371 * o + .7827717662 * s - .808675766 * c
|
|
1134
1134
|
];
|
|
1135
1135
|
}
|
|
1136
|
-
function
|
|
1136
|
+
function Re(e, t, n) {
|
|
1137
1137
|
let r = e + .3963377774 * t + .2158037573 * n, i = e - .1055613458 * t - .0638541728 * n, a = e - .0894841775 * t - 1.291485548 * n, o = r * r * r, s = i * i * i, c = a * a * a;
|
|
1138
1138
|
return [
|
|
1139
1139
|
4.0767416621 * o - 3.3077115913 * s + .2309699292 * c,
|
|
@@ -1141,12 +1141,12 @@ function ze(e, t, n) {
|
|
|
1141
1141
|
-.0041960863 * o - .7034186147 * s + 1.707614701 * c
|
|
1142
1142
|
];
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1144
|
+
function ze(e, t, n) {
|
|
1145
1145
|
return e >= -1e-6 && e <= 1.000001 && t >= -1e-6 && t <= 1.000001 && n >= -1e-6 && n <= 1.000001;
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1148
|
-
let [r, i, a] =
|
|
1149
|
-
if (
|
|
1147
|
+
function Be(e, t, n) {
|
|
1148
|
+
let [r, i, a] = Re(e, t, n);
|
|
1149
|
+
if (ze(r, i, a)) return [
|
|
1150
1150
|
r,
|
|
1151
1151
|
i,
|
|
1152
1152
|
a
|
|
@@ -1154,58 +1154,58 @@ function Ve(e, t, n) {
|
|
|
1154
1154
|
let o = 0, s = 1;
|
|
1155
1155
|
for (let c = 0; c < 5; c++) {
|
|
1156
1156
|
let c = (o + s) / 2;
|
|
1157
|
-
[r, i, a] =
|
|
1157
|
+
[r, i, a] = Re(e, t * c, n * c), ze(r, i, a) ? o = c : s = c;
|
|
1158
1158
|
}
|
|
1159
|
-
return [r, i, a] =
|
|
1159
|
+
return [r, i, a] = Re(e, t * o, n * o), [
|
|
1160
1160
|
r,
|
|
1161
1161
|
i,
|
|
1162
1162
|
a
|
|
1163
1163
|
];
|
|
1164
1164
|
}
|
|
1165
|
-
function
|
|
1166
|
-
let [r, i, a] =
|
|
1165
|
+
function Ve(e, t, n) {
|
|
1166
|
+
let [r, i, a] = Be(e, t, n);
|
|
1167
1167
|
return [
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1168
|
+
Fe(r),
|
|
1169
|
+
Fe(i),
|
|
1170
|
+
Fe(a)
|
|
1171
1171
|
];
|
|
1172
1172
|
}
|
|
1173
|
-
function
|
|
1173
|
+
function He(e, t, n) {
|
|
1174
1174
|
return [
|
|
1175
1175
|
e,
|
|
1176
1176
|
Math.hypot(t, n),
|
|
1177
1177
|
Math.atan2(n, t)
|
|
1178
1178
|
];
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1180
|
+
function Ue(e, t, n) {
|
|
1181
1181
|
return [
|
|
1182
1182
|
e,
|
|
1183
1183
|
t * Math.cos(n),
|
|
1184
1184
|
t * Math.sin(n)
|
|
1185
1185
|
];
|
|
1186
1186
|
}
|
|
1187
|
-
var
|
|
1188
|
-
function
|
|
1189
|
-
let [r, i, a] =
|
|
1190
|
-
return `#${
|
|
1187
|
+
var We = (e) => Math.max(0, Math.min(255, Math.round(e))).toString(16).padStart(2, "0");
|
|
1188
|
+
function Ge(e, t, n) {
|
|
1189
|
+
let [r, i, a] = Ue(e, t, n * Math.PI / 180), [o, s, c] = Ve(r, i, a);
|
|
1190
|
+
return `#${We(o)}${We(s)}${We(c)}`;
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1193
|
-
let [t, n, r] =
|
|
1192
|
+
function Ke(e) {
|
|
1193
|
+
let [t, n, r] = Ie(...Ne(e)), [i, a, o] = He(t, n, r);
|
|
1194
1194
|
return {
|
|
1195
1195
|
L: i,
|
|
1196
1196
|
C: a,
|
|
1197
1197
|
H: (o * 180 / Math.PI % 360 + 360) % 360
|
|
1198
1198
|
};
|
|
1199
1199
|
}
|
|
1200
|
-
function
|
|
1200
|
+
function U(e) {
|
|
1201
1201
|
let t = Math.abs(e), n = t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
1202
1202
|
return e < 0 ? -n : n;
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1204
|
+
function W(e) {
|
|
1205
1205
|
let t = Math.abs(e), n = t <= .0031308 ? t * 12.92 : 1.055 * t ** (1 / 2.4) - .055;
|
|
1206
1206
|
return e < 0 ? -n : n;
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function qe(e, t, n) {
|
|
1209
1209
|
if (t === 0) return [
|
|
1210
1210
|
n,
|
|
1211
1211
|
n,
|
|
@@ -1213,15 +1213,15 @@ function Je(e, t, n) {
|
|
|
1213
1213
|
];
|
|
1214
1214
|
let r = n < .5 ? n * (1 + t) : n + t - n * t, i = 2 * n - r, a = e / 360;
|
|
1215
1215
|
return [
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1216
|
+
Je(i, r, a + 1 / 3),
|
|
1217
|
+
Je(i, r, a),
|
|
1218
|
+
Je(i, r, a - 1 / 3)
|
|
1219
1219
|
];
|
|
1220
1220
|
}
|
|
1221
|
-
function
|
|
1221
|
+
function Je(e, t, n) {
|
|
1222
1222
|
return n < 0 && (n += 1), n > 1 && --n, n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1224
|
+
function Ye(e, t, n) {
|
|
1225
1225
|
let r = Math.max(e, t, n), i = Math.min(e, t, n), a = (r + i) / 2, o = r - i;
|
|
1226
1226
|
if (o === 0) return [
|
|
1227
1227
|
0,
|
|
@@ -1235,111 +1235,111 @@ function Xe(e, t, n) {
|
|
|
1235
1235
|
a
|
|
1236
1236
|
];
|
|
1237
1237
|
}
|
|
1238
|
-
var
|
|
1239
|
-
function
|
|
1238
|
+
var Xe = 1e-4;
|
|
1239
|
+
function Ze(e, t, n, r) {
|
|
1240
1240
|
let i = ((t - e) % 360 + 360) % 360;
|
|
1241
1241
|
return r === "shorter" ? i > 180 && (i -= 360) : i > 0 && i < 180 && (i -= 360), ((e + i * n) % 360 + 360) % 360;
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1244
|
-
let i = e[0] <
|
|
1243
|
+
function Qe(e, t, n, r) {
|
|
1244
|
+
let i = e[0] < Xe ? t[1] : e[1], a = t[0] < Xe ? e[1] : t[1];
|
|
1245
1245
|
return [
|
|
1246
1246
|
e[0] + (t[0] - e[0]) * n,
|
|
1247
|
-
|
|
1247
|
+
Ze(i, a, n, r),
|
|
1248
1248
|
e[2] + (t[2] - e[2]) * n
|
|
1249
1249
|
];
|
|
1250
1250
|
}
|
|
1251
|
-
var
|
|
1251
|
+
var $e = (e, t, n) => [
|
|
1252
1252
|
e[0] + (t[0] - e[0]) * n,
|
|
1253
1253
|
e[1] + (t[1] - e[1]) * n,
|
|
1254
1254
|
e[2] + (t[2] - e[2]) * n
|
|
1255
|
-
],
|
|
1256
|
-
function
|
|
1257
|
-
let [r, i, a] =
|
|
1255
|
+
], et = (e) => e < 0 ? 0 : e > 1 ? 1 : e, tt = (e) => Le(U(e[0]), U(e[1]), U(e[2]));
|
|
1256
|
+
function nt(e, t, n) {
|
|
1257
|
+
let [r, i, a] = Be(e, t, n);
|
|
1258
1258
|
return [
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1259
|
+
et(W(r)),
|
|
1260
|
+
et(W(i)),
|
|
1261
|
+
et(W(a))
|
|
1262
1262
|
];
|
|
1263
1263
|
}
|
|
1264
|
-
function
|
|
1264
|
+
function rt(e, t, n, r = "oklch", i = "shorter") {
|
|
1265
1265
|
switch (r) {
|
|
1266
|
-
case "srgb": return
|
|
1266
|
+
case "srgb": return $e(e, t, n);
|
|
1267
1267
|
case "srgb-linear": {
|
|
1268
1268
|
let r = (e) => [
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
], [i, a, o] =
|
|
1269
|
+
U(e[0]),
|
|
1270
|
+
U(e[1]),
|
|
1271
|
+
U(e[2])
|
|
1272
|
+
], [i, a, o] = $e(r(e), r(t), n);
|
|
1273
1273
|
return [
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1274
|
+
W(i),
|
|
1275
|
+
W(a),
|
|
1276
|
+
W(o)
|
|
1277
1277
|
];
|
|
1278
1278
|
}
|
|
1279
1279
|
case "oklab": {
|
|
1280
|
-
let [r, i, a] =
|
|
1281
|
-
return
|
|
1280
|
+
let [r, i, a] = $e(tt(e), tt(t), n);
|
|
1281
|
+
return nt(r, i, a);
|
|
1282
1282
|
}
|
|
1283
1283
|
case "oklch": {
|
|
1284
1284
|
let r = (e) => {
|
|
1285
|
-
let [t, n, r] =
|
|
1285
|
+
let [t, n, r] = He(...tt(e));
|
|
1286
1286
|
return [
|
|
1287
1287
|
n,
|
|
1288
1288
|
(r * 180 / Math.PI % 360 + 360) % 360,
|
|
1289
1289
|
t
|
|
1290
1290
|
];
|
|
1291
|
-
}, [a, o, s] =
|
|
1292
|
-
return
|
|
1291
|
+
}, [a, o, s] = Qe(r(e), r(t), n, i), [c, l, u] = Ue(s, a, o * Math.PI / 180);
|
|
1292
|
+
return nt(c, l, u);
|
|
1293
1293
|
}
|
|
1294
1294
|
case "hsl": {
|
|
1295
1295
|
let r = (e) => {
|
|
1296
|
-
let [t, n, r] =
|
|
1296
|
+
let [t, n, r] = Ye(e[0], e[1], e[2]);
|
|
1297
1297
|
return [
|
|
1298
1298
|
n,
|
|
1299
1299
|
t,
|
|
1300
1300
|
r
|
|
1301
1301
|
];
|
|
1302
|
-
}, [a, o, s] =
|
|
1303
|
-
return
|
|
1302
|
+
}, [a, o, s] = Qe(r(e), r(t), n, i);
|
|
1303
|
+
return qe(o, a, s);
|
|
1304
1304
|
}
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
1307
|
-
function
|
|
1308
|
-
let t =
|
|
1307
|
+
function it(e) {
|
|
1308
|
+
let t = at.get(e);
|
|
1309
1309
|
if (t !== void 0) return t;
|
|
1310
|
-
let n =
|
|
1311
|
-
return
|
|
1310
|
+
let n = st(e);
|
|
1311
|
+
return at.size >= ot && at.clear(), at.set(e, n), n;
|
|
1312
1312
|
}
|
|
1313
|
-
var
|
|
1314
|
-
function
|
|
1313
|
+
var at = /* @__PURE__ */ new Map(), ot = 1024;
|
|
1314
|
+
function st(e) {
|
|
1315
1315
|
let t = e.trim();
|
|
1316
|
-
if (t.startsWith("#")) return
|
|
1317
|
-
let n = t.toLowerCase(), r =
|
|
1316
|
+
if (t.startsWith("#")) return lt(t);
|
|
1317
|
+
let n = t.toLowerCase(), r = yt[n];
|
|
1318
1318
|
if (r !== void 0) return r;
|
|
1319
1319
|
if (n.startsWith("rgb")) {
|
|
1320
|
-
let e =
|
|
1320
|
+
let e = pt(n);
|
|
1321
1321
|
if (e) return e;
|
|
1322
1322
|
}
|
|
1323
1323
|
if (n.startsWith("hsl")) {
|
|
1324
|
-
let e =
|
|
1324
|
+
let e = mt(n);
|
|
1325
1325
|
if (e) return e;
|
|
1326
1326
|
}
|
|
1327
1327
|
if (n.startsWith("color(")) {
|
|
1328
|
-
let e =
|
|
1328
|
+
let e = ht(n);
|
|
1329
1329
|
if (e) return e;
|
|
1330
1330
|
}
|
|
1331
1331
|
if (n.startsWith("ok")) {
|
|
1332
|
-
let e =
|
|
1332
|
+
let e = gt(n);
|
|
1333
1333
|
if (e) return e;
|
|
1334
1334
|
}
|
|
1335
1335
|
throw Error(`parseColor: unrecognized color "${e}"`);
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1337
|
+
function ct(e) {
|
|
1338
1338
|
let [t, n, r] = e, i = e.length === 4 ? e[3] : 1, a = (e) => Math.max(0, Math.min(255, Math.round(e * 255))).toString(16).padStart(2, "0"), o = `#${a(t)}${a(n)}${a(r)}`;
|
|
1339
1339
|
return i >= 1 ? o : `${o}${a(i)}`;
|
|
1340
1340
|
}
|
|
1341
|
-
function
|
|
1342
|
-
let t =
|
|
1341
|
+
function lt(e) {
|
|
1342
|
+
let t = Me(e);
|
|
1343
1343
|
if (!t) throw Error(`parseColor: invalid hex "${e}"`);
|
|
1344
1344
|
return [
|
|
1345
1345
|
t[0] / 255,
|
|
@@ -1348,10 +1348,10 @@ function ut(e) {
|
|
|
1348
1348
|
t[3] / 255
|
|
1349
1349
|
];
|
|
1350
1350
|
}
|
|
1351
|
-
function
|
|
1351
|
+
function G(e, t) {
|
|
1352
1352
|
return !e.startsWith(t + "(") || !e.endsWith(")") ? null : e.slice(t.length + 1, -1).trim();
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1354
|
+
function ut(e) {
|
|
1355
1355
|
if (e.includes(",")) {
|
|
1356
1356
|
let t = e.split(",").map((e) => e.trim());
|
|
1357
1357
|
return t.length !== 3 && t.length !== 4 ? null : {
|
|
@@ -1373,103 +1373,103 @@ function dt(e) {
|
|
|
1373
1373
|
alpha: r
|
|
1374
1374
|
};
|
|
1375
1375
|
}
|
|
1376
|
-
function
|
|
1376
|
+
function dt(e, t) {
|
|
1377
1377
|
if (e.endsWith("%")) {
|
|
1378
1378
|
let t = Number(e.slice(0, -1));
|
|
1379
|
-
return Number.isFinite(t) ?
|
|
1379
|
+
return Number.isFinite(t) ? K(t / 100) : null;
|
|
1380
1380
|
}
|
|
1381
1381
|
let n = Number(e);
|
|
1382
|
-
return Number.isFinite(n) ?
|
|
1382
|
+
return Number.isFinite(n) ? K(n / t) : null;
|
|
1383
1383
|
}
|
|
1384
|
-
function
|
|
1384
|
+
function ft(e) {
|
|
1385
1385
|
if (e === null) return 1;
|
|
1386
1386
|
if (e.endsWith("%")) {
|
|
1387
1387
|
let t = Number(e.slice(0, -1));
|
|
1388
|
-
return Number.isFinite(t) ?
|
|
1388
|
+
return Number.isFinite(t) ? K(t / 100) : 1;
|
|
1389
1389
|
}
|
|
1390
1390
|
let t = Number(e);
|
|
1391
|
-
return Number.isFinite(t) ?
|
|
1391
|
+
return Number.isFinite(t) ? K(t) : 1;
|
|
1392
1392
|
}
|
|
1393
|
-
function
|
|
1394
|
-
let t =
|
|
1393
|
+
function pt(e) {
|
|
1394
|
+
let t = G(e, "rgba") ?? G(e, "rgb");
|
|
1395
1395
|
if (t === null) return null;
|
|
1396
|
-
let n =
|
|
1396
|
+
let n = ut(t);
|
|
1397
1397
|
if (!n) return null;
|
|
1398
|
-
let r =
|
|
1398
|
+
let r = dt(n.rgb[0], 255), i = dt(n.rgb[1], 255), a = dt(n.rgb[2], 255);
|
|
1399
1399
|
return r === null || i === null || a === null ? null : [
|
|
1400
1400
|
r,
|
|
1401
1401
|
i,
|
|
1402
1402
|
a,
|
|
1403
|
-
|
|
1403
|
+
ft(n.alpha)
|
|
1404
1404
|
];
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1407
|
-
let t =
|
|
1406
|
+
function mt(e) {
|
|
1407
|
+
let t = G(e, "hsla") ?? G(e, "hsl");
|
|
1408
1408
|
if (t === null) return null;
|
|
1409
|
-
let n =
|
|
1409
|
+
let n = ut(t);
|
|
1410
1410
|
if (!n) return null;
|
|
1411
|
-
let r =
|
|
1411
|
+
let r = _t(n.rgb[0]), i = vt(n.rgb[1]), a = vt(n.rgb[2]);
|
|
1412
1412
|
if (r === null || i === null || a === null) return null;
|
|
1413
|
-
let [o, s, c] =
|
|
1413
|
+
let [o, s, c] = qe(r, i, a);
|
|
1414
1414
|
return [
|
|
1415
1415
|
o,
|
|
1416
1416
|
s,
|
|
1417
1417
|
c,
|
|
1418
|
-
|
|
1418
|
+
ft(n.alpha)
|
|
1419
1419
|
];
|
|
1420
1420
|
}
|
|
1421
|
-
function
|
|
1422
|
-
let t =
|
|
1421
|
+
function ht(e) {
|
|
1422
|
+
let t = G(e, "color"), n = t?.match(/^(srgb-linear|srgb)\s+/);
|
|
1423
1423
|
if (!t || !n || t.includes(",")) return null;
|
|
1424
|
-
let r =
|
|
1424
|
+
let r = ut(t.slice(n[0].length));
|
|
1425
1425
|
if (!r) return null;
|
|
1426
|
-
let i = r.rgb.map((e) =>
|
|
1426
|
+
let i = r.rgb.map((e) => dt(e, 1));
|
|
1427
1427
|
if (i.some((e) => e === null)) return null;
|
|
1428
|
-
let [a, o, s] = n[1] === "srgb" ? i : i.map((e) =>
|
|
1428
|
+
let [a, o, s] = n[1] === "srgb" ? i : i.map((e) => W(e));
|
|
1429
1429
|
return [
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1430
|
+
K(a),
|
|
1431
|
+
K(o),
|
|
1432
|
+
K(s),
|
|
1433
|
+
ft(r.alpha)
|
|
1434
1434
|
];
|
|
1435
1435
|
}
|
|
1436
|
-
function
|
|
1437
|
-
let t =
|
|
1436
|
+
function gt(e) {
|
|
1437
|
+
let t = G(e, "oklch"), n = t ?? G(e, "oklab");
|
|
1438
1438
|
if (n === null || n.includes(",")) return null;
|
|
1439
|
-
let r =
|
|
1439
|
+
let r = ut(n);
|
|
1440
1440
|
if (!r) return null;
|
|
1441
|
-
let i =
|
|
1441
|
+
let i = vt(r.rgb[0]), a = Number(r.rgb[1]);
|
|
1442
1442
|
if (i === null || !Number.isFinite(a)) return null;
|
|
1443
1443
|
let o = a, s = Number(r.rgb[2]);
|
|
1444
1444
|
if (t !== null) {
|
|
1445
|
-
let e =
|
|
1445
|
+
let e = _t(r.rgb[2]);
|
|
1446
1446
|
if (e === null) return null;
|
|
1447
|
-
[, o, s] =
|
|
1447
|
+
[, o, s] = Ue(i, a, Math.PI / 180 * e);
|
|
1448
1448
|
} else if (!Number.isFinite(s)) return null;
|
|
1449
|
-
let [c, l, u] =
|
|
1449
|
+
let [c, l, u] = Re(i, o, s).map((e) => K(W(e)));
|
|
1450
1450
|
return [
|
|
1451
1451
|
c,
|
|
1452
1452
|
l,
|
|
1453
1453
|
u,
|
|
1454
|
-
|
|
1454
|
+
ft(r.alpha)
|
|
1455
1455
|
];
|
|
1456
1456
|
}
|
|
1457
|
-
function
|
|
1457
|
+
function _t(e) {
|
|
1458
1458
|
let t;
|
|
1459
1459
|
return t = e.endsWith("deg") ? Number(e.slice(0, -3)) : e.endsWith("grad") ? Number(e.slice(0, -4)) * .9 : e.endsWith("rad") ? Number(e.slice(0, -3)) * (180 / Math.PI) : e.endsWith("turn") ? Number(e.slice(0, -4)) * 360 : Number(e), Number.isFinite(t) ? (t % 360 + 360) % 360 : null;
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1461
|
+
function vt(e) {
|
|
1462
1462
|
if (e.endsWith("%")) {
|
|
1463
1463
|
let t = Number(e.slice(0, -1));
|
|
1464
|
-
return Number.isFinite(t) ?
|
|
1464
|
+
return Number.isFinite(t) ? K(t / 100) : null;
|
|
1465
1465
|
}
|
|
1466
1466
|
let t = Number(e);
|
|
1467
|
-
return Number.isFinite(t) ?
|
|
1467
|
+
return Number.isFinite(t) ? K(t) : null;
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1469
|
+
function K(e) {
|
|
1470
1470
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
1471
1471
|
}
|
|
1472
|
-
var
|
|
1472
|
+
var yt = (() => {
|
|
1473
1473
|
let e = {
|
|
1474
1474
|
aliceblue: 15792383,
|
|
1475
1475
|
antiquewhite: 16444375,
|
|
@@ -1636,29 +1636,29 @@ var bt = (() => {
|
|
|
1636
1636
|
}
|
|
1637
1637
|
return t;
|
|
1638
1638
|
})();
|
|
1639
|
-
function
|
|
1640
|
-
return .2126 *
|
|
1639
|
+
function bt(e, t, n) {
|
|
1640
|
+
return .2126 * U(e) + .7152 * U(t) + .0722 * U(n);
|
|
1641
1641
|
}
|
|
1642
|
-
function
|
|
1642
|
+
function xt(e, t) {
|
|
1643
1643
|
return (Math.max(e, t) + .05) / (Math.min(e, t) + .05);
|
|
1644
1644
|
}
|
|
1645
|
-
function
|
|
1645
|
+
function St(e, t) {
|
|
1646
1646
|
if (!Number.isInteger(t) || t < 0) return;
|
|
1647
1647
|
let n = 0;
|
|
1648
1648
|
for (let r of e) if (n++ === t) return r;
|
|
1649
1649
|
}
|
|
1650
|
-
var
|
|
1651
|
-
function
|
|
1650
|
+
var Ct = (e, t) => `${t}:${e}`;
|
|
1651
|
+
function wt(e, t) {
|
|
1652
1652
|
let n = /* @__PURE__ */ new Map();
|
|
1653
1653
|
for (let t of e.entries) n.has(t.name) || n.set(t.name, t);
|
|
1654
1654
|
let r = (e) => ({ resolve: (t) => i(t, e) }), i = (e, a) => {
|
|
1655
1655
|
if (e == null) return null;
|
|
1656
1656
|
if (typeof e == "function") return i(e(r(a)), a);
|
|
1657
1657
|
if ("space" in e) return e;
|
|
1658
|
-
let o = e.index ?? 0, s =
|
|
1658
|
+
let o = e.index ?? 0, s = Ct(e.ref, o);
|
|
1659
1659
|
if (a.has(s)) return null;
|
|
1660
1660
|
let c = new Set(a).add(s), l = n.get(e.ref);
|
|
1661
|
-
return l ? "color" in l ? o === 0 ? i(l.color, c) : null : i(
|
|
1661
|
+
return l ? "color" in l ? o === 0 ? i(l.color, c) : null : i(St(l.colors(r(c)), o), c) : i(t?.(e), c);
|
|
1662
1662
|
};
|
|
1663
1663
|
return {
|
|
1664
1664
|
byName: n,
|
|
@@ -1666,11 +1666,11 @@ function Tt(e, t) {
|
|
|
1666
1666
|
visit: i
|
|
1667
1667
|
};
|
|
1668
1668
|
}
|
|
1669
|
-
function
|
|
1670
|
-
return
|
|
1669
|
+
function Tt(e, t, n) {
|
|
1670
|
+
return wt(e, n).visit(t, /* @__PURE__ */ new Set());
|
|
1671
1671
|
}
|
|
1672
|
-
var
|
|
1673
|
-
function
|
|
1672
|
+
var Et = (e) => Math.max(0, Math.min(255, Math.round(e))).toString(16).padStart(2, "0");
|
|
1673
|
+
function Dt(e) {
|
|
1674
1674
|
let [t, n, r] = e.coords;
|
|
1675
1675
|
if (r === void 0) return null;
|
|
1676
1676
|
let i;
|
|
@@ -1683,25 +1683,25 @@ function Ot(e) {
|
|
|
1683
1683
|
];
|
|
1684
1684
|
break;
|
|
1685
1685
|
case "oklab":
|
|
1686
|
-
i =
|
|
1686
|
+
i = Ve(t, n, r);
|
|
1687
1687
|
break;
|
|
1688
1688
|
case "oklch":
|
|
1689
|
-
i =
|
|
1689
|
+
i = Ve(...Ue(t, n, r * Math.PI / 180));
|
|
1690
1690
|
break;
|
|
1691
1691
|
default: return null;
|
|
1692
1692
|
}
|
|
1693
1693
|
let a = e.alpha ?? 1;
|
|
1694
|
-
return `#${i.map(
|
|
1694
|
+
return `#${i.map(Et).join("")}${a < 1 ? Et(a * 255) : ""}`;
|
|
1695
1695
|
}
|
|
1696
|
-
function
|
|
1696
|
+
function Ot(e) {
|
|
1697
1697
|
if (e.coords.length < 3) return null;
|
|
1698
|
-
let t =
|
|
1698
|
+
let t = Dt(e);
|
|
1699
1699
|
if (t) return t;
|
|
1700
1700
|
let n = e.alpha ?? 1;
|
|
1701
1701
|
return `color(${e.space} ${e.coords.join(" ")}${n < 1 ? ` / ${n}` : ""})`;
|
|
1702
1702
|
}
|
|
1703
|
-
function
|
|
1704
|
-
let [t, n, r, i] =
|
|
1703
|
+
function kt(e) {
|
|
1704
|
+
let [t, n, r, i] = it(e), a = [
|
|
1705
1705
|
t,
|
|
1706
1706
|
n,
|
|
1707
1707
|
r
|
|
@@ -1717,43 +1717,43 @@ function At(e) {
|
|
|
1717
1717
|
}
|
|
1718
1718
|
//#endregion
|
|
1719
1719
|
//#region node_modules/@weasel-js/theme/dist/chunk-44CG54ZK.js
|
|
1720
|
-
var
|
|
1721
|
-
function
|
|
1722
|
-
return q(
|
|
1720
|
+
var At = Ne, q = Ge, J = Ke;
|
|
1721
|
+
function Y(e, t) {
|
|
1722
|
+
return J(q(e, .5, t)).C;
|
|
1723
1723
|
}
|
|
1724
|
-
function
|
|
1725
|
-
let [t, n, r] =
|
|
1726
|
-
return
|
|
1724
|
+
function jt(e) {
|
|
1725
|
+
let [t, n, r] = At(e);
|
|
1726
|
+
return bt(t / 255, n / 255, r / 255);
|
|
1727
1727
|
}
|
|
1728
|
-
function
|
|
1729
|
-
return
|
|
1728
|
+
function Mt(e, t) {
|
|
1729
|
+
return xt(jt(e), jt(t));
|
|
1730
1730
|
}
|
|
1731
|
-
function
|
|
1731
|
+
function Nt(e, t) {
|
|
1732
1732
|
let n = Math.abs(e - t) % 360;
|
|
1733
1733
|
return Math.min(n, 360 - n);
|
|
1734
1734
|
}
|
|
1735
|
-
function
|
|
1736
|
-
let [t, n, r] =
|
|
1737
|
-
return
|
|
1735
|
+
function Pt(e) {
|
|
1736
|
+
let [t, n, r] = At(e);
|
|
1737
|
+
return Ie(t, n, r);
|
|
1738
1738
|
}
|
|
1739
|
-
function
|
|
1740
|
-
let [n, r, i] =
|
|
1739
|
+
function Ft(e, t) {
|
|
1740
|
+
let [n, r, i] = Pt(e), [a, o, s] = Pt(t);
|
|
1741
1741
|
return Math.hypot(n - a, 3 * (r - o), 3 * (i - s));
|
|
1742
1742
|
}
|
|
1743
|
-
function
|
|
1743
|
+
function It(e) {
|
|
1744
1744
|
let t = .5, n = -1;
|
|
1745
1745
|
for (let r = .32; r <= .96; r += .01) {
|
|
1746
|
-
let i =
|
|
1746
|
+
let i = Y(r, e);
|
|
1747
1747
|
i > n && (n = i, t = r);
|
|
1748
1748
|
}
|
|
1749
1749
|
return t;
|
|
1750
1750
|
}
|
|
1751
|
-
var
|
|
1752
|
-
function
|
|
1753
|
-
let n =
|
|
1754
|
-
return
|
|
1751
|
+
var Lt = Array(360), Rt = (e) => (Math.round(e) % 360 + 360) % 360, zt = (e) => Lt[Rt(e)] ??= It(Rt(e));
|
|
1752
|
+
function Bt(e, t) {
|
|
1753
|
+
let n = zt(e) + (t.lightnessTarget - zt(e)) * t.lightnessPull;
|
|
1754
|
+
return q(n, Y(n, e) * t.chromaFraction, e);
|
|
1755
1755
|
}
|
|
1756
|
-
var
|
|
1756
|
+
var Vt = [
|
|
1757
1757
|
[15, "rose"],
|
|
1758
1758
|
[45, "red"],
|
|
1759
1759
|
[62, "orange"],
|
|
@@ -1769,57 +1769,57 @@ var Ht = [
|
|
|
1769
1769
|
[310, "violet"],
|
|
1770
1770
|
[345, "fuchsia"]
|
|
1771
1771
|
];
|
|
1772
|
-
function
|
|
1773
|
-
for (let [t, n] of
|
|
1772
|
+
function Ht(e) {
|
|
1773
|
+
for (let [t, n] of Vt) if (e < t) return n;
|
|
1774
1774
|
return "rose";
|
|
1775
1775
|
}
|
|
1776
|
-
function
|
|
1776
|
+
function Ut(e) {
|
|
1777
1777
|
let t = /* @__PURE__ */ new Map();
|
|
1778
1778
|
return e.map((e) => {
|
|
1779
|
-
let n =
|
|
1779
|
+
let n = Ht(e), r = (t.get(n) ?? 0) + 1;
|
|
1780
1780
|
return t.set(n, r), r === 1 ? n : `${n}-${r}`;
|
|
1781
1781
|
});
|
|
1782
1782
|
}
|
|
1783
|
-
function
|
|
1783
|
+
function Wt(e, t, n) {
|
|
1784
1784
|
if (t <= 0) return e;
|
|
1785
|
-
let r = e.map(
|
|
1785
|
+
let r = e.map(J), i = r.reduce((e, t) => e + t.C, 0) / r.length;
|
|
1786
1786
|
return r.map((e, r) => {
|
|
1787
1787
|
let a = e.C + (i - e.C) * t;
|
|
1788
|
-
if (n[r]) return
|
|
1789
|
-
if (
|
|
1788
|
+
if (n[r]) return q(e.L, Math.min(a, Y(e.L, e.H)), e.H);
|
|
1789
|
+
if (Y(e.L, e.H) >= a) return q(e.L, a, e.H);
|
|
1790
1790
|
let o = e.L, s = Infinity;
|
|
1791
|
-
for (let t = .3; t <= .96; t += .005) if (
|
|
1791
|
+
for (let t = .3; t <= .96; t += .005) if (Y(t, e.H) >= a) {
|
|
1792
1792
|
let n = Math.abs(t - e.L);
|
|
1793
1793
|
n < s && (s = n, o = t);
|
|
1794
1794
|
}
|
|
1795
1795
|
if (s === Infinity) {
|
|
1796
|
-
let t =
|
|
1797
|
-
return
|
|
1796
|
+
let t = zt(e.H);
|
|
1797
|
+
return q(t, Y(t, e.H), e.H);
|
|
1798
1798
|
}
|
|
1799
|
-
return
|
|
1799
|
+
return q(o, a, e.H);
|
|
1800
1800
|
});
|
|
1801
1801
|
}
|
|
1802
|
-
function
|
|
1802
|
+
function Gt(e) {
|
|
1803
1803
|
let t = [0];
|
|
1804
1804
|
for (; t.length < e.length;) {
|
|
1805
1805
|
let n = -1, r = -1;
|
|
1806
1806
|
for (let i = 0; i < e.length; i += 1) {
|
|
1807
1807
|
if (t.includes(i)) continue;
|
|
1808
|
-
let a = Math.min(...t.map((t) =>
|
|
1808
|
+
let a = Math.min(...t.map((t) => Nt(e[i], e[t])));
|
|
1809
1809
|
a > r && (r = a, n = i);
|
|
1810
1810
|
}
|
|
1811
1811
|
t.push(n);
|
|
1812
1812
|
}
|
|
1813
1813
|
return t;
|
|
1814
1814
|
}
|
|
1815
|
-
function
|
|
1815
|
+
function Kt(e) {
|
|
1816
1816
|
return e.hueFloor <= 0 ? 0 : e.hueFloor * 360 / Math.max(1, e.count);
|
|
1817
1817
|
}
|
|
1818
|
-
function
|
|
1819
|
-
let t =
|
|
1818
|
+
function qt(e) {
|
|
1819
|
+
let t = Kt(e), n = e.anchors.map((e) => e.hue), r = e.anchors.map(Qt), i = e.count - e.anchors.length;
|
|
1820
1820
|
if (i < 0) return null;
|
|
1821
1821
|
let a = (e) => {
|
|
1822
|
-
let [t, n, r] =
|
|
1822
|
+
let [t, n, r] = Pt(e);
|
|
1823
1823
|
return [
|
|
1824
1824
|
t,
|
|
1825
1825
|
3 * n,
|
|
@@ -1828,31 +1828,31 @@ function Jt(e) {
|
|
|
1828
1828
|
}, o = (e, t) => Math.hypot(e[0] - t[0], e[1] - t[1], e[2] - t[2]), s = /* @__PURE__ */ new Map(), c = (t) => {
|
|
1829
1829
|
let n = (Math.round(t) % 360 + 360) % 360, r = s.get(n);
|
|
1830
1830
|
if (!r) {
|
|
1831
|
-
let t =
|
|
1831
|
+
let t = Bt(n, e), i = J(t);
|
|
1832
1832
|
r = {
|
|
1833
1833
|
hex: t,
|
|
1834
1834
|
hue: i.H,
|
|
1835
|
-
contrast:
|
|
1835
|
+
contrast: Mt(t, e.surface),
|
|
1836
1836
|
chroma: i.C,
|
|
1837
|
-
surfaceDistance:
|
|
1837
|
+
surfaceDistance: Ft(t, e.surface),
|
|
1838
1838
|
lab: a(t)
|
|
1839
1839
|
}, s.set(n, r);
|
|
1840
1840
|
}
|
|
1841
1841
|
return r;
|
|
1842
1842
|
}, l = r.map((t) => {
|
|
1843
|
-
let n =
|
|
1843
|
+
let n = J(t);
|
|
1844
1844
|
return {
|
|
1845
1845
|
hex: t,
|
|
1846
1846
|
hue: n.H,
|
|
1847
|
-
contrast:
|
|
1847
|
+
contrast: Mt(t, e.surface),
|
|
1848
1848
|
chroma: n.C,
|
|
1849
|
-
surfaceDistance:
|
|
1849
|
+
surfaceDistance: Ft(t, e.surface),
|
|
1850
1850
|
lab: a(t)
|
|
1851
1851
|
};
|
|
1852
1852
|
}), u = (e) => [...l, ...e.map(c)], d = (n) => {
|
|
1853
1853
|
let r = u(n), i = 0;
|
|
1854
1854
|
if (t > 0) for (let e = 0; e < r.length; e += 1) for (let n = e + 1; n < r.length; n += 1) {
|
|
1855
|
-
let a = t -
|
|
1855
|
+
let a = t - Nt(r[e].hue, r[n].hue);
|
|
1856
1856
|
a > 0 && (i += a);
|
|
1857
1857
|
}
|
|
1858
1858
|
if (e.minContrast > 0) for (let t of r) {
|
|
@@ -1902,7 +1902,7 @@ function Jt(e) {
|
|
|
1902
1902
|
}
|
|
1903
1903
|
for (let s = 0; s < n.length; s += 1) if (s !== r) {
|
|
1904
1904
|
if (t > 0) {
|
|
1905
|
-
let e = t -
|
|
1905
|
+
let e = t - Nt(a.hue, n[s].hue);
|
|
1906
1906
|
e > 0 && (i += e);
|
|
1907
1907
|
}
|
|
1908
1908
|
if (e.minDistance > 0) {
|
|
@@ -1943,41 +1943,41 @@ function Jt(e) {
|
|
|
1943
1943
|
}
|
|
1944
1944
|
return v;
|
|
1945
1945
|
}
|
|
1946
|
-
function
|
|
1946
|
+
function Jt(e) {
|
|
1947
1947
|
if (e.length < 2) return 1;
|
|
1948
1948
|
let t = Infinity;
|
|
1949
|
-
for (let n = 0; n < e.length; n += 1) for (let r = n + 1; r < e.length; r += 1) t = Math.min(t,
|
|
1949
|
+
for (let n = 0; n < e.length; n += 1) for (let r = n + 1; r < e.length; r += 1) t = Math.min(t, Ft(e[n], e[r]));
|
|
1950
1950
|
return t;
|
|
1951
1951
|
}
|
|
1952
|
-
function
|
|
1952
|
+
function Yt(e, t) {
|
|
1953
1953
|
let n = e.map((e) => e.lch.C), r = e.map((e) => e.lch.L), i = 360;
|
|
1954
|
-
for (let t = 0; t < e.length; t += 1) for (let n = t + 1; n < e.length; n += 1) i = Math.min(i,
|
|
1954
|
+
for (let t = 0; t < e.length; t += 1) for (let n = t + 1; n < e.length; n += 1) i = Math.min(i, Nt(e[t].lch.H, e[n].lch.H));
|
|
1955
1955
|
return {
|
|
1956
1956
|
meanChroma: n.reduce((e, t) => e + t, 0) / (n.length || 1),
|
|
1957
1957
|
chromaSpread: Math.max(...n) - Math.min(...n),
|
|
1958
1958
|
lightnessSpread: Math.max(...r) - Math.min(...r),
|
|
1959
1959
|
minHueGap: e.length > 1 ? i : 360,
|
|
1960
1960
|
hueFloorShare: e.length > 1 ? i * e.length / 360 : 1,
|
|
1961
|
-
minContrast: Math.min(...e.map((e) =>
|
|
1962
|
-
minSurfaceDistance: Math.min(...e.map((e) =>
|
|
1963
|
-
minDistance:
|
|
1961
|
+
minContrast: Math.min(...e.map((e) => Mt(e.hex, t))),
|
|
1962
|
+
minSurfaceDistance: Math.min(...e.map((e) => Ft(e.hex, t))),
|
|
1963
|
+
minDistance: Jt(e.map((e) => e.hex))
|
|
1964
1964
|
};
|
|
1965
1965
|
}
|
|
1966
|
-
function
|
|
1967
|
-
let t =
|
|
1966
|
+
function Xt(e) {
|
|
1967
|
+
let t = qt(e), n = t !== null, r = t ?? Array.from({ length: Math.max(0, e.count - e.anchors.length) }, (t, n) => Math.round(n * 360 / Math.max(1, e.count - e.anchors.length))), i = [...e.anchors.map((e) => e.hue), ...r], a = [...e.anchors.map(() => !0), ...r.map(() => !1)], o = Wt([...e.anchors.map(Qt), ...r.map((t) => Bt(t, e))], e.equalize, a), s = e.order === "farthest" ? Gt(i) : [...i.keys()].sort((e, t) => i[e] - i[t]), c = Ut(s.map((e) => J(o[e]).H)), l = s.map((t, n) => ({
|
|
1968
1968
|
name: e.anchors[t]?.name ?? c[n],
|
|
1969
1969
|
hex: o[t],
|
|
1970
|
-
lch:
|
|
1970
|
+
lch: J(o[t]),
|
|
1971
1971
|
anchored: a[t],
|
|
1972
|
-
contrast:
|
|
1972
|
+
contrast: Mt(o[t], e.surface)
|
|
1973
1973
|
}));
|
|
1974
1974
|
return {
|
|
1975
1975
|
swatches: l,
|
|
1976
|
-
stats:
|
|
1976
|
+
stats: Yt(l, e.surface),
|
|
1977
1977
|
feasible: n
|
|
1978
1978
|
};
|
|
1979
1979
|
}
|
|
1980
|
-
var
|
|
1980
|
+
var Zt = {
|
|
1981
1981
|
count: 10,
|
|
1982
1982
|
hueFloor: .9,
|
|
1983
1983
|
minContrast: 4,
|
|
@@ -1991,15 +1991,15 @@ var Qt = {
|
|
|
1991
1991
|
anchors: [],
|
|
1992
1992
|
order: "farthest"
|
|
1993
1993
|
};
|
|
1994
|
-
function
|
|
1995
|
-
let t =
|
|
1996
|
-
return
|
|
1994
|
+
function Qt(e) {
|
|
1995
|
+
let t = Y(e.lightness, e.hue);
|
|
1996
|
+
return q(e.lightness, e.chroma === void 0 ? t : Math.min(e.chroma, t), e.hue);
|
|
1997
1997
|
}
|
|
1998
1998
|
//#endregion
|
|
1999
1999
|
//#region node_modules/@weasel-js/theme/dist/chunk-M3R5MV7Q.js
|
|
2000
|
-
var
|
|
2001
|
-
function
|
|
2002
|
-
let t =
|
|
2000
|
+
var $t = /^(-?(?:\d+\.?\d*|\.\d+))([a-z%]*)$/i;
|
|
2001
|
+
function en(e) {
|
|
2002
|
+
let t = $t.exec(e.trim());
|
|
2003
2003
|
return t ? {
|
|
2004
2004
|
value: Number(t[1]),
|
|
2005
2005
|
unit: t[2]
|
|
@@ -2007,7 +2007,7 @@ function tn(e) {
|
|
|
2007
2007
|
}
|
|
2008
2008
|
//#endregion
|
|
2009
2009
|
//#region node_modules/@weasel-js/registry/dist/index.js
|
|
2010
|
-
function
|
|
2010
|
+
function tn() {
|
|
2011
2011
|
let e = /* @__PURE__ */ new Set(), t = null;
|
|
2012
2012
|
return {
|
|
2013
2013
|
subscribe(n) {
|
|
@@ -2029,25 +2029,25 @@ function nn() {
|
|
|
2029
2029
|
}
|
|
2030
2030
|
};
|
|
2031
2031
|
}
|
|
2032
|
-
function
|
|
2032
|
+
function nn() {
|
|
2033
2033
|
try {
|
|
2034
2034
|
return process.env.NODE_ENV !== "production";
|
|
2035
2035
|
} catch {
|
|
2036
2036
|
return !0;
|
|
2037
2037
|
}
|
|
2038
2038
|
}
|
|
2039
|
-
function
|
|
2039
|
+
function rn(e) {
|
|
2040
2040
|
return e === Object.prototype || e === null || Object.getPrototypeOf(e) === null;
|
|
2041
2041
|
}
|
|
2042
|
-
function
|
|
2043
|
-
return typeof e == "object" && !!e &&
|
|
2042
|
+
function an(e) {
|
|
2043
|
+
return typeof e == "object" && !!e && rn(Object.getPrototypeOf(e));
|
|
2044
2044
|
}
|
|
2045
2045
|
//#endregion
|
|
2046
2046
|
//#region node_modules/@weasel-js/theme/dist/chunk-P5F3GZV6.js
|
|
2047
|
-
function
|
|
2048
|
-
return
|
|
2047
|
+
function on(e) {
|
|
2048
|
+
return an(e) && typeof e.by == "string";
|
|
2049
2049
|
}
|
|
2050
|
-
function
|
|
2050
|
+
function X(e, t = {}) {
|
|
2051
2051
|
let n = {};
|
|
2052
2052
|
for (let [r, i] of Object.entries(e)) {
|
|
2053
2053
|
let e = t[r];
|
|
@@ -2055,7 +2055,7 @@ function Y(e, t = {}) {
|
|
|
2055
2055
|
}
|
|
2056
2056
|
return n;
|
|
2057
2057
|
}
|
|
2058
|
-
function
|
|
2058
|
+
function sn(e, t) {
|
|
2059
2059
|
let n = { ...e };
|
|
2060
2060
|
for (let [r, i] of Object.entries(t)) n[r] = {
|
|
2061
2061
|
...i,
|
|
@@ -2066,13 +2066,13 @@ function cn(e, t) {
|
|
|
2066
2066
|
};
|
|
2067
2067
|
return n;
|
|
2068
2068
|
}
|
|
2069
|
-
function
|
|
2070
|
-
let n =
|
|
2069
|
+
function cn(e, t) {
|
|
2070
|
+
let n = X(e, t);
|
|
2071
2071
|
return Object.keys(e).map((e) => `${e}=${n[e]}`).join(",");
|
|
2072
2072
|
}
|
|
2073
|
-
function
|
|
2073
|
+
function ln(e, t) {
|
|
2074
2074
|
let n = e;
|
|
2075
|
-
for (;
|
|
2075
|
+
for (; on(n);) {
|
|
2076
2076
|
let e = n.by, r = t[e];
|
|
2077
2077
|
if (r === void 0 || r === "by" || !(r in n)) return {
|
|
2078
2078
|
ok: !1,
|
|
@@ -2088,51 +2088,51 @@ function un(e, t) {
|
|
|
2088
2088
|
}
|
|
2089
2089
|
//#endregion
|
|
2090
2090
|
//#region node_modules/@weasel-js/theme/dist/chunk-OP5VYXEZ.js
|
|
2091
|
-
function
|
|
2091
|
+
function un(e) {
|
|
2092
2092
|
return e.map((e) => typeof e == "string" && /\s/.test(e) ? `'${e}'` : String(e)).join(", ");
|
|
2093
2093
|
}
|
|
2094
|
-
function
|
|
2095
|
-
return Array.isArray(t) ? e === "cubicBezier" ? `cubic-bezier(${t.join(", ")})` : e === "fontFamily" ?
|
|
2094
|
+
function dn(e, t) {
|
|
2095
|
+
return Array.isArray(t) ? e === "cubicBezier" ? `cubic-bezier(${t.join(", ")})` : e === "fontFamily" ? un(t) : t.join(", ") : String(t);
|
|
2096
2096
|
}
|
|
2097
|
-
function
|
|
2097
|
+
function fn(e, t) {
|
|
2098
2098
|
let n = {};
|
|
2099
|
-
return e.map((e) => (n =
|
|
2099
|
+
return e.map((e) => (n = sn(n, e.axes), {
|
|
2100
2100
|
...t,
|
|
2101
|
-
...
|
|
2101
|
+
...X(n, t)
|
|
2102
2102
|
}));
|
|
2103
2103
|
}
|
|
2104
|
-
function
|
|
2105
|
-
let n =
|
|
2104
|
+
function pn(e, t) {
|
|
2105
|
+
let n = fn(e, t), r = {};
|
|
2106
2106
|
return e.forEach((e, t) => {
|
|
2107
2107
|
for (let [i, a] of Object.entries(e.tokens)) {
|
|
2108
|
-
let e =
|
|
2108
|
+
let e = ln(a, n[t]);
|
|
2109
2109
|
e.ok && (r[i] = e.value);
|
|
2110
2110
|
}
|
|
2111
2111
|
}), r;
|
|
2112
2112
|
}
|
|
2113
|
-
function
|
|
2114
|
-
let n =
|
|
2115
|
-
if (!n) return
|
|
2113
|
+
function mn(e, t) {
|
|
2114
|
+
let n = vn(e.trim());
|
|
2115
|
+
if (!n) return hn(e.trim(), t);
|
|
2116
2116
|
let [r, i, a, o] = n;
|
|
2117
|
-
return `rgba(${r}, ${i}, ${a}, ${
|
|
2117
|
+
return `rgba(${r}, ${i}, ${a}, ${_n(o * t, 3)})`;
|
|
2118
2118
|
}
|
|
2119
|
-
function
|
|
2120
|
-
return `color-mix(in srgb, ${e} ${
|
|
2119
|
+
function hn(e, t) {
|
|
2120
|
+
return `color-mix(in srgb, ${e} ${_n(t * 100, 4)}%, transparent)`;
|
|
2121
2121
|
}
|
|
2122
|
-
function
|
|
2123
|
-
let n =
|
|
2122
|
+
function gn(e, t) {
|
|
2123
|
+
let n = vn(e.trim());
|
|
2124
2124
|
if (!n) return `rgb(from ${e.trim()} r g b / ${t})`;
|
|
2125
2125
|
let [r, i, a] = n;
|
|
2126
|
-
return `rgba(${r}, ${i}, ${a}, ${
|
|
2126
|
+
return `rgba(${r}, ${i}, ${a}, ${_n(t, 3)})`;
|
|
2127
2127
|
}
|
|
2128
|
-
function
|
|
2128
|
+
function _n(e, t) {
|
|
2129
2129
|
return Number(e.toFixed(t));
|
|
2130
2130
|
}
|
|
2131
|
-
function
|
|
2131
|
+
function vn(e) {
|
|
2132
2132
|
if (!/^(?:#|rgba?\(|transparent$)/i.test(e)) return null;
|
|
2133
2133
|
let t;
|
|
2134
2134
|
try {
|
|
2135
|
-
t =
|
|
2135
|
+
t = it(e);
|
|
2136
2136
|
} catch {
|
|
2137
2137
|
return null;
|
|
2138
2138
|
}
|
|
@@ -2143,15 +2143,15 @@ function yn(e) {
|
|
|
2143
2143
|
t[3]
|
|
2144
2144
|
];
|
|
2145
2145
|
}
|
|
2146
|
-
var
|
|
2147
|
-
function
|
|
2146
|
+
var yn = /^\{([^}]+)\}$/;
|
|
2147
|
+
function bn(e) {
|
|
2148
2148
|
if (typeof e != "string") return null;
|
|
2149
|
-
let t =
|
|
2149
|
+
let t = yn.exec(e.trim());
|
|
2150
2150
|
if (!t) return null;
|
|
2151
2151
|
let n = t[1], r = n.indexOf(".");
|
|
2152
2152
|
return r === -1 ? n : n.slice(r + 1);
|
|
2153
2153
|
}
|
|
2154
|
-
function
|
|
2154
|
+
function xn(e) {
|
|
2155
2155
|
let t = {}, n = /* @__PURE__ */ new Set(), r = (i) => {
|
|
2156
2156
|
let a = t[i];
|
|
2157
2157
|
if (a !== void 0) return a;
|
|
@@ -2159,26 +2159,26 @@ function Sn(e) {
|
|
|
2159
2159
|
if (!o) throw Error(`Unknown token "${i}"`);
|
|
2160
2160
|
if (n.has(i)) throw Error(`Reference cycle at token "${i}" (${[...n].join(" → ")})`);
|
|
2161
2161
|
n.add(i);
|
|
2162
|
-
let s =
|
|
2163
|
-
if (s === null) c =
|
|
2162
|
+
let s = bn(o.value), c;
|
|
2163
|
+
if (s === null) c = dn(o.type, o.value);
|
|
2164
2164
|
else if (e[s]) c = r(s);
|
|
2165
2165
|
else throw Error(`Token "${i}" references "${s}", which is not defined`);
|
|
2166
|
-
return o.alpha !== void 0 && (c =
|
|
2166
|
+
return o.alpha !== void 0 && (c = mn(c, o.alpha)), n.delete(i), t[i] = c, c;
|
|
2167
2167
|
};
|
|
2168
2168
|
for (let t of Object.keys(e)) r(t);
|
|
2169
2169
|
return t;
|
|
2170
2170
|
}
|
|
2171
|
-
function
|
|
2171
|
+
function Sn(e) {
|
|
2172
2172
|
let t = [];
|
|
2173
2173
|
for (let n = e; n; n = n.extends) t.unshift(n);
|
|
2174
2174
|
return t;
|
|
2175
2175
|
}
|
|
2176
|
-
function
|
|
2177
|
-
return
|
|
2176
|
+
function Cn(e) {
|
|
2177
|
+
return Sn(e).reduce((e, t) => sn(e, t.axes), {});
|
|
2178
2178
|
}
|
|
2179
2179
|
function wn(e, t = {}) {
|
|
2180
|
-
let n =
|
|
2181
|
-
for (let [t, i] of Object.entries(
|
|
2180
|
+
let n = X(Cn(e), t), r = {};
|
|
2181
|
+
for (let [t, i] of Object.entries(xn(pn(Sn(e), n)))) r[`--wzl-${t}`] = i;
|
|
2182
2182
|
return r;
|
|
2183
2183
|
}
|
|
2184
2184
|
//#endregion
|
|
@@ -3478,7 +3478,7 @@ var Tn = { weasel: {
|
|
|
3478
3478
|
function Dn(e) {
|
|
3479
3479
|
let t = 0, n = 0, r;
|
|
3480
3480
|
for (let { css: i, weight: a } of e) {
|
|
3481
|
-
let e =
|
|
3481
|
+
let e = en(i);
|
|
3482
3482
|
if (!e || r !== void 0 && e.unit !== r) return;
|
|
3483
3483
|
r = e.unit, t += e.value * a, n += a;
|
|
3484
3484
|
}
|
|
@@ -3489,7 +3489,7 @@ function On(e) {
|
|
|
3489
3489
|
for (let { css: r, weight: i } of e) {
|
|
3490
3490
|
let e;
|
|
3491
3491
|
try {
|
|
3492
|
-
e =
|
|
3492
|
+
e = it(r);
|
|
3493
3493
|
} catch {
|
|
3494
3494
|
return;
|
|
3495
3495
|
}
|
|
@@ -3497,7 +3497,7 @@ function On(e) {
|
|
|
3497
3497
|
t = [...e];
|
|
3498
3498
|
continue;
|
|
3499
3499
|
}
|
|
3500
|
-
let a = i / n, [o, s, c] =
|
|
3500
|
+
let a = i / n, [o, s, c] = rt([
|
|
3501
3501
|
t[0],
|
|
3502
3502
|
t[1],
|
|
3503
3503
|
t[2]
|
|
@@ -3513,14 +3513,14 @@ function On(e) {
|
|
|
3513
3513
|
t[3] + (e[3] - t[3]) * a
|
|
3514
3514
|
];
|
|
3515
3515
|
}
|
|
3516
|
-
return
|
|
3516
|
+
return ct(t);
|
|
3517
3517
|
}
|
|
3518
3518
|
function kn(e) {
|
|
3519
3519
|
return e.every((t) => t.css === e[0].css) ? e[0].css : Dn(e) ?? On(e) ?? En(e);
|
|
3520
3520
|
}
|
|
3521
3521
|
function An(e, t, n = {}) {
|
|
3522
|
-
let r =
|
|
3523
|
-
selection:
|
|
3522
|
+
let r = Cn(e), i = [{
|
|
3523
|
+
selection: X(r, n),
|
|
3524
3524
|
weight: 1
|
|
3525
3525
|
}];
|
|
3526
3526
|
for (let [e, n] of Object.entries(t)) {
|
|
@@ -3591,7 +3591,7 @@ function Ln(e, t, n) {
|
|
|
3591
3591
|
var Rn = /* @__PURE__ */ new WeakMap();
|
|
3592
3592
|
function zn(e, t, n = {}, r = {}) {
|
|
3593
3593
|
if (typeof document > "u") return () => {};
|
|
3594
|
-
let i =
|
|
3594
|
+
let i = Cn(t), a = X(i, n), o = Object.entries(r.weights ? An(t, r.weights, a) : wn(t, a)).map(([e, t]) => `${e}: ${t};`).join(" "), s = Object.keys(i), c = `[data-wzl-theme='${t.name}']${s.map((e) => `[data-wzl-${e}='${a[e]}']`).join("")}`, { variant: l, release: u } = Ln(Nn(e), c, o);
|
|
3595
3595
|
Rn.get(e)?.(), e.setAttribute("data-wzl-theme", t.name);
|
|
3596
3596
|
for (let t of s) e.setAttribute(`data-wzl-${t}`, a[t]);
|
|
3597
3597
|
l === 0 ? e.removeAttribute("data-wzl-variant") : e.setAttribute("data-wzl-variant", String(l));
|
|
@@ -3615,23 +3615,23 @@ function Wn(e, t) {
|
|
|
3615
3615
|
if (!/currentcolor/i.test(n)) return e;
|
|
3616
3616
|
if (/^currentcolor$/i.test(n)) return t;
|
|
3617
3617
|
let r = Vn.exec(n);
|
|
3618
|
-
if (r) return
|
|
3618
|
+
if (r) return gn(t, Un(r[1], r[2]));
|
|
3619
3619
|
let i = Hn.exec(n);
|
|
3620
|
-
if (i && i[2] === "%") return
|
|
3620
|
+
if (i && i[2] === "%") return mn(t, Un(i[1], i[2]));
|
|
3621
3621
|
throw Error(`resolveCurrentColor: cannot flatten "${e}"`);
|
|
3622
3622
|
}
|
|
3623
3623
|
var Gn = (e, t) => (Math.trunc(e) % t + t) % t, Kn = /* @__PURE__ */ new Map();
|
|
3624
3624
|
function qn({ generate: e }) {
|
|
3625
3625
|
let t = JSON.stringify([e.count, e.gates ?? {}]), n = Kn.get(t);
|
|
3626
|
-
return n || (n =
|
|
3627
|
-
...
|
|
3626
|
+
return n || (n = Xt({
|
|
3627
|
+
...Zt,
|
|
3628
3628
|
...e.gates,
|
|
3629
3629
|
count: e.count,
|
|
3630
3630
|
anchors: []
|
|
3631
3631
|
}).swatches.map((e) => e.hex.toLowerCase()), Kn.set(t, n)), n;
|
|
3632
3632
|
}
|
|
3633
3633
|
function Jn(e, t) {
|
|
3634
|
-
for (let n of
|
|
3634
|
+
for (let n of Sn(e).reverse()) {
|
|
3635
3635
|
let e = n.ramps?.[t];
|
|
3636
3636
|
if (e) return e;
|
|
3637
3637
|
}
|
|
@@ -3642,7 +3642,7 @@ function Yn(e, t) {
|
|
|
3642
3642
|
return n;
|
|
3643
3643
|
}
|
|
3644
3644
|
function Xn(e) {
|
|
3645
|
-
for (let t of
|
|
3645
|
+
for (let t of Sn(e).reverse()) if (t.tints) return t.tints;
|
|
3646
3646
|
return { ramp: "swatch" };
|
|
3647
3647
|
}
|
|
3648
3648
|
var Zn, Qn = () => Zn ??= {
|
|
@@ -3661,7 +3661,7 @@ function nr(e, t) {
|
|
|
3661
3661
|
var rr = { entries: [] }, ir = (e) => e.tints ?? Xn(e.theme);
|
|
3662
3662
|
function ar(e) {
|
|
3663
3663
|
try {
|
|
3664
|
-
return
|
|
3664
|
+
return kt(e);
|
|
3665
3665
|
} catch {
|
|
3666
3666
|
return null;
|
|
3667
3667
|
}
|
|
@@ -3694,11 +3694,11 @@ function ur(e, t) {
|
|
|
3694
3694
|
return n === null ? null : sr(n, t);
|
|
3695
3695
|
}
|
|
3696
3696
|
function dr(e, t = Qn()) {
|
|
3697
|
-
return
|
|
3697
|
+
return Tt(t.palette ?? rr, e, (e) => ur(e, t));
|
|
3698
3698
|
}
|
|
3699
3699
|
function fr(e, t) {
|
|
3700
3700
|
let n = dr(e, t);
|
|
3701
|
-
return n &&
|
|
3701
|
+
return n && Ot(n);
|
|
3702
3702
|
}
|
|
3703
3703
|
function pr(e, t) {
|
|
3704
3704
|
let n = ir(t), r = e.index ?? 0;
|
|
@@ -3768,7 +3768,7 @@ function Dr(e, t, n) {
|
|
|
3768
3768
|
}
|
|
3769
3769
|
var Or = (e, t) => e.size === t.size && [...e].every(([e, n]) => t.has(e) && Object.is(t.get(e), n));
|
|
3770
3770
|
function kr(e = {}, t = null) {
|
|
3771
|
-
let n = e, r = Dr(n, "", /* @__PURE__ */ new Map()), i =
|
|
3771
|
+
let n = e, r = Dr(n, "", /* @__PURE__ */ new Map()), i = tn(), a = () => i.emit(), o = null;
|
|
3772
3772
|
return {
|
|
3773
3773
|
get(e) {
|
|
3774
3774
|
let r = Er(n, e);
|
|
@@ -3796,12 +3796,12 @@ function jr(e) {
|
|
|
3796
3796
|
}
|
|
3797
3797
|
var Mr = i(null), Nr = { entries: [] };
|
|
3798
3798
|
function Pr({ theme: e = Z, selection: t, tints: n, palette: r = Nr, className: i, style: a, children: o }) {
|
|
3799
|
-
let s = m(null), c =
|
|
3799
|
+
let s = m(null), c = Cn(e), l = t?.mode === "auto" && !("auto" in (c.mode?.values ?? {})), u = jr(l ? "auto" : "dark"), p = l ? {
|
|
3800
3800
|
...t,
|
|
3801
3801
|
mode: u
|
|
3802
|
-
} : t, h =
|
|
3802
|
+
} : t, h = X(c, p);
|
|
3803
3803
|
Ir(e, c, p);
|
|
3804
|
-
let g =
|
|
3804
|
+
let g = cn(c, h), _ = f(() => ({
|
|
3805
3805
|
theme: e,
|
|
3806
3806
|
selection: h,
|
|
3807
3807
|
resolved: wn(e, h),
|
|
@@ -3831,7 +3831,7 @@ function Pr({ theme: e = Z, selection: t, tints: n, palette: r = Nr, className:
|
|
|
3831
3831
|
}
|
|
3832
3832
|
var Fr = /* @__PURE__ */ new Set();
|
|
3833
3833
|
function Ir(e, t, n) {
|
|
3834
|
-
if (n &&
|
|
3834
|
+
if (n && nn()) for (let [r, i] of Object.entries(n)) {
|
|
3835
3835
|
let n = t[r];
|
|
3836
3836
|
if (!n || i in n.values) continue;
|
|
3837
3837
|
let a = `${e.name}\0${r}\0${i}`;
|
|
@@ -3842,7 +3842,7 @@ var Lr;
|
|
|
3842
3842
|
function Rr() {
|
|
3843
3843
|
return s(Mr) || (Lr ??= {
|
|
3844
3844
|
theme: Z,
|
|
3845
|
-
selection:
|
|
3845
|
+
selection: X(Cn(Z)),
|
|
3846
3846
|
resolved: wn(Z),
|
|
3847
3847
|
tints: Xn(Z),
|
|
3848
3848
|
palette: Nr
|
|
@@ -4149,16 +4149,16 @@ function Ci(e, t, n, r, i) {
|
|
|
4149
4149
|
}));
|
|
4150
4150
|
}
|
|
4151
4151
|
var wi = a(function(e, t) {
|
|
4152
|
-
let n = zr(), { width: r, height: i, xRange: a = [0, 1], yRange: s = [0, 1], grid: l, axes: p, xTicks: g, yTicks: _, tabIndex: b, role: x = "img", className: S, style: C, onPointerDown: w, onContextMenu: T, onKeyDown:
|
|
4152
|
+
let n = zr(), { width: r, height: i, xRange: a = [0, 1], yRange: s = [0, 1], grid: l, axes: p, xTicks: g, yTicks: _, tabIndex: b, role: x = "img", className: S, style: C, onPointerDown: w, onContextMenu: T, onKeyDown: E, children: D } = e, O = m(null), k = f(() => ({
|
|
4153
4153
|
xMin: a[0],
|
|
4154
4154
|
xMax: a[1],
|
|
4155
4155
|
yMin: s[0],
|
|
4156
4156
|
yMax: s[1]
|
|
4157
|
-
}), [a, s]),
|
|
4157
|
+
}), [a, s]), A = f(() => ({
|
|
4158
4158
|
width: r,
|
|
4159
4159
|
height: i
|
|
4160
|
-
}), [r, i]),
|
|
4161
|
-
let t =
|
|
4160
|
+
}), [r, i]), j = o((e) => {
|
|
4161
|
+
let t = O.current?.getBoundingClientRect(), n = t?.left ?? 0, r = t?.top ?? 0;
|
|
4162
4162
|
return {
|
|
4163
4163
|
x: e.clientX - n,
|
|
4164
4164
|
y: e.clientY - r
|
|
@@ -4169,46 +4169,46 @@ var wi = a(function(e, t) {
|
|
|
4169
4169
|
height: i
|
|
4170
4170
|
}), () => Qr("plot2d", "unmount")), []), u(t, () => ({
|
|
4171
4171
|
get svg() {
|
|
4172
|
-
return
|
|
4172
|
+
return O.current;
|
|
4173
4173
|
},
|
|
4174
|
-
plotToModel: (e) => yi(e,
|
|
4175
|
-
modelToPlot: (e) => Q(e,
|
|
4176
|
-
clientToPlot:
|
|
4177
|
-
clientToModel: (e) => yi(
|
|
4174
|
+
plotToModel: (e) => yi(e, k, A),
|
|
4175
|
+
modelToPlot: (e) => Q(e, k, A),
|
|
4176
|
+
clientToPlot: j,
|
|
4177
|
+
clientToModel: (e) => yi(j(e), k, A),
|
|
4178
4178
|
get width() {
|
|
4179
|
-
return
|
|
4179
|
+
return A.width;
|
|
4180
4180
|
},
|
|
4181
4181
|
get height() {
|
|
4182
|
-
return
|
|
4182
|
+
return A.height;
|
|
4183
4183
|
}
|
|
4184
4184
|
}), [
|
|
4185
|
-
O,
|
|
4186
4185
|
k,
|
|
4187
|
-
A
|
|
4186
|
+
A,
|
|
4187
|
+
j
|
|
4188
4188
|
]);
|
|
4189
|
-
let
|
|
4190
|
-
let t =
|
|
4189
|
+
let M = o((e) => {
|
|
4190
|
+
let t = j(e);
|
|
4191
4191
|
return {
|
|
4192
4192
|
plot: t,
|
|
4193
|
-
model: yi(t,
|
|
4193
|
+
model: yi(t, k, A)
|
|
4194
4194
|
};
|
|
4195
4195
|
}, [
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
]),
|
|
4196
|
+
j,
|
|
4197
|
+
k,
|
|
4198
|
+
A
|
|
4199
|
+
]), N = g ? Ci(g, "x", a, r, (e) => Q({
|
|
4200
4200
|
x: e,
|
|
4201
4201
|
y: s[0]
|
|
4202
|
-
},
|
|
4202
|
+
}, k, A).x) : [], P = _ ? Ci(_, "y", s, i, (e) => Q({
|
|
4203
4203
|
x: a[0],
|
|
4204
4204
|
y: e
|
|
4205
|
-
},
|
|
4205
|
+
}, k, A).y) : [], F = !!_ && (_.labels ?? "inside") === "inside", I = m(null), [L, ee] = h(0), te = F ? P.map((e) => e.label).join("\n") : "";
|
|
4206
4206
|
d(() => {
|
|
4207
|
-
if (!
|
|
4207
|
+
if (!F) return;
|
|
4208
4208
|
let e = () => {
|
|
4209
4209
|
let e = 0;
|
|
4210
|
-
for (let t of
|
|
4211
|
-
|
|
4210
|
+
for (let t of I.current?.querySelectorAll("text") ?? []) typeof t.getComputedTextLength == "function" && (e = Math.max(e, t.getComputedTextLength()));
|
|
4211
|
+
ee((t) => t === e ? t : e);
|
|
4212
4212
|
};
|
|
4213
4213
|
e();
|
|
4214
4214
|
let t = !0;
|
|
@@ -4217,8 +4217,8 @@ var wi = a(function(e, t) {
|
|
|
4217
4217
|
}), () => {
|
|
4218
4218
|
t = !1;
|
|
4219
4219
|
};
|
|
4220
|
-
}, [
|
|
4221
|
-
let
|
|
4220
|
+
}, [F, te]);
|
|
4221
|
+
let R = [$.root, S].filter(Boolean).join(" "), z = (e, t, n) => !n || n.lines === !1 || t.length === 0 ? null : /* @__PURE__ */ v("g", { children: t.map((t) => /* @__PURE__ */ v("line", {
|
|
4222
4222
|
"data-plot-element": "tick",
|
|
4223
4223
|
"data-axis": e,
|
|
4224
4224
|
className: $.tick,
|
|
@@ -4233,7 +4233,7 @@ var wi = a(function(e, t) {
|
|
|
4233
4233
|
y1: t.at,
|
|
4234
4234
|
y2: t.at
|
|
4235
4235
|
}
|
|
4236
|
-
}, `t${e}-${t.value}`)) }),
|
|
4236
|
+
}, `t${e}-${t.value}`)) }), B = (e, t, n) => {
|
|
4237
4237
|
if (!n || t.length === 0) return null;
|
|
4238
4238
|
let r = n.labels ?? "inside";
|
|
4239
4239
|
if (r === !1) return null;
|
|
@@ -4242,8 +4242,8 @@ var wi = a(function(e, t) {
|
|
|
4242
4242
|
x: -o,
|
|
4243
4243
|
textAnchor: "end",
|
|
4244
4244
|
dominantBaseline: "central"
|
|
4245
|
-
} :
|
|
4246
|
-
x: o +
|
|
4245
|
+
} : L > 0 ? {
|
|
4246
|
+
x: o + L,
|
|
4247
4247
|
textAnchor: "end",
|
|
4248
4248
|
dominantBaseline: "central"
|
|
4249
4249
|
} : {
|
|
@@ -4258,7 +4258,7 @@ var wi = a(function(e, t) {
|
|
|
4258
4258
|
y: i - o,
|
|
4259
4259
|
textAnchor: "middle"
|
|
4260
4260
|
}, /* @__PURE__ */ v("g", {
|
|
4261
|
-
ref: e === "y" ?
|
|
4261
|
+
ref: e === "y" ? I : void 0,
|
|
4262
4262
|
className: $.tickLabels,
|
|
4263
4263
|
"aria-hidden": "true",
|
|
4264
4264
|
children: t.map((t) => /* @__PURE__ */ v("text", {
|
|
@@ -4275,8 +4275,8 @@ var wi = a(function(e, t) {
|
|
|
4275
4275
|
});
|
|
4276
4276
|
};
|
|
4277
4277
|
return /* @__PURE__ */ y("svg", {
|
|
4278
|
-
ref:
|
|
4279
|
-
className:
|
|
4278
|
+
ref: O,
|
|
4279
|
+
className: R,
|
|
4280
4280
|
style: C,
|
|
4281
4281
|
width: r,
|
|
4282
4282
|
height: i,
|
|
@@ -4284,9 +4284,9 @@ var wi = a(function(e, t) {
|
|
|
4284
4284
|
role: x,
|
|
4285
4285
|
"aria-label": e["aria-label"],
|
|
4286
4286
|
tabIndex: b,
|
|
4287
|
-
onPointerDown: w ? (e) => w(e,
|
|
4288
|
-
onContextMenu: T ? (e) => T(e,
|
|
4289
|
-
onKeyDown:
|
|
4287
|
+
onPointerDown: w ? (e) => w(e, M(e)) : void 0,
|
|
4288
|
+
onContextMenu: T ? (e) => T(e, M(e)) : void 0,
|
|
4289
|
+
onKeyDown: E,
|
|
4290
4290
|
children: [
|
|
4291
4291
|
l && (() => {
|
|
4292
4292
|
let e = l.divisions ?? 3, t = [];
|
|
@@ -4311,8 +4311,8 @@ var wi = a(function(e, t) {
|
|
|
4311
4311
|
}, `gy-${e}`))]
|
|
4312
4312
|
});
|
|
4313
4313
|
})(),
|
|
4314
|
-
|
|
4315
|
-
|
|
4314
|
+
z("x", N, g),
|
|
4315
|
+
z("y", P, _),
|
|
4316
4316
|
p !== !1 && p !== null && (() => {
|
|
4317
4317
|
let e = n(p?.color);
|
|
4318
4318
|
return /* @__PURE__ */ y("g", {
|
|
@@ -4334,9 +4334,9 @@ var wi = a(function(e, t) {
|
|
|
4334
4334
|
})]
|
|
4335
4335
|
});
|
|
4336
4336
|
})(),
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4337
|
+
B("x", N, g),
|
|
4338
|
+
B("y", P, _),
|
|
4339
|
+
D
|
|
4340
4340
|
]
|
|
4341
4341
|
});
|
|
4342
4342
|
});
|
|
@@ -4350,11 +4350,15 @@ function Ti(e) {
|
|
|
4350
4350
|
let r = (n - t) * .05;
|
|
4351
4351
|
return [t - r, n + r];
|
|
4352
4352
|
}
|
|
4353
|
-
function Ei(
|
|
4353
|
+
function Ei(e, t) {
|
|
4354
|
+
let n = t?.[0] ?? e[0] ?? 0, r = t?.[1] ?? e[e.length - 1] ?? n;
|
|
4355
|
+
return [n, r - n < 1 ? n + 1e3 : r];
|
|
4356
|
+
}
|
|
4357
|
+
function Di([e, t], n, r) {
|
|
4354
4358
|
let i = (t - e) * n / Math.max(1, r - 2 * n);
|
|
4355
4359
|
return [e - i, t + i];
|
|
4356
4360
|
}
|
|
4357
|
-
function
|
|
4361
|
+
function Oi(e, t, n, r) {
|
|
4358
4362
|
let i = "", a = !1;
|
|
4359
4363
|
return e.forEach((e, o) => {
|
|
4360
4364
|
let s = t[o];
|
|
@@ -4367,9 +4371,9 @@ function Di(e, t, n, r) {
|
|
|
4367
4371
|
}
|
|
4368
4372
|
//#endregion
|
|
4369
4373
|
//#region src/ui/ChannelPlot.tsx
|
|
4370
|
-
var
|
|
4371
|
-
function
|
|
4372
|
-
let [s, c] =
|
|
4374
|
+
var ki = 8, Ai = "\n.bp-plot { margin: 0; display: grid; gap: 2px; font-variant-numeric: tabular-nums; }\n.bp-plot-surface { margin-block-end: calc(var(--wzl-font-size-xs) + 6px); }\n.bp-plot-label { font-family: var(--wzl-font-ui); font-size: var(--wzl-font-size-xs); color: var(--wzl-fg-muted); }\n.bp-plot-thin, .bp-plot-thick { fill: none; stroke-linejoin: round; }\n.bp-plot-thin { stroke-width: 1; opacity: 0.65; }\n.bp-plot-thick { stroke-width: 2.5; }\n.bp-plot-playhead { stroke: var(--wzl-danger); stroke-width: 1; }\n";
|
|
4375
|
+
function ji({ label: e, times: t, series: n, playhead: r, range: i, width: a = 320, height: o = 90 }) {
|
|
4376
|
+
let [s, c] = Di(Ti(n), ki, o), [l, u] = Ei(t, i), d = {
|
|
4373
4377
|
xMin: l,
|
|
4374
4378
|
xMax: u,
|
|
4375
4379
|
yMin: s,
|
|
@@ -4387,7 +4391,7 @@ function Ai({ label: e, times: t, series: n, playhead: r, range: i, width: a = 3
|
|
|
4387
4391
|
return /* @__PURE__ */ y("figure", {
|
|
4388
4392
|
className: "bp-plot",
|
|
4389
4393
|
children: [
|
|
4390
|
-
/* @__PURE__ */ v("style", { children:
|
|
4394
|
+
/* @__PURE__ */ v("style", { children: Ai }),
|
|
4391
4395
|
/* @__PURE__ */ v("figcaption", {
|
|
4392
4396
|
className: "bp-plot-label",
|
|
4393
4397
|
children: e
|
|
@@ -4404,7 +4408,7 @@ function Ai({ label: e, times: t, series: n, playhead: r, range: i, width: a = 3
|
|
|
4404
4408
|
"aria-label": e,
|
|
4405
4409
|
children: [n.map((e) => /* @__PURE__ */ v("path", {
|
|
4406
4410
|
className: e.thick ? "bp-plot-thick" : "bp-plot-thin",
|
|
4407
|
-
d:
|
|
4411
|
+
d: Oi(t, e.values, p, m),
|
|
4408
4412
|
stroke: e.color ?? x(e.hue)
|
|
4409
4413
|
}, e.id)), /* @__PURE__ */ v("line", {
|
|
4410
4414
|
className: "bp-plot-playhead",
|
|
@@ -4419,9 +4423,9 @@ function Ai({ label: e, times: t, series: n, playhead: r, range: i, width: a = 3
|
|
|
4419
4423
|
}
|
|
4420
4424
|
//#endregion
|
|
4421
4425
|
//#region src/ui/ColorStrip.tsx
|
|
4422
|
-
var
|
|
4423
|
-
function
|
|
4424
|
-
let o = `bp-check${l().replace(/[^\w-]/g, "")}`, s = n.reduce((e, t) => Math.max(e, (t?.length ?? 1) - 1), 0), c =
|
|
4426
|
+
var Mi = 22, Ni = 9, Pi = 2, Fi = "\n.bp-strip { margin: 0 0 6px; display: grid; gap: 2px; }\n.bp-strip-label { font-family: var(--wzl-font-ui); font-size: var(--wzl-font-size-xs); color: var(--wzl-fg-muted); }\n.bp-strip-check-a { fill: var(--wzl-surface-sunken); }\n.bp-strip-check-b { fill: var(--wzl-border); }\n.bp-strip-playhead { stroke: var(--wzl-danger); stroke-width: 1; }\n.bp-strip-layer-label { font-family: var(--wzl-font-ui); font-size: 8px; fill: var(--wzl-fg-muted); }\n";
|
|
4427
|
+
function Ii({ label: e, times: t, colors: n, playhead: r, range: i, width: a = 320 }) {
|
|
4428
|
+
let o = `bp-check${l().replace(/[^\w-]/g, "")}`, s = n.reduce((e, t) => Math.max(e, (t?.length ?? 1) - 1), 0), c = Mi + s * 11, [u, d] = Ei(t, i), f = {
|
|
4425
4429
|
xMin: u,
|
|
4426
4430
|
xMax: d,
|
|
4427
4431
|
yMin: 0,
|
|
@@ -4434,10 +4438,10 @@ function Fi({ label: e, times: t, colors: n, playhead: r, range: i, width: a = 3
|
|
|
4434
4438
|
height: c
|
|
4435
4439
|
}).x, m = p(Math.min(d, Math.max(u, r))), h = (e) => e === 0 ? {
|
|
4436
4440
|
y: 0,
|
|
4437
|
-
h: ji
|
|
4438
|
-
} : {
|
|
4439
|
-
y: ji + (e - 1) * 11 + Ni,
|
|
4440
4441
|
h: Mi
|
|
4442
|
+
} : {
|
|
4443
|
+
y: Mi + (e - 1) * 11 + Pi,
|
|
4444
|
+
h: Ni
|
|
4441
4445
|
}, g = Array.from({ length: s + 1 }, (e, t) => ({
|
|
4442
4446
|
name: t === 0 ? "shown" : `layer ${t}`,
|
|
4443
4447
|
layer: t,
|
|
@@ -4461,7 +4465,7 @@ function Fi({ label: e, times: t, colors: n, playhead: r, range: i, width: a = 3
|
|
|
4461
4465
|
}), /* @__PURE__ */ y("figure", {
|
|
4462
4466
|
className: "bp-strip",
|
|
4463
4467
|
children: [
|
|
4464
|
-
/* @__PURE__ */ v("style", { children:
|
|
4468
|
+
/* @__PURE__ */ v("style", { children: Fi }),
|
|
4465
4469
|
/* @__PURE__ */ v("figcaption", {
|
|
4466
4470
|
className: "bp-strip-label",
|
|
4467
4471
|
children: e
|
|
@@ -4513,7 +4517,7 @@ function Fi({ label: e, times: t, colors: n, playhead: r, range: i, width: a = 3
|
|
|
4513
4517
|
g.slice(1).map((e) => /* @__PURE__ */ v("text", {
|
|
4514
4518
|
className: "bp-strip-layer-label",
|
|
4515
4519
|
x: 2,
|
|
4516
|
-
y: e.y +
|
|
4520
|
+
y: e.y + Ni - 1,
|
|
4517
4521
|
children: e.layer
|
|
4518
4522
|
}, e.name)),
|
|
4519
4523
|
/* @__PURE__ */ v("line", {
|
|
@@ -4530,12 +4534,12 @@ function Fi({ label: e, times: t, colors: n, playhead: r, range: i, width: a = 3
|
|
|
4530
4534
|
}
|
|
4531
4535
|
//#endregion
|
|
4532
4536
|
//#region src/ui/lanes.ts
|
|
4533
|
-
var
|
|
4537
|
+
var Li = /* @__PURE__ */ new Set([
|
|
4534
4538
|
"live",
|
|
4535
4539
|
"frozen",
|
|
4536
4540
|
"fading"
|
|
4537
4541
|
]);
|
|
4538
|
-
function
|
|
4542
|
+
function Ri(e, t) {
|
|
4539
4543
|
let n = new Map(t.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map(), i = (e, t, i) => {
|
|
4540
4544
|
let a = r.get(e);
|
|
4541
4545
|
if (a === void 0) {
|
|
@@ -4561,7 +4565,7 @@ function Li(e, t) {
|
|
|
4561
4565
|
let e = i(t.voice, t.name, t.track);
|
|
4562
4566
|
e.marks.push(t), t.mark === "start" && (e.from = t.at), t.mark === "end" && (e.to = t.at);
|
|
4563
4567
|
}
|
|
4564
|
-
for (let e of t)
|
|
4568
|
+
for (let e of t) Li.has(e.state) && i(e.id, e.name, e.track);
|
|
4565
4569
|
let o = /* @__PURE__ */ new Map();
|
|
4566
4570
|
for (let { span: e, track: t } of r.values()) {
|
|
4567
4571
|
let n = t ?? `#${e.voice}`, r = o.get(n);
|
|
@@ -4580,39 +4584,39 @@ function Li(e, t) {
|
|
|
4580
4584
|
announced: a
|
|
4581
4585
|
};
|
|
4582
4586
|
}
|
|
4583
|
-
function
|
|
4587
|
+
function zi(e, t, n) {
|
|
4584
4588
|
let r = t[0], i = t[t.length - 1];
|
|
4585
4589
|
if (!Number.isFinite(e)) return [r ?? 0, Math.max((r ?? 0) + 1, i ?? 1)];
|
|
4586
|
-
let a = e -
|
|
4590
|
+
let a = e - k, o = e + k;
|
|
4587
4591
|
for (let e of n) e.at < a && (a = e.at), e.at > o && (o = e.at);
|
|
4588
|
-
let s = r ?? Math.max(e - 1e4, a), c = Math.max(Math.min(o, e +
|
|
4592
|
+
let s = r ?? Math.max(e - 1e4, a), c = Math.max(Math.min(o, e + A), i ?? e);
|
|
4589
4593
|
return [s, Math.max(s + 1, c)];
|
|
4590
4594
|
}
|
|
4591
4595
|
//#endregion
|
|
4592
4596
|
//#region src/ui/time.ts
|
|
4593
|
-
var
|
|
4594
|
-
function
|
|
4597
|
+
var Bi = (e) => String(e).padStart(2, "0");
|
|
4598
|
+
function Vi(e) {
|
|
4595
4599
|
if (!Number.isFinite(e)) return "—";
|
|
4596
4600
|
let t = e < 0 ? "-" : "", n = Math.floor(Math.abs(e) / 10), r = n % 6e3 / 100, i = Math.floor(n / 6e3) % 60, a = Math.floor(n / 36e4);
|
|
4597
4601
|
if (a === 0 && i === 0) return `${t}${r.toFixed(2)}s`;
|
|
4598
4602
|
let o = r.toFixed(2).padStart(5, "0");
|
|
4599
|
-
return a === 0 ? `${t}${i}:${o}` : `${t}${a}:${
|
|
4603
|
+
return a === 0 ? `${t}${i}:${o}` : `${t}${a}:${Bi(i)}:${o}`;
|
|
4600
4604
|
}
|
|
4601
4605
|
//#endregion
|
|
4602
4606
|
//#region src/ui/Plan.tsx
|
|
4603
|
-
var
|
|
4604
|
-
function
|
|
4605
|
-
let [a, o] = n, { lanes: s, announced: c } =
|
|
4607
|
+
var Hi = 30, Ui = 12, Wi = 5.2, Gi = "\n.bp-plan { margin: 0 0 8px; display: grid; gap: 2px; font-variant-numeric: tabular-nums; }\n.bp-plan svg { display: block; overflow: visible; }\n.bp-plan-text { font-family: var(--wzl-font-ui); font-size: 9px; fill: var(--wzl-fg-muted); }\n.bp-plan-name { font-family: var(--wzl-font-ui); font-size: 10px; fill: var(--wzl-fg); }\n.bp-plan-ahead { fill: var(--wzl-fg); opacity: 0.05; }\n.bp-plan-bar { opacity: 0.4; }\n.bp-plan-tick { stroke-width: 1.5; }\n.bp-plan-said { stroke: var(--wzl-fg-muted); stroke-dasharray: 3 3; stroke-width: 1; }\n.bp-plan-playhead { stroke: var(--wzl-danger); stroke-width: 1; }\n";
|
|
4608
|
+
function Ki({ marks: e, voices: t, range: n, playhead: r, width: i = 320 }) {
|
|
4609
|
+
let [a, o] = n, { lanes: s, announced: c } = Ri(e, t), l = c.filter((e) => e.at >= a && e.at <= o), u = s.slice(0, Ui), d = (e) => (Math.min(o, Math.max(a, e)) - a) / (o - a) * i, f = u.length + +(l.length > 0), p = Math.max(1, f) * Hi, m = Number.isFinite(r) ? d(r) : null, h = Number.isFinite(r) ? o - r : 0;
|
|
4606
4610
|
return /* @__PURE__ */ y("figure", {
|
|
4607
4611
|
className: "bp-plan",
|
|
4608
4612
|
"aria-label": "plan",
|
|
4609
4613
|
children: [
|
|
4610
|
-
/* @__PURE__ */ v("style", { children:
|
|
4614
|
+
/* @__PURE__ */ v("style", { children: Gi }),
|
|
4611
4615
|
/* @__PURE__ */ y("figcaption", {
|
|
4612
4616
|
className: "bp-plot-label",
|
|
4613
4617
|
children: [
|
|
4614
4618
|
"plan",
|
|
4615
|
-
h > 0 ? `, ${
|
|
4619
|
+
h > 0 ? `, ${Vi(h)} ahead` : "",
|
|
4616
4620
|
s.length > u.length && ` · ${s.length - u.length} more lanes`
|
|
4617
4621
|
]
|
|
4618
4622
|
}),
|
|
@@ -4635,9 +4639,9 @@ function Gi({ marks: e, voices: t, range: n, playhead: r, width: i = 320 }) {
|
|
|
4635
4639
|
y: 18,
|
|
4636
4640
|
children: "nothing planned"
|
|
4637
4641
|
}),
|
|
4638
|
-
u.map((e, t) => /* @__PURE__ */ v(
|
|
4642
|
+
u.map((e, t) => /* @__PURE__ */ v(qi, {
|
|
4639
4643
|
lane: e,
|
|
4640
|
-
y: t *
|
|
4644
|
+
y: t * Hi,
|
|
4641
4645
|
x: d,
|
|
4642
4646
|
xMin: a,
|
|
4643
4647
|
xMax: o
|
|
@@ -4648,20 +4652,20 @@ function Gi({ marks: e, voices: t, range: n, playhead: r, width: i = 320 }) {
|
|
|
4648
4652
|
x2: d(e.at),
|
|
4649
4653
|
y1: 0,
|
|
4650
4654
|
y2: p,
|
|
4651
|
-
children: /* @__PURE__ */ v("title", { children:
|
|
4655
|
+
children: /* @__PURE__ */ v("title", { children: Xi(e) })
|
|
4652
4656
|
}, `said-${e.name}-${e.at}`)),
|
|
4653
4657
|
l.length > 0 && /* @__PURE__ */ y("g", {
|
|
4654
|
-
transform: `translate(0 ${u.length *
|
|
4658
|
+
transform: `translate(0 ${u.length * Hi})`,
|
|
4655
4659
|
children: [/* @__PURE__ */ v("text", {
|
|
4656
4660
|
className: "bp-plan-name",
|
|
4657
4661
|
x: 2,
|
|
4658
4662
|
y: 10,
|
|
4659
4663
|
children: "announced"
|
|
4660
|
-
}),
|
|
4664
|
+
}), Yi(l, d).map(({ m: e, show: t }) => /* @__PURE__ */ y("g", { children: [/* @__PURE__ */ v("path", {
|
|
4661
4665
|
d: `M${d(e.at)} 12l4 4l-4 4l-4 -4z`,
|
|
4662
4666
|
fill: "var(--wzl-fg)",
|
|
4663
|
-
"aria-label":
|
|
4664
|
-
children: /* @__PURE__ */ v("title", { children:
|
|
4667
|
+
"aria-label": Xi(e),
|
|
4668
|
+
children: /* @__PURE__ */ v("title", { children: Xi(e) })
|
|
4665
4669
|
}), t && /* @__PURE__ */ v("text", {
|
|
4666
4670
|
className: "bp-plan-text",
|
|
4667
4671
|
x: d(e.at) + 6,
|
|
@@ -4681,7 +4685,7 @@ function Gi({ marks: e, voices: t, range: n, playhead: r, width: i = 320 }) {
|
|
|
4681
4685
|
]
|
|
4682
4686
|
});
|
|
4683
4687
|
}
|
|
4684
|
-
function
|
|
4688
|
+
function qi({ lane: e, y: t, x: n, xMin: r, xMax: i }) {
|
|
4685
4689
|
let a = x(e.hue), o = n(e.from);
|
|
4686
4690
|
return /* @__PURE__ */ y("g", {
|
|
4687
4691
|
transform: `translate(0 ${t})`,
|
|
@@ -4691,7 +4695,7 @@ function Ki({ lane: e, y: t, x: n, xMin: r, xMax: i }) {
|
|
|
4691
4695
|
x: Math.max(2, Math.min(o, n(i) - 60)) + 2,
|
|
4692
4696
|
y: 9,
|
|
4693
4697
|
children: e.label
|
|
4694
|
-
}), e.spans.map((e) => /* @__PURE__ */ v(
|
|
4698
|
+
}), e.spans.map((e) => /* @__PURE__ */ v(Ji, {
|
|
4695
4699
|
span: e,
|
|
4696
4700
|
color: a,
|
|
4697
4701
|
x: n,
|
|
@@ -4700,8 +4704,8 @@ function Ki({ lane: e, y: t, x: n, xMin: r, xMax: i }) {
|
|
|
4700
4704
|
}, e.voice))]
|
|
4701
4705
|
});
|
|
4702
4706
|
}
|
|
4703
|
-
function
|
|
4704
|
-
let a = n(e.from), o = !(e.to <= i), s = o ? n(i) - 6 : n(e.to), c = e.to === Infinity ? "no end known: plays on" : `gone at ${
|
|
4707
|
+
function Ji({ span: e, color: t, x: n, xMin: r, xMax: i }) {
|
|
4708
|
+
let a = n(e.from), o = !(e.to <= i), s = o ? n(i) - 6 : n(e.to), c = e.to === Infinity ? "no end known: plays on" : `gone at ${Vi(e.to)}`;
|
|
4705
4709
|
return /* @__PURE__ */ y("g", {
|
|
4706
4710
|
"aria-label": `${e.label}: ${c}`,
|
|
4707
4711
|
children: [
|
|
@@ -4719,14 +4723,14 @@ function qi({ span: e, color: t, x: n, xMin: r, xMax: i }) {
|
|
|
4719
4723
|
fill: t,
|
|
4720
4724
|
children: /* @__PURE__ */ v("title", { children: c })
|
|
4721
4725
|
}),
|
|
4722
|
-
|
|
4726
|
+
Yi(e.marks.filter((e) => e.at >= r && e.at <= i), n).map(({ m: e, show: r }) => /* @__PURE__ */ y("g", { children: [/* @__PURE__ */ v("line", {
|
|
4723
4727
|
className: "bp-plan-tick",
|
|
4724
4728
|
x1: n(e.at),
|
|
4725
4729
|
x2: n(e.at),
|
|
4726
4730
|
y1: 10,
|
|
4727
4731
|
y2: 21,
|
|
4728
4732
|
stroke: t,
|
|
4729
|
-
children: /* @__PURE__ */ v("title", { children:
|
|
4733
|
+
children: /* @__PURE__ */ v("title", { children: Xi(e) })
|
|
4730
4734
|
}), r && /* @__PURE__ */ v("text", {
|
|
4731
4735
|
className: "bp-plan-text",
|
|
4732
4736
|
x: n(e.at) + 2,
|
|
@@ -4736,23 +4740,23 @@ function qi({ span: e, color: t, x: n, xMin: r, xMax: i }) {
|
|
|
4736
4740
|
]
|
|
4737
4741
|
});
|
|
4738
4742
|
}
|
|
4739
|
-
function
|
|
4743
|
+
function Yi(e, t) {
|
|
4740
4744
|
let n = -Infinity;
|
|
4741
4745
|
return e.map((e) => {
|
|
4742
4746
|
let r = t(e.at), i = (e.voice === null ? e.name : e.mark) ?? "", a = r >= n;
|
|
4743
|
-
return a && (n = r + 4 + i.length *
|
|
4747
|
+
return a && (n = r + 4 + i.length * Wi), {
|
|
4744
4748
|
m: e,
|
|
4745
4749
|
show: a
|
|
4746
4750
|
};
|
|
4747
4751
|
});
|
|
4748
4752
|
}
|
|
4749
|
-
function
|
|
4750
|
-
return `${e.voice === null ? `announced ${e.name ?? ""}` : `${e.name ?? `#${e.voice}`} ${e.mark}`} at ${
|
|
4753
|
+
function Xi(e) {
|
|
4754
|
+
return `${e.voice === null ? `announced ${e.name ?? ""}` : `${e.name ?? `#${e.voice}`} ${e.mark}`} at ${Vi(e.at)}`;
|
|
4751
4755
|
}
|
|
4752
4756
|
//#endregion
|
|
4753
4757
|
//#region src/ui/Plots.tsx
|
|
4754
|
-
function
|
|
4755
|
-
let { times: s, values: c, colors: l, weights: u, read: d } = f(() => e.series(), [e, t]), p = Number.isFinite(i) ? i : s[s.length - 1] ?? NaN, m =
|
|
4758
|
+
function Zi({ samples: e, drawn: t, voices: n, marks: r, playhead: i, picked: a, mix: o }) {
|
|
4759
|
+
let { times: s, values: c, colors: l, weights: u, read: d } = f(() => e.series(), [e, t]), p = Number.isFinite(i) ? i : s[s.length - 1] ?? NaN, m = zi(p, a ? s : [], r), h = o && /* @__PURE__ */ v(Ki, {
|
|
4756
4760
|
marks: r,
|
|
4757
4761
|
voices: n,
|
|
4758
4762
|
range: m,
|
|
@@ -4774,14 +4778,14 @@ function Xi({ samples: e, drawn: t, voices: n, marks: r, playhead: i, picked: a,
|
|
|
4774
4778
|
className: "bp-plots",
|
|
4775
4779
|
children: [
|
|
4776
4780
|
h,
|
|
4777
|
-
[...l].map(([e, t]) => /* @__PURE__ */ v(
|
|
4781
|
+
[...l].map(([e, t]) => /* @__PURE__ */ v(Ii, {
|
|
4778
4782
|
label: `${e}${g}`,
|
|
4779
4783
|
times: s,
|
|
4780
4784
|
colors: t,
|
|
4781
4785
|
range: m,
|
|
4782
4786
|
playhead: p
|
|
4783
4787
|
}, e)),
|
|
4784
|
-
[...c].map(([e, t]) => /* @__PURE__ */ v(
|
|
4788
|
+
[...c].map(([e, t]) => /* @__PURE__ */ v(ji, {
|
|
4785
4789
|
label: `${e}${g}`,
|
|
4786
4790
|
times: s,
|
|
4787
4791
|
range: m,
|
|
@@ -4794,7 +4798,7 @@ function Xi({ samples: e, drawn: t, voices: n, marks: r, playhead: i, picked: a,
|
|
|
4794
4798
|
thick: !0
|
|
4795
4799
|
}]
|
|
4796
4800
|
}, e)),
|
|
4797
|
-
b.length > 0 && /* @__PURE__ */ v(
|
|
4801
|
+
b.length > 0 && /* @__PURE__ */ v(ji, {
|
|
4798
4802
|
label: "weightOf",
|
|
4799
4803
|
times: s,
|
|
4800
4804
|
range: m,
|
|
@@ -4806,7 +4810,7 @@ function Xi({ samples: e, drawn: t, voices: n, marks: r, playhead: i, picked: a,
|
|
|
4806
4810
|
}
|
|
4807
4811
|
//#endregion
|
|
4808
4812
|
//#region src/ui/Panel.tsx
|
|
4809
|
-
var
|
|
4813
|
+
var Qi = {
|
|
4810
4814
|
mixes: [],
|
|
4811
4815
|
mix: null,
|
|
4812
4816
|
subject: null,
|
|
@@ -4823,7 +4827,7 @@ var Zi = {
|
|
|
4823
4827
|
circles: !1,
|
|
4824
4828
|
drawn: 0
|
|
4825
4829
|
};
|
|
4826
|
-
function
|
|
4830
|
+
function $i(e, t) {
|
|
4827
4831
|
switch (t.kind) {
|
|
4828
4832
|
case "mixes": return {
|
|
4829
4833
|
...e,
|
|
@@ -4866,17 +4870,17 @@ function Qi(e, t) {
|
|
|
4866
4870
|
default: return e;
|
|
4867
4871
|
}
|
|
4868
4872
|
}
|
|
4869
|
-
var
|
|
4873
|
+
var ea = [
|
|
4870
4874
|
0,
|
|
4871
4875
|
.1,
|
|
4872
4876
|
.25,
|
|
4873
4877
|
.5,
|
|
4874
4878
|
1,
|
|
4875
4879
|
2
|
|
4876
|
-
],
|
|
4877
|
-
function
|
|
4880
|
+
], ta = 1e3 / 60, na = "blits-panel:place";
|
|
4881
|
+
function ra() {
|
|
4878
4882
|
try {
|
|
4879
|
-
let e = JSON.parse(localStorage.getItem(
|
|
4883
|
+
let e = JSON.parse(localStorage.getItem(na) ?? "null");
|
|
4880
4884
|
if (e && typeof e.x == "number" && typeof e.y == "number") return e;
|
|
4881
4885
|
} catch {}
|
|
4882
4886
|
return {
|
|
@@ -4885,24 +4889,24 @@ function na() {
|
|
|
4885
4889
|
open: !1
|
|
4886
4890
|
};
|
|
4887
4891
|
}
|
|
4888
|
-
function
|
|
4892
|
+
function ia(e) {
|
|
4889
4893
|
try {
|
|
4890
|
-
localStorage.setItem(
|
|
4894
|
+
localStorage.setItem(na, JSON.stringify(e));
|
|
4891
4895
|
} catch {}
|
|
4892
4896
|
}
|
|
4893
|
-
function
|
|
4897
|
+
function aa(e, t) {
|
|
4894
4898
|
let n = typeof innerWidth == "number" ? innerWidth : 1024, r = typeof innerHeight == "number" ? innerHeight : 768;
|
|
4895
4899
|
return {
|
|
4896
4900
|
x: Math.min(Math.max(0, e), Math.max(0, n - 120)),
|
|
4897
4901
|
y: Math.min(Math.max(0, t), Math.max(0, r - 40))
|
|
4898
4902
|
};
|
|
4899
4903
|
}
|
|
4900
|
-
function
|
|
4901
|
-
let [r, i] = p(
|
|
4902
|
-
let e =
|
|
4904
|
+
function oa({ source: e, docked: t = !1, bar: n }) {
|
|
4905
|
+
let [r, i] = p($i, Qi), a = m(new j()), [o, s] = h(() => {
|
|
4906
|
+
let e = ra();
|
|
4903
4907
|
return {
|
|
4904
4908
|
...e,
|
|
4905
|
-
...
|
|
4909
|
+
...aa(e.x, e.y)
|
|
4906
4910
|
};
|
|
4907
4911
|
}), [l, u] = h(""), [d, f] = h(null);
|
|
4908
4912
|
c(() => {
|
|
@@ -4939,10 +4943,10 @@ function aa({ source: e, docked: t = !1, bar: n }) {
|
|
|
4939
4943
|
S && r.hold.now > g.current && (g.current = r.hold.now), S || (g.current = -Infinity);
|
|
4940
4944
|
let C = (e, t = o.x, n = o.y) => {
|
|
4941
4945
|
let r = {
|
|
4942
|
-
...
|
|
4946
|
+
...aa(t, n),
|
|
4943
4947
|
open: e
|
|
4944
4948
|
};
|
|
4945
|
-
s(r),
|
|
4949
|
+
s(r), ia(r);
|
|
4946
4950
|
}, w = (e) => {
|
|
4947
4951
|
if (e.target.closest("button, select, input")) return;
|
|
4948
4952
|
let t = {
|
|
@@ -4972,7 +4976,7 @@ function aa({ source: e, docked: t = !1, bar: n }) {
|
|
|
4972
4976
|
title: "step one frame",
|
|
4973
4977
|
onClick: () => b({
|
|
4974
4978
|
kind: "step",
|
|
4975
|
-
ms:
|
|
4979
|
+
ms: ta
|
|
4976
4980
|
}),
|
|
4977
4981
|
children: "⏭"
|
|
4978
4982
|
}),
|
|
@@ -5012,11 +5016,11 @@ function aa({ source: e, docked: t = !1, bar: n }) {
|
|
|
5012
5016
|
}),
|
|
5013
5017
|
/* @__PURE__ */ v("span", {
|
|
5014
5018
|
className: "bp-time",
|
|
5015
|
-
children:
|
|
5019
|
+
children: Vi(r.hold.now)
|
|
5016
5020
|
})
|
|
5017
5021
|
]
|
|
5018
5022
|
});
|
|
5019
|
-
let
|
|
5023
|
+
let E = r.subjects.filter((e) => e.label.toLowerCase().includes(l.toLowerCase()));
|
|
5020
5024
|
return /* @__PURE__ */ y("div", {
|
|
5021
5025
|
className: t ? "bp-window bp-docked" : "bp-window",
|
|
5022
5026
|
style: t ? void 0 : {
|
|
@@ -5052,7 +5056,7 @@ function aa({ source: e, docked: t = !1, bar: n }) {
|
|
|
5052
5056
|
kind: "rate",
|
|
5053
5057
|
rate: Number(e.currentTarget.value)
|
|
5054
5058
|
}),
|
|
5055
|
-
children:
|
|
5059
|
+
children: ea.map((e) => /* @__PURE__ */ y("option", {
|
|
5056
5060
|
value: e,
|
|
5057
5061
|
children: ["×", e]
|
|
5058
5062
|
}, e))
|
|
@@ -5066,11 +5070,11 @@ function aa({ source: e, docked: t = !1, bar: n }) {
|
|
|
5066
5070
|
}),
|
|
5067
5071
|
/* @__PURE__ */ v("span", {
|
|
5068
5072
|
className: "bp-time",
|
|
5069
|
-
children:
|
|
5073
|
+
children: Vi(r.hold.now)
|
|
5070
5074
|
})
|
|
5071
5075
|
]
|
|
5072
5076
|
}),
|
|
5073
|
-
x !== void 0 && /* @__PURE__ */ v(
|
|
5077
|
+
x !== void 0 && /* @__PURE__ */ v(sa, {
|
|
5074
5078
|
mix: x,
|
|
5075
5079
|
hold: r.hold
|
|
5076
5080
|
}),
|
|
@@ -5102,7 +5106,7 @@ function aa({ source: e, docked: t = !1, bar: n }) {
|
|
|
5102
5106
|
/* @__PURE__ */ v("ul", {
|
|
5103
5107
|
className: "bp-list",
|
|
5104
5108
|
"aria-label": "subjects",
|
|
5105
|
-
children:
|
|
5109
|
+
children: E.map((e) => /* @__PURE__ */ v("li", { children: /* @__PURE__ */ v("button", {
|
|
5106
5110
|
type: "button",
|
|
5107
5111
|
className: e.id === r.subject ? "bp-item bp-on" : "bp-item",
|
|
5108
5112
|
onClick: () => b({
|
|
@@ -5164,7 +5168,7 @@ function aa({ source: e, docked: t = !1, bar: n }) {
|
|
|
5164
5168
|
}, e.id))
|
|
5165
5169
|
})
|
|
5166
5170
|
]
|
|
5167
|
-
}), /* @__PURE__ */ v(
|
|
5171
|
+
}), /* @__PURE__ */ v(Zi, {
|
|
5168
5172
|
samples: a.current,
|
|
5169
5173
|
drawn: r.drawn,
|
|
5170
5174
|
voices: r.voices,
|
|
@@ -5177,7 +5181,7 @@ function aa({ source: e, docked: t = !1, bar: n }) {
|
|
|
5177
5181
|
]
|
|
5178
5182
|
});
|
|
5179
5183
|
}
|
|
5180
|
-
function
|
|
5184
|
+
function sa({ mix: e, hold: t }) {
|
|
5181
5185
|
let n = e.history, r = n === null ? "no history: made before the panel, or the panel was told not to add it, so it only pauses and steps forward" : n.tape ? n.added ? `history: ${(n.ms / 1e3).toFixed(0)} s, added by the debugger` : `history: ${(n.ms / 1e3).toFixed(0)} s, its own` : "no tape: it only pauses and steps forward";
|
|
5182
5186
|
return /* @__PURE__ */ y("p", {
|
|
5183
5187
|
className: "bp-note",
|
|
@@ -5186,10 +5190,10 @@ function oa({ mix: e, hold: t }) {
|
|
|
5186
5190
|
}
|
|
5187
5191
|
//#endregion
|
|
5188
5192
|
//#region src/mount.tsx
|
|
5189
|
-
function
|
|
5193
|
+
function ca(e = {}) {
|
|
5190
5194
|
let t = r(), n = t.history, i = e.history ?? (n === void 0 && 1e4), a = i === !1 ? void 0 : {
|
|
5191
5195
|
ms: i,
|
|
5192
|
-
tape:
|
|
5196
|
+
tape: Ae
|
|
5193
5197
|
};
|
|
5194
5198
|
a !== void 0 && (t.history = a);
|
|
5195
5199
|
let o = document.createElement("div");
|
|
@@ -5205,14 +5209,14 @@ function sa(e = {}) {
|
|
|
5205
5209
|
}
|
|
5206
5210
|
let c = document.createElement("div");
|
|
5207
5211
|
s.appendChild(c), document.body.appendChild(o);
|
|
5208
|
-
let l =
|
|
5212
|
+
let l = ce({
|
|
5209
5213
|
...e,
|
|
5210
5214
|
ignore: o
|
|
5211
5215
|
}), u = b(c);
|
|
5212
5216
|
u.render(/* @__PURE__ */ v(Pr, {
|
|
5213
5217
|
selection: { mode: "auto" },
|
|
5214
5218
|
className: "bp-root",
|
|
5215
|
-
children: /* @__PURE__ */ v(
|
|
5219
|
+
children: /* @__PURE__ */ v(oa, { source: l })
|
|
5216
5220
|
}));
|
|
5217
5221
|
let d = !1;
|
|
5218
5222
|
return () => {
|
|
@@ -5221,39 +5225,39 @@ function sa(e = {}) {
|
|
|
5221
5225
|
}
|
|
5222
5226
|
//#endregion
|
|
5223
5227
|
//#region src/wire.ts
|
|
5224
|
-
function
|
|
5228
|
+
function la(e) {
|
|
5225
5229
|
return JSON.stringify(e, (e, t) => typeof t == "number" && !Number.isFinite(t) ? { $n: String(t) } : t);
|
|
5226
5230
|
}
|
|
5227
|
-
function
|
|
5231
|
+
function ua(e) {
|
|
5228
5232
|
return JSON.parse(e, (e, t) => typeof t == "object" && t && typeof t.$n == "string" && Object.keys(t).length === 1 ? Number(t.$n) : t);
|
|
5229
5233
|
}
|
|
5230
|
-
function
|
|
5234
|
+
function da(e) {
|
|
5231
5235
|
let t = /* @__PURE__ */ new Set(), n = e.listen((e) => {
|
|
5232
|
-
let n =
|
|
5236
|
+
let n = ua(e);
|
|
5233
5237
|
if ("e" in n) for (let e of [...t]) e(n.e);
|
|
5234
5238
|
});
|
|
5235
5239
|
return {
|
|
5236
5240
|
subscribe(n) {
|
|
5237
|
-
return t.add(n), t.size === 1 && e.send(
|
|
5241
|
+
return t.add(n), t.size === 1 && e.send(la({ hello: !0 })), () => {
|
|
5238
5242
|
t.delete(n);
|
|
5239
5243
|
};
|
|
5240
5244
|
},
|
|
5241
5245
|
send(t) {
|
|
5242
|
-
e.send(
|
|
5246
|
+
e.send(la({ c: t }));
|
|
5243
5247
|
},
|
|
5244
5248
|
refresh() {
|
|
5245
|
-
e.send(
|
|
5249
|
+
e.send(la({ hello: !0 }));
|
|
5246
5250
|
},
|
|
5247
5251
|
close() {
|
|
5248
5252
|
n(), t.clear();
|
|
5249
5253
|
}
|
|
5250
5254
|
};
|
|
5251
5255
|
}
|
|
5252
|
-
function
|
|
5256
|
+
function fa(e, t) {
|
|
5253
5257
|
let n = () => {}, r = () => {
|
|
5254
|
-
n(), n = e.subscribe((e) => t.send(
|
|
5258
|
+
n(), n = e.subscribe((e) => t.send(la({ e })));
|
|
5255
5259
|
}, i = t.listen((t) => {
|
|
5256
|
-
let n =
|
|
5260
|
+
let n = ua(t);
|
|
5257
5261
|
"hello" in n ? r() : "c" in n && e.send(n.c);
|
|
5258
5262
|
});
|
|
5259
5263
|
return r(), () => {
|
|
@@ -5261,6 +5265,6 @@ function da(e, t) {
|
|
|
5261
5265
|
};
|
|
5262
5266
|
}
|
|
5263
5267
|
//#endregion
|
|
5264
|
-
export {
|
|
5268
|
+
export { A as AHEAD_CAP_MS, k as AHEAD_MS, O as CAP, ji as ChannelPlot, Ii as ColorStrip, oa as Panel, j as Samples, D as WINDOW_MS, ce as agent, z as colorsOf, ua as decode, la as encode, R as flatten, x as hueColor, ca as mount, F as offer, Br as panelStyles, ne as readPose, fa as serve, da as wireSource };
|
|
5265
5269
|
|
|
5266
5270
|
//# sourceMappingURL=index.js.map
|