xmlui 0.8.2 → 0.8.4

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.
@@ -627,12 +627,12 @@ var Fn = class {
627
627
  }
628
628
  r === -1 && (r = this._mainRule.fontStyle), s === 0 && (s = this._mainRule.foreground), o === 0 && (o = this._mainRule.background), this._rulesWithParentScopes.push(new $e(e, t, r, s, o));
629
629
  }
630
- }, J = class M {
630
+ }, J = class B {
631
631
  static toBinaryStr(e) {
632
632
  return e.toString(2).padStart(32, "0");
633
633
  }
634
634
  static print(e) {
635
- const t = M.getLanguageId(e), r = M.getTokenType(e), s = M.getFontStyle(e), o = M.getForeground(e), i = M.getBackground(e);
635
+ const t = B.getLanguageId(e), r = B.getTokenType(e), s = B.getFontStyle(e), o = B.getForeground(e), i = B.getBackground(e);
636
636
  console.log({
637
637
  languageId: t,
638
638
  tokenType: r,
@@ -664,7 +664,7 @@ var Fn = class {
664
664
  * A value of `0`, `NotSet` or `null` indicates that the corresponding field should be left as is.
665
665
  */
666
666
  static set(e, t, r, s, o, i, l) {
667
- let a = M.getLanguageId(e), c = M.getTokenType(e), u = M.containsBalancedBrackets(e) ? 1 : 0, h = M.getFontStyle(e), d = M.getForeground(e), f = M.getBackground(e);
667
+ let a = B.getLanguageId(e), c = B.getTokenType(e), u = B.containsBalancedBrackets(e) ? 1 : 0, h = B.getFontStyle(e), d = B.getForeground(e), f = B.getBackground(e);
668
668
  return t !== 0 && (a = t), r !== 8 && (c = r), s !== null && (u = s ? 1 : 0), o !== -1 && (h = o), i !== 0 && (d = i), l !== 0 && (f = l), (a << 0 | c << 8 | u << 10 | h << 11 | d << 15 | f << 24) >>> 0;
669
669
  }
670
670
  };
@@ -1976,7 +1976,7 @@ var re = class U {
1976
1976
  }), r = r.parent;
1977
1977
  return r === e ? t.reverse() : void 0;
1978
1978
  }
1979
- }, B, He = (B = class {
1979
+ }, G, He = (G = class {
1980
1980
  /**
1981
1981
  * Invariant:
1982
1982
  * ```
@@ -2009,7 +2009,7 @@ var re = class U {
2009
2009
  this.parent = e, this.ruleId = t, this.beginRuleCapturedEOL = o, this.endRule = i, this.nameScopesList = l, this.contentNameScopesList = a, this.depth = this.parent ? this.parent.depth + 1 : 1, this._enterPos = r, this._anchorPos = s;
2010
2010
  }
2011
2011
  equals(e) {
2012
- return e === null ? !1 : B._equals(this, e);
2012
+ return e === null ? !1 : G._equals(this, e);
2013
2013
  }
2014
2014
  static _equals(e, t) {
2015
2015
  return e === t ? !0 : this._structuralEquals(e, t) ? re.equals(e.contentNameScopesList, t.contentNameScopesList) : !1;
@@ -2034,7 +2034,7 @@ var re = class U {
2034
2034
  e._enterPos = -1, e._anchorPos = -1, e = e.parent;
2035
2035
  }
2036
2036
  reset() {
2037
- B._reset(this);
2037
+ G._reset(this);
2038
2038
  }
2039
2039
  pop() {
2040
2040
  return this.parent;
@@ -2043,7 +2043,7 @@ var re = class U {
2043
2043
  return this.parent ? this.parent : this;
2044
2044
  }
2045
2045
  push(e, t, r, s, o, i, l) {
2046
- return new B(
2046
+ return new G(
2047
2047
  this,
2048
2048
  e,
2049
2049
  t,
@@ -2083,7 +2083,7 @@ var re = class U {
2083
2083
  );
2084
2084
  }
2085
2085
  withEndRule(e) {
2086
- return this.endRule === e ? this : new B(
2086
+ return this.endRule === e ? this : new G(
2087
2087
  this.parent,
2088
2088
  this.ruleId,
2089
2089
  this._enterPos,
@@ -2116,7 +2116,7 @@ var re = class U {
2116
2116
  }
2117
2117
  static pushFrame(e, t) {
2118
2118
  const r = re.fromExtension((e == null ? void 0 : e.nameScopesList) ?? null, t.nameScopesList);
2119
- return new B(
2119
+ return new G(
2120
2120
  e,
2121
2121
  t.ruleId,
2122
2122
  t.enterPos ?? -1,
@@ -2128,7 +2128,7 @@ var re = class U {
2128
2128
  );
2129
2129
  }
2130
2130
  }, // TODO remove me
2131
- p(B, "NULL", new B(
2131
+ p(G, "NULL", new G(
2132
2132
  null,
2133
2133
  0,
2134
2134
  0,
@@ -2137,7 +2137,7 @@ p(B, "NULL", new B(
2137
2137
  null,
2138
2138
  null,
2139
2139
  null
2140
- )), B), mr = class {
2140
+ )), G), mr = class {
2141
2141
  constructor(n, e) {
2142
2142
  p(this, "balancedBracketScopes");
2143
2143
  p(this, "unbalancedBracketScopes");
@@ -2426,50 +2426,58 @@ const Sr = [
2426
2426
  ];
2427
2427
  class ue {
2428
2428
  /**
2429
- * @constructor
2430
- * @param {Properties} property
2431
- * @param {Normal} normal
2432
- * @param {string} [space]
2429
+ * @param {SchemaType['property']} property
2430
+ * Property.
2431
+ * @param {SchemaType['normal']} normal
2432
+ * Normal.
2433
+ * @param {Space | undefined} [space]
2434
+ * Space.
2435
+ * @returns
2436
+ * Schema.
2433
2437
  */
2434
2438
  constructor(e, t, r) {
2435
- this.property = e, this.normal = t, r && (this.space = r);
2439
+ this.normal = t, this.property = e, r && (this.space = r);
2436
2440
  }
2437
2441
  }
2438
- ue.prototype.property = {};
2439
2442
  ue.prototype.normal = {};
2440
- ue.prototype.space = null;
2443
+ ue.prototype.property = {};
2444
+ ue.prototype.space = void 0;
2441
2445
  function zt(n, e) {
2442
2446
  const t = {}, r = {};
2443
- let s = -1;
2444
- for (; ++s < n.length; )
2445
- Object.assign(t, n[s].property), Object.assign(r, n[s].normal);
2447
+ for (const s of n)
2448
+ Object.assign(t, s.property), Object.assign(r, s.normal);
2446
2449
  return new ue(t, r, e);
2447
2450
  }
2448
2451
  function Ve(n) {
2449
2452
  return n.toLowerCase();
2450
2453
  }
2451
- class G {
2454
+ class O {
2452
2455
  /**
2453
- * @constructor
2454
2456
  * @param {string} property
2457
+ * Property.
2455
2458
  * @param {string} attribute
2459
+ * Attribute.
2460
+ * @returns
2461
+ * Info.
2456
2462
  */
2457
2463
  constructor(e, t) {
2458
- this.property = e, this.attribute = t;
2459
- }
2460
- }
2461
- G.prototype.space = null;
2462
- G.prototype.boolean = !1;
2463
- G.prototype.booleanish = !1;
2464
- G.prototype.overloadedBoolean = !1;
2465
- G.prototype.number = !1;
2466
- G.prototype.commaSeparated = !1;
2467
- G.prototype.spaceSeparated = !1;
2468
- G.prototype.commaOrSpaceSeparated = !1;
2469
- G.prototype.mustUseProperty = !1;
2470
- G.prototype.defined = !1;
2464
+ this.attribute = t, this.property = e;
2465
+ }
2466
+ }
2467
+ O.prototype.attribute = "";
2468
+ O.prototype.booleanish = !1;
2469
+ O.prototype.boolean = !1;
2470
+ O.prototype.commaOrSpaceSeparated = !1;
2471
+ O.prototype.commaSeparated = !1;
2472
+ O.prototype.defined = !1;
2473
+ O.prototype.mustUseProperty = !1;
2474
+ O.prototype.number = !1;
2475
+ O.prototype.overloadedBoolean = !1;
2476
+ O.prototype.property = "";
2477
+ O.prototype.spaceSeparated = !1;
2478
+ O.prototype.space = void 0;
2471
2479
  let Cr = 0;
2472
- const w = V(), A = V(), Ht = V(), m = V(), k = V(), Y = V(), O = V();
2480
+ const w = V(), A = V(), Ht = V(), m = V(), k = V(), Y = V(), M = V();
2473
2481
  function V() {
2474
2482
  return 2 ** ++Cr;
2475
2483
  }
@@ -2477,19 +2485,28 @@ const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2477
2485
  __proto__: null,
2478
2486
  boolean: w,
2479
2487
  booleanish: A,
2480
- commaOrSpaceSeparated: O,
2488
+ commaOrSpaceSeparated: M,
2481
2489
  commaSeparated: Y,
2482
2490
  number: m,
2483
2491
  overloadedBoolean: Ht,
2484
2492
  spaceSeparated: k
2485
- }, Symbol.toStringTag, { value: "Module" })), Ge = Object.keys(Ke);
2486
- class Qe extends G {
2493
+ }, Symbol.toStringTag, { value: "Module" })), Ge = (
2494
+ /** @type {ReadonlyArray<keyof typeof types>} */
2495
+ Object.keys(Ke)
2496
+ );
2497
+ class Qe extends O {
2487
2498
  /**
2488
2499
  * @constructor
2489
2500
  * @param {string} property
2501
+ * Property.
2490
2502
  * @param {string} attribute
2491
- * @param {number|null} [mask]
2492
- * @param {string} [space]
2503
+ * Attribute.
2504
+ * @param {number | null | undefined} [mask]
2505
+ * Mask.
2506
+ * @param {Space | undefined} [space]
2507
+ * Space.
2508
+ * @returns
2509
+ * Info.
2493
2510
  */
2494
2511
  constructor(e, t, r, s) {
2495
2512
  let o = -1;
@@ -2504,58 +2521,20 @@ Qe.prototype.defined = !0;
2504
2521
  function gt(n, e, t) {
2505
2522
  t && (n[e] = t);
2506
2523
  }
2507
- const wr = {}.hasOwnProperty;
2508
2524
  function Q(n) {
2509
2525
  const e = {}, t = {};
2510
- let r;
2511
- for (r in n.properties)
2512
- if (wr.call(n.properties, r)) {
2513
- const s = n.properties[r], o = new Qe(
2514
- r,
2515
- n.transform(n.attributes || {}, r),
2516
- s,
2517
- n.space
2518
- );
2519
- n.mustUseProperty && n.mustUseProperty.includes(r) && (o.mustUseProperty = !0), e[r] = o, t[Ve(r)] = r, t[Ve(o.attribute)] = r;
2520
- }
2526
+ for (const [r, s] of Object.entries(n.properties)) {
2527
+ const o = new Qe(
2528
+ r,
2529
+ n.transform(n.attributes || {}, r),
2530
+ s,
2531
+ n.space
2532
+ );
2533
+ n.mustUseProperty && n.mustUseProperty.includes(r) && (o.mustUseProperty = !0), e[r] = o, t[Ve(r)] = r, t[Ve(o.attribute)] = r;
2534
+ }
2521
2535
  return new ue(e, t, n.space);
2522
2536
  }
2523
2537
  const qt = Q({
2524
- space: "xlink",
2525
- transform(n, e) {
2526
- return "xlink:" + e.slice(5).toLowerCase();
2527
- },
2528
- properties: {
2529
- xLinkActuate: null,
2530
- xLinkArcRole: null,
2531
- xLinkHref: null,
2532
- xLinkRole: null,
2533
- xLinkShow: null,
2534
- xLinkTitle: null,
2535
- xLinkType: null
2536
- }
2537
- }), Vt = Q({
2538
- space: "xml",
2539
- transform(n, e) {
2540
- return "xml:" + e.slice(3).toLowerCase();
2541
- },
2542
- properties: { xmlLang: null, xmlBase: null, xmlSpace: null }
2543
- });
2544
- function Kt(n, e) {
2545
- return e in n ? n[e] : e;
2546
- }
2547
- function Yt(n, e) {
2548
- return Kt(n, e.toLowerCase());
2549
- }
2550
- const Xt = Q({
2551
- space: "xmlns",
2552
- attributes: { xmlnsxlink: "xmlns:xlink" },
2553
- transform: Yt,
2554
- properties: { xmlns: null, xmlnsXLink: null }
2555
- }), Jt = Q({
2556
- transform(n, e) {
2557
- return e === "role" ? e : "aria-" + e.slice(4).toLowerCase();
2558
- },
2559
2538
  properties: {
2560
2539
  ariaActiveDescendant: null,
2561
2540
  ariaAtomic: A,
@@ -2606,16 +2585,24 @@ const Xt = Q({
2606
2585
  ariaValueNow: m,
2607
2586
  ariaValueText: null,
2608
2587
  role: null
2588
+ },
2589
+ transform(n, e) {
2590
+ return e === "role" ? e : "aria-" + e.slice(4).toLowerCase();
2609
2591
  }
2610
- }), vr = Q({
2611
- space: "html",
2592
+ });
2593
+ function Vt(n, e) {
2594
+ return e in n ? n[e] : e;
2595
+ }
2596
+ function Kt(n, e) {
2597
+ return Vt(n, e.toLowerCase());
2598
+ }
2599
+ const wr = Q({
2612
2600
  attributes: {
2613
2601
  acceptcharset: "accept-charset",
2614
2602
  classname: "class",
2615
2603
  htmlfor: "for",
2616
2604
  httpequiv: "http-equiv"
2617
2605
  },
2618
- transform: Yt,
2619
2606
  mustUseProperty: ["checked", "multiple", "muted", "selected"],
2620
2607
  properties: {
2621
2608
  // Standard Properties.
@@ -2967,9 +2954,10 @@ const Xt = Q({
2967
2954
  results: m,
2968
2955
  security: null,
2969
2956
  unselectable: null
2970
- }
2971
- }), kr = Q({
2972
- space: "svg",
2957
+ },
2958
+ space: "html",
2959
+ transform: Kt
2960
+ }), vr = Q({
2973
2961
  attributes: {
2974
2962
  accentHeight: "accent-height",
2975
2963
  alignmentBaseline: "alignment-baseline",
@@ -3145,9 +3133,8 @@ const Xt = Q({
3145
3133
  playbackOrder: "playbackorder",
3146
3134
  timelineBegin: "timelinebegin"
3147
3135
  },
3148
- transform: Kt,
3149
3136
  properties: {
3150
- about: O,
3137
+ about: M,
3151
3138
  accentHeight: m,
3152
3139
  accumulate: null,
3153
3140
  additive: null,
@@ -3259,7 +3246,7 @@ const Xt = Q({
3259
3246
  k2: m,
3260
3247
  k3: m,
3261
3248
  k4: m,
3262
- kernelMatrix: O,
3249
+ kernelMatrix: M,
3263
3250
  kernelUnitLength: null,
3264
3251
  keyPoints: null,
3265
3252
  // SEMI_COLON_SEPARATED
@@ -3416,21 +3403,21 @@ const Xt = Q({
3416
3403
  preserveAspectRatio: null,
3417
3404
  primitiveUnits: null,
3418
3405
  propagate: null,
3419
- property: O,
3406
+ property: M,
3420
3407
  r: null,
3421
3408
  radius: null,
3422
3409
  referrerPolicy: null,
3423
3410
  refX: null,
3424
3411
  refY: null,
3425
- rel: O,
3426
- rev: O,
3412
+ rel: M,
3413
+ rev: M,
3427
3414
  renderingIntent: null,
3428
3415
  repeatCount: null,
3429
3416
  repeatDur: null,
3430
- requiredExtensions: O,
3431
- requiredFeatures: O,
3432
- requiredFonts: O,
3433
- requiredFormats: O,
3417
+ requiredExtensions: M,
3418
+ requiredFeatures: M,
3419
+ requiredFonts: M,
3420
+ requiredFormats: M,
3434
3421
  resource: null,
3435
3422
  restart: null,
3436
3423
  result: null,
@@ -3458,7 +3445,7 @@ const Xt = Q({
3458
3445
  strikethroughThickness: m,
3459
3446
  string: null,
3460
3447
  stroke: null,
3461
- strokeDashArray: O,
3448
+ strokeDashArray: M,
3462
3449
  strokeDashOffset: null,
3463
3450
  strokeLineCap: null,
3464
3451
  strokeLineJoin: null,
@@ -3472,7 +3459,7 @@ const Xt = Q({
3472
3459
  syncMaster: null,
3473
3460
  syncTolerance: null,
3474
3461
  syncToleranceDefault: null,
3475
- systemLanguage: O,
3462
+ systemLanguage: M,
3476
3463
  tabIndex: m,
3477
3464
  tableValues: null,
3478
3465
  target: null,
@@ -3486,7 +3473,7 @@ const Xt = Q({
3486
3473
  title: null,
3487
3474
  transformBehavior: null,
3488
3475
  type: null,
3489
- typeOf: O,
3476
+ typeOf: M,
3490
3477
  to: null,
3491
3478
  transform: null,
3492
3479
  transformOrigin: null,
@@ -3526,21 +3513,48 @@ const Xt = Q({
3526
3513
  yChannelSelector: null,
3527
3514
  z: null,
3528
3515
  zoomAndPan: null
3516
+ },
3517
+ space: "svg",
3518
+ transform: Vt
3519
+ }), Yt = Q({
3520
+ properties: {
3521
+ xLinkActuate: null,
3522
+ xLinkArcRole: null,
3523
+ xLinkHref: null,
3524
+ xLinkRole: null,
3525
+ xLinkShow: null,
3526
+ xLinkTitle: null,
3527
+ xLinkType: null
3528
+ },
3529
+ space: "xlink",
3530
+ transform(n, e) {
3531
+ return "xlink:" + e.slice(5).toLowerCase();
3532
+ }
3533
+ }), Xt = Q({
3534
+ attributes: { xmlnsxlink: "xmlns:xlink" },
3535
+ properties: { xmlnsXLink: null, xmlns: null },
3536
+ space: "xmlns",
3537
+ transform: Kt
3538
+ }), Jt = Q({
3539
+ properties: { xmlBase: null, xmlLang: null, xmlSpace: null },
3540
+ space: "xml",
3541
+ transform(n, e) {
3542
+ return "xml:" + e.slice(3).toLowerCase();
3529
3543
  }
3530
- }), Rr = /^data[-\w.:]+$/i, mt = /-[a-z]/g, Ar = /[A-Z]/g;
3531
- function Pr(n, e) {
3544
+ }), kr = /[A-Z]/g, mt = /-[a-z]/g, Rr = /^data[-\w.:]+$/i;
3545
+ function Ar(n, e) {
3532
3546
  const t = Ve(e);
3533
- let r = e, s = G;
3547
+ let r = e, s = O;
3534
3548
  if (t in n.normal)
3535
3549
  return n.property[n.normal[t]];
3536
3550
  if (t.length > 4 && t.slice(0, 4) === "data" && Rr.test(e)) {
3537
3551
  if (e.charAt(4) === "-") {
3538
- const o = e.slice(5).replace(mt, Tr);
3552
+ const o = e.slice(5).replace(mt, Nr);
3539
3553
  r = "data" + o.charAt(0).toUpperCase() + o.slice(1);
3540
3554
  } else {
3541
3555
  const o = e.slice(4);
3542
3556
  if (!mt.test(o)) {
3543
- let i = o.replace(Ar, Nr);
3557
+ let i = o.replace(kr, Pr);
3544
3558
  i.charAt(0) !== "-" && (i = "-" + i), e = "data" + i;
3545
3559
  }
3546
3560
  }
@@ -3548,14 +3562,14 @@ function Pr(n, e) {
3548
3562
  }
3549
3563
  return new s(r, e);
3550
3564
  }
3551
- function Nr(n) {
3565
+ function Pr(n) {
3552
3566
  return "-" + n.toLowerCase();
3553
3567
  }
3554
- function Tr(n) {
3568
+ function Nr(n) {
3555
3569
  return n.charAt(1).toUpperCase();
3556
3570
  }
3557
- const xr = zt([Vt, qt, Xt, Jt, vr], "html"), Qt = zt([Vt, qt, Xt, Jt, kr], "svg"), yt = {}.hasOwnProperty;
3558
- function Er(n, e) {
3571
+ const Tr = zt([qt, wr, Yt, Xt, Jt], "html"), Qt = zt([qt, vr, Yt, Xt, Jt], "svg"), yt = {}.hasOwnProperty;
3572
+ function xr(n, e) {
3559
3573
  const t = e || {};
3560
3574
  function r(s, ...o) {
3561
3575
  let i = r.invalid;
@@ -3569,17 +3583,17 @@ function Er(n, e) {
3569
3583
  }
3570
3584
  return r.handlers = t.handlers || {}, r.invalid = t.invalid, r.unknown = t.unknown, r;
3571
3585
  }
3572
- const Ir = /["&'<>`]/g, Lr = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, Or = (
3586
+ const Er = /["&'<>`]/g, Ir = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, Lr = (
3573
3587
  // eslint-disable-next-line no-control-regex, unicorn/no-hex-escape
3574
3588
  /[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g
3575
- ), Mr = /[|\\{}()[\]^$+*?.]/g, _t = /* @__PURE__ */ new WeakMap();
3576
- function Br(n, e) {
3589
+ ), Or = /[|\\{}()[\]^$+*?.]/g, _t = /* @__PURE__ */ new WeakMap();
3590
+ function Mr(n, e) {
3577
3591
  if (n = n.replace(
3578
- e.subset ? Gr(e.subset) : Ir,
3592
+ e.subset ? Br(e.subset) : Er,
3579
3593
  r
3580
3594
  ), e.subset || e.escapeOnly)
3581
3595
  return n;
3582
- return n.replace(Lr, t).replace(Or, r);
3596
+ return n.replace(Ir, t).replace(Lr, r);
3583
3597
  function t(s, o, i) {
3584
3598
  return e.format(
3585
3599
  (s.charCodeAt(0) - 55296) * 1024 + s.charCodeAt(1) - 56320 + 65536,
@@ -3595,28 +3609,28 @@ function Br(n, e) {
3595
3609
  );
3596
3610
  }
3597
3611
  }
3598
- function Gr(n) {
3612
+ function Br(n) {
3599
3613
  let e = _t.get(n);
3600
- return e || (e = Dr(n), _t.set(n, e)), e;
3614
+ return e || (e = Gr(n), _t.set(n, e)), e;
3601
3615
  }
3602
- function Dr(n) {
3616
+ function Gr(n) {
3603
3617
  const e = [];
3604
3618
  let t = -1;
3605
3619
  for (; ++t < n.length; )
3606
- e.push(n[t].replace(Mr, "\\$&"));
3620
+ e.push(n[t].replace(Or, "\\$&"));
3607
3621
  return new RegExp("(?:" + e.join("|") + ")", "g");
3608
3622
  }
3609
- const Ur = /[\dA-Fa-f]/;
3610
- function jr(n, e, t) {
3623
+ const Dr = /[\dA-Fa-f]/;
3624
+ function Ur(n, e, t) {
3611
3625
  const r = "&#x" + n.toString(16).toUpperCase();
3612
- return t && e && !Ur.test(String.fromCharCode(e)) ? r : r + ";";
3626
+ return t && e && !Dr.test(String.fromCharCode(e)) ? r : r + ";";
3613
3627
  }
3614
- const $r = /\d/;
3615
- function Fr(n, e, t) {
3628
+ const jr = /\d/;
3629
+ function $r(n, e, t) {
3616
3630
  const r = "&#" + String(n);
3617
- return t && e && !$r.test(String.fromCharCode(e)) ? r : r + ";";
3631
+ return t && e && !jr.test(String.fromCharCode(e)) ? r : r + ";";
3618
3632
  }
3619
- const Wr = [
3633
+ const Fr = [
3620
3634
  "AElig",
3621
3635
  "AMP",
3622
3636
  "Aacute",
@@ -3976,7 +3990,7 @@ const Wr = [
3976
3990
  lsaquo: "‹",
3977
3991
  rsaquo: "›",
3978
3992
  euro: "€"
3979
- }, zr = [
3993
+ }, Wr = [
3980
3994
  "cent",
3981
3995
  "copy",
3982
3996
  "divide",
@@ -3989,49 +4003,49 @@ const Wr = [
3989
4003
  let pe;
3990
4004
  for (pe in De)
3991
4005
  Zt.call(De, pe) && (Ye[De[pe]] = pe);
3992
- const Hr = /[^\dA-Za-z]/;
3993
- function qr(n, e, t, r) {
4006
+ const zr = /[^\dA-Za-z]/;
4007
+ function Hr(n, e, t, r) {
3994
4008
  const s = String.fromCharCode(n);
3995
4009
  if (Zt.call(Ye, s)) {
3996
4010
  const o = Ye[s], i = "&" + o;
3997
- return t && Wr.includes(o) && !zr.includes(o) && (!r || e && e !== 61 && Hr.test(String.fromCharCode(e))) ? i : i + ";";
4011
+ return t && Fr.includes(o) && !Wr.includes(o) && (!r || e && e !== 61 && zr.test(String.fromCharCode(e))) ? i : i + ";";
3998
4012
  }
3999
4013
  return "";
4000
4014
  }
4001
- function Vr(n, e, t) {
4002
- let r = jr(n, e, t.omitOptionalSemicolons), s;
4003
- if ((t.useNamedReferences || t.useShortestReferences) && (s = qr(
4015
+ function qr(n, e, t) {
4016
+ let r = Ur(n, e, t.omitOptionalSemicolons), s;
4017
+ if ((t.useNamedReferences || t.useShortestReferences) && (s = Hr(
4004
4018
  n,
4005
4019
  e,
4006
4020
  t.omitOptionalSemicolons,
4007
4021
  t.attribute
4008
4022
  )), (t.useShortestReferences || !s) && t.useShortestReferences) {
4009
- const o = Fr(n, e, t.omitOptionalSemicolons);
4023
+ const o = $r(n, e, t.omitOptionalSemicolons);
4010
4024
  o.length < r.length && (r = o);
4011
4025
  }
4012
4026
  return s && (!t.useShortestReferences || s.length < r.length) ? s : r;
4013
4027
  }
4014
4028
  function X(n, e) {
4015
- return Br(n, Object.assign({ format: Vr }, e));
4029
+ return Mr(n, Object.assign({ format: qr }, e));
4016
4030
  }
4017
- const Kr = /^>|^->|<!--|-->|--!>|<!-$/g, Yr = [">"], Xr = ["<", ">"];
4018
- function Jr(n, e, t, r) {
4031
+ const Vr = /^>|^->|<!--|-->|--!>|<!-$/g, Kr = [">"], Yr = ["<", ">"];
4032
+ function Xr(n, e, t, r) {
4019
4033
  return r.settings.bogusComments ? "<?" + X(
4020
4034
  n.value,
4021
4035
  Object.assign({}, r.settings.characterReferences, {
4022
- subset: Yr
4036
+ subset: Kr
4023
4037
  })
4024
- ) + ">" : "<!--" + n.value.replace(Kr, s) + "-->";
4038
+ ) + ">" : "<!--" + n.value.replace(Vr, s) + "-->";
4025
4039
  function s(o) {
4026
4040
  return X(
4027
4041
  o,
4028
4042
  Object.assign({}, r.settings.characterReferences, {
4029
- subset: Xr
4043
+ subset: Yr
4030
4044
  })
4031
4045
  );
4032
4046
  }
4033
4047
  }
4034
- function Qr(n, e, t, r) {
4048
+ function Jr(n, e, t, r) {
4035
4049
  return "<!" + (r.settings.upperDoctype ? "DOCTYPE" : "doctype") + (r.settings.tightDoctype ? "" : " ") + "html>";
4036
4050
  }
4037
4051
  function bt(n, e) {
@@ -4043,27 +4057,27 @@ function bt(n, e) {
4043
4057
  r++, s = t.indexOf(e, s + e.length);
4044
4058
  return r;
4045
4059
  }
4046
- function Zr(n, e) {
4060
+ function Qr(n, e) {
4047
4061
  const t = e || {};
4048
4062
  return (n[n.length - 1] === "" ? [...n, ""] : n).join(
4049
4063
  (t.padRight ? " " : "") + "," + (t.padLeft === !1 ? "" : " ")
4050
4064
  ).trim();
4051
4065
  }
4052
- function es(n) {
4066
+ function Zr(n) {
4053
4067
  return n.join(" ").trim();
4054
4068
  }
4055
- const ts = /[ \t\n\f\r]/g;
4069
+ const es = /[ \t\n\f\r]/g;
4056
4070
  function Ze(n) {
4057
4071
  return typeof n == "object" ? n.type === "text" ? St(n.value) : !1 : St(n);
4058
4072
  }
4059
4073
  function St(n) {
4060
- return n.replace(ts, "") === "";
4074
+ return n.replace(es, "") === "";
4061
4075
  }
4062
- const T = tn(1), en = tn(-1), ns = [];
4076
+ const T = tn(1), en = tn(-1), ts = [];
4063
4077
  function tn(n) {
4064
4078
  return e;
4065
4079
  function e(t, r, s) {
4066
- const o = t ? t.children : ns;
4080
+ const o = t ? t.children : ts;
4067
4081
  let i = (r || 0) + n, l = o[i];
4068
4082
  if (!s)
4069
4083
  for (; l && Ze(l); )
@@ -4071,60 +4085,60 @@ function tn(n) {
4071
4085
  return l;
4072
4086
  }
4073
4087
  }
4074
- const rs = {}.hasOwnProperty;
4088
+ const ns = {}.hasOwnProperty;
4075
4089
  function nn(n) {
4076
4090
  return e;
4077
4091
  function e(t, r, s) {
4078
- return rs.call(n, t.tagName) && n[t.tagName](t, r, s);
4092
+ return ns.call(n, t.tagName) && n[t.tagName](t, r, s);
4079
4093
  }
4080
4094
  }
4081
4095
  const et = nn({
4082
- body: os,
4096
+ body: ss,
4083
4097
  caption: Ue,
4084
4098
  colgroup: Ue,
4085
- dd: cs,
4086
- dt: ls,
4099
+ dd: ls,
4100
+ dt: as,
4087
4101
  head: Ue,
4088
- html: ss,
4089
- li: as,
4090
- optgroup: us,
4091
- option: hs,
4092
- p: is,
4102
+ html: rs,
4103
+ li: is,
4104
+ optgroup: cs,
4105
+ option: us,
4106
+ p: os,
4093
4107
  rp: Ct,
4094
4108
  rt: Ct,
4095
- tbody: ds,
4109
+ tbody: fs,
4096
4110
  td: wt,
4097
- tfoot: ps,
4111
+ tfoot: ds,
4098
4112
  th: wt,
4099
- thead: fs,
4100
- tr: gs
4113
+ thead: hs,
4114
+ tr: ps
4101
4115
  });
4102
4116
  function Ue(n, e, t) {
4103
4117
  const r = T(t, e, !0);
4104
4118
  return !r || r.type !== "comment" && !(r.type === "text" && Ze(r.value.charAt(0)));
4105
4119
  }
4106
- function ss(n, e, t) {
4120
+ function rs(n, e, t) {
4107
4121
  const r = T(t, e);
4108
4122
  return !r || r.type !== "comment";
4109
4123
  }
4110
- function os(n, e, t) {
4124
+ function ss(n, e, t) {
4111
4125
  const r = T(t, e);
4112
4126
  return !r || r.type !== "comment";
4113
4127
  }
4114
- function is(n, e, t) {
4128
+ function os(n, e, t) {
4115
4129
  const r = T(t, e);
4116
4130
  return r ? r.type === "element" && (r.tagName === "address" || r.tagName === "article" || r.tagName === "aside" || r.tagName === "blockquote" || r.tagName === "details" || r.tagName === "div" || r.tagName === "dl" || r.tagName === "fieldset" || r.tagName === "figcaption" || r.tagName === "figure" || r.tagName === "footer" || r.tagName === "form" || r.tagName === "h1" || r.tagName === "h2" || r.tagName === "h3" || r.tagName === "h4" || r.tagName === "h5" || r.tagName === "h6" || r.tagName === "header" || r.tagName === "hgroup" || r.tagName === "hr" || r.tagName === "main" || r.tagName === "menu" || r.tagName === "nav" || r.tagName === "ol" || r.tagName === "p" || r.tagName === "pre" || r.tagName === "section" || r.tagName === "table" || r.tagName === "ul") : !t || // Confusing parent.
4117
4131
  !(t.type === "element" && (t.tagName === "a" || t.tagName === "audio" || t.tagName === "del" || t.tagName === "ins" || t.tagName === "map" || t.tagName === "noscript" || t.tagName === "video"));
4118
4132
  }
4119
- function as(n, e, t) {
4133
+ function is(n, e, t) {
4120
4134
  const r = T(t, e);
4121
4135
  return !r || r.type === "element" && r.tagName === "li";
4122
4136
  }
4123
- function ls(n, e, t) {
4137
+ function as(n, e, t) {
4124
4138
  const r = T(t, e);
4125
4139
  return !!(r && r.type === "element" && (r.tagName === "dt" || r.tagName === "dd"));
4126
4140
  }
4127
- function cs(n, e, t) {
4141
+ function ls(n, e, t) {
4128
4142
  const r = T(t, e);
4129
4143
  return !r || r.type === "element" && (r.tagName === "dt" || r.tagName === "dd");
4130
4144
  }
@@ -4132,26 +4146,26 @@ function Ct(n, e, t) {
4132
4146
  const r = T(t, e);
4133
4147
  return !r || r.type === "element" && (r.tagName === "rp" || r.tagName === "rt");
4134
4148
  }
4135
- function us(n, e, t) {
4149
+ function cs(n, e, t) {
4136
4150
  const r = T(t, e);
4137
4151
  return !r || r.type === "element" && r.tagName === "optgroup";
4138
4152
  }
4139
- function hs(n, e, t) {
4153
+ function us(n, e, t) {
4140
4154
  const r = T(t, e);
4141
4155
  return !r || r.type === "element" && (r.tagName === "option" || r.tagName === "optgroup");
4142
4156
  }
4143
- function fs(n, e, t) {
4157
+ function hs(n, e, t) {
4144
4158
  const r = T(t, e);
4145
4159
  return !!(r && r.type === "element" && (r.tagName === "tbody" || r.tagName === "tfoot"));
4146
4160
  }
4147
- function ds(n, e, t) {
4161
+ function fs(n, e, t) {
4148
4162
  const r = T(t, e);
4149
4163
  return !r || r.type === "element" && (r.tagName === "tbody" || r.tagName === "tfoot");
4150
4164
  }
4151
- function ps(n, e, t) {
4165
+ function ds(n, e, t) {
4152
4166
  return !T(t, e);
4153
4167
  }
4154
- function gs(n, e, t) {
4168
+ function ps(n, e, t) {
4155
4169
  const r = T(t, e);
4156
4170
  return !r || r.type === "element" && r.tagName === "tr";
4157
4171
  }
@@ -4159,18 +4173,18 @@ function wt(n, e, t) {
4159
4173
  const r = T(t, e);
4160
4174
  return !r || r.type === "element" && (r.tagName === "td" || r.tagName === "th");
4161
4175
  }
4162
- const ms = nn({
4163
- body: bs,
4164
- colgroup: Ss,
4165
- head: _s,
4166
- html: ys,
4167
- tbody: Cs
4176
+ const gs = nn({
4177
+ body: _s,
4178
+ colgroup: bs,
4179
+ head: ys,
4180
+ html: ms,
4181
+ tbody: Ss
4168
4182
  });
4169
- function ys(n) {
4183
+ function ms(n) {
4170
4184
  const e = T(n, -1);
4171
4185
  return !e || e.type !== "comment";
4172
4186
  }
4173
- function _s(n) {
4187
+ function ys(n) {
4174
4188
  const e = /* @__PURE__ */ new Set();
4175
4189
  for (const r of n.children)
4176
4190
  if (r.type === "element" && (r.tagName === "base" || r.tagName === "title")) {
@@ -4180,15 +4194,15 @@ function _s(n) {
4180
4194
  const t = n.children[0];
4181
4195
  return !t || t.type === "element";
4182
4196
  }
4183
- function bs(n) {
4197
+ function _s(n) {
4184
4198
  const e = T(n, -1, !0);
4185
4199
  return !e || e.type !== "comment" && !(e.type === "text" && Ze(e.value.charAt(0))) && !(e.type === "element" && (e.tagName === "meta" || e.tagName === "link" || e.tagName === "script" || e.tagName === "style" || e.tagName === "template"));
4186
4200
  }
4187
- function Ss(n, e, t) {
4201
+ function bs(n, e, t) {
4188
4202
  const r = en(t, e), s = T(n, -1, !0);
4189
4203
  return t && r && r.type === "element" && r.tagName === "colgroup" && et(r, t.children.indexOf(r), t) ? !1 : !!(s && s.type === "element" && s.tagName === "col");
4190
4204
  }
4191
- function Cs(n, e, t) {
4205
+ function Ss(n, e, t) {
4192
4206
  const r = en(t, e), s = T(n, -1);
4193
4207
  return t && r && r.type === "element" && (r.tagName === "thead" || r.tagName === "tbody") && et(r, t.children.indexOf(r), t) ? !1 : !!(s && s.type === "element" && s.tagName === "tr");
4194
4208
  }
@@ -4222,24 +4236,24 @@ const ge = {
4222
4236
  ['\0"&'.split(""), "\0\"&'`".split("")]
4223
4237
  ]
4224
4238
  };
4225
- function ws(n, e, t, r) {
4239
+ function Cs(n, e, t, r) {
4226
4240
  const s = r.schema, o = s.space === "svg" ? !1 : r.settings.omitOptionalTags;
4227
4241
  let i = s.space === "svg" ? r.settings.closeEmptyElements : r.settings.voids.includes(n.tagName.toLowerCase());
4228
4242
  const l = [];
4229
4243
  let a;
4230
4244
  s.space === "html" && n.tagName === "svg" && (r.schema = Qt);
4231
- const c = vs(r, n.properties), u = r.all(
4245
+ const c = ws(r, n.properties), u = r.all(
4232
4246
  s.space === "html" && n.tagName === "template" ? n.content : n
4233
4247
  );
4234
- return r.schema = s, u && (i = !1), (c || !o || !ms(n, e, t)) && (l.push("<", n.tagName, c ? " " + c : ""), i && (s.space === "svg" || r.settings.closeSelfClosing) && (a = c.charAt(c.length - 1), (!r.settings.tightSelfClosing || a === "/" || a && a !== '"' && a !== "'") && l.push(" "), l.push("/")), l.push(">")), l.push(u), !i && (!o || !et(n, e, t)) && l.push("</" + n.tagName + ">"), l.join("");
4248
+ return r.schema = s, u && (i = !1), (c || !o || !gs(n, e, t)) && (l.push("<", n.tagName, c ? " " + c : ""), i && (s.space === "svg" || r.settings.closeSelfClosing) && (a = c.charAt(c.length - 1), (!r.settings.tightSelfClosing || a === "/" || a && a !== '"' && a !== "'") && l.push(" "), l.push("/")), l.push(">")), l.push(u), !i && (!o || !et(n, e, t)) && l.push("</" + n.tagName + ">"), l.join("");
4235
4249
  }
4236
- function vs(n, e) {
4250
+ function ws(n, e) {
4237
4251
  const t = [];
4238
4252
  let r = -1, s;
4239
4253
  if (e) {
4240
4254
  for (s in e)
4241
4255
  if (e[s] !== null && e[s] !== void 0) {
4242
- const o = ks(n, s, e[s]);
4256
+ const o = vs(n, s, e[s]);
4243
4257
  o && t.push(o);
4244
4258
  }
4245
4259
  }
@@ -4249,8 +4263,8 @@ function vs(n, e) {
4249
4263
  }
4250
4264
  return t.join("");
4251
4265
  }
4252
- function ks(n, e, t) {
4253
- const r = Pr(n.schema, e), s = n.settings.allowParseErrors && n.schema.space === "html" ? 0 : 1, o = n.settings.allowDangerousCharacters ? 0 : 1;
4266
+ function vs(n, e, t) {
4267
+ const r = Ar(n.schema, e), s = n.settings.allowParseErrors && n.schema.space === "html" ? 0 : 1, o = n.settings.allowDangerousCharacters ? 0 : 1;
4254
4268
  let i = n.quote, l;
4255
4269
  if (r.overloadedBoolean && (t === r.attribute || t === "") ? t = !0 : (r.boolean || r.overloadedBoolean) && (typeof t != "string" || t === r.attribute || t === "") && (t = !!t), t == null || t === !1 || typeof t == "number" && Number.isNaN(t))
4256
4270
  return "";
@@ -4261,7 +4275,7 @@ function ks(n, e, t) {
4261
4275
  subset: ge.name[s][o]
4262
4276
  })
4263
4277
  );
4264
- return t === !0 || (t = Array.isArray(t) ? (r.commaSeparated ? Zr : es)(t, {
4278
+ return t === !0 || (t = Array.isArray(t) ? (r.commaSeparated ? Qr : Zr)(t, {
4265
4279
  padLeft: !n.settings.tightCommaSeparatedLists
4266
4280
  }) : String(t), n.settings.collapseEmptyAttributes && !t) ? a : (n.settings.preferUnquoted && (l = X(
4267
4281
  t,
@@ -4278,44 +4292,44 @@ function ks(n, e, t) {
4278
4292
  })
4279
4293
  ) + i), a + (l && "=" + l));
4280
4294
  }
4281
- const Rs = ["<", "&"];
4295
+ const ks = ["<", "&"];
4282
4296
  function rn(n, e, t, r) {
4283
4297
  return t && t.type === "element" && (t.tagName === "script" || t.tagName === "style") ? n.value : X(
4284
4298
  n.value,
4285
4299
  Object.assign({}, r.settings.characterReferences, {
4286
- subset: Rs
4300
+ subset: ks
4287
4301
  })
4288
4302
  );
4289
4303
  }
4290
- function As(n, e, t, r) {
4304
+ function Rs(n, e, t, r) {
4291
4305
  return r.settings.allowDangerousHtml ? n.value : rn(n, e, t, r);
4292
4306
  }
4293
- function Ps(n, e, t, r) {
4307
+ function As(n, e, t, r) {
4294
4308
  return r.all(n);
4295
4309
  }
4296
- const Ns = Er("type", {
4297
- invalid: Ts,
4298
- unknown: xs,
4299
- handlers: { comment: Jr, doctype: Qr, element: ws, raw: As, root: Ps, text: rn }
4310
+ const Ps = xr("type", {
4311
+ invalid: Ns,
4312
+ unknown: Ts,
4313
+ handlers: { comment: Xr, doctype: Jr, element: Cs, raw: Rs, root: As, text: rn }
4300
4314
  });
4301
- function Ts(n) {
4315
+ function Ns(n) {
4302
4316
  throw new Error("Expected node, not `" + n + "`");
4303
4317
  }
4304
- function xs(n) {
4318
+ function Ts(n) {
4305
4319
  const e = (
4306
4320
  /** @type {Nodes} */
4307
4321
  n
4308
4322
  );
4309
4323
  throw new Error("Cannot compile unknown node `" + e.type + "`");
4310
4324
  }
4311
- const Es = {}, Is = {}, Ls = [];
4312
- function Os(n, e) {
4313
- const t = Es, r = t.quote || '"', s = r === '"' ? "'" : '"';
4325
+ const xs = {}, Es = {}, Is = [];
4326
+ function Ls(n, e) {
4327
+ const t = xs, r = t.quote || '"', s = r === '"' ? "'" : '"';
4314
4328
  if (r !== '"' && r !== "'")
4315
4329
  throw new Error("Invalid quote `" + r + "`, expected `'` or `\"`");
4316
4330
  return {
4317
- one: Ms,
4318
- all: Bs,
4331
+ one: Os,
4332
+ all: Ms,
4319
4333
  settings: {
4320
4334
  omitOptionalTags: t.omitOptionalTags || !1,
4321
4335
  allowParseErrors: t.allowParseErrors || !1,
@@ -4331,11 +4345,11 @@ function Os(n, e) {
4331
4345
  collapseEmptyAttributes: t.collapseEmptyAttributes || !1,
4332
4346
  allowDangerousHtml: t.allowDangerousHtml || !1,
4333
4347
  voids: t.voids || Sr,
4334
- characterReferences: t.characterReferences || Is,
4348
+ characterReferences: t.characterReferences || Es,
4335
4349
  closeSelfClosing: t.closeSelfClosing || !1,
4336
4350
  closeEmptyElements: t.closeEmptyElements || !1
4337
4351
  },
4338
- schema: t.space === "svg" ? Qt : xr,
4352
+ schema: t.space === "svg" ? Qt : Tr,
4339
4353
  quote: r,
4340
4354
  alternative: s
4341
4355
  }.one(
@@ -4344,17 +4358,17 @@ function Os(n, e) {
4344
4358
  void 0
4345
4359
  );
4346
4360
  }
4347
- function Ms(n, e, t) {
4348
- return Ns(n, e, t, this);
4361
+ function Os(n, e, t) {
4362
+ return Ps(n, e, t, this);
4349
4363
  }
4350
- function Bs(n) {
4351
- const e = [], t = n && n.children || Ls;
4364
+ function Ms(n) {
4365
+ const e = [], t = n && n.children || Is;
4352
4366
  let r = -1;
4353
4367
  for (; ++r < t.length; )
4354
4368
  e[r] = this.one(t[r], r, n);
4355
4369
  return e.join("");
4356
4370
  }
4357
- function Gs(n) {
4371
+ function Bs(n) {
4358
4372
  return Array.isArray(n) ? n : [n];
4359
4373
  }
4360
4374
  function Te(n, e = !1) {
@@ -4371,13 +4385,13 @@ function Te(n, e = !1) {
4371
4385
  function tt(n) {
4372
4386
  return !n || ["plaintext", "txt", "text", "plain"].includes(n);
4373
4387
  }
4374
- function Ds(n) {
4388
+ function Gs(n) {
4375
4389
  return n === "ansi" || tt(n);
4376
4390
  }
4377
4391
  function nt(n) {
4378
4392
  return n === "none";
4379
4393
  }
4380
- function Us(n) {
4394
+ function Ds(n) {
4381
4395
  return nt(n);
4382
4396
  }
4383
4397
  function sn(n, e) {
@@ -4390,7 +4404,7 @@ function sn(n, e) {
4390
4404
  s && !n.properties.class.includes(s) && n.properties.class.push(s);
4391
4405
  return n;
4392
4406
  }
4393
- function js(n, e) {
4407
+ function Us(n, e) {
4394
4408
  let t = 0;
4395
4409
  const r = [];
4396
4410
  for (const s of e)
@@ -4405,11 +4419,11 @@ function js(n, e) {
4405
4419
  offset: n.offset + t
4406
4420
  }), r;
4407
4421
  }
4408
- function $s(n, e) {
4422
+ function js(n, e) {
4409
4423
  const t = Array.from(e instanceof Set ? e : new Set(e)).sort((r, s) => r - s);
4410
4424
  return t.length ? n.map((r) => r.flatMap((s) => {
4411
4425
  const o = t.filter((i) => s.offset < i && i < s.offset + s.content.length).map((i) => i - s.offset).sort((i, l) => i - l);
4412
- return o.length ? js(s, o) : s;
4426
+ return o.length ? Us(s, o) : s;
4413
4427
  })) : n;
4414
4428
  }
4415
4429
  async function on(n) {
@@ -4428,10 +4442,10 @@ function an(n) {
4428
4442
  const e = {};
4429
4443
  return n.color && (e.color = n.color), n.bgColor && (e["background-color"] = n.bgColor), n.fontStyle && (n.fontStyle & W.Italic && (e["font-style"] = "italic"), n.fontStyle & W.Bold && (e["font-weight"] = "bold"), n.fontStyle & W.Underline && (e["text-decoration"] = "underline")), e;
4430
4444
  }
4431
- function Fs(n) {
4445
+ function $s(n) {
4432
4446
  return typeof n == "string" ? n : Object.entries(n).map(([e, t]) => `${e}:${t}`).join(";");
4433
4447
  }
4434
- function Ws(n) {
4448
+ function Fs(n) {
4435
4449
  const e = Te(n, !0).map(([s]) => s);
4436
4450
  function t(s) {
4437
4451
  if (s === n.length)
@@ -4500,7 +4514,7 @@ class Z {
4500
4514
  */
4501
4515
  static initial(e, t) {
4502
4516
  return new Z(
4503
- Object.fromEntries(Gs(t).map((r) => [r, qe])),
4517
+ Object.fromEntries(Bs(t).map((r) => [r, qe])),
4504
4518
  e
4505
4519
  );
4506
4520
  }
@@ -4541,12 +4555,12 @@ function vt(n) {
4541
4555
  }
4542
4556
  return r(n), e;
4543
4557
  }
4544
- function zs(n, e) {
4558
+ function Ws(n, e) {
4545
4559
  if (!(n instanceof Z))
4546
4560
  throw new I("Invalid grammar state");
4547
4561
  return n.getInternalStack(e);
4548
4562
  }
4549
- function Hs() {
4563
+ function zs() {
4550
4564
  const n = /* @__PURE__ */ new WeakMap();
4551
4565
  function e(t) {
4552
4566
  if (!n.has(t.meta)) {
@@ -4570,12 +4584,12 @@ function Hs() {
4570
4584
  };
4571
4585
  }
4572
4586
  };
4573
- const s = Ws(t.source), o = (t.options.decorations || []).map((i) => ({
4587
+ const s = Fs(t.source), o = (t.options.decorations || []).map((i) => ({
4574
4588
  ...i,
4575
4589
  start: r(i.start),
4576
4590
  end: r(i.end)
4577
4591
  }));
4578
- qs(o), n.set(t.meta, {
4592
+ Hs(o), n.set(t.meta, {
4579
4593
  decorations: o,
4580
4594
  converter: s,
4581
4595
  source: t.source
@@ -4590,7 +4604,7 @@ function Hs() {
4590
4604
  if (!((i = this.options.decorations) != null && i.length))
4591
4605
  return;
4592
4606
  const s = e(this).decorations.flatMap((l) => [l.start.offset, l.end.offset]);
4593
- return $s(t, s);
4607
+ return js(t, s);
4594
4608
  },
4595
4609
  code(t) {
4596
4610
  var u;
@@ -4652,7 +4666,7 @@ function Hs() {
4652
4666
  }
4653
4667
  };
4654
4668
  }
4655
- function qs(n) {
4669
+ function Hs(n) {
4656
4670
  for (let e = 0; e < n.length; e++) {
4657
4671
  const t = n[e];
4658
4672
  if (t.start.offset > t.end.offset)
@@ -4670,13 +4684,13 @@ function qs(n) {
4670
4684
  function cn(n) {
4671
4685
  return n.type === "text" ? n.value : n.type === "element" ? n.children.map(cn).join("") : "";
4672
4686
  }
4673
- const Vs = [
4674
- /* @__PURE__ */ Hs()
4687
+ const qs = [
4688
+ /* @__PURE__ */ zs()
4675
4689
  ];
4676
4690
  function ke(n) {
4677
4691
  return [
4678
4692
  ...n.transformers || [],
4679
- ...Vs
4693
+ ...qs
4680
4694
  ];
4681
4695
  }
4682
4696
  var H = [
@@ -4704,7 +4718,7 @@ var H = [
4704
4718
  7: "reverse",
4705
4719
  9: "strikethrough"
4706
4720
  };
4707
- function Ks(n, e) {
4721
+ function Vs(n, e) {
4708
4722
  const t = n.indexOf("\x1B[", e);
4709
4723
  if (t !== -1) {
4710
4724
  const r = n.indexOf("m", t);
@@ -4738,7 +4752,7 @@ function kt(n, e) {
4738
4752
  }
4739
4753
  return [t, s];
4740
4754
  }
4741
- function Ys(n) {
4755
+ function Ks(n) {
4742
4756
  const e = [];
4743
4757
  for (let t = 0; t < n.length; t++) {
4744
4758
  const r = n[t], s = Number.parseInt(r);
@@ -4794,21 +4808,21 @@ function Ys(n) {
4794
4808
  }
4795
4809
  return e;
4796
4810
  }
4797
- function Xs() {
4811
+ function Ys() {
4798
4812
  let n = null, e = null, t = /* @__PURE__ */ new Set();
4799
4813
  return {
4800
4814
  parse(r) {
4801
4815
  const s = [];
4802
4816
  let o = 0;
4803
4817
  do {
4804
- const i = Ks(r, o), l = i.sequence ? r.substring(o, i.startPosition) : r.substring(o);
4818
+ const i = Vs(r, o), l = i.sequence ? r.substring(o, i.startPosition) : r.substring(o);
4805
4819
  if (l.length > 0 && s.push({
4806
4820
  value: l,
4807
4821
  foreground: n,
4808
4822
  background: e,
4809
4823
  decorations: new Set(t)
4810
4824
  }), i.sequence) {
4811
- const a = Ys(i.sequence);
4825
+ const a = Ks(i.sequence);
4812
4826
  for (const c of a)
4813
4827
  c.type === "resetAll" ? (n = null, e = null, t.clear()) : c.type === "resetForegroundColor" ? n = null : c.type === "resetBackgroundColor" ? e = null : c.type === "resetDecoration" && t.delete(c.value);
4814
4828
  for (const c of a)
@@ -4820,7 +4834,7 @@ function Xs() {
4820
4834
  }
4821
4835
  };
4822
4836
  }
4823
- var Js = {
4837
+ var Xs = {
4824
4838
  black: "#000000",
4825
4839
  red: "#bb0000",
4826
4840
  green: "#00bb00",
@@ -4838,7 +4852,7 @@ var Js = {
4838
4852
  brightCyan: "#55ffff",
4839
4853
  brightWhite: "#ffffff"
4840
4854
  };
4841
- function Qs(n = Js) {
4855
+ function Js(n = Xs) {
4842
4856
  function e(l) {
4843
4857
  return n[l];
4844
4858
  }
@@ -4879,8 +4893,8 @@ function Qs(n = Js) {
4879
4893
  value: i
4880
4894
  };
4881
4895
  }
4882
- function Zs(n, e, t) {
4883
- const r = ve(n, t), s = Te(e), o = Qs(
4896
+ function Qs(n, e, t) {
4897
+ const r = ve(n, t), s = Te(e), o = Js(
4884
4898
  Object.fromEntries(
4885
4899
  H.map((l) => {
4886
4900
  var a;
@@ -4890,11 +4904,11 @@ function Zs(n, e, t) {
4890
4904
  ];
4891
4905
  })
4892
4906
  )
4893
- ), i = Xs();
4907
+ ), i = Ys();
4894
4908
  return s.map(
4895
4909
  (l) => i.parse(l[0]).map((a) => {
4896
4910
  let c, u;
4897
- a.decorations.has("reverse") ? (c = a.background ? o.value(a.background) : n.bg, u = a.foreground ? o.value(a.foreground) : n.fg) : (c = a.foreground ? o.value(a.foreground) : n.fg, u = a.background ? o.value(a.background) : void 0), c = z(c, r), u = z(u, r), a.decorations.has("dim") && (c = eo(c));
4911
+ a.decorations.has("reverse") ? (c = a.background ? o.value(a.background) : n.bg, u = a.foreground ? o.value(a.foreground) : n.fg) : (c = a.foreground ? o.value(a.foreground) : n.fg, u = a.background ? o.value(a.background) : void 0), c = z(c, r), u = z(u, r), a.decorations.has("dim") && (c = Zs(c));
4898
4912
  let h = W.None;
4899
4913
  return a.decorations.has("bold") && (h |= W.Bold), a.decorations.has("italic") && (h |= W.Italic), a.decorations.has("underline") && (h |= W.Underline), {
4900
4914
  content: a.value,
@@ -4907,7 +4921,7 @@ function Zs(n, e, t) {
4907
4921
  })
4908
4922
  );
4909
4923
  }
4910
- function eo(n) {
4924
+ function Zs(n) {
4911
4925
  const e = n.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);
4912
4926
  if (e)
4913
4927
  if (e[3]) {
@@ -4926,7 +4940,7 @@ function rt(n, e, t = {}) {
4926
4940
  return Te(e).map((a) => [{ content: a[0], offset: a[1] }]);
4927
4941
  const { theme: o, colorMap: i } = n.setTheme(s);
4928
4942
  if (r === "ansi")
4929
- return Zs(o, e, t);
4943
+ return Qs(o, e, t);
4930
4944
  const l = n.getLanguage(r);
4931
4945
  if (t.grammarState) {
4932
4946
  if (t.grammarState.lang !== l.name)
@@ -4934,9 +4948,9 @@ function rt(n, e, t = {}) {
4934
4948
  if (!t.grammarState.themes.includes(o.name))
4935
4949
  throw new q(`Grammar state themes "${t.grammarState.themes}" do not contain highlight theme "${o.name}"`);
4936
4950
  }
4937
- return no(e, l, o, i, t);
4951
+ return to(e, l, o, i, t);
4938
4952
  }
4939
- function to(...n) {
4953
+ function eo(...n) {
4940
4954
  if (n.length === 2)
4941
4955
  return ae(n[1]);
4942
4956
  const [e, t, r = {}] = n, {
@@ -4954,7 +4968,7 @@ function to(...n) {
4954
4968
  i.name
4955
4969
  );
4956
4970
  }
4957
- function no(n, e, t, r, s) {
4971
+ function to(n, e, t, r, s) {
4958
4972
  const o = Re(n, e, t, r, s), i = new Z(
4959
4973
  Re(n, e, t, r, s).stateStack,
4960
4974
  e.name,
@@ -4967,7 +4981,7 @@ function Re(n, e, t, r, s) {
4967
4981
  tokenizeMaxLineLength: i = 0,
4968
4982
  tokenizeTimeLimit: l = 500
4969
4983
  } = s, a = Te(n);
4970
- let c = s.grammarState ? zs(s.grammarState, t.name) ?? qe : s.grammarContextCode != null ? Re(
4984
+ let c = s.grammarState ? Ws(s.grammarState, t.name) ?? qe : s.grammarContextCode != null ? Re(
4971
4985
  s.grammarContextCode,
4972
4986
  e,
4973
4987
  t,
@@ -5039,9 +5053,9 @@ function Re(n, e, t, r, s) {
5039
5053
  );
5040
5054
  it += K.length, Ee.explanation.push({
5041
5055
  content: K,
5042
- scopes: s.includeExplanation === "scopeName" ? ro(
5056
+ scopes: s.includeExplanation === "scopeName" ? no(
5043
5057
  $.scopes
5044
- ) : so(
5058
+ ) : ro(
5045
5059
  ot,
5046
5060
  $.scopes
5047
5061
  )
@@ -5057,16 +5071,16 @@ function Re(n, e, t, r, s) {
5057
5071
  stateStack: c
5058
5072
  };
5059
5073
  }
5060
- function ro(n) {
5074
+ function no(n) {
5061
5075
  return n.map((e) => ({ scopeName: e }));
5062
5076
  }
5063
- function so(n, e) {
5077
+ function ro(n, e) {
5064
5078
  const t = [];
5065
5079
  for (let r = 0, s = e.length; r < s; r++) {
5066
5080
  const o = e[r];
5067
5081
  t[r] = {
5068
5082
  scopeName: o,
5069
- themeMatches: io(n, o, e.slice(0, r))
5083
+ themeMatches: oo(n, o, e.slice(0, r))
5070
5084
  };
5071
5085
  }
5072
5086
  return t;
@@ -5074,7 +5088,7 @@ function so(n, e) {
5074
5088
  function Rt(n, e) {
5075
5089
  return n === e || e.substring(0, n.length) === n && e[n.length] === ".";
5076
5090
  }
5077
- function oo(n, e, t) {
5091
+ function so(n, e, t) {
5078
5092
  if (!Rt(n[n.length - 1], e))
5079
5093
  return !1;
5080
5094
  let r = n.length - 2, s = t.length - 1;
@@ -5082,11 +5096,11 @@ function oo(n, e, t) {
5082
5096
  Rt(n[r], t[s]) && (r -= 1), s -= 1;
5083
5097
  return r === -1;
5084
5098
  }
5085
- function io(n, e, t) {
5099
+ function oo(n, e, t) {
5086
5100
  const r = [];
5087
5101
  for (const { selectors: s, settings: o } of n)
5088
5102
  for (const i of s)
5089
- if (oo(i, e, t)) {
5103
+ if (so(i, e, t)) {
5090
5104
  r.push(o);
5091
5105
  break;
5092
5106
  }
@@ -5103,7 +5117,7 @@ function un(n, e, t) {
5103
5117
  state: u,
5104
5118
  theme: h
5105
5119
  };
5106
- }), o = ao(
5120
+ }), o = io(
5107
5121
  ...s.map((a) => a.tokens)
5108
5122
  ), i = o[0].map(
5109
5123
  (a, c) => a.map((u, h) => {
@@ -5131,7 +5145,7 @@ function un(n, e, t) {
5131
5145
  ) : void 0;
5132
5146
  return l && xe(i, l), i;
5133
5147
  }
5134
- function ao(...n) {
5148
+ function io(...n) {
5135
5149
  const e = n.map(() => []), t = n.length;
5136
5150
  for (let r = 0; r < n[0].length; r++) {
5137
5151
  const s = n.map((a) => a[r]), o = e.map(() => []);
@@ -5171,7 +5185,7 @@ function Ae(n, e, t) {
5171
5185
  if (a = ae(d), c && !h.find((_) => _.color === c))
5172
5186
  throw new q(`\`themes\` option must contain the defaultColor key \`${c}\``);
5173
5187
  const f = h.map((_) => n.getTheme(_.theme)), g = h.map((_) => _.color);
5174
- o = d.map((_) => _.map((y) => lo(y, g, u, c))), a && xe(o, a);
5188
+ o = d.map((_) => _.map((y) => ao(y, g, u, c))), a && xe(o, a);
5175
5189
  const C = h.map((_) => ve(_.theme, t));
5176
5190
  s = h.map((_, y) => (y === 0 && c ? "" : `${u + _.color}:`) + (z(f[y].fg, C[y]) || "inherit")).join(";"), r = h.map((_, y) => (y === 0 && c ? "" : `${u + _.color}-bg:`) + (z(f[y].bg, C[y]) || "inherit")).join(";"), i = `shiki-themes ${f.map((_) => _.name).join(" ")}`, l = c ? void 0 : [s, r].join(";");
5177
5191
  } else if ("theme" in t) {
@@ -5194,7 +5208,7 @@ function Ae(n, e, t) {
5194
5208
  grammarState: a
5195
5209
  };
5196
5210
  }
5197
- function lo(n, e, t, r) {
5211
+ function ao(n, e, t, r) {
5198
5212
  const s = {
5199
5213
  content: n.content,
5200
5214
  explanation: n.explanation,
@@ -5233,7 +5247,7 @@ function Pe(n, e, t, r = {
5233
5247
  const {
5234
5248
  mergeWhitespaces: h = !0
5235
5249
  } = t;
5236
- h === !0 ? o = uo(o) : h === "never" && (o = ho(o));
5250
+ h === !0 ? o = co(o) : h === "never" && (o = uo(o));
5237
5251
  const d = {
5238
5252
  ...r,
5239
5253
  get source() {
@@ -5242,7 +5256,7 @@ function Pe(n, e, t, r = {
5242
5256
  };
5243
5257
  for (const C of ke(t))
5244
5258
  o = ((g = C.tokens) == null ? void 0 : g.call(d, o)) || o;
5245
- return co(
5259
+ return lo(
5246
5260
  o,
5247
5261
  {
5248
5262
  ...t,
@@ -5255,7 +5269,7 @@ function Pe(n, e, t, r = {
5255
5269
  u
5256
5270
  );
5257
5271
  }
5258
- function co(n, e, t, r = ae(n)) {
5272
+ function lo(n, e, t, r = ae(n)) {
5259
5273
  var g, C, _;
5260
5274
  const s = ke(e), o = [], i = {
5261
5275
  type: "root",
@@ -5332,7 +5346,7 @@ function co(n, e, t, r = ae(n)) {
5332
5346
  children: [{ type: "text", value: P.content }]
5333
5347
  };
5334
5348
  P.htmlStyle;
5335
- const he = Fs(P.htmlStyle || an(P));
5349
+ const he = $s(P.htmlStyle || an(P));
5336
5350
  he && (j.properties.style = he);
5337
5351
  for (const ee of s)
5338
5352
  j = ((R = ee == null ? void 0 : ee.span) == null ? void 0 : R.call(d, j, b + 1, v, S, P)) || j;
@@ -5356,7 +5370,7 @@ function co(n, e, t, r = ae(n)) {
5356
5370
  f = ((_ = y == null ? void 0 : y.root) == null ? void 0 : _.call(d, f)) || f;
5357
5371
  return r && xe(f, r), f;
5358
5372
  }
5359
- function uo(n) {
5373
+ function co(n) {
5360
5374
  return n.map((e) => {
5361
5375
  const t = [];
5362
5376
  let r = "", s = 0;
@@ -5376,7 +5390,7 @@ function uo(n) {
5376
5390
  }), t;
5377
5391
  });
5378
5392
  }
5379
- function ho(n) {
5393
+ function uo(n) {
5380
5394
  return n.map((e) => e.flatMap((t) => {
5381
5395
  if (t.content.match(/^\s+$/))
5382
5396
  return t;
@@ -5400,7 +5414,7 @@ function ho(n) {
5400
5414
  }), l;
5401
5415
  }));
5402
5416
  }
5403
- function fo(n, e, t) {
5417
+ function ho(n, e, t) {
5404
5418
  var o;
5405
5419
  const r = {
5406
5420
  meta: {},
@@ -5408,7 +5422,7 @@ function fo(n, e, t) {
5408
5422
  codeToHast: (i, l) => Pe(n, i, l),
5409
5423
  codeToTokens: (i, l) => Ae(n, i, l)
5410
5424
  };
5411
- let s = Os(Pe(n, e, t, r));
5425
+ let s = Ls(Pe(n, e, t, r));
5412
5426
  for (const i of ke(t))
5413
5427
  s = ((o = i.postprocess) == null ? void 0 : o.call(r, s, t)) || s;
5414
5428
  return s;
@@ -5477,17 +5491,17 @@ function st(n) {
5477
5491
  }
5478
5492
  async function hn(n) {
5479
5493
  return Array.from(new Set((await Promise.all(
5480
- n.filter((e) => !Ds(e)).map(async (e) => await on(e).then((t) => Array.isArray(t) ? t : [t]))
5494
+ n.filter((e) => !Gs(e)).map(async (e) => await on(e).then((t) => Array.isArray(t) ? t : [t]))
5481
5495
  )).flat()));
5482
5496
  }
5483
5497
  async function fn(n) {
5484
5498
  return (await Promise.all(
5485
5499
  n.map(
5486
- async (t) => Us(t) ? null : st(await on(t))
5500
+ async (t) => Ds(t) ? null : st(await on(t))
5487
5501
  )
5488
5502
  )).filter((t) => !!t);
5489
5503
  }
5490
- class po extends br {
5504
+ class fo extends br {
5491
5505
  constructor(t, r, s, o = {}) {
5492
5506
  super(t);
5493
5507
  p(this, "_resolvedThemes", /* @__PURE__ */ new Map());
@@ -5582,7 +5596,7 @@ class po extends br {
5582
5596
  this._langGraph.set(r, this._langMap.get(r));
5583
5597
  }
5584
5598
  }
5585
- class go {
5599
+ class po {
5586
5600
  constructor(e, t) {
5587
5601
  p(this, "_langs", /* @__PURE__ */ new Map());
5588
5602
  p(this, "_scopeToLang", /* @__PURE__ */ new Map());
@@ -5620,12 +5634,12 @@ class go {
5620
5634
  }
5621
5635
  }
5622
5636
  let te = 0;
5623
- function mo(n) {
5637
+ function go(n) {
5624
5638
  te += 1, n.warnings !== !1 && te >= 10 && te % 10 === 0 && console.warn(`[Shiki] ${te} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);
5625
5639
  let e = !1;
5626
5640
  if (!n.engine)
5627
5641
  throw new I("`engine` option is required for synchronous mode");
5628
- const t = (n.langs || []).flat(1), r = (n.themes || []).flat(1).map(st), s = new go(n.engine, t), o = new po(s, r, t, n.langAlias);
5642
+ const t = (n.langs || []).flat(1), r = (n.themes || []).flat(1).map(st), s = new po(n.engine, t), o = new fo(s, r, t, n.langAlias);
5629
5643
  let i;
5630
5644
  function l(b) {
5631
5645
  _();
@@ -5694,7 +5708,7 @@ function mo(n) {
5694
5708
  [Symbol.dispose]: y
5695
5709
  };
5696
5710
  }
5697
- async function yo(n = {}) {
5711
+ async function mo(n = {}) {
5698
5712
  n.loadWasm;
5699
5713
  const [
5700
5714
  e,
@@ -5705,22 +5719,22 @@ async function yo(n = {}) {
5705
5719
  hn(n.langs || []),
5706
5720
  n.engine || Ln(n.loadWasm || In())
5707
5721
  ]);
5708
- return mo({
5722
+ return go({
5709
5723
  ...n,
5710
5724
  themes: e,
5711
5725
  langs: t,
5712
5726
  engine: r
5713
5727
  });
5714
5728
  }
5715
- async function wo(n = {}) {
5716
- const e = await yo(n);
5729
+ async function Co(n = {}) {
5730
+ const e = await mo(n);
5717
5731
  return {
5718
- getLastGrammarState: (...t) => to(e, ...t),
5732
+ getLastGrammarState: (...t) => eo(e, ...t),
5719
5733
  codeToTokensBase: (t, r) => rt(e, t, r),
5720
5734
  codeToTokensWithThemes: (t, r) => un(e, t, r),
5721
5735
  codeToTokens: (t, r) => Ae(e, t, r),
5722
5736
  codeToHast: (t, r) => Pe(e, t, r),
5723
- codeToHtml: (t, r) => fo(e, t, r),
5737
+ codeToHtml: (t, r) => ho(e, t, r),
5724
5738
  ...e,
5725
5739
  getInternalContext: () => e
5726
5740
  };
@@ -5732,30 +5746,30 @@ export {
5732
5746
  sn as addClassToHast,
5733
5747
  z as applyColorReplacements,
5734
5748
  Pe as codeToHast,
5735
- fo as codeToHtml,
5749
+ ho as codeToHtml,
5736
5750
  Ae as codeToTokens,
5737
5751
  rt as codeToTokensBase,
5738
5752
  un as codeToTokensWithThemes,
5739
- wo as createHighlighterCore,
5740
- Ws as createPositionConverter,
5741
- yo as createShikiInternal,
5742
- mo as createShikiInternalSync,
5753
+ Co as createHighlighterCore,
5754
+ Fs as createPositionConverter,
5755
+ mo as createShikiInternal,
5756
+ go as createShikiInternalSync,
5743
5757
  an as getTokenStyleObject,
5744
- Os as hastToHtml,
5758
+ Ls as hastToHtml,
5745
5759
  nt as isNoneTheme,
5746
5760
  tt as isPlainLang,
5747
- Ds as isSpecialLang,
5748
- Us as isSpecialTheme,
5761
+ Gs as isSpecialLang,
5762
+ Ds as isSpecialTheme,
5749
5763
  on as normalizeGetter,
5750
5764
  st as normalizeTheme,
5751
5765
  ve as resolveColorReplacements,
5752
5766
  Te as splitLines,
5753
- js as splitToken,
5754
- $s as splitTokens,
5755
- Fs as stringifyTokenStyle,
5756
- Gs as toArray,
5757
- Zs as tokenizeAnsiWithTheme,
5758
- no as tokenizeWithTheme,
5759
- co as tokensToHast,
5760
- Hs as transformerDecorations
5767
+ Us as splitToken,
5768
+ js as splitTokens,
5769
+ $s as stringifyTokenStyle,
5770
+ Bs as toArray,
5771
+ Qs as tokenizeAnsiWithTheme,
5772
+ to as tokenizeWithTheme,
5773
+ lo as tokensToHast,
5774
+ zs as transformerDecorations
5761
5775
  };