monowind 0.2.4 → 0.2.6
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/README.md +11 -0
- package/dist/cdn.js +76 -31
- package/dist/cdn.js.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/index.js +1299 -919
- package/dist/index.js.map +1 -1
- package/dist/layout.d.ts.map +1 -1
- package/dist/leaf.d.ts +4 -0
- package/dist/leaf.d.ts.map +1 -1
- package/dist/paint.d.ts +1 -0
- package/dist/paint.d.ts.map +1 -1
- package/dist/plain-text.d.ts +10 -0
- package/dist/plain-text.d.ts.map +1 -1
- package/dist/pointer.d.ts.map +1 -1
- package/dist/selection.d.ts +61 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/tree.d.ts.map +1 -1
- package/dist/types.d.ts +23 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/styles.css +37 -2
package/dist/index.js
CHANGED
|
@@ -327,7 +327,7 @@ x("single", {
|
|
|
327
327
|
dashed: A,
|
|
328
328
|
dotted: A
|
|
329
329
|
});
|
|
330
|
-
function
|
|
330
|
+
function ee(e) {
|
|
331
331
|
return {
|
|
332
332
|
track: e?.solid?.scrollTrack ?? "░",
|
|
333
333
|
thumb: e?.solid?.scrollThumb ?? "█"
|
|
@@ -341,57 +341,57 @@ x("blocks", {
|
|
|
341
341
|
});
|
|
342
342
|
//#endregion
|
|
343
343
|
//#region src/warn.ts
|
|
344
|
-
var
|
|
345
|
-
function
|
|
346
|
-
let n =
|
|
347
|
-
n ||
|
|
344
|
+
var te = /* @__PURE__ */ new WeakMap();
|
|
345
|
+
function j(e, t) {
|
|
346
|
+
let n = te.get(e);
|
|
347
|
+
n || te.set(e, n = /* @__PURE__ */ new Set()), !n.has(t) && (n.add(t), console.warn(`[monowind] ${t}`, ne(e)));
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function ne(e) {
|
|
350
350
|
if (!globalThis.process?.versions?.node) return e;
|
|
351
351
|
let t = e.id ? `#${e.id}` : "", n = e.classList.length ? `.${Array.from(e.classList).join(".")}` : "";
|
|
352
352
|
return `<${e.tagName.toLowerCase()}${t}${n}>`;
|
|
353
353
|
}
|
|
354
354
|
//#endregion
|
|
355
355
|
//#region src/leaf.ts
|
|
356
|
-
var
|
|
357
|
-
function
|
|
356
|
+
var re = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ new Set();
|
|
357
|
+
function ae(e) {
|
|
358
358
|
let t = e.tag.toLowerCase();
|
|
359
359
|
if (!t.includes("-")) {
|
|
360
360
|
console.warn(`[monowind] registerLeafRenderer: "${e.tag}" is not a custom-element tag name (needs a hyphen); ignored.`);
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
re.has(t) && console.warn(`[monowind] registerLeafRenderer: replacing existing renderer for <${t}> (last registration wins).`), re.set(t, {
|
|
364
364
|
...e,
|
|
365
365
|
tag: t
|
|
366
|
-
}),
|
|
366
|
+
}), de();
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
|
|
368
|
+
function oe() {
|
|
369
|
+
de();
|
|
370
370
|
}
|
|
371
|
-
function
|
|
372
|
-
return
|
|
371
|
+
function se(e) {
|
|
372
|
+
return re.get(e.toLowerCase());
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function ce() {
|
|
375
375
|
let e = /* @__PURE__ */ new Set();
|
|
376
|
-
for (let t of
|
|
376
|
+
for (let t of re.values()) for (let n of t.observedAttributes ?? []) e.add(n.toLowerCase());
|
|
377
377
|
return [...e];
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
return
|
|
379
|
+
function le(e) {
|
|
380
|
+
return ie.add(e), () => ie.delete(e);
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function ue(e, t) {
|
|
383
383
|
try {
|
|
384
384
|
return e.render(t);
|
|
385
385
|
} catch (n) {
|
|
386
|
-
return
|
|
386
|
+
return j(t, `<${e.tag}> renderer threw; rendering nothing. ${String(n)}`), null;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
for (let e of
|
|
389
|
+
function de() {
|
|
390
|
+
for (let e of ie) e();
|
|
391
391
|
}
|
|
392
392
|
//#endregion
|
|
393
393
|
//#region src/borders.ts
|
|
394
|
-
function
|
|
394
|
+
function fe(e, t, n) {
|
|
395
395
|
let r = e.border;
|
|
396
396
|
if (r.top === 0 && r.right === 0 && r.bottom === 0 && r.left === 0) return;
|
|
397
397
|
let i = Math.max(r.top, r.right, r.bottom, r.left);
|
|
@@ -407,11 +407,11 @@ function ue(e, t, n) {
|
|
|
407
407
|
width: t.width - (i.left ? a : 0) - (i.right ? a : 0),
|
|
408
408
|
height: t.height - (i.top ? a : 0) - (i.bottom ? a : 0)
|
|
409
409
|
};
|
|
410
|
-
o.width <= 0 || o.height <= 0 ||
|
|
410
|
+
o.width <= 0 || o.height <= 0 || pe(n, e.borderStyle, e.borderColor, o, i, S(e.glyphSet));
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
let o =
|
|
413
|
+
function pe(e, t, n, r, i, a) {
|
|
414
|
+
let o = ve(t.top, a), s = ve(t.right, a), c = ve(t.bottom, a), l = ve(t.left, a), u = (e, t, n) => n(ve(e === t ? e : "solid", a)), { x: d, y: f, width: p, height: m } = r, h = p >= 2 && m >= 2, g = d + +!!i.left, _ = d + p - +!!i.right, v = f + +!!i.top, y = f + m - +!!i.bottom;
|
|
415
415
|
if (i.top && _ > g && e.push({
|
|
416
416
|
glyph: o.h,
|
|
417
417
|
x: g,
|
|
@@ -464,13 +464,13 @@ function de(e, t, n, r, i, a) {
|
|
|
464
464
|
color: n.bottom
|
|
465
465
|
}));
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function me(e, t) {
|
|
468
468
|
return e.style.position !== "static" || (t.style.display === "flex" || t.style.display === "grid") && e.style.zIndex !== null;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function he(e) {
|
|
471
471
|
if (e.children.length <= 1) return e.children;
|
|
472
472
|
let t = null, n = null, r = null, i = null;
|
|
473
|
-
for (let a of e.children)
|
|
473
|
+
for (let a of e.children) me(a, e) ? (a.style.zIndex ?? 0) < 0 ? (t ??= []).push(a) : (i ??= []).push(a) : a.inlineBox ? (r ??= []).push(a) : (n ??= []).push(a);
|
|
474
474
|
return t && t.length > 1 && t.sort((e, t) => (e.style.zIndex ?? 0) - (t.style.zIndex ?? 0)), i && i.length > 1 && i.sort((e, t) => (e.style.zIndex ?? 0) - (t.style.zIndex ?? 0)), !t && n && !r && !i ? n : !t && !n && r && !i ? r : !t && !n && !r && i ? i : [
|
|
475
475
|
...t ?? [],
|
|
476
476
|
...n ?? [],
|
|
@@ -478,11 +478,11 @@ function pe(e) {
|
|
|
478
478
|
...i ?? []
|
|
479
479
|
];
|
|
480
480
|
}
|
|
481
|
-
function
|
|
482
|
-
let r =
|
|
481
|
+
function ge(e, t, n) {
|
|
482
|
+
let r = ve(e, n);
|
|
483
483
|
return t === "h" ? r.h : r.v;
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function _e(e, t, n, r, i, a) {
|
|
486
486
|
let o = (t ? 8 : 0) | (n ? 4 : 0) | (r ? 2 : 0) | !!i;
|
|
487
487
|
if (a) {
|
|
488
488
|
let t = w(o), n = t && a[e]?.[t];
|
|
@@ -490,8 +490,8 @@ function he(e, t, n, r, i, a) {
|
|
|
490
490
|
}
|
|
491
491
|
return (e === "double" ? E : T)[o];
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
let n = (n, r, i, a) =>
|
|
493
|
+
function ve(e, t) {
|
|
494
|
+
let n = (n, r, i, a) => _e(e, n, r, i, a, t), r = {
|
|
495
495
|
h: n(!1, !1, !0, !0),
|
|
496
496
|
v: n(!0, !0, !1, !1),
|
|
497
497
|
tl: n(!1, !0, !1, !0),
|
|
@@ -502,24 +502,24 @@ function ge(e, t) {
|
|
|
502
502
|
return e === "dashed" ? {
|
|
503
503
|
h: "╌",
|
|
504
504
|
v: "╎",
|
|
505
|
-
...
|
|
506
|
-
...
|
|
505
|
+
...ye(r),
|
|
506
|
+
...be(t, e)
|
|
507
507
|
} : e === "dotted" ? {
|
|
508
508
|
h: "┄",
|
|
509
509
|
v: "┊",
|
|
510
|
-
...
|
|
511
|
-
...
|
|
510
|
+
...ye(r),
|
|
511
|
+
...be(t, e)
|
|
512
512
|
} : r;
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function ye(e) {
|
|
515
515
|
let { h: t, v: n, ...r } = e;
|
|
516
516
|
return r;
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function be(e, t) {
|
|
519
519
|
let n = e?.[t], r = {};
|
|
520
520
|
return n?.h && (r.h = n.h), n?.v && (r.v = n.v), r;
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function xe(e, t, n, r) {
|
|
523
523
|
let i = e.map((e) => e.spanned ? !1 : n === "between" ? e.beforeOccupied && e.afterOccupied : n !== "around" || e.beforeOccupied || e.afterOccupied), a = [];
|
|
524
524
|
for (let n = 0; n < e.length; n++) if (a.push({
|
|
525
525
|
start: e[n].start,
|
|
@@ -563,7 +563,7 @@ function ye(e, t, n, r) {
|
|
|
563
563
|
end: e.end - r
|
|
564
564
|
})).filter((e) => e.end > e.start);
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function Se(e) {
|
|
567
567
|
let t = [], n = e.border.left + e.padding.left, r = e.border.top + e.padding.top, i = (e, t) => ({
|
|
568
568
|
line: t.bandStart + Math.floor((t.bandSize - e.width) / 2),
|
|
569
569
|
start: t.start,
|
|
@@ -572,7 +572,7 @@ function be(e) {
|
|
|
572
572
|
endHalf: t.endHalf === !0
|
|
573
573
|
}), a = e.ruleX ? e.vertical.map((t) => i(e.ruleX, t)) : [], o = e.ruleY ? e.horizontal.map((t) => i(e.ruleY, t)) : [], s = e.ruleX?.width ?? 0, c = e.ruleY?.width ?? 0, l = (e, t, n, r) => e.some((e) => n >= e.line && n < e.line + t && (e.start < r && e.end > r || e.end === r && !e.endHalf || e.start === r && !e.startHalf)), u = (e, t) => o.some((n) => t >= n.line && t < n.line + c && e >= n.start && e < n.end);
|
|
574
574
|
if (e.ruleX) {
|
|
575
|
-
let i =
|
|
575
|
+
let i = ge(e.ruleX.style, "v", e.glyphs);
|
|
576
576
|
for (let o of a) {
|
|
577
577
|
for (let a = 0; a < s; a++) for (let s = o.start; s < o.end; s++) u(o.line + a, s) || t.push({
|
|
578
578
|
glyph: i,
|
|
@@ -581,7 +581,7 @@ function be(e) {
|
|
|
581
581
|
length: 1,
|
|
582
582
|
color: e.ruleX.color
|
|
583
583
|
});
|
|
584
|
-
|
|
584
|
+
Ce(e, t, "x", o.line, o.start, o.end);
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
if (e.ruleY) {
|
|
@@ -592,7 +592,7 @@ function be(e) {
|
|
|
592
592
|
for (let d = u.start; d < u.end; d++) {
|
|
593
593
|
let u = l(a, s, d, f), p = l(a, s, d, f + 1);
|
|
594
594
|
t.push({
|
|
595
|
-
glyph: u || p ?
|
|
595
|
+
glyph: u || p ? _e(i ? "double" : "solid", u, p, l(o, c, f, d), l(o, c, f, d + 1), e.glyphs) : ge(e.ruleY.style, "h", e.glyphs),
|
|
596
596
|
x: n + d,
|
|
597
597
|
y: r + f,
|
|
598
598
|
length: 1,
|
|
@@ -600,16 +600,16 @@ function be(e) {
|
|
|
600
600
|
});
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
|
|
603
|
+
Ce(e, t, "y", u.line, u.start, u.end);
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
return t;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function Ce(e, t, n, r, i, a) {
|
|
609
609
|
let o = n === "x" ? e.ruleX : e.ruleY, s = e.border.left + e.padding.left, c = e.border.top + e.padding.top, l = s + e.contentWidth + e.padding.right + e.border.right, u = c + e.contentHeight + e.padding.bottom + e.border.bottom, d = (n, r, i, a, s, c, l, u) => {
|
|
610
610
|
let d = o.style === "double" && i === "double" ? "double" : "solid";
|
|
611
611
|
t.push({
|
|
612
|
-
glyph:
|
|
612
|
+
glyph: _e(d, s, c, l, u, e.glyphs),
|
|
613
613
|
x: n,
|
|
614
614
|
y: r,
|
|
615
615
|
length: 1,
|
|
@@ -626,37 +626,15 @@ function xe(e, t, n, r, i, a) {
|
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
628
|
//#endregion
|
|
629
|
-
//#region src/pointer.ts
|
|
630
|
-
function Se(e, t, n) {
|
|
631
|
-
let r = [], i = e, a = e.localRect.x, o = e.localRect.y;
|
|
632
|
-
for (;;) {
|
|
633
|
-
let e = null;
|
|
634
|
-
for (let r of pe(i)) {
|
|
635
|
-
if (r.tableHidden) continue;
|
|
636
|
-
let i = a + r.localRect.x, s = o + r.localRect.y;
|
|
637
|
-
t >= i && t < i + r.localRect.width && n >= s && n < s + r.localRect.height && (e = r);
|
|
638
|
-
}
|
|
639
|
-
if (!e) return r;
|
|
640
|
-
r.push({
|
|
641
|
-
node: e,
|
|
642
|
-
x: a + e.localRect.x,
|
|
643
|
-
y: o + e.localRect.y
|
|
644
|
-
}), a += e.localRect.x - (e.scroll?.x ?? 0), o += e.localRect.y - (e.scroll?.y ?? 0), i = e;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
function Ce(e, t, n) {
|
|
648
|
-
return Se(e, t, n).map((e) => e.node.source);
|
|
649
|
-
}
|
|
650
|
-
//#endregion
|
|
651
629
|
//#region src/metrics.ts
|
|
652
|
-
function
|
|
630
|
+
function M(e) {
|
|
653
631
|
return (e >= 0 ? Math.floor(e + .5) : -Math.floor(-e + .5)) || 0;
|
|
654
632
|
}
|
|
655
|
-
function
|
|
656
|
-
return t <= 0 ? 0 :
|
|
633
|
+
function N(e, t) {
|
|
634
|
+
return t <= 0 ? 0 : M(e / (.25 * t));
|
|
657
635
|
}
|
|
658
636
|
function we(e, t) {
|
|
659
|
-
return
|
|
637
|
+
return M(t * e / 100);
|
|
660
638
|
}
|
|
661
639
|
function Te(e, t) {
|
|
662
640
|
let n = t.getBoundingClientRect(), r = parseFloat(getComputedStyle(e).letterSpacing) || 0, i = t.ownerDocument.createRange();
|
|
@@ -703,7 +681,7 @@ function Me(e, t, n) {
|
|
|
703
681
|
for (let i = e; i < t; i++) r += n[i] ?? 1;
|
|
704
682
|
return r;
|
|
705
683
|
}
|
|
706
|
-
function
|
|
684
|
+
function P(e, t, n, r = 0) {
|
|
707
685
|
return t <= e ? 0 : Me(e, t, n) - Math.min(r, Ne(t - 1, n));
|
|
708
686
|
}
|
|
709
687
|
function Ne(e, t) {
|
|
@@ -711,7 +689,7 @@ function Ne(e, t) {
|
|
|
711
689
|
}
|
|
712
690
|
function Pe(e, t = {}) {
|
|
713
691
|
let { advances: n, tracking: r = 0 } = t, i = 0;
|
|
714
|
-
for (let t of Re(e, 0, e.length)) for (let a of Ie(e, t.start, t.end)) i = Math.max(i,
|
|
692
|
+
for (let t of Re(e, 0, e.length)) for (let a of Ie(e, t.start, t.end)) i = Math.max(i, P(a.start, a.end, n, r));
|
|
715
693
|
return i;
|
|
716
694
|
}
|
|
717
695
|
function Fe(e, t) {
|
|
@@ -779,7 +757,7 @@ function ze(e, t, n, r, { advances: i, tracking: a = 0 }, o = 0) {
|
|
|
779
757
|
else {
|
|
780
758
|
for (l !== null && (c.push(l), d = 0);;) {
|
|
781
759
|
let n = e;
|
|
782
|
-
for (; n < t &&
|
|
760
|
+
for (; n < t && P(e, n + 1, i, a) <= f();) n++;
|
|
783
761
|
if (n === t || n === e) break;
|
|
784
762
|
c.push({
|
|
785
763
|
start: e,
|
|
@@ -822,7 +800,7 @@ function Ve(e, t, n, r, i) {
|
|
|
822
800
|
afterOccupied: !0
|
|
823
801
|
}), s = [], c = 0;
|
|
824
802
|
for (let e of a) e.start > c && s.push(o(c, e.start)), c = Math.max(c, e.end);
|
|
825
|
-
return c < i && s.push(o(c, i)),
|
|
803
|
+
return c < i && s.push(o(c, i)), xe(s, "intersection", "all", e.style.ruleInset === "overlap-join" ? "overlap-join" : 0);
|
|
826
804
|
}
|
|
827
805
|
function He(e, t) {
|
|
828
806
|
return typeof t != "number" || t <= 0 ? e : e.map((e) => ({
|
|
@@ -832,14 +810,14 @@ function He(e, t) {
|
|
|
832
810
|
})).filter((e) => e.end > e.start);
|
|
833
811
|
}
|
|
834
812
|
function Ue(e, t, n, r, i, a, o) {
|
|
835
|
-
let s = H(e.style, "x", t), c = H(e.style, "y", n), l =
|
|
813
|
+
let s = H(e.style, "x", t), c = H(e.style, "y", n), l = Ze(e).map((e) => {
|
|
836
814
|
let n = W(e.style.margin, t);
|
|
837
815
|
return {
|
|
838
816
|
node: e,
|
|
839
|
-
base:
|
|
817
|
+
base: Xe(e, t, o),
|
|
840
818
|
grow: e.style.flexGrow,
|
|
841
819
|
shrink: e.style.flexShrink,
|
|
842
|
-
min:
|
|
820
|
+
min: et(e, t, o),
|
|
843
821
|
max: G(e.style.maxWidth, t),
|
|
844
822
|
margin: n
|
|
845
823
|
};
|
|
@@ -864,12 +842,12 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
864
842
|
}), m = p.map((e) => e.height), h = c * Math.max(0, p.length - 1), g;
|
|
865
843
|
if (e.style.flexWrap === "nowrap") r === void 0 ? Number.isFinite(n) && (m[0] = Math.max(n, m[0] ?? 0)) : m[0] = r, g = [0];
|
|
866
844
|
else {
|
|
867
|
-
let t = m.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - h) : 0, i =
|
|
845
|
+
let t = m.reduce((e, t) => e + t, 0), r = Number.isFinite(n) ? Math.max(0, n - t - h) : 0, i = Qe(e.style);
|
|
868
846
|
if (i === "stretch" && r > 0) {
|
|
869
|
-
let e =
|
|
847
|
+
let e = I(Array.from({ length: p.length }, () => 1), r);
|
|
870
848
|
for (let t = 0; t < m.length; t++) m[t] += e[t];
|
|
871
|
-
g =
|
|
872
|
-
} else g =
|
|
849
|
+
g = F("start", m, 0);
|
|
850
|
+
} else g = F(i === "stretch" ? "start" : i, m, r);
|
|
873
851
|
}
|
|
874
852
|
for (let i = 0; i < p.length; i++) {
|
|
875
853
|
let { row: a, widths: l, availableForItems: u } = p[i], h = m[i], _ = g[i] + i * c;
|
|
@@ -886,10 +864,10 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
886
864
|
}
|
|
887
865
|
let v = l.reduce((e, t) => e + t, 0), y = Math.max(0, u - v), b = a.reduce((e, t) => e + +(t.margin.left === null) + +(t.margin.right === null), 0), x = Array.from({ length: a.length }, () => 0), S = Array.from({ length: a.length }, () => 0), C;
|
|
888
866
|
if (b > 0 && y > 0) {
|
|
889
|
-
let e =
|
|
867
|
+
let e = I(Array.from({ length: b }, () => 1), y), t = 0;
|
|
890
868
|
for (let n = 0; n < a.length; n++) a[n].margin.left === null && (x[n] = e[t++]), a[n].margin.right === null && (S[n] = e[t++]);
|
|
891
|
-
C =
|
|
892
|
-
} else C =
|
|
869
|
+
C = F("start", l, 0);
|
|
870
|
+
} else C = F($e(e.style), l, y);
|
|
893
871
|
let w = 0;
|
|
894
872
|
for (let t = 0; t < a.length; t++) {
|
|
895
873
|
let n = a[t], r = n.node, i = n.margin.left ?? 0, o = n.margin.right ?? 0;
|
|
@@ -920,7 +898,7 @@ function Ue(e, t, n, r, i, a, o) {
|
|
|
920
898
|
});
|
|
921
899
|
}
|
|
922
900
|
}
|
|
923
|
-
e.decorationRuns =
|
|
901
|
+
e.decorationRuns = Se({
|
|
924
902
|
glyphs: S(e.style.glyphSet),
|
|
925
903
|
ruleX: e.style.ruleX,
|
|
926
904
|
ruleY: e.style.ruleY,
|
|
@@ -947,7 +925,7 @@ function We(e, t, n, r, i) {
|
|
|
947
925
|
});
|
|
948
926
|
}
|
|
949
927
|
function Ge(e, t, n, r, i, a, o) {
|
|
950
|
-
let s = H(e.style, "y", n), c =
|
|
928
|
+
let s = H(e.style, "y", n), c = Ze(e).map((i) => {
|
|
951
929
|
let a = W(i.style.margin, t), s = Math.max(0, t - (a.left ?? 0) - (a.right ?? 0)), c = Ye(i, e) === "stretch";
|
|
952
930
|
B(i, s, r && Number.isFinite(n) ? n : void 0, 0, 0, c ? "fill" : "shrink", o);
|
|
953
931
|
let l = Number.isFinite(n) ? n : void 0, u = i.style.flexBasis, d = u === void 0 || u.kind === "auto" ? i.unclampedHeight : u.kind === "cells" ? u.value : u.kind === "percent" && l !== void 0 ? we(u.value, l) : i.unclampedHeight, f = i.style.minHeight === "auto" ? i.style.overflow.y === "visible" ? i.localRect.height : 0 : void 0;
|
|
@@ -967,10 +945,10 @@ function Ge(e, t, n, r, i, a, o) {
|
|
|
967
945
|
}
|
|
968
946
|
let _ = g.reduce((e, t) => e + t, 0), v = Math.max(0, m - _), y = c.reduce((e, t) => e + +(t.margin.top === null) + +(t.margin.bottom === null), 0), b = Array.from({ length: c.length }, () => 0), x = Array.from({ length: c.length }, () => 0), C;
|
|
969
947
|
if (y > 0 && v > 0) {
|
|
970
|
-
let e =
|
|
948
|
+
let e = I(Array.from({ length: y }, () => 1), v), t = 0;
|
|
971
949
|
for (let n = 0; n < c.length; n++) c[n].margin.top === null && (b[n] = e[t++]), c[n].margin.bottom === null && (x[n] = e[t++]);
|
|
972
|
-
C =
|
|
973
|
-
} else C =
|
|
950
|
+
C = F("start", g, 0);
|
|
951
|
+
} else C = F($e(e.style), g, v);
|
|
974
952
|
let w = i.left + a.left, T = i.top + a.top, E = 0;
|
|
975
953
|
for (let n = 0; n < c.length; n++) {
|
|
976
954
|
let r = c[n], i = r.node, a = r.margin.top ?? 0, o = r.margin.bottom ?? 0;
|
|
@@ -992,7 +970,7 @@ function Ge(e, t, n, r, i, a, o) {
|
|
|
992
970
|
end: t
|
|
993
971
|
});
|
|
994
972
|
}
|
|
995
|
-
e.decorationRuns =
|
|
973
|
+
e.decorationRuns = Se({
|
|
996
974
|
glyphs: S(e.style.glyphSet),
|
|
997
975
|
ruleX: null,
|
|
998
976
|
ruleY: e.style.ruleY,
|
|
@@ -1010,13 +988,13 @@ function Ge(e, t, n, r, i, a, o) {
|
|
|
1010
988
|
}
|
|
1011
989
|
function Ke(e, t, n, r) {
|
|
1012
990
|
let i = e.style.alignSelf === "auto" ? t : e.style.alignSelf, a = r.top ?? 0, o = r.bottom ?? 0, s = n - e.localRect.height, c = r.top === null && r.bottom === null, l = r.top === null && r.bottom !== null, u = r.bottom === null && r.top !== null;
|
|
1013
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
991
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + L(i, n, e.localRect.height);
|
|
1014
992
|
}
|
|
1015
993
|
function qe(e, t, n, r) {
|
|
1016
994
|
let i = e.style.alignSelf === "auto" ? t : e.style.alignSelf, a = r.left ?? 0, o = r.right ?? 0, s = n - e.localRect.width, c = r.left === null && r.right === null, l = r.left === null && r.right !== null, u = r.right === null && r.left !== null;
|
|
1017
|
-
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a +
|
|
995
|
+
return c ? Math.floor(s / 2) : l ? s - o : u ? a : a + L(i, n, e.localRect.width);
|
|
1018
996
|
}
|
|
1019
|
-
function
|
|
997
|
+
function F(e, t, n) {
|
|
1020
998
|
let r = t.length;
|
|
1021
999
|
if (r === 0) return [];
|
|
1022
1000
|
let i = [], a = 0;
|
|
@@ -1026,7 +1004,7 @@ function L(e, t, n) {
|
|
|
1026
1004
|
return i;
|
|
1027
1005
|
}
|
|
1028
1006
|
if ((e === "space-around" || e === "space-evenly") && n > 0) {
|
|
1029
|
-
let o =
|
|
1007
|
+
let o = I(Array.from({ length: r + 1 }, (t, n) => e === "space-evenly" || n === 0 || n === r ? 1 : 2), n);
|
|
1030
1008
|
for (let e = 0; e < r; e++) a += o[e], i.push(a), a += t[e];
|
|
1031
1009
|
return i;
|
|
1032
1010
|
}
|
|
@@ -1044,7 +1022,7 @@ function Je(e, t) {
|
|
|
1044
1022
|
let c = [];
|
|
1045
1023
|
for (let e = 0; e < n; e++) s[e] || c.push(e);
|
|
1046
1024
|
if (c.length === 0) break;
|
|
1047
|
-
let l = o.reduce((e, t, n) => s[n] ? e + t : e, 0), u = c.reduce((e, t) => e + i[t], 0), d = t - l - u, f = a ? Math.max(0, d) : Math.max(0, -d), p =
|
|
1025
|
+
let l = o.reduce((e, t, n) => s[n] ? e + t : e, 0), u = c.reduce((e, t) => e + i[t], 0), d = t - l - u, f = a ? Math.max(0, d) : Math.max(0, -d), p = I(c.map((t) => a ? e[t].grow : i[t] * e[t].shrink), f), m = c.map((e, t) => i[e] + (a ? p[t] : -p[t])), h = c.map((e, t) => r(m[t], e)), g = h.reduce((e, t, n) => e + (t - m[n]), 0);
|
|
1048
1026
|
if (g === 0) {
|
|
1049
1027
|
for (let e = 0; e < c.length; e++) o[c[e]] = h[e];
|
|
1050
1028
|
break;
|
|
@@ -1056,7 +1034,7 @@ function Je(e, t) {
|
|
|
1056
1034
|
}
|
|
1057
1035
|
return o;
|
|
1058
1036
|
}
|
|
1059
|
-
function
|
|
1037
|
+
function I(e, t) {
|
|
1060
1038
|
let n = e.reduce((e, t) => e + t, 0);
|
|
1061
1039
|
if (n === 0 || t <= 0) return e.map(() => 0);
|
|
1062
1040
|
let r = e.map((e) => e / n * t), i = r.map(Math.floor), a = t - i.reduce((e, t) => e + t, 0);
|
|
@@ -1072,32 +1050,35 @@ function R(e, t) {
|
|
|
1072
1050
|
function Ye(e, t) {
|
|
1073
1051
|
return e.style.alignSelf === "auto" ? t.style.alignItems : e.style.alignSelf;
|
|
1074
1052
|
}
|
|
1075
|
-
function
|
|
1053
|
+
function L(e, t, n) {
|
|
1076
1054
|
return e === "center" ? Math.max(0, Math.floor((t - n) / 2)) : e === "end" ? Math.max(0, t - n) : 0;
|
|
1077
1055
|
}
|
|
1078
|
-
function
|
|
1056
|
+
function Xe(e, t, n) {
|
|
1079
1057
|
let r = e.style.flexBasis, i = e.style.width;
|
|
1080
1058
|
return r !== void 0 && r.kind !== "auto" ? K(r, t, e, n) : i !== void 0 && i.kind !== "auto" ? K(i, t, e, n) : q(e, n);
|
|
1081
1059
|
}
|
|
1082
|
-
function
|
|
1060
|
+
function Ze(e) {
|
|
1083
1061
|
let t = e.children.filter((e) => !z(e.style)).sort((e, t) => e.style.order - t.style.order);
|
|
1084
1062
|
return e.style.flexReverse && t.reverse(), t;
|
|
1085
1063
|
}
|
|
1086
|
-
function
|
|
1064
|
+
function Qe(e) {
|
|
1087
1065
|
return e.wrapReverse ? e.alignContent === "start" ? "end" : e.alignContent === "end" ? "start" : e.alignContent : e.alignContent;
|
|
1088
1066
|
}
|
|
1089
|
-
function
|
|
1067
|
+
function $e(e) {
|
|
1090
1068
|
let t = e.justifyContent === "stretch" ? "start" : e.justifyContent;
|
|
1091
1069
|
return e.flexReverse ? t === "start" ? "end" : t === "end" ? "start" : t : t;
|
|
1092
1070
|
}
|
|
1093
|
-
function
|
|
1094
|
-
return e.style.minWidth === "auto" ? e.style.overflow.x === "visible" ?
|
|
1071
|
+
function et(e, t, n) {
|
|
1072
|
+
return e.style.minWidth === "auto" ? e.style.overflow.x === "visible" ? tr(e, n) : 0 : G(e.style.minWidth, t) ?? 0;
|
|
1095
1073
|
}
|
|
1096
1074
|
//#endregion
|
|
1097
1075
|
//#region src/types.ts
|
|
1098
|
-
function
|
|
1076
|
+
function tt(e) {
|
|
1099
1077
|
return e === "auto" || e === "scroll";
|
|
1100
1078
|
}
|
|
1079
|
+
function nt(e) {
|
|
1080
|
+
return e.children.filter((e) => e.inlineBox);
|
|
1081
|
+
}
|
|
1101
1082
|
function rt(e) {
|
|
1102
1083
|
return {
|
|
1103
1084
|
right: e.scrollbarSize.y + e.scrollbarInset.x,
|
|
@@ -1134,8 +1115,8 @@ function at() {
|
|
|
1134
1115
|
justifySelf: "auto",
|
|
1135
1116
|
gridTemplateColumns: { kind: "none" },
|
|
1136
1117
|
gridTemplateRows: { kind: "none" },
|
|
1137
|
-
gridAutoColumns: [
|
|
1138
|
-
gridAutoRows: [
|
|
1118
|
+
gridAutoColumns: [ot()],
|
|
1119
|
+
gridAutoRows: [ot()],
|
|
1139
1120
|
gridAutoFlow: {
|
|
1140
1121
|
direction: "row",
|
|
1141
1122
|
dense: !1
|
|
@@ -1151,7 +1132,7 @@ function at() {
|
|
|
1151
1132
|
minHeight: "auto",
|
|
1152
1133
|
maxWidth: void 0,
|
|
1153
1134
|
maxHeight: void 0,
|
|
1154
|
-
padding:
|
|
1135
|
+
padding: R(),
|
|
1155
1136
|
margin: {
|
|
1156
1137
|
top: 0,
|
|
1157
1138
|
right: 0,
|
|
@@ -1167,7 +1148,7 @@ function at() {
|
|
|
1167
1148
|
},
|
|
1168
1149
|
gapX: 0,
|
|
1169
1150
|
gapY: 0,
|
|
1170
|
-
border:
|
|
1151
|
+
border: R(),
|
|
1171
1152
|
borderStyle: {
|
|
1172
1153
|
top: "solid",
|
|
1173
1154
|
right: "solid",
|
|
@@ -1237,7 +1218,7 @@ function at() {
|
|
|
1237
1218
|
breakInsideAvoid: !1
|
|
1238
1219
|
};
|
|
1239
1220
|
}
|
|
1240
|
-
function
|
|
1221
|
+
function R() {
|
|
1241
1222
|
return {
|
|
1242
1223
|
top: 0,
|
|
1243
1224
|
right: 0,
|
|
@@ -1245,7 +1226,7 @@ function ot() {
|
|
|
1245
1226
|
left: 0
|
|
1246
1227
|
};
|
|
1247
1228
|
}
|
|
1248
|
-
function
|
|
1229
|
+
function ot() {
|
|
1249
1230
|
return {
|
|
1250
1231
|
min: { kind: "auto" },
|
|
1251
1232
|
max: { kind: "auto" }
|
|
@@ -1253,15 +1234,15 @@ function st() {
|
|
|
1253
1234
|
}
|
|
1254
1235
|
//#endregion
|
|
1255
1236
|
//#region src/grid.ts
|
|
1256
|
-
function
|
|
1257
|
-
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap : H(o, "x", t), d = l ? l.gap : H(o, "y", s), f =
|
|
1237
|
+
function st(e, t, n, r, i, a) {
|
|
1238
|
+
let o = e.style, s = Number.isFinite(n) ? n : void 0, c = e.subgrid?.cols, l = e.subgrid?.rows, u = c ? c.gap : H(o, "x", t), d = l ? l.gap : H(o, "y", s), f = _t(e, t, s, u, d, e.subgrid ? {
|
|
1258
1239
|
col: e.subgrid.colSpan,
|
|
1259
1240
|
row: e.subgrid.rowSpan
|
|
1260
|
-
} : void 0), { children: p, placed: m, colLines: h, rowLines: g, colTracks: _, rowTracks: v, colCollapsed: y, rowCollapsed: b } = f, x = p.map((e) => W(e.style.margin, t)), C = p.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), w = p.map(
|
|
1241
|
+
} : void 0), { children: p, placed: m, colLines: h, rowLines: g, colTracks: _, rowTracks: v, colCollapsed: y, rowCollapsed: b } = f, x = p.map((e) => W(e.style.margin, t)), C = p.map((e) => e.style.justifySelf === "auto" ? o.justifyItems : e.style.justifySelf), w = p.map(ct), T = c ? ut(c) : Mt(_, y, dt(f, w, x, a), t, u, o.justifyContent === "stretch"), E = c ? c.positions : Nt(T, t, o.justifyContent), D = [];
|
|
1261
1242
|
for (let e = 0; e < p.length; e++) {
|
|
1262
|
-
let t = p[e], n = m.items[e], r =
|
|
1243
|
+
let t = p[e], n = m.items[e], r = Ft(E, T.sizes, n.col.start, n.col.span), i = x[e], o = Math.max(0, r - xt(i)), s = w[e];
|
|
1263
1244
|
if (s.cols || s.rows) {
|
|
1264
|
-
let e = s.cols ?
|
|
1245
|
+
let e = s.cols ? lt(E, T, u, n.col.start, n.col.span, pt(t, "cols", i, r)) : void 0;
|
|
1265
1246
|
t.subgrid = {
|
|
1266
1247
|
colSpan: n.col.span,
|
|
1267
1248
|
rowSpan: n.row.span,
|
|
@@ -1270,12 +1251,12 @@ function ct(e, t, n, r, i, a) {
|
|
|
1270
1251
|
};
|
|
1271
1252
|
} else t.subgrid = void 0;
|
|
1272
1253
|
let c = C[e], l = i.left === null || i.right === null, d = t.style.width !== void 0 && t.style.width.kind !== "auto";
|
|
1273
|
-
s.cols ? B(t, r, void 0, 0, 0, "fill", a, { width: o }) : c === "stretch" && !l && !d ? B(t, r, void 0, 0, 0, "fill", a, { width: V(o, t.style.minWidth === "auto" ? t.style.overflow.x === "visible" ?
|
|
1254
|
+
s.cols ? B(t, r, void 0, 0, 0, "fill", a, { width: o }) : c === "stretch" && !l && !d ? B(t, r, void 0, 0, 0, "fill", a, { width: V(o, t.style.minWidth === "auto" ? t.style.overflow.x === "visible" ? tr(t, a) : 0 : G(t.style.minWidth, r) ?? 0, Gn(t.style.maxWidth, r, t, a)) }) : B(t, o, void 0, 0, 0, "shrink", a), D.push(t.localRect.width);
|
|
1274
1255
|
}
|
|
1275
|
-
let O = l ?
|
|
1256
|
+
let O = l ? ut(l) : Mt(v, b, ft(f, w, x), s ?? "max-content", d, o.alignContent === "stretch"), k = Pt(O), A = l ? l.positions : Nt(O, s ?? k, o.alignContent), ee = r.left + i.left, te = r.top + i.top;
|
|
1276
1257
|
for (let t = 0; t < p.length; t++) {
|
|
1277
|
-
let n = p[t], r = m.items[t], i = x[t], o =
|
|
1278
|
-
if (w[t].rows) n.subgrid.rows =
|
|
1258
|
+
let n = p[t], r = m.items[t], i = x[t], o = Ft(E, T.sizes, r.col.start, r.col.span), s = Ft(A, O.sizes, r.row.start, r.row.span), c = Math.max(0, s - St(i)), l = Ye(n, e), u = i.top === null || i.bottom === null, f = n.style.height !== void 0 && n.style.height.kind !== "auto";
|
|
1259
|
+
if (w[t].rows) n.subgrid.rows = lt(A, O, d, r.row.start, r.row.span, pt(n, "rows", i, o)), B(n, o, s, 0, 0, "fill", a, {
|
|
1279
1260
|
width: D[t],
|
|
1280
1261
|
height: c
|
|
1281
1262
|
});
|
|
@@ -1288,11 +1269,11 @@ function ct(e, t, n, r, i, a) {
|
|
|
1288
1269
|
} else n.style.height?.kind === "percent" && B(n, o, s, 0, 0, "fill", a, { width: D[t] });
|
|
1289
1270
|
n.localRect = {
|
|
1290
1271
|
...n.localRect,
|
|
1291
|
-
x:
|
|
1292
|
-
y:
|
|
1272
|
+
x: ee + E[r.col.start] + It(C[t], i.left, i.right, o, n.localRect.width),
|
|
1273
|
+
y: te + A[r.row.start] + It(l, i.top, i.bottom, s, n.localRect.height)
|
|
1293
1274
|
};
|
|
1294
1275
|
}
|
|
1295
|
-
let
|
|
1276
|
+
let j = Number.isFinite(n) ? Math.max(n, k) : k;
|
|
1296
1277
|
if (o.ruleX || o.ruleY) {
|
|
1297
1278
|
let n = T.sizes.length, a = O.sizes.length, s = Array.from({ length: n }, () => Array.from({ length: a }, () => !1)), c = Array.from({ length: Math.max(0, n - 1) }, () => Array.from({ length: a }, () => !1)), l = Array.from({ length: Math.max(0, a - 1) }, () => Array.from({ length: n }, () => !1));
|
|
1298
1279
|
for (let e of m.items) for (let t = e.col.start; t < e.col.start + e.col.span && t < n; t++) for (let r = e.row.start; r < e.row.start + e.row.span && r < a; r++) s[t][r] = !0, t + 1 < e.col.start + e.col.span && t < n - 1 && (c[t][r] = !0), r + 1 < e.row.start + e.row.span && r < a - 1 && (l[r][t] = !0);
|
|
@@ -1306,7 +1287,7 @@ function ct(e, t, n, r, i, a) {
|
|
|
1306
1287
|
let r = [];
|
|
1307
1288
|
for (let i = 1; i < e.length; i++) {
|
|
1308
1289
|
let a = e[i - 1] + t[i - 1], s = e[i] - a;
|
|
1309
|
-
if (!(s <= 0)) for (let e of
|
|
1290
|
+
if (!(s <= 0)) for (let e of xe(n(i - 1), o.ruleBreak, o.ruleVisibilityItems, o.ruleInset)) r.push({
|
|
1310
1291
|
bandStart: a,
|
|
1311
1292
|
bandSize: s,
|
|
1312
1293
|
...e
|
|
@@ -1314,40 +1295,40 @@ function ct(e, t, n, r, i, a) {
|
|
|
1314
1295
|
}
|
|
1315
1296
|
return r;
|
|
1316
1297
|
}, f = d(E, T.sizes, (e) => u(e, A, O.sizes, c, (t) => s[e]?.[t] ?? !1, (t) => s[e + 1]?.[t] ?? !1)), p = d(A, O.sizes, (e) => u(e, E, T.sizes, l, (t) => s[t]?.[e] ?? !1, (t) => s[t]?.[e + 1] ?? !1));
|
|
1317
|
-
e.decorationRuns =
|
|
1298
|
+
e.decorationRuns = Se({
|
|
1318
1299
|
glyphs: S(o.glyphSet),
|
|
1319
1300
|
ruleX: o.ruleX,
|
|
1320
1301
|
ruleY: o.ruleY,
|
|
1321
1302
|
vertical: f,
|
|
1322
1303
|
horizontal: p,
|
|
1323
1304
|
contentWidth: t,
|
|
1324
|
-
contentHeight:
|
|
1305
|
+
contentHeight: j,
|
|
1325
1306
|
border: r,
|
|
1326
1307
|
borderStyle: o.borderStyle,
|
|
1327
1308
|
borderColor: o.borderColor,
|
|
1328
1309
|
padding: i
|
|
1329
1310
|
});
|
|
1330
1311
|
}
|
|
1331
|
-
let
|
|
1332
|
-
if (
|
|
1312
|
+
let ne = e.children.filter((e) => z(e.style));
|
|
1313
|
+
if (ne.length > 0) {
|
|
1333
1314
|
let e = z(o) ? {
|
|
1334
1315
|
x: r.left,
|
|
1335
1316
|
y: r.top,
|
|
1336
1317
|
width: i.left + t + i.right,
|
|
1337
|
-
height: i.top +
|
|
1318
|
+
height: i.top + j + i.bottom
|
|
1338
1319
|
} : {
|
|
1339
|
-
x:
|
|
1340
|
-
y:
|
|
1320
|
+
x: ee,
|
|
1321
|
+
y: te,
|
|
1341
1322
|
width: t,
|
|
1342
|
-
height:
|
|
1323
|
+
height: j
|
|
1343
1324
|
};
|
|
1344
|
-
for (let n of
|
|
1345
|
-
let r =
|
|
1325
|
+
for (let n of ne) {
|
|
1326
|
+
let r = ht(n.style.gridColumnStart, n.style.gridColumnEnd, h, m.colOrigin, E, T.sizes, -i.left, t + i.right), a = ht(n.style.gridRowStart, n.style.gridRowEnd, g, m.rowOrigin, A, O.sizes, -i.top, j + i.bottom);
|
|
1346
1327
|
n.staticSlot = {
|
|
1347
1328
|
kind: "grid",
|
|
1348
1329
|
area: {
|
|
1349
|
-
x:
|
|
1350
|
-
y:
|
|
1330
|
+
x: ee + r.start,
|
|
1331
|
+
y: te + a.start,
|
|
1351
1332
|
width: Math.max(0, r.end - r.start),
|
|
1352
1333
|
height: Math.max(0, a.end - a.start)
|
|
1353
1334
|
},
|
|
@@ -1355,16 +1336,16 @@ function ct(e, t, n, r, i, a) {
|
|
|
1355
1336
|
};
|
|
1356
1337
|
}
|
|
1357
1338
|
}
|
|
1358
|
-
return
|
|
1339
|
+
return j;
|
|
1359
1340
|
}
|
|
1360
|
-
function
|
|
1341
|
+
function ct(e) {
|
|
1361
1342
|
let t = e.style.display === "grid";
|
|
1362
1343
|
return {
|
|
1363
1344
|
cols: t && e.style.gridTemplateColumns.kind === "subgrid",
|
|
1364
1345
|
rows: t && e.style.gridTemplateRows.kind === "subgrid"
|
|
1365
1346
|
};
|
|
1366
1347
|
}
|
|
1367
|
-
function
|
|
1348
|
+
function lt(e, t, n, r, i, a) {
|
|
1368
1349
|
let o = e[r] + a.start, s = t.sizes.slice(r, r + i);
|
|
1369
1350
|
return s[0] = Math.max(0, s[0] - a.start), s[i - 1] = Math.max(0, s[i - 1] - a.end), {
|
|
1370
1351
|
positions: Array.from({ length: i }, (t, n) => n === 0 ? 0 : e[r + n] - o),
|
|
@@ -1373,20 +1354,20 @@ function ut(e, t, n, r, i, a) {
|
|
|
1373
1354
|
gap: n
|
|
1374
1355
|
};
|
|
1375
1356
|
}
|
|
1376
|
-
function
|
|
1357
|
+
function ut(e) {
|
|
1377
1358
|
return {
|
|
1378
1359
|
sizes: e.sizes,
|
|
1379
1360
|
gapBefore: e.gapBefore,
|
|
1380
1361
|
limits: e.sizes
|
|
1381
1362
|
};
|
|
1382
1363
|
}
|
|
1383
|
-
function
|
|
1364
|
+
function dt(e, t, n, r) {
|
|
1384
1365
|
let i = [];
|
|
1385
1366
|
return e.children.forEach((a, o) => {
|
|
1386
1367
|
let s = e.placed.items[o], c = n[o];
|
|
1387
1368
|
if (t[o].cols) {
|
|
1388
|
-
let e =
|
|
1389
|
-
for (let t of
|
|
1369
|
+
let e = pt(a, "cols", c, 0);
|
|
1370
|
+
for (let t of mt(a, "cols", s, e, r)) i.push({
|
|
1390
1371
|
...t,
|
|
1391
1372
|
start: t.start + s.col.start
|
|
1392
1373
|
});
|
|
@@ -1395,24 +1376,24 @@ function ft(e, t, n, r) {
|
|
|
1395
1376
|
i.push({
|
|
1396
1377
|
start: s.col.start,
|
|
1397
1378
|
span: s.col.span,
|
|
1398
|
-
min: J(a, "min", r) +
|
|
1399
|
-
max: J(a, "max", r) +
|
|
1379
|
+
min: J(a, "min", r) + xt(c),
|
|
1380
|
+
max: J(a, "max", r) + xt(c)
|
|
1400
1381
|
});
|
|
1401
1382
|
}), i;
|
|
1402
1383
|
}
|
|
1403
|
-
function
|
|
1384
|
+
function ft(e, t, n) {
|
|
1404
1385
|
let r = [];
|
|
1405
1386
|
return e.children.forEach((i, a) => {
|
|
1406
1387
|
let o = e.placed.items[a], s = n[a];
|
|
1407
1388
|
if (t[a].rows) {
|
|
1408
|
-
let e =
|
|
1409
|
-
for (let t of
|
|
1389
|
+
let e = pt(i, "rows", s, 0);
|
|
1390
|
+
for (let t of mt(i, "rows", o, e)) r.push({
|
|
1410
1391
|
...t,
|
|
1411
1392
|
start: t.start + o.row.start
|
|
1412
1393
|
});
|
|
1413
1394
|
return;
|
|
1414
1395
|
}
|
|
1415
|
-
let c = i.localRect.height +
|
|
1396
|
+
let c = i.localRect.height + St(s), l = i.style.minHeight === "auto" && i.style.overflow.y !== "visible" ? St(s) : c;
|
|
1416
1397
|
r.push({
|
|
1417
1398
|
start: o.row.start,
|
|
1418
1399
|
span: o.row.span,
|
|
@@ -1421,7 +1402,7 @@ function pt(e, t, n) {
|
|
|
1421
1402
|
});
|
|
1422
1403
|
}), r;
|
|
1423
1404
|
}
|
|
1424
|
-
function
|
|
1405
|
+
function pt(e, t, n, r) {
|
|
1425
1406
|
let { border: i, padding: a } = e.style;
|
|
1426
1407
|
return t === "cols" ? {
|
|
1427
1408
|
start: (n.left ?? 0) + i.left + U(a.left, r),
|
|
@@ -1431,15 +1412,15 @@ function mt(e, t, n, r) {
|
|
|
1431
1412
|
end: (n.bottom ?? 0) + i.bottom + U(a.bottom, r)
|
|
1432
1413
|
};
|
|
1433
1414
|
}
|
|
1434
|
-
function
|
|
1435
|
-
let a = t === "cols" ? n.col.span : n.row.span, o =
|
|
1415
|
+
function mt(e, t, n, r, i) {
|
|
1416
|
+
let a = t === "cols" ? n.col.span : n.row.span, o = _t(e, void 0, void 0, 0, 0, {
|
|
1436
1417
|
col: n.col.span,
|
|
1437
1418
|
row: n.row.span
|
|
1438
1419
|
}), s = [];
|
|
1439
1420
|
if (o.children.forEach((e, n) => {
|
|
1440
1421
|
let c = o.placed.items[n], l = t === "cols" ? c.col : c.row, u = l.start === 0, d = l.start + l.span === a, f = (u ? r.start : 0) + (d ? r.end : 0), p = W(e.style.margin, 0);
|
|
1441
|
-
if (
|
|
1442
|
-
let n =
|
|
1422
|
+
if (ct(e)[t]) {
|
|
1423
|
+
let n = pt(e, t, p, 0), a = mt(e, t, c, {
|
|
1443
1424
|
start: n.start + (u ? r.start : 0),
|
|
1444
1425
|
end: n.end + (d ? r.end : 0)
|
|
1445
1426
|
}, i);
|
|
@@ -1452,11 +1433,11 @@ function ht(e, t, n, r, i) {
|
|
|
1452
1433
|
if (t === "cols") s.push({
|
|
1453
1434
|
start: l.start,
|
|
1454
1435
|
span: l.span,
|
|
1455
|
-
min: J(e, "min", i) +
|
|
1456
|
-
max: J(e, "max", i) +
|
|
1436
|
+
min: J(e, "min", i) + xt(p) + f,
|
|
1437
|
+
max: J(e, "max", i) + xt(p) + f
|
|
1457
1438
|
});
|
|
1458
1439
|
else {
|
|
1459
|
-
let t = e.localRect.height +
|
|
1440
|
+
let t = e.localRect.height + St(p) + f;
|
|
1460
1441
|
s.push({
|
|
1461
1442
|
start: l.start,
|
|
1462
1443
|
span: l.span,
|
|
@@ -1475,9 +1456,9 @@ function ht(e, t, n, r, i) {
|
|
|
1475
1456
|
}
|
|
1476
1457
|
return s;
|
|
1477
1458
|
}
|
|
1478
|
-
function
|
|
1479
|
-
let c =
|
|
1480
|
-
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l =
|
|
1459
|
+
function ht(e, t, n, r, i, a, o, s) {
|
|
1460
|
+
let c = Ot(e, "start", n), l = Ot(t, "end", n);
|
|
1461
|
+
c !== null && l !== null ? c > l ? [c, l] = [l, c] : c === l && (l = null) : c !== null && t.kind === "span" ? l = kt(c, t, 1, n) : l !== null && e.kind === "span" && (c = kt(l, e, -1, n));
|
|
1481
1462
|
let u = i.length, d = (e) => {
|
|
1482
1463
|
if (e === null) return;
|
|
1483
1464
|
let t = e - r;
|
|
@@ -1488,22 +1469,22 @@ function gt(e, t, n, r, i, a, o, s) {
|
|
|
1488
1469
|
end: h === void 0 ? s : p(h)
|
|
1489
1470
|
};
|
|
1490
1471
|
}
|
|
1491
|
-
function
|
|
1472
|
+
function gt(e, t) {
|
|
1492
1473
|
let n = t.gridIntrinsic.get(e);
|
|
1493
1474
|
if (n !== void 0) return n;
|
|
1494
|
-
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a =
|
|
1475
|
+
let r = e.style, i = Math.max(typeof r.gapX == "number" ? r.gapX : 0, r.ruleX?.width ?? 0), a = _t(e, void 0, void 0, i, 0, e.subgrid ? {
|
|
1495
1476
|
col: e.subgrid.colSpan,
|
|
1496
1477
|
row: e.subgrid.rowSpan
|
|
1497
|
-
} : void 0), o = a.children.map(
|
|
1478
|
+
} : void 0), o = a.children.map(ct), s = a.children.map((e) => W(e.style.margin, 0)), c = Mt(a.colTracks, a.colCollapsed, dt(a, o, s, t), "min-content", i, !1), l = c.gapBefore.reduce((e, t) => e + t, 0), u = {
|
|
1498
1479
|
min: c.sizes.reduce((e, t) => e + t, 0) + l,
|
|
1499
1480
|
max: c.limits.reduce((e, t) => e + t, 0) + l
|
|
1500
1481
|
};
|
|
1501
1482
|
return t.gridIntrinsic.set(e, u), u;
|
|
1502
1483
|
}
|
|
1503
|
-
function
|
|
1504
|
-
let o = e.style, s =
|
|
1484
|
+
function _t(e, t, n, r, i, a) {
|
|
1485
|
+
let o = e.style, s = bt(e), c = o.gridTemplateColumns.kind === "subgrid" && a !== void 0, l = o.gridTemplateRows.kind === "subgrid" && a !== void 0, u = c ? vt(a.col) : Ct(o.gridTemplateColumns, t, r), d = l ? vt(a.row) : Ct(o.gridTemplateRows, n, i), f = o.gridTemplateAreas, p = [...u.tracks], m = [...d.tracks];
|
|
1505
1486
|
if (f) {
|
|
1506
|
-
c ||
|
|
1487
|
+
c || Tt(p, u.lineNames, f.columns, o.gridAutoColumns), l || Tt(m, d.lineNames, f.rows, o.gridAutoRows);
|
|
1507
1488
|
for (let [e, t] of f.areas) u.lineNames[Math.min(t.colStart, p.length)].push(`${e}-start`), u.lineNames[Math.min(t.colEnd, p.length)].push(`${e}-end`), d.lineNames[Math.min(t.rowStart, m.length)].push(`${e}-start`), d.lineNames[Math.min(t.rowEnd, m.length)].push(`${e}-end`);
|
|
1508
1489
|
}
|
|
1509
1490
|
let h = {
|
|
@@ -1512,28 +1493,28 @@ function vt(e, t, n, r, i, a) {
|
|
|
1512
1493
|
}, g = {
|
|
1513
1494
|
explicitCount: m.length,
|
|
1514
1495
|
names: d.lineNames
|
|
1515
|
-
}, _ =
|
|
1516
|
-
col:
|
|
1517
|
-
row:
|
|
1496
|
+
}, _ = jt(s.map((e) => ({
|
|
1497
|
+
col: At(e.style.gridColumnStart, e.style.gridColumnEnd, h),
|
|
1498
|
+
row: At(e.style.gridRowStart, e.style.gridRowEnd, g)
|
|
1518
1499
|
})), p.length, m.length, o.gridAutoFlow);
|
|
1519
|
-
return c &&
|
|
1500
|
+
return c && yt(_, "col", p.length), l && yt(_, "row", m.length), {
|
|
1520
1501
|
children: s,
|
|
1521
1502
|
placed: _,
|
|
1522
1503
|
colLines: h,
|
|
1523
1504
|
rowLines: g,
|
|
1524
|
-
colTracks:
|
|
1525
|
-
rowTracks:
|
|
1526
|
-
colCollapsed:
|
|
1527
|
-
rowCollapsed:
|
|
1505
|
+
colTracks: Et(p, _.colOrigin, _.colCount, o.gridAutoColumns),
|
|
1506
|
+
rowTracks: Et(m, _.rowOrigin, _.rowCount, o.gridAutoRows),
|
|
1507
|
+
colCollapsed: Dt(u, _.colOrigin, _.colCount, _.items.map((e) => e.col)),
|
|
1508
|
+
rowCollapsed: Dt(d, _.rowOrigin, _.rowCount, _.items.map((e) => e.row))
|
|
1528
1509
|
};
|
|
1529
1510
|
}
|
|
1530
|
-
function
|
|
1511
|
+
function vt(e) {
|
|
1531
1512
|
return {
|
|
1532
|
-
tracks: Array.from({ length: e }, () =>
|
|
1513
|
+
tracks: Array.from({ length: e }, () => ot()),
|
|
1533
1514
|
lineNames: Array.from({ length: e + 1 }, () => [])
|
|
1534
1515
|
};
|
|
1535
1516
|
}
|
|
1536
|
-
function
|
|
1517
|
+
function yt(e, t, n) {
|
|
1537
1518
|
let r = t === "col" ? e.colOrigin : e.rowOrigin;
|
|
1538
1519
|
for (let i of e.items) {
|
|
1539
1520
|
let e = i[t], a = Math.min(Math.max(e.start + r, 0), n - 1), o = Math.min(Math.max(e.start + r + e.span, a + 1), n);
|
|
@@ -1541,16 +1522,16 @@ function bt(e, t, n) {
|
|
|
1541
1522
|
}
|
|
1542
1523
|
t === "col" ? (e.colOrigin = 0, e.colCount = n) : (e.rowOrigin = 0, e.rowCount = n);
|
|
1543
1524
|
}
|
|
1544
|
-
function
|
|
1525
|
+
function bt(e) {
|
|
1545
1526
|
return e.children.filter((e) => !z(e.style) && !e.inlineBox).sort((e, t) => e.style.order - t.style.order);
|
|
1546
1527
|
}
|
|
1547
|
-
function
|
|
1528
|
+
function xt(e) {
|
|
1548
1529
|
return (e.left ?? 0) + (e.right ?? 0);
|
|
1549
1530
|
}
|
|
1550
|
-
function
|
|
1531
|
+
function St(e) {
|
|
1551
1532
|
return (e.top ?? 0) + (e.bottom ?? 0);
|
|
1552
1533
|
}
|
|
1553
|
-
function
|
|
1534
|
+
function Ct(e, t, n) {
|
|
1554
1535
|
if (e.kind !== "tracks") return {
|
|
1555
1536
|
tracks: [],
|
|
1556
1537
|
lineNames: [[]]
|
|
@@ -1563,7 +1544,7 @@ function wt(e, t, n) {
|
|
|
1563
1544
|
let { index: i, tracks: a, mode: o } = e.autoRepeat, s = 1;
|
|
1564
1545
|
if (t !== void 0) {
|
|
1565
1546
|
let e = a.reduce((e, n) => {
|
|
1566
|
-
let r =
|
|
1547
|
+
let r = wt(n.min, t) ?? wt(n.max, t) ?? 1;
|
|
1567
1548
|
return e + Math.max(1, r);
|
|
1568
1549
|
}, 0);
|
|
1569
1550
|
s = Math.max(1, Math.floor((t + n) / (e + n * a.length)));
|
|
@@ -1591,23 +1572,23 @@ function wt(e, t, n) {
|
|
|
1591
1572
|
lineNames: d
|
|
1592
1573
|
};
|
|
1593
1574
|
}
|
|
1594
|
-
function
|
|
1575
|
+
function wt(e, t) {
|
|
1595
1576
|
if (e.kind === "cells") return e.value;
|
|
1596
1577
|
if (e.kind === "percent" && t !== void 0) return we(e.value, t);
|
|
1597
1578
|
if (e.kind === "math") {
|
|
1598
1579
|
let n = [];
|
|
1599
1580
|
for (let r of e.args) {
|
|
1600
|
-
let e =
|
|
1581
|
+
let e = wt(r, t);
|
|
1601
1582
|
if (e === void 0) return;
|
|
1602
1583
|
n.push(e);
|
|
1603
1584
|
}
|
|
1604
1585
|
return e.fn === "min" ? Math.min(...n) : Math.max(...n);
|
|
1605
1586
|
}
|
|
1606
1587
|
}
|
|
1607
|
-
function
|
|
1588
|
+
function Tt(e, t, n, r) {
|
|
1608
1589
|
for (let i = e.length; i < n; i++) e.push(r[(i - e.length) % r.length]), t.push([]);
|
|
1609
1590
|
}
|
|
1610
|
-
function
|
|
1591
|
+
function Et(e, t, n, r) {
|
|
1611
1592
|
let i = [];
|
|
1612
1593
|
for (let a = 0; a < n; a++) {
|
|
1613
1594
|
let n = a + t;
|
|
@@ -1619,7 +1600,7 @@ function Dt(e, t, n, r) {
|
|
|
1619
1600
|
}
|
|
1620
1601
|
return i;
|
|
1621
1602
|
}
|
|
1622
|
-
function
|
|
1603
|
+
function Dt(e, t, n, r) {
|
|
1623
1604
|
let i = Array.from({ length: n }, () => !1);
|
|
1624
1605
|
if (!e.autoFit) return i;
|
|
1625
1606
|
for (let a = e.autoFit.start; a < e.autoFit.end; a++) {
|
|
@@ -1628,7 +1609,7 @@ function Ot(e, t, n, r) {
|
|
|
1628
1609
|
}
|
|
1629
1610
|
return i;
|
|
1630
1611
|
}
|
|
1631
|
-
function
|
|
1612
|
+
function Ot(e, t, n) {
|
|
1632
1613
|
if (e.kind === "line") return e.value > 0 ? e.value - 1 : n.explicitCount + 1 + e.value;
|
|
1633
1614
|
if (e.kind !== "name") return null;
|
|
1634
1615
|
if (e.nth === void 0) {
|
|
@@ -1643,14 +1624,14 @@ function kt(e, t, n) {
|
|
|
1643
1624
|
for (let t = i; t >= 0; t--) if (n.names[t].includes(e.name) && ++a === -r) return t;
|
|
1644
1625
|
return -(-r - a);
|
|
1645
1626
|
}
|
|
1646
|
-
function
|
|
1627
|
+
function kt(e, t, n, r) {
|
|
1647
1628
|
if (t.name === void 0) return e + n * t.value;
|
|
1648
1629
|
let i = t.value, a = e;
|
|
1649
1630
|
for (; i > 0;) a += n, (!(a >= 0 && a <= r.explicitCount) || r.names[a].includes(t.name)) && i--;
|
|
1650
1631
|
return a;
|
|
1651
1632
|
}
|
|
1652
|
-
function
|
|
1653
|
-
let r =
|
|
1633
|
+
function At(e, t, n) {
|
|
1634
|
+
let r = Ot(e, "start", n), i = Ot(t, "end", n);
|
|
1654
1635
|
if (r !== null && i !== null) return r === i ? {
|
|
1655
1636
|
start: r,
|
|
1656
1637
|
span: 1
|
|
@@ -1660,10 +1641,10 @@ function jt(e, t, n) {
|
|
|
1660
1641
|
};
|
|
1661
1642
|
if (r !== null) return {
|
|
1662
1643
|
start: r,
|
|
1663
|
-
span: (t.kind === "span" ?
|
|
1644
|
+
span: (t.kind === "span" ? kt(r, t, 1, n) : r + 1) - r
|
|
1664
1645
|
};
|
|
1665
1646
|
if (i !== null) {
|
|
1666
|
-
let t = e.kind === "span" ?
|
|
1647
|
+
let t = e.kind === "span" ? kt(i, e, -1, n) : i - 1;
|
|
1667
1648
|
return {
|
|
1668
1649
|
start: t,
|
|
1669
1650
|
span: i - t
|
|
@@ -1674,7 +1655,7 @@ function jt(e, t, n) {
|
|
|
1674
1655
|
span: e.kind === "span" ? e.value : t.kind === "span" ? t.value : 1
|
|
1675
1656
|
};
|
|
1676
1657
|
}
|
|
1677
|
-
function
|
|
1658
|
+
function jt(e, t, n, r) {
|
|
1678
1659
|
let i = r.direction === "row", a = e.map((e) => i ? e.row : e.col), o = e.map((e) => i ? e.col : e.row), s = i ? t : n, c = i ? n : t, l = 0, u = Math.max(s, 1);
|
|
1679
1660
|
for (let t = 0; t < e.length; t++) {
|
|
1680
1661
|
let e = o[t];
|
|
@@ -1771,7 +1752,7 @@ function Mt(e, t, n, r) {
|
|
|
1771
1752
|
rowCount: S
|
|
1772
1753
|
};
|
|
1773
1754
|
}
|
|
1774
|
-
function
|
|
1755
|
+
function Mt(e, t, n, r, i, a) {
|
|
1775
1756
|
let o = typeof r == "number" ? r : void 0, s = e.map((e, n) => {
|
|
1776
1757
|
if (t[n]) return {
|
|
1777
1758
|
base: 0,
|
|
@@ -1781,7 +1762,7 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1781
1762
|
frFactor: 0,
|
|
1782
1763
|
collapsed: !0
|
|
1783
1764
|
};
|
|
1784
|
-
let r =
|
|
1765
|
+
let r = wt(e.min, o), i = r ?? 0, a = r === void 0, s = e.max;
|
|
1785
1766
|
if (s.kind === "fr") return {
|
|
1786
1767
|
base: i,
|
|
1787
1768
|
limit: null,
|
|
@@ -1790,7 +1771,7 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1790
1771
|
frFactor: s.value,
|
|
1791
1772
|
collapsed: !1
|
|
1792
1773
|
};
|
|
1793
|
-
let c =
|
|
1774
|
+
let c = wt(s, o);
|
|
1794
1775
|
return c === void 0 ? {
|
|
1795
1776
|
base: i,
|
|
1796
1777
|
limit: null,
|
|
@@ -1824,7 +1805,7 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1824
1805
|
if (n.length === 0) continue;
|
|
1825
1806
|
let i = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - i;
|
|
1826
1807
|
if (a > 0) {
|
|
1827
|
-
let e = n.reduce((e, t) => e + t.frFactor, 0), t =
|
|
1808
|
+
let e = n.reduce((e, t) => e + t.frFactor, 0), t = I(n.map((t) => e > 0 ? t.frFactor : 1), a);
|
|
1828
1809
|
n.forEach((e, n) => {
|
|
1829
1810
|
e.base += t[n];
|
|
1830
1811
|
});
|
|
@@ -1835,7 +1816,7 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1835
1816
|
if (i.length > 0) {
|
|
1836
1817
|
let n = t.reduce((e, t) => e + t.base, 0) + r, a = e.min - n;
|
|
1837
1818
|
if (a > 0) {
|
|
1838
|
-
let e =
|
|
1819
|
+
let e = I(i.map(() => 1), a);
|
|
1839
1820
|
i.forEach((t, n) => {
|
|
1840
1821
|
t.base += e[n];
|
|
1841
1822
|
});
|
|
@@ -1846,7 +1827,7 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1846
1827
|
if (e.length === 0) continue;
|
|
1847
1828
|
let a = i - (t.reduce((e, t) => e + u(t), 0) + r);
|
|
1848
1829
|
if (a > 0) {
|
|
1849
|
-
let t =
|
|
1830
|
+
let t = I(e.map(() => 1), a);
|
|
1850
1831
|
e.forEach((e, n) => {
|
|
1851
1832
|
e.limit = u(e) + t[n];
|
|
1852
1833
|
});
|
|
@@ -1868,7 +1849,7 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1868
1849
|
n <= 0 || (t = Math.max(t, (e.max - r) / Math.max(n, 1)));
|
|
1869
1850
|
}
|
|
1870
1851
|
for (let n of e) {
|
|
1871
|
-
let e = Math.max(n.base,
|
|
1852
|
+
let e = Math.max(n.base, M(n.frFactor * t));
|
|
1872
1853
|
n.limit = e, r === "max-content" && (n.base = e);
|
|
1873
1854
|
}
|
|
1874
1855
|
}
|
|
@@ -1878,7 +1859,7 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1878
1859
|
for (; !(t <= 0);) {
|
|
1879
1860
|
let e = s.filter((e) => !e.collapsed && e.limitKind !== "fr" && e.base < u(e));
|
|
1880
1861
|
if (e.length === 0) break;
|
|
1881
|
-
let n =
|
|
1862
|
+
let n = I(e.map(() => 1), t), r = 0;
|
|
1882
1863
|
if (e.forEach((e, t) => {
|
|
1883
1864
|
let i = Math.min(n[t], u(e) - e.base);
|
|
1884
1865
|
e.base += i, r += i;
|
|
@@ -1888,7 +1869,7 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1888
1869
|
if (n.length > 0) {
|
|
1889
1870
|
let t = Math.max(0, o - e - s.reduce((e, t) => e + (t.limitKind === "fr" ? 0 : t.base), 0)), r = n, i = t, a = n.reduce((e, t) => e + t.frFactor, 0);
|
|
1890
1871
|
for (a < 1 && (i = Math.floor(i * a));;) {
|
|
1891
|
-
let e =
|
|
1872
|
+
let e = I(r.map((e) => e.frFactor), i), t = r.filter((t, n) => e[n] < t.base);
|
|
1892
1873
|
if (t.length === 0) {
|
|
1893
1874
|
r.forEach((t, n) => {
|
|
1894
1875
|
t.base = Math.max(t.base, e[n]);
|
|
@@ -1902,7 +1883,7 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1902
1883
|
if (a) {
|
|
1903
1884
|
let t = o - e - s.reduce((e, t) => e + t.base, 0), n = s.filter((e) => !e.collapsed && e.limitKind === "intrinsic-max");
|
|
1904
1885
|
if (t > 0 && n.length > 0) {
|
|
1905
|
-
let e =
|
|
1886
|
+
let e = I(n.map(() => 1), t);
|
|
1906
1887
|
n.forEach((t, n) => {
|
|
1907
1888
|
t.base += e[n];
|
|
1908
1889
|
});
|
|
@@ -1915,65 +1896,65 @@ function Nt(e, t, n, r, i, a) {
|
|
|
1915
1896
|
limits: s.map((e) => u(e))
|
|
1916
1897
|
};
|
|
1917
1898
|
}
|
|
1918
|
-
function
|
|
1919
|
-
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t -
|
|
1899
|
+
function Nt(e, t, n) {
|
|
1900
|
+
let { sizes: r, gapBefore: i } = e, a = Math.max(0, t - Pt(e)), o = F(n === "stretch" ? "start" : n, r, a), s = [], c = 0;
|
|
1920
1901
|
for (let e = 0; e < r.length; e++) c += i[e], s.push(o[e] + c);
|
|
1921
1902
|
return s;
|
|
1922
1903
|
}
|
|
1923
|
-
function
|
|
1904
|
+
function Pt(e) {
|
|
1924
1905
|
return e.sizes.reduce((e, t) => e + t, 0) + e.gapBefore.reduce((e, t) => e + t, 0);
|
|
1925
1906
|
}
|
|
1926
|
-
function
|
|
1907
|
+
function Ft(e, t, n, r) {
|
|
1927
1908
|
let i = n + r - 1;
|
|
1928
1909
|
return e[n] === void 0 || e[i] === void 0 ? 0 : e[i] + t[i] - e[n];
|
|
1929
1910
|
}
|
|
1930
|
-
function
|
|
1911
|
+
function It(e, t, n, r, i) {
|
|
1931
1912
|
let a = t ?? 0, o = n ?? 0, s = r - i;
|
|
1932
|
-
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a +
|
|
1913
|
+
return t === null && n === null ? Math.floor(s / 2) : t === null ? s - o : n === null ? a : a + L(e, r, i + a + o);
|
|
1933
1914
|
}
|
|
1934
1915
|
//#endregion
|
|
1935
1916
|
//#region src/multicol.ts
|
|
1936
|
-
function
|
|
1917
|
+
function Lt(e, t, n) {
|
|
1937
1918
|
let r = e.columnWidth === null ? null : Math.max(1, Math.floor((t + n) / (e.columnWidth + n)));
|
|
1938
1919
|
return e.columnCount !== null && r !== null ? Math.max(1, Math.min(e.columnCount, r)) : r === null ? Math.max(1, e.columnCount ?? 1) : r;
|
|
1939
1920
|
}
|
|
1940
|
-
function
|
|
1941
|
-
let r =
|
|
1921
|
+
function Rt(e, t, n) {
|
|
1922
|
+
let r = Lt(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r)), a = Math.max(0, t - (r * i + (r - 1) * n));
|
|
1942
1923
|
return Array.from({ length: r }, (e, t) => i + +(t < a));
|
|
1943
1924
|
}
|
|
1944
|
-
function
|
|
1925
|
+
function zt(e, t) {
|
|
1945
1926
|
let n = Math.max(typeof e.gapX == "number" ? e.gapX : 0, e.ruleX?.width ?? 0);
|
|
1946
1927
|
return e.columnCount === null ? Math.max(e.columnWidth ?? 1, t) : e.columnCount * t + (e.columnCount - 1) * n;
|
|
1947
1928
|
}
|
|
1948
|
-
function
|
|
1929
|
+
function Bt(e, t) {
|
|
1949
1930
|
return e === void 0 ? t : t === void 0 ? e : Math.min(e, t);
|
|
1950
1931
|
}
|
|
1951
|
-
function
|
|
1932
|
+
function Vt(e, t, n) {
|
|
1952
1933
|
for (; e < t;) {
|
|
1953
1934
|
let r = e + t >> 1;
|
|
1954
1935
|
n(r) ? t = r : e = r + 1;
|
|
1955
1936
|
}
|
|
1956
1937
|
return e;
|
|
1957
1938
|
}
|
|
1958
|
-
function
|
|
1959
|
-
let r =
|
|
1939
|
+
function Ht(e, t, n) {
|
|
1940
|
+
let r = Lt(e, t, n), i = Math.max(1, Math.floor((t - (r - 1) * n) / r));
|
|
1960
1941
|
return {
|
|
1961
1942
|
count: r,
|
|
1962
1943
|
width: i,
|
|
1963
1944
|
leftover: Math.max(0, t - (r * i + (r - 1) * n))
|
|
1964
1945
|
};
|
|
1965
1946
|
}
|
|
1966
|
-
function
|
|
1947
|
+
function Ut(e, t, n) {
|
|
1967
1948
|
return e === "all" ? !0 : e === "around" ? t || n : t && n;
|
|
1968
1949
|
}
|
|
1969
|
-
function
|
|
1970
|
-
let i =
|
|
1950
|
+
function Wt(e, t, n, r) {
|
|
1951
|
+
let i = Hn(e, Math.max(1, t.width - e.style.tracking)), { heights: a, textOffsets: o } = Un(e, i), s = e.style.lineGap, c = Kt(a.map((e) => e + s)), l;
|
|
1971
1952
|
if (e.style.columnFill === "auto" && r !== void 0) l = Math.max(1, r);
|
|
1972
1953
|
else {
|
|
1973
|
-
let e =
|
|
1954
|
+
let e = Vt(c.reduce((e, t) => Math.max(e, t.rows - s), 1), Math.max(1, c.reduce((e, t) => e + t.rows, 0) - s), (e) => Gt(c, s, e).columns <= t.count);
|
|
1974
1955
|
l = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
1975
1956
|
}
|
|
1976
|
-
let u =
|
|
1957
|
+
let u = Gt(c, s, l);
|
|
1977
1958
|
return {
|
|
1978
1959
|
spans: i,
|
|
1979
1960
|
lineY: u.top,
|
|
@@ -1986,7 +1967,7 @@ function Gt(e, t, n, r) {
|
|
|
1986
1967
|
columnsUsed: i.length > 0 ? u.columns : 0
|
|
1987
1968
|
};
|
|
1988
1969
|
}
|
|
1989
|
-
function
|
|
1970
|
+
function Gt(e, t, n, r = "truncate") {
|
|
1990
1971
|
let i = 0, a = 0, o = 0, s = [], c = [];
|
|
1991
1972
|
for (let l = 0; l < e.length; l++) {
|
|
1992
1973
|
let u = e[l], d = r === "glue" || l === 0 || a > 0 ? u.pre : 0;
|
|
@@ -2007,7 +1988,7 @@ function Kt(e, t, n, r = "truncate") {
|
|
|
2007
1988
|
top: c
|
|
2008
1989
|
};
|
|
2009
1990
|
}
|
|
2010
|
-
function
|
|
1991
|
+
function Kt(e) {
|
|
2011
1992
|
return e.map((e) => ({
|
|
2012
1993
|
rows: e,
|
|
2013
1994
|
pre: 0,
|
|
@@ -2016,27 +1997,27 @@ function qt(e) {
|
|
|
2016
1997
|
lines: 1
|
|
2017
1998
|
}));
|
|
2018
1999
|
}
|
|
2019
|
-
var
|
|
2020
|
-
function
|
|
2021
|
-
if (
|
|
2000
|
+
var qt = null;
|
|
2001
|
+
function Jt() {
|
|
2002
|
+
if (qt !== null) return qt;
|
|
2022
2003
|
let e = document.createElement("div");
|
|
2023
2004
|
e.style.cssText = "position:absolute;left:-9999px;visibility:hidden;columns:2;column-gap:0;column-fill:balance;width:200px;font:10px/20px monospace;orphans:1;widows:1", e.innerHTML = "<div style=\"margin:0;padding:0 0 20px 0\">aaaaaa aaaaaa aaaaaa</div><div style=\"margin:0\"><span>bbbbbb</span> bbbbbb</div>", document.body.appendChild(e);
|
|
2024
2005
|
let t = e.getBoundingClientRect().top, n = e.querySelector("span").getBoundingClientRect();
|
|
2025
|
-
return e.remove(),
|
|
2006
|
+
return e.remove(), qt = !(n.width > 0 && n.top - t >= 10), qt;
|
|
2026
2007
|
}
|
|
2027
|
-
function
|
|
2008
|
+
function Yt(e, t) {
|
|
2028
2009
|
let { columnWidth: n, columnCount: r, tracking: i = 0, lineGap: a = 0, restrictingHeight: o } = t, s = i > 0 ? Array.from(e, () => 1 + i) : void 0, c = je(e, Math.max(1, n - i), {
|
|
2029
2010
|
advances: s,
|
|
2030
2011
|
tracking: i,
|
|
2031
2012
|
firstLineIndent: t.firstLineIndent
|
|
2032
|
-
}), l =
|
|
2013
|
+
}), l = Kt(c.map(() => 1 + a)), u = Gt(l, a, o ?? Vt(1, Math.max(1, c.length * (1 + a) - a), (e) => Gt(l, a, e).columns <= r));
|
|
2033
2014
|
return c.map((t, n) => ({
|
|
2034
2015
|
text: e.slice(t.start, t.end),
|
|
2035
2016
|
column: u.column[n],
|
|
2036
2017
|
top: u.top[n]
|
|
2037
2018
|
}));
|
|
2038
2019
|
}
|
|
2039
|
-
function
|
|
2020
|
+
function Xt(e, t, n, r) {
|
|
2040
2021
|
let i = e.style;
|
|
2041
2022
|
if (!i.ruleX) return;
|
|
2042
2023
|
let a = t.columnCount * t.columnWidth + (t.columnCount - 1) * t.gap, o = t.ruleSegments ?? [{
|
|
@@ -2046,14 +2027,14 @@ function Zt(e, t, n, r) {
|
|
|
2046
2027
|
}], s = [];
|
|
2047
2028
|
for (let e of o) {
|
|
2048
2029
|
let n = Math.min(e.columns, t.columnCount);
|
|
2049
|
-
for (let r = 0; r < t.columnCount - 1; r++)
|
|
2030
|
+
for (let r = 0; r < t.columnCount - 1; r++) Ut(i.ruleVisibilityItems, r < n, r + 1 < n) && s.push({
|
|
2050
2031
|
bandStart: (r + 1) * t.columnWidth + r * t.gap,
|
|
2051
2032
|
bandSize: t.gap,
|
|
2052
2033
|
start: e.start,
|
|
2053
2034
|
end: e.end
|
|
2054
2035
|
});
|
|
2055
2036
|
}
|
|
2056
|
-
e.decorationRuns =
|
|
2037
|
+
e.decorationRuns = Se({
|
|
2057
2038
|
glyphs: S(i.glyphSet),
|
|
2058
2039
|
ruleX: i.ruleX,
|
|
2059
2040
|
ruleY: null,
|
|
@@ -2067,12 +2048,12 @@ function Zt(e, t, n, r) {
|
|
|
2067
2048
|
padding: r
|
|
2068
2049
|
});
|
|
2069
2050
|
}
|
|
2070
|
-
function
|
|
2051
|
+
function Zt(e, t) {
|
|
2071
2052
|
let n = e.style, r = n.padding;
|
|
2072
2053
|
return e.text !== "" && e.children.length === 0 && n.display === "block" && n.position === "static" && !n.columnSpan && n.whiteSpace === "normal" && n.lineGap === t.lineGap && n.border.top === 0 && n.border.right === 0 && n.border.bottom === 0 && n.border.left === 0 && r.top === 0 && r.right === 0 && r.bottom === 0 && r.left === 0 && n.backgroundColor === void 0 && !n.backgroundClear && n.overflow.x === "visible" && n.overflow.y === "visible" && (n.width === void 0 || n.width.kind === "auto") && (n.height === void 0 || n.height.kind === "auto") && (n.minWidth === "auto" || n.minWidth === 0 || n.minWidth === void 0) && (n.minHeight === "auto" || n.minHeight === 0 || n.minHeight === void 0) && n.maxWidth === void 0 && n.maxHeight === void 0;
|
|
2073
2054
|
}
|
|
2074
|
-
function
|
|
2075
|
-
let s = e.style, c = H(s, "x", n), l =
|
|
2055
|
+
function Qt(e, t, n, r, i, a, o) {
|
|
2056
|
+
let s = e.style, c = H(s, "x", n), l = Ht(s, n, c);
|
|
2076
2057
|
a.right += l.leftover;
|
|
2077
2058
|
let u = s.lineGap, d = i.left + a.left, f = i.top + a.top, p = n - l.leftover, m = [[]], h = [];
|
|
2078
2059
|
for (let e of t) e.style.columnSpan ? (h[m.length - 1] = e, m.push([])) : m[m.length - 1].push(e);
|
|
@@ -2082,13 +2063,13 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2082
2063
|
if (t.length > 0) {
|
|
2083
2064
|
let i = t.map((e) => ({
|
|
2084
2065
|
node: e,
|
|
2085
|
-
spans:
|
|
2066
|
+
spans: Hn(e, Math.max(1, l.width - e.style.tracking)),
|
|
2086
2067
|
margin: W(e.style.margin, l.width),
|
|
2087
2068
|
pre: 0,
|
|
2088
2069
|
post: 0
|
|
2089
2070
|
})), a = [], o = null, h = null, x = !1;
|
|
2090
2071
|
for (let e of i) {
|
|
2091
|
-
let { node: t, spans: n, margin: r } = e, i = o === null ? r.top ?? 0 :
|
|
2072
|
+
let { node: t, spans: n, margin: r } = e, i = o === null ? r.top ?? 0 : Jn(o, r.top ?? 0), s = i;
|
|
2092
2073
|
_ === "glue" && h !== null ? (s = 0, h.post = i, a[a.length - 1].post = i) : e.pre = i;
|
|
2093
2074
|
let c = x || t.style.breakBeforeColumn;
|
|
2094
2075
|
if (t.style.breakInsideAvoid && n.length > 0) a.push({
|
|
@@ -2111,10 +2092,10 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2111
2092
|
let S;
|
|
2112
2093
|
if (s.columnFill === "auto" && r !== void 0) S = Math.max(1, r);
|
|
2113
2094
|
else {
|
|
2114
|
-
let e =
|
|
2095
|
+
let e = Vt(1, Math.max(1, Gt(a, u, Infinity, _).maxUsed), (e) => Gt(a, u, e, _).columns <= l.count);
|
|
2115
2096
|
S = r === void 0 ? e : Math.max(1, Math.min(e, r));
|
|
2116
2097
|
}
|
|
2117
|
-
let C =
|
|
2098
|
+
let C = Gt(a, u, S, _);
|
|
2118
2099
|
for (let e = 0, t = 0; e < i.length; e++) {
|
|
2119
2100
|
let { node: n, spans: r, margin: a, pre: o, post: s } = i[e], u = [], m = [];
|
|
2120
2101
|
for (let e = 0; e < r.length; e++, t++) u.push(y + C.top[t]), m.push(C.column[t] * (l.width + c));
|
|
@@ -2155,7 +2136,7 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2155
2136
|
if (i) {
|
|
2156
2137
|
let e = W(i.style.margin, p), t = (e.left ?? 0) + (e.right ?? 0);
|
|
2157
2138
|
B(i, Math.max(0, p - t), void 0, 0, 0, "fill", o);
|
|
2158
|
-
let r =
|
|
2139
|
+
let r = qn(e, p, i.localRect.width), a = (e.top ?? 0) + n;
|
|
2159
2140
|
y += a, i.localRect = {
|
|
2160
2141
|
...i.localRect,
|
|
2161
2142
|
x: d + r,
|
|
@@ -2194,10 +2175,10 @@ function $t(e, t, n, r, i, a, o) {
|
|
|
2194
2175
|
} : {}
|
|
2195
2176
|
}, x;
|
|
2196
2177
|
}
|
|
2197
|
-
function
|
|
2198
|
-
let s = e.style, c =
|
|
2199
|
-
if (u.length > 0 && u.every((e) =>
|
|
2200
|
-
let f = H(s, "x", t), p =
|
|
2178
|
+
function $t(e, t, n, r, i, a, o) {
|
|
2179
|
+
let s = e.style, c = Bt(n, r), l = e.children.filter((e) => !z(e.style)), u = l.filter((e) => !e.style.columnSpan), d = l.reduce((e, t, n) => !t.style.columnSpan && (n === 0 || l[n - 1].style.columnSpan) ? e + 1 : e, 0);
|
|
2180
|
+
if (u.length > 0 && u.every((e) => Zt(e, s)) && (u.length === l.length || s.columnFill === "balance" && c === void 0 && (Jt() || d <= 1 && u.every((e) => (e.style.margin.top === 0 || e.style.margin.top === null) && (e.style.margin.bottom === 0 || e.style.margin.bottom === null))))) return Qt(e, l, t, c, i, a, o);
|
|
2181
|
+
let f = H(s, "x", t), p = Rt(s, t, f), m = p.length, h = [];
|
|
2201
2182
|
{
|
|
2202
2183
|
let e = 0;
|
|
2203
2184
|
for (let t of p) h.push(e), e += t + f;
|
|
@@ -2206,7 +2187,7 @@ function en(e, t, n, r, i, a, o) {
|
|
|
2206
2187
|
let r = 0, i = 0, a = null, s = 0, c = (e) => {
|
|
2207
2188
|
if (t) for (let t of T) {
|
|
2208
2189
|
if (t.index !== e) continue;
|
|
2209
|
-
let n = a === null ? t.margin.top ?? 0 :
|
|
2190
|
+
let n = a === null ? t.margin.top ?? 0 : Jn(a, t.margin.top ?? 0);
|
|
2210
2191
|
t.child.staticSlot = {
|
|
2211
2192
|
kind: "block",
|
|
2212
2193
|
x: y + g(r) + (t.margin.left ?? 0),
|
|
@@ -2217,7 +2198,7 @@ function en(e, t, n, r, i, a, o) {
|
|
|
2217
2198
|
for (let l = 0; l < w.length; l++) {
|
|
2218
2199
|
let u = w[l];
|
|
2219
2200
|
c(l);
|
|
2220
|
-
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 :
|
|
2201
|
+
let d = a === null ? l === 0 ? u.margin.top ?? 0 : 0 : Jn(a, u.margin.top ?? 0), f = u.node.localRect.height;
|
|
2221
2202
|
if (a !== null && (u.breakBefore || i + d + f > e) && (r += 1, i = 0, a = null, d = 0), t) {
|
|
2222
2203
|
let e = u.node, t = _(r);
|
|
2223
2204
|
if (t !== v) {
|
|
@@ -2226,7 +2207,7 @@ function en(e, t, n, r, i, a, o) {
|
|
|
2226
2207
|
}
|
|
2227
2208
|
e.localRect = {
|
|
2228
2209
|
...e.localRect,
|
|
2229
|
-
x: y + g(r) +
|
|
2210
|
+
x: y + g(r) + qn(u.margin, t, e.localRect.width),
|
|
2230
2211
|
y: b + C + i + d
|
|
2231
2212
|
};
|
|
2232
2213
|
}
|
|
@@ -2249,13 +2230,13 @@ function en(e, t, n, r, i, a, o) {
|
|
|
2249
2230
|
let e = c === void 0 ? void 0 : Math.max(1, c - C), t = s.columnFill === "auto" && e !== void 0, r;
|
|
2250
2231
|
if (t) r = e;
|
|
2251
2232
|
else {
|
|
2252
|
-
let t =
|
|
2233
|
+
let t = Vt(1, D(Infinity, !1).maxUsed, (e) => D(e, !1).columns <= m);
|
|
2253
2234
|
r = e === void 0 ? t : Math.min(t, e);
|
|
2254
2235
|
}
|
|
2255
2236
|
let i = D(r, !0), a = t && n !== void 0 ? Math.max(i.maxUsed, r) : i.maxUsed;
|
|
2256
2237
|
if (s.ruleX) for (let e = 0; e < m - 1; e++) {
|
|
2257
2238
|
let t = Math.min(i.columns, m);
|
|
2258
|
-
|
|
2239
|
+
Ut(s.ruleVisibilityItems, e < t, e + 1 < t) && x.push({
|
|
2259
2240
|
bandStart: h[e] + p[e],
|
|
2260
2241
|
bandSize: f,
|
|
2261
2242
|
start: C,
|
|
@@ -2278,7 +2259,7 @@ function en(e, t, n, r, i, a, o) {
|
|
|
2278
2259
|
let e = W(r.style.margin, t), i = (e.left ?? 0) + (e.right ?? 0);
|
|
2279
2260
|
B(r, Math.max(0, t - i), n, 0, 0, "fill", o), C += e.top ?? 0, r.localRect = {
|
|
2280
2261
|
...r.localRect,
|
|
2281
|
-
x: y +
|
|
2262
|
+
x: y + qn(e, t, r.localRect.width),
|
|
2282
2263
|
y: b + C
|
|
2283
2264
|
}, C += r.localRect.height + (e.bottom ?? 0);
|
|
2284
2265
|
continue;
|
|
@@ -2290,7 +2271,7 @@ function en(e, t, n, r, i, a, o) {
|
|
|
2290
2271
|
breakBefore: E || r.style.breakBeforeColumn
|
|
2291
2272
|
}), E = r.style.breakAfterColumn;
|
|
2292
2273
|
}
|
|
2293
|
-
return O(), s.ruleX && x.length > 0 && (e.decorationRuns =
|
|
2274
|
+
return O(), s.ruleX && x.length > 0 && (e.decorationRuns = Se({
|
|
2294
2275
|
glyphs: S(s.glyphSet),
|
|
2295
2276
|
ruleX: s.ruleX,
|
|
2296
2277
|
ruleY: null,
|
|
@@ -2306,32 +2287,32 @@ function en(e, t, n, r, i, a, o) {
|
|
|
2306
2287
|
}
|
|
2307
2288
|
//#endregion
|
|
2308
2289
|
//#region src/table.ts
|
|
2309
|
-
function
|
|
2310
|
-
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" &&
|
|
2290
|
+
function en(e, t) {
|
|
2291
|
+
e.hidden.push(t), t.style.tableRole !== "column" && t.style.tableRole !== "column-group" && j(t.source, "Table content outside the expected structure (rows in tables, cells in rows) can't be laid out and was hidden — no anonymous table boxes (specs/table.md).");
|
|
2311
2292
|
}
|
|
2312
|
-
function
|
|
2293
|
+
function tn(e, t) {
|
|
2313
2294
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
2314
2295
|
return Number.isNaN(n) ? 1 : t === "colspan" ? Math.min(1e3, Math.max(1, n)) : Math.min(65534, Math.max(0, n));
|
|
2315
2296
|
}
|
|
2316
|
-
function
|
|
2297
|
+
function nn(e, t, n) {
|
|
2317
2298
|
let r = (t, r) => {
|
|
2318
2299
|
let i = t.style.width, a = i && i.kind !== "auto" && i.kind !== "percent" ? K(i, 0, t, n) : void 0, o = i && i.kind === "percent" ? i.value : void 0;
|
|
2319
2300
|
for (let t = 0; t < r; t++) e.colFixed.push(a), e.colPercent.push(o);
|
|
2320
2301
|
};
|
|
2321
2302
|
if (t.style.tableRole === "column") {
|
|
2322
|
-
r(t,
|
|
2303
|
+
r(t, rn(t.source));
|
|
2323
2304
|
return;
|
|
2324
2305
|
}
|
|
2325
2306
|
let i = t.children.filter((e) => e.style.tableRole === "column");
|
|
2326
|
-
if (i.length === 0) r(t,
|
|
2327
|
-
else for (let e of i) r(e,
|
|
2328
|
-
for (let n of t.children) n.style.tableRole !== "column" &&
|
|
2307
|
+
if (i.length === 0) r(t, rn(t.source));
|
|
2308
|
+
else for (let e of i) r(e, rn(e.source));
|
|
2309
|
+
for (let n of t.children) n.style.tableRole !== "column" && en(e, n);
|
|
2329
2310
|
}
|
|
2330
|
-
function
|
|
2311
|
+
function rn(e) {
|
|
2331
2312
|
let t = Number.parseInt(e.getAttribute("span") ?? "", 10);
|
|
2332
2313
|
return Number.isNaN(t) ? 1 : Math.min(1e3, Math.max(1, t));
|
|
2333
2314
|
}
|
|
2334
|
-
function
|
|
2315
|
+
function an(e, t) {
|
|
2335
2316
|
let n = {
|
|
2336
2317
|
caption: null,
|
|
2337
2318
|
rows: [],
|
|
@@ -2355,8 +2336,8 @@ function on(e, t) {
|
|
|
2355
2336
|
for (let e of o.children) z(e.style) || (e.style.tableRole === "row" ? t.push({
|
|
2356
2337
|
row: e,
|
|
2357
2338
|
group: o
|
|
2358
|
-
}) :
|
|
2359
|
-
} else e === "caption" ? n.caption === null ? n.caption = o :
|
|
2339
|
+
}) : en(n, e));
|
|
2340
|
+
} else e === "caption" ? n.caption === null ? n.caption = o : en(n, o) : e === "column" || e === "column-group" ? (nn(n, o, t), n.hidden.push(o)) : en(n, o);
|
|
2360
2341
|
}
|
|
2361
2342
|
let o = [
|
|
2362
2343
|
...r,
|
|
@@ -2371,20 +2352,20 @@ function on(e, t) {
|
|
|
2371
2352
|
s = e + 1;
|
|
2372
2353
|
}
|
|
2373
2354
|
}
|
|
2374
|
-
return
|
|
2355
|
+
return on(n), n;
|
|
2375
2356
|
}
|
|
2376
|
-
function
|
|
2357
|
+
function on(e) {
|
|
2377
2358
|
let t = [];
|
|
2378
2359
|
for (let n = 0; n < e.rows.length; n++) {
|
|
2379
2360
|
let r = e.rows[n], i = 0;
|
|
2380
2361
|
for (let a of r.children) {
|
|
2381
2362
|
if (z(a.style)) continue;
|
|
2382
2363
|
if (a.style.tableRole !== "cell") {
|
|
2383
|
-
|
|
2364
|
+
en(e, a);
|
|
2384
2365
|
continue;
|
|
2385
2366
|
}
|
|
2386
2367
|
for (; (t[i] ?? 0) > n;) i++;
|
|
2387
|
-
let o =
|
|
2368
|
+
let o = tn(a.source, "colspan"), s = tn(a.source, "rowspan"), c = e.groupEnds[n], l = Math.max(1, Math.min(s === 0 ? c - n : s, c - n));
|
|
2388
2369
|
for (let e = i; e < i + o; e++) t[e] = Math.max(t[e] ?? 0, n + l);
|
|
2389
2370
|
e.cells.push({
|
|
2390
2371
|
node: a,
|
|
@@ -2398,8 +2379,8 @@ function sn(e) {
|
|
|
2398
2379
|
}
|
|
2399
2380
|
e.columnCount = Math.max(t.length, e.colFixed.length);
|
|
2400
2381
|
}
|
|
2401
|
-
function
|
|
2402
|
-
let r = e.style, i =
|
|
2382
|
+
function sn(e, t, n) {
|
|
2383
|
+
let r = e.style, i = tr(e, n), a;
|
|
2403
2384
|
if (t === "min") a = i;
|
|
2404
2385
|
else {
|
|
2405
2386
|
let t = r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" ? K(r.width, 0, e, n) : void 0;
|
|
@@ -2408,11 +2389,11 @@ function cn(e, t, n) {
|
|
|
2408
2389
|
let o = typeof r.minWidth == "number" ? r.minWidth : 0, s = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
2409
2390
|
return Math.max(0, V(a, o, s));
|
|
2410
2391
|
}
|
|
2411
|
-
function
|
|
2392
|
+
function cn(e) {
|
|
2412
2393
|
let t = e.style.width;
|
|
2413
2394
|
return t && t.kind === "percent" ? t.value : void 0;
|
|
2414
2395
|
}
|
|
2415
|
-
function
|
|
2396
|
+
function ln(e, t, n) {
|
|
2416
2397
|
let r = e.columnCount, i = Array.from({ length: r }, () => 0), a = Array.from({ length: r }, () => 0), o = Array.from({ length: r }, () => void 0);
|
|
2417
2398
|
for (let t = 0; t < r; t++) e.colFixed[t] !== void 0 && (a[t] = e.colFixed[t]), o[t] = e.colPercent[t];
|
|
2418
2399
|
let s = [];
|
|
@@ -2421,17 +2402,17 @@ function un(e, t, n) {
|
|
|
2421
2402
|
s.push(t);
|
|
2422
2403
|
continue;
|
|
2423
2404
|
}
|
|
2424
|
-
i[t.col] = Math.max(i[t.col],
|
|
2425
|
-
let e =
|
|
2405
|
+
i[t.col] = Math.max(i[t.col], sn(t.node, "min", n)), a[t.col] = Math.max(a[t.col], sn(t.node, "max", n));
|
|
2406
|
+
let e = cn(t.node);
|
|
2426
2407
|
e !== void 0 && (o[t.col] = Math.max(o[t.col] ?? 0, e));
|
|
2427
2408
|
}
|
|
2428
2409
|
s.sort((e, t) => e.colSpan - t.colSpan);
|
|
2429
2410
|
for (let e of s) {
|
|
2430
|
-
let r = e.col, o = e.col + e.colSpan, s =
|
|
2411
|
+
let r = e.col, o = e.col + e.colSpan, s = gn(t, r, o), c = a.slice(r, o);
|
|
2431
2412
|
for (let t of ["min", "max"]) {
|
|
2432
|
-
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d =
|
|
2413
|
+
let l = t === "min" ? i : a, u = l.slice(r, o).reduce((e, t) => e + t, 0) + s, d = sn(e.node, t, n) - u;
|
|
2433
2414
|
if (d <= 0) continue;
|
|
2434
|
-
let f =
|
|
2415
|
+
let f = I(c.some((e) => e > 0) ? c : c.map(() => 1), d);
|
|
2435
2416
|
for (let e = r; e < o; e++) l[e] += f[e - r];
|
|
2436
2417
|
}
|
|
2437
2418
|
}
|
|
@@ -2442,7 +2423,7 @@ function un(e, t, n) {
|
|
|
2442
2423
|
percent: o
|
|
2443
2424
|
};
|
|
2444
2425
|
}
|
|
2445
|
-
function
|
|
2426
|
+
function un(e, t) {
|
|
2446
2427
|
let n = e.min.length, r = e.min.slice(), i = [], a = [];
|
|
2447
2428
|
for (let t = 0; t < n; t++) (e.percent[t] === void 0 ? a : i).push(t);
|
|
2448
2429
|
if (i.length > 0) {
|
|
@@ -2453,32 +2434,32 @@ function dn(e, t) {
|
|
|
2453
2434
|
}
|
|
2454
2435
|
let s = a.reduce((t, n) => t + e.min[n], 0), c = i.reduce((e, t) => e + r[t], 0) - (t - s);
|
|
2455
2436
|
if (c > 0) {
|
|
2456
|
-
let t = i.map((t) => r[t] - e.min[t]), n =
|
|
2437
|
+
let t = i.map((t) => r[t] - e.min[t]), n = I(t, Math.min(c, t.reduce((e, t) => e + t, 0)));
|
|
2457
2438
|
i.forEach((e, t) => r[e] -= n[t]);
|
|
2458
2439
|
}
|
|
2459
2440
|
}
|
|
2460
2441
|
let o = t - r.reduce((e, t) => e + t, 0);
|
|
2461
2442
|
if (o > 0 && a.length > 0) {
|
|
2462
|
-
let t = a.map((t) => e.max[t] - e.min[t]), n = t.reduce((e, t) => e + t, 0), i =
|
|
2443
|
+
let t = a.map((t) => e.max[t] - e.min[t]), n = t.reduce((e, t) => e + t, 0), i = I(t, Math.min(o, n));
|
|
2463
2444
|
a.forEach((e, t) => r[e] += i[t]), o -= Math.min(o, n);
|
|
2464
2445
|
}
|
|
2465
2446
|
if (o > 0) {
|
|
2466
2447
|
let t = a.length > 0 ? a : i;
|
|
2467
2448
|
if (t.length > 0) {
|
|
2468
|
-
let n = t.map((t) => e.max[t]), i =
|
|
2449
|
+
let n = t.map((t) => e.max[t]), i = I(n.some((e) => e > 0) ? n : n.map(() => 1), o);
|
|
2469
2450
|
t.forEach((e, t) => r[e] += i[t]);
|
|
2470
2451
|
}
|
|
2471
2452
|
}
|
|
2472
2453
|
return r;
|
|
2473
2454
|
}
|
|
2474
|
-
function
|
|
2455
|
+
function dn(e, t, n) {
|
|
2475
2456
|
let r = e.columnCount, i = Array.from({ length: r }, () => void 0);
|
|
2476
2457
|
for (let n = 0; n < r; n++) e.colFixed[n] === void 0 ? e.colPercent[n] !== void 0 && (i[n] = Math.max(0, Math.round(t * e.colPercent[n] / 100))) : i[n] = e.colFixed[n];
|
|
2477
2458
|
for (let r of e.cells) {
|
|
2478
2459
|
if (r.row !== 0) continue;
|
|
2479
2460
|
let e = r.node.style, a;
|
|
2480
2461
|
if (e.width && e.width.kind === "percent" ? a = Math.max(0, Math.round(t * e.width.value / 100)) : e.width && e.width.kind !== "auto" && (a = K(e.width, 0, r.node, n)), a === void 0) continue;
|
|
2481
|
-
let o =
|
|
2462
|
+
let o = I(Array.from({ length: r.colSpan }, () => 1), a);
|
|
2482
2463
|
for (let e = 0; e < r.colSpan; e++) {
|
|
2483
2464
|
let t = r.col + e;
|
|
2484
2465
|
i[t] === void 0 && (i[t] = o[e]);
|
|
@@ -2486,18 +2467,18 @@ function fn(e, t, n) {
|
|
|
2486
2467
|
}
|
|
2487
2468
|
let a = i.reduce((e, t) => e + (t ?? 0), 0), o = i.filter((e) => e === void 0).length;
|
|
2488
2469
|
if (o > 0) {
|
|
2489
|
-
let e =
|
|
2470
|
+
let e = I(Array.from({ length: o }, () => 1), Math.max(0, t - a)), n = 0;
|
|
2490
2471
|
for (let t = 0; t < r; t++) i[t] === void 0 && (i[t] = e[n++]);
|
|
2491
2472
|
}
|
|
2492
2473
|
return i.map((e) => e ?? 0);
|
|
2493
2474
|
}
|
|
2494
|
-
var
|
|
2475
|
+
var fn = {
|
|
2495
2476
|
double: 3,
|
|
2496
2477
|
solid: 2,
|
|
2497
2478
|
dashed: 1,
|
|
2498
2479
|
dotted: 0
|
|
2499
2480
|
};
|
|
2500
|
-
function
|
|
2481
|
+
function pn(e) {
|
|
2501
2482
|
for (let { border: t, side: n } of e) if (t?.hidden[n]) return null;
|
|
2502
2483
|
let t = null;
|
|
2503
2484
|
for (let { border: n, side: r } of e) {
|
|
@@ -2505,7 +2486,7 @@ function mn(e) {
|
|
|
2505
2486
|
let e = n.width[r];
|
|
2506
2487
|
if (e <= 0) continue;
|
|
2507
2488
|
let i = n.style[r];
|
|
2508
|
-
(t === null || e > t.width || e === t.width &&
|
|
2489
|
+
(t === null || e > t.width || e === t.width && fn[i] > fn[t.style]) && (t = {
|
|
2509
2490
|
width: e,
|
|
2510
2491
|
style: i,
|
|
2511
2492
|
color: n.color[r]
|
|
@@ -2513,7 +2494,7 @@ function mn(e) {
|
|
|
2513
2494
|
}
|
|
2514
2495
|
return t;
|
|
2515
2496
|
}
|
|
2516
|
-
function
|
|
2497
|
+
function mn(e, t) {
|
|
2517
2498
|
let n = t.columnCount, r = t.rows.length, i = e.style.borderCollapse, a = {
|
|
2518
2499
|
collapsed: i,
|
|
2519
2500
|
vLines: Array.from({ length: n + 1 }, () => 0),
|
|
@@ -2558,7 +2539,7 @@ function hn(e, t) {
|
|
|
2558
2539
|
side: u
|
|
2559
2540
|
});
|
|
2560
2541
|
}
|
|
2561
|
-
i.push(
|
|
2542
|
+
i.push(pn(l));
|
|
2562
2543
|
}
|
|
2563
2544
|
a.vSegments.push(i), a.vLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
2564
2545
|
}
|
|
@@ -2597,47 +2578,47 @@ function hn(e, t) {
|
|
|
2597
2578
|
}), e === r && l.push({
|
|
2598
2579
|
border: s,
|
|
2599
2580
|
side: "bottom"
|
|
2600
|
-
}), i.push(
|
|
2581
|
+
}), i.push(pn(l));
|
|
2601
2582
|
}
|
|
2602
2583
|
a.hSegments.push(i), a.hLines[e] = i.reduce((e, t) => Math.max(e, t?.width ?? 0), 0);
|
|
2603
2584
|
}
|
|
2604
2585
|
return a;
|
|
2605
2586
|
}
|
|
2606
|
-
function
|
|
2587
|
+
function hn(e, t) {
|
|
2607
2588
|
return e.collapsed ? e.vLines.reduce((e, t) => e + t, 0) : (t + 1) * e.spacingX;
|
|
2608
2589
|
}
|
|
2609
|
-
function
|
|
2590
|
+
function gn(e, t, n) {
|
|
2610
2591
|
if (!e.collapsed) return e.spacingX * (n - t - 1);
|
|
2611
2592
|
let r = 0;
|
|
2612
2593
|
for (let i = t + 1; i < n; i++) r += e.vLines[i];
|
|
2613
2594
|
return r;
|
|
2614
2595
|
}
|
|
2615
|
-
function
|
|
2596
|
+
function _n(e, t, n) {
|
|
2616
2597
|
if (!e.collapsed) return e.spacingY * (n - t - 1);
|
|
2617
2598
|
let r = 0;
|
|
2618
2599
|
for (let i = t + 1; i < n; i++) r += e.hLines[i];
|
|
2619
2600
|
return r;
|
|
2620
2601
|
}
|
|
2621
|
-
function
|
|
2602
|
+
function vn(e, t) {
|
|
2622
2603
|
let n = t.tableData.get(e);
|
|
2623
2604
|
if (n) return n;
|
|
2624
|
-
let r =
|
|
2605
|
+
let r = an(e, t), i = mn(e, r), a = {
|
|
2625
2606
|
structure: r,
|
|
2626
2607
|
chrome: i,
|
|
2627
|
-
bounds:
|
|
2628
|
-
chromeX:
|
|
2608
|
+
bounds: ln(r, i, t),
|
|
2609
|
+
chromeX: hn(i, r.columnCount)
|
|
2629
2610
|
};
|
|
2630
2611
|
return t.tableData.set(e, a), a;
|
|
2631
2612
|
}
|
|
2632
|
-
function
|
|
2633
|
-
let { structure: n, bounds: r, chromeX: i } =
|
|
2634
|
-
return n.caption && (a = Math.max(a,
|
|
2613
|
+
function yn(e, t) {
|
|
2614
|
+
let { structure: n, bounds: r, chromeX: i } = vn(e, t), a = r.min.reduce((e, t) => e + t, 0) + i, o = r.max.reduce((e, t) => e + t, 0) + i;
|
|
2615
|
+
return n.caption && (a = Math.max(a, tr(n.caption, t)), o = Math.max(o, q(n.caption, t))), {
|
|
2635
2616
|
min: a,
|
|
2636
2617
|
max: o
|
|
2637
2618
|
};
|
|
2638
2619
|
}
|
|
2639
|
-
function
|
|
2640
|
-
let r = e.style, { bounds: i, chromeX: a } =
|
|
2620
|
+
function bn(e, t, n) {
|
|
2621
|
+
let r = e.style, { bounds: i, chromeX: a } = vn(e, n), { min: o, max: s } = yn(e, n), c = r.border.left + r.border.right + U(r.padding.left, t) + U(r.padding.right, t) + it(r).right, l = i.max.reduce((e, t) => e + t, 0), u = 0, d = 0;
|
|
2641
2622
|
for (let e = 0; e < i.max.length; e++) {
|
|
2642
2623
|
let t = i.percent[e];
|
|
2643
2624
|
t === void 0 ? d += i.max[e] : u += t;
|
|
@@ -2653,8 +2634,8 @@ function xn(e, t, n) {
|
|
|
2653
2634
|
let f = Math.max(l + a, s) + c;
|
|
2654
2635
|
return Math.max(o + c, Math.min(f, t));
|
|
2655
2636
|
}
|
|
2656
|
-
function
|
|
2657
|
-
let { structure: o, chrome: s, bounds: c } =
|
|
2637
|
+
function xn(e, t, n, r, i, a) {
|
|
2638
|
+
let { structure: o, chrome: s, bounds: c } = vn(e, a), l = o.columnCount, u = o.rows.length, d = r.left + i.left, f = r.top + i.top;
|
|
2658
2639
|
for (let e of o.hidden) e.tableHidden = !0, e.localRect = {
|
|
2659
2640
|
x: 0,
|
|
2660
2641
|
y: 0,
|
|
@@ -2666,13 +2647,13 @@ function Sn(e, t, n, r, i, a) {
|
|
|
2666
2647
|
bottom: 0,
|
|
2667
2648
|
left: 0
|
|
2668
2649
|
}, e.unclampedHeight = 0;
|
|
2669
|
-
let p = Math.max(0, t -
|
|
2650
|
+
let p = Math.max(0, t - hn(s, l)), m = e.style, h = m.tableLayout === "fixed" && m.width !== void 0 && m.width.kind !== "auto" ? dn(o, p, a) : un(c, p), g = [], _ = 0;
|
|
2670
2651
|
for (let e = 0; e < l; e++) _ += s.collapsed ? s.vLines[e] : s.spacingX, g.push(_), _ += h[e];
|
|
2671
2652
|
let v = _ + (s.collapsed ? s.vLines[l] ?? 0 : s.spacingX), y = 0;
|
|
2672
2653
|
o.caption && (B(o.caption, t, void 0, d, f, "fill", a), y = o.caption.localRect.height);
|
|
2673
2654
|
let b = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
|
|
2674
2655
|
for (let e of o.cells) {
|
|
2675
|
-
let t = e.col + e.colSpan, n = h.slice(e.col, t).reduce((e, t) => e + t, 0) +
|
|
2656
|
+
let t = e.col + e.colSpan, n = h.slice(e.col, t).reduce((e, t) => e + t, 0) + gn(s, e.col, t);
|
|
2676
2657
|
x.set(e, n), B(e.node, n, void 0, 0, 0, "fill", a, { width: n }), b.set(e, e.node.localRect.height);
|
|
2677
2658
|
}
|
|
2678
2659
|
let C = s.collapsed ? s.hLines.reduce((e, t) => e + t, 0) : (u + 1) * s.spacingY, w = n === void 0 ? void 0 : Math.max(0, n - y - C), T = (e) => e !== void 0 && e.kind === "percent" && w !== void 0 ? we(e.value, w) : 0, E = Array.from({ length: u }, () => 0), D = Array.from({ length: u }, () => !1);
|
|
@@ -2688,9 +2669,9 @@ function Sn(e, t, n, r, i, a) {
|
|
|
2688
2669
|
}
|
|
2689
2670
|
let O = o.cells.filter((e) => e.rowSpan > 1).sort((e, t) => e.rowSpan - t.rowSpan);
|
|
2690
2671
|
for (let e of O) {
|
|
2691
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
2672
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + _n(s, e.row, t), r = b.get(e) - n;
|
|
2692
2673
|
if (r <= 0) continue;
|
|
2693
|
-
let i =
|
|
2674
|
+
let i = I(Array.from({ length: e.rowSpan }, () => 1), r);
|
|
2694
2675
|
for (let n = e.row; n < t; n++) E[n] += i[n - e.row];
|
|
2695
2676
|
}
|
|
2696
2677
|
if (n !== void 0 && u > 0) {
|
|
@@ -2698,18 +2679,18 @@ function Sn(e, t, n, r, i, a) {
|
|
|
2698
2679
|
if (e > 0) {
|
|
2699
2680
|
let t = [];
|
|
2700
2681
|
for (let e = 0; e < u; e++) D[e] || t.push(e);
|
|
2701
|
-
let n = t.length > 0 ? t : Array.from({ length: u }, (e, t) => t), r =
|
|
2682
|
+
let n = t.length > 0 ? t : Array.from({ length: u }, (e, t) => t), r = I(n.map(() => 1), e);
|
|
2702
2683
|
n.forEach((e, t) => E[e] += r[t]);
|
|
2703
2684
|
}
|
|
2704
2685
|
}
|
|
2705
|
-
let k = o.caption && e.style.captionSide === "top" ? y : 0, A = [],
|
|
2706
|
-
for (let e = 0; e < u; e++)
|
|
2707
|
-
let
|
|
2686
|
+
let k = o.caption && e.style.captionSide === "top" ? y : 0, A = [], ee = k;
|
|
2687
|
+
for (let e = 0; e < u; e++) ee += s.collapsed ? s.hLines[e] : s.spacingY, A.push(ee), ee += E[e];
|
|
2688
|
+
let te = u > 0 ? ee + (s.collapsed ? s.hLines[u] ?? 0 : s.spacingY) : k, j = /* @__PURE__ */ new Map();
|
|
2708
2689
|
for (let e = 0; e < u; e++) {
|
|
2709
2690
|
let t = o.rowGroups[e];
|
|
2710
|
-
t && !
|
|
2691
|
+
t && !j.has(t) && j.set(t, A[e]);
|
|
2711
2692
|
}
|
|
2712
|
-
for (let [e, t] of
|
|
2693
|
+
for (let [e, t] of j) {
|
|
2713
2694
|
let n = t;
|
|
2714
2695
|
for (let t = 0; t < u; t++) o.rowGroups[t] === e && (n = A[t] + E[t]);
|
|
2715
2696
|
e.localRect = {
|
|
@@ -2725,7 +2706,7 @@ function Sn(e, t, n, r, i, a) {
|
|
|
2725
2706
|
}, e.unclampedHeight = n - t;
|
|
2726
2707
|
}
|
|
2727
2708
|
for (let e = 0; e < u; e++) {
|
|
2728
|
-
let t = o.rows[e], n = o.rowGroups[e], r = n ?
|
|
2709
|
+
let t = o.rows[e], n = o.rowGroups[e], r = n ? j.get(n) : void 0;
|
|
2729
2710
|
t.localRect = {
|
|
2730
2711
|
x: r === void 0 ? d : 0,
|
|
2731
2712
|
y: r === void 0 ? f + A[e] : A[e] - r,
|
|
@@ -2739,11 +2720,11 @@ function Sn(e, t, n, r, i, a) {
|
|
|
2739
2720
|
}, t.unclampedHeight = E[e];
|
|
2740
2721
|
}
|
|
2741
2722
|
for (let e of o.cells) {
|
|
2742
|
-
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) +
|
|
2723
|
+
let t = e.row + e.rowSpan, n = E.slice(e.row, t).reduce((e, t) => e + t, 0) + _n(s, e.row, t);
|
|
2743
2724
|
e.node.children.some((e) => !z(e.style) && e.style.height?.kind === "percent") && n !== b.get(e) && B(e.node, x.get(e), n, 0, 0, "fill", a, {
|
|
2744
2725
|
width: x.get(e),
|
|
2745
2726
|
height: n
|
|
2746
|
-
}),
|
|
2727
|
+
}), Sn(e.node, n - (e.node.naturalContentHeight ?? e.node.localRect.height)), e.node.localRect = {
|
|
2747
2728
|
x: g[e.col],
|
|
2748
2729
|
y: 0,
|
|
2749
2730
|
width: e.node.localRect.width,
|
|
@@ -2755,9 +2736,9 @@ function Sn(e, t, n, r, i, a) {
|
|
|
2755
2736
|
x: d,
|
|
2756
2737
|
y: f
|
|
2757
2738
|
});
|
|
2758
|
-
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f +
|
|
2739
|
+
return o.caption && e.style.captionSide === "bottom" && (o.caption.localRect.y = f + te), s.collapsed && l > 0 && u > 0 && (e.decorationRuns = Cn(s, o, h, E, g, A, d, f, S(e.style.glyphSet))), e.style.captionSide === "bottom" ? te + y : te;
|
|
2759
2740
|
}
|
|
2760
|
-
function
|
|
2741
|
+
function Sn(e, t) {
|
|
2761
2742
|
if (t <= 0) return;
|
|
2762
2743
|
let n = e.style.verticalAlign, r = n === "center" ? Math.floor(t / 2) : n === "end" ? t : 0;
|
|
2763
2744
|
if (!e.children.some((e) => !z(e.style) && !e.inlineBox)) {
|
|
@@ -2766,14 +2747,14 @@ function Cn(e, t) {
|
|
|
2766
2747
|
}
|
|
2767
2748
|
if (!(r <= 0)) for (let t of e.children) t.inlineBox || (z(t.style) ? t.staticSlot?.kind === "block" && (t.staticSlot.y += r) : t.localRect.y += r);
|
|
2768
2749
|
}
|
|
2769
|
-
function
|
|
2750
|
+
function Cn(e, t, n, r, i, a, o, s, c) {
|
|
2770
2751
|
let l = t.columnCount, u = t.rows.length, d = [], f = (t) => t < l ? i[t] - e.vLines[t] : i[l - 1] + n[l - 1], p = (t) => t < u ? a[t] - e.hLines[t] : a[u - 1] + r[u - 1];
|
|
2771
2752
|
for (let t = 0; t <= l; t++) {
|
|
2772
2753
|
let n = e.vSegments[t];
|
|
2773
2754
|
for (let e = 0; e < u; e++) {
|
|
2774
2755
|
let i = n[e];
|
|
2775
2756
|
if (!i) continue;
|
|
2776
|
-
let l =
|
|
2757
|
+
let l = ge(i.style, "v", c);
|
|
2777
2758
|
for (let n = 0; n < i.width; n++) for (let c = a[e]; c < a[e] + r[e]; c++) d.push({
|
|
2778
2759
|
glyph: l,
|
|
2779
2760
|
x: o + f(t) + n,
|
|
@@ -2788,7 +2769,7 @@ function wn(e, t, n, r, i, a, o, s, c) {
|
|
|
2788
2769
|
for (let e = 0; e < l; e++) {
|
|
2789
2770
|
let a = r[e];
|
|
2790
2771
|
if (!a) continue;
|
|
2791
|
-
let l =
|
|
2772
|
+
let l = ge(a.style, "h", c);
|
|
2792
2773
|
for (let r = 0; r < a.width; r++) d.push({
|
|
2793
2774
|
glyph: l,
|
|
2794
2775
|
x: o + i[e],
|
|
@@ -2807,7 +2788,7 @@ function wn(e, t, n, r, i, a, o, s, c) {
|
|
|
2807
2788
|
m
|
|
2808
2789
|
].filter((e) => e !== null);
|
|
2809
2790
|
if (h.length === 0) continue;
|
|
2810
|
-
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width &&
|
|
2791
|
+
let g = h.every((e) => e.style === "double") ? "double" : "solid", _ = h.reduce((e, t) => t.width > e.width || t.width === e.width && fn[t.style] > fn[e.style] ? t : e), v = _e(g, r !== null, i !== null, a !== null, m !== null, c);
|
|
2811
2792
|
for (let r = 0; r < e.vLines[t]; r++) for (let i = 0; i < e.hLines[n]; i++) d.push({
|
|
2812
2793
|
glyph: v,
|
|
2813
2794
|
x: o + f(t) + r,
|
|
@@ -2820,30 +2801,30 @@ function wn(e, t, n, r, i, a, o, s, c) {
|
|
|
2820
2801
|
}
|
|
2821
2802
|
//#endregion
|
|
2822
2803
|
//#region src/positioning.ts
|
|
2823
|
-
function
|
|
2804
|
+
function wn(e) {
|
|
2824
2805
|
return e.position === "absolute" || e.position === "fixed" ? "absolute" : e.position === "relative" || e.position === "sticky" ? "relative" : "static";
|
|
2825
2806
|
}
|
|
2826
|
-
function
|
|
2807
|
+
function Tn(e, t, n, r, i) {
|
|
2827
2808
|
for (let a of e.children) {
|
|
2828
|
-
let o =
|
|
2809
|
+
let o = wn(a.style);
|
|
2829
2810
|
if (o === "relative") {
|
|
2830
2811
|
let t = e.localRect.width - e.style.border.left - e.style.border.right - e.resolvedPadding.left - e.resolvedPadding.right, n = e.localRect.height - e.style.border.top - e.style.border.bottom - e.resolvedPadding.top - e.resolvedPadding.bottom;
|
|
2831
|
-
a.localRect.x +=
|
|
2832
|
-
} else o === "absolute" &&
|
|
2833
|
-
|
|
2812
|
+
a.localRect.x += En(a.style.insets.left, a.style.insets.right, t), a.localRect.y += En(a.style.insets.top, a.style.insets.bottom, n);
|
|
2813
|
+
} else o === "absolute" && On(a, e, t, n, r, i);
|
|
2814
|
+
Tn(a, t + a.localRect.x, n + a.localRect.y, [...r, {
|
|
2834
2815
|
node: a,
|
|
2835
2816
|
absX: t + a.localRect.x,
|
|
2836
2817
|
absY: n + a.localRect.y
|
|
2837
2818
|
}], i);
|
|
2838
2819
|
}
|
|
2839
2820
|
}
|
|
2840
|
-
function
|
|
2821
|
+
function En(e, t, n) {
|
|
2841
2822
|
return e === null ? t === null ? 0 : -U(t, n) : U(e, n);
|
|
2842
2823
|
}
|
|
2843
|
-
function
|
|
2824
|
+
function Dn(e, t) {
|
|
2844
2825
|
if (!t) for (let t = e.length - 1; t > 0; t--) {
|
|
2845
2826
|
let n = e[t];
|
|
2846
|
-
if (!
|
|
2827
|
+
if (!In(n.node.style)) continue;
|
|
2847
2828
|
let r = n.node.style.border;
|
|
2848
2829
|
return {
|
|
2849
2830
|
x: n.absX + r.left,
|
|
@@ -2860,43 +2841,43 @@ function On(e, t) {
|
|
|
2860
2841
|
height: n.node.localRect.height
|
|
2861
2842
|
};
|
|
2862
2843
|
}
|
|
2863
|
-
function
|
|
2864
|
-
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s &&
|
|
2844
|
+
function On(e, t, n, r, i, a) {
|
|
2845
|
+
let o = e.style, s = o.position === "fixed", c = e.staticSlot, l = c?.kind === "grid" && !s && In(t.style) ? {
|
|
2865
2846
|
x: n + c.area.x,
|
|
2866
2847
|
y: r + c.area.y,
|
|
2867
2848
|
width: c.area.width,
|
|
2868
2849
|
height: c.area.height
|
|
2869
|
-
} :
|
|
2850
|
+
} : Dn(i, s), u = o.insets.left === null ? null : U(o.insets.left, l.width), d = o.insets.right === null ? null : U(o.insets.right, l.width), f = o.insets.top === null ? null : U(o.insets.top, l.height), p = o.insets.bottom === null ? null : U(o.insets.bottom, l.height), m = W(o.margin, l.width), h = m.left ?? 0, g = m.right ?? 0, _ = m.top ?? 0, v = m.bottom ?? 0, y = o.width === void 0 || o.width.kind === "auto", b = o.height === void 0 || o.height.kind === "auto", x = Gn(o.minWidth, l.width, e, a) ?? 0, S = Gn(o.maxWidth, l.width, e, a), C = {};
|
|
2870
2851
|
if (!y) C.width = V(K(o.width, l.width, e, a), x, S);
|
|
2871
2852
|
else if (u !== null && d !== null) C.width = V(Math.max(0, l.width - u - d - h - g), x, S);
|
|
2872
2853
|
else {
|
|
2873
2854
|
let t = Math.max(0, l.width - (u ?? 0) - (d ?? 0) - h - g);
|
|
2874
|
-
C.width = V(Math.min(q(e, a), Math.max(
|
|
2855
|
+
C.width = V(Math.min(q(e, a), Math.max(tr(e, a), t)), x, S);
|
|
2875
2856
|
}
|
|
2876
2857
|
f !== null && p !== null && b && (C.height = V(Math.max(0, l.height - f - p - _ - v), G(o.minHeight, l.height) ?? 0, G(o.maxHeight, l.height))), B(e, l.width, l.height, 0, 0, "shrink", a, C);
|
|
2877
2858
|
let w = e.localRect.width, T = e.localRect.height, E;
|
|
2878
2859
|
if (u !== null && d !== null) {
|
|
2879
2860
|
let e = Math.max(0, l.width - u - d - w - h - g), t = m.left === null && m.right === null;
|
|
2880
2861
|
E = l.x + u + h + (t ? Math.floor(e / 2) : m.left === null ? e : 0);
|
|
2881
|
-
} else E = u === null ? d === null ?
|
|
2862
|
+
} else E = u === null ? d === null ? Nn(e, t, n, w) : l.x + l.width - d - w - g : l.x + u + h;
|
|
2882
2863
|
let D;
|
|
2883
2864
|
if (f !== null && p !== null) {
|
|
2884
2865
|
let e = Math.max(0, l.height - f - p - T - _ - v), t = m.top === null && m.bottom === null;
|
|
2885
2866
|
D = l.y + f + _ + (t ? Math.floor(e / 2) : m.top === null ? e : 0);
|
|
2886
|
-
} else D = f === null ? p === null ?
|
|
2867
|
+
} else D = f === null ? p === null ? Pn(e, t, r, T) : l.y + l.height - p - T - v : l.y + f + _;
|
|
2887
2868
|
e.localRect = {
|
|
2888
2869
|
...e.localRect,
|
|
2889
2870
|
x: E - n,
|
|
2890
2871
|
y: D - r
|
|
2891
2872
|
};
|
|
2892
2873
|
}
|
|
2893
|
-
function
|
|
2894
|
-
return
|
|
2874
|
+
function kn(e, t, n) {
|
|
2875
|
+
return F(e, [n], Math.max(0, t - n))[0];
|
|
2895
2876
|
}
|
|
2896
|
-
function
|
|
2897
|
-
return
|
|
2877
|
+
function An(e, t, n, r) {
|
|
2878
|
+
return L(Ye(e, t), n, r);
|
|
2898
2879
|
}
|
|
2899
|
-
function
|
|
2880
|
+
function jn(e, t, n, r, i) {
|
|
2900
2881
|
let a = W(e.style.margin, n.innerWidth), [o, s, c, l] = r === "x" ? [
|
|
2901
2882
|
a.left ?? 0,
|
|
2902
2883
|
a.right ?? 0,
|
|
@@ -2908,9 +2889,9 @@ function Mn(e, t, n, r, i) {
|
|
|
2908
2889
|
n.innerHeight,
|
|
2909
2890
|
n.direction === "column"
|
|
2910
2891
|
], u = i + o + s;
|
|
2911
|
-
return (l ?
|
|
2892
|
+
return (l ? kn($e(t.style), c, u) : An(e, t, c, u)) + o;
|
|
2912
2893
|
}
|
|
2913
|
-
function
|
|
2894
|
+
function Mn(e, t, n, r, i) {
|
|
2914
2895
|
let a = W(e.style.margin, n.width), o = e.style.justifySelf === "auto" ? t.style.justifyItems : e.style.justifySelf, [s, c, l, u] = r === "x" ? [
|
|
2915
2896
|
a.left ?? 0,
|
|
2916
2897
|
a.right ?? 0,
|
|
@@ -2922,35 +2903,35 @@ function Nn(e, t, n, r, i) {
|
|
|
2922
2903
|
n.height,
|
|
2923
2904
|
Ye(e, t)
|
|
2924
2905
|
];
|
|
2925
|
-
return
|
|
2906
|
+
return L(u, l, i + s + c) + s;
|
|
2926
2907
|
}
|
|
2927
|
-
function
|
|
2908
|
+
function Nn(e, t, n, r) {
|
|
2928
2909
|
let i = e.staticSlot;
|
|
2929
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x +
|
|
2910
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.x : i.kind === "grid" ? n + i.staticArea.x + Mn(e, t, i.staticArea, "x", r) : n + i.originX + jn(e, t, i, "x", r);
|
|
2930
2911
|
}
|
|
2931
|
-
function
|
|
2912
|
+
function Pn(e, t, n, r) {
|
|
2932
2913
|
let i = e.staticSlot;
|
|
2933
|
-
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y +
|
|
2914
|
+
return i === void 0 ? n : i.kind === "block" ? n + i.y : i.kind === "grid" ? n + i.staticArea.y + Mn(e, t, i.staticArea, "y", r) : n + i.originY + jn(e, t, i, "y", r);
|
|
2934
2915
|
}
|
|
2935
2916
|
//#endregion
|
|
2936
2917
|
//#region src/layout.ts
|
|
2937
|
-
function
|
|
2938
|
-
let n =
|
|
2939
|
-
B(e, t, void 0, 0, 0, "fill", n),
|
|
2918
|
+
function Fn(e, t) {
|
|
2919
|
+
let n = Ln();
|
|
2920
|
+
B(e, t, void 0, 0, 0, "fill", n), Tn(e, 0, 0, [{
|
|
2940
2921
|
node: e,
|
|
2941
2922
|
absX: 0,
|
|
2942
2923
|
absY: 0
|
|
2943
2924
|
}], n);
|
|
2944
|
-
let r = e.localRect.height, i =
|
|
2925
|
+
let r = e.localRect.height, i = Xn(e);
|
|
2945
2926
|
return e.localRect.width = Math.max(e.localRect.width, i.x), e.localRect.height = Math.max(r, i.y), { height: r };
|
|
2946
2927
|
}
|
|
2947
2928
|
function z(e) {
|
|
2948
2929
|
return e.position === "absolute" || e.position === "fixed";
|
|
2949
2930
|
}
|
|
2950
|
-
function
|
|
2931
|
+
function In(e) {
|
|
2951
2932
|
return e.position !== "static";
|
|
2952
2933
|
}
|
|
2953
|
-
function
|
|
2934
|
+
function Ln() {
|
|
2954
2935
|
return {
|
|
2955
2936
|
maxContent: /* @__PURE__ */ new WeakMap(),
|
|
2956
2937
|
minContent: /* @__PURE__ */ new WeakMap(),
|
|
@@ -2961,7 +2942,7 @@ function Rn() {
|
|
|
2961
2942
|
function B(e, t, n, r, i, a, o, s) {
|
|
2962
2943
|
let c = e.style, l = s?.height;
|
|
2963
2944
|
delete e.decorationRuns, delete e.multicolGeometry, delete e.multicolFlow, delete e.multicolFlowSpan, delete e.textExtent;
|
|
2964
|
-
let u =
|
|
2945
|
+
let u = Gn(c.minWidth, t, e, o) ?? 0, d = Gn(c.maxWidth, t, e, o), f = G(c.minHeight, n) ?? 0, p = G(c.maxHeight, n), m = it(c), h = rt(c);
|
|
2965
2946
|
s?.gutter?.right && (m.right = h.right), s?.gutter?.bottom && (m.bottom = h.bottom);
|
|
2966
2947
|
let g = {
|
|
2967
2948
|
top: U(c.padding.top, t),
|
|
@@ -2970,9 +2951,9 @@ function B(e, t, n, r, i, a, o, s) {
|
|
|
2970
2951
|
left: U(c.padding.left, t)
|
|
2971
2952
|
};
|
|
2972
2953
|
e.resolvedPadding = g;
|
|
2973
|
-
let _ = s?.width ?? V(
|
|
2954
|
+
let _ = s?.width ?? V(Yn(c, t, a, e, o), u, d), v = $n(c, n), y = rr(_, l ?? v ?? (f > 0 ? f : void 0) ?? Infinity, c.border, g), b = l !== void 0 || v !== void 0, x = p === void 0 ? void 0 : Math.max(0, p - c.border.top - c.border.bottom - g.top - g.bottom), S = zn(e), C = (t, n) => {
|
|
2974
2955
|
let r = n && Number.isFinite(t) ? t : void 0;
|
|
2975
|
-
return S ?
|
|
2956
|
+
return S ? Rn(e, y.width, t, r, x, g, o) : c.display === "flex" && c.flexDirection === "row" ? Ue(e, y.width, t, r, c.border, g, o) : c.display === "flex" ? Ge(e, y.width, t, n, c.border, g, o) : c.display === "grid" ? st(e, y.width, t, c.border, g, o) : c.display === "table" ? xn(e, y.width, r, c.border, g, o) : c.display === "multicol" ? $t(e, y.width, r, x, c.border, g, o) : Kn(e, y.width, r, c.border, g, o);
|
|
2976
2957
|
}, w = C(y.height, b);
|
|
2977
2958
|
if (!S && (c.display === "flex" || c.display === "grid") && !b && p !== void 0) {
|
|
2978
2959
|
let e = c.border.top + c.border.bottom + g.top + g.bottom, t = V(w + e, f, p) - e;
|
|
@@ -2983,28 +2964,31 @@ function B(e, t, n, r, i, a, o, s) {
|
|
|
2983
2964
|
let D = V(E, f, p), O = e.multicolGeometry;
|
|
2984
2965
|
if (O) {
|
|
2985
2966
|
let t = D - c.border.top - c.border.bottom - g.top - g.bottom;
|
|
2986
|
-
t > O.totalRows && (g.bottom += t - O.totalRows),
|
|
2967
|
+
t > O.totalRows && (g.bottom += t - O.totalRows), Xt(e, O, c.border, g);
|
|
2987
2968
|
}
|
|
2988
2969
|
if (e.localRect = {
|
|
2989
2970
|
x: r,
|
|
2990
2971
|
y: i,
|
|
2991
2972
|
width: _,
|
|
2992
2973
|
height: D
|
|
2993
|
-
},
|
|
2994
|
-
let l =
|
|
2974
|
+
}, tt(c.overflow.x) || tt(c.overflow.y)) {
|
|
2975
|
+
let l = Xn(e), u = Math.max(0, l.x - c.border.left - g.left), d = Math.max(0, l.y - c.border.top - g.top), f = Math.max(0, _ - c.border.left - c.border.right - g.left - g.right), p = Math.max(0, D - c.border.top - c.border.bottom - g.top - g.bottom);
|
|
2995
2976
|
if (e.scrollRange = {
|
|
2996
2977
|
sizeX: u,
|
|
2997
2978
|
sizeY: d,
|
|
2998
|
-
maxX:
|
|
2999
|
-
maxY:
|
|
3000
|
-
},
|
|
3001
|
-
let l =
|
|
3002
|
-
|
|
2979
|
+
maxX: tt(c.overflow.x) ? Math.max(0, u - f) : 0,
|
|
2980
|
+
maxY: tt(c.overflow.y) ? Math.max(0, d - p) : 0
|
|
2981
|
+
}, c.scrollbarWidth !== "none") {
|
|
2982
|
+
let l = s?.gutter ?? {
|
|
2983
|
+
right: !1,
|
|
2984
|
+
bottom: !1
|
|
2985
|
+
}, u = l.right || c.overflow.y === "auto" && e.scrollRange.maxY > 0, d = l.bottom || c.overflow.x === "auto" && e.scrollRange.maxX > 0;
|
|
2986
|
+
if (u !== l.right || d !== l.bottom) {
|
|
3003
2987
|
B(e, t, n, r, i, a, o, {
|
|
3004
2988
|
...s,
|
|
3005
2989
|
gutter: {
|
|
3006
|
-
right:
|
|
3007
|
-
bottom:
|
|
2990
|
+
right: u,
|
|
2991
|
+
bottom: d
|
|
3008
2992
|
}
|
|
3009
2993
|
});
|
|
3010
2994
|
return;
|
|
@@ -3016,25 +3000,25 @@ function B(e, t, n, r, i, a, o, s) {
|
|
|
3016
3000
|
};
|
|
3017
3001
|
} else delete e.scrollRange, delete e.scrollGutterCells;
|
|
3018
3002
|
}
|
|
3019
|
-
function
|
|
3003
|
+
function Rn(e, t, n, r, i, a, o) {
|
|
3020
3004
|
let s = e.style, c;
|
|
3021
3005
|
if (e.text) {
|
|
3022
|
-
let l =
|
|
3006
|
+
let l = nt(e);
|
|
3023
3007
|
Fe(e.text, (n, r) => {
|
|
3024
3008
|
let i = l[r];
|
|
3025
3009
|
B(i, t, void 0, 0, 0, "shrink", o), e.advances[n] = Math.max(1, i.localRect.width);
|
|
3026
3010
|
});
|
|
3027
3011
|
let u, d;
|
|
3028
3012
|
if (s.display === "multicol") {
|
|
3029
|
-
let n = H(s, "x", t), o =
|
|
3013
|
+
let n = H(s, "x", t), o = Ht(s, t, n);
|
|
3030
3014
|
a.right += o.leftover;
|
|
3031
|
-
let c =
|
|
3015
|
+
let c = Wt(e, o, n, Bt(r, i));
|
|
3032
3016
|
e.multicolGeometry = c, u = c, d = c.lineX;
|
|
3033
|
-
} else u =
|
|
3017
|
+
} else u = Vn(e, t);
|
|
3034
3018
|
if (c = u.totalRows, e.textExtent = {
|
|
3035
|
-
width: u.spans.reduce((t, n) => Math.max(t,
|
|
3019
|
+
width: u.spans.reduce((t, n) => Math.max(t, P(n.start, n.end, e.advances, s.tracking)), 0),
|
|
3036
3020
|
rows: u.totalRows
|
|
3037
|
-
},
|
|
3021
|
+
}, Bn(e, u, t, n, a), l.length > 0) {
|
|
3038
3022
|
let t = (e) => u.spans.findIndex((t) => e >= t.start && e < t.end);
|
|
3039
3023
|
Fe(e.text, (n, r) => {
|
|
3040
3024
|
let i = t(n);
|
|
@@ -3059,30 +3043,30 @@ function zn(e, t, n, r, i, a, o) {
|
|
|
3059
3043
|
}
|
|
3060
3044
|
return c;
|
|
3061
3045
|
}
|
|
3062
|
-
function
|
|
3046
|
+
function zn(e) {
|
|
3063
3047
|
return e.children.some((e) => !z(e.style) && !e.inlineBox) ? !1 : e.text !== "" || e.style.display !== "flex" && e.style.display !== "grid";
|
|
3064
3048
|
}
|
|
3065
3049
|
function V(e, t, n) {
|
|
3066
3050
|
return Math.max(t, n === void 0 ? e : Math.min(e, n));
|
|
3067
3051
|
}
|
|
3068
|
-
function
|
|
3052
|
+
function Bn(e, t, n, r, i) {
|
|
3069
3053
|
let a = e.style;
|
|
3070
3054
|
if (a.display !== "flex" && a.display !== "grid" || t.spans.length === 0) return;
|
|
3071
|
-
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t,
|
|
3055
|
+
let o = a.display === "flex" && a.flexDirection === "column", s = t.spans.reduce((t, n) => Math.max(t, P(n.start, n.end, e.advances, a.tracking)), 0), c = Math.max(0, n - s);
|
|
3072
3056
|
if (c > 0) {
|
|
3073
|
-
let e = a.display === "grid" ?
|
|
3057
|
+
let e = a.display === "grid" ? L(a.justifyItems, n, s) : o ? L(a.alignItems, n, s) : F($e(a), [s], c)[0];
|
|
3074
3058
|
e > 0 && (i.left += e, i.right += c - e);
|
|
3075
3059
|
}
|
|
3076
3060
|
if (Number.isFinite(r)) {
|
|
3077
3061
|
let e = Math.max(0, r - t.totalRows);
|
|
3078
3062
|
if (e > 0) {
|
|
3079
|
-
let n = a.display === "grid" || !o ?
|
|
3063
|
+
let n = a.display === "grid" || !o ? L(a.alignItems, r, t.totalRows) : F($e(a), [t.totalRows], e)[0];
|
|
3080
3064
|
n > 0 && (i.top += n, i.bottom += e - n);
|
|
3081
3065
|
}
|
|
3082
3066
|
}
|
|
3083
3067
|
}
|
|
3084
|
-
function
|
|
3085
|
-
let n =
|
|
3068
|
+
function Vn(e, t) {
|
|
3069
|
+
let n = Hn(e, t), { heights: r, textOffsets: i } = Un(e, n), a = [], o = [], s = 0;
|
|
3086
3070
|
for (let t = 0; t < n.length; t++) a.push(s), o.push(s + i[t]), s += r[t] + (t < n.length - 1 ? e.style.lineGap : 0);
|
|
3087
3071
|
return {
|
|
3088
3072
|
spans: n,
|
|
@@ -3091,21 +3075,21 @@ function Hn(e, t) {
|
|
|
3091
3075
|
totalRows: s
|
|
3092
3076
|
};
|
|
3093
3077
|
}
|
|
3094
|
-
function
|
|
3078
|
+
function Hn(e, t) {
|
|
3095
3079
|
return e.style.whiteSpace === "normal" ? je(e.text, t, {
|
|
3096
3080
|
advances: e.advances,
|
|
3097
3081
|
tracking: e.style.tracking,
|
|
3098
3082
|
firstLineIndent: e.style.textIndent
|
|
3099
3083
|
}) : Ae(e.text);
|
|
3100
3084
|
}
|
|
3101
|
-
function
|
|
3102
|
-
let n =
|
|
3085
|
+
function Un(e, t) {
|
|
3086
|
+
let n = nt(e), r = [], i = [], a = 0;
|
|
3103
3087
|
for (let o of t) {
|
|
3104
3088
|
let t = 1, s = 0;
|
|
3105
3089
|
for (let r = o.start; r < o.end; r++) {
|
|
3106
3090
|
if (e.text[r] !== "") continue;
|
|
3107
3091
|
let i = n[a];
|
|
3108
|
-
t = Math.max(t, i.localRect.height), i.style.verticalAlign === "end" ? s = Math.max(s, i.localRect.height - 1) : i.style.verticalAlign === "center" &&
|
|
3092
|
+
t = Math.max(t, i.localRect.height), i.style.verticalAlign === "end" ? s = Math.max(s, i.localRect.height - 1) : i.style.verticalAlign === "center" && j(i.source, "vertical-align: middle on an inline box can't land on whole rows and behaves as top. Use align-top or align-bottom."), a++;
|
|
3109
3093
|
}
|
|
3110
3094
|
r.push(t), i.push(Math.min(s, t - 1));
|
|
3111
3095
|
}
|
|
@@ -3130,16 +3114,16 @@ function W(e, t) {
|
|
|
3130
3114
|
left: n(e.left)
|
|
3131
3115
|
};
|
|
3132
3116
|
}
|
|
3133
|
-
function
|
|
3117
|
+
function Wn(e) {
|
|
3134
3118
|
return typeof e == "number" ? e : 0;
|
|
3135
3119
|
}
|
|
3136
3120
|
function G(e, t) {
|
|
3137
3121
|
if (e !== void 0 && typeof e != "string") return typeof e == "number" ? e : t === void 0 ? void 0 : we(e.percent, t);
|
|
3138
3122
|
}
|
|
3139
|
-
function
|
|
3123
|
+
function Gn(e, t, n, r) {
|
|
3140
3124
|
return e === "min-content" || e === "max-content" || e === "fit-content" ? K({ kind: e }, t, n, r) : G(e, t);
|
|
3141
3125
|
}
|
|
3142
|
-
function
|
|
3126
|
+
function Kn(e, t, n, r, i, a) {
|
|
3143
3127
|
let o = r.left + i.left, s = r.top + i.top, c = s, l = null;
|
|
3144
3128
|
for (let r of e.children) {
|
|
3145
3129
|
let e = W(r.style.margin, t), i = e.top ?? 0, s = e.bottom ?? 0, u = e.left ?? 0, d = e.right ?? 0;
|
|
@@ -3147,13 +3131,13 @@ function qn(e, t, n, r, i, a) {
|
|
|
3147
3131
|
r.staticSlot = {
|
|
3148
3132
|
kind: "block",
|
|
3149
3133
|
x: o + u,
|
|
3150
|
-
y: c + (l === null ? i :
|
|
3134
|
+
y: c + (l === null ? i : Jn(l, i))
|
|
3151
3135
|
};
|
|
3152
3136
|
continue;
|
|
3153
3137
|
}
|
|
3154
3138
|
B(r, Math.max(0, t - u - d), n, 0, 0, "fill", a);
|
|
3155
|
-
let f =
|
|
3156
|
-
c += l === null ? i :
|
|
3139
|
+
let f = qn(e, t, r.localRect.width);
|
|
3140
|
+
c += l === null ? i : Jn(l, i), r.localRect = {
|
|
3157
3141
|
...r.localRect,
|
|
3158
3142
|
x: o + f,
|
|
3159
3143
|
y: c
|
|
@@ -3161,30 +3145,30 @@ function qn(e, t, n, r, i, a) {
|
|
|
3161
3145
|
}
|
|
3162
3146
|
return l !== null && (c += l), c - s;
|
|
3163
3147
|
}
|
|
3164
|
-
function
|
|
3148
|
+
function qn(e, t, n) {
|
|
3165
3149
|
let r = t - n;
|
|
3166
3150
|
return e.left === null && e.right === null ? Math.floor(r / 2) : e.left === null ? r - (e.right ?? 0) : e.left;
|
|
3167
3151
|
}
|
|
3168
|
-
function
|
|
3152
|
+
function Jn(e, t) {
|
|
3169
3153
|
return e >= 0 && t >= 0 ? Math.max(e, t) : e <= 0 && t <= 0 ? Math.min(e, t) : e + t;
|
|
3170
3154
|
}
|
|
3171
|
-
function
|
|
3155
|
+
function Yn(e, t, n, r, i) {
|
|
3172
3156
|
let a = e.width;
|
|
3173
3157
|
if (e.display === "table") {
|
|
3174
3158
|
if (!r.children.some((e) => !z(e.style) && !e.inlineBox)) return a !== void 0 && a.kind !== "auto" ? K(a, t, r, i) : Math.min(t, q(r, i));
|
|
3175
3159
|
if (a !== void 0 && a.kind !== "auto") {
|
|
3176
3160
|
let e = K(a, t, r, i);
|
|
3177
|
-
return Math.max(e,
|
|
3161
|
+
return Math.max(e, Qn(r, t, i));
|
|
3178
3162
|
}
|
|
3179
|
-
return
|
|
3163
|
+
return bn(r, t, i);
|
|
3180
3164
|
}
|
|
3181
3165
|
return a !== void 0 && a.kind !== "auto" ? K(a, t, r, i) : n === "shrink" ? Math.min(t, q(r, i)) : t;
|
|
3182
3166
|
}
|
|
3183
|
-
function
|
|
3167
|
+
function Xn(e) {
|
|
3184
3168
|
let t = 0, n = 0;
|
|
3185
3169
|
for (let r of e.children) {
|
|
3186
3170
|
if (r.style.position === "fixed") continue;
|
|
3187
|
-
let e =
|
|
3171
|
+
let e = Zn(r);
|
|
3188
3172
|
t = Math.max(t, r.localRect.x + e.x), n = Math.max(n, r.localRect.y + e.y);
|
|
3189
3173
|
}
|
|
3190
3174
|
if (e.textExtent) {
|
|
@@ -3196,23 +3180,23 @@ function Zn(e) {
|
|
|
3196
3180
|
y: n
|
|
3197
3181
|
};
|
|
3198
3182
|
}
|
|
3199
|
-
function
|
|
3183
|
+
function Zn(e) {
|
|
3200
3184
|
let { width: t, height: n } = e.localRect, r = e.style.overflow.x !== "visible", i = e.style.overflow.y !== "visible";
|
|
3201
3185
|
if (r && i) return {
|
|
3202
3186
|
x: t,
|
|
3203
3187
|
y: n
|
|
3204
3188
|
};
|
|
3205
|
-
let a =
|
|
3189
|
+
let a = Xn(e);
|
|
3206
3190
|
return {
|
|
3207
3191
|
x: r ? t : Math.max(t, a.x),
|
|
3208
3192
|
y: i ? n : Math.max(n, a.y)
|
|
3209
3193
|
};
|
|
3210
3194
|
}
|
|
3211
|
-
function
|
|
3195
|
+
function Qn(e, t, n) {
|
|
3212
3196
|
let r = e.style;
|
|
3213
|
-
return
|
|
3197
|
+
return yn(e, n).min + r.border.left + r.border.right + U(r.padding.left, t) + U(r.padding.right, t) + it(r).right;
|
|
3214
3198
|
}
|
|
3215
|
-
function
|
|
3199
|
+
function $n(e, t) {
|
|
3216
3200
|
if (e.height?.kind === "cells") return e.height.value;
|
|
3217
3201
|
if (e.height?.kind === "percent" && t != null) return we(e.height.value, t);
|
|
3218
3202
|
}
|
|
@@ -3220,40 +3204,40 @@ function K(e, t, n, r) {
|
|
|
3220
3204
|
switch (e.kind) {
|
|
3221
3205
|
case "cells": return e.value;
|
|
3222
3206
|
case "percent": return we(e.value, t);
|
|
3223
|
-
case "min-content": return
|
|
3207
|
+
case "min-content": return tr(n, r);
|
|
3224
3208
|
case "max-content": return q(n, r);
|
|
3225
|
-
case "fit-content": return Math.min(q(n, r), Math.max(
|
|
3209
|
+
case "fit-content": return Math.min(q(n, r), Math.max(tr(n, r), t));
|
|
3226
3210
|
case "auto": return q(n, r);
|
|
3227
3211
|
}
|
|
3228
3212
|
}
|
|
3229
3213
|
function q(e, t) {
|
|
3230
3214
|
let n = t.maxContent.get(e);
|
|
3231
3215
|
if (n !== void 0) return n;
|
|
3232
|
-
let r = e.style, i =
|
|
3216
|
+
let r = e.style, i = er(e, t) + r.border.left + r.border.right + Wn(r.padding.left) + Wn(r.padding.right) + it(r).right;
|
|
3233
3217
|
return t.maxContent.set(e, i), i;
|
|
3234
3218
|
}
|
|
3235
|
-
function
|
|
3219
|
+
function er(e, t) {
|
|
3236
3220
|
let n = e.children.filter((e) => !z(e.style) && !e.inlineBox);
|
|
3237
|
-
if (n.length === 0) return e.style.display === "multicol" ?
|
|
3238
|
-
if (e.style.display === "grid") return
|
|
3239
|
-
if (e.style.display === "table") return
|
|
3221
|
+
if (n.length === 0) return e.style.display === "multicol" ? zt(e.style, e.intrinsicWidth) : e.intrinsicWidth;
|
|
3222
|
+
if (e.style.display === "grid") return gt(e, t).max;
|
|
3223
|
+
if (e.style.display === "table") return yn(e, t).max;
|
|
3240
3224
|
if (e.style.display === "flex" && e.style.flexDirection === "row") {
|
|
3241
|
-
let r = Math.max(
|
|
3225
|
+
let r = Math.max(Wn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3242
3226
|
return n.reduce((e, n) => e + J(n, "max", t), 0) + r;
|
|
3243
3227
|
}
|
|
3244
3228
|
let r = n.reduce((e, n) => Math.max(e, J(n, "max", t)), 0);
|
|
3245
|
-
return e.style.display === "multicol" ?
|
|
3229
|
+
return e.style.display === "multicol" ? zt(e.style, r) : r;
|
|
3246
3230
|
}
|
|
3247
3231
|
function J(e, t, n) {
|
|
3248
3232
|
let r = e.style, i;
|
|
3249
|
-
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = K(r.width, 0, e, n)), i === void 0 && (i = t === "min" ?
|
|
3233
|
+
r.width !== void 0 && r.width.kind !== "auto" && r.width.kind !== "percent" && (i = K(r.width, 0, e, n)), i === void 0 && (i = t === "min" ? tr(e, n) : q(e, n));
|
|
3250
3234
|
let a = typeof r.minWidth == "number" ? r.minWidth : 0, o = typeof r.maxWidth == "number" ? r.maxWidth : void 0;
|
|
3251
3235
|
return Math.max(0, V(i, a, o));
|
|
3252
3236
|
}
|
|
3253
|
-
function
|
|
3237
|
+
function tr(e, t) {
|
|
3254
3238
|
let n = t.minContent.get(e);
|
|
3255
3239
|
if (n !== void 0) return n;
|
|
3256
|
-
let r = e.style, i = nr(e, t) + r.border.left + r.border.right +
|
|
3240
|
+
let r = e.style, i = nr(e, t) + r.border.left + r.border.right + Wn(r.padding.left) + Wn(r.padding.right) + it(r).right;
|
|
3257
3241
|
return t.minContent.set(e, i), i;
|
|
3258
3242
|
}
|
|
3259
3243
|
function nr(e, t) {
|
|
@@ -3262,10 +3246,10 @@ function nr(e, t) {
|
|
|
3262
3246
|
advances: e.advances,
|
|
3263
3247
|
tracking: e.style.tracking
|
|
3264
3248
|
});
|
|
3265
|
-
if (e.style.display === "grid") return
|
|
3266
|
-
if (e.style.display === "table") return
|
|
3249
|
+
if (e.style.display === "grid") return gt(e, t).min;
|
|
3250
|
+
if (e.style.display === "table") return yn(e, t).min;
|
|
3267
3251
|
if (e.style.display === "flex" && e.style.flexDirection === "row" && e.style.flexWrap === "nowrap") {
|
|
3268
|
-
let r = Math.max(
|
|
3252
|
+
let r = Math.max(Wn(e.style.gapX), e.style.ruleX?.width ?? 0) * Math.max(0, n.length - 1);
|
|
3269
3253
|
return n.reduce((e, n) => e + J(n, "min", t), 0) + r;
|
|
3270
3254
|
}
|
|
3271
3255
|
return n.reduce((e, n) => Math.max(e, J(n, "min", t)), 0);
|
|
@@ -3338,7 +3322,7 @@ function fr(e, t, n, r, i = 1) {
|
|
|
3338
3322
|
for (let n = 0; n < e.localRect.height; n++) for (let i = 0; i < e.localRect.width; i++) r(a + i, o + n, " ", t);
|
|
3339
3323
|
}
|
|
3340
3324
|
let l = [];
|
|
3341
|
-
|
|
3325
|
+
fe(s, {
|
|
3342
3326
|
x: a,
|
|
3343
3327
|
y: o,
|
|
3344
3328
|
width: e.localRect.width,
|
|
@@ -3352,43 +3336,33 @@ function fr(e, t, n, r, i = 1) {
|
|
|
3352
3336
|
let e = c(t.color === void 0 ? void 0 : { color: t.color });
|
|
3353
3337
|
for (let n = 0; n < t.length; n++) r(a + t.x + n, o + t.y, t.glyph, e);
|
|
3354
3338
|
}
|
|
3355
|
-
let u = e.
|
|
3356
|
-
if (
|
|
3357
|
-
let t = a + s.border.left, n = o + s.border.top, i = a + e.localRect.width - s.border.right - (
|
|
3358
|
-
|
|
3359
|
-
|
|
3339
|
+
let u = e.scrollGutterCells, d = s.overflow.x !== "visible", f = s.overflow.y !== "visible", p = a - (e.scroll?.x ?? 0), m = o - (e.scroll?.y ?? 0), h = r;
|
|
3340
|
+
if (d || f) {
|
|
3341
|
+
let t = a + s.border.left, n = o + s.border.top, i = a + e.localRect.width - s.border.right - (u?.right ?? 0), c = o + e.localRect.height - s.border.bottom - (u?.bottom ?? 0);
|
|
3342
|
+
h = (e, a, o, s) => {
|
|
3343
|
+
d && (e < t || e >= i) || f && (a < n || a >= c) || r(e, a, o, s);
|
|
3360
3344
|
};
|
|
3361
3345
|
}
|
|
3362
3346
|
if (!e.children.some((e) => !e.inlineBox && e.style.position !== "absolute" && e.style.position !== "fixed") && e.text) {
|
|
3363
|
-
let t =
|
|
3364
|
-
|
|
3365
|
-
let
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
}
|
|
3374
|
-
b += Me(t, t + 1, e.advances);
|
|
3375
|
-
}
|
|
3376
|
-
h.ellipsis && g(b, p, "…", d);
|
|
3377
|
-
}
|
|
3378
|
-
}
|
|
3379
|
-
for (let t of pe(e)) fr(t, m, h, g, i * t.style.opacity);
|
|
3380
|
-
let _ = e.scrollRange;
|
|
3381
|
-
if (_ && d && (d.right > 0 || d.bottom > 0)) {
|
|
3382
|
-
let { track: t, thumb: n } = j(S(s.glyphSet)), i = (e) => c(e ? { color: e } : void 0), l = i(s.scrollbarColor?.track ?? s.color), u = i(s.scrollbarColor?.thumb ?? s.color), d = pr(e, a, o);
|
|
3347
|
+
let t = c(dr(s)), n = e.inlineElements?.map((e) => c(dr(e)));
|
|
3348
|
+
pr(e, p, m, (r, i, a) => {
|
|
3349
|
+
let o = e.charInline?.[r] ?? -1, s = o >= 0 ? e.inlineElements[o] : void 0;
|
|
3350
|
+
e.text[r] === "" ? s?.backgroundColor && h(i, a, " ", c({ backgroundColor: s.backgroundColor })) : h(i, a, e.text[r], s ? n[o] : t);
|
|
3351
|
+
}, (e, n) => h(e, n, "…", t));
|
|
3352
|
+
}
|
|
3353
|
+
for (let t of he(e)) fr(t, p, m, h, i * t.style.opacity);
|
|
3354
|
+
let g = e.scrollRange;
|
|
3355
|
+
if (g && u && (u.right > 0 || u.bottom > 0)) {
|
|
3356
|
+
let { track: t, thumb: n } = ee(S(s.glyphSet)), i = (e) => c(e ? { color: e } : void 0), l = i(s.scrollbarColor?.track ?? s.color), u = i(s.scrollbarColor?.thumb ?? s.color), d = gr(e, a, o);
|
|
3383
3357
|
if (d.y) {
|
|
3384
|
-
let { col: i, row: a, thick: o, len: s } = d.y, { at: c, len: f } =
|
|
3358
|
+
let { col: i, row: a, thick: o, len: s } = d.y, { at: c, len: f } = _r(s, g.sizeY, g.maxY, e.scroll?.y ?? 0);
|
|
3385
3359
|
for (let e = 0; e < o; e++) for (let o = 0; o < s; o++) {
|
|
3386
3360
|
let s = o >= c && o < c + f;
|
|
3387
3361
|
r(i + e, a + o, s ? n : t, s ? u : l);
|
|
3388
3362
|
}
|
|
3389
3363
|
}
|
|
3390
3364
|
if (d.x) {
|
|
3391
|
-
let { col: i, row: a, thick: o, len: s } = d.x, { at: c, len: f } =
|
|
3365
|
+
let { col: i, row: a, thick: o, len: s } = d.x, { at: c, len: f } = _r(s, g.sizeX, g.maxX, e.scroll?.x ?? 0);
|
|
3392
3366
|
for (let e = 0; e < o; e++) for (let o = 0; o < s; o++) {
|
|
3393
3367
|
let s = o >= c && o < c + f;
|
|
3394
3368
|
r(i + o, a + e, s ? n : t, s ? u : l);
|
|
@@ -3396,7 +3370,42 @@ function fr(e, t, n, r, i = 1) {
|
|
|
3396
3370
|
}
|
|
3397
3371
|
}
|
|
3398
3372
|
}
|
|
3399
|
-
function pr(e, t, n) {
|
|
3373
|
+
function pr(e, t, n, r, i) {
|
|
3374
|
+
let a = e.style, o = e.resolvedPadding, s = t + a.border.left + o.left, c = n + a.border.top + o.top, l = e.localRect.width - a.border.left - a.border.right - o.left - o.right, u = e.multicolGeometry, { spans: d, textY: f } = u ?? Vn(e, l), p = u ? Math.max(1, u.columnWidth - a.tracking) : l;
|
|
3375
|
+
for (let t = 0; t < d.length; t++) {
|
|
3376
|
+
let n = d[t], o = c + f[t], l = t === 0 ? a.textIndent : 0, m = a.whiteSpace !== "normal" && a.overflow.x === "clip" ? vr(e.text, n, p - l, e.advances, a) : {
|
|
3377
|
+
end: n.end,
|
|
3378
|
+
ellipsis: !1
|
|
3379
|
+
}, h = P(n.start, n.end, e.advances, a.tracking), g = Math.max(0, p - l - h), _ = a.textAlign === "end" ? g : a.textAlign === "center" ? Math.floor(g / 2) : 0, v = s + (u?.lineX[t] ?? 0) + _ + l;
|
|
3380
|
+
for (let t = n.start; t < m.end; t++) {
|
|
3381
|
+
let n = Me(t, t + 1, e.advances);
|
|
3382
|
+
if (e.text[t] !== "") {
|
|
3383
|
+
let i = e.inlineElements?.[e.charInline?.[t] ?? -1]?.insets, a = i ? i.left ?? (i.right === null ? 0 : -i.right) : 0, s = i ? i.top ?? (i.bottom === null ? 0 : -i.bottom) : 0;
|
|
3384
|
+
r(t, v + a, o + s, n);
|
|
3385
|
+
}
|
|
3386
|
+
v += n;
|
|
3387
|
+
}
|
|
3388
|
+
m.ellipsis && i?.(v, o);
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
function mr(e, t, n, r, i) {
|
|
3392
|
+
let a = e.multicolGeometry;
|
|
3393
|
+
if (!a) return !1;
|
|
3394
|
+
let o = e.style, s = e.resolvedPadding, c = r - (t + o.border.left + s.left), l = i - (n + o.border.top + s.top), { lineX: u, lineY: d } = a;
|
|
3395
|
+
for (let e = 0; e < d.length; e++) {
|
|
3396
|
+
if (c < u[e] || c >= u[e] + a.columnWidth) continue;
|
|
3397
|
+
let t = (e + 1 < d.length && u[e + 1] === u[e] ? d[e + 1] : void 0) ?? d[e] + 1 + o.lineGap;
|
|
3398
|
+
if (l >= d[e] && l < t) return !0;
|
|
3399
|
+
}
|
|
3400
|
+
return !1;
|
|
3401
|
+
}
|
|
3402
|
+
function hr(e, t, n, r, i) {
|
|
3403
|
+
let a = null;
|
|
3404
|
+
return pr(e, t - (e.scroll?.x ?? 0), n - (e.scroll?.y ?? 0), (e, t, n, o) => {
|
|
3405
|
+
a === null && n === i && r >= t && r < t + o && (a = e);
|
|
3406
|
+
}), a;
|
|
3407
|
+
}
|
|
3408
|
+
function gr(e, t, n) {
|
|
3400
3409
|
let r = e.scrollGutterCells;
|
|
3401
3410
|
if (!r) return {};
|
|
3402
3411
|
let { border: i, scrollbarSize: a, scrollbarInset: o } = e.style, s = n + i.top, c = t + i.left, l = n + e.localRect.height - i.bottom, u = t + e.localRect.width - i.right, d = r.bottom > 0 ? l - r.bottom : l - o.y, f = r.right > 0 ? u - r.right : u - o.x, p = {};
|
|
@@ -3412,38 +3421,214 @@ function pr(e, t, n) {
|
|
|
3412
3421
|
len: Math.max(0, f - c - o.x)
|
|
3413
3422
|
}), p;
|
|
3414
3423
|
}
|
|
3415
|
-
function
|
|
3424
|
+
function _r(e, t, n, r) {
|
|
3416
3425
|
let i = t > 0 ? Math.min(1, e / t) : 1, a = Math.max(1, Math.round(i * e));
|
|
3417
3426
|
return n > 0 && (a = Math.max(1, Math.min(a, e - n))), {
|
|
3418
3427
|
at: n > 0 ? Math.round(Math.min(r, n) / n * (e - a)) : 0,
|
|
3419
3428
|
len: a
|
|
3420
3429
|
};
|
|
3421
3430
|
}
|
|
3422
|
-
function
|
|
3431
|
+
function vr(e, t, n, r, i) {
|
|
3423
3432
|
let { textOverflow: a, tracking: o } = i;
|
|
3424
|
-
if (
|
|
3433
|
+
if (P(t.start, t.end, r, o) <= n) return {
|
|
3425
3434
|
end: t.end,
|
|
3426
3435
|
ellipsis: !1
|
|
3427
3436
|
};
|
|
3428
3437
|
let s = a === "ellipsis" ? n - 1 : n, c = t.start;
|
|
3429
|
-
for (; c < t.end &&
|
|
3438
|
+
for (; c < t.end && P(t.start, c + 1, r, o) <= s;) c++;
|
|
3430
3439
|
return {
|
|
3431
3440
|
end: c,
|
|
3432
3441
|
ellipsis: a === "ellipsis" && n > 0
|
|
3433
3442
|
};
|
|
3434
3443
|
}
|
|
3435
3444
|
//#endregion
|
|
3445
|
+
//#region src/pointer.ts
|
|
3446
|
+
function yr(e, t, n) {
|
|
3447
|
+
let r = [], i = e, a = e.localRect.x, o = e.localRect.y;
|
|
3448
|
+
for (;;) {
|
|
3449
|
+
let e = null;
|
|
3450
|
+
for (let r of he(i)) {
|
|
3451
|
+
if (r.tableHidden) continue;
|
|
3452
|
+
let i = a + r.localRect.x, s = o + r.localRect.y;
|
|
3453
|
+
(r.multicolFlow ? mr(r, i, s, t, n) : t >= i && t < i + r.localRect.width && n >= s && n < s + r.localRect.height) && (e = r);
|
|
3454
|
+
}
|
|
3455
|
+
if (!e) return r;
|
|
3456
|
+
r.push({
|
|
3457
|
+
node: e,
|
|
3458
|
+
x: a + e.localRect.x,
|
|
3459
|
+
y: o + e.localRect.y
|
|
3460
|
+
}), a += e.localRect.x - (e.scroll?.x ?? 0), o += e.localRect.y - (e.scroll?.y ?? 0), i = e;
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
function br(e, t, n) {
|
|
3464
|
+
return yr(e, t, n).map((e) => e.node.source);
|
|
3465
|
+
}
|
|
3466
|
+
//#endregion
|
|
3467
|
+
//#region src/selection.ts
|
|
3468
|
+
function xr(e, t, n, r) {
|
|
3469
|
+
let i = e.ownerDocument, a = i.createRange();
|
|
3470
|
+
a.setStart(e, t), a.collapse(!0);
|
|
3471
|
+
let o = i.createRange();
|
|
3472
|
+
return o.setStart(n, r), o.collapse(!0), a.compareBoundaryPoints(a.START_TO_START, o);
|
|
3473
|
+
}
|
|
3474
|
+
function Sr(e, t, n) {
|
|
3475
|
+
let r = nt(e).findIndex((e) => e.source.contains(t));
|
|
3476
|
+
if (r >= 0) {
|
|
3477
|
+
let t = -1;
|
|
3478
|
+
for (let n = 0; n <= r; n++) t = e.text.indexOf("", t + 1);
|
|
3479
|
+
if (t >= 0) return t;
|
|
3480
|
+
}
|
|
3481
|
+
let i = e.charSource ?? [], a = 0, o = i.length;
|
|
3482
|
+
for (; a < o;) {
|
|
3483
|
+
let e = a + o >> 1, r = i[e];
|
|
3484
|
+
xr(r.node, r.offset, t, n) <= 0 ? a = e + 1 : o = e;
|
|
3485
|
+
}
|
|
3486
|
+
if (a === 0) return 0;
|
|
3487
|
+
let s = i[a - 1];
|
|
3488
|
+
return t === s.node && n < s.offset + s.length ? s.index + (n - s.offset) : s.index + s.length;
|
|
3489
|
+
}
|
|
3490
|
+
function Cr(e, t) {
|
|
3491
|
+
let n = e.charSource ?? [], r = 0, i = n.length;
|
|
3492
|
+
for (; r < i;) {
|
|
3493
|
+
let e = r + i >> 1;
|
|
3494
|
+
n[e].index <= t ? r = e + 1 : i = e;
|
|
3495
|
+
}
|
|
3496
|
+
let a = n[r - 1];
|
|
3497
|
+
if (!a) return null;
|
|
3498
|
+
let o = t - a.index;
|
|
3499
|
+
return o <= a.length ? {
|
|
3500
|
+
node: a.node,
|
|
3501
|
+
offset: a.offset + o
|
|
3502
|
+
} : null;
|
|
3503
|
+
}
|
|
3504
|
+
function wr(e) {
|
|
3505
|
+
try {
|
|
3506
|
+
let t = e.ownerDocument.getSelection();
|
|
3507
|
+
if (!t) return null;
|
|
3508
|
+
if (t.getComposedRanges) return t.getComposedRanges({ shadowRoots: [e] })[0] ?? null;
|
|
3509
|
+
let n = e.getSelection?.();
|
|
3510
|
+
return !n || n.rangeCount === 0 ? null : n.getRangeAt(0);
|
|
3511
|
+
} catch {
|
|
3512
|
+
return null;
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3515
|
+
function Tr(e, t, n) {
|
|
3516
|
+
let { startContainer: r, endContainer: i } = n;
|
|
3517
|
+
return t.contains(r) && t.contains(i) ? "grid" : e.contains(r) && e.contains(i) ? "light" : "outside";
|
|
3518
|
+
}
|
|
3519
|
+
function Er(e, t) {
|
|
3520
|
+
let n = e.source.ownerDocument.createRange();
|
|
3521
|
+
n.setStart(t.startContainer, t.startOffset), n.setEnd(t.endContainer, t.endOffset);
|
|
3522
|
+
let r = [];
|
|
3523
|
+
return Dr(e, n, r), Pr(r);
|
|
3524
|
+
}
|
|
3525
|
+
function Dr(e, t, n) {
|
|
3526
|
+
if (e.tableHidden || !t.intersectsNode(e.source)) return;
|
|
3527
|
+
let r = jr(e);
|
|
3528
|
+
if (r && n.push({ breaks: r }), e.style.tableRole === "row") Or(e, t, n);
|
|
3529
|
+
else if (e.style.display === "table") {
|
|
3530
|
+
let r = Ar(e);
|
|
3531
|
+
for (let r of e.children) r.style.tableRole === "row" || kr(r) || Dr(r, t, n);
|
|
3532
|
+
let i = !1;
|
|
3533
|
+
for (let e of r) t.intersectsNode(e.source) && (i && n.push({ text: "\n" }), Dr(e, t, n), i = !0);
|
|
3534
|
+
} else {
|
|
3535
|
+
Mr(e) && n.push({ text: Nr(e, t) });
|
|
3536
|
+
for (let r of e.children) r.inlineBox || Dr(r, t, n);
|
|
3537
|
+
}
|
|
3538
|
+
r && n.push({ breaks: r });
|
|
3539
|
+
}
|
|
3540
|
+
function Or(e, t, n) {
|
|
3541
|
+
let r = !1;
|
|
3542
|
+
for (let i of e.children) i.style.tableRole !== "cell" || i.tableHidden || t.intersectsNode(i.source) && (r && n.push({ text: " " }), Dr(i, t, n), r = !0);
|
|
3543
|
+
}
|
|
3544
|
+
function kr(e) {
|
|
3545
|
+
let t = e.style.tableRole;
|
|
3546
|
+
return t === "header-group" || t === "row-group" || t === "footer-group";
|
|
3547
|
+
}
|
|
3548
|
+
function Ar(e) {
|
|
3549
|
+
let t = [];
|
|
3550
|
+
for (let n of e.children) if (n.style.tableRole === "row") t.push(n);
|
|
3551
|
+
else if (kr(n)) for (let e of n.children) e.style.tableRole === "row" && t.push(e);
|
|
3552
|
+
return t;
|
|
3553
|
+
}
|
|
3554
|
+
function jr(e) {
|
|
3555
|
+
if (e.inlineBox) return 0;
|
|
3556
|
+
let t = e.style.tableRole;
|
|
3557
|
+
return t === "row" || t === "cell" || kr(e) || t === "column" || t === "column-group" ? 0 : e.source.tagName === "P" ? 2 : 1;
|
|
3558
|
+
}
|
|
3559
|
+
function Mr(e) {
|
|
3560
|
+
return e.text.length !== 0 && !e.children.some((e) => !e.inlineBox && e.style.position !== "absolute" && e.style.position !== "fixed");
|
|
3561
|
+
}
|
|
3562
|
+
function Nr(e, t) {
|
|
3563
|
+
let { text: n } = e, r = 0, i = n.length;
|
|
3564
|
+
e.charSource && (e.source.contains(t.startContainer) && (r = Sr(e, t.startContainer, t.startOffset)), e.source.contains(t.endContainer) && (i = Sr(e, t.endContainer, t.endOffset)));
|
|
3565
|
+
let a = n.slice(r, i);
|
|
3566
|
+
i === n.length && a.endsWith("\n") && (a = a.slice(0, -1));
|
|
3567
|
+
let o = nt(e), s = n.slice(0, r).split("").length - 1;
|
|
3568
|
+
return a = a.replaceAll("", () => {
|
|
3569
|
+
let e = o[s++];
|
|
3570
|
+
if (!e || !t.intersectsNode(e.source)) return "";
|
|
3571
|
+
let n = [];
|
|
3572
|
+
return Dr(e, t, n), Pr(n);
|
|
3573
|
+
}), a.replaceAll("", "");
|
|
3574
|
+
}
|
|
3575
|
+
function Pr(e) {
|
|
3576
|
+
let t = "", n = 0;
|
|
3577
|
+
for (let r of e) {
|
|
3578
|
+
if ("breaks" in r) {
|
|
3579
|
+
n = Math.max(n, r.breaks);
|
|
3580
|
+
continue;
|
|
3581
|
+
}
|
|
3582
|
+
r.text.length !== 0 && (t.length > 0 && n > 0 && (t += "\n".repeat(n)), n = 0, t += r.text);
|
|
3583
|
+
}
|
|
3584
|
+
return t;
|
|
3585
|
+
}
|
|
3586
|
+
var Fr = /* @__PURE__ */ new Map();
|
|
3587
|
+
function Ir(e, t) {
|
|
3588
|
+
let { text: n } = e;
|
|
3589
|
+
if (t < 0 || t >= n.length || Lr(n[t])) return null;
|
|
3590
|
+
let r = t;
|
|
3591
|
+
for (; r > 0 && !Lr(n[r - 1]);) r--;
|
|
3592
|
+
let i = t;
|
|
3593
|
+
for (; i < n.length && !Lr(n[i]);) i++;
|
|
3594
|
+
let a = Rr(e.source.closest?.("[lang]")?.getAttribute("lang") ?? "");
|
|
3595
|
+
if (!a) return null;
|
|
3596
|
+
for (let e of a.segment(n.slice(r, i))) {
|
|
3597
|
+
let n = r + e.index, i = n + e.segment.length;
|
|
3598
|
+
if (t >= n && t < i) return {
|
|
3599
|
+
start: n,
|
|
3600
|
+
end: i
|
|
3601
|
+
};
|
|
3602
|
+
}
|
|
3603
|
+
return null;
|
|
3604
|
+
}
|
|
3605
|
+
function Lr(e) {
|
|
3606
|
+
return e === "\n" || e === "" || e === "";
|
|
3607
|
+
}
|
|
3608
|
+
function Rr(e) {
|
|
3609
|
+
let t = Fr.get(e);
|
|
3610
|
+
return t === void 0 && (t = zr(e) ?? zr(""), Fr.set(e, t)), t;
|
|
3611
|
+
}
|
|
3612
|
+
function zr(e) {
|
|
3613
|
+
if (typeof Intl.Segmenter != "function") return null;
|
|
3614
|
+
try {
|
|
3615
|
+
return new Intl.Segmenter(e || void 0, { granularity: "word" });
|
|
3616
|
+
} catch {
|
|
3617
|
+
return null;
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
//#endregion
|
|
3436
3621
|
//#region src/paint.ts
|
|
3437
|
-
var
|
|
3438
|
-
function
|
|
3439
|
-
return
|
|
3440
|
-
}
|
|
3441
|
-
function
|
|
3442
|
-
let r = ar(e), i =
|
|
3443
|
-
if (
|
|
3444
|
-
let a =
|
|
3445
|
-
if (a &&
|
|
3446
|
-
|
|
3622
|
+
var Br = /* @__PURE__ */ new WeakMap(), Vr = /* @__PURE__ */ new WeakMap();
|
|
3623
|
+
function Hr(e) {
|
|
3624
|
+
return Gr(e, !0) !== null;
|
|
3625
|
+
}
|
|
3626
|
+
function Ur(e, t, n = !1) {
|
|
3627
|
+
let r = ar(e), i = Xr(r);
|
|
3628
|
+
if (Br.get(t) === i) return !0;
|
|
3629
|
+
let a = Vr.get(t);
|
|
3630
|
+
if (a && Wr(t, a.nodes, r)) {
|
|
3631
|
+
Br.set(t, i);
|
|
3447
3632
|
for (let e = 0; e < r.length; e++) for (let t = 0; t < r[e].length; t++) {
|
|
3448
3633
|
let n = r[e][t];
|
|
3449
3634
|
if (lr(n) || sr(n, a.segments[e][t])) continue;
|
|
@@ -3452,8 +3637,8 @@ function yr(e, t, n = !1) {
|
|
|
3452
3637
|
}
|
|
3453
3638
|
return a.segments = r, !0;
|
|
3454
3639
|
}
|
|
3455
|
-
if (n &&
|
|
3456
|
-
|
|
3640
|
+
if (n && Hr(t)) return !1;
|
|
3641
|
+
Br.set(t, i);
|
|
3457
3642
|
let o = document.createDocumentFragment(), s = [];
|
|
3458
3643
|
for (let e = 0; e < r.length; e++) {
|
|
3459
3644
|
e > 0 && o.appendChild(document.createTextNode("\n"));
|
|
@@ -3469,14 +3654,14 @@ function yr(e, t, n = !1) {
|
|
|
3469
3654
|
}
|
|
3470
3655
|
s.push(t);
|
|
3471
3656
|
}
|
|
3472
|
-
|
|
3657
|
+
Vr.set(t, {
|
|
3473
3658
|
nodes: s,
|
|
3474
3659
|
segments: r
|
|
3475
3660
|
});
|
|
3476
|
-
let c =
|
|
3477
|
-
return t.replaceChildren(o), c &&
|
|
3661
|
+
let c = Gr(t, !1);
|
|
3662
|
+
return t.replaceChildren(o), c && Kr(t, c), !0;
|
|
3478
3663
|
}
|
|
3479
|
-
function
|
|
3664
|
+
function Wr(e, t, n) {
|
|
3480
3665
|
if (t.length !== n.length) return !1;
|
|
3481
3666
|
for (let r = 0; r < n.length; r++) {
|
|
3482
3667
|
let i = t[r], a = n[r];
|
|
@@ -3488,23 +3673,15 @@ function br(e, t, n) {
|
|
|
3488
3673
|
}
|
|
3489
3674
|
return !0;
|
|
3490
3675
|
}
|
|
3491
|
-
function
|
|
3676
|
+
function Gr(e, t) {
|
|
3492
3677
|
try {
|
|
3493
3678
|
let n = e.ownerDocument.getSelection();
|
|
3494
3679
|
if (!n) return null;
|
|
3495
3680
|
let r = e.getRootNode();
|
|
3496
3681
|
if (!(r instanceof ShadowRoot)) return null;
|
|
3497
|
-
let i;
|
|
3498
|
-
if (
|
|
3499
|
-
|
|
3500
|
-
if (e.length === 0) return null;
|
|
3501
|
-
i = e[0];
|
|
3502
|
-
} else {
|
|
3503
|
-
let e = r.getSelection?.();
|
|
3504
|
-
if (!e || e.rangeCount === 0) return null;
|
|
3505
|
-
i = e.getRangeAt(0);
|
|
3506
|
-
}
|
|
3507
|
-
let a = Cr(e, i.startContainer, i.startOffset), o = Cr(e, i.endContainer, i.endOffset);
|
|
3682
|
+
let i = wr(r);
|
|
3683
|
+
if (!i) return null;
|
|
3684
|
+
let a = qr(e, i.startContainer, i.startOffset), o = qr(e, i.endContainer, i.endOffset);
|
|
3508
3685
|
return a === null || o === null || a === o && !t ? null : {
|
|
3509
3686
|
start: a,
|
|
3510
3687
|
end: o,
|
|
@@ -3514,32 +3691,32 @@ function xr(e, t) {
|
|
|
3514
3691
|
return null;
|
|
3515
3692
|
}
|
|
3516
3693
|
}
|
|
3517
|
-
function
|
|
3694
|
+
function Kr(e, t) {
|
|
3518
3695
|
try {
|
|
3519
|
-
let n =
|
|
3696
|
+
let n = Jr(e, t.start), r = Jr(e, t.end);
|
|
3520
3697
|
if (!n || !r) return;
|
|
3521
3698
|
let i = e.getRootNode().getSelection?.() ?? e.ownerDocument.getSelection();
|
|
3522
3699
|
t.backward ? i?.setBaseAndExtent(r[0], r[1], n[0], n[1]) : i?.setBaseAndExtent(n[0], n[1], r[0], r[1]);
|
|
3523
3700
|
} catch {}
|
|
3524
3701
|
}
|
|
3525
|
-
function
|
|
3702
|
+
function qr(e, t, n) {
|
|
3526
3703
|
if (!e.contains(t)) return null;
|
|
3527
3704
|
let r = e.ownerDocument.createRange();
|
|
3528
3705
|
return r.selectNodeContents(e), r.setEnd(t, n), r.toString().length;
|
|
3529
3706
|
}
|
|
3530
|
-
function
|
|
3707
|
+
function Jr(e, t) {
|
|
3531
3708
|
let n = t, r = null;
|
|
3532
|
-
for (let t of
|
|
3709
|
+
for (let t of Yr(e)) {
|
|
3533
3710
|
if (n <= t.data.length) return [t, n];
|
|
3534
3711
|
n -= t.data.length, r = [t, t.data.length];
|
|
3535
3712
|
}
|
|
3536
3713
|
return r;
|
|
3537
3714
|
}
|
|
3538
|
-
function*
|
|
3715
|
+
function* Yr(e) {
|
|
3539
3716
|
let t = e.ownerDocument.createTreeWalker(e, NodeFilter.SHOW_TEXT), n = t.nextNode();
|
|
3540
3717
|
for (; n;) yield n, n = t.nextNode();
|
|
3541
3718
|
}
|
|
3542
|
-
function
|
|
3719
|
+
function Xr(e) {
|
|
3543
3720
|
let t = [];
|
|
3544
3721
|
for (let n of e) {
|
|
3545
3722
|
for (let e of n) t.push(e.text, e.color ?? "", e.backgroundColor ?? "", e.fontWeight ?? "", e.fontStyle ?? "", e.textDecorationLine ?? "", e.opacity ?? "");
|
|
@@ -3549,9 +3726,9 @@ function Er(e) {
|
|
|
3549
3726
|
}
|
|
3550
3727
|
//#endregion
|
|
3551
3728
|
//#region src/render.ts
|
|
3552
|
-
function
|
|
3729
|
+
function Zr(e) {
|
|
3553
3730
|
let t = /* @__PURE__ */ new Set();
|
|
3554
|
-
|
|
3731
|
+
Qr(e, !0, t);
|
|
3555
3732
|
for (let n of Array.from(e.source.querySelectorAll("[data-mw-inline-inset]"))) if (!t.has(n)) {
|
|
3556
3733
|
n.removeAttribute("data-mw-inline-inset");
|
|
3557
3734
|
let e = n.style;
|
|
@@ -3563,78 +3740,78 @@ function Dr(e) {
|
|
|
3563
3740
|
]) e.removeProperty(t);
|
|
3564
3741
|
}
|
|
3565
3742
|
}
|
|
3566
|
-
function
|
|
3743
|
+
function Y(e, t, n) {
|
|
3567
3744
|
e.style.getPropertyValue(t) !== n && e.style.setProperty(t, n);
|
|
3568
3745
|
}
|
|
3569
|
-
function
|
|
3746
|
+
function X(e, t) {
|
|
3570
3747
|
e.style.getPropertyValue(t) !== "" && e.style.removeProperty(t);
|
|
3571
3748
|
}
|
|
3572
|
-
function
|
|
3749
|
+
function Z(e, t, n) {
|
|
3573
3750
|
e.hasAttribute(t) !== n && (n ? e.setAttribute(t, "") : e.removeAttribute(t));
|
|
3574
3751
|
}
|
|
3575
|
-
function
|
|
3752
|
+
function Qr(e, t, n) {
|
|
3576
3753
|
if (e.inlineElements) for (let { element: t, tracking: r, padLeft: i, padRight: a, insets: o } of e.inlineElements) {
|
|
3577
3754
|
let e = t;
|
|
3578
|
-
|
|
3755
|
+
Y(e, "--mw-ls", String(r)), i > 0 ? Y(e, "--mw-ipl", String(i)) : X(e, "--mw-ipl"), a > 0 ? Y(e, "--mw-ipr", String(a)) : X(e, "--mw-ipr"), o && (n.add(t), $r(e, o));
|
|
3579
3756
|
}
|
|
3580
|
-
if (t ||
|
|
3757
|
+
if (t || ti(e), !e.tableHidden) for (let t of he(e)) {
|
|
3581
3758
|
let r = t.source;
|
|
3582
|
-
t.style.zIndex !== null &&
|
|
3759
|
+
t.style.zIndex !== null && me(t, e) && !t.inlineBox ? Y(r, "--mw-z", String(t.style.zIndex)) : X(r, "--mw-z"), Qr(t, !1, n);
|
|
3583
3760
|
}
|
|
3584
3761
|
}
|
|
3585
|
-
function
|
|
3586
|
-
|
|
3762
|
+
function $r(e, t) {
|
|
3763
|
+
Z(e, "data-mw-inline-inset", !0);
|
|
3587
3764
|
let n = (t, n) => {
|
|
3588
|
-
n === null ?
|
|
3765
|
+
n === null ? X(e, t) : Y(e, t, String(n));
|
|
3589
3766
|
};
|
|
3590
3767
|
n("--mw-it", t.top), n("--mw-ir", t.right), n("--mw-ib", t.bottom), n("--mw-il", t.left);
|
|
3591
3768
|
}
|
|
3592
|
-
function
|
|
3769
|
+
function ei(e) {
|
|
3593
3770
|
let t = e.style;
|
|
3594
3771
|
if (t.textAlign !== "center" || !e.text || e.inlineBox || e.children.length > 0) return !1;
|
|
3595
|
-
let n = e.multicolGeometry, r = e.resolvedPadding, i = e.localRect.width - t.border.left - t.border.right - r.left - r.right, a = n ? Math.max(1, n.columnWidth - t.tracking) : i, o = n?.spans ??
|
|
3772
|
+
let n = e.multicolGeometry, r = e.resolvedPadding, i = e.localRect.width - t.border.left - t.border.right - r.left - r.right, a = n ? Math.max(1, n.columnWidth - t.tracking) : i, o = n?.spans ?? Hn(e, i);
|
|
3596
3773
|
return o.length !== 0 && o.every((n, r) => {
|
|
3597
|
-
let i = r === 0 ? t.textIndent : 0, o = a - i -
|
|
3774
|
+
let i = r === 0 ? t.textIndent : 0, o = a - i - P(n.start, n.end, e.advances, t.tracking);
|
|
3598
3775
|
return o > 0 && o % 2 == 1;
|
|
3599
3776
|
});
|
|
3600
3777
|
}
|
|
3601
|
-
function
|
|
3778
|
+
function ti(e) {
|
|
3602
3779
|
let t = e.source, n = e.localRect, r = e.resolvedPadding, { border: i, textAlignBlocked: a, overflow: o, whiteSpace: s, tracking: c, lineGap: l } = e.style, u = e.multicolFlow, d = e.multicolFlowSpan;
|
|
3603
|
-
|
|
3780
|
+
Z(t, "data-mw-laid-out", !e.inlineBox && !u && !d), Z(t, "data-mw-inline-box", !!e.inlineBox), Z(t, "data-mw-multicol-flow", !!u), Z(t, "data-mw-multicol-flow-span", !!d);
|
|
3604
3781
|
let f = u ?? d;
|
|
3605
|
-
f ? (
|
|
3782
|
+
f ? (Y(t, "--mw-mt", String(f.top ?? 0)), Y(t, "--mw-mr", String(f.right ?? 0)), Y(t, "--mw-mb", String(f.bottom ?? 0)), Y(t, "--mw-ml", String(f.left ?? 0))) : (X(t, "--mw-mt"), X(t, "--mw-mr"), X(t, "--mw-mb"), X(t, "--mw-ml")), Z(t, "data-mw-vbottom", !!e.inlineBox && e.style.verticalAlign === "end"), Y(t, "--mw-ls", String(c)), Y(t, "--mw-lh", String(l + 1)), Y(t, "--mw-lhs", String(-l / 2)), Z(t, "data-mw-nowrap", s !== "normal");
|
|
3606
3783
|
let p = u || d ? void 0 : e.multicolGeometry;
|
|
3607
|
-
if (
|
|
3784
|
+
if (Z(t, "data-mw-multicol", !!p), Z(t, "data-mw-multicol-balance", !!p?.nativeBalance), p ? (Y(t, "--mw-colc", String(p.columnCount)), Y(t, "--mw-colg", String(p.gap))) : (X(t, "--mw-colc"), X(t, "--mw-colg")), Z(t, "data-mw-pre", s === "pre"), Y(t, "--mw-x", String(n.x)), Y(t, "--mw-y", String(n.y)), Y(t, "--mw-w", String(n.width)), Y(t, "--mw-h", String(n.height)), Z(t, "data-mw-clip", o.x === "clip" || o.y === "clip"), Z(t, "data-mw-scroll", e.scrollRange !== void 0), e.scrollRange) {
|
|
3608
3785
|
let { maxX: n, maxY: r } = e.scrollRange;
|
|
3609
|
-
|
|
3610
|
-
} else
|
|
3611
|
-
|
|
3786
|
+
Y(t, "--mw-se-x", String(n > 0 ? n + e.localRect.width : 1)), Y(t, "--mw-se-y", String(r > 0 ? r + e.localRect.height : 1));
|
|
3787
|
+
} else X(t, "--mw-se-x"), X(t, "--mw-se-y");
|
|
3788
|
+
Y(t, "--mw-pt", String(r.top)), Y(t, "--mw-pr", String(r.right)), Y(t, "--mw-pb", String(r.bottom)), Y(t, "--mw-pl", String(r.left)), Y(t, "--mw-bt", String(i.top)), Y(t, "--mw-br", String(i.right)), Y(t, "--mw-bb", String(i.bottom)), Y(t, "--mw-bl", String(i.left)), Y(t, "--mw-ti", String(e.style.textIndent)), Z(t, "data-mw-text-align-blocked", a), Z(t, "data-mw-center-nudge", ei(e)), Z(t, "data-mw-dropped-text", !!e.droppedText), Z(t, "data-mw-table-hidden", !!e.tableHidden);
|
|
3612
3789
|
}
|
|
3613
3790
|
//#endregion
|
|
3614
3791
|
//#region src/style.ts
|
|
3615
|
-
function
|
|
3616
|
-
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a =
|
|
3617
|
-
|
|
3618
|
-
let c = (e, r, i) =>
|
|
3792
|
+
function ni(e, t, n) {
|
|
3793
|
+
let r = getComputedStyle(e), i = parseFloat(r.fontSize) || t, a = wi(e) ? e.computedStyleMap() : null, o = e.getAttribute("class") ?? "", s = e.style;
|
|
3794
|
+
yi(e, o, s);
|
|
3795
|
+
let c = (e, r, i) => Vi(a, e, r, o, i, s, n, t) ?? Ui(a, e, r, o, i, s, n, t) ?? Pi(r, t), l = r.display || gi[e.tagName] || "", u = _i[l] ?? "none", d = r.columnCount && r.columnCount !== "auto" ? Math.max(1, Math.floor(Number(r.columnCount) || 1)) : null, f = r.columnWidth && r.columnWidth !== "auto" ? parseFloat(r.columnWidth) : NaN, p = Number.isFinite(f) ? Math.max(1, N(f, t)) : null, m = l === "flex" || l === "inline-flex" ? "flex" : l === "grid" || l === "inline-grid" ? "grid" : l === "table" || l === "inline-table" ? "table" : l === "none" || hi(e, r) ? "none" : d !== null || p !== null ? "multicol" : "block", h = { kind: "none" }, g = { kind: "none" }, _ = [ot()], v = [ot()], y = {
|
|
3619
3796
|
direction: "row",
|
|
3620
3797
|
dense: !1
|
|
3621
3798
|
}, b = null;
|
|
3622
3799
|
if (m === "grid") {
|
|
3623
|
-
if (a) h =
|
|
3800
|
+
if (a) h = Ki(a.get("grid-template-columns")?.toString() ?? "", t), g = Ki(a.get("grid-template-rows")?.toString() ?? "", t);
|
|
3624
3801
|
else {
|
|
3625
3802
|
e.setAttribute("data-mw-degrid", "");
|
|
3626
3803
|
try {
|
|
3627
|
-
h =
|
|
3804
|
+
h = Ki(r.getPropertyValue("grid-template-columns"), t), g = Ki(r.getPropertyValue("grid-template-rows"), t);
|
|
3628
3805
|
} finally {
|
|
3629
3806
|
e.removeAttribute("data-mw-degrid");
|
|
3630
3807
|
}
|
|
3631
3808
|
}
|
|
3632
|
-
_ =
|
|
3809
|
+
_ = Xi(r.getPropertyValue("grid-auto-columns"), t), v = Xi(r.getPropertyValue("grid-auto-rows"), t), y = na(r.getPropertyValue("grid-auto-flow")), b = Yi(r.getPropertyValue("grid-template-areas"));
|
|
3633
3810
|
}
|
|
3634
3811
|
let x = "auto", S = !1, C = 0, w = 0;
|
|
3635
3812
|
if (m === "table" && (x = r.tableLayout === "fixed" ? "fixed" : "auto", S = r.borderCollapse === "collapse", !S)) {
|
|
3636
3813
|
let e = r.borderSpacing.split(" ");
|
|
3637
|
-
C =
|
|
3814
|
+
C = N(parseFloat(e[0] ?? "") || 0, t), w = N(parseFloat(e[1] ?? e[0] ?? "") || 0, t);
|
|
3638
3815
|
}
|
|
3639
3816
|
let T = {
|
|
3640
3817
|
display: m,
|
|
@@ -3644,75 +3821,75 @@ function Mr(e, t, n) {
|
|
|
3644
3821
|
borderSpacingX: C,
|
|
3645
3822
|
borderSpacingY: w,
|
|
3646
3823
|
captionSide: r.captionSide === "bottom" ? "bottom" : "top",
|
|
3647
|
-
verticalAlign: u === "cell" || l.startsWith("inline-") ?
|
|
3824
|
+
verticalAlign: u === "cell" || l.startsWith("inline-") ? vi(e, r) : "start",
|
|
3648
3825
|
flexDirection: r.flexDirection.startsWith("column") ? "column" : "row",
|
|
3649
3826
|
flexReverse: r.flexDirection.endsWith("-reverse"),
|
|
3650
3827
|
flexWrap: r.flexWrap.startsWith("wrap") ? "wrap" : "nowrap",
|
|
3651
3828
|
wrapReverse: r.flexWrap === "wrap-reverse",
|
|
3652
3829
|
flexGrow: Number(r.flexGrow) || 0,
|
|
3653
3830
|
flexShrink: r.flexShrink === "" ? 1 : Number(r.flexShrink) || 0,
|
|
3654
|
-
flexBasis:
|
|
3831
|
+
flexBasis: Wi(r.flexBasis, t),
|
|
3655
3832
|
order: Number(r.order) || 0,
|
|
3656
|
-
justifyContent:
|
|
3657
|
-
alignContent:
|
|
3658
|
-
alignItems:
|
|
3659
|
-
alignSelf:
|
|
3660
|
-
justifyItems:
|
|
3661
|
-
justifySelf:
|
|
3833
|
+
justifyContent: Ti(r.justifyContent),
|
|
3834
|
+
alignContent: Ti(r.alignContent),
|
|
3835
|
+
alignItems: Ei(r.alignItems),
|
|
3836
|
+
alignSelf: Di(r.alignSelf),
|
|
3837
|
+
justifyItems: Ei(r.justifyItems),
|
|
3838
|
+
justifySelf: Di(r.justifySelf),
|
|
3662
3839
|
gridTemplateColumns: h,
|
|
3663
3840
|
gridTemplateRows: g,
|
|
3664
3841
|
gridAutoColumns: _,
|
|
3665
3842
|
gridAutoRows: v,
|
|
3666
3843
|
gridAutoFlow: y,
|
|
3667
3844
|
gridTemplateAreas: b,
|
|
3668
|
-
gridColumnStart:
|
|
3669
|
-
gridColumnEnd:
|
|
3670
|
-
gridRowStart:
|
|
3671
|
-
gridRowEnd:
|
|
3672
|
-
width:
|
|
3673
|
-
height:
|
|
3845
|
+
gridColumnStart: ta(r.getPropertyValue("grid-column-start")),
|
|
3846
|
+
gridColumnEnd: ta(r.getPropertyValue("grid-column-end")),
|
|
3847
|
+
gridRowStart: ta(r.getPropertyValue("grid-row-start")),
|
|
3848
|
+
gridRowEnd: ta(r.getPropertyValue("grid-row-end")),
|
|
3849
|
+
width: Li(a, r.width, "width", t, o, s, n),
|
|
3850
|
+
height: Li(a, r.height, "height", t, o, s, n),
|
|
3674
3851
|
minWidth: c("min-width", r.minWidth, "min-w") ?? "auto",
|
|
3675
3852
|
minHeight: c("min-height", r.minHeight, "min-h") ?? "auto",
|
|
3676
3853
|
maxWidth: c("max-width", r.maxWidth, "max-w"),
|
|
3677
3854
|
maxHeight: c("max-height", r.maxHeight, "max-h"),
|
|
3678
|
-
padding:
|
|
3679
|
-
margin:
|
|
3680
|
-
position:
|
|
3681
|
-
insets:
|
|
3682
|
-
gapX:
|
|
3683
|
-
gapY:
|
|
3684
|
-
border:
|
|
3855
|
+
padding: ia(r, t),
|
|
3856
|
+
margin: Oi(r, a, o, s, t),
|
|
3857
|
+
position: ji(r.position),
|
|
3858
|
+
insets: Mi(r, a, o, s, t),
|
|
3859
|
+
gapX: Q(r.columnGap === "normal" || r.columnGap === "" ? m === "multicol" ? `${i}px` : "0px" : r.columnGap, t),
|
|
3860
|
+
gapY: Q(r.rowGap === "normal" ? "0px" : r.rowGap, t),
|
|
3861
|
+
border: aa(r),
|
|
3685
3862
|
borderStyle: {
|
|
3686
|
-
top:
|
|
3687
|
-
right:
|
|
3688
|
-
bottom:
|
|
3689
|
-
left:
|
|
3863
|
+
top: Ni(r.borderTopStyle),
|
|
3864
|
+
right: Ni(r.borderRightStyle),
|
|
3865
|
+
bottom: Ni(r.borderBottomStyle),
|
|
3866
|
+
left: Ni(r.borderLeftStyle)
|
|
3690
3867
|
},
|
|
3691
|
-
overflow:
|
|
3692
|
-
scrollbarWidth:
|
|
3693
|
-
scrollbarColor:
|
|
3868
|
+
overflow: mi(r),
|
|
3869
|
+
scrollbarWidth: ui(e, r),
|
|
3870
|
+
scrollbarColor: di(r.scrollbarColor),
|
|
3694
3871
|
overscroll: {
|
|
3695
3872
|
x: (r.overscrollBehaviorX || "auto") === "auto",
|
|
3696
3873
|
y: (r.overscrollBehaviorY || "auto") === "auto"
|
|
3697
3874
|
},
|
|
3698
3875
|
scrollbarSize: {
|
|
3699
|
-
x:
|
|
3700
|
-
y:
|
|
3876
|
+
x: fi(r.getPropertyValue("--mw-scrollbar-size-x")),
|
|
3877
|
+
y: fi(r.getPropertyValue("--mw-scrollbar-size-y"))
|
|
3701
3878
|
},
|
|
3702
3879
|
scrollbarInset: {
|
|
3703
|
-
x:
|
|
3704
|
-
y:
|
|
3880
|
+
x: fi(r.getPropertyValue("--mw-scrollbar-inset-x"), 0),
|
|
3881
|
+
y: fi(r.getPropertyValue("--mw-scrollbar-inset-y"), 0)
|
|
3705
3882
|
},
|
|
3706
3883
|
whiteSpace: r.whiteSpace === "pre" ? "pre" : r.whiteSpace === "nowrap" ? "nowrap" : "normal",
|
|
3707
3884
|
tabSize: Math.max(1, Math.floor(parseFloat(r.tabSize)) || 8),
|
|
3708
|
-
lineGap:
|
|
3709
|
-
tracking:
|
|
3885
|
+
lineGap: Ai(r.lineHeight, i),
|
|
3886
|
+
tracking: ki(r.letterSpacing, i, n?.letterSpacing ?? 0),
|
|
3710
3887
|
textOverflow: r.textOverflow === "ellipsis" ? "ellipsis" : "clip",
|
|
3711
3888
|
color: r.color,
|
|
3712
3889
|
fontWeight: r.fontWeight,
|
|
3713
3890
|
fontStyle: r.fontStyle,
|
|
3714
3891
|
textDecorationLine: r.textDecorationLine,
|
|
3715
|
-
backgroundColor:
|
|
3892
|
+
backgroundColor: ai(e, r.backgroundColor, r),
|
|
3716
3893
|
backgroundClear: r.getPropertyValue("--mw-bg-clear").trim() === "1",
|
|
3717
3894
|
borderColor: {
|
|
3718
3895
|
top: r.borderTopColor,
|
|
@@ -3720,18 +3897,18 @@ function Mr(e, t, n) {
|
|
|
3720
3897
|
bottom: r.borderBottomColor,
|
|
3721
3898
|
left: r.borderLeftColor
|
|
3722
3899
|
},
|
|
3723
|
-
textAlignBlocked:
|
|
3724
|
-
textAlign:
|
|
3725
|
-
textIndent:
|
|
3726
|
-
opacity:
|
|
3900
|
+
textAlignBlocked: Si(e, r),
|
|
3901
|
+
textAlign: Ci(e, r),
|
|
3902
|
+
textIndent: Ii(r, t),
|
|
3903
|
+
opacity: Fi(r.opacity),
|
|
3727
3904
|
glyphSet: r.getPropertyValue("--mw-border-glyphs").trim() || null,
|
|
3728
3905
|
zIndex: r.zIndex === "auto" || r.zIndex === "" ? null : Number(r.zIndex) || 0,
|
|
3729
3906
|
latticeBorder: null,
|
|
3730
|
-
ruleX: m === "flex" || m === "grid" || m === "multicol" ?
|
|
3731
|
-
ruleY: m === "flex" || m === "grid" ?
|
|
3732
|
-
ruleBreak:
|
|
3733
|
-
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0,
|
|
3734
|
-
ruleVisibilityItems:
|
|
3907
|
+
ruleX: m === "flex" || m === "grid" || m === "multicol" ? xi(r, "x") : null,
|
|
3908
|
+
ruleY: m === "flex" || m === "grid" ? xi(r, "y") : null,
|
|
3909
|
+
ruleBreak: bi(r, "--mw-rule-break", ["none", "intersection"], "normal"),
|
|
3910
|
+
ruleInset: r.getPropertyValue("--mw-rule-inset").trim() === "overlap-join" ? "overlap-join" : Math.max(0, M(parseFloat(r.getPropertyValue("--mw-rule-inset")) || 0)),
|
|
3911
|
+
ruleVisibilityItems: bi(r, "--mw-rule-visibility-items", [
|
|
3735
3912
|
"all",
|
|
3736
3913
|
"around",
|
|
3737
3914
|
"between"
|
|
@@ -3744,9 +3921,9 @@ function Mr(e, t, n) {
|
|
|
3744
3921
|
breakAfterColumn: r.breakAfter === "column",
|
|
3745
3922
|
breakInsideAvoid: r.breakInside === "avoid" || r.breakInside === "avoid-column"
|
|
3746
3923
|
};
|
|
3747
|
-
return
|
|
3924
|
+
return ri(T, r), T;
|
|
3748
3925
|
}
|
|
3749
|
-
function
|
|
3926
|
+
function ri(e, t) {
|
|
3750
3927
|
t.borderCollapse === "collapse" && (e.display === "table" || e.tableRole === "cell" || e.tableRole === "row" || e.tableRole === "row-group" || e.tableRole === "header-group" || e.tableRole === "footer-group") && (e.latticeBorder = {
|
|
3751
3928
|
width: e.border,
|
|
3752
3929
|
style: e.borderStyle,
|
|
@@ -3757,37 +3934,37 @@ function Nr(e, t) {
|
|
|
3757
3934
|
bottom: t.borderBottomStyle === "hidden",
|
|
3758
3935
|
left: t.borderLeftStyle === "hidden"
|
|
3759
3936
|
}
|
|
3760
|
-
}, e.border =
|
|
3937
|
+
}, e.border = R(), e.display === "table" && (e.padding = R()));
|
|
3761
3938
|
}
|
|
3762
|
-
function
|
|
3939
|
+
function ii(e) {
|
|
3763
3940
|
if (!e) return !0;
|
|
3764
3941
|
let t = e.trim().toLowerCase();
|
|
3765
3942
|
return t === "" || t === "transparent" || t === "rgba(0, 0, 0, 0)" || t === "currentcolor";
|
|
3766
3943
|
}
|
|
3767
|
-
function
|
|
3768
|
-
let i = r(e,
|
|
3944
|
+
function ai(e, t, n) {
|
|
3945
|
+
let i = r(e, ii(t) ? "" : t, n);
|
|
3769
3946
|
return i === "" ? void 0 : i;
|
|
3770
3947
|
}
|
|
3771
|
-
function
|
|
3948
|
+
function oi(e) {
|
|
3772
3949
|
return e === "hidden" || e === "clip";
|
|
3773
3950
|
}
|
|
3774
|
-
var
|
|
3775
|
-
function
|
|
3776
|
-
if (
|
|
3951
|
+
var si = /* @__PURE__ */ new WeakMap(), ci = null;
|
|
3952
|
+
function li(e) {
|
|
3953
|
+
if (ci !== null) return ci;
|
|
3777
3954
|
if (!e.body) return !0;
|
|
3778
3955
|
let t = e.createElement("div");
|
|
3779
|
-
return t.style.cssText = "position: absolute; width: 0; height: 0; overflow: auto", e.body.appendChild(t),
|
|
3956
|
+
return t.style.cssText = "position: absolute; width: 0; height: 0; overflow: auto", e.body.appendChild(t), ci = getComputedStyle(t).scrollbarWidth !== "none", t.remove(), ci;
|
|
3780
3957
|
}
|
|
3781
|
-
function
|
|
3782
|
-
if (!
|
|
3958
|
+
function ui(e, t) {
|
|
3959
|
+
if (!li(e.ownerDocument)) return "auto";
|
|
3783
3960
|
if (e.hasAttribute("data-mw-scroll")) {
|
|
3784
|
-
let t =
|
|
3961
|
+
let t = si.get(e);
|
|
3785
3962
|
if (t !== void 0) return t;
|
|
3786
3963
|
}
|
|
3787
3964
|
let n = t.scrollbarWidth === "none" ? "none" : "auto";
|
|
3788
|
-
return
|
|
3965
|
+
return si.set(e, n), n;
|
|
3789
3966
|
}
|
|
3790
|
-
function
|
|
3967
|
+
function di(e) {
|
|
3791
3968
|
let t = (e ?? "").trim();
|
|
3792
3969
|
if (!t || t === "auto") return null;
|
|
3793
3970
|
let n = 0;
|
|
@@ -3802,25 +3979,25 @@ function Vr(e) {
|
|
|
3802
3979
|
}
|
|
3803
3980
|
return null;
|
|
3804
3981
|
}
|
|
3805
|
-
function
|
|
3982
|
+
function fi(e, t = 1) {
|
|
3806
3983
|
return Math.max(t, Math.floor(Number(e) || t));
|
|
3807
3984
|
}
|
|
3808
|
-
function
|
|
3809
|
-
return
|
|
3985
|
+
function pi(e) {
|
|
3986
|
+
return oi(e) ? "clip" : e === "auto" || e === "scroll" ? e : "visible";
|
|
3810
3987
|
}
|
|
3811
|
-
function
|
|
3812
|
-
let t =
|
|
3988
|
+
function mi(e) {
|
|
3989
|
+
let t = pi(e.overflowX || e.overflow), n = pi(e.overflowY || e.overflow);
|
|
3813
3990
|
return t !== "visible" && n === "visible" && (n = "auto"), n !== "visible" && t === "visible" && (t = "auto"), {
|
|
3814
3991
|
x: t,
|
|
3815
3992
|
y: n
|
|
3816
3993
|
};
|
|
3817
3994
|
}
|
|
3818
|
-
function
|
|
3995
|
+
function hi(e, t) {
|
|
3819
3996
|
if (t.position !== "absolute" && t.position !== "fixed") return !1;
|
|
3820
3997
|
let n = t.clip.replace(/\s/g, "");
|
|
3821
|
-
return n === "rect(0px,0px,0px,0px)" || n === "rect(0,0,0,0)" || !
|
|
3998
|
+
return n === "rect(0px,0px,0px,0px)" || n === "rect(0,0,0,0)" || !se(e.tagName) && (oi(t.overflow) || oi(t.overflowX)) && parseFloat(t.width) <= 1 && parseFloat(t.height) <= 1;
|
|
3822
3999
|
}
|
|
3823
|
-
var
|
|
4000
|
+
var gi = {
|
|
3824
4001
|
TABLE: "table",
|
|
3825
4002
|
THEAD: "table-header-group",
|
|
3826
4003
|
TBODY: "table-row-group",
|
|
@@ -3831,7 +4008,7 @@ var Kr = {
|
|
|
3831
4008
|
CAPTION: "table-caption",
|
|
3832
4009
|
COL: "table-column",
|
|
3833
4010
|
COLGROUP: "table-column-group"
|
|
3834
|
-
},
|
|
4011
|
+
}, _i = {
|
|
3835
4012
|
"table-header-group": "header-group",
|
|
3836
4013
|
"table-row-group": "row-group",
|
|
3837
4014
|
"table-footer-group": "footer-group",
|
|
@@ -3841,38 +4018,38 @@ var Kr = {
|
|
|
3841
4018
|
"table-column": "column",
|
|
3842
4019
|
"table-column-group": "column-group"
|
|
3843
4020
|
};
|
|
3844
|
-
function
|
|
4021
|
+
function vi(e, t) {
|
|
3845
4022
|
let n = t.verticalAlign || e.getAttribute("valign")?.toLowerCase() || (e.tagName === "TD" || e.tagName === "TH" ? "middle" : "baseline");
|
|
3846
4023
|
return n === "top" ? "start" : n === "middle" ? "center" : n === "bottom" ? "end" : "start";
|
|
3847
4024
|
}
|
|
3848
|
-
function
|
|
3849
|
-
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") &&
|
|
4025
|
+
function yi(e, t, n) {
|
|
4026
|
+
(/(?:^|[\s:.[!])text-(?:xs|sm|base|lg|[2-9]?xl)(?![\w-])/.test(t) || /(?:^|[\s:.[!])text-\[(?:(?:length|size):|[\d.])/.test(t) || n.fontSize !== "") && j(e, "font-size inside <mono-wind> is ignored — all text shares the host's cell size. Size the <mono-wind> element itself instead.");
|
|
3850
4027
|
}
|
|
3851
|
-
function
|
|
4028
|
+
function bi(e, t, n, r) {
|
|
3852
4029
|
let i = e.getPropertyValue(t).trim();
|
|
3853
4030
|
return n.includes(i) ? i : r;
|
|
3854
4031
|
}
|
|
3855
|
-
function
|
|
3856
|
-
let n =
|
|
4032
|
+
function xi(e, t) {
|
|
4033
|
+
let n = M(parseFloat(e.getPropertyValue(`--mw-rule-${t}-width`)) || 0);
|
|
3857
4034
|
if (n <= 0) return null;
|
|
3858
4035
|
let r = e.getPropertyValue(`--mw-rule-${t}-color`).trim();
|
|
3859
4036
|
return {
|
|
3860
4037
|
width: n,
|
|
3861
|
-
style:
|
|
4038
|
+
style: Ni(e.getPropertyValue(`--mw-rule-${t}-style`).trim()),
|
|
3862
4039
|
color: r && r !== "currentcolor" && r !== "currentColor" ? r : e.color
|
|
3863
4040
|
};
|
|
3864
4041
|
}
|
|
3865
|
-
function
|
|
4042
|
+
function Si(e, t) {
|
|
3866
4043
|
return t.textAlign === "justify" || e.getAttribute("align")?.toLowerCase() === "justify";
|
|
3867
4044
|
}
|
|
3868
|
-
function
|
|
4045
|
+
function Ci(e, t) {
|
|
3869
4046
|
let n = t.textAlign || e.getAttribute("align")?.toLowerCase() || "";
|
|
3870
4047
|
return n === "right" || n === "end" ? "end" : n === "center" || n.endsWith("-center") ? "center" : "start";
|
|
3871
4048
|
}
|
|
3872
|
-
function
|
|
4049
|
+
function wi(e) {
|
|
3873
4050
|
return typeof e.computedStyleMap == "function";
|
|
3874
4051
|
}
|
|
3875
|
-
function
|
|
4052
|
+
function Ti(e) {
|
|
3876
4053
|
switch (e) {
|
|
3877
4054
|
case "center": return "center";
|
|
3878
4055
|
case "flex-end":
|
|
@@ -3887,7 +4064,7 @@ function ti(e) {
|
|
|
3887
4064
|
default: return "start";
|
|
3888
4065
|
}
|
|
3889
4066
|
}
|
|
3890
|
-
function
|
|
4067
|
+
function Ei(e) {
|
|
3891
4068
|
switch (e) {
|
|
3892
4069
|
case "center": return "center";
|
|
3893
4070
|
case "flex-end":
|
|
@@ -3898,10 +4075,10 @@ function ni(e) {
|
|
|
3898
4075
|
default: return "start";
|
|
3899
4076
|
}
|
|
3900
4077
|
}
|
|
3901
|
-
function
|
|
3902
|
-
return e === "auto" || e === "" || e === "normal" ? "auto" :
|
|
4078
|
+
function Di(e) {
|
|
4079
|
+
return e === "auto" || e === "" || e === "normal" ? "auto" : Ei(e);
|
|
3903
4080
|
}
|
|
3904
|
-
function
|
|
4081
|
+
function Oi(e, t, n, r, i) {
|
|
3905
4082
|
let a = (a, o, s) => {
|
|
3906
4083
|
if (t) {
|
|
3907
4084
|
let e = t.get(a)?.toString().trim();
|
|
@@ -3913,10 +4090,10 @@ function ii(e, t, n, r, i) {
|
|
|
3913
4090
|
} else if (s.test(n) || r.getPropertyValue(a) === "auto") return null;
|
|
3914
4091
|
let c = e.getPropertyValue(a);
|
|
3915
4092
|
if (c === "auto") return null;
|
|
3916
|
-
let l =
|
|
4093
|
+
let l = Q(c, i);
|
|
3917
4094
|
if (l !== 0) return l;
|
|
3918
4095
|
let u = e.getPropertyValue(o);
|
|
3919
|
-
return u === "auto" ? null :
|
|
4096
|
+
return u === "auto" ? null : Q(u, i);
|
|
3920
4097
|
};
|
|
3921
4098
|
return {
|
|
3922
4099
|
top: a("margin-top", "margin-block-start", /(?:^|[\s:.[!])(?:m|my|mt)-auto\b/),
|
|
@@ -3925,16 +4102,16 @@ function ii(e, t, n, r, i) {
|
|
|
3925
4102
|
left: a("margin-left", "margin-inline-start", /(?:^|[\s:.[!])(?:m|mx|ml|ms)-auto\b/)
|
|
3926
4103
|
};
|
|
3927
4104
|
}
|
|
3928
|
-
function
|
|
4105
|
+
function ki(e, t, n) {
|
|
3929
4106
|
let r = (e === "normal" ? 0 : parseFloat(e) || 0) - n;
|
|
3930
4107
|
return r <= 0 ? 0 : Math.floor(r / (.025 * t) + 1e-6);
|
|
3931
4108
|
}
|
|
3932
|
-
function
|
|
4109
|
+
function Ai(e, t) {
|
|
3933
4110
|
if (!e || e === "normal" || t <= 0) return 0;
|
|
3934
4111
|
let n = parseFloat(e);
|
|
3935
4112
|
return Number.isFinite(n) ? Math.max(0, Math.floor(n / t + 1e-6) - 1) : 0;
|
|
3936
4113
|
}
|
|
3937
|
-
function
|
|
4114
|
+
function ji(e) {
|
|
3938
4115
|
switch (e) {
|
|
3939
4116
|
case "relative":
|
|
3940
4117
|
case "absolute":
|
|
@@ -3943,17 +4120,17 @@ function si(e) {
|
|
|
3943
4120
|
default: return "static";
|
|
3944
4121
|
}
|
|
3945
4122
|
}
|
|
3946
|
-
function
|
|
4123
|
+
function Mi(e, t, n, r, i) {
|
|
3947
4124
|
let a = (a, o) => {
|
|
3948
4125
|
if (t) {
|
|
3949
4126
|
let e = t.get(a)?.toString().trim();
|
|
3950
|
-
return !e || e === "auto" ? null :
|
|
4127
|
+
return !e || e === "auto" ? null : Q(e, i);
|
|
3951
4128
|
}
|
|
3952
4129
|
let s = r[a];
|
|
3953
|
-
if (s) return s === "auto" ? null :
|
|
4130
|
+
if (s) return s === "auto" ? null : Q(s, i);
|
|
3954
4131
|
if (!o.test(n)) return null;
|
|
3955
4132
|
let c = e.getPropertyValue(a);
|
|
3956
|
-
return !c || c === "auto" ? null :
|
|
4133
|
+
return !c || c === "auto" ? null : Q(c, i);
|
|
3957
4134
|
};
|
|
3958
4135
|
return {
|
|
3959
4136
|
top: a("top", /(?:^|[\s:.[!])-?(?:top|inset|inset-y)-/),
|
|
@@ -3962,7 +4139,7 @@ function ci(e, t, n, r, i) {
|
|
|
3962
4139
|
left: a("left", /(?:^|[\s:.[!])-?(?:left|start|inset|inset-x)-/)
|
|
3963
4140
|
};
|
|
3964
4141
|
}
|
|
3965
|
-
function
|
|
4142
|
+
function Ni(e) {
|
|
3966
4143
|
switch (e) {
|
|
3967
4144
|
case "double": return "double";
|
|
3968
4145
|
case "dashed": return "dashed";
|
|
@@ -3970,7 +4147,7 @@ function li(e) {
|
|
|
3970
4147
|
default: return "solid";
|
|
3971
4148
|
}
|
|
3972
4149
|
}
|
|
3973
|
-
function
|
|
4150
|
+
function Pi(e, t) {
|
|
3974
4151
|
if (!e || e === "none" || e === "auto") return;
|
|
3975
4152
|
if (e === "min-content" || e === "max-content" || e === "fit-content") return e;
|
|
3976
4153
|
if (e.endsWith("%")) {
|
|
@@ -3978,44 +4155,44 @@ function ui(e, t) {
|
|
|
3978
4155
|
return Number.isFinite(t) ? { percent: t } : void 0;
|
|
3979
4156
|
}
|
|
3980
4157
|
let n = parseFloat(e);
|
|
3981
|
-
return Number.isFinite(n) ?
|
|
4158
|
+
return Number.isFinite(n) ? N(n, t) : void 0;
|
|
3982
4159
|
}
|
|
3983
|
-
function
|
|
4160
|
+
function Q(e, t) {
|
|
3984
4161
|
if (!e || e === "auto" || e === "none") return 0;
|
|
3985
4162
|
if (e.endsWith("%")) {
|
|
3986
4163
|
let t = parseFloat(e);
|
|
3987
4164
|
return Number.isFinite(t) && t !== 0 ? { percent: t } : 0;
|
|
3988
4165
|
}
|
|
3989
4166
|
let n = parseFloat(e);
|
|
3990
|
-
return Number.isFinite(n) ?
|
|
4167
|
+
return Number.isFinite(n) ? N(n, t) : 0;
|
|
3991
4168
|
}
|
|
3992
|
-
function
|
|
4169
|
+
function Fi(e) {
|
|
3993
4170
|
let t = parseFloat(e);
|
|
3994
4171
|
return Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : 1;
|
|
3995
4172
|
}
|
|
3996
|
-
function
|
|
4173
|
+
function Ii(e, t) {
|
|
3997
4174
|
let n = e.textIndent;
|
|
3998
4175
|
if (!n || n.endsWith("%")) return 0;
|
|
3999
4176
|
let r = parseFloat(n);
|
|
4000
|
-
return Number.isFinite(r) ? Math.max(0,
|
|
4177
|
+
return Number.isFinite(r) ? Math.max(0, N(r, t)) : 0;
|
|
4001
4178
|
}
|
|
4002
|
-
function
|
|
4003
|
-
let s =
|
|
4179
|
+
function Li(e, t, n, r, i, a, o) {
|
|
4180
|
+
let s = Ri(n === "width" ? a.width : a.height);
|
|
4004
4181
|
if (s !== null) return {
|
|
4005
4182
|
kind: "cells",
|
|
4006
|
-
value:
|
|
4183
|
+
value: Bi(s, n, o, r)
|
|
4007
4184
|
};
|
|
4008
|
-
let c =
|
|
4185
|
+
let c = Vi(e, n, t, i, n === "width" ? "w" : "h", a, o, r);
|
|
4009
4186
|
if (c !== void 0) return {
|
|
4010
4187
|
kind: "cells",
|
|
4011
4188
|
value: c
|
|
4012
4189
|
};
|
|
4013
|
-
let l =
|
|
4190
|
+
let l = zi(i, n === "width" ? "w" : "h");
|
|
4014
4191
|
if (l !== null) {
|
|
4015
4192
|
let i = parseFloat(e ? String(e.get(n) ?? "") : t), a = Number.isFinite(i) && Math.abs(i - l) <= l * .3;
|
|
4016
4193
|
if (a || !Number.isFinite(i)) return {
|
|
4017
4194
|
kind: "cells",
|
|
4018
|
-
value:
|
|
4195
|
+
value: Bi(a ? i : l, n, o, r)
|
|
4019
4196
|
};
|
|
4020
4197
|
}
|
|
4021
4198
|
if (e) {
|
|
@@ -4023,7 +4200,7 @@ function pi(e, t, n, r, i, a, o) {
|
|
|
4023
4200
|
if (t == null) return;
|
|
4024
4201
|
let i = t.toString().trim();
|
|
4025
4202
|
if (i === "auto") return { kind: "auto" };
|
|
4026
|
-
let a =
|
|
4203
|
+
let a = Gi(i);
|
|
4027
4204
|
if (a) return a;
|
|
4028
4205
|
if (i.endsWith("%")) return {
|
|
4029
4206
|
kind: "percent",
|
|
@@ -4031,22 +4208,22 @@ function pi(e, t, n, r, i, a, o) {
|
|
|
4031
4208
|
};
|
|
4032
4209
|
if (i.endsWith("px")) return {
|
|
4033
4210
|
kind: "cells",
|
|
4034
|
-
value:
|
|
4211
|
+
value: N(parseFloat(i), r)
|
|
4035
4212
|
};
|
|
4036
4213
|
if (i.endsWith("rem")) return {
|
|
4037
4214
|
kind: "cells",
|
|
4038
|
-
value:
|
|
4215
|
+
value: M(parseFloat(i) / .25)
|
|
4039
4216
|
};
|
|
4040
|
-
let s =
|
|
4217
|
+
let s = Ri(i);
|
|
4041
4218
|
if (s !== null) return {
|
|
4042
4219
|
kind: "cells",
|
|
4043
|
-
value:
|
|
4220
|
+
value: Bi(s, n, o, r)
|
|
4044
4221
|
};
|
|
4045
4222
|
}
|
|
4046
4223
|
let u = n === "width" ? a.width : a.height;
|
|
4047
4224
|
if (u) {
|
|
4048
4225
|
if (u === "auto") return { kind: "auto" };
|
|
4049
|
-
let e =
|
|
4226
|
+
let e = Gi(u);
|
|
4050
4227
|
if (e) return e;
|
|
4051
4228
|
if (u.endsWith("%")) return {
|
|
4052
4229
|
kind: "percent",
|
|
@@ -4055,7 +4232,7 @@ function pi(e, t, n, r, i, a, o) {
|
|
|
4055
4232
|
let t = parseFloat(u);
|
|
4056
4233
|
if (Number.isFinite(t)) return {
|
|
4057
4234
|
kind: "cells",
|
|
4058
|
-
value:
|
|
4235
|
+
value: N(t, r)
|
|
4059
4236
|
};
|
|
4060
4237
|
}
|
|
4061
4238
|
let d = n === "width" ? "w" : "h";
|
|
@@ -4079,9 +4256,9 @@ function pi(e, t, n, r, i, a, o) {
|
|
|
4079
4256
|
let m = RegExp(`(?:^|[\\s:.[!])${d}-(\\d+(?:\\.\\d+)?)(?![\\w-/])`).exec(i);
|
|
4080
4257
|
if (m) return {
|
|
4081
4258
|
kind: "cells",
|
|
4082
|
-
value:
|
|
4259
|
+
value: M(Number(m[1]))
|
|
4083
4260
|
};
|
|
4084
|
-
if (!
|
|
4261
|
+
if (!ra(i, d) || t === "auto") return { kind: "auto" };
|
|
4085
4262
|
if (t.endsWith("%")) return {
|
|
4086
4263
|
kind: "percent",
|
|
4087
4264
|
value: parseFloat(t)
|
|
@@ -4089,10 +4266,10 @@ function pi(e, t, n, r, i, a, o) {
|
|
|
4089
4266
|
let h = parseFloat(t);
|
|
4090
4267
|
if (Number.isFinite(h)) return {
|
|
4091
4268
|
kind: "cells",
|
|
4092
|
-
value:
|
|
4269
|
+
value: N(h, r)
|
|
4093
4270
|
};
|
|
4094
4271
|
}
|
|
4095
|
-
function
|
|
4272
|
+
function Ri(e) {
|
|
4096
4273
|
let t = /^(-?[\d.]+)((?:[dsl]?v)(?:h|w|min|max)|vi|vb)$/.exec(e.trim());
|
|
4097
4274
|
if (!t || typeof window > "u") return null;
|
|
4098
4275
|
let n = parseFloat(t[1]);
|
|
@@ -4100,7 +4277,7 @@ function mi(e) {
|
|
|
4100
4277
|
let r = t[2], i = window.innerHeight, a = window.innerWidth, o = r.endsWith("h") ? i : r.endsWith("min") ? Math.min(a, i) : r.endsWith("max") ? Math.max(a, i) : r === "vb" ? i : a;
|
|
4101
4278
|
return n / 100 * o;
|
|
4102
4279
|
}
|
|
4103
|
-
function
|
|
4280
|
+
function zi(e, t) {
|
|
4104
4281
|
if (typeof window > "u") return null;
|
|
4105
4282
|
let n = RegExp(`(?:^|[\\s:.[!])${t}-(screen|[dsl]v[hw])(?![\\w-])`).exec(e);
|
|
4106
4283
|
if (n) {
|
|
@@ -4108,25 +4285,25 @@ function hi(e, t) {
|
|
|
4108
4285
|
return e === "screen" ? t.includes("h") ? window.innerHeight : window.innerWidth : e.endsWith("h") ? window.innerHeight : window.innerWidth;
|
|
4109
4286
|
}
|
|
4110
4287
|
let r = RegExp(`(?:^|[\\s:.[!])${t}-\\[(-?[\\d.]+(?:[dsl]?v(?:h|w|min|max)|vi|vb))\\]`).exec(e);
|
|
4111
|
-
return r ?
|
|
4288
|
+
return r ? Ri(r[1]) : null;
|
|
4112
4289
|
}
|
|
4113
|
-
function
|
|
4290
|
+
function Bi(e, t, n, r) {
|
|
4114
4291
|
let i = t === "width" ? n?.width : n?.height;
|
|
4115
|
-
return i && i > 0 ? Math.max(0, Math.floor(e / i)) :
|
|
4292
|
+
return i && i > 0 ? Math.max(0, Math.floor(e / i)) : N(e, r);
|
|
4116
4293
|
}
|
|
4117
|
-
function
|
|
4294
|
+
function Vi(e, t, n, r, i, a, o, s) {
|
|
4118
4295
|
let c = t.endsWith("width") ? "width" : "height", l = a.getPropertyValue(t).trim(), u = l.startsWith("calc(");
|
|
4119
4296
|
if (!u && !r.includes("-[calc(")) return;
|
|
4120
4297
|
let d = RegExp(`(?:^|[\\s:.[!])${i}-\\[(calc\\([^\\]]*\\))\\]`).exec(r), f = u ? l : d?.[1]?.replaceAll("_", " ");
|
|
4121
4298
|
if (!f) return;
|
|
4122
|
-
let p =
|
|
4299
|
+
let p = Hi(f, c, o, s);
|
|
4123
4300
|
if (!p || p.unitless) return;
|
|
4124
|
-
let m = Math.max(0,
|
|
4301
|
+
let m = Math.max(0, M(p.cells));
|
|
4125
4302
|
if (u) return m;
|
|
4126
4303
|
let h = (e ? String(e.get(t) ?? "") : n).trim(), g = parseFloat(h);
|
|
4127
4304
|
return (Number.isFinite(g) ? Math.abs(g - p.px) <= Math.abs(p.px) * .3 : h === "") ? m : void 0;
|
|
4128
4305
|
}
|
|
4129
|
-
function
|
|
4306
|
+
function Hi(e, t, n, r) {
|
|
4130
4307
|
let i = e.match(/--spacing\(\s*-?[\d.]+\s*\)|calc|[\d.]+[a-z%]*|[()+\-*/]/g);
|
|
4131
4308
|
if (!i || i.join("").replace(/\s+/g, "") !== e.replace(/\s+/g, "")) return null;
|
|
4132
4309
|
let a = 0, o = () => i[a], s = () => i[a++], c = (e, t) => ({
|
|
@@ -4150,8 +4327,8 @@ function vi(e, t, n, r) {
|
|
|
4150
4327
|
};
|
|
4151
4328
|
if (s === "px") return c(o / (r / 4), o);
|
|
4152
4329
|
if (s === "rem") return c(o * 4, o * r);
|
|
4153
|
-
let l =
|
|
4154
|
-
return l === null ? null : c(
|
|
4330
|
+
let l = Ri(e);
|
|
4331
|
+
return l === null ? null : c(Bi(l, t, n, r), l);
|
|
4155
4332
|
}, u = (e, t, n) => {
|
|
4156
4333
|
if (e === "+" || e === "-") {
|
|
4157
4334
|
if (t.unitless !== n.unitless) return null;
|
|
@@ -4208,17 +4385,17 @@ function vi(e, t, n, r) {
|
|
|
4208
4385
|
}, h = m();
|
|
4209
4386
|
return a === i.length ? h : null;
|
|
4210
4387
|
}
|
|
4211
|
-
function
|
|
4212
|
-
let c = t.endsWith("width") ? "width" : "height", l =
|
|
4213
|
-
if (l !== null) return
|
|
4214
|
-
let u =
|
|
4388
|
+
function Ui(e, t, n, r, i, a, o, s) {
|
|
4389
|
+
let c = t.endsWith("width") ? "width" : "height", l = Ri(a.getPropertyValue(t)) ?? Ri(e?.get(t)?.toString().trim() ?? "");
|
|
4390
|
+
if (l !== null) return Bi(l, c, o, s);
|
|
4391
|
+
let u = zi(r, i);
|
|
4215
4392
|
if (u === null) return;
|
|
4216
4393
|
let d = (e ? String(e.get(t) ?? "") : n).trim(), f = parseFloat(d), p = Number.isFinite(f) && Math.abs(f - u) <= u * .3;
|
|
4217
|
-
if (p || d === "") return
|
|
4394
|
+
if (p || d === "") return Bi(p ? f : u, c, o, s);
|
|
4218
4395
|
}
|
|
4219
|
-
function
|
|
4396
|
+
function Wi(e, t) {
|
|
4220
4397
|
if (!e || e === "auto" || e === "content") return;
|
|
4221
|
-
let n =
|
|
4398
|
+
let n = Gi(e);
|
|
4222
4399
|
if (n) return n;
|
|
4223
4400
|
if (e.endsWith("%")) {
|
|
4224
4401
|
let t = parseFloat(e);
|
|
@@ -4230,30 +4407,30 @@ function bi(e, t) {
|
|
|
4230
4407
|
let r = parseFloat(e);
|
|
4231
4408
|
return Number.isFinite(r) ? {
|
|
4232
4409
|
kind: "cells",
|
|
4233
|
-
value:
|
|
4410
|
+
value: N(r, t)
|
|
4234
4411
|
} : void 0;
|
|
4235
4412
|
}
|
|
4236
|
-
function
|
|
4413
|
+
function Gi(e) {
|
|
4237
4414
|
if (e === "min-content") return { kind: "min-content" };
|
|
4238
4415
|
if (e === "max-content") return { kind: "max-content" };
|
|
4239
4416
|
if (e === "fit-content") return { kind: "fit-content" };
|
|
4240
4417
|
}
|
|
4241
|
-
function
|
|
4418
|
+
function Ki(e, t) {
|
|
4242
4419
|
let n = e.trim();
|
|
4243
4420
|
if (!n || n === "none") return { kind: "none" };
|
|
4244
4421
|
if (n === "subgrid" || n.startsWith("subgrid ")) return { kind: "subgrid" };
|
|
4245
4422
|
let r = [], i = [], a = [], o = (e) => {
|
|
4246
4423
|
i.push(a), a = [], r.push(e);
|
|
4247
4424
|
}, s;
|
|
4248
|
-
for (let e of
|
|
4249
|
-
let n =
|
|
4425
|
+
for (let e of ea(n)) {
|
|
4426
|
+
let n = Ji(e);
|
|
4250
4427
|
if (n) {
|
|
4251
4428
|
a.push(...n);
|
|
4252
4429
|
continue;
|
|
4253
4430
|
}
|
|
4254
4431
|
let i = e.match(/^repeat\(\s*([^,]+?)\s*,(.*)\)$/s);
|
|
4255
4432
|
if (i) {
|
|
4256
|
-
let e =
|
|
4433
|
+
let e = qi(i[2].trim(), t);
|
|
4257
4434
|
if (e.tracks.length === 0) continue;
|
|
4258
4435
|
let n = i[1];
|
|
4259
4436
|
if (n === "auto-fill" || n === "auto-fit") {
|
|
@@ -4271,7 +4448,7 @@ function Si(e, t) {
|
|
|
4271
4448
|
}
|
|
4272
4449
|
continue;
|
|
4273
4450
|
}
|
|
4274
|
-
o(
|
|
4451
|
+
o(Zi(e, t));
|
|
4275
4452
|
}
|
|
4276
4453
|
if (i.push(a), r.length === 0 && !s) return { kind: "none" };
|
|
4277
4454
|
let c = {
|
|
@@ -4280,26 +4457,26 @@ function Si(e, t) {
|
|
|
4280
4457
|
};
|
|
4281
4458
|
return i.some((e) => e.length > 0) && (c.lineNames = i), s && (c.autoRepeat = s), c;
|
|
4282
4459
|
}
|
|
4283
|
-
function
|
|
4460
|
+
function qi(e, t) {
|
|
4284
4461
|
let n = [], r = [], i = [];
|
|
4285
|
-
for (let a of
|
|
4286
|
-
let e =
|
|
4462
|
+
for (let a of ea(e)) {
|
|
4463
|
+
let e = Ji(a);
|
|
4287
4464
|
if (e) {
|
|
4288
4465
|
i.push(...e);
|
|
4289
4466
|
continue;
|
|
4290
4467
|
}
|
|
4291
|
-
r.push(i), i = [], n.push(
|
|
4468
|
+
r.push(i), i = [], n.push(Zi(a, t));
|
|
4292
4469
|
}
|
|
4293
4470
|
return r.push(i), {
|
|
4294
4471
|
tracks: n,
|
|
4295
4472
|
lineNames: r
|
|
4296
4473
|
};
|
|
4297
4474
|
}
|
|
4298
|
-
function
|
|
4475
|
+
function Ji(e) {
|
|
4299
4476
|
let t = e.match(/^\[(.*)\]$/s);
|
|
4300
4477
|
return t ? t[1].split(/\s+/).filter((e) => e !== "") : null;
|
|
4301
4478
|
}
|
|
4302
|
-
function
|
|
4479
|
+
function Yi(e) {
|
|
4303
4480
|
let t = [];
|
|
4304
4481
|
for (let n of e.matchAll(/"([^"]*)"|'([^']*)'/g)) {
|
|
4305
4482
|
let e = (n[1] ?? n[2] ?? "").trim().split(/\s+/).filter((e) => e !== "");
|
|
@@ -4329,23 +4506,23 @@ function Ti(e) {
|
|
|
4329
4506
|
areas: r
|
|
4330
4507
|
};
|
|
4331
4508
|
}
|
|
4332
|
-
function
|
|
4333
|
-
let n =
|
|
4334
|
-
return n.length > 0 ? n : [
|
|
4509
|
+
function Xi(e, t) {
|
|
4510
|
+
let n = ea(e.trim()).filter((e) => e !== "" && !e.startsWith("[")).map((e) => Zi(e, t));
|
|
4511
|
+
return n.length > 0 ? n : [ot()];
|
|
4335
4512
|
}
|
|
4336
|
-
function
|
|
4513
|
+
function Zi(e, t) {
|
|
4337
4514
|
let n = e.match(/^minmax\((.*)\)$/s);
|
|
4338
4515
|
if (n) {
|
|
4339
|
-
let e =
|
|
4516
|
+
let e = $i(n[1]).map((e) => e.trim());
|
|
4340
4517
|
return e.length === 2 ? {
|
|
4341
|
-
min:
|
|
4342
|
-
max:
|
|
4518
|
+
min: Qi(e[0], t),
|
|
4519
|
+
max: Qi(e[1], t)
|
|
4343
4520
|
} : {
|
|
4344
4521
|
min: { kind: "auto" },
|
|
4345
4522
|
max: { kind: "auto" }
|
|
4346
4523
|
};
|
|
4347
4524
|
}
|
|
4348
|
-
let r =
|
|
4525
|
+
let r = Qi(e, t);
|
|
4349
4526
|
return r.kind === "fr" ? {
|
|
4350
4527
|
min: { kind: "auto" },
|
|
4351
4528
|
max: r
|
|
@@ -4354,13 +4531,13 @@ function Di(e, t) {
|
|
|
4354
4531
|
max: r
|
|
4355
4532
|
};
|
|
4356
4533
|
}
|
|
4357
|
-
function
|
|
4534
|
+
function Qi(e, t) {
|
|
4358
4535
|
if (e === "auto" || e.startsWith("fit-content")) return { kind: "auto" };
|
|
4359
4536
|
if (e === "min-content") return { kind: "min-content" };
|
|
4360
4537
|
if (e === "max-content") return { kind: "max-content" };
|
|
4361
4538
|
let n = e.match(/^(min|max)\((.*)\)$/s);
|
|
4362
4539
|
if (n) {
|
|
4363
|
-
let e =
|
|
4540
|
+
let e = $i(n[2]).map((e) => Qi(e.trim(), t)), r = e.every((e) => e.kind === "cells" || e.kind === "percent" || e.kind === "math");
|
|
4364
4541
|
return e.length > 0 && r ? {
|
|
4365
4542
|
kind: "math",
|
|
4366
4543
|
fn: n[1],
|
|
@@ -4384,10 +4561,10 @@ function Oi(e, t) {
|
|
|
4384
4561
|
let r = parseFloat(e);
|
|
4385
4562
|
return Number.isFinite(r) ? {
|
|
4386
4563
|
kind: "cells",
|
|
4387
|
-
value: e.endsWith("rem") ?
|
|
4564
|
+
value: e.endsWith("rem") ? M(r / .25) : N(r, t)
|
|
4388
4565
|
} : { kind: "auto" };
|
|
4389
4566
|
}
|
|
4390
|
-
function
|
|
4567
|
+
function $i(e) {
|
|
4391
4568
|
let t = [], n = 0, r = 0;
|
|
4392
4569
|
for (let i = 0; i < e.length; i++) {
|
|
4393
4570
|
let a = e[i];
|
|
@@ -4395,7 +4572,7 @@ function ki(e) {
|
|
|
4395
4572
|
}
|
|
4396
4573
|
return t.push(e.slice(r)), t.filter((e) => e.trim() !== "");
|
|
4397
4574
|
}
|
|
4398
|
-
function
|
|
4575
|
+
function ea(e) {
|
|
4399
4576
|
let t = [], n = 0, r = -1;
|
|
4400
4577
|
for (let i = 0; i < e.length; i++) {
|
|
4401
4578
|
let a = e[i];
|
|
@@ -4403,7 +4580,7 @@ function Ai(e) {
|
|
|
4403
4580
|
}
|
|
4404
4581
|
return r !== -1 && t.push(e.slice(r)), t;
|
|
4405
4582
|
}
|
|
4406
|
-
function
|
|
4583
|
+
function ta(e) {
|
|
4407
4584
|
let t = e.trim();
|
|
4408
4585
|
if (!t || t === "auto") return { kind: "auto" };
|
|
4409
4586
|
let n = !1, r, i;
|
|
@@ -4431,25 +4608,25 @@ function ji(e) {
|
|
|
4431
4608
|
nth: r
|
|
4432
4609
|
};
|
|
4433
4610
|
}
|
|
4434
|
-
function
|
|
4611
|
+
function na(e) {
|
|
4435
4612
|
return {
|
|
4436
4613
|
direction: e.includes("column") ? "column" : "row",
|
|
4437
4614
|
dense: e.includes("dense")
|
|
4438
4615
|
};
|
|
4439
4616
|
}
|
|
4440
|
-
function
|
|
4617
|
+
function ra(e, t) {
|
|
4441
4618
|
return (t === "w" ? /(?:^|[\s:.[!])w-/ : /(?:^|[\s:.[!])h-/).test(e);
|
|
4442
4619
|
}
|
|
4443
|
-
function
|
|
4620
|
+
function ia(e, t) {
|
|
4444
4621
|
return {
|
|
4445
|
-
top:
|
|
4446
|
-
right:
|
|
4447
|
-
bottom:
|
|
4448
|
-
left:
|
|
4622
|
+
top: Q(e.getPropertyValue("padding-top"), t),
|
|
4623
|
+
right: Q(e.getPropertyValue("padding-right"), t),
|
|
4624
|
+
bottom: Q(e.getPropertyValue("padding-bottom"), t),
|
|
4625
|
+
left: Q(e.getPropertyValue("padding-left"), t)
|
|
4449
4626
|
};
|
|
4450
4627
|
}
|
|
4451
|
-
function
|
|
4452
|
-
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 :
|
|
4628
|
+
function aa(e) {
|
|
4629
|
+
let t = (t, n) => e.getPropertyValue(n) === "none" ? 0 : M(parseFloat(e.getPropertyValue(t)) || 0);
|
|
4453
4630
|
return {
|
|
4454
4631
|
top: t("border-top-width", "border-top-style"),
|
|
4455
4632
|
right: t("border-right-width", "border-right-style"),
|
|
@@ -4459,14 +4636,14 @@ function Fi(e) {
|
|
|
4459
4636
|
}
|
|
4460
4637
|
//#endregion
|
|
4461
4638
|
//#region src/tree.ts
|
|
4462
|
-
function
|
|
4463
|
-
let i =
|
|
4639
|
+
function oa(e, t, n, r) {
|
|
4640
|
+
let i = ni(e, t, n);
|
|
4464
4641
|
if (i.display === "none") return null;
|
|
4465
|
-
let a =
|
|
4466
|
-
if (a) return
|
|
4467
|
-
let o = Array.from(e.children), s = o.map(
|
|
4642
|
+
let a = se(e.tagName);
|
|
4643
|
+
if (a) return sa(e, i, a);
|
|
4644
|
+
let o = Array.from(e.children), s = o.map(fa), c = e.tagName, l = wa(c);
|
|
4468
4645
|
if (!s.includes("block") || l) {
|
|
4469
|
-
let a =
|
|
4646
|
+
let a = pa(e, i.tracking, {
|
|
4470
4647
|
rootFontSizePx: t,
|
|
4471
4648
|
rootLetterSpacingPx: n?.letterSpacing ?? 0,
|
|
4472
4649
|
cellMetrics: n,
|
|
@@ -4475,12 +4652,12 @@ function Ii(e, t, n, r) {
|
|
|
4475
4652
|
tabSize: i.tabSize
|
|
4476
4653
|
}), u = a.chars.join("");
|
|
4477
4654
|
if (a.boxes.length > 0) {
|
|
4478
|
-
let e =
|
|
4655
|
+
let e = Ln();
|
|
4479
4656
|
Fe(a.chars, (t, n) => {
|
|
4480
4657
|
a.advances[t] = Math.max(1, q(a.boxes[n], e));
|
|
4481
4658
|
});
|
|
4482
4659
|
}
|
|
4483
|
-
let d =
|
|
4660
|
+
let d = ya(u, a.advances, i.tracking);
|
|
4484
4661
|
if (l && d === 0) {
|
|
4485
4662
|
if (c === "INPUT") d = Number(e.size) || 20;
|
|
4486
4663
|
else if (c === "TEXTAREA") d = Number(e.cols) || 20;
|
|
@@ -4489,7 +4666,7 @@ function Ii(e, t, n, r) {
|
|
|
4489
4666
|
d = Math.max(1, ...r.map((e) => e.trim().length));
|
|
4490
4667
|
}
|
|
4491
4668
|
}
|
|
4492
|
-
let f = u.length > 0 ?
|
|
4669
|
+
let f = u.length > 0 ? ba(u) : 0, p;
|
|
4493
4670
|
if (c === "TEXTAREA") {
|
|
4494
4671
|
let t = e, n = t.value ?? "", a = r?.get(t), o = +!!n.endsWith("\n"), s = a !== void 0 && a > 0 ? Oe(n, a) + o : n === "" ? 0 : n.split(/\r\n?|\n/).length, c = getComputedStyle(e).getPropertyValue("field-sizing") === "content" ? 1 : Number(t.rows) || 2, l = Math.max(c, s);
|
|
4495
4672
|
p = l + Math.max(0, l - 1) * i.lineGap;
|
|
@@ -4501,11 +4678,11 @@ function Ii(e, t, n, r) {
|
|
|
4501
4678
|
let i = o[e], a = m.get(i);
|
|
4502
4679
|
if (a) g.push(a);
|
|
4503
4680
|
else if (s[e] === "out-of-flow") {
|
|
4504
|
-
let e =
|
|
4681
|
+
let e = oa(i, t, n, r);
|
|
4505
4682
|
e && g.push(e);
|
|
4506
4683
|
}
|
|
4507
4684
|
}
|
|
4508
|
-
g.push(...h);
|
|
4685
|
+
h.length > 0 && (g.push(...h), g.sort((e, t) => e.source.compareDocumentPosition(t.source) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1));
|
|
4509
4686
|
let _ = {
|
|
4510
4687
|
source: e,
|
|
4511
4688
|
style: i,
|
|
@@ -4520,14 +4697,16 @@ function Ii(e, t, n, r) {
|
|
|
4520
4697
|
height: p
|
|
4521
4698
|
},
|
|
4522
4699
|
unclampedHeight: 0,
|
|
4523
|
-
resolvedPadding:
|
|
4700
|
+
resolvedPadding: R()
|
|
4524
4701
|
};
|
|
4525
|
-
|
|
4702
|
+
(a.advances.some((e) => e !== 1) || a.boxes.length > 0) && (_.advances = a.advances), a.inlineElements.length > 0 && (_.inlineElements = a.inlineElements, _.charInline = a.chars.map((e, t) => a.inlineIndex[t] ?? -1));
|
|
4703
|
+
let v = va(a);
|
|
4704
|
+
return v.length > 0 && (_.charSource = v), _;
|
|
4526
4705
|
}
|
|
4527
4706
|
let u = [];
|
|
4528
4707
|
for (let e = 0; e < o.length; e++) {
|
|
4529
4708
|
if (s[e] === "none") continue;
|
|
4530
|
-
let i =
|
|
4709
|
+
let i = oa(o[e], t, n, r);
|
|
4531
4710
|
i && u.push(i);
|
|
4532
4711
|
}
|
|
4533
4712
|
let d = {
|
|
@@ -4544,14 +4723,14 @@ function Ii(e, t, n, r) {
|
|
|
4544
4723
|
height: 0
|
|
4545
4724
|
},
|
|
4546
4725
|
unclampedHeight: 0,
|
|
4547
|
-
resolvedPadding:
|
|
4726
|
+
resolvedPadding: R()
|
|
4548
4727
|
};
|
|
4549
|
-
return
|
|
4728
|
+
return Ta(e, d), d;
|
|
4550
4729
|
}
|
|
4551
|
-
function
|
|
4552
|
-
let r =
|
|
4730
|
+
function sa(e, t, n) {
|
|
4731
|
+
let r = ue(n, e), i = r?.lines ?? [], a = i.join("\n");
|
|
4553
4732
|
t.whiteSpace = "pre", (t.width === void 0 || t.width.kind === "auto") && (t.width = { kind: "max-content" });
|
|
4554
|
-
let o = Array.from({ length: a.length }, () => 1 + t.tracking), s =
|
|
4733
|
+
let o = Array.from({ length: a.length }, () => 1 + t.tracking), s = ya(a, o, t.tracking), c = i.length, l = {
|
|
4555
4734
|
source: e,
|
|
4556
4735
|
style: t,
|
|
4557
4736
|
children: [],
|
|
@@ -4565,7 +4744,7 @@ function Li(e, t, n) {
|
|
|
4565
4744
|
height: c
|
|
4566
4745
|
},
|
|
4567
4746
|
unclampedHeight: 0,
|
|
4568
|
-
resolvedPadding:
|
|
4747
|
+
resolvedPadding: R()
|
|
4569
4748
|
};
|
|
4570
4749
|
t.tracking > 0 && (l.advances = o);
|
|
4571
4750
|
let u = r?.runs ?? [];
|
|
@@ -4593,95 +4772,111 @@ function Li(e, t, n) {
|
|
|
4593
4772
|
}
|
|
4594
4773
|
return l;
|
|
4595
4774
|
}
|
|
4596
|
-
var
|
|
4597
|
-
function
|
|
4598
|
-
return t || (
|
|
4775
|
+
var ca = /* @__PURE__ */ new Set(/* @__PURE__ */ "A.ABBR.B.BDI.BDO.BR.CITE.CODE.DATA.DFN.EM.I.KBD.MARK.Q.S.SAMP.SMALL.SPAN.STRONG.SUB.SUP.TIME.U.VAR.WBR".split("."));
|
|
4776
|
+
function la(e, t) {
|
|
4777
|
+
return t || (ca.has(e.tagName) ? "inline" : "block");
|
|
4599
4778
|
}
|
|
4600
|
-
function
|
|
4601
|
-
let n =
|
|
4779
|
+
function ua(e, t) {
|
|
4780
|
+
let n = la(e, t);
|
|
4602
4781
|
return n === "inline" || n === "contents";
|
|
4603
4782
|
}
|
|
4604
|
-
function
|
|
4605
|
-
let n =
|
|
4783
|
+
function da(e, t) {
|
|
4784
|
+
let n = la(e, t);
|
|
4606
4785
|
return n.startsWith("inline") && n !== "inline";
|
|
4607
4786
|
}
|
|
4608
|
-
function
|
|
4787
|
+
function fa(e) {
|
|
4609
4788
|
let t = getComputedStyle(e);
|
|
4610
|
-
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" :
|
|
4789
|
+
return t.display === "none" ? "none" : t.position === "absolute" || t.position === "fixed" ? "out-of-flow" : se(e.tagName) ? "block" : ua(e, t.display) || da(e, t.display) ? "inline" : "block";
|
|
4611
4790
|
}
|
|
4612
|
-
function
|
|
4791
|
+
function pa(e, t, n) {
|
|
4613
4792
|
let r = {
|
|
4614
4793
|
chars: [],
|
|
4615
4794
|
advances: [],
|
|
4795
|
+
sourceNode: [],
|
|
4796
|
+
sourceOffset: [],
|
|
4616
4797
|
inlineIndex: [],
|
|
4617
4798
|
inlineElements: [],
|
|
4618
4799
|
boxes: []
|
|
4619
4800
|
};
|
|
4620
|
-
return
|
|
4801
|
+
return ma(e, t, n, r), n.preserve ? r : _a(r);
|
|
4621
4802
|
}
|
|
4622
|
-
function
|
|
4803
|
+
function ma(e, t, n, r) {
|
|
4623
4804
|
let i = () => {
|
|
4624
4805
|
let e = 0;
|
|
4625
4806
|
for (let t = r.chars.length - 1; t >= 0 && r.chars[t] !== "\n"; t--) e += r.advances[t];
|
|
4626
4807
|
return e;
|
|
4627
4808
|
};
|
|
4628
|
-
if (
|
|
4809
|
+
if (!wa(e.tagName)) {
|
|
4629
4810
|
for (let a of Array.from(e.childNodes)) if (a.nodeType === Node.TEXT_NODE) {
|
|
4630
|
-
if (n.preserve)
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4811
|
+
if (n.preserve) {
|
|
4812
|
+
let e = a.textContent ?? "", o = 0;
|
|
4813
|
+
for (let s of e) {
|
|
4814
|
+
let c = o;
|
|
4815
|
+
if (o += s.length, s === "\r") {
|
|
4816
|
+
if (e[o] === "\n") continue;
|
|
4817
|
+
$(r, "\n", 0, a, c);
|
|
4818
|
+
} else if (s === "\n") $(r, "\n", 0, a, c);
|
|
4819
|
+
else if (s === " ") {
|
|
4820
|
+
let e = (Math.floor(i() / n.tabSize) + 1) * n.tabSize;
|
|
4821
|
+
for (let t = i(); t < e; t++) $(r, " ", 1, a, c);
|
|
4822
|
+
} else $(r, s, 1 + t, a, c);
|
|
4823
|
+
}
|
|
4824
|
+
} else {
|
|
4825
|
+
let e = 0, n = !1;
|
|
4826
|
+
for (let i of a.textContent ?? "") {
|
|
4827
|
+
let o = i === " " || i === " " || i === "\r" || i === "\n" || i === "\f";
|
|
4828
|
+
o ? n || $(r, " ", 1 + t, a, e) : $(r, i, 1 + t, a, e), n = o, e += i.length;
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4636
4831
|
} else if (a.nodeType === Node.ELEMENT_NODE) {
|
|
4637
4832
|
let e = a;
|
|
4638
4833
|
if (e.tagName === "BR") {
|
|
4639
|
-
r
|
|
4834
|
+
$(r, "\n", 0, null, -1);
|
|
4640
4835
|
continue;
|
|
4641
4836
|
}
|
|
4642
4837
|
let t = getComputedStyle(e);
|
|
4643
4838
|
if (t.display === "none" || t.position === "absolute" || t.position === "fixed") continue;
|
|
4644
|
-
if (
|
|
4645
|
-
let t =
|
|
4646
|
-
t && (t.inlineBox = !0, r
|
|
4839
|
+
if (da(e, t.display)) {
|
|
4840
|
+
let t = oa(e, n.rootFontSizePx, n.cellMetrics, n.textareaWidths);
|
|
4841
|
+
t && (t.inlineBox = !0, $(r, "", 1, null, -1), r.boxes.push(t));
|
|
4647
4842
|
continue;
|
|
4648
4843
|
}
|
|
4649
|
-
if (!
|
|
4650
|
-
|
|
4844
|
+
if (!ua(e, t.display)) {
|
|
4845
|
+
xa(e);
|
|
4651
4846
|
continue;
|
|
4652
4847
|
}
|
|
4653
|
-
let i =
|
|
4848
|
+
let i = ki(t.letterSpacing, parseFloat(t.fontSize) || n.rootFontSizePx, n.rootLetterSpacingPx), o = ha(t.paddingLeft, n.rootFontSizePx), s = ha(t.paddingRight, n.rootFontSizePx);
|
|
4654
4849
|
r.inlineElements.push({
|
|
4655
4850
|
element: e,
|
|
4656
4851
|
tracking: i,
|
|
4657
4852
|
padLeft: o,
|
|
4658
4853
|
padRight: s,
|
|
4659
|
-
insets: t.position === "static" ? null :
|
|
4854
|
+
insets: t.position === "static" ? null : ga(t, n.rootFontSizePx),
|
|
4660
4855
|
color: t.color,
|
|
4661
|
-
backgroundColor:
|
|
4856
|
+
backgroundColor: ii(t.backgroundColor) ? void 0 : t.backgroundColor,
|
|
4662
4857
|
fontWeight: t.fontWeight,
|
|
4663
4858
|
fontStyle: t.fontStyle,
|
|
4664
4859
|
textDecorationLine: t.textDecorationLine
|
|
4665
4860
|
});
|
|
4666
4861
|
let c = r.inlineElements.length - 1;
|
|
4667
|
-
for (let e = 0; e < o; e++) r.inlineIndex[r.chars.length] = c, r
|
|
4862
|
+
for (let e = 0; e < o; e++) r.inlineIndex[r.chars.length] = c, $(r, "", 1, null, -1);
|
|
4668
4863
|
let l = r.chars.length;
|
|
4669
|
-
|
|
4864
|
+
ma(e, i, n, r);
|
|
4670
4865
|
for (let e = l; e < r.chars.length; e++) r.inlineIndex[e] === void 0 && (r.inlineIndex[e] = c);
|
|
4671
|
-
for (let e = 0; e < s; e++) r.inlineIndex[r.chars.length] = c, r
|
|
4866
|
+
for (let e = 0; e < s; e++) r.inlineIndex[r.chars.length] = c, $(r, "", 1, null, -1);
|
|
4672
4867
|
}
|
|
4673
4868
|
}
|
|
4674
4869
|
}
|
|
4675
|
-
function
|
|
4870
|
+
function ha(e, t) {
|
|
4676
4871
|
if (!e || e.endsWith("%")) return 0;
|
|
4677
4872
|
let n = parseFloat(e);
|
|
4678
|
-
return Number.isFinite(n) ? Math.max(0,
|
|
4873
|
+
return Number.isFinite(n) ? Math.max(0, N(n, t)) : 0;
|
|
4679
4874
|
}
|
|
4680
|
-
function
|
|
4875
|
+
function ga(e, t) {
|
|
4681
4876
|
let n = (e) => {
|
|
4682
4877
|
if (!e || e === "auto" || e.endsWith("%")) return null;
|
|
4683
4878
|
let n = parseFloat(e);
|
|
4684
|
-
return Number.isFinite(n) ?
|
|
4879
|
+
return Number.isFinite(n) ? N(n, t) : null;
|
|
4685
4880
|
};
|
|
4686
4881
|
return {
|
|
4687
4882
|
top: n(e.top),
|
|
@@ -4690,55 +4885,73 @@ function Ki(e, t) {
|
|
|
4690
4885
|
left: n(e.left)
|
|
4691
4886
|
};
|
|
4692
4887
|
}
|
|
4693
|
-
function
|
|
4694
|
-
let t = [], n = [], r = [], i = () => {
|
|
4888
|
+
function _a(e) {
|
|
4889
|
+
let t = [], n = [], r = [], i = [], a = [], o = () => {
|
|
4695
4890
|
let e = t.length;
|
|
4696
4891
|
for (; e > 0 && t[e - 1] !== "\n";) e--;
|
|
4697
4892
|
return e;
|
|
4698
|
-
},
|
|
4699
|
-
for (; t.length >
|
|
4893
|
+
}, s = () => {
|
|
4894
|
+
for (; t.length > o() && t[t.length - 1] === " ";) t.pop(), n.pop(), r.pop(), i.pop(), a.pop();
|
|
4700
4895
|
};
|
|
4701
|
-
for (let
|
|
4702
|
-
let
|
|
4703
|
-
if (
|
|
4896
|
+
for (let o = 0; o < e.chars.length; o++) {
|
|
4897
|
+
let c = e.chars[o];
|
|
4898
|
+
if (c === " ") {
|
|
4704
4899
|
let e = t.length - 1;
|
|
4705
4900
|
for (; e >= 0 && t[e] === "";) e--;
|
|
4706
4901
|
if (e < 0 || t[e] === "\n" || t[e] === " ") continue;
|
|
4707
|
-
} else
|
|
4708
|
-
t.push(
|
|
4902
|
+
} else c === "\n" && s();
|
|
4903
|
+
t.push(c), n.push(e.advances[o]), r.push(e.sourceNode[o] ?? null), i.push(e.sourceOffset[o] ?? -1), a.push(e.inlineIndex[o] ?? -1);
|
|
4709
4904
|
}
|
|
4710
|
-
return
|
|
4905
|
+
return s(), {
|
|
4711
4906
|
chars: t,
|
|
4712
4907
|
advances: n,
|
|
4713
|
-
|
|
4908
|
+
sourceNode: r,
|
|
4909
|
+
sourceOffset: i,
|
|
4910
|
+
inlineIndex: a,
|
|
4714
4911
|
inlineElements: e.inlineElements,
|
|
4715
4912
|
boxes: e.boxes
|
|
4716
4913
|
};
|
|
4717
4914
|
}
|
|
4718
|
-
function
|
|
4915
|
+
function $(e, t, n, r, i) {
|
|
4916
|
+
e.chars.push(t), e.advances.push(n), e.sourceNode.push(r), e.sourceOffset.push(i);
|
|
4917
|
+
}
|
|
4918
|
+
function va(e) {
|
|
4919
|
+
let t = [], n = 0;
|
|
4920
|
+
for (let r = 0; r < e.chars.length; r++) {
|
|
4921
|
+
let i = e.chars[r], a = e.sourceNode[r], o = e.sourceOffset[r], s = t[t.length - 1];
|
|
4922
|
+
a && (s && s.node === a && s.offset + s.length === o ? s.length += i.length : t.push({
|
|
4923
|
+
index: n,
|
|
4924
|
+
length: i.length,
|
|
4925
|
+
node: a,
|
|
4926
|
+
offset: o
|
|
4927
|
+
})), n += i.length;
|
|
4928
|
+
}
|
|
4929
|
+
return t;
|
|
4930
|
+
}
|
|
4931
|
+
function ya(e, t, n) {
|
|
4719
4932
|
let r = 0, i = 0;
|
|
4720
|
-
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r,
|
|
4933
|
+
for (let a = 0; a <= e.length; a++) (a === e.length || e[a] === "\n") && (r = Math.max(r, P(i, a, t, n)), i = a + 1);
|
|
4721
4934
|
return r;
|
|
4722
4935
|
}
|
|
4723
|
-
function
|
|
4936
|
+
function ba(e) {
|
|
4724
4937
|
return Ae(e).length;
|
|
4725
4938
|
}
|
|
4726
|
-
function
|
|
4727
|
-
|
|
4939
|
+
function xa(e) {
|
|
4940
|
+
j(e, "A block-level element nested inside a text run can't be laid out and was skipped. Give it its own place in the layout instead.");
|
|
4728
4941
|
}
|
|
4729
|
-
function
|
|
4942
|
+
function Sa(e) {
|
|
4730
4943
|
return Array.from(e.childNodes).some((e) => e.nodeType === Node.TEXT_NODE && /[^ \t\r\n\f]/.test(e.textContent ?? ""));
|
|
4731
4944
|
}
|
|
4732
|
-
var
|
|
4733
|
-
function
|
|
4945
|
+
var Ca = "Direct text next to block-level children can't be laid out and was hidden. Wrap each text segment in its own element (e.g. a <div>).";
|
|
4946
|
+
function wa(e) {
|
|
4734
4947
|
return e === "INPUT" || e === "SELECT" || e === "TEXTAREA";
|
|
4735
4948
|
}
|
|
4736
|
-
function
|
|
4737
|
-
|
|
4949
|
+
function Ta(e, t) {
|
|
4950
|
+
Sa(e) && (t.droppedText = !0, j(e, Ca));
|
|
4738
4951
|
}
|
|
4739
4952
|
//#endregion
|
|
4740
4953
|
//#region src/element.ts
|
|
4741
|
-
var
|
|
4954
|
+
var Ea = "\n<style>\n :host { display: block; position: relative; contain: layout style; }\n #viewport { position: relative; width: 100%; height: 100%; background: inherit; }\n /* When the host hides its own dropped direct text (visibility, see\n * styles.css), the render layer must not sink with it. Scoped to that\n * state so an authored 'invisible' on the host stays intact. */\n :host([data-mw-dropped-text]) #viewport { visibility: visible; }\n /* The unified grid: one <pre> with same-paint-run spans, cell-precise\n * (one monospace character = one cell). In select=\"grid\" (the\n * default, reflected onto the attribute — see DEFAULT_SELECT) the\n * grid catches drags for native selection of the ASCII; interactive\n * elements opt back into pointer-events via styles.css so clicks\n * still work. In select=\"text\" the grid is inert to events and drag\n * selects the light DOM natively. */\n /* Sized by the engine's ink extent (element.ts), not the host box:\n * visible overflow paints past the host (specs/cell-model.md\n * \"Overflow\"), and the host's background follows it there — the\n * host is the canvas, as the root element's background covers a\n * document's overflow — inherited through #viewport, the shadow\n * parent. (A translucent host background paints repeatedly inside\n * the box.) */\n #grid { position: absolute; top: 0; left: 0; margin: 0; background: inherit; font: inherit; line-height: inherit; letter-spacing: inherit; white-space: pre; pointer-events: none; user-select: none; -webkit-user-select: none; }\n :host([select=\"grid\"]) #grid { pointer-events: auto; user-select: text; -webkit-user-select: text; }\n :host([select=\"grid\"]) slot { pointer-events: none; user-select: none; -webkit-user-select: none; }\n /* A live semantic selection (specs/semantic-selection.md) lifts the\n * lock so the element selection copies; pointer events stay off. */\n :host([select=\"grid\"][data-mw-semantic-selection]) slot { user-select: text; -webkit-user-select: text; }\n /* Selection invert — mirror of the canonical rule in styles.css\n * (which explains the field choices); update together. */\n ::selection { color: var(--mw-bg, canvas); text-shadow: 0 0 0 var(--mw-bg, canvas); background: var(--mw-fg, canvastext); }\n</style>\n<div id=\"viewport\">\n <pre id=\"grid\" aria-hidden=\"true\"></pre>\n <slot></slot>\n</div>\n", Da = "grid", Oa = "data-mw-semantic-selection", ka = "a, button, input, select, textarea, label, [tabindex], [role='button']", Aa = [
|
|
4742
4955
|
"pointerover",
|
|
4743
4956
|
"pointerleave",
|
|
4744
4957
|
"pointerdown",
|
|
@@ -4750,12 +4963,12 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4750
4963
|
"focusout",
|
|
4751
4964
|
"input",
|
|
4752
4965
|
"change"
|
|
4753
|
-
],
|
|
4966
|
+
], ja = /^(color|opacity|border-(top|right|bottom|left)-color|border-color)$/, Ma = 3e4, Na = 200, Pa = 3, Fa = 4, Ia = 8, La = 100, Ra = 160, za = typeof HTMLElement > "u" ? class {} : HTMLElement, Ba = class e extends za {
|
|
4754
4967
|
static observedAttributes = ["select"];
|
|
4755
4968
|
static #e = /* @__PURE__ */ new Set();
|
|
4756
4969
|
static #t = null;
|
|
4757
4970
|
static #n = () => {
|
|
4758
|
-
for (let t of e.#e) t.#
|
|
4971
|
+
for (let t of e.#e) t.#Me();
|
|
4759
4972
|
};
|
|
4760
4973
|
static #r(t) {
|
|
4761
4974
|
t instanceof HTMLLinkElement && t.rel === "stylesheet" && !t.sheet && t.addEventListener("load", e.#n, { once: !0 });
|
|
@@ -4792,8 +5005,12 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4792
5005
|
#y = /* @__PURE__ */ new WeakMap();
|
|
4793
5006
|
#b = null;
|
|
4794
5007
|
#x = null;
|
|
4795
|
-
#S =
|
|
4796
|
-
#C
|
|
5008
|
+
#S = "";
|
|
5009
|
+
#C = null;
|
|
5010
|
+
#w = null;
|
|
5011
|
+
#T = !1;
|
|
5012
|
+
#E = [];
|
|
5013
|
+
#D() {
|
|
4797
5014
|
this.#u?.observe(this, {
|
|
4798
5015
|
childList: !0,
|
|
4799
5016
|
subtree: !0,
|
|
@@ -4805,80 +5022,80 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4805
5022
|
"colspan",
|
|
4806
5023
|
"rowspan",
|
|
4807
5024
|
"span",
|
|
4808
|
-
...
|
|
5025
|
+
...ce()
|
|
4809
5026
|
]
|
|
4810
5027
|
});
|
|
4811
5028
|
}
|
|
4812
5029
|
constructor() {
|
|
4813
|
-
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML =
|
|
5030
|
+
super(), this.#o = this.attachShadow({ mode: "open" }), this.#o.innerHTML = Ea, this.#s = this.#o.getElementById("grid"), this.#c = document.createElement("span"), this.#c.setAttribute("aria-hidden", "true"), this.#c.setAttribute("data-mw-probe", ""), this.#c.style.cssText = "position:absolute!important;top:0!important;left:0!important;visibility:hidden!important;pointer-events:none!important;user-select:none!important;white-space:pre!important;overflow-wrap:normal!important;padding:0!important;margin:0!important;border:0!important;", this.#c.textContent = "M".repeat(100);
|
|
4814
5031
|
}
|
|
4815
5032
|
connectedCallback() {
|
|
4816
|
-
this.hasAttribute("select") || this.setAttribute("select",
|
|
4817
|
-
this.#
|
|
4818
|
-
}), this.#h = C(() => this.#
|
|
5033
|
+
this.hasAttribute("select") || this.setAttribute("select", Da), this.#c.parentNode !== this && this.appendChild(this.#c), this.#l = new ResizeObserver(() => this.#Me()), this.#l.observe(this), this.#Y(), this.#l.observe(this.#c), window.addEventListener("resize", this.#Oe), this.#u = new MutationObserver(() => this.#Me()), this.#D(), this.#m = le(() => {
|
|
5034
|
+
this.#D(), this.#Me();
|
|
5035
|
+
}), this.#h = C(() => this.#Me()), document.fonts?.ready.then(this.#ke).catch((e) => {
|
|
4819
5036
|
console.warn("[monowind] document.fonts.ready failed:", e);
|
|
4820
|
-
}), document.fonts?.addEventListener("loadingdone", this.#
|
|
4821
|
-
for (let e of
|
|
4822
|
-
this.addEventListener("transitionrun", this.#
|
|
5037
|
+
}), document.fonts?.addEventListener("loadingdone", this.#ke);
|
|
5038
|
+
for (let e of Aa) this.addEventListener(e, this.#De);
|
|
5039
|
+
this.addEventListener("transitionrun", this.#we), this.addEventListener("transitionend", this.#Te), this.addEventListener("transitioncancel", this.#Te), this.addEventListener("pointermove", this.#Q), this.addEventListener("pointerleave", this.#he), this.addEventListener("pointerdown", this.#ge), this.addEventListener("scroll", this.#W, {
|
|
4823
5040
|
capture: !0,
|
|
4824
5041
|
passive: !0
|
|
4825
|
-
}), this.addEventListener("scrollend", this.#
|
|
5042
|
+
}), this.addEventListener("scrollend", this.#G, { capture: !0 }), this.addEventListener("wheel", this.#q, { passive: !1 }), this.addEventListener("copy", this.#$), this.addEventListener("mousedown", this.#ee), document.addEventListener("selectionchange", this.#me), window.addEventListener("pointerup", this.#_e), window.addEventListener("pointercancel", this.#_e), document.addEventListener("scroll", this.#ve, {
|
|
4826
5043
|
capture: !0,
|
|
4827
5044
|
passive: !0
|
|
4828
|
-
}), e.#i(this), this.#
|
|
5045
|
+
}), e.#i(this), this.#Me();
|
|
4829
5046
|
}
|
|
4830
5047
|
disconnectedCallback() {
|
|
4831
|
-
window.removeEventListener("resize", this.#
|
|
4832
|
-
for (let e of
|
|
4833
|
-
this.removeEventListener("transitionrun", this.#
|
|
5048
|
+
window.removeEventListener("resize", this.#Oe), this.#l?.disconnect(), this.#u?.disconnect(), this.#l = null, this.#u = null, this.#m?.(), this.#m = null, this.#h?.(), this.#h = null, document.fonts?.removeEventListener("loadingdone", this.#ke);
|
|
5049
|
+
for (let e of Aa) this.removeEventListener(e, this.#De);
|
|
5050
|
+
this.removeEventListener("transitionrun", this.#we), this.removeEventListener("transitionend", this.#Te), this.removeEventListener("transitioncancel", this.#Te), this.#xe = 0, this.removeEventListener("pointermove", this.#Q), this.removeEventListener("pointerleave", this.#he), this.removeEventListener("pointerdown", this.#ge), this.removeEventListener("scroll", this.#W, { capture: !0 }), this.removeEventListener("scrollend", this.#G, { capture: !0 }), this.removeEventListener("wheel", this.#q), this.removeEventListener("copy", this.#$), this.removeEventListener("mousedown", this.#ee), document.removeEventListener("selectionchange", this.#me);
|
|
4834
5051
|
for (let e of this.#v.values()) clearTimeout(e);
|
|
4835
|
-
this.#v.clear(), this.#x = null, this.#b = null, window.removeEventListener("pointerup", this.#
|
|
4836
|
-
}
|
|
4837
|
-
#
|
|
4838
|
-
#
|
|
4839
|
-
#
|
|
4840
|
-
#
|
|
4841
|
-
#
|
|
4842
|
-
#
|
|
4843
|
-
#
|
|
4844
|
-
#
|
|
4845
|
-
#
|
|
4846
|
-
static #
|
|
4847
|
-
#
|
|
5052
|
+
this.#v.clear(), this.#x = null, this.#b = null, window.removeEventListener("pointerup", this.#_e), window.removeEventListener("pointercancel", this.#_e), document.removeEventListener("scroll", this.#ve, { capture: !0 }), this.#N = null, this.#A = null, this.#j = !1, this.#M = !1, this.#ye(), e.#a(this);
|
|
5053
|
+
}
|
|
5054
|
+
#O = /* @__PURE__ */ new Set();
|
|
5055
|
+
#k = /* @__PURE__ */ new Set();
|
|
5056
|
+
#A = null;
|
|
5057
|
+
#j = !1;
|
|
5058
|
+
#M = !1;
|
|
5059
|
+
#N = null;
|
|
5060
|
+
#P = NaN;
|
|
5061
|
+
#F = NaN;
|
|
5062
|
+
#I = null;
|
|
5063
|
+
static #L = typeof matchMedia > "u" ? null : matchMedia("(hover: hover)");
|
|
5064
|
+
#R() {
|
|
4848
5065
|
if (this.#g || this.#d) return;
|
|
4849
5066
|
this.#g = !0;
|
|
4850
5067
|
let e = !1, t = () => {
|
|
4851
5068
|
if (e) return;
|
|
4852
5069
|
e = !0, this.#g = !1;
|
|
4853
5070
|
let t = this.#f;
|
|
4854
|
-
this.isConnected && this.#p && t && (this.#
|
|
5071
|
+
this.isConnected && this.#p && t && (this.#z(t), this.#M = !Ur(this.#p, this.#s, this.#ne()), this.#ye());
|
|
4855
5072
|
};
|
|
4856
5073
|
requestAnimationFrame(t), setTimeout(t, 50);
|
|
4857
5074
|
}
|
|
4858
|
-
#
|
|
5075
|
+
#z(e, t) {
|
|
4859
5076
|
for (let n of this.#_) {
|
|
4860
5077
|
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, o = t?.get(r);
|
|
4861
5078
|
n.scroll = o ? {
|
|
4862
5079
|
x: o.pinX ? i : Math.min(o.x, i),
|
|
4863
5080
|
y: o.pinY ? a : Math.min(o.y, a)
|
|
4864
|
-
} : this.#
|
|
5081
|
+
} : this.#B(n, e);
|
|
4865
5082
|
}
|
|
4866
5083
|
}
|
|
4867
|
-
#
|
|
5084
|
+
#B(e, t) {
|
|
4868
5085
|
let n = e.source, { maxX: r, maxY: i } = e.scrollRange, a = e.scroll ?? {
|
|
4869
5086
|
x: 0,
|
|
4870
5087
|
y: 0
|
|
4871
5088
|
};
|
|
4872
5089
|
return {
|
|
4873
|
-
x:
|
|
4874
|
-
y:
|
|
5090
|
+
x: Ha(n, "x", t.width, r, a.x),
|
|
5091
|
+
y: Ha(n, "y", t.height, i, a.y)
|
|
4875
5092
|
};
|
|
4876
5093
|
}
|
|
4877
|
-
#
|
|
5094
|
+
#V() {
|
|
4878
5095
|
let e = /* @__PURE__ */ new Map(), t = this.#f;
|
|
4879
5096
|
if (!t) return e;
|
|
4880
5097
|
for (let n of this.#_) {
|
|
4881
|
-
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, { x: o, y: s } = this.#
|
|
5098
|
+
let r = n.source, { maxX: i, maxY: a } = n.scrollRange, { x: o, y: s } = this.#B(n, t);
|
|
4882
5099
|
e.set(r, {
|
|
4883
5100
|
top: r.scrollTop,
|
|
4884
5101
|
left: r.scrollLeft,
|
|
@@ -4890,42 +5107,42 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4890
5107
|
}
|
|
4891
5108
|
return e;
|
|
4892
5109
|
}
|
|
4893
|
-
#
|
|
5110
|
+
#H(e) {
|
|
4894
5111
|
for (let t of this.#_) {
|
|
4895
5112
|
let n = t.source, r = e.get(n);
|
|
4896
5113
|
r && (n.scrollTop, n.scrollLeft, n.scrollTop = r.pinY ? n.scrollHeight : r.top, n.scrollLeft = r.pinX ? n.scrollWidth : r.left);
|
|
4897
5114
|
}
|
|
4898
5115
|
}
|
|
4899
|
-
#
|
|
4900
|
-
clearTimeout(this.#v.get(e)), this.#v.set(e, setTimeout(() => this.#
|
|
5116
|
+
#U(e, t) {
|
|
5117
|
+
clearTimeout(this.#v.get(e)), this.#v.set(e, setTimeout(() => this.#K(e), t));
|
|
4901
5118
|
}
|
|
4902
|
-
#
|
|
5119
|
+
#W = (e) => {
|
|
4903
5120
|
let t = e.target;
|
|
4904
|
-
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (this.#
|
|
5121
|
+
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (this.#R(), !(Date.now() - (this.#y.get(t) ?? 0) < Na) && (clearTimeout(this.#v.get(t)), "onscrollend" in window || this.#U(t, Ra)));
|
|
4905
5122
|
};
|
|
4906
|
-
#
|
|
5123
|
+
#G = (e) => {
|
|
4907
5124
|
let t = e.target;
|
|
4908
|
-
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (Date.now() - (this.#y.get(t) ?? 0) <
|
|
5125
|
+
t instanceof HTMLElement && t !== this && t.hasAttribute("data-mw-scroll") && (Date.now() - (this.#y.get(t) ?? 0) < Na || this.#U(t, La));
|
|
4909
5126
|
};
|
|
4910
|
-
#
|
|
5127
|
+
#K(e) {
|
|
4911
5128
|
if (this.#x?.el === e) return;
|
|
4912
|
-
this.#
|
|
5129
|
+
this.#R();
|
|
4913
5130
|
let t = this.#f, n = this.#_.find((t) => t.source === e);
|
|
4914
5131
|
if (!t || !n) return;
|
|
4915
|
-
let r = n.scrollRange, i = n.scroll ?? this.#
|
|
5132
|
+
let r = n.scrollRange, i = n.scroll ?? this.#B(n, t), a = i.y === r.maxY ? e.scrollHeight - e.clientHeight : i.y * t.height, o = i.x === r.maxX ? e.scrollWidth - e.clientWidth : i.x * t.width;
|
|
4916
5133
|
(Math.abs(e.scrollTop - a) > .5 || Math.abs(e.scrollLeft - o) > .5) && e.scrollTo({
|
|
4917
5134
|
top: a,
|
|
4918
5135
|
left: o,
|
|
4919
5136
|
behavior: "instant"
|
|
4920
5137
|
});
|
|
4921
5138
|
}
|
|
4922
|
-
#
|
|
5139
|
+
#q = (e) => {
|
|
4923
5140
|
if (this.getAttribute("select") !== "grid") return;
|
|
4924
5141
|
let t = this.#p, n = this.#f;
|
|
4925
5142
|
if (!t || !n || this.#_.length === 0) return;
|
|
4926
5143
|
let r = e, i = r.deltaMode === 1 ? n.height : r.deltaMode === 2 ? this.clientHeight : 1, a = r.deltaX * i, o = r.deltaY * i;
|
|
4927
|
-
if (!r.cancelable && this.#
|
|
4928
|
-
let { col: s, row: c } = this.#
|
|
5144
|
+
if (!r.cancelable && this.#J(a, o)) return;
|
|
5145
|
+
let { col: s, row: c } = this.#X(r.clientX, r.clientY, n), l = Date.now(), u = Math.abs(a) + Math.abs(o);
|
|
4929
5146
|
if (u === 0) {
|
|
4930
5147
|
this.#b = null, r.preventDefault();
|
|
4931
5148
|
return;
|
|
@@ -4933,13 +5150,13 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4933
5150
|
let d = (e) => {
|
|
4934
5151
|
let t = e.scrollRange, n = e.source;
|
|
4935
5152
|
return o !== 0 && t.maxY > 0 && (o > 0 && n.scrollTop < n.scrollHeight - n.clientHeight - .5 || o < 0 && n.scrollTop > .5) || a !== 0 && t.maxX > 0 && (a > 0 && n.scrollLeft < n.scrollWidth - n.clientWidth - .5 || a < 0 && n.scrollLeft > .5);
|
|
4936
|
-
}, f = this.#b, p = Math.abs(a) >= Math.abs(o) ? "x" : "y", m = f !== null && u > f.mag * 1.25 + 1, h = f !== null && (Math.abs(r.clientX - f.x) >
|
|
5153
|
+
}, f = this.#b, p = Math.abs(a) >= Math.abs(o) ? "x" : "y", m = f !== null && u > f.mag * 1.25 + 1, h = f !== null && (Math.abs(r.clientX - f.x) > Pa || Math.abs(r.clientY - f.y) > Pa), g = f !== null && f.decayed >= Ia, _ = f !== null && l - f.at < Na && p === f.axis && (h ? u <= f.mag : !(g && m)), v = null;
|
|
4937
5154
|
if (_) {
|
|
4938
5155
|
if (f.decayed = u <= f.mag && u >= f.mag * .5 ? f.decayed + 1 : g ? f.decayed : 0, f.mag = u, f.at = l, !f.el) return;
|
|
4939
5156
|
v = this.#_.find((e) => e.source === f.el) ?? null;
|
|
4940
5157
|
}
|
|
4941
5158
|
if (!v) {
|
|
4942
|
-
let e =
|
|
5159
|
+
let e = yr(t, s, c);
|
|
4943
5160
|
for (let t = e.length - 1; t >= 0; t--) {
|
|
4944
5161
|
let n = e[t].node;
|
|
4945
5162
|
if (!n.scrollRange) continue;
|
|
@@ -4953,7 +5170,7 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4953
5170
|
break;
|
|
4954
5171
|
}
|
|
4955
5172
|
}
|
|
4956
|
-
if (!v && u <
|
|
5173
|
+
if (!v && u < Fa) {
|
|
4957
5174
|
r.preventDefault();
|
|
4958
5175
|
return;
|
|
4959
5176
|
}
|
|
@@ -4969,41 +5186,41 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
4969
5186
|
}
|
|
4970
5187
|
if (!v || (r.preventDefault(), !d(v))) return;
|
|
4971
5188
|
let y = v.source, b = v.scrollRange, x = { behavior: "instant" };
|
|
4972
|
-
o !== 0 && b.maxY > 0 && (x.top = o), a !== 0 && b.maxX > 0 && (x.left = a), y.scrollBy(x), this.#y.set(y, l), this.#
|
|
5189
|
+
o !== 0 && b.maxY > 0 && (x.top = o), a !== 0 && b.maxX > 0 && (x.left = a), y.scrollBy(x), this.#y.set(y, l), this.#U(y, Na);
|
|
4973
5190
|
};
|
|
4974
|
-
#
|
|
4975
|
-
return this.#
|
|
5191
|
+
#J(e, t) {
|
|
5192
|
+
return this.#E.some((n) => t > 0 && n.scrollTop < n.scrollHeight - n.clientHeight - .5 || t < 0 && n.scrollTop > .5 || e > 0 && n.scrollLeft < n.scrollWidth - n.clientWidth - .5 || e < 0 && n.scrollLeft > .5);
|
|
4976
5193
|
}
|
|
4977
|
-
#
|
|
5194
|
+
#Y() {
|
|
4978
5195
|
let e = this.parentElement;
|
|
4979
5196
|
if (e && this.#l) {
|
|
4980
5197
|
this.#l.observe(e);
|
|
4981
5198
|
for (let t of e.children) t !== this && this.#l.observe(t);
|
|
4982
5199
|
}
|
|
4983
5200
|
}
|
|
4984
|
-
#
|
|
4985
|
-
if (!this.#
|
|
5201
|
+
#X(e, t, n) {
|
|
5202
|
+
if (!this.#I) {
|
|
4986
5203
|
let e = this.#s.getBoundingClientRect();
|
|
4987
|
-
this.#
|
|
5204
|
+
this.#I = {
|
|
4988
5205
|
left: e.left,
|
|
4989
5206
|
top: e.top
|
|
4990
5207
|
};
|
|
4991
5208
|
}
|
|
4992
5209
|
return {
|
|
4993
|
-
col: Math.floor((e - this.#
|
|
4994
|
-
row: Math.floor((t - this.#
|
|
5210
|
+
col: Math.floor((e - this.#I.left) / n.width),
|
|
5211
|
+
row: Math.floor((t - this.#I.top) / n.height)
|
|
4995
5212
|
};
|
|
4996
5213
|
}
|
|
4997
|
-
#
|
|
5214
|
+
#Z(e, t) {
|
|
4998
5215
|
let n = this.#p, r = this.#f;
|
|
4999
5216
|
if (!n || !r || this.#_.length === 0) return null;
|
|
5000
|
-
let { col: i, row: a } = this.#
|
|
5217
|
+
let { col: i, row: a } = this.#X(e, t, r), o = yr(n, i, a);
|
|
5001
5218
|
for (let n = o.length - 1; n >= 0; n--) {
|
|
5002
5219
|
let { node: s, x: c, y: l } = o[n], u = s.scrollRange;
|
|
5003
5220
|
if (!u) continue;
|
|
5004
|
-
let d = s.source, { y: f, x: p } =
|
|
5221
|
+
let d = s.source, { y: f, x: p } = gr(s, c, l);
|
|
5005
5222
|
if (f && u.maxY > 0 && i >= f.col && i < f.col + f.thick && a >= f.row && a < f.row + f.len) {
|
|
5006
|
-
let e =
|
|
5223
|
+
let e = _r(f.len, u.sizeY, u.maxY, 0).len, n = Math.max(1, (f.len - e) * r.height);
|
|
5007
5224
|
return {
|
|
5008
5225
|
el: d,
|
|
5009
5226
|
axis: "y",
|
|
@@ -5013,7 +5230,7 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5013
5230
|
};
|
|
5014
5231
|
}
|
|
5015
5232
|
if (p && u.maxX > 0 && a >= p.row && a < p.row + p.thick && i >= p.col && i < p.col + p.len) {
|
|
5016
|
-
let t =
|
|
5233
|
+
let t = _r(p.len, u.sizeX, u.maxX, 0).len, n = Math.max(1, (p.len - t) * r.width);
|
|
5017
5234
|
return {
|
|
5018
5235
|
el: d,
|
|
5019
5236
|
axis: "x",
|
|
@@ -5025,69 +5242,217 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5025
5242
|
}
|
|
5026
5243
|
return null;
|
|
5027
5244
|
}
|
|
5028
|
-
#
|
|
5029
|
-
if (
|
|
5245
|
+
#Q = (e) => {
|
|
5246
|
+
if (Wa(e)) return;
|
|
5030
5247
|
let { clientX: t, clientY: n } = e, r = this.#x;
|
|
5031
5248
|
if (r) {
|
|
5032
5249
|
let e = (r.axis === "y" ? n : t) - r.startClient, i = r.startPx + e * r.factor;
|
|
5033
5250
|
r.axis === "y" ? r.el.scrollTop = i : r.el.scrollLeft = i;
|
|
5034
5251
|
return;
|
|
5035
5252
|
}
|
|
5036
|
-
|
|
5253
|
+
let i = !!(e.buttons & 1);
|
|
5254
|
+
i && this.#C && this.#ce(this.#C, t, n), i && this.#w && this.#se(this.#w, t, n), i && this.#T && !this.hasAttribute("data-mw-dragging") && this.setAttribute("data-mw-dragging", ""), this.#N = {
|
|
5037
5255
|
x: t,
|
|
5038
5256
|
y: n
|
|
5039
5257
|
};
|
|
5040
|
-
let
|
|
5041
|
-
if (
|
|
5042
|
-
let { col: e, row: r } = this.#
|
|
5043
|
-
if (e === this.#
|
|
5258
|
+
let a = this.#f;
|
|
5259
|
+
if (a) {
|
|
5260
|
+
let { col: e, row: r } = this.#X(t, n, a);
|
|
5261
|
+
if (e === this.#P && r === this.#F) return;
|
|
5044
5262
|
}
|
|
5045
|
-
this
|
|
5263
|
+
this.#ye();
|
|
5046
5264
|
};
|
|
5047
|
-
|
|
5048
|
-
|
|
5265
|
+
#$ = (e) => {
|
|
5266
|
+
let { clipboardData: t } = e, n = this.#p, r = this.#pe();
|
|
5267
|
+
t && n && r && (t.setData("text/plain", Er(n, r)), e.preventDefault());
|
|
5049
5268
|
};
|
|
5050
|
-
#
|
|
5269
|
+
#ee = (e) => {
|
|
5051
5270
|
let t = e;
|
|
5052
|
-
if (
|
|
5053
|
-
let n =
|
|
5271
|
+
if (t.button !== 0 || this.getAttribute("select") !== "grid") return;
|
|
5272
|
+
let n = t.composedPath().includes(this.#s);
|
|
5273
|
+
if (!n && !this.#re(t.target)) return;
|
|
5274
|
+
let r = this.#S === "mouse" || this.#S === "pen";
|
|
5275
|
+
if (t.detail <= 1) {
|
|
5276
|
+
if (t.detail !== 1) return;
|
|
5277
|
+
this.removeAttribute(Oa);
|
|
5278
|
+
let e = this.#te();
|
|
5279
|
+
r && (!n || e) && (e?.blur(), this.#oe(t));
|
|
5280
|
+
return;
|
|
5281
|
+
}
|
|
5282
|
+
if (!r) return;
|
|
5283
|
+
let i = t.detail === 2 ? "word" : "paragraph", a = document.getSelection(), o = this.#p, s = this.#f;
|
|
5284
|
+
if (!a || !o || !s) return;
|
|
5285
|
+
let { col: c, row: l } = this.#X(t.clientX, t.clientY, s), u = this.#ue(c, l, i);
|
|
5286
|
+
if (!u) {
|
|
5287
|
+
this.removeAttribute(Oa), this.#C = null;
|
|
5288
|
+
return;
|
|
5289
|
+
}
|
|
5290
|
+
t.preventDefault(), this.#te()?.blur(), this.#fe(u);
|
|
5291
|
+
let d = t.shiftKey && a.anchorNode && this.#pe() ? Ka({
|
|
5292
|
+
node: a.anchorNode,
|
|
5293
|
+
offset: a.anchorOffset
|
|
5294
|
+
}) : u;
|
|
5295
|
+
this.#le(a, d, u), this.#C = {
|
|
5296
|
+
unit: i,
|
|
5297
|
+
anchor: d
|
|
5298
|
+
};
|
|
5299
|
+
};
|
|
5300
|
+
#te() {
|
|
5301
|
+
let e = document.activeElement;
|
|
5302
|
+
return e instanceof HTMLElement && e !== document.body && this.contains(e) ? e : null;
|
|
5303
|
+
}
|
|
5304
|
+
#ne() {
|
|
5305
|
+
return this.#j && !this.#w;
|
|
5306
|
+
}
|
|
5307
|
+
#re(e) {
|
|
5308
|
+
return e instanceof Element && e !== this && this.contains(e) && !e.matches(ka);
|
|
5309
|
+
}
|
|
5310
|
+
#ie(e, t) {
|
|
5311
|
+
let n = this.#s.textContent.split("\n"), r = Math.max(0, Math.min(t, n.length - 1)), i = 0;
|
|
5312
|
+
for (let e = 0; e < r; e++) i += n[e].length + 1;
|
|
5313
|
+
return i + Math.max(0, Math.min(e, n[r]?.length ?? 0));
|
|
5314
|
+
}
|
|
5315
|
+
#ae(e, t) {
|
|
5316
|
+
let n = this.#f;
|
|
5317
|
+
if (!n) return null;
|
|
5318
|
+
let { col: r, row: i } = this.#X(e, t, n), a = this.#ie(r, i), o = Jr(this.#s, a);
|
|
5319
|
+
return o && {
|
|
5320
|
+
offset: a,
|
|
5321
|
+
at: o
|
|
5322
|
+
};
|
|
5323
|
+
}
|
|
5324
|
+
#oe(e) {
|
|
5325
|
+
let t = this.#ae(e.clientX, e.clientY);
|
|
5326
|
+
t && (e.preventDefault(), document.getSelection()?.setBaseAndExtent(...t.at, ...t.at), this.#w = { anchor: t.offset });
|
|
5327
|
+
}
|
|
5328
|
+
#se(e, t, n) {
|
|
5329
|
+
let r = Jr(this.#s, e.anchor), i = this.#ae(t, n);
|
|
5330
|
+
r && i && document.getSelection()?.setBaseAndExtent(...r, ...i.at);
|
|
5331
|
+
}
|
|
5332
|
+
#ce(e, t, n) {
|
|
5333
|
+
let r = this.#f, i = document.getSelection();
|
|
5334
|
+
if (!r || !i) return;
|
|
5335
|
+
let { col: a, row: o } = this.#X(t, n, r), s = this.#ue(a, o, e.unit);
|
|
5336
|
+
s && this.#le(i, e.anchor, s);
|
|
5337
|
+
}
|
|
5338
|
+
#le(e, t, n) {
|
|
5339
|
+
if (Ja(t, n)) {
|
|
5340
|
+
qa(e, n.start, n.end);
|
|
5341
|
+
return;
|
|
5342
|
+
}
|
|
5343
|
+
let r = this.#de(t), i = this.#de(n);
|
|
5344
|
+
xr(r.start.node, r.start.offset, i.start.node, i.start.offset) <= 0 ? qa(e, r.start, i.end) : qa(e, r.end, i.start);
|
|
5345
|
+
}
|
|
5346
|
+
#ue(e, t, n) {
|
|
5347
|
+
let r = this.#p;
|
|
5348
|
+
if (!r) return null;
|
|
5349
|
+
let i = yr(r, e, t);
|
|
5350
|
+
for (let r = i.length - 1; r >= 0; r--) {
|
|
5351
|
+
let { node: a, x: o, y: s } = i[r];
|
|
5352
|
+
if (!Mr(a)) continue;
|
|
5353
|
+
let c = hr(a, o, s, e, t);
|
|
5354
|
+
if (c === null) return null;
|
|
5355
|
+
let l = se(a.source.tagName)?.selectionTarget?.(a.source);
|
|
5356
|
+
if (n === "word" && !l) {
|
|
5357
|
+
let e = Ir(a, c), t = e && Cr(a, e.start), n = e && Cr(a, e.end);
|
|
5358
|
+
if (t && n) return {
|
|
5359
|
+
start: t,
|
|
5360
|
+
end: n
|
|
5361
|
+
};
|
|
5362
|
+
}
|
|
5363
|
+
let u = l ?? a.source;
|
|
5364
|
+
return {
|
|
5365
|
+
start: {
|
|
5366
|
+
node: u,
|
|
5367
|
+
offset: 0
|
|
5368
|
+
},
|
|
5369
|
+
end: {
|
|
5370
|
+
node: u,
|
|
5371
|
+
offset: u.childNodes.length
|
|
5372
|
+
}
|
|
5373
|
+
};
|
|
5374
|
+
}
|
|
5375
|
+
return null;
|
|
5376
|
+
}
|
|
5377
|
+
#de(e) {
|
|
5378
|
+
let t = e.start.node.getRootNode();
|
|
5379
|
+
if (!(t instanceof ShadowRoot) || t === this.#s.getRootNode()) return e;
|
|
5380
|
+
let n = t.host, r = n.parentNode;
|
|
5381
|
+
if (!r) return e;
|
|
5382
|
+
let i = Array.prototype.indexOf.call(r.childNodes, n), a = n.previousSibling, o = n.nextSibling;
|
|
5383
|
+
return {
|
|
5384
|
+
start: Ga(a) ? {
|
|
5385
|
+
node: a,
|
|
5386
|
+
offset: a instanceof Text ? a.length : a.childNodes.length
|
|
5387
|
+
} : {
|
|
5388
|
+
node: r,
|
|
5389
|
+
offset: i
|
|
5390
|
+
},
|
|
5391
|
+
end: Ga(o) ? {
|
|
5392
|
+
node: o,
|
|
5393
|
+
offset: 0
|
|
5394
|
+
} : {
|
|
5395
|
+
node: r,
|
|
5396
|
+
offset: i + 1
|
|
5397
|
+
}
|
|
5398
|
+
};
|
|
5399
|
+
}
|
|
5400
|
+
#fe(e) {
|
|
5401
|
+
this.setAttribute(Oa, "");
|
|
5402
|
+
let t = e.start.node, n = t instanceof Element ? t : t.parentElement;
|
|
5403
|
+
n && getComputedStyle(n).userSelect;
|
|
5404
|
+
}
|
|
5405
|
+
#pe() {
|
|
5406
|
+
let e = wr(this.#s.getRootNode());
|
|
5407
|
+
return !e || Tr(this, this.#s, e) !== "light" || e.startContainer === e.endContainer && e.startOffset === e.endOffset ? null : e;
|
|
5408
|
+
}
|
|
5409
|
+
#me = () => {
|
|
5410
|
+
this.hasAttribute(Oa) && (this.#pe() || this.removeAttribute(Oa));
|
|
5411
|
+
};
|
|
5412
|
+
#he = () => {
|
|
5413
|
+
this.#N = null, this.#ye();
|
|
5414
|
+
};
|
|
5415
|
+
#ge = (e) => {
|
|
5416
|
+
let t = e;
|
|
5417
|
+
if (!t.isPrimary || t.button !== 0 || (this.#S = t.pointerType, Wa(t))) return;
|
|
5418
|
+
let n = this.#Z(t.clientX, t.clientY);
|
|
5054
5419
|
if (n) {
|
|
5055
5420
|
this.#x = n, t.preventDefault(), t.isTrusted && this.setPointerCapture(t.pointerId);
|
|
5056
5421
|
return;
|
|
5057
5422
|
}
|
|
5058
|
-
this.#
|
|
5423
|
+
this.#N = {
|
|
5059
5424
|
x: t.clientX,
|
|
5060
5425
|
y: t.clientY
|
|
5061
|
-
}, this.#
|
|
5426
|
+
}, this.#j = !0, this.#T = t.composedPath().includes(this.#s), this.#ye(!0);
|
|
5062
5427
|
};
|
|
5063
|
-
#
|
|
5428
|
+
#_e = (e) => {
|
|
5064
5429
|
if (e.isPrimary) {
|
|
5065
|
-
if (this.#x) {
|
|
5066
|
-
this.#
|
|
5430
|
+
if (this.#C = null, this.#w = null, this.#T = !1, this.removeAttribute("data-mw-dragging"), this.#x) {
|
|
5431
|
+
this.#K(this.#x.el), this.#x = null;
|
|
5067
5432
|
return;
|
|
5068
5433
|
}
|
|
5069
|
-
(this.#
|
|
5434
|
+
(this.#j || this.#A) && (this.#j = !1, this.#A = null, this.#ye(), this.#M && this.#Me());
|
|
5070
5435
|
}
|
|
5071
5436
|
};
|
|
5072
|
-
#
|
|
5073
|
-
if (!this.#
|
|
5437
|
+
#ve = (e) => {
|
|
5438
|
+
if (!this.#N) return;
|
|
5074
5439
|
let t = e.target;
|
|
5075
|
-
t instanceof HTMLElement && t.hasAttribute("data-mw-scroll") || (this.#
|
|
5440
|
+
t instanceof HTMLElement && t.hasAttribute("data-mw-scroll") || (this.#I = null, this.#ye());
|
|
5076
5441
|
};
|
|
5077
|
-
|
|
5442
|
+
#ye(t = !1) {
|
|
5078
5443
|
let n = this.#p, r = this.#f, i = [];
|
|
5079
|
-
if (this.#
|
|
5080
|
-
let { col: e, row: t } = this.#
|
|
5081
|
-
this.#
|
|
5082
|
-
} else this.#
|
|
5444
|
+
if (this.#N && n && r && this.isConnected && this.getAttribute("select") === "grid" && (this.#j || e.#L?.matches)) {
|
|
5445
|
+
let { col: e, row: t } = this.#X(this.#N.x, this.#N.y, r);
|
|
5446
|
+
this.#P = e, this.#F = t, i = br(n, e, t);
|
|
5447
|
+
} else this.#P = NaN, this.#F = NaN;
|
|
5083
5448
|
let a = i.at(-1) ?? null;
|
|
5084
|
-
t && (this.#
|
|
5085
|
-
let o = e.#
|
|
5086
|
-
l = this.#
|
|
5449
|
+
t && (this.#A = a);
|
|
5450
|
+
let o = e.#L?.matches ? i : [], s = this.#A ? i.indexOf(this.#A) : -1, c = s >= 0 ? i.slice(0, s + 1) : [], l = this.#be("data-mw-hover", this.#O, o);
|
|
5451
|
+
l = this.#be("data-mw-active", this.#k, c) || l;
|
|
5087
5452
|
let u = a ? getComputedStyle(a).cursor : "";
|
|
5088
|
-
this.#s.style.cursor = u === "auto" ? "" : u, l && this.isConnected && this.#
|
|
5453
|
+
this.#s.style.cursor = u === "auto" ? "" : u, l && this.isConnected && this.#Me();
|
|
5089
5454
|
}
|
|
5090
|
-
#
|
|
5455
|
+
#be(e, t, n) {
|
|
5091
5456
|
let r = !1, i = new Set(n);
|
|
5092
5457
|
for (let n of t) i.has(n) || (n.removeAttribute(e), r = !0);
|
|
5093
5458
|
for (let n of i) t.has(n) || (n.setAttribute(e, ""), r = !0);
|
|
@@ -5095,53 +5460,53 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5095
5460
|
for (let e of i) t.add(e);
|
|
5096
5461
|
return r;
|
|
5097
5462
|
}
|
|
5098
|
-
#
|
|
5099
|
-
#
|
|
5100
|
-
#
|
|
5101
|
-
#
|
|
5102
|
-
|
|
5463
|
+
#xe = 0;
|
|
5464
|
+
#Se = !1;
|
|
5465
|
+
#Ce = 0;
|
|
5466
|
+
#we = (e) => {
|
|
5467
|
+
ja.test(e.propertyName) && (this.#xe++, this.#Ce = performance.now(), this.#Ee());
|
|
5103
5468
|
};
|
|
5104
|
-
#
|
|
5105
|
-
|
|
5469
|
+
#Te = (e) => {
|
|
5470
|
+
ja.test(e.propertyName) && (this.#xe = Math.max(0, this.#xe - 1));
|
|
5106
5471
|
};
|
|
5107
|
-
#
|
|
5108
|
-
if (this.#
|
|
5109
|
-
this.#
|
|
5472
|
+
#Ee() {
|
|
5473
|
+
if (this.#Se) return;
|
|
5474
|
+
this.#Se = !0;
|
|
5110
5475
|
let e = () => {
|
|
5111
|
-
if (!this.isConnected || this.#
|
|
5112
|
-
this.#
|
|
5476
|
+
if (!this.isConnected || this.#xe === 0 && !a() || performance.now() - this.#Ce > Ma) {
|
|
5477
|
+
this.#Se = !1, this.#xe = 0, this.#Me();
|
|
5113
5478
|
return;
|
|
5114
5479
|
}
|
|
5115
|
-
this.#
|
|
5480
|
+
this.#je(), requestAnimationFrame(e);
|
|
5116
5481
|
};
|
|
5117
5482
|
requestAnimationFrame(e);
|
|
5118
5483
|
}
|
|
5119
|
-
#
|
|
5120
|
-
if (!
|
|
5484
|
+
#De = (e) => {
|
|
5485
|
+
if (!Wa(e)) {
|
|
5121
5486
|
if ((e.type === "focusin" || e.type === "focusout") && e.target instanceof HTMLSelectElement) {
|
|
5122
|
-
this.#
|
|
5487
|
+
this.#je();
|
|
5123
5488
|
return;
|
|
5124
5489
|
}
|
|
5125
|
-
this.#
|
|
5490
|
+
this.#Me();
|
|
5126
5491
|
}
|
|
5127
5492
|
};
|
|
5128
5493
|
attributeChangedCallback(e, t, n) {
|
|
5129
5494
|
if (e === "select" && n !== "text" && n !== "grid") {
|
|
5130
|
-
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`,
|
|
5495
|
+
n !== null && console.warn(`[monowind] Ignoring unrecognized select="${n}". Expected "grid" (default) or "text".`, ne(this)), this.setAttribute("select", Da);
|
|
5131
5496
|
return;
|
|
5132
5497
|
}
|
|
5133
|
-
e === "select" && this
|
|
5498
|
+
e === "select" && this.#ye(), this.#Me();
|
|
5134
5499
|
}
|
|
5135
5500
|
toPlainText() {
|
|
5136
|
-
return this.#d && this.#
|
|
5501
|
+
return this.#d && this.#Ne(), this.#p ? ir(this.#p) : "";
|
|
5137
5502
|
}
|
|
5138
|
-
#
|
|
5139
|
-
this.#
|
|
5503
|
+
#Oe = () => {
|
|
5504
|
+
this.#Me();
|
|
5140
5505
|
};
|
|
5141
|
-
#
|
|
5142
|
-
requestAnimationFrame(() => this.#
|
|
5506
|
+
#ke = () => {
|
|
5507
|
+
requestAnimationFrame(() => this.#Me());
|
|
5143
5508
|
};
|
|
5144
|
-
#
|
|
5509
|
+
#Ae() {
|
|
5145
5510
|
let e = document.activeElement;
|
|
5146
5511
|
if (!(e instanceof HTMLSelectElement) || !this.contains(e)) return !1;
|
|
5147
5512
|
try {
|
|
@@ -5150,25 +5515,25 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5150
5515
|
return !1;
|
|
5151
5516
|
}
|
|
5152
5517
|
}
|
|
5153
|
-
#
|
|
5518
|
+
#je() {
|
|
5154
5519
|
try {
|
|
5155
|
-
this.#
|
|
5520
|
+
this.#Ne();
|
|
5156
5521
|
} catch (e) {
|
|
5157
5522
|
console.error("[monowind] layout failed:", e);
|
|
5158
5523
|
}
|
|
5159
5524
|
}
|
|
5160
|
-
#
|
|
5525
|
+
#Me() {
|
|
5161
5526
|
this.#d || (this.#d = !0, requestAnimationFrame(() => {
|
|
5162
|
-
if (this.#d = !1, this.#
|
|
5163
|
-
this.#
|
|
5527
|
+
if (this.#d = !1, this.#Ae()) {
|
|
5528
|
+
this.#Me();
|
|
5164
5529
|
return;
|
|
5165
5530
|
}
|
|
5166
|
-
this.#
|
|
5531
|
+
this.#je();
|
|
5167
5532
|
}));
|
|
5168
5533
|
}
|
|
5169
|
-
#
|
|
5534
|
+
#Ne() {
|
|
5170
5535
|
if (!this.isConnected) return;
|
|
5171
|
-
let e = this.#
|
|
5536
|
+
let e = this.#V(), t = /* @__PURE__ */ new Map(), n = getComputedStyle(this).getPropertyValue("--mw-cw").trim(), r = parseFloat(n);
|
|
5172
5537
|
if (Number.isFinite(r) && r > 0) for (let e of this.querySelectorAll("textarea")) {
|
|
5173
5538
|
let n = getComputedStyle(e), i = e.clientWidth - (parseFloat(n.paddingLeft) || 0) - (parseFloat(n.paddingRight) || 0);
|
|
5174
5539
|
t.set(e, Math.max(0, Math.round(i / r)));
|
|
@@ -5183,10 +5548,10 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5183
5548
|
let s = Ee(), c = [];
|
|
5184
5549
|
for (let e of Array.from(this.children)) {
|
|
5185
5550
|
if (e === this.#c) continue;
|
|
5186
|
-
let r =
|
|
5551
|
+
let r = oa(e, s, n, t);
|
|
5187
5552
|
r && c.push(r);
|
|
5188
5553
|
}
|
|
5189
|
-
if (
|
|
5554
|
+
if (Sa(this) ? (this.hasAttribute("data-mw-dropped-text") || console.warn(`[monowind] ${Ca}`, ne(this)), this.setAttribute("data-mw-dropped-text", "")) : this.removeAttribute("data-mw-dropped-text"), c.length === 0) {
|
|
5190
5555
|
this.#s.replaceChildren(), this.#p = null, this.setAttribute("data-mw-ready", "");
|
|
5191
5556
|
return;
|
|
5192
5557
|
}
|
|
@@ -5204,9 +5569,9 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5204
5569
|
height: 0
|
|
5205
5570
|
},
|
|
5206
5571
|
unclampedHeight: 0,
|
|
5207
|
-
resolvedPadding:
|
|
5208
|
-
}, { height: u } =
|
|
5209
|
-
|
|
5572
|
+
resolvedPadding: R()
|
|
5573
|
+
}, { height: u } = Fn(l, o);
|
|
5574
|
+
Zr(l), this.#_ = Ya(l), this.#z(n, e), this.#M = !Ur(l, this.#s, this.#ne()), this.#p = l;
|
|
5210
5575
|
let d = `${l.localRect.width * n.width}px`, f = `${l.localRect.height * n.height}px`;
|
|
5211
5576
|
this.#s.style.width !== d && (this.#s.style.width = d), this.#s.style.height !== f && (this.#s.style.height = f);
|
|
5212
5577
|
let p = i.boxSizing === "border-box" ? (parseFloat(i.paddingTop) || 0) + (parseFloat(i.paddingBottom) || 0) + (parseFloat(i.borderTopWidth) || 0) + (parseFloat(i.borderBottomWidth) || 0) : 0, m = `${u * n.height + p}px`;
|
|
@@ -5214,28 +5579,43 @@ var ta = "\n<style>\n :host { display: block; position: relative; contain: layo
|
|
|
5214
5579
|
let h = i.boxSizing === "border-box" ? a + (parseFloat(i.borderLeftWidth) || 0) + (parseFloat(i.borderRightWidth) || 0) : 0, g = `${o * n.width + h}px`;
|
|
5215
5580
|
this.style.getPropertyValue("--mw-host-w") !== g && this.style.setProperty("--mw-host-w", g), this.hasAttribute("data-mw-ready") || this.setAttribute("data-mw-ready", "");
|
|
5216
5581
|
} finally {
|
|
5217
|
-
this.setAttribute("settling", ""), this.removeAttribute("measuring"), getComputedStyle(this).transitionProperty, this.removeAttribute("settling"), this.#
|
|
5582
|
+
this.setAttribute("settling", ""), this.removeAttribute("measuring"), getComputedStyle(this).transitionProperty, this.removeAttribute("settling"), this.#H(e), this.#u?.takeRecords(), i(this) && (a() ? (this.#Ce = performance.now(), this.#Ee()) : this.#Me()), this.#Y(), this.#E = [];
|
|
5218
5583
|
let t = document.scrollingElement ?? document.documentElement;
|
|
5219
|
-
for (let e = this.parentElement; e; e = e.parentElement) (e === t || /auto|scroll/.test(getComputedStyle(e).overflow)) && this.#
|
|
5220
|
-
this.#
|
|
5584
|
+
for (let e = this.parentElement; e; e = e.parentElement) (e === t || /auto|scroll/.test(getComputedStyle(e).overflow)) && this.#E.push(e);
|
|
5585
|
+
this.#I = null, this.#N && this.#ye();
|
|
5221
5586
|
}
|
|
5222
5587
|
}
|
|
5223
5588
|
};
|
|
5224
|
-
function
|
|
5225
|
-
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind",
|
|
5589
|
+
function Va() {
|
|
5590
|
+
typeof customElements > "u" || customElements.get("mono-wind") || customElements.define("mono-wind", Ba);
|
|
5226
5591
|
}
|
|
5227
|
-
function
|
|
5228
|
-
return
|
|
5592
|
+
function Ha(e, t, n, r, i) {
|
|
5593
|
+
return Ua(t === "y" ? e.scrollTop : e.scrollLeft, t === "y" ? e.scrollHeight - e.clientHeight : e.scrollWidth - e.clientWidth, n, r, i);
|
|
5229
5594
|
}
|
|
5230
|
-
function
|
|
5595
|
+
function Ua(e, t, n, r, i) {
|
|
5231
5596
|
if (r > 0 && e > 0 && e >= t - 1) return r;
|
|
5232
5597
|
let a = e / n - i, o = Math.abs(a) <= .5 ? i : i + Math.sign(a) * Math.round(Math.abs(a));
|
|
5233
5598
|
return Math.min(Math.max(0, o), r);
|
|
5234
5599
|
}
|
|
5235
|
-
function
|
|
5600
|
+
function Wa(e) {
|
|
5236
5601
|
return e instanceof PointerEvent && e.pointerType === "touch" && e.type !== "pointerup";
|
|
5237
5602
|
}
|
|
5238
|
-
function
|
|
5603
|
+
function Ga(e) {
|
|
5604
|
+
return e !== null && !(e instanceof Element && e.shadowRoot);
|
|
5605
|
+
}
|
|
5606
|
+
function Ka(e) {
|
|
5607
|
+
return {
|
|
5608
|
+
start: e,
|
|
5609
|
+
end: e
|
|
5610
|
+
};
|
|
5611
|
+
}
|
|
5612
|
+
function qa(e, t, n) {
|
|
5613
|
+
e.setBaseAndExtent(t.node, t.offset, n.node, n.offset);
|
|
5614
|
+
}
|
|
5615
|
+
function Ja(e, t) {
|
|
5616
|
+
return e.start.node === t.start.node && e.start.offset === t.start.offset && e.end.node === t.end.node && e.end.offset === t.end.offset;
|
|
5617
|
+
}
|
|
5618
|
+
function Ya(e) {
|
|
5239
5619
|
let t = [], n = (e) => {
|
|
5240
5620
|
e.scrollRange && t.push(e);
|
|
5241
5621
|
for (let t of e.children) n(t);
|
|
@@ -5243,6 +5623,6 @@ function va(e) {
|
|
|
5243
5623
|
return n(e), t;
|
|
5244
5624
|
}
|
|
5245
5625
|
//#endregion
|
|
5246
|
-
export {
|
|
5626
|
+
export { Ba as MonoWindElement, Va as defineMonoWind, oe as invalidateLeaves, Yt as multicolLines, x as registerBorderGlyphs, ae as registerLeafRenderer, ir as renderPlainText, De as wrapLines };
|
|
5247
5627
|
|
|
5248
5628
|
//# sourceMappingURL=index.js.map
|