securemark 0.270.2 → 0.272.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.272.0
4
+
5
+ - Change footnote identifiers.
6
+
7
+ ## 0.271.0
8
+
9
+ - Extend table highlight syntax.
10
+
3
11
  ## 0.270.2
4
12
 
5
13
  - Refactoring.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.270.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.272.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("Prism"), require("DOMPurify"));
@@ -1373,17 +1373,18 @@ exports.suppressAsyncException = suppressAsyncException;
1373
1373
  /***/ }),
1374
1374
 
1375
1375
  /***/ 4128:
1376
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1376
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1377
1377
 
1378
1378
  "use strict";
1379
1379
 
1380
1380
 
1381
+ Object.defineProperty(exports, "__esModule", ({
1382
+ value: true
1383
+ }));
1381
1384
  __webpack_require__(6921);
1382
- const global = false || typeof globalThis !== 'undefined' && globalThis
1383
- // @ts-ignore
1384
- || typeof self !== 'undefined' && self || Function('return this')();
1385
+ const global = globalThis;
1385
1386
  global.global = global;
1386
- module.exports = global;
1387
+ exports["default"] = global;
1387
1388
 
1388
1389
  /***/ }),
1389
1390
 
@@ -1394,9 +1395,7 @@ module.exports = global;
1394
1395
 
1395
1396
 
1396
1397
  // @ts-ignore
1397
- var globalThis;
1398
- // @ts-ignore
1399
- var global = (/* unused pure expression or super */ null && (globalThis));
1398
+ var global = globalThis;
1400
1399
 
1401
1400
  /***/ }),
1402
1401
 
@@ -1487,9 +1486,9 @@ class Heap {
1487
1486
  this.$length = 0;
1488
1487
  }
1489
1488
  }
1490
- exports.Heap = Heap;
1491
1489
  Heap.max = (a, b) => a > b ? -1 : a < b ? 1 : 0;
1492
1490
  Heap.min = (a, b) => a > b ? 1 : a < b ? -1 : 0;
1491
+ exports.Heap = Heap;
1493
1492
  function sort(cmp, array, index, length, stable) {
1494
1493
  if (length === 0) return false;
1495
1494
  switch (index) {
@@ -1631,9 +1630,9 @@ class MultiHeap {
1631
1630
  this.$length = 0;
1632
1631
  }
1633
1632
  }
1634
- exports.MultiHeap = MultiHeap;
1635
1633
  MultiHeap.max = Heap.max;
1636
1634
  MultiHeap.min = Heap.min;
1635
+ exports.MultiHeap = MultiHeap;
1637
1636
 
1638
1637
  /***/ }),
1639
1638
 
@@ -1993,10 +1992,10 @@ class PriorityQueue {
1993
1992
  return;
1994
1993
  }
1995
1994
  }
1996
- exports.PriorityQueue = PriorityQueue;
1997
1995
  PriorityQueue.priority = Symbol('priority');
1998
1996
  PriorityQueue.max = heap_1.Heap.max;
1999
1997
  PriorityQueue.min = heap_1.Heap.min;
1998
+ exports.PriorityQueue = PriorityQueue;
2000
1999
  class MultiQueue {
2001
2000
  constructor(entries) {
2002
2001
  this.dict = new Map();
@@ -2570,7 +2569,6 @@ class ReadonlyURL {
2570
2569
  return this.href;
2571
2570
  }
2572
2571
  }
2573
- exports.ReadonlyURL = ReadonlyURL;
2574
2572
  // Can't freeze URL object in the Firefox extension environment.
2575
2573
  // ref: https://github.com/falsandtru/pjax-api/issues/44#issuecomment-633915035
2576
2574
  // Bug: Error in dependents.
@@ -2578,6 +2576,7 @@ exports.ReadonlyURL = ReadonlyURL;
2578
2576
  ReadonlyURL.get = (0, memoize_1.memoize)((url, base) => ({
2579
2577
  url: new __webpack_require__.g.URL(url, base)
2580
2578
  }), (url, base = '') => `${base.indexOf('\n') > -1 ? base.replace(/\n+/g, '') : base}\n${url}`, new cache_1.Cache(10000));
2579
+ exports.ReadonlyURL = ReadonlyURL;
2581
2580
 
2582
2581
  /***/ }),
2583
2582
 
@@ -3540,7 +3539,6 @@ class Delimiters {
3540
3539
  return false;
3541
3540
  }
3542
3541
  }
3543
- exports.Delimiters = Delimiters;
3544
3542
  _a = Delimiters;
3545
3543
  Delimiters.matcher = (0, memoize_1.memoize)(pattern => {
3546
3544
  switch (typeof pattern) {
@@ -3552,6 +3550,7 @@ Delimiters.matcher = (0, memoize_1.memoize)(pattern => {
3552
3550
  return (0, memoize_1.reduce)(source => pattern.test(source) || undefined);
3553
3551
  }
3554
3552
  }, _a.signature);
3553
+ exports.Delimiters = Delimiters;
3555
3554
 
3556
3555
  /***/ }),
3557
3556
 
@@ -4539,7 +4538,7 @@ exports.aside = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
4539
4538
  'data-invalid-message': 'Missing the title at the first line'
4540
4539
  }, `${opener}${body}${closer}`)];
4541
4540
  return [(0, dom_1.html)('aside', {
4542
- id: (0, indexee_1.identity)(context.id, (0, indexee_1.text)(heading)),
4541
+ id: (0, indexee_1.identity)(context.id, (0, indexee_1.index)(heading)),
4543
4542
  class: 'aside'
4544
4543
  }, [document, (0, dom_1.html)('h2', 'References'), references])];
4545
4544
  })));
@@ -4949,28 +4948,36 @@ const parser = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinat
4949
4948
  const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.union)([align])), (0, combinator_1.some)((0, combinator_1.union)([head, data, (0, combinator_1.some)(dataline, alignment), source_1.emptyline]))]), ns => !(0, alias_1.isArray)(ns[0]) ? (0, array_1.unshift)([[[]]], ns) : ns)));
4950
4949
  const alignment = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/;
4951
4950
  const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([s]) => s.split('/').map(s => s.split(''))));
4952
- const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/;
4953
- const head = (0, combinator_1.creation)(1, false, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.trim)((0, visibility_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('th', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false));
4954
- const data = (0, combinator_1.creation)(1, false, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.trim)((0, visibility_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('td', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false));
4951
+ const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/;
4952
+ const head = (0, combinator_1.creation)(1, false, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.trim)((0, visibility_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('th', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false));
4953
+ const data = (0, combinator_1.creation)(1, false, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.trim)((0, visibility_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('td', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false));
4955
4954
  const dataline = (0, combinator_1.creation)(1, false, (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/^!+\s/, (0, combinator_1.convert)(source => `:${source}`, data)), (0, combinator_1.convert)(source => `: ${source}`, data)]))));
4956
4955
  function attributes(source) {
4957
- let [, rowspan = undefined, colspan = undefined, highlight = undefined] = source.match(/^.(?:(\d+)?:(\d+)?)?(!+)?$/) ?? [];
4956
+ let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
4958
4957
  rowspan === '1' ? rowspan = undefined : undefined;
4959
4958
  colspan === '1' ? colspan = undefined : undefined;
4960
4959
  rowspan &&= `${(0, alias_1.max)(0, (0, alias_1.min)(+rowspan, 65534))}`;
4961
4960
  colspan &&= `${(0, alias_1.max)(0, (0, alias_1.min)(+colspan, 1000))}`;
4962
- highlight &&= highlight.length > 0 ? `${highlight.length}` : undefined;
4963
- const valid = !highlight || source[0] === '#' && +highlight <= 1 || source[0] === ':' && +highlight <= 6;
4961
+ extension ||= undefined;
4962
+ const level = highlight?.length ?? 0;
4963
+ const validH = !highlight || source[0] === '#' && level <= 6 || source[0] === ':' && level <= 6;
4964
+ const validE = source[0] === '#' || extension !== '+';
4965
+ const valid = validH && validE;
4964
4966
  return {
4965
4967
  class: valid ? highlight && 'highlight' : 'invalid',
4966
4968
  rowspan,
4967
4969
  colspan,
4968
- ...(valid ? {
4969
- 'data-highlight-level': +highlight > 1 ? highlight : undefined
4970
- } : {
4970
+ ...(!validH && {
4971
4971
  'data-invalid-syntax': 'table',
4972
4972
  'data-invalid-type': 'syntax',
4973
4973
  'data-invalid-message': 'Too much highlight level'
4974
+ } || !validE && {
4975
+ 'data-invalid-syntax': 'table',
4976
+ 'data-invalid-type': 'syntax',
4977
+ 'data-invalid-message': 'Extensible cells are only head cells'
4978
+ } || {
4979
+ 'data-highlight-level': level > 1 ? `${level}` : undefined,
4980
+ 'data-highlight-extension': extension
4974
4981
  })
4975
4982
  };
4976
4983
  }
@@ -4982,7 +4989,8 @@ function format(rows) {
4982
4989
  const valigns = [];
4983
4990
  let target = thead;
4984
4991
  let ranges = {};
4985
- let verticalHighlights = 0n;
4992
+ let verticalHighlightExtensions = 0n;
4993
+ let verticalHighlightLevels = [];
4986
4994
  ROW: for (let i = 0; i < rows.length; ++i) {
4987
4995
  // Copy to make them retryable.
4988
4996
  const [[[...as], [...vs] = []], ...cells] = rows[i];
@@ -5040,22 +5048,26 @@ function format(rows) {
5040
5048
  const row = (0, dom_1.html)('tr');
5041
5049
  let heads = 0n;
5042
5050
  let highlights = 0n;
5051
+ let highlightExtensions = 0n;
5052
+ let highlightLevels = [];
5043
5053
  let hasDataCell = false;
5044
- let lHeadCellIdx;
5045
- let rHeadCellIdx;
5054
+ let lHeadCellIndex;
5055
+ let rHeadCellIndex;
5046
5056
  for (let j = 0; j < cells.length; ++j) {
5047
5057
  const jn = BigInt(j);
5048
5058
  const isVirtual = !!ranges[i]?.[j];
5049
5059
  const cell = isVirtual ? (0, array_1.splice)(cells, j, 0, undefined) && ranges[i][j] : cells[j];
5050
5060
  const isHeadCell = cell.tagName === 'TH';
5051
- heads |= BigInt(isHeadCell) << jn;
5052
- highlights |= BigInt(cell.className === 'highlight') << jn;
5061
+ heads |= isHeadCell ? 1n << jn : 0n;
5062
+ highlights |= cell.className === 'highlight' ? 1n << jn : 0n;
5063
+ highlightExtensions |= cell.getAttribute('data-highlight-extension') ? 1n << jn : 0n;
5064
+ highlightLevels[j] = cell.getAttribute('data-highlight-level') ?? '1';
5053
5065
  hasDataCell ||= !isHeadCell;
5054
5066
  if (isHeadCell && !hasDataCell) {
5055
- lHeadCellIdx = jn;
5067
+ lHeadCellIndex = jn;
5056
5068
  }
5057
5069
  if (isHeadCell && hasDataCell) {
5058
- rHeadCellIdx ??= jn;
5070
+ rHeadCellIndex ??= jn;
5059
5071
  }
5060
5072
  const rowSpan = cell.rowSpan;
5061
5073
  if (rowSpan > 1 && !isVirtual) {
@@ -5070,6 +5082,8 @@ function format(rows) {
5070
5082
  (0, array_1.splice)(cells, j + 1, 0, ...Array(colSpan - 1));
5071
5083
  heads |= heads & 1n << jn && ~(~0n << BigInt(colSpan)) << jn;
5072
5084
  highlights |= highlights & 1n << jn && ~(~0n << BigInt(colSpan)) << jn;
5085
+ highlightExtensions |= highlightExtensions & 1n << jn && ~(~0n << BigInt(colSpan)) << jn;
5086
+ (0, array_1.splice)(highlightLevels, j + 1, 0, ...Array(colSpan - 1));
5073
5087
  j += colSpan - 1;
5074
5088
  }
5075
5089
  if (target === thead) {
@@ -5104,21 +5118,36 @@ function format(rows) {
5104
5118
  target.appendChild(row);
5105
5119
  switch (target) {
5106
5120
  case thead:
5107
- verticalHighlights = heads & highlights;
5121
+ verticalHighlightExtensions = highlightExtensions;
5122
+ verticalHighlightLevels = highlightLevels;
5108
5123
  continue;
5109
5124
  case tbody:
5110
- lHeadCellIdx ??= -1n;
5111
- rHeadCellIdx ??= -1n;
5112
- const tHighlights = verticalHighlights;
5113
- const horizontalHighlights = heads & highlights;
5114
- const lHighlight = ~lHeadCellIdx && horizontalHighlights & 1n << lHeadCellIdx;
5115
- const rHighlight = ~rHeadCellIdx && horizontalHighlights & 1n << rHeadCellIdx;
5125
+ lHeadCellIndex ??= -1n;
5126
+ rHeadCellIndex ??= -1n;
5127
+ const tHighlights = verticalHighlightExtensions;
5128
+ const horizontalHighlights = highlightExtensions;
5129
+ const horizontalHighlightLevels = highlightLevels;
5130
+ const lHighlight = ~lHeadCellIndex && horizontalHighlights & 1n << lHeadCellIndex;
5131
+ const rHighlight = ~rHeadCellIndex && horizontalHighlights & 1n << rHeadCellIndex;
5116
5132
  for (let i = 0, m = 1n; i < cells.length; ++i, m <<= 1n) {
5117
5133
  const cell = cells[i];
5118
5134
  if (!cell) continue;
5119
5135
  if (heads & m) continue;
5120
- if (!(lHighlight || rHighlight || tHighlights & m || highlights & m)) continue;
5121
- cell.classList.add('highlight');
5136
+ switch (m) {
5137
+ case highlights & m:
5138
+ (lHighlight || rHighlight) && cell.setAttribute('data-highlight-level', horizontalHighlightLevels[i]);
5139
+ break;
5140
+ case lHighlight && m:
5141
+ case rHighlight && m:
5142
+ cell.classList.add('highlight');
5143
+ break;
5144
+ case tHighlights & m:
5145
+ cell.classList.add('highlight');
5146
+ +verticalHighlightLevels[i] > 1 && cell.setAttribute('data-highlight-level', verticalHighlightLevels[i]);
5147
+ break;
5148
+ default:
5149
+ continue;
5150
+ }
5122
5151
  }
5123
5152
  continue;
5124
5153
  case tfoot:
@@ -5707,7 +5736,7 @@ const shortmedia_1 = __webpack_require__(4189);
5707
5736
  const autolink_1 = __webpack_require__(6051);
5708
5737
  const bracket_1 = __webpack_require__(5196);
5709
5738
  const source_1 = __webpack_require__(6743);
5710
- exports.inline = (0, combinator_1.union)([annotation_1.annotation, reference_1.reference, template_1.template, comment_1.comment, math_1.math, extension_1.extension, ruby_1.ruby, link_1.textlink, link_1.linemedialink, media_1.linemedia, html_1.html, insertion_1.insertion, deletion_1.deletion, mark_1.mark, strong_1.strong, emphasis_1.emphasis, code_1.code, htmlentity_1.htmlentity, shortmedia_1.lineshortmedia, autolink_1.autolink, bracket_1.bracket, source_1.text]);
5739
+ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([annotation_1.annotation, reference_1.reference, template_1.template, comment_1.comment, math_1.math, extension_1.extension, ruby_1.ruby, link_1.textlink, link_1.linemedialink, media_1.linemedia, html_1.html, insertion_1.insertion, deletion_1.deletion, mark_1.mark, strong_1.strong, emphasis_1.emphasis, code_1.code, htmlentity_1.htmlentity, shortmedia_1.lineshortmedia, autolink_1.autolink, bracket_1.bracket, source_1.text]));
5711
5740
  var indexee_1 = __webpack_require__(1269);
5712
5741
  Object.defineProperty(exports, "indexee", ({
5713
5742
  enumerable: true,
@@ -5779,7 +5808,7 @@ const hashnum_1 = __webpack_require__(5631);
5779
5808
  const anchor_1 = __webpack_require__(6495);
5780
5809
  const source_1 = __webpack_require__(6743);
5781
5810
  const util_1 = __webpack_require__(9437);
5782
- exports.autolink = (0, combinator_1.validate)(/^(?:[@#>0-9a-z\r\n]|\S[#>])/i, (0, combinator_1.constraint)(2 /* State.autolink */, false, (0, combinator_1.syntax)(2 /* Syntax.autolink */, 1, 1, ~1 /* State.shortcut */, (0, combinator_1.union)([(0, combinator_1.some)((0, combinator_1.union)([url_1.lineurl])), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email,
5811
+ exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^(?:[@#>0-9a-z\r\n]|\S[#>])/i, (0, combinator_1.constraint)(2 /* State.autolink */, false, (0, combinator_1.syntax)(2 /* Syntax.autolink */, 1, 1, ~1 /* State.shortcut */, (0, combinator_1.union)([(0, combinator_1.some)((0, combinator_1.union)([url_1.lineurl])), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email,
5783
5812
  // Escape unmatched email-like strings.
5784
5813
  (0, combinator_1.focus)(/^[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z])*(?:@(?:[0-9a-z]+(?:[.-][0-9a-z]+)*)?)*/i, ({
5785
5814
  source
@@ -5796,7 +5825,7 @@ exports.autolink = (0, combinator_1.validate)(/^(?:[@#>0-9a-z\r\n]|\S[#>])/i, (0
5796
5825
  // Escape unmatched hashtag-like strings.
5797
5826
  (0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji|')*/u.source.replace('emoji', hashtag_1.emoji), 'u')),
5798
5827
  // Escape invalid leading characters.
5799
- (0, source_1.str)(/^[0-9\p{Sc}](?=>)/u), anchor_1.anchor])), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)])]))));
5828
+ (0, source_1.str)(/^[0-9\p{Sc}](?=>)/u), anchor_1.anchor])), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)])])))));
5800
5829
 
5801
5830
  /***/ }),
5802
5831
 
@@ -5958,7 +5987,7 @@ const link_1 = __webpack_require__(9628);
5958
5987
  const source_1 = __webpack_require__(6743);
5959
5988
  const closer = /^[-+*=~^_,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
5960
5989
  exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.unsafelink])))));
5961
- exports.lineurl = (0, combinator_1.open)(source_1.linebreak, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.focus)(/^https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink))]));
5990
+ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.open)(source_1.linebreak, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.focus)(/^https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink))])));
5962
5991
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.precedence)(2, (0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.unescsource, '"')), '"', true)]))));
5963
5992
 
5964
5993
  /***/ }),
@@ -6132,14 +6161,15 @@ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, comb
6132
6161
  Object.defineProperty(exports, "__esModule", ({
6133
6162
  value: true
6134
6163
  }));
6135
- exports.text = exports.identity = exports.indexee = void 0;
6164
+ exports.text = exports.index = exports.identity = exports.indexee = void 0;
6136
6165
  const combinator_1 = __webpack_require__(2087);
6166
+ const memoize_1 = __webpack_require__(1808);
6137
6167
  const dom_1 = __webpack_require__(3252);
6138
6168
  function indexee(parser, optional) {
6139
6169
  return (0, combinator_1.fmap)(parser, ([el], _, {
6140
6170
  id
6141
6171
  }) => [(0, dom_1.define)(el, {
6142
- id: identity(id, text(el, optional))
6172
+ id: identity(id, index(el, optional))
6143
6173
  })]);
6144
6174
  }
6145
6175
  exports.indexee = indexee;
@@ -6153,17 +6183,20 @@ function identity(id, text, name = 'index') {
6153
6183
  case 'index':
6154
6184
  return `${name}:${id ?? ''}:${cs.slice(0, 97).join('')}...`;
6155
6185
  case 'mark':
6156
- case 'note':
6157
6186
  return `${name}:${id ?? ''}:${cs.slice(0, 50).join('')}...${cs.slice(-47).join('')}`;
6158
6187
  }
6159
6188
  }
6160
6189
  exports.identity = identity;
6161
- function text(source, optional = false) {
6190
+ function index(source, optional = false) {
6162
6191
  if (!source.firstChild) return '';
6163
6192
  const indexer = source.querySelector(':scope > .indexer');
6164
6193
  const index = indexer?.getAttribute('data-index');
6165
6194
  if (index) return index;
6166
6195
  if (index === '' && optional) return '';
6196
+ return (0, exports.text)(source);
6197
+ }
6198
+ exports.index = index;
6199
+ exports.text = (0, memoize_1.reduce)(source => {
6167
6200
  const target = source.cloneNode(true);
6168
6201
  for (let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, br, .annotation, .reference, .checkbox, ul, ol'), len = es.length, i = 0; i < len; ++i) {
6169
6202
  const el = es[i];
@@ -6194,8 +6227,7 @@ function text(source, optional = false) {
6194
6227
  // Better:
6195
6228
  //return target.innerText;
6196
6229
  return target.textContent;
6197
- }
6198
- exports.text = text;
6230
+ });
6199
6231
 
6200
6232
  /***/ }),
6201
6233
 
@@ -6654,7 +6686,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
6654
6686
  }))))));
6655
6687
  exports.linemedia = (0, combinator_1.surround)(source_1.linebreak, (0, combinator_1.union)([exports.media]), /^(?=[^\S\n]*(?:$|\n))/);
6656
6688
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true)])));
6657
- const option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]);
6689
+ const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]));
6658
6690
  function sanitize(target, uri, alt) {
6659
6691
  switch (uri.protocol) {
6660
6692
  case 'http:':
@@ -7065,8 +7097,8 @@ function* footnote(target, footnotes, opts = {}, bottom = null) {
7065
7097
  const el = es[i];
7066
7098
  el.parentNode === target && el.remove();
7067
7099
  }
7068
- yield* (0, exports.reference)(target, footnotes?.references, opts, bottom);
7069
7100
  yield* (0, exports.annotation)(target, footnotes?.annotations, opts, bottom);
7101
+ yield* (0, exports.reference)(target, footnotes?.references, opts, bottom);
7070
7102
  return;
7071
7103
  }
7072
7104
  exports.footnote = footnote;
@@ -7085,25 +7117,16 @@ function build(syntax, marker, splitter = '_') {
7085
7117
  }
7086
7118
  const refs = target.querySelectorAll(`sup.${syntax}:not(.disabled)`);
7087
7119
  const titles = new Map();
7088
- const contents = new Map();
7089
- for (let len = refs.length, i = 0; i < len; ++i) {
7090
- if (i % 10 === 9) yield;
7091
- const ref = refs[i];
7092
- const identifier = ref.getAttribute('data-abbr') || ` ${ref.firstElementChild.innerHTML}`;
7093
- if (titles.has(identifier)) continue;
7094
- const content = (0, dom_1.html)('span', {
7095
- id: (0, indexee_1.identity)(opts.id, (0, indexee_1.text)(ref.firstElementChild), 'note')
7096
- }, ref.firstElementChild.cloneNode(true).childNodes);
7097
- const title = (0, indexee_1.text)(content).trim();
7098
- if (!title) continue;
7099
- titles.set(identifier, title);
7100
- contents.set(identifier, content);
7101
- }
7120
+ const indexes = new Map();
7102
7121
  let count = 0;
7103
7122
  let total = 0;
7104
7123
  let style;
7105
7124
  for (let len = refs.length, i = 0; i < len; ++i) {
7106
7125
  const ref = refs[i];
7126
+ if (ref.closest('[hidden]')) {
7127
+ yield;
7128
+ continue;
7129
+ }
7107
7130
  while (splitters.length > 0 && splitters[0].compareDocumentPosition(ref) & Node.DOCUMENT_POSITION_FOLLOWING) {
7108
7131
  if (defs.size > 0) {
7109
7132
  total += defs.size;
@@ -7115,8 +7138,9 @@ function build(syntax, marker, splitter = '_') {
7115
7138
  }
7116
7139
  splitters.shift();
7117
7140
  }
7118
- const identifier = ref.getAttribute('data-abbr') || ` ${ref.firstElementChild.innerHTML}`;
7119
7141
  const abbr = ref.getAttribute('data-abbr') || undefined;
7142
+ const identifier = abbr || (0, indexee_1.identity)(undefined, (0, indexee_1.text)(ref.firstElementChild), 'mark')?.slice(6) || '';
7143
+ const title = false || titles.get(identifier) || titles.set(identifier, (0, indexee_1.text)(ref.firstElementChild)).get(identifier) || null;
7120
7144
  style ??= abbr ? 'abbr' : 'count';
7121
7145
  if (style === 'count' ? abbr : !abbr) {
7122
7146
  (0, dom_1.define)(ref, {
@@ -7138,21 +7162,21 @@ function build(syntax, marker, splitter = '_') {
7138
7162
  } else {
7139
7163
  ref.lastChild?.remove();
7140
7164
  }
7141
- const title = titles.get(identifier);
7142
7165
  const refIndex = ++count;
7143
7166
  const refId = opts.id !== '' ? `${syntax}:${opts.id ?? ''}:ref:${refIndex}` : undefined;
7144
7167
  const def = false || defs.get(identifier) || defs.set(identifier, (0, dom_1.html)('li', {
7145
- id: opts.id !== '' ? `${syntax}:${opts.id ?? ''}:def:${total + defs.size + 1}` : undefined,
7168
+ id: opts.id !== '' ? `${syntax}:${opts.id ?? ''}:def:${identifier}` : undefined,
7146
7169
  'data-marker': !footnote ? marker(total + defs.size + 1, abbr) : undefined
7147
- }, [contents.get(identifier) ?? (0, dom_1.frag)(), (0, dom_1.html)('sup')])).get(identifier);
7148
- const defIndex = +def.id.slice(def.id.lastIndexOf(':') + 1) || total + defs.size;
7170
+ }, [(0, dom_1.define)(ref.firstElementChild.cloneNode(true), {
7171
+ hidden: null
7172
+ }), (0, dom_1.html)('sup')])).get(identifier);
7173
+ const defIndex = false || indexes.get(def) || indexes.set(def, total + defs.size).get(def);
7149
7174
  const defId = def.id || undefined;
7150
7175
  (0, dom_1.define)(ref, {
7151
7176
  id: refId,
7152
- class: opts.id !== '' ? undefined : `${ref.className} disabled`,
7153
- ...(title ? {
7154
- title
7155
- } : {
7177
+ class: opts.id !== '' ? undefined : void ref.classList.add('disabled'),
7178
+ title,
7179
+ ...(!title && {
7156
7180
  class: void ref.classList.add('invalid'),
7157
7181
  'data-invalid-syntax': syntax,
7158
7182
  'data-invalid-type': 'content',
@@ -8404,7 +8428,7 @@ function unlink(h) {
8404
8428
  /***/ 3252:
8405
8429
  /***/ (function(module) {
8406
8430
 
8407
- /*! typed-dom v0.0.317 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8431
+ /*! typed-dom v0.0.330 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8408
8432
  (function webpackUniversalModuleDefinition(root, factory) {
8409
8433
  if(true)
8410
8434
  module.exports = factory();
@@ -8414,7 +8438,7 @@ return /******/ (() => { // webpackBootstrap
8414
8438
  /******/ "use strict";
8415
8439
  /******/ var __webpack_modules__ = ({
8416
8440
 
8417
- /***/ 406:
8441
+ /***/ 5406:
8418
8442
  /***/ ((__unused_webpack_module, exports) => {
8419
8443
 
8420
8444
 
@@ -8437,7 +8461,7 @@ exports.ObjectSetPrototypeOf = Object.setPrototypeOf;
8437
8461
 
8438
8462
  /***/ }),
8439
8463
 
8440
- /***/ 529:
8464
+ /***/ 5529:
8441
8465
  /***/ ((__unused_webpack_module, exports) => {
8442
8466
 
8443
8467
 
@@ -8453,8 +8477,8 @@ exports.equal = equal;
8453
8477
 
8454
8478
  /***/ }),
8455
8479
 
8456
- /***/ 808:
8457
- /***/ ((__unused_webpack_module, exports, __nested_webpack_require_3147__) => {
8480
+ /***/ 1808:
8481
+ /***/ ((__unused_webpack_module, exports, __nested_webpack_require_3150__) => {
8458
8482
 
8459
8483
 
8460
8484
 
@@ -8462,8 +8486,8 @@ Object.defineProperty(exports, "__esModule", ({
8462
8486
  value: true
8463
8487
  }));
8464
8488
  exports.reduce = exports.memoize = void 0;
8465
- const alias_1 = __nested_webpack_require_3147__(406);
8466
- const compare_1 = __nested_webpack_require_3147__(529);
8489
+ const alias_1 = __nested_webpack_require_3150__(5406);
8490
+ const compare_1 = __nested_webpack_require_3150__(5529);
8467
8491
  function memoize(f, identify = (...as) => as[0], memory) {
8468
8492
  if (typeof identify === 'object') return memoize(f, undefined, identify);
8469
8493
  return (0, alias_1.isArray)(memory) || memory?.constructor === Object ? memoizeRecord(f, identify, memory) : memoizeDict(f, identify, memory ?? new Map());
@@ -8509,8 +8533,8 @@ exports.reduce = reduce;
8509
8533
 
8510
8534
  /***/ }),
8511
8535
 
8512
- /***/ 521:
8513
- /***/ ((__unused_webpack_module, exports, __nested_webpack_require_4662__) => {
8536
+ /***/ 7521:
8537
+ /***/ ((__unused_webpack_module, exports, __nested_webpack_require_4668__) => {
8514
8538
 
8515
8539
 
8516
8540
 
@@ -8518,8 +8542,8 @@ Object.defineProperty(exports, "__esModule", ({
8518
8542
  value: true
8519
8543
  }));
8520
8544
  exports.defrag = exports.prepend = exports.append = exports.isChildren = exports.define = exports.element = exports.text = exports.svg = exports.html = exports.frag = exports.shadow = void 0;
8521
- const alias_1 = __nested_webpack_require_4662__(406);
8522
- const memoize_1 = __nested_webpack_require_4662__(808);
8545
+ const alias_1 = __nested_webpack_require_4668__(5406);
8546
+ const memoize_1 = __nested_webpack_require_4668__(1808);
8523
8547
  var caches;
8524
8548
  (function (caches) {
8525
8549
  caches.shadows = new WeakMap();
@@ -8548,20 +8572,22 @@ function text(source) {
8548
8572
  exports.text = text;
8549
8573
  function element(context, ns) {
8550
8574
  return (tag, attrs, children) => {
8551
- const el = elem(context, ns, tag);
8552
- return !attrs || isChildren(attrs) ? defineChildren(el, attrs ?? children) : defineChildren(defineAttrs(el, attrs), children);
8575
+ return !attrs || isChildren(attrs) ? defineChildren(elem(context, ns, tag, {}), attrs ?? children) : defineChildren(defineAttrs(elem(context, ns, tag, attrs), attrs), children);
8553
8576
  };
8554
8577
  }
8555
8578
  exports.element = element;
8556
- function elem(context, ns, tag) {
8579
+ function elem(context, ns, tag, attrs) {
8557
8580
  if (!('createElement' in context)) throw new Error(`TypedDOM: Scoped custom elements are not supported on this browser.`);
8581
+ const opts = 'is' in attrs ? {
8582
+ is: attrs['is']
8583
+ } : undefined;
8558
8584
  switch (ns) {
8559
8585
  case "HTML" /* NS.HTML */:
8560
- return context.createElement(tag);
8586
+ return context.createElement(tag, opts);
8561
8587
  case "SVG" /* NS.SVG */:
8562
- return context.createElementNS('http://www.w3.org/2000/svg', tag);
8588
+ return context.createElementNS('http://www.w3.org/2000/svg', tag, opts);
8563
8589
  case "MathML" /* NS.MathML */:
8564
- return context.createElementNS('http://www.w3.org/1998/Math/MathML', tag);
8590
+ return context.createElementNS('http://www.w3.org/1998/Math/MathML', tag, opts);
8565
8591
  }
8566
8592
  }
8567
8593
  function define(node, attrs, children) {
@@ -8576,8 +8602,11 @@ function define(node, attrs, children) {
8576
8602
  }
8577
8603
  exports.define = define;
8578
8604
  function defineAttrs(el, attrs) {
8579
- for (const name in attrs) {
8580
- if (!(0, alias_1.hasOwnProperty)(attrs, name)) continue;
8605
+ for (const name of Object.keys(attrs)) {
8606
+ switch (name) {
8607
+ case 'is':
8608
+ continue;
8609
+ }
8581
8610
  const value = attrs[name];
8582
8611
  switch (typeof value) {
8583
8612
  case 'string':
@@ -8645,7 +8674,7 @@ function defineChildren(node, children) {
8645
8674
  return node;
8646
8675
  }
8647
8676
  function isChildren(value) {
8648
- return !!value?.[Symbol.iterator];
8677
+ return value?.[Symbol.iterator] !== undefined;
8649
8678
  }
8650
8679
  exports.isChildren = isChildren;
8651
8680
  function append(node, children) {
@@ -8698,7 +8727,7 @@ exports.defrag = defrag;
8698
8727
  /******/ var __webpack_module_cache__ = {};
8699
8728
  /******/
8700
8729
  /******/ // The require function
8701
- /******/ function __nested_webpack_require_11449__(moduleId) {
8730
+ /******/ function __nested_webpack_require_11589__(moduleId) {
8702
8731
  /******/ // Check if module is in cache
8703
8732
  /******/ var cachedModule = __webpack_module_cache__[moduleId];
8704
8733
  /******/ if (cachedModule !== undefined) {
@@ -8712,7 +8741,7 @@ exports.defrag = defrag;
8712
8741
  /******/ };
8713
8742
  /******/
8714
8743
  /******/ // Execute the module function
8715
- /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_11449__);
8744
+ /******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_11589__);
8716
8745
  /******/
8717
8746
  /******/ // Return the exports of the module
8718
8747
  /******/ return module.exports;
@@ -8723,7 +8752,7 @@ exports.defrag = defrag;
8723
8752
  /******/ // startup
8724
8753
  /******/ // Load entry module and return exports
8725
8754
  /******/ // This entry module is referenced by other modules so it can't be inlined
8726
- /******/ var __nested_webpack_exports__ = __nested_webpack_require_11449__(521);
8755
+ /******/ var __nested_webpack_exports__ = __nested_webpack_require_11589__(7521);
8727
8756
  /******/
8728
8757
  /******/ return __nested_webpack_exports__;
8729
8758
  /******/ })()
@@ -8735,7 +8764,7 @@ exports.defrag = defrag;
8735
8764
  /***/ 6120:
8736
8765
  /***/ (function(module) {
8737
8766
 
8738
- /*! typed-dom v0.0.317 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8767
+ /*! typed-dom v0.0.330 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8739
8768
  (function webpackUniversalModuleDefinition(root, factory) {
8740
8769
  if(true)
8741
8770
  module.exports = factory();