securemark 0.293.2 → 0.293.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.
- package/CHANGELOG.md +8 -0
- package/README.md +7 -10
- package/dist/index.js +349 -167
- package/package.json +1 -1
- package/src/combinator/control/manipulation/indent.test.ts +6 -1
- package/src/combinator/control/manipulation/indent.ts +1 -1
- package/src/combinator/control/manipulation/surround.ts +2 -1
- package/src/combinator/data/parser/context/delimiter.ts +7 -12
- package/src/combinator/data/parser/some.ts +4 -8
- package/src/combinator/data/parser.ts +0 -3
- package/src/parser/api/bind.ts +1 -1
- package/src/parser/api/parse.ts +1 -1
- package/src/parser/block/dlist.test.ts +1 -1
- package/src/parser/block/heading.test.ts +1 -0
- package/src/parser/block/olist.test.ts +9 -6
- package/src/parser/block/olist.ts +2 -2
- package/src/parser/block/ulist.test.ts +1 -0
- package/src/parser/block.ts +38 -36
- package/src/parser/inline/annotation.test.ts +1 -1
- package/src/parser/inline/bracket.test.ts +4 -2
- package/src/parser/inline/bracket.ts +114 -88
- package/src/parser/inline/emphasis.test.ts +1 -0
- package/src/parser/inline/html.test.ts +3 -3
- package/src/parser/inline/html.ts +32 -21
- package/src/parser/inline/italic.test.ts +1 -0
- package/src/parser/inline/link.test.ts +10 -8
- package/src/parser/inline/link.ts +18 -18
- package/src/parser/inline/mark.test.ts +1 -0
- package/src/parser/inline/math.ts +2 -2
- package/src/parser/inline/media.test.ts +6 -7
- package/src/parser/inline/media.ts +6 -5
- package/src/parser/inline/reference.test.ts +1 -1
- package/src/parser/inline/remark.test.ts +3 -1
- package/src/parser/inline/remark.ts +2 -2
- package/src/parser/inline/strong.test.ts +1 -0
- package/src/parser/inline/template.ts +1 -1
- package/src/parser/inline.test.ts +16 -16
- package/src/parser/inline.ts +46 -47
- package/src/parser/segment.ts +12 -12
- package/src/parser/source/escapable.test.ts +1 -0
- package/src/parser/source/escapable.ts +3 -9
- package/src/parser/source/text.test.ts +5 -4
- package/src/parser/source/text.ts +175 -24
- package/src/parser/source/unescapable.test.ts +1 -0
- package/src/parser/source/unescapable.ts +2 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.293.
|
|
1
|
+
/*! securemark v0.293.4 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"));
|
|
@@ -2768,7 +2768,7 @@ function indent(opener, parser = false, separation = false) {
|
|
|
2768
2768
|
if (typeof opener === 'function') {
|
|
2769
2769
|
separation = parser;
|
|
2770
2770
|
parser = opener;
|
|
2771
|
-
opener = /
|
|
2771
|
+
opener = / {1,4}|\t{1,2}/y;
|
|
2772
2772
|
}
|
|
2773
2773
|
return (0, parser_1.failsafe)((0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, ({
|
|
2774
2774
|
context
|
|
@@ -3074,8 +3074,10 @@ function isBacktrack(context, backtracks, position = context.position, length =
|
|
|
3074
3074
|
exports.isBacktrack = isBacktrack;
|
|
3075
3075
|
function setBacktrack(context, backtracks, position, length = 1) {
|
|
3076
3076
|
const {
|
|
3077
|
-
source
|
|
3077
|
+
source,
|
|
3078
|
+
state = 0
|
|
3078
3079
|
} = context;
|
|
3080
|
+
if (state === 0) return;
|
|
3079
3081
|
if (position === source.length) return;
|
|
3080
3082
|
if (length === 0) return;
|
|
3081
3083
|
for (const backtrack of backtracks) {
|
|
@@ -3455,19 +3457,18 @@ class Delimiters {
|
|
|
3455
3457
|
this.states = [];
|
|
3456
3458
|
}
|
|
3457
3459
|
// 手間を惜しまなければ規定のパターンはすべて配列のインデクスに変換可能。
|
|
3458
|
-
static signature(pattern
|
|
3460
|
+
static signature(pattern) {
|
|
3459
3461
|
switch (typeof pattern) {
|
|
3460
3462
|
case 'undefined':
|
|
3461
|
-
return
|
|
3463
|
+
return 1 << 7;
|
|
3462
3464
|
case 'string':
|
|
3463
3465
|
if (pattern.length === 1) {
|
|
3464
3466
|
const code = pattern.charCodeAt(0);
|
|
3465
|
-
|
|
3466
|
-
if ((code & 1 << 7) === 0) return code | +linebreakable << 7;
|
|
3467
|
+
return code;
|
|
3467
3468
|
}
|
|
3468
|
-
return `s:${pattern}
|
|
3469
|
+
return `s:${pattern}`;
|
|
3469
3470
|
case 'object':
|
|
3470
|
-
return `r/${pattern.source}
|
|
3471
|
+
return `r/${pattern.source}`;
|
|
3471
3472
|
}
|
|
3472
3473
|
}
|
|
3473
3474
|
static matcher(pattern) {
|
|
@@ -3502,8 +3503,7 @@ class Delimiters {
|
|
|
3502
3503
|
const {
|
|
3503
3504
|
signature,
|
|
3504
3505
|
matcher,
|
|
3505
|
-
precedence
|
|
3506
|
-
linebreakable
|
|
3506
|
+
precedence
|
|
3507
3507
|
} = delims[i];
|
|
3508
3508
|
const memory = this.registry(signature);
|
|
3509
3509
|
const index = memory[0]?.index ?? delimiters.length;
|
|
@@ -3514,7 +3514,6 @@ class Delimiters {
|
|
|
3514
3514
|
signature,
|
|
3515
3515
|
matcher,
|
|
3516
3516
|
precedence,
|
|
3517
|
-
linebreakable,
|
|
3518
3517
|
state: true
|
|
3519
3518
|
};
|
|
3520
3519
|
delimiters[index] = delimiter;
|
|
@@ -3570,8 +3569,7 @@ class Delimiters {
|
|
|
3570
3569
|
}
|
|
3571
3570
|
match(input) {
|
|
3572
3571
|
const {
|
|
3573
|
-
precedence = 0
|
|
3574
|
-
linebreak = 0
|
|
3572
|
+
precedence = 0
|
|
3575
3573
|
} = input.context;
|
|
3576
3574
|
const {
|
|
3577
3575
|
delimiters
|
|
@@ -3581,7 +3579,6 @@ class Delimiters {
|
|
|
3581
3579
|
if (delimiter.precedence <= precedence || !delimiter.state) continue;
|
|
3582
3580
|
switch (delimiter.matcher(input)) {
|
|
3583
3581
|
case true:
|
|
3584
|
-
if (!delimiter.linebreakable && linebreak > 0) return false;
|
|
3585
3582
|
return true;
|
|
3586
3583
|
case false:
|
|
3587
3584
|
return false;
|
|
@@ -3684,15 +3681,13 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3684
3681
|
exports.some = void 0;
|
|
3685
3682
|
const parser_1 = __webpack_require__(605);
|
|
3686
3683
|
const delimiter_1 = __webpack_require__(5691);
|
|
3687
|
-
const array_1 = __webpack_require__(6876);
|
|
3688
3684
|
function some(parser, end, delimiters = [], limit = -1) {
|
|
3689
3685
|
if (typeof end === 'number') return some(parser, undefined, delimiters, end);
|
|
3690
3686
|
const match = delimiter_1.Delimiters.matcher(end);
|
|
3691
|
-
const delims = delimiters.map(([delimiter, precedence
|
|
3692
|
-
signature: delimiter_1.Delimiters.signature(delimiter
|
|
3687
|
+
const delims = delimiters.map(([delimiter, precedence]) => ({
|
|
3688
|
+
signature: delimiter_1.Delimiters.signature(delimiter),
|
|
3693
3689
|
matcher: delimiter_1.Delimiters.matcher(delimiter),
|
|
3694
|
-
precedence
|
|
3695
|
-
linebreakable
|
|
3690
|
+
precedence
|
|
3696
3691
|
}));
|
|
3697
3692
|
return input => {
|
|
3698
3693
|
const {
|
|
@@ -3714,7 +3709,7 @@ function some(parser, end, delimiters = [], limit = -1) {
|
|
|
3714
3709
|
if (context.delimiters?.match(input)) break;
|
|
3715
3710
|
const result = parser(input);
|
|
3716
3711
|
if (result === undefined) break;
|
|
3717
|
-
nodes = nodes ? nodes.
|
|
3712
|
+
nodes = nodes ? (nodes.push(...(0, parser_1.eval)(result)), nodes) : (0, parser_1.eval)(result);
|
|
3718
3713
|
if (limit >= 0 && context.position - position > limit) break;
|
|
3719
3714
|
}
|
|
3720
3715
|
if (delims.length > 0) {
|
|
@@ -4321,46 +4316,52 @@ exports.block = (0, combinator_1.reset)({
|
|
|
4321
4316
|
}
|
|
4322
4317
|
} = input;
|
|
4323
4318
|
if (position === source.length) return;
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
case '
|
|
4330
|
-
return (0, codeblock_1.codeblock)(input);
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
return (0,
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4319
|
+
const fst = source[position];
|
|
4320
|
+
switch (fst) {
|
|
4321
|
+
case '=':
|
|
4322
|
+
if (source.startsWith('===', position)) return (0, pagebreak_1.pagebreak)(input);
|
|
4323
|
+
break;
|
|
4324
|
+
case '`':
|
|
4325
|
+
if (source.startsWith('```', position)) return (0, codeblock_1.codeblock)(input);
|
|
4326
|
+
break;
|
|
4327
|
+
case '~':
|
|
4328
|
+
if (source.startsWith('~~~', position)) return (0, extension_1.extension)(input);
|
|
4329
|
+
if (source[position + 1] === ' ') return (0, dlist_1.dlist)(input);
|
|
4330
|
+
break;
|
|
4331
|
+
case '-':
|
|
4332
|
+
if (source[position + 1] === ' ') return (0, ulist_1.ulist)(input) || (0, ilist_1.ilist)(input);
|
|
4333
|
+
break;
|
|
4334
|
+
case '+':
|
|
4335
|
+
case '*':
|
|
4336
|
+
if (source[position + 1] === ' ') return (0, ilist_1.ilist)(input);
|
|
4337
|
+
break;
|
|
4338
|
+
case '[':
|
|
4339
|
+
switch (source[position + 1]) {
|
|
4340
|
+
case '$':
|
|
4341
|
+
return (0, extension_1.extension)(input);
|
|
4342
|
+
case '!':
|
|
4343
|
+
return (0, mediablock_1.mediablock)(input);
|
|
4344
|
+
}
|
|
4345
|
+
break;
|
|
4346
|
+
case '!':
|
|
4347
|
+
if (source[position + 1] === '>') return (0, blockquote_1.blockquote)(input);
|
|
4338
4348
|
return (0, mediablock_1.mediablock)(input);
|
|
4339
|
-
case '
|
|
4349
|
+
case '>':
|
|
4350
|
+
if (source[position + 1] === '>') return (0, blockquote_1.blockquote)(input) || (0, reply_1.reply)(input);
|
|
4340
4351
|
return (0, blockquote_1.blockquote)(input);
|
|
4341
|
-
case '>>':
|
|
4342
|
-
return (0, blockquote_1.blockquote)(input) || (0, reply_1.reply)(input);
|
|
4343
|
-
case '- ':
|
|
4344
|
-
return (0, ulist_1.ulist)(input) || (0, ilist_1.ilist)(input);
|
|
4345
|
-
case '+ ':
|
|
4346
|
-
case '* ':
|
|
4347
|
-
return (0, ilist_1.ilist)(input);
|
|
4348
|
-
case '~ ':
|
|
4349
|
-
return (0, dlist_1.dlist)(input);
|
|
4350
|
-
}
|
|
4351
|
-
switch (source[position]) {
|
|
4352
4352
|
case '#':
|
|
4353
4353
|
return (0, heading_1.heading)(input);
|
|
4354
|
-
case '|':
|
|
4355
|
-
return (0, table_1.table)(input) || (0, sidefence_1.sidefence)(input);
|
|
4356
4354
|
case '$':
|
|
4355
|
+
if (source[position + 1] === '$') return (0, mathblock_1.mathblock)(input);
|
|
4357
4356
|
return (0, extension_1.extension)(input);
|
|
4358
|
-
case '
|
|
4359
|
-
return (0,
|
|
4360
|
-
case '
|
|
4361
|
-
return (0,
|
|
4357
|
+
case '|':
|
|
4358
|
+
return (0, table_1.table)(input) || (0, sidefence_1.sidefence)(input);
|
|
4359
|
+
case '(':
|
|
4360
|
+
return (0, olist_1.olist)(input);
|
|
4361
|
+
default:
|
|
4362
|
+
if ('0' <= fst && fst <= '9') return (0, olist_1.olist)(input);
|
|
4362
4363
|
}
|
|
4363
|
-
}, source_1.emptyline,
|
|
4364
|
+
}, source_1.emptyline, paragraph_1.paragraph])));
|
|
4364
4365
|
function error(parser) {
|
|
4365
4366
|
const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}.*\n`);
|
|
4366
4367
|
return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)("\u0007" /* Command.Error */, ({
|
|
@@ -5289,7 +5290,7 @@ const openers = {
|
|
|
5289
5290
|
'.': /([0-9]+|[a-z]+|[A-Z]+)(?:-(?=$|[0-9\n])[0-9]*)*(?:\.?(?:$|[\n])|\. )/y,
|
|
5290
5291
|
'(': /\((?=$|[0-9a-z\n])([0-9]*|[a-z]*)(?=$|[)\n])\)?(?:-(?=$|[0-9\n])[0-9]*)*(?:$|[ \n])/y
|
|
5291
5292
|
};
|
|
5292
|
-
exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/([0-9]
|
|
5293
|
+
exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/(?:[0-9]+)(?:-[0-9]+)*\. /y.source, /\((?:[0-9]+)\)(?:-[0-9]+)* /y.source].join('|'), 'y'), exports.olist_)));
|
|
5293
5294
|
exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => idx(ms[1]), [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => idx(ms[1]), []))])));
|
|
5294
5295
|
const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => [(0, dom_1.html)('li', {
|
|
5295
5296
|
'data-index': (0, inline_1.dataindex)(ns),
|
|
@@ -5758,55 +5759,55 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
5758
5759
|
}
|
|
5759
5760
|
} = input;
|
|
5760
5761
|
if (position === source.length) return;
|
|
5761
|
-
switch (source.slice(position, position + 2)) {
|
|
5762
|
-
case '((':
|
|
5763
|
-
return (0, annotation_1.annotation)(input) || (0, bracket_1.bracket)(input);
|
|
5764
|
-
case '[[':
|
|
5765
|
-
return (0, reference_1.reference)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5766
|
-
case '{{':
|
|
5767
|
-
return (0, template_1.template)(input) || (0, bracket_1.bracket)(input);
|
|
5768
|
-
case '[%':
|
|
5769
|
-
return (0, remark_1.remark)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5770
|
-
case '[#':
|
|
5771
|
-
case '[$':
|
|
5772
|
-
case '[:':
|
|
5773
|
-
case '[^':
|
|
5774
|
-
case '[|':
|
|
5775
|
-
return (0, extension_1.extension)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5776
|
-
case '${':
|
|
5777
|
-
return (0, math_1.math)(input);
|
|
5778
|
-
case '++':
|
|
5779
|
-
return (0, insertion_1.insertion)(input);
|
|
5780
|
-
case '~~':
|
|
5781
|
-
return (0, deletion_1.deletion)(input);
|
|
5782
|
-
case '==':
|
|
5783
|
-
return (0, mark_1.mark)(input);
|
|
5784
|
-
case '//':
|
|
5785
|
-
return (0, italic_1.italic)(input);
|
|
5786
|
-
case '**':
|
|
5787
|
-
return (0, emstrong_1.emstrong)(input) || (0, strong_1.strong)(input) || stars(input);
|
|
5788
|
-
}
|
|
5789
5762
|
switch (source[position]) {
|
|
5763
|
+
case '(':
|
|
5764
|
+
if (source[position + 1] === '(') return (0, annotation_1.annotation)(input) || (0, bracket_1.bracket)(input);
|
|
5765
|
+
return (0, bracket_1.bracket)(input);
|
|
5790
5766
|
case '[':
|
|
5767
|
+
switch (source[position + 1]) {
|
|
5768
|
+
case '[':
|
|
5769
|
+
return (0, reference_1.reference)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5770
|
+
case '%':
|
|
5771
|
+
return (0, remark_1.remark)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5772
|
+
case '#':
|
|
5773
|
+
case '$':
|
|
5774
|
+
case ':':
|
|
5775
|
+
case '^':
|
|
5776
|
+
case '|':
|
|
5777
|
+
return (0, extension_1.extension)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5778
|
+
}
|
|
5791
5779
|
return (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input) || (0, bracket_1.bracket)(input);
|
|
5792
5780
|
case '{':
|
|
5781
|
+
if (source[position + 1] === '{') return (0, template_1.template)(input) || (0, bracket_1.bracket)(input);
|
|
5793
5782
|
return (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5783
|
+
case '"':
|
|
5784
|
+
case '(':
|
|
5785
|
+
case '[':
|
|
5786
|
+
case '{':
|
|
5787
|
+
return (0, bracket_1.bracket)(input);
|
|
5794
5788
|
case '<':
|
|
5795
5789
|
return (0, html_1.html)(input);
|
|
5796
5790
|
case '$':
|
|
5791
|
+
if (source[position + 1] === '{') return (0, math_1.math)(input);
|
|
5797
5792
|
return (0, extension_1.extension)(input) || (0, math_1.math)(input);
|
|
5793
|
+
case '+':
|
|
5794
|
+
if (source[position + 1] === '+') return (0, insertion_1.insertion)(input);
|
|
5795
|
+
break;
|
|
5796
|
+
case '~':
|
|
5797
|
+
if (source[position + 1] === '~') return (0, deletion_1.deletion)(input);
|
|
5798
|
+
break;
|
|
5799
|
+
case '=':
|
|
5800
|
+
if (source[position + 1] === '=') return (0, mark_1.mark)(input);
|
|
5801
|
+
break;
|
|
5802
|
+
case '/':
|
|
5803
|
+
if (source[position + 1] === '/' && source[position + 2] === '/') return (0, italic_1.italic)(input);
|
|
5804
|
+
break;
|
|
5805
|
+
case '*':
|
|
5806
|
+
return source[position + 1] === '*' ? source[position + 2] === '*' ? (0, emstrong_1.emstrong)(input) || stars(input) : (0, strong_1.strong)(input) || stars(input) : (0, emphasis_1.emphasis)(input);
|
|
5798
5807
|
case '`':
|
|
5799
5808
|
return (0, code_1.code)(input);
|
|
5800
|
-
case '*':
|
|
5801
|
-
return (0, emphasis_1.emphasis)(input) || stars(input);
|
|
5802
5809
|
case '&':
|
|
5803
5810
|
return (0, htmlentity_1.htmlentity)(input);
|
|
5804
|
-
case '(':
|
|
5805
|
-
case '(':
|
|
5806
|
-
case '[':
|
|
5807
|
-
case '{':
|
|
5808
|
-
case '"':
|
|
5809
|
-
return (0, bracket_1.bracket)(input);
|
|
5810
5811
|
}
|
|
5811
5812
|
}, autolink_1.autolink, source_1.text]));
|
|
5812
5813
|
var indexee_1 = __webpack_require__(7610);
|
|
@@ -6127,7 +6128,31 @@ const array_1 = __webpack_require__(6876);
|
|
|
6127
6128
|
const dom_1 = __webpack_require__(394);
|
|
6128
6129
|
const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
|
|
6129
6130
|
const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
|
|
6130
|
-
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
6131
|
+
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
|
|
6132
|
+
const {
|
|
6133
|
+
context: {
|
|
6134
|
+
source,
|
|
6135
|
+
position
|
|
6136
|
+
}
|
|
6137
|
+
} = input;
|
|
6138
|
+
switch (source[position]) {
|
|
6139
|
+
case '(':
|
|
6140
|
+
return p1(input);
|
|
6141
|
+
case '(':
|
|
6142
|
+
return p2(input);
|
|
6143
|
+
case '[':
|
|
6144
|
+
return s1(input);
|
|
6145
|
+
case '[':
|
|
6146
|
+
return s2(input);
|
|
6147
|
+
case '{':
|
|
6148
|
+
return c1(input);
|
|
6149
|
+
case '{':
|
|
6150
|
+
return c2(input);
|
|
6151
|
+
case '"':
|
|
6152
|
+
return d1(input);
|
|
6153
|
+
}
|
|
6154
|
+
}]));
|
|
6155
|
+
const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], {
|
|
6131
6156
|
source,
|
|
6132
6157
|
position,
|
|
6133
6158
|
range = 0
|
|
@@ -6136,7 +6161,8 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/[([{
|
|
|
6136
6161
|
return indexA.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
|
|
6137
6162
|
class: 'paren'
|
|
6138
6163
|
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
|
|
6139
|
-
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */])
|
|
6164
|
+
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6165
|
+
const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], {
|
|
6140
6166
|
source,
|
|
6141
6167
|
position,
|
|
6142
6168
|
range = 0
|
|
@@ -6145,7 +6171,8 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/[([{
|
|
|
6145
6171
|
return indexF.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
|
|
6146
6172
|
class: 'paren'
|
|
6147
6173
|
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
|
|
6148
|
-
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]
|
|
6174
|
+
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6175
|
+
const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, ([as, bs = [], cs], context) => {
|
|
6149
6176
|
if (context.state & 8 /* State.link */) {
|
|
6150
6177
|
const {
|
|
6151
6178
|
source,
|
|
@@ -6169,9 +6196,13 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/[([{
|
|
|
6169
6196
|
}
|
|
6170
6197
|
}
|
|
6171
6198
|
return [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)];
|
|
6172
|
-
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */])
|
|
6173
|
-
|
|
6174
|
-
(0, combinator_1.surround)((0, source_1.str)('
|
|
6199
|
+
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6200
|
+
const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6201
|
+
const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6202
|
+
const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6203
|
+
const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
|
|
6204
|
+
// 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
|
|
6205
|
+
(0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6175
6206
|
|
|
6176
6207
|
/***/ },
|
|
6177
6208
|
|
|
@@ -6706,12 +6737,17 @@ const attrspecs = {
|
|
|
6706
6737
|
};
|
|
6707
6738
|
Object.setPrototypeOf(attrspecs, null);
|
|
6708
6739
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
6709
|
-
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[
|
|
6740
|
+
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
6710
6741
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
6711
|
-
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[
|
|
6742
|
+
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]]), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[^\S\n]|>)`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs]) => [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)], ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]),
|
|
6743
|
+
// 不可視のHTML構造が可視構造を変化させるべきでない。
|
|
6744
|
+
// 可視のHTMLは優先度変更を検討する。
|
|
6745
|
+
// このため<>は将来的に共通構造を変化させる可能性があり
|
|
6746
|
+
// 共通構造を変化させない非構造文字列としては依然としてエスケープを要する。
|
|
6747
|
+
(0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], context) => [[elem(tag, true, as, bs, cs, context)]], ([as, bs = []], context) => [[elem(tag, true, as, bs, [], context)]]), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
|
|
6712
6748
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
6713
|
-
(0, source_1.str)(/<[a-z]+(?=[
|
|
6714
|
-
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/[
|
|
6749
|
+
(0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]])])));
|
|
6750
|
+
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
|
|
6715
6751
|
function elem(tag, content, as, bs, cs, context) {
|
|
6716
6752
|
if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
|
|
6717
6753
|
if (content) {
|
|
@@ -6719,7 +6755,7 @@ function elem(tag, content, as, bs, cs, context) {
|
|
|
6719
6755
|
if (bs.length === 0) return ielem('content', `Missing the content`, context);
|
|
6720
6756
|
if (!(0, visibility_1.isLooseNodeStart)(bs)) return ielem('content', `Missing the visible content in the same line`, context);
|
|
6721
6757
|
}
|
|
6722
|
-
const attrs = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -1 : as.length));
|
|
6758
|
+
const [attrs] = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -1 : as.length));
|
|
6723
6759
|
if (/(?<!\S)invalid(?!\S)/.test(attrs['class'] ?? '')) return ielem('attribute', 'Invalid HTML attribute', context);
|
|
6724
6760
|
if (as.at(-1) !== '>') return ielem('tag', `Missing the closing symbol ">"`, context);
|
|
6725
6761
|
return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
|
|
@@ -6732,6 +6768,7 @@ function ielem(type, message, context) {
|
|
|
6732
6768
|
}
|
|
6733
6769
|
const requiredAttributes = (0, memoize_1.memoize)(spec => Object.entries(spec).flatMap(([k, v]) => v && Object.isFrozen(v) ? [k] : []), new WeakMap());
|
|
6734
6770
|
function attributes(syntax, spec, params) {
|
|
6771
|
+
const remains = [];
|
|
6735
6772
|
let invalidation = false;
|
|
6736
6773
|
const attrs = {};
|
|
6737
6774
|
for (let i = 0; i < params.length; ++i) {
|
|
@@ -6740,16 +6777,23 @@ function attributes(syntax, spec, params) {
|
|
|
6740
6777
|
const name = param.split('=', 1)[0];
|
|
6741
6778
|
const value = param !== name ? param.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
|
|
6742
6779
|
invalidation ||= name === '' || !spec || name in attrs;
|
|
6743
|
-
if (name === ''
|
|
6744
|
-
spec
|
|
6745
|
-
|
|
6780
|
+
if (name === '') continue;
|
|
6781
|
+
if (spec && name in spec && !spec[name]) {
|
|
6782
|
+
remains.push(params[i]);
|
|
6783
|
+
continue;
|
|
6784
|
+
}
|
|
6785
|
+
if (spec?.[name]?.includes(value) || spec?.[name]?.length === 0 && value !== undefined) {
|
|
6786
|
+
attrs[name] = value ?? '';
|
|
6787
|
+
} else {
|
|
6788
|
+
invalidation ||= !!spec;
|
|
6789
|
+
}
|
|
6746
6790
|
}
|
|
6747
6791
|
invalidation ||= !!spec && !requiredAttributes(spec).every(name => name in attrs);
|
|
6748
6792
|
if (invalidation) {
|
|
6749
6793
|
attrs['class'] = 'invalid';
|
|
6750
6794
|
Object.assign(attrs, (0, util_1.invalid)(syntax, 'argument', 'Invalid argument'));
|
|
6751
6795
|
}
|
|
6752
|
-
return attrs;
|
|
6796
|
+
return [attrs, remains];
|
|
6753
6797
|
}
|
|
6754
6798
|
exports.attributes = attributes;
|
|
6755
6799
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
@@ -6872,7 +6916,7 @@ Object.setPrototypeOf(optspec, null);
|
|
|
6872
6916
|
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, ([, ns = []], context) => context.linebreak === 0 ? [(0, array_1.push)(ns, ["\u001F" /* Command.Separator */])] : undefined, undefined, [3 | 64 /* Backtrack.bracket */, 3 | 16 /* Backtrack.link */, 2 | 8 /* Backtrack.ruby */])),
|
|
6873
6917
|
// `{ `と`{`で個別にバックトラックが発生し+1nされる。
|
|
6874
6918
|
// 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
|
|
6875
|
-
(0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /
|
|
6919
|
+
(0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, undefined, ([as, bs], context) => {
|
|
6876
6920
|
if (!bs) return;
|
|
6877
6921
|
const head = context.position - context.range;
|
|
6878
6922
|
(0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
|
|
@@ -6898,10 +6942,10 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
|
|
|
6898
6942
|
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
6899
6943
|
return [[parse((0, dom_1.defrag)(content), params, context)]];
|
|
6900
6944
|
}))))));
|
|
6901
|
-
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.validate)(/[[{]/y, (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /
|
|
6902
|
-
exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /
|
|
6903
|
-
exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/
|
|
6904
|
-
exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/
|
|
6945
|
+
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.validate)(/[[{]/y, (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([params, content = []], context) => [[parse((0, dom_1.defrag)(content), params, context)]]))))));
|
|
6946
|
+
exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([params, content = []], context) => [[parse((0, dom_1.defrag)(content), params, context)]])));
|
|
6947
|
+
exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/ /y, (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
|
|
6948
|
+
exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => [` rel="nofollow"`]), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
|
|
6905
6949
|
function parse(content, params, context) {
|
|
6906
6950
|
const INSECURE_URI = params.shift();
|
|
6907
6951
|
let uri;
|
|
@@ -6909,7 +6953,7 @@ function parse(content, params, context) {
|
|
|
6909
6953
|
uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
6910
6954
|
} catch {}
|
|
6911
6955
|
const el = elem(INSECURE_URI, content, uri, context.host?.origin || location.origin);
|
|
6912
|
-
return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, params));
|
|
6956
|
+
return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, params)[0]);
|
|
6913
6957
|
}
|
|
6914
6958
|
function elem(INSECURE_URI, content, uri, origin) {
|
|
6915
6959
|
let type;
|
|
@@ -6922,11 +6966,11 @@ function elem(INSECURE_URI, content, uri, origin) {
|
|
|
6922
6966
|
case 'http:':
|
|
6923
6967
|
case 'https:':
|
|
6924
6968
|
switch (true) {
|
|
6925
|
-
case /[
|
|
6969
|
+
case /[0-9a-z]:\S/i.test((0, util_1.stringify)(content)):
|
|
6926
6970
|
type = 'content';
|
|
6927
6971
|
message = 'URI must not be contained';
|
|
6928
6972
|
break;
|
|
6929
|
-
case INSECURE_URI.
|
|
6973
|
+
case INSECURE_URI.startsWith('^/') && /\/\.\.?(?:\/|$)/.test(INSECURE_URI.slice(0, INSECURE_URI.search(/[?#]|$/))):
|
|
6930
6974
|
type = 'argument';
|
|
6931
6975
|
message = 'Dot-segments cannot be used in subresource paths';
|
|
6932
6976
|
break;
|
|
@@ -6963,13 +7007,13 @@ function elem(INSECURE_URI, content, uri, origin) {
|
|
|
6963
7007
|
}
|
|
6964
7008
|
function resolve(uri, host, source) {
|
|
6965
7009
|
switch (true) {
|
|
6966
|
-
case uri.
|
|
7010
|
+
case uri.startsWith('^/'):
|
|
6967
7011
|
const last = host.pathname.slice(host.pathname.lastIndexOf('/') + 1);
|
|
6968
7012
|
return last.includes('.') // isFile
|
|
6969
7013
|
// Exclude ISO 6709.
|
|
6970
7014
|
&& /^[0-9]*[a-z][0-9a-z]*$/i.test(last.slice(last.lastIndexOf('.') + 1)) ? `${host.pathname.slice(0, -last.length)}${uri.slice(2)}` : `${host.pathname.replace(/\/?$/, '/')}${uri.slice(2)}`;
|
|
6971
7015
|
case host.origin === source.origin && host.pathname === source.pathname:
|
|
6972
|
-
case uri.
|
|
7016
|
+
case uri.startsWith('//'):
|
|
6973
7017
|
return uri;
|
|
6974
7018
|
default:
|
|
6975
7019
|
const target = new url_1.ReadonlyURL(uri, source.href);
|
|
@@ -6978,13 +7022,11 @@ function resolve(uri, host, source) {
|
|
|
6978
7022
|
}
|
|
6979
7023
|
exports.resolve = resolve;
|
|
6980
7024
|
function decode(uri) {
|
|
6981
|
-
const
|
|
7025
|
+
const head = /^[a-z]+(?:[.+-][0-9a-z]+)*:\/*[^/?#\s]+/i;
|
|
7026
|
+
const origin = uri.match(head)?.[0] ?? '';
|
|
6982
7027
|
try {
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
path = uri.slice(origin.length);
|
|
6986
|
-
}
|
|
6987
|
-
uri = origin + path;
|
|
7028
|
+
const path = decodeURI(uri.slice(origin.length));
|
|
7029
|
+
uri = !origin && head.test(path) ? uri.slice(origin.length) : origin + path;
|
|
6988
7030
|
} finally {
|
|
6989
7031
|
return uri.replace(/\s+/g, encodeURI);
|
|
6990
7032
|
}
|
|
@@ -7043,7 +7085,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7043
7085
|
const util_1 = __webpack_require__(4992);
|
|
7044
7086
|
const dom_1 = __webpack_require__(394);
|
|
7045
7087
|
const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
|
|
7046
|
-
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(
|
|
7088
|
+
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, undefined, undefined, [3 | 64 /* Backtrack.bracket */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, undefined, undefined, [3 | 64 /* Backtrack.bracket */])]), ({
|
|
7047
7089
|
context: {
|
|
7048
7090
|
source,
|
|
7049
7091
|
caches: {
|
|
@@ -7090,7 +7132,7 @@ const optspec = {
|
|
|
7090
7132
|
rel: undefined
|
|
7091
7133
|
};
|
|
7092
7134
|
Object.setPrototypeOf(optspec, null);
|
|
7093
|
-
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, ([, ns = []], context) => context.linebreak === 0 ? [ns] : undefined, undefined, [3 | 4 /* Backtrack.escbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /
|
|
7135
|
+
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, ([, ns = []], context) => context.linebreak === 0 ? [ns] : undefined, undefined, [3 | 4 /* Backtrack.escbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, undefined, ([as, bs], context) => {
|
|
7094
7136
|
if (!bs) return;
|
|
7095
7137
|
const head = context.position - context.range;
|
|
7096
7138
|
(0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
|
|
@@ -7117,7 +7159,8 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7117
7159
|
});
|
|
7118
7160
|
el.setAttribute('alt', text);
|
|
7119
7161
|
if (!sanitize(el, uri)) return [[el]];
|
|
7120
|
-
|
|
7162
|
+
const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, params);
|
|
7163
|
+
(0, dom_1.define)(el, attrs);
|
|
7121
7164
|
// Awaiting the generic support for attr().
|
|
7122
7165
|
if (el.hasAttribute('aspect-ratio')) {
|
|
7123
7166
|
el.style.aspectRatio = el.getAttribute('aspect-ratio');
|
|
@@ -7135,10 +7178,10 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7135
7178
|
class: null,
|
|
7136
7179
|
target: '_blank'
|
|
7137
7180
|
}, [el])];
|
|
7138
|
-
})((0, parser_1.subinput)(`{ ${INSECURE_URI}${
|
|
7181
|
+
})((0, parser_1.subinput)(`{ ${INSECURE_URI}${linkparams.join('')} }`, context));
|
|
7139
7182
|
})))));
|
|
7140
7183
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (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, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (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, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (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, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */])])));
|
|
7141
|
-
const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/
|
|
7184
|
+
const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, ([[a], [b], [c]]) => [b === 'x' ? [`width="${a}"`, `height="${c}"`] : [`aspect-ratio="${a}/${c}"`]]), link_1.option]));
|
|
7142
7185
|
function sanitize(target, uri) {
|
|
7143
7186
|
let type;
|
|
7144
7187
|
let message;
|
|
@@ -7306,7 +7349,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7306
7349
|
const util_1 = __webpack_require__(4992);
|
|
7307
7350
|
const array_1 = __webpack_require__(6876);
|
|
7308
7351
|
const dom_1 = __webpack_require__(394);
|
|
7309
|
-
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(
|
|
7352
|
+
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /\s%\]/y, [[/\s%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = [], cs]) => [[(0, dom_1.html)('span', {
|
|
7310
7353
|
class: 'remark'
|
|
7311
7354
|
}, [(0, dom_1.html)('input', {
|
|
7312
7355
|
type: 'checkbox'
|
|
@@ -7471,7 +7514,7 @@ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, s
|
|
|
7471
7514
|
class: 'invalid',
|
|
7472
7515
|
...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
|
|
7473
7516
|
}, context.source.slice(context.position - context.range, context.position))]], [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
|
|
7474
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource,
|
|
7517
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], context) => context.linebreak === 0 ? [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)] : (context.position -= 1, [(0, array_1.unshift)(as, bs)]), ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 4 /* Backtrack.escbracket */])]));
|
|
7475
7518
|
|
|
7476
7519
|
/***/ },
|
|
7477
7520
|
|
|
@@ -7809,19 +7852,19 @@ const parser = (0, combinator_1.union)([input => {
|
|
|
7809
7852
|
}
|
|
7810
7853
|
} = input;
|
|
7811
7854
|
if (position === source.length) return;
|
|
7812
|
-
switch (source.slice(position, position + 3)) {
|
|
7813
|
-
case '~~~':
|
|
7814
|
-
return (0, extension_1.segment)(input);
|
|
7815
|
-
case '```':
|
|
7816
|
-
return (0, codeblock_1.segment)(input);
|
|
7817
|
-
}
|
|
7818
|
-
switch (source.slice(position, position + 2)) {
|
|
7819
|
-
case '$$':
|
|
7820
|
-
return (0, mathblock_1.segment)(input);
|
|
7821
|
-
case '[$':
|
|
7822
|
-
return (0, extension_1.segment)(input);
|
|
7823
|
-
}
|
|
7824
7855
|
switch (source[position]) {
|
|
7856
|
+
case '`':
|
|
7857
|
+
if (source.startsWith('```', position)) return (0, codeblock_1.segment)(input);
|
|
7858
|
+
break;
|
|
7859
|
+
case '~':
|
|
7860
|
+
if (source.startsWith('~~~', position)) return (0, extension_1.segment)(input);
|
|
7861
|
+
break;
|
|
7862
|
+
case '$':
|
|
7863
|
+
if (source[position + 1] === '$') return (0, mathblock_1.segment)(input);
|
|
7864
|
+
break;
|
|
7865
|
+
case '[':
|
|
7866
|
+
if (source[position + 1] === '$') return (0, extension_1.segment)(input);
|
|
7867
|
+
break;
|
|
7825
7868
|
case '#':
|
|
7826
7869
|
return (0, heading_1.segment)(input);
|
|
7827
7870
|
case '$':
|
|
@@ -7949,7 +7992,7 @@ exports.escsource = void 0;
|
|
|
7949
7992
|
const combinator_1 = __webpack_require__(3484);
|
|
7950
7993
|
const text_1 = __webpack_require__(5655);
|
|
7951
7994
|
const dom_1 = __webpack_require__(394);
|
|
7952
|
-
const delimiter = /(?=[\\$"`\[\](){}\r\n]|\s
|
|
7995
|
+
const delimiter = /(?=[\\$"`\[\](){}\r\n]|\s\$|:\/\/)/g;
|
|
7953
7996
|
const escsource = ({
|
|
7954
7997
|
context
|
|
7955
7998
|
}) => {
|
|
@@ -7985,9 +8028,7 @@ const escsource = ({
|
|
|
7985
8028
|
return [[(0, dom_1.html)('br')]];
|
|
7986
8029
|
default:
|
|
7987
8030
|
if (context.sequential) return [[char]];
|
|
7988
|
-
text_1.
|
|
7989
|
-
const b = (0, text_1.isBlank)(source, position);
|
|
7990
|
-
let i = b ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, delimiter);
|
|
8031
|
+
let i = (0, text_1.next)(source, position, delimiter);
|
|
7991
8032
|
i -= position;
|
|
7992
8033
|
(0, combinator_1.consume)(i - 1, context);
|
|
7993
8034
|
context.position += i - 1;
|
|
@@ -8100,11 +8141,11 @@ exports.strs = strs;
|
|
|
8100
8141
|
Object.defineProperty(exports, "__esModule", ({
|
|
8101
8142
|
value: true
|
|
8102
8143
|
}));
|
|
8103
|
-
exports.
|
|
8144
|
+
exports.backToEmailHead = exports.backToUrlHead = exports.backToWhitespace = exports.next = exports.canSkip = exports.linebreak = exports.txt = exports.text = exports.nonWhitespace = void 0;
|
|
8104
8145
|
const combinator_1 = __webpack_require__(3484);
|
|
8105
8146
|
const dom_1 = __webpack_require__(394);
|
|
8106
|
-
|
|
8107
|
-
exports.nonWhitespace = /[\
|
|
8147
|
+
//const delimiter = /(?=[\\!@#$&"`\[\](){}<>()[]{}*%|\r\n]|([+~=])\1|\/{3}|\s(?:\\?(?:$|\s)|[$%])|:\/\/)/g;
|
|
8148
|
+
exports.nonWhitespace = /[^ \t ]/g;
|
|
8108
8149
|
const text = input => {
|
|
8109
8150
|
const {
|
|
8110
8151
|
context
|
|
@@ -8139,31 +8180,65 @@ const text = input => {
|
|
|
8139
8180
|
default:
|
|
8140
8181
|
if (context.sequential) return [[char]];
|
|
8141
8182
|
exports.nonWhitespace.lastIndex = position + 1;
|
|
8142
|
-
const
|
|
8143
|
-
let i =
|
|
8144
|
-
const lineend = false ||
|
|
8183
|
+
const s = canSkip(source, position);
|
|
8184
|
+
let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position);
|
|
8185
|
+
const lineend = false || s && i === source.length || s && source[i] === '\n';
|
|
8145
8186
|
i -= position;
|
|
8146
|
-
i = lineend ? i : i - +
|
|
8187
|
+
i = lineend ? i : i - +s || 1;
|
|
8147
8188
|
(0, combinator_1.consume)(i - 1, context);
|
|
8148
8189
|
context.position += i - 1;
|
|
8149
8190
|
const linestart = position === 0 || source[position - 1] === '\n';
|
|
8150
|
-
|
|
8151
|
-
i += position;
|
|
8152
|
-
return i === context.position || b && !linestart || lineend ? [[]] : [[source.slice(i, context.position)]];
|
|
8191
|
+
return position === context.position || s && !linestart || lineend ? [[]] : [[source.slice(position, context.position)]];
|
|
8153
8192
|
}
|
|
8154
8193
|
};
|
|
8155
8194
|
exports.text = text;
|
|
8156
8195
|
exports.txt = (0, combinator_1.union)([exports.text]);
|
|
8157
8196
|
exports.linebreak = (0, combinator_1.focus)(/[\r\n]/y, (0, combinator_1.union)([exports.text]));
|
|
8197
|
+
function canSkip(source, position) {
|
|
8198
|
+
if (!isWhitespace(source[position], false)) return false;
|
|
8199
|
+
if (position + 1 === source.length) return true;
|
|
8200
|
+
return isWhitespace(source[position + 1], true);
|
|
8201
|
+
}
|
|
8202
|
+
exports.canSkip = canSkip;
|
|
8203
|
+
function isWhitespace(char, linebreak) {
|
|
8204
|
+
switch (char) {
|
|
8205
|
+
case ' ':
|
|
8206
|
+
case '\t':
|
|
8207
|
+
case ' ':
|
|
8208
|
+
return true;
|
|
8209
|
+
case '\r':
|
|
8210
|
+
case '\n':
|
|
8211
|
+
return linebreak;
|
|
8212
|
+
default:
|
|
8213
|
+
return false;
|
|
8214
|
+
}
|
|
8215
|
+
}
|
|
8158
8216
|
function next(source, position, delimiter) {
|
|
8159
|
-
|
|
8160
|
-
delimiter
|
|
8161
|
-
|
|
8217
|
+
let index;
|
|
8218
|
+
if (delimiter) {
|
|
8219
|
+
delimiter.lastIndex = position + 1;
|
|
8220
|
+
delimiter.test(source);
|
|
8221
|
+
index = delimiter.lastIndex;
|
|
8222
|
+
} else {
|
|
8223
|
+
index = seek(source, position);
|
|
8224
|
+
}
|
|
8162
8225
|
if (index === 0) return source.length;
|
|
8163
8226
|
const char = source[index];
|
|
8164
8227
|
switch (char) {
|
|
8228
|
+
case '$':
|
|
8229
|
+
case '%':
|
|
8230
|
+
case '*':
|
|
8231
|
+
case '+':
|
|
8232
|
+
case '~':
|
|
8233
|
+
case '=':
|
|
8234
|
+
case '/':
|
|
8235
|
+
index = backToWhitespace(source, position, index);
|
|
8236
|
+
break;
|
|
8237
|
+
case '[':
|
|
8238
|
+
index = source[index + 1] === '|' ? backToWhitespace(source, position, index) : index;
|
|
8239
|
+
break;
|
|
8165
8240
|
case ':':
|
|
8166
|
-
index = backToUrlHead(source, position, index);
|
|
8241
|
+
index = source.startsWith('//', index + 1) ? backToUrlHead(source, position, index) : index;
|
|
8167
8242
|
break;
|
|
8168
8243
|
case '@':
|
|
8169
8244
|
index = backToEmailHead(source, position, index);
|
|
@@ -8172,6 +8247,11 @@ function next(source, position, delimiter) {
|
|
|
8172
8247
|
return index;
|
|
8173
8248
|
}
|
|
8174
8249
|
exports.next = next;
|
|
8250
|
+
function backToWhitespace(source, position, index) {
|
|
8251
|
+
const prev = index - 1;
|
|
8252
|
+
return prev > position && /\s/.test(source[prev]) ? prev : index;
|
|
8253
|
+
}
|
|
8254
|
+
exports.backToWhitespace = backToWhitespace;
|
|
8175
8255
|
function backToUrlHead(source, position, index) {
|
|
8176
8256
|
const delim = index;
|
|
8177
8257
|
let state = false;
|
|
@@ -8229,16 +8309,119 @@ function backToEmailHead(source, position, index) {
|
|
|
8229
8309
|
return index + offset;
|
|
8230
8310
|
}
|
|
8231
8311
|
exports.backToEmailHead = backToEmailHead;
|
|
8232
|
-
const blank = /\s(?:$|\s|\\\n)/y;
|
|
8233
|
-
function isBlank(source, position) {
|
|
8234
|
-
blank.lastIndex = position;
|
|
8235
|
-
return blank.test(source);
|
|
8236
|
-
}
|
|
8237
|
-
exports.isBlank = isBlank;
|
|
8238
8312
|
function isAlphanumeric(char) {
|
|
8239
8313
|
if (char < '0' || '\x7F' < char) return false;
|
|
8240
8314
|
return '0' <= char && char <= '9' || 'a' <= char && char <= 'z' || 'A' <= char && char <= 'Z';
|
|
8241
8315
|
}
|
|
8316
|
+
//const dict = new class {
|
|
8317
|
+
// constructor() {
|
|
8318
|
+
// [
|
|
8319
|
+
// '\\',
|
|
8320
|
+
// '!',
|
|
8321
|
+
// '@',
|
|
8322
|
+
// '#',
|
|
8323
|
+
// '$',
|
|
8324
|
+
// '&',
|
|
8325
|
+
// '"',
|
|
8326
|
+
// '`',
|
|
8327
|
+
// '[',
|
|
8328
|
+
// ']',
|
|
8329
|
+
// '(',
|
|
8330
|
+
// ')',
|
|
8331
|
+
// '{',
|
|
8332
|
+
// '}',
|
|
8333
|
+
// '<',
|
|
8334
|
+
// '>',
|
|
8335
|
+
// '(',
|
|
8336
|
+
// ')',
|
|
8337
|
+
// '[',
|
|
8338
|
+
// ']',
|
|
8339
|
+
// '{',
|
|
8340
|
+
// '}',
|
|
8341
|
+
// '*',
|
|
8342
|
+
// '%',
|
|
8343
|
+
// '|',
|
|
8344
|
+
// '\r',
|
|
8345
|
+
// '\n',
|
|
8346
|
+
// ].forEach(c =>
|
|
8347
|
+
// this[c.charCodeAt(0)] = undefined);
|
|
8348
|
+
// }
|
|
8349
|
+
//};
|
|
8350
|
+
function seek(source, position) {
|
|
8351
|
+
for (let i = position + 1; i < source.length; ++i) {
|
|
8352
|
+
const fst = source[i];
|
|
8353
|
+
//if (fst.charCodeAt(0) in dict) return i;
|
|
8354
|
+
switch (fst) {
|
|
8355
|
+
case '\\':
|
|
8356
|
+
case '!':
|
|
8357
|
+
case '@':
|
|
8358
|
+
case '#':
|
|
8359
|
+
case '$':
|
|
8360
|
+
case '&':
|
|
8361
|
+
case '"':
|
|
8362
|
+
case '`':
|
|
8363
|
+
case '[':
|
|
8364
|
+
case ']':
|
|
8365
|
+
case '(':
|
|
8366
|
+
case ')':
|
|
8367
|
+
case '{':
|
|
8368
|
+
case '}':
|
|
8369
|
+
case '<':
|
|
8370
|
+
case '>':
|
|
8371
|
+
case '(':
|
|
8372
|
+
case ')':
|
|
8373
|
+
case '[':
|
|
8374
|
+
case ']':
|
|
8375
|
+
case '{':
|
|
8376
|
+
case '}':
|
|
8377
|
+
case '*':
|
|
8378
|
+
case '|':
|
|
8379
|
+
case '\r':
|
|
8380
|
+
case '\n':
|
|
8381
|
+
return i;
|
|
8382
|
+
case '+':
|
|
8383
|
+
case '~':
|
|
8384
|
+
case '=':
|
|
8385
|
+
if (source[i + 1] === fst) return i;
|
|
8386
|
+
continue;
|
|
8387
|
+
case '/':
|
|
8388
|
+
if (source[i + 1] === fst && source[i + 2] === fst) return i;
|
|
8389
|
+
continue;
|
|
8390
|
+
case '%':
|
|
8391
|
+
if (source[i + 1] === ']') return i;
|
|
8392
|
+
continue;
|
|
8393
|
+
case ':':
|
|
8394
|
+
if (source[i + 1] === '/' && source[i + 2] === '/') return i;
|
|
8395
|
+
continue;
|
|
8396
|
+
case ' ':
|
|
8397
|
+
case '\t':
|
|
8398
|
+
case ' ':
|
|
8399
|
+
if (i + 1 === source.length) return i;
|
|
8400
|
+
switch (source[i + 1]) {
|
|
8401
|
+
case ' ':
|
|
8402
|
+
case '\t':
|
|
8403
|
+
case '\r':
|
|
8404
|
+
case '\n':
|
|
8405
|
+
case ' ':
|
|
8406
|
+
return i;
|
|
8407
|
+
case '\\':
|
|
8408
|
+
if (i + 2 === source.length) return i;
|
|
8409
|
+
switch (source[i + 2]) {
|
|
8410
|
+
case ' ':
|
|
8411
|
+
case '\t':
|
|
8412
|
+
case '\r':
|
|
8413
|
+
case '\n':
|
|
8414
|
+
case ' ':
|
|
8415
|
+
return i;
|
|
8416
|
+
}
|
|
8417
|
+
}
|
|
8418
|
+
continue;
|
|
8419
|
+
default:
|
|
8420
|
+
continue;
|
|
8421
|
+
}
|
|
8422
|
+
}
|
|
8423
|
+
return source.length;
|
|
8424
|
+
}
|
|
8242
8425
|
|
|
8243
8426
|
/***/ },
|
|
8244
8427
|
|
|
@@ -8281,8 +8464,7 @@ const unescsource = ({
|
|
|
8281
8464
|
default:
|
|
8282
8465
|
if (context.sequential) return [[char]];
|
|
8283
8466
|
text_1.nonWhitespace.lastIndex = position + 1;
|
|
8284
|
-
|
|
8285
|
-
let i = b ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, exports.delimiter);
|
|
8467
|
+
let i = (0, text_1.canSkip)(source, position) ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, exports.delimiter);
|
|
8286
8468
|
i -= position;
|
|
8287
8469
|
(0, combinator_1.consume)(i - 1, context);
|
|
8288
8470
|
context.position += i - 1;
|