securemark 0.299.1 → 0.299.3
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/dist/index.js +192 -138
- package/markdown.d.ts +2 -2
- package/package.json +1 -1
- package/src/combinator/control/manipulation/fence.ts +2 -2
- package/src/combinator/control/manipulation/match.ts +2 -2
- package/src/combinator/data/delimiter.ts +5 -3
- package/src/combinator/data/parser/context.ts +12 -38
- package/src/combinator/data/parser/some.ts +13 -6
- package/src/parser/api/header.ts +5 -1
- package/src/parser/api/parse.test.ts +9 -9
- package/src/parser/block/blockquote.ts +2 -2
- package/src/parser/block.ts +1 -1
- package/src/parser/context.ts +5 -6
- package/src/parser/header.test.ts +5 -5
- package/src/parser/header.ts +2 -3
- package/src/parser/inline/annotation.ts +9 -4
- package/src/parser/inline/autolink/url.ts +3 -4
- package/src/parser/inline/deletion.ts +1 -1
- package/src/parser/inline/emstrong.ts +1 -1
- package/src/parser/inline/insertion.ts +1 -1
- package/src/parser/inline/italic.ts +1 -1
- package/src/parser/inline/link.ts +2 -2
- package/src/parser/inline/mark.ts +1 -1
- package/src/parser/inline/math.test.ts +2 -2
- package/src/parser/inline/math.ts +3 -3
- package/src/parser/inline/media.ts +2 -2
- package/src/parser/inline/ruby.ts +2 -3
- package/src/parser/inline.test.ts +1 -1
- package/src/parser/inline.ts +1 -1
- package/src/parser/repeat.ts +11 -23
- package/src/parser/source/escapable.ts +33 -10
- package/src/parser/source/text.ts +15 -24
- package/src/parser/source/unescapable.test.ts +1 -1
- package/src/parser/source/unescapable.ts +90 -9
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.299.
|
|
1
|
+
/*! securemark v0.299.3 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"));
|
|
@@ -2605,7 +2605,7 @@ function fence(opener, limit, separation = true) {
|
|
|
2605
2605
|
opener.lastIndex = position;
|
|
2606
2606
|
const matches = opener.exec(source);
|
|
2607
2607
|
if (!matches) return;
|
|
2608
|
-
(0, combinator_1.
|
|
2608
|
+
(0, combinator_1.spend)(context, matches[0].length);
|
|
2609
2609
|
const delim = matches[1];
|
|
2610
2610
|
if (matches[0].includes(delim, delim.length)) return;
|
|
2611
2611
|
context.position += matches[0].length;
|
|
@@ -2727,7 +2727,7 @@ function match(pattern, f) {
|
|
|
2727
2727
|
pattern.lastIndex = position;
|
|
2728
2728
|
const params = pattern.exec(source);
|
|
2729
2729
|
if (!params) return;
|
|
2730
|
-
count && (0, combinator_1.
|
|
2730
|
+
count && (0, combinator_1.spend)(context, params[0].length);
|
|
2731
2731
|
const result = f(params)(input);
|
|
2732
2732
|
context.position += result ? context.position === position ? params[0].length : 0 : context.position - position;
|
|
2733
2733
|
return result;
|
|
@@ -3239,7 +3239,7 @@ function matcher(pattern, advance, after) {
|
|
|
3239
3239
|
pos = position;
|
|
3240
3240
|
if (index === -1) return;
|
|
3241
3241
|
const src = source.slice(position, index);
|
|
3242
|
-
count && !hit && (0, context_1.
|
|
3242
|
+
count && !hit && (0, context_1.spend)(context, src.length);
|
|
3243
3243
|
if (advance) {
|
|
3244
3244
|
context.position = index;
|
|
3245
3245
|
}
|
|
@@ -3290,7 +3290,7 @@ function tester(pattern, advance, after) {
|
|
|
3290
3290
|
pos = position;
|
|
3291
3291
|
if (index === -1) return;
|
|
3292
3292
|
const len = index - position;
|
|
3293
|
-
count && !hit && (0, context_1.
|
|
3293
|
+
count && !hit && (0, context_1.spend)(context, len);
|
|
3294
3294
|
if (advance) {
|
|
3295
3295
|
context.position = index;
|
|
3296
3296
|
}
|
|
@@ -3547,35 +3547,28 @@ exports.failsafe = failsafe;
|
|
|
3547
3547
|
Object.defineProperty(exports, "__esModule", ({
|
|
3548
3548
|
value: true
|
|
3549
3549
|
}));
|
|
3550
|
-
exports.constraint = exports.state = exports.precedence = exports.
|
|
3550
|
+
exports.constraint = exports.state = exports.precedence = exports.recur = exports.recursion = exports.spend = exports.creation = void 0;
|
|
3551
3551
|
const alias_1 = __webpack_require__(5413);
|
|
3552
3552
|
function creation(cost, parser) {
|
|
3553
3553
|
return input => {
|
|
3554
3554
|
const context = input;
|
|
3555
|
-
const resources = context.resources ?? {
|
|
3556
|
-
clock: cost || 1,
|
|
3557
|
-
recursions: [1]
|
|
3558
|
-
};
|
|
3559
|
-
const {
|
|
3560
|
-
recursions
|
|
3561
|
-
} = resources;
|
|
3562
3555
|
const result = parser(input);
|
|
3563
3556
|
if (result === undefined) return;
|
|
3564
|
-
|
|
3557
|
+
spend(context, cost);
|
|
3565
3558
|
return result;
|
|
3566
3559
|
};
|
|
3567
3560
|
}
|
|
3568
3561
|
exports.creation = creation;
|
|
3569
|
-
function
|
|
3570
|
-
const {
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3562
|
+
function spend(context, cost) {
|
|
3563
|
+
const resources = context.resources ?? {
|
|
3564
|
+
clock: cost || 1,
|
|
3565
|
+
recursions: [1]
|
|
3566
|
+
};
|
|
3574
3567
|
if (resources.clock < cost) throw new Error('Too many creations');
|
|
3575
3568
|
resources.clock -= cost;
|
|
3576
3569
|
}
|
|
3577
|
-
exports.
|
|
3578
|
-
function recursion(
|
|
3570
|
+
exports.spend = spend;
|
|
3571
|
+
function recursion(index, parser) {
|
|
3579
3572
|
return input => {
|
|
3580
3573
|
const context = input;
|
|
3581
3574
|
const resources = context.resources ?? {
|
|
@@ -3585,41 +3578,19 @@ function recursion(recursion, parser) {
|
|
|
3585
3578
|
const {
|
|
3586
3579
|
recursions
|
|
3587
3580
|
} = resources;
|
|
3588
|
-
|
|
3589
|
-
if (rec >= 0 && recursions[rec] < 1) throw new Error('Too much recursion');
|
|
3590
|
-
rec >= 0 && --recursions[rec];
|
|
3581
|
+
recur(recursions, index, 1);
|
|
3591
3582
|
const result = parser(input);
|
|
3592
|
-
|
|
3583
|
+
recur(recursions, index, -1);
|
|
3593
3584
|
return result;
|
|
3594
3585
|
};
|
|
3595
3586
|
}
|
|
3596
3587
|
exports.recursion = recursion;
|
|
3597
|
-
function recursions
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
clock: 1,
|
|
3602
|
-
recursions: [4]
|
|
3603
|
-
};
|
|
3604
|
-
const {
|
|
3605
|
-
recursions
|
|
3606
|
-
} = resources;
|
|
3607
|
-
for (const recursion of rs) {
|
|
3608
|
-
const rec = (0, alias_1.min)(recursion, recursions.length - 1);
|
|
3609
|
-
if (rec === -1) continue;
|
|
3610
|
-
if (recursions[rec] < 1) throw new Error('Too much recursion');
|
|
3611
|
-
--recursions[rec];
|
|
3612
|
-
}
|
|
3613
|
-
const result = parser(input);
|
|
3614
|
-
for (const recursion of rs) {
|
|
3615
|
-
const rec = (0, alias_1.min)(recursion, recursions.length - 1);
|
|
3616
|
-
if (rec === -1) continue;
|
|
3617
|
-
++recursions[rec];
|
|
3618
|
-
}
|
|
3619
|
-
return result;
|
|
3620
|
-
};
|
|
3588
|
+
function recur(recursions, index, size, force = false) {
|
|
3589
|
+
index = (0, alias_1.min)(index, recursions.length && recursions.length - 1);
|
|
3590
|
+
if (recursions[index] < size - +force) throw new Error('Too much recursion');
|
|
3591
|
+
recursions[index] -= size;
|
|
3621
3592
|
}
|
|
3622
|
-
exports.
|
|
3593
|
+
exports.recur = recur;
|
|
3623
3594
|
function precedence(precedence, parser) {
|
|
3624
3595
|
return input => {
|
|
3625
3596
|
const context = input;
|
|
@@ -3745,16 +3716,21 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3745
3716
|
}));
|
|
3746
3717
|
exports.some = void 0;
|
|
3747
3718
|
const delimiter_1 = __webpack_require__(385);
|
|
3748
|
-
function some(parser, delimiter, after, delimiters, limit =
|
|
3719
|
+
function some(parser, delimiter, after, delimiters, limit = 0) {
|
|
3749
3720
|
if (typeof delimiter === 'number') {
|
|
3750
3721
|
limit = delimiter;
|
|
3722
|
+
delimiters = undefined;
|
|
3751
3723
|
delimiter = undefined;
|
|
3752
3724
|
} else if (Array.isArray(delimiter)) {
|
|
3725
|
+
limit = after;
|
|
3753
3726
|
delimiters = delimiter;
|
|
3754
3727
|
delimiter = undefined;
|
|
3755
3728
|
} else if (after === undefined || Array.isArray(after)) {
|
|
3729
|
+
limit = delimiters;
|
|
3756
3730
|
delimiters = after;
|
|
3757
3731
|
after = undefined;
|
|
3732
|
+
} else {
|
|
3733
|
+
delimiters = delimiters;
|
|
3758
3734
|
}
|
|
3759
3735
|
const match = delimiter_1.Delimiters.tester(delimiter, after);
|
|
3760
3736
|
const delims = delimiters?.map(([delimiter, precedence]) => ({
|
|
@@ -3768,7 +3744,6 @@ function some(parser, delimiter, after, delimiters, limit = -1) {
|
|
|
3768
3744
|
source,
|
|
3769
3745
|
position
|
|
3770
3746
|
} = context;
|
|
3771
|
-
//assert(context.backtracks ??= {});
|
|
3772
3747
|
let nodes;
|
|
3773
3748
|
delims && context.delimiters.push(delims);
|
|
3774
3749
|
// whileは数倍遅い
|
|
@@ -3780,7 +3755,8 @@ function some(parser, delimiter, after, delimiters, limit = -1) {
|
|
|
3780
3755
|
if (result === undefined) break;
|
|
3781
3756
|
if (context.position === pos) break;
|
|
3782
3757
|
nodes = nodes?.import(result) ?? result;
|
|
3783
|
-
|
|
3758
|
+
// 次にパースに成功すれば確実に制限値を超えるので制限値ちょうどでも中止する
|
|
3759
|
+
if (limit > 0 && context.position - position >= limit) break;
|
|
3784
3760
|
}
|
|
3785
3761
|
delims && context.delimiters.pop(delims.length);
|
|
3786
3762
|
return context.position > position ? nodes : undefined;
|
|
@@ -4201,7 +4177,11 @@ function header(source) {
|
|
|
4201
4177
|
exports.header = header;
|
|
4202
4178
|
function headers(source) {
|
|
4203
4179
|
const [el] = parse(source);
|
|
4204
|
-
|
|
4180
|
+
const acc = [];
|
|
4181
|
+
for (let field = el?.firstChild?.firstChild; field = field?.nextSibling;) {
|
|
4182
|
+
acc.push(field.textContent);
|
|
4183
|
+
}
|
|
4184
|
+
return acc;
|
|
4205
4185
|
}
|
|
4206
4186
|
exports.headers = headers;
|
|
4207
4187
|
function parse(source) {
|
|
@@ -4458,7 +4438,7 @@ exports.block = error((0, combinator_1.union)([source_1.emptysegment, input => {
|
|
|
4458
4438
|
case '(':
|
|
4459
4439
|
return (0, olist_1.olist)(input);
|
|
4460
4440
|
default:
|
|
4461
|
-
if (
|
|
4441
|
+
if (char <= '9' && '0' <= char) return (0, olist_1.olist)(input);
|
|
4462
4442
|
}
|
|
4463
4443
|
}, paragraph_1.paragraph]));
|
|
4464
4444
|
function error(parser) {
|
|
@@ -4502,7 +4482,7 @@ const indent = (0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.co
|
|
|
4502
4482
|
const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \r\n])))|\r?\n$/g, '');
|
|
4503
4483
|
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.blockquote */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
|
|
4504
4484
|
const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.blockquote */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, context => {
|
|
4505
|
-
(0, combinator_1.
|
|
4485
|
+
(0, combinator_1.spend)(context, 10);
|
|
4506
4486
|
const {
|
|
4507
4487
|
source
|
|
4508
4488
|
} = context;
|
|
@@ -5813,7 +5793,7 @@ exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE * 10;
|
|
|
5813
5793
|
class Context extends parser_1.Context {
|
|
5814
5794
|
constructor(options = {}) {
|
|
5815
5795
|
super(options);
|
|
5816
|
-
this.recursion = new RecursionCounter(
|
|
5796
|
+
this.recursion = new RecursionCounter(2);
|
|
5817
5797
|
const {
|
|
5818
5798
|
segment,
|
|
5819
5799
|
local,
|
|
@@ -5825,9 +5805,9 @@ class Context extends parser_1.Context {
|
|
|
5825
5805
|
id,
|
|
5826
5806
|
caches
|
|
5827
5807
|
} = options;
|
|
5828
|
-
this.resources
|
|
5808
|
+
this.resources = options.resources ?? {
|
|
5829
5809
|
// バックトラックのせいで文字数制限を受けないようにする。
|
|
5830
|
-
clock: exports.MAX_SEGMENT_SIZE * (
|
|
5810
|
+
clock: exports.MAX_SEGMENT_SIZE * (5 + 1),
|
|
5831
5811
|
recursions: [5 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
|
|
5832
5812
|
};
|
|
5833
5813
|
this.segment = segment ?? 0 /* Segment.unknown */;
|
|
@@ -5843,8 +5823,7 @@ class Context extends parser_1.Context {
|
|
|
5843
5823
|
}
|
|
5844
5824
|
exports.Context = Context;
|
|
5845
5825
|
class RecursionCounter {
|
|
5846
|
-
constructor(
|
|
5847
|
-
this.syntax = syntax;
|
|
5826
|
+
constructor(limit) {
|
|
5848
5827
|
this.limit = limit;
|
|
5849
5828
|
this.stack = [];
|
|
5850
5829
|
this.index = 0;
|
|
@@ -5855,7 +5834,7 @@ class RecursionCounter {
|
|
|
5855
5834
|
} = this;
|
|
5856
5835
|
for (; this.index > 0 && stack[this.index - 1] <= depth; --this.index);
|
|
5857
5836
|
// 内側から数えるので無効化処理できずエラーを投げるしかない。
|
|
5858
|
-
if (this.index === this.limit) throw new Error(`Too much
|
|
5837
|
+
if (this.index === this.limit) throw new Error(`Too much recursion`);
|
|
5859
5838
|
stack[this.index] = depth;
|
|
5860
5839
|
++this.index;
|
|
5861
5840
|
}
|
|
@@ -5881,7 +5860,7 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
5881
5860
|
const source_1 = __webpack_require__(8745);
|
|
5882
5861
|
const util_1 = __webpack_require__(4992);
|
|
5883
5862
|
const dom_1 = __webpack_require__(394);
|
|
5884
|
-
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(context => context.header, (0, combinator_1.focus)(/(---+)[^\S\r\n]*\r?\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,
|
|
5863
|
+
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(context => context.header, (0, combinator_1.focus)(/(---+)[^\S\r\n]*\r?\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,32}\1[^\S\r\n]*(?:$|\r?\n)/yi, (0, combinator_1.convert)(source => source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
5885
5864
|
class: 'header'
|
|
5886
5865
|
}, [(0, dom_1.html)('details', {
|
|
5887
5866
|
open: ''
|
|
@@ -5903,7 +5882,7 @@ const field = (0, combinator_1.line)(({
|
|
|
5903
5882
|
}) => {
|
|
5904
5883
|
const name = source.slice(position, source.indexOf(':', position));
|
|
5905
5884
|
const value = source.slice(position + name.length + 1).trim();
|
|
5906
|
-
return new parser_1.List([new parser_1.Node((0, dom_1.html)('
|
|
5885
|
+
return new parser_1.List([new parser_1.Node((0, dom_1.html)('div', {
|
|
5907
5886
|
class: 'field',
|
|
5908
5887
|
'data-name': name.toLowerCase(),
|
|
5909
5888
|
'data-value': value
|
|
@@ -5911,7 +5890,7 @@ const field = (0, combinator_1.line)(({
|
|
|
5911
5890
|
class: 'field-name'
|
|
5912
5891
|
}, name), ': ', (0, dom_1.html)('span', {
|
|
5913
5892
|
class: 'field-value'
|
|
5914
|
-
}, value)
|
|
5893
|
+
}, value)]))]);
|
|
5915
5894
|
});
|
|
5916
5895
|
|
|
5917
5896
|
/***/ },
|
|
@@ -6057,7 +6036,7 @@ Object.defineProperty(exports, "lineshortmedia", ({
|
|
|
6057
6036
|
}
|
|
6058
6037
|
}));
|
|
6059
6038
|
function isAlphabet(char) {
|
|
6060
|
-
return
|
|
6039
|
+
return char <= 'z' && 'a' <= char;
|
|
6061
6040
|
}
|
|
6062
6041
|
|
|
6063
6042
|
/***/ },
|
|
@@ -6095,7 +6074,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
6095
6074
|
// 修正する必要があるためほぼ完全な二重処理が必要になり三重以上の注釈という不適切な使用のために
|
|
6096
6075
|
// 常に非常に非効率な処理を行い常時低速化するより三重以上の注釈を禁止して効率性を維持するのが妥当である。
|
|
6097
6076
|
const MAX_DEPTH = 20;
|
|
6098
|
-
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, repeat_1.repeat)('(', visibility_1.beforeNonblank, ')',
|
|
6077
|
+
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, repeat_1.repeat)('(', visibility_1.beforeNonblank, ')', 4 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]]), ')', false, [], ([, bs], {
|
|
6099
6078
|
buffer
|
|
6100
6079
|
}) => buffer.import(bs), ([, bs], {
|
|
6101
6080
|
buffer
|
|
@@ -6359,10 +6338,9 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6359
6338
|
exports.lineurl = exports.url = void 0;
|
|
6360
6339
|
const parser_1 = __webpack_require__(605);
|
|
6361
6340
|
const combinator_1 = __webpack_require__(3484);
|
|
6362
|
-
const inline_1 = __webpack_require__(7973);
|
|
6363
6341
|
const link_1 = __webpack_require__(3628);
|
|
6364
6342
|
const source_1 = __webpack_require__(8745);
|
|
6365
|
-
exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[
|
|
6343
|
+
exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[[0-9A-Za-z])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, bracket)]), [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, context => new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(context.source)]), context))]))), context => new parser_1.List([new parser_1.Node(context.source)])])));
|
|
6366
6344
|
exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\r\n]*(?=$|\r?\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, context => {
|
|
6367
6345
|
const {
|
|
6368
6346
|
source,
|
|
@@ -6370,7 +6348,7 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
|
|
|
6370
6348
|
} = context;
|
|
6371
6349
|
context.position -= source[0] === '!' ? 1 : 0;
|
|
6372
6350
|
return new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(source.slice(position))]), context))]);
|
|
6373
|
-
})), (
|
|
6351
|
+
})), context => new parser_1.List([new parser_1.Node(context.source)])])])));
|
|
6374
6352
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.unescapable */])]));
|
|
6375
6353
|
|
|
6376
6354
|
/***/ },
|
|
@@ -6510,7 +6488,7 @@ const repeat_1 = __webpack_require__(8019);
|
|
|
6510
6488
|
const visibility_1 = __webpack_require__(6364);
|
|
6511
6489
|
const util_1 = __webpack_require__(4992);
|
|
6512
6490
|
const dom_1 = __webpack_require__(394);
|
|
6513
|
-
exports.deletion = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('~~', '', '~~',
|
|
6491
|
+
exports.deletion = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('~~', '', '~~', 3 /* Recursion.inline */, (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), '~~', false, [], ([, bs], {
|
|
6514
6492
|
buffer
|
|
6515
6493
|
}) => buffer.import(bs), ([, bs], {
|
|
6516
6494
|
buffer
|
|
@@ -6565,7 +6543,7 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
|
|
|
6565
6543
|
// 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
|
|
6566
6544
|
// 可能な限り早く閉じるよう解析しなければならない。
|
|
6567
6545
|
// このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
|
|
6568
|
-
exports.emstrong = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('***', visibility_1.beforeNonblank, '***',
|
|
6546
|
+
exports.emstrong = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('***', visibility_1.beforeNonblank, '***', 3 /* Recursion.inline */, (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank)])), (0, source_1.strs)('*', 1, 3), false, [], ([, bs, cs], context) => {
|
|
6569
6547
|
const {
|
|
6570
6548
|
buffer
|
|
6571
6549
|
} = context;
|
|
@@ -7144,7 +7122,7 @@ const repeat_1 = __webpack_require__(8019);
|
|
|
7144
7122
|
const visibility_1 = __webpack_require__(6364);
|
|
7145
7123
|
const util_1 = __webpack_require__(4992);
|
|
7146
7124
|
const dom_1 = __webpack_require__(394);
|
|
7147
|
-
exports.insertion = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('++', '', '++',
|
|
7125
|
+
exports.insertion = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('++', '', '++', 3 /* Recursion.inline */, (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), '++', false, [], ([, bs], {
|
|
7148
7126
|
buffer
|
|
7149
7127
|
}) => buffer.import(bs), ([, bs], {
|
|
7150
7128
|
buffer
|
|
@@ -7172,7 +7150,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
7172
7150
|
// 可読性のため実際にはオブリーク体を指定する。
|
|
7173
7151
|
// 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
|
|
7174
7152
|
// ある程度の長さのある文に使うのが望ましい。
|
|
7175
|
-
exports.italic = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('///', visibility_1.beforeNonblank, '///',
|
|
7153
|
+
exports.italic = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('///', visibility_1.beforeNonblank, '///', 3 /* Recursion.inline */, (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '///', visibility_1.afterNonblank), '///', false, [], ([, bs], {
|
|
7176
7154
|
buffer
|
|
7177
7155
|
}) => buffer.import(bs), ([, bs], {
|
|
7178
7156
|
buffer
|
|
@@ -7247,7 +7225,7 @@ exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(' ', (0, source_1.
|
|
|
7247
7225
|
exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Node(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\r\n]|[^\\\r\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
|
|
7248
7226
|
function parse(content, params, context) {
|
|
7249
7227
|
const INSECURE_URI = params.shift().value;
|
|
7250
|
-
(0, combinator_1.
|
|
7228
|
+
(0, combinator_1.spend)(context, 10);
|
|
7251
7229
|
let uri;
|
|
7252
7230
|
try {
|
|
7253
7231
|
uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
@@ -7354,7 +7332,7 @@ const repeat_1 = __webpack_require__(8019);
|
|
|
7354
7332
|
const visibility_1 = __webpack_require__(6364);
|
|
7355
7333
|
const util_1 = __webpack_require__(4992);
|
|
7356
7334
|
const dom_1 = __webpack_require__(394);
|
|
7357
|
-
exports.mark = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('==', visibility_1.beforeNonblank, '==',
|
|
7335
|
+
exports.mark = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('==', visibility_1.beforeNonblank, '==', 3 /* Recursion.inline */, (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.state)(2 /* State.mark */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '==', visibility_1.afterNonblank)), '==', false, [], ([, bs], {
|
|
7358
7336
|
buffer
|
|
7359
7337
|
}) => buffer.import(bs), ([, bs], {
|
|
7360
7338
|
buffer
|
|
@@ -7389,8 +7367,8 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
7389
7367
|
const source_1 = __webpack_require__(8745);
|
|
7390
7368
|
const util_1 = __webpack_require__(4992);
|
|
7391
7369
|
const dom_1 = __webpack_require__(394);
|
|
7392
|
-
const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])
|
|
7393
|
-
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, [3 | 16 /* Backtrack.escapable */]), (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,
|
|
7370
|
+
const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
|
|
7371
|
+
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, [3 | 16 /* Backtrack.escapable */]), (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, /[`"{}$\r\n]|(?<=[0-9A-Za-z]):\/\/[[0-9A-Za-z]/y), (0, combinator_1.precedence)(4, bracket)]))), /(?<!\s)\$(?![-0-9A-Za-z])/y, false, [3 | 16 /* Backtrack.escapable */])]), ({
|
|
7394
7372
|
source,
|
|
7395
7373
|
caches: {
|
|
7396
7374
|
math: cache
|
|
@@ -7404,7 +7382,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
|
|
|
7404
7382
|
translate: 'no',
|
|
7405
7383
|
...(0, util_1.invalid)('math', 'content', `"${source.match(forbiddenCommand)[0]}" command is forbidden`)
|
|
7406
7384
|
}, source))])));
|
|
7407
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\r\n]/y)]))), (0, source_1.str)('}'), true));
|
|
7385
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\r\n]|(?<=[0-9A-Za-z]):\/\/[[0-9A-Za-z]/y)]))), (0, source_1.str)('}'), true));
|
|
7408
7386
|
|
|
7409
7387
|
/***/ },
|
|
7410
7388
|
|
|
@@ -7456,7 +7434,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7456
7434
|
text = text.trim();
|
|
7457
7435
|
if (text === '' || text[0] !== tmp[0]) return;
|
|
7458
7436
|
}
|
|
7459
|
-
(0, combinator_1.
|
|
7437
|
+
(0, combinator_1.spend)(context, 100);
|
|
7460
7438
|
if (params.last.value === "\u0018" /* Command.Cancel */) {
|
|
7461
7439
|
params.pop();
|
|
7462
7440
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
@@ -7666,14 +7644,14 @@ const dom_1 = __webpack_require__(394);
|
|
|
7666
7644
|
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, [1 | 4 /* Backtrack.common */, 3 | 32 /* Backtrack.ruby */], ([, ns]) => {
|
|
7667
7645
|
ns && ns.last?.value === '' && ns.pop();
|
|
7668
7646
|
return (0, visibility_1.isNonblankNodeStart)(ns) ? ns : undefined;
|
|
7669
|
-
})), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false
|
|
7647
|
+
})), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false))]), ([{
|
|
7670
7648
|
value: texts
|
|
7671
7649
|
}, {
|
|
7672
7650
|
value: rubies = undefined
|
|
7673
7651
|
} = {}], context) => {
|
|
7674
7652
|
if (rubies === undefined) {
|
|
7675
7653
|
const head = context.position - context.range;
|
|
7676
|
-
return void (0, combinator_1.setBacktrack)(context, 2 | 32 /* Backtrack.ruby */, head);
|
|
7654
|
+
return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
|
|
7677
7655
|
}
|
|
7678
7656
|
switch (true) {
|
|
7679
7657
|
case texts.length >= rubies.length:
|
|
@@ -8148,8 +8126,9 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8148
8126
|
exports.repeat = void 0;
|
|
8149
8127
|
const parser_1 = __webpack_require__(605);
|
|
8150
8128
|
const delimiter_1 = __webpack_require__(385);
|
|
8129
|
+
const combinator_1 = __webpack_require__(3484);
|
|
8151
8130
|
const alias_1 = __webpack_require__(5413);
|
|
8152
|
-
function repeat(opener, after, closer,
|
|
8131
|
+
function repeat(opener, after, closer, recursion, parser, cons, termination = (nodes, context, prefix, postfix) => {
|
|
8153
8132
|
const acc = new parser_1.List();
|
|
8154
8133
|
if (prefix > 0) {
|
|
8155
8134
|
acc.push(new parser_1.Node(opener[0].repeat(prefix)));
|
|
@@ -8175,7 +8154,7 @@ function repeat(opener, after, closer, rs, parser, cons, termination = (nodes, c
|
|
|
8175
8154
|
position,
|
|
8176
8155
|
resources: {
|
|
8177
8156
|
recursions
|
|
8178
|
-
}
|
|
8157
|
+
}
|
|
8179
8158
|
} = context;
|
|
8180
8159
|
if (!source.startsWith(opener, context.position)) return;
|
|
8181
8160
|
let nodes = new parser_1.List();
|
|
@@ -8187,20 +8166,11 @@ function repeat(opener, after, closer, rs, parser, cons, termination = (nodes, c
|
|
|
8187
8166
|
return;
|
|
8188
8167
|
}
|
|
8189
8168
|
let depth = i / opener.length + 1 | 0;
|
|
8190
|
-
|
|
8191
|
-
const rec = (0, alias_1.min)(recursion, recursions.length - 1);
|
|
8192
|
-
if (rec === -1) continue;
|
|
8193
|
-
if (recursions[rec] < depth - 1) throw new Error('Too much recursion');
|
|
8194
|
-
recursions[rec] -= depth;
|
|
8195
|
-
}
|
|
8169
|
+
(0, combinator_1.recur)(recursions, recursion, depth, true);
|
|
8196
8170
|
let state = false;
|
|
8197
8171
|
let follow = 0;
|
|
8198
8172
|
for (; i >= opener.length; i -= opener.length, follow -= closer.length) {
|
|
8199
|
-
|
|
8200
|
-
const rec = (0, alias_1.min)(recursion, recursions.length - 1);
|
|
8201
|
-
if (rec === -1) continue;
|
|
8202
|
-
recursions[rec] += 1;
|
|
8203
|
-
}
|
|
8173
|
+
(0, combinator_1.recur)(recursions, recursion, -1);
|
|
8204
8174
|
depth -= 1;
|
|
8205
8175
|
const lead = i - opener.length;
|
|
8206
8176
|
if (source.startsWith(closer, context.position)) {
|
|
@@ -8209,10 +8179,10 @@ function repeat(opener, after, closer, rs, parser, cons, termination = (nodes, c
|
|
|
8209
8179
|
follow = follow > 0 ? follow : countFollows(source, pos, closer, lead / opener.length | 0);
|
|
8210
8180
|
nodes = cons(nodes, context, lead, follow);
|
|
8211
8181
|
if (context.position > pos) {
|
|
8212
|
-
const advance =
|
|
8182
|
+
const advance = context.position - pos;
|
|
8213
8183
|
i -= advance;
|
|
8214
8184
|
follow -= advance;
|
|
8215
|
-
depth -= advance;
|
|
8185
|
+
depth -= advance / closer.length | 0;
|
|
8216
8186
|
}
|
|
8217
8187
|
continue;
|
|
8218
8188
|
}
|
|
@@ -8239,20 +8209,16 @@ function repeat(opener, after, closer, rs, parser, cons, termination = (nodes, c
|
|
|
8239
8209
|
nodes = cons(nodes, context, lead, follow);
|
|
8240
8210
|
state = true;
|
|
8241
8211
|
if (context.position > pos) {
|
|
8242
|
-
const advance =
|
|
8212
|
+
const advance = context.position - pos;
|
|
8243
8213
|
i -= advance;
|
|
8244
8214
|
follow -= advance;
|
|
8245
|
-
depth -= advance;
|
|
8215
|
+
depth -= advance / closer.length | 0;
|
|
8246
8216
|
}
|
|
8247
8217
|
continue;
|
|
8248
8218
|
}
|
|
8249
8219
|
break;
|
|
8250
8220
|
}
|
|
8251
|
-
|
|
8252
|
-
const rec = (0, alias_1.min)(recursion, recursions.length - 1);
|
|
8253
|
-
if (rec === -1) continue;
|
|
8254
|
-
recursions[rec] += depth;
|
|
8255
|
-
}
|
|
8221
|
+
(0, combinator_1.recur)(recursions, recursion, -depth);
|
|
8256
8222
|
depth = 0;
|
|
8257
8223
|
const prefix = i;
|
|
8258
8224
|
i = 0;
|
|
@@ -8431,22 +8397,19 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8431
8397
|
exports.escsource = void 0;
|
|
8432
8398
|
const parser_1 = __webpack_require__(605);
|
|
8433
8399
|
const combinator_1 = __webpack_require__(3484);
|
|
8434
|
-
const text_1 = __webpack_require__(5655);
|
|
8435
8400
|
const dom_1 = __webpack_require__(394);
|
|
8436
|
-
const delimiter = /(?=[\\$"`\[\](){}\r\n]|\s\$|:\/\/)/g;
|
|
8437
8401
|
const escsource = context => {
|
|
8438
8402
|
const {
|
|
8439
8403
|
source,
|
|
8440
|
-
position
|
|
8441
|
-
state
|
|
8404
|
+
position
|
|
8442
8405
|
} = context;
|
|
8443
8406
|
if (position === source.length) return;
|
|
8444
8407
|
const char = source[position];
|
|
8445
|
-
(0, combinator_1.
|
|
8408
|
+
(0, combinator_1.spend)(context, 1);
|
|
8446
8409
|
context.position += 1;
|
|
8447
8410
|
switch (char) {
|
|
8448
8411
|
case "\u001B" /* Command.Escape */:
|
|
8449
|
-
(0, combinator_1.
|
|
8412
|
+
(0, combinator_1.spend)(context, 1);
|
|
8450
8413
|
context.position += 1;
|
|
8451
8414
|
return new parser_1.List([new parser_1.Node(source.slice(position + 1, position + 2))]);
|
|
8452
8415
|
case '\\':
|
|
@@ -8456,7 +8419,7 @@ const escsource = context => {
|
|
|
8456
8419
|
case '\n':
|
|
8457
8420
|
return new parser_1.List([new parser_1.Node(char)]);
|
|
8458
8421
|
default:
|
|
8459
|
-
(0, combinator_1.
|
|
8422
|
+
(0, combinator_1.spend)(context, 1);
|
|
8460
8423
|
context.position += 1;
|
|
8461
8424
|
return new parser_1.List([new parser_1.Node(source.slice(position, position + 2))]);
|
|
8462
8425
|
}
|
|
@@ -8467,14 +8430,38 @@ const escsource = context => {
|
|
|
8467
8430
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'), 1 /* Flag.blank */)]);
|
|
8468
8431
|
default:
|
|
8469
8432
|
if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
|
|
8470
|
-
let i = (
|
|
8433
|
+
let i = seek(source, position);
|
|
8471
8434
|
i -= position;
|
|
8472
|
-
(0, combinator_1.
|
|
8435
|
+
(0, combinator_1.spend)(context, i - 1);
|
|
8473
8436
|
context.position += i - 1;
|
|
8474
8437
|
return new parser_1.List([new parser_1.Node(source.slice(position, context.position))]);
|
|
8475
8438
|
}
|
|
8476
8439
|
};
|
|
8477
8440
|
exports.escsource = escsource;
|
|
8441
|
+
function seek(source, position) {
|
|
8442
|
+
for (let i = position + 1; i < source.length; ++i) {
|
|
8443
|
+
const char = source[i];
|
|
8444
|
+
switch (char) {
|
|
8445
|
+
case '\\':
|
|
8446
|
+
case '$':
|
|
8447
|
+
case '"':
|
|
8448
|
+
case '`':
|
|
8449
|
+
case ':':
|
|
8450
|
+
case '[':
|
|
8451
|
+
case ']':
|
|
8452
|
+
case '(':
|
|
8453
|
+
case ')':
|
|
8454
|
+
case '{':
|
|
8455
|
+
case '}':
|
|
8456
|
+
case '\r':
|
|
8457
|
+
case '\n':
|
|
8458
|
+
return i;
|
|
8459
|
+
default:
|
|
8460
|
+
continue;
|
|
8461
|
+
}
|
|
8462
|
+
}
|
|
8463
|
+
return source.length;
|
|
8464
|
+
}
|
|
8478
8465
|
|
|
8479
8466
|
/***/ },
|
|
8480
8467
|
|
|
@@ -8604,7 +8591,7 @@ exports.strs = strs;
|
|
|
8604
8591
|
Object.defineProperty(exports, "__esModule", ({
|
|
8605
8592
|
value: true
|
|
8606
8593
|
}));
|
|
8607
|
-
exports.isAlphanumeric = exports.
|
|
8594
|
+
exports.isAlphanumeric = exports.backToEmailHead = exports.backToUrlHead = exports.canSkip = exports.txt = exports.text = exports.nonWhitespace = void 0;
|
|
8608
8595
|
const parser_1 = __webpack_require__(605);
|
|
8609
8596
|
const combinator_1 = __webpack_require__(3484);
|
|
8610
8597
|
const dom_1 = __webpack_require__(394);
|
|
@@ -8618,7 +8605,7 @@ const text = input => {
|
|
|
8618
8605
|
} = context;
|
|
8619
8606
|
if (position === source.length) return;
|
|
8620
8607
|
const char = source[position];
|
|
8621
|
-
(0, combinator_1.
|
|
8608
|
+
(0, combinator_1.spend)(context, 1);
|
|
8622
8609
|
context.position += 1;
|
|
8623
8610
|
switch (char) {
|
|
8624
8611
|
case "\u001B" /* Command.Escape */:
|
|
@@ -8630,7 +8617,7 @@ const text = input => {
|
|
|
8630
8617
|
case '\n':
|
|
8631
8618
|
return new parser_1.List();
|
|
8632
8619
|
default:
|
|
8633
|
-
(0, combinator_1.
|
|
8620
|
+
(0, combinator_1.spend)(context, 1);
|
|
8634
8621
|
context.position += 1;
|
|
8635
8622
|
return new parser_1.List([new parser_1.Node(source.slice(position + 1, context.position))]);
|
|
8636
8623
|
}
|
|
@@ -8647,7 +8634,7 @@ const text = input => {
|
|
|
8647
8634
|
const lineend = false || s && i === source.length || s && source[i] === '\r' || s && source[i] === '\n';
|
|
8648
8635
|
i -= position;
|
|
8649
8636
|
i = lineend ? i : i - +s || 1;
|
|
8650
|
-
(0, combinator_1.
|
|
8637
|
+
(0, combinator_1.spend)(context, i - 1);
|
|
8651
8638
|
context.position += i - 1;
|
|
8652
8639
|
const linestart = position === 0 || source[position - 1] === '\n';
|
|
8653
8640
|
if (position === context.position || s && !linestart || lineend) return new parser_1.List();
|
|
@@ -8675,23 +8662,16 @@ function isWhitespace(char, linebreak) {
|
|
|
8675
8662
|
return false;
|
|
8676
8663
|
}
|
|
8677
8664
|
}
|
|
8678
|
-
function next(source, position, state
|
|
8679
|
-
let index;
|
|
8680
|
-
if (
|
|
8681
|
-
delimiter.lastIndex = position + 1;
|
|
8682
|
-
delimiter.test(source);
|
|
8683
|
-
index = delimiter.lastIndex || position;
|
|
8684
|
-
} else {
|
|
8685
|
-
index = seek(source, position, state);
|
|
8686
|
-
}
|
|
8687
|
-
if (index === position || index === source.length) return source.length;
|
|
8665
|
+
function next(source, position, state) {
|
|
8666
|
+
let index = seek(source, position, state);
|
|
8667
|
+
if (index === source.length) return index;
|
|
8688
8668
|
const char = source[index];
|
|
8689
8669
|
switch (char) {
|
|
8690
8670
|
case '%':
|
|
8691
|
-
index +=
|
|
8671
|
+
index += index - 1 > position ? -1 : 0;
|
|
8692
8672
|
break;
|
|
8693
8673
|
case '[':
|
|
8694
|
-
index +=
|
|
8674
|
+
index += index - 1 > position && source.startsWith(' [|', index - 1) ? -1 : 0;
|
|
8695
8675
|
break;
|
|
8696
8676
|
case ':':
|
|
8697
8677
|
index = source.startsWith('//', index + 1) ? backToUrlHead(source, position, index) : index;
|
|
@@ -8702,7 +8682,6 @@ function next(source, position, state, delimiter) {
|
|
|
8702
8682
|
}
|
|
8703
8683
|
return index;
|
|
8704
8684
|
}
|
|
8705
|
-
exports.next = next;
|
|
8706
8685
|
function backToUrlHead(source, position, index) {
|
|
8707
8686
|
const delim = index;
|
|
8708
8687
|
let state = false;
|
|
@@ -8724,6 +8703,7 @@ function backToUrlHead(source, position, index) {
|
|
|
8724
8703
|
}
|
|
8725
8704
|
return index === position || source[index] !== 'h' ? delim : index;
|
|
8726
8705
|
}
|
|
8706
|
+
exports.backToUrlHead = backToUrlHead;
|
|
8727
8707
|
function backToEmailHead(source, position, index) {
|
|
8728
8708
|
const delim = index;
|
|
8729
8709
|
let state = false;
|
|
@@ -8746,9 +8726,11 @@ function backToEmailHead(source, position, index) {
|
|
|
8746
8726
|
}
|
|
8747
8727
|
return index === position ? delim : index;
|
|
8748
8728
|
}
|
|
8729
|
+
exports.backToEmailHead = backToEmailHead;
|
|
8749
8730
|
function isAlphanumeric(char) {
|
|
8750
|
-
if (char < '0' || '
|
|
8751
|
-
|
|
8731
|
+
if (char < '0' || 'z' < char) return false;
|
|
8732
|
+
if (char <= '9' || 'a' <= char) return true;
|
|
8733
|
+
return 'A' <= char && char <= 'Z';
|
|
8752
8734
|
}
|
|
8753
8735
|
exports.isAlphanumeric = isAlphanumeric;
|
|
8754
8736
|
function seek(source, position, state) {
|
|
@@ -8841,12 +8823,11 @@ function seek(source, position, state) {
|
|
|
8841
8823
|
Object.defineProperty(exports, "__esModule", ({
|
|
8842
8824
|
value: true
|
|
8843
8825
|
}));
|
|
8844
|
-
exports.unescsource =
|
|
8826
|
+
exports.unescsource = void 0;
|
|
8845
8827
|
const parser_1 = __webpack_require__(605);
|
|
8846
8828
|
const combinator_1 = __webpack_require__(3484);
|
|
8847
8829
|
const text_1 = __webpack_require__(5655);
|
|
8848
8830
|
const dom_1 = __webpack_require__(394);
|
|
8849
|
-
exports.delimiter = /(?=(?=[\x00-\x7F])[^0-9A-Za-z]|(?<=[\x00-\x7F])[^\x00-\x7F])/g;
|
|
8850
8831
|
const unescsource = context => {
|
|
8851
8832
|
const {
|
|
8852
8833
|
source,
|
|
@@ -8855,11 +8836,11 @@ const unescsource = context => {
|
|
|
8855
8836
|
} = context;
|
|
8856
8837
|
if (position === source.length) return;
|
|
8857
8838
|
const char = source[position];
|
|
8858
|
-
(0, combinator_1.
|
|
8839
|
+
(0, combinator_1.spend)(context, 1);
|
|
8859
8840
|
context.position += 1;
|
|
8860
8841
|
switch (char) {
|
|
8861
8842
|
case "\u001B" /* Command.Escape */:
|
|
8862
|
-
(0, combinator_1.
|
|
8843
|
+
(0, combinator_1.spend)(context, 1);
|
|
8863
8844
|
context.position += 1;
|
|
8864
8845
|
return new parser_1.List([new parser_1.Node(source.slice(position + 1, position + 2))]);
|
|
8865
8846
|
case '\r':
|
|
@@ -8870,14 +8851,87 @@ const unescsource = context => {
|
|
|
8870
8851
|
default:
|
|
8871
8852
|
if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
|
|
8872
8853
|
text_1.nonWhitespace.lastIndex = position + 1;
|
|
8873
|
-
let i = (0, text_1.canSkip)(source, position) ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length :
|
|
8854
|
+
let i = (0, text_1.canSkip)(source, position) ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : next(source, position, state);
|
|
8874
8855
|
i -= position;
|
|
8875
|
-
(0, combinator_1.
|
|
8856
|
+
(0, combinator_1.spend)(context, i - 1);
|
|
8876
8857
|
context.position += i - 1;
|
|
8877
8858
|
return new parser_1.List([new parser_1.Node(source.slice(position, context.position))]);
|
|
8878
8859
|
}
|
|
8879
8860
|
};
|
|
8880
8861
|
exports.unescsource = unescsource;
|
|
8862
|
+
function next(source, position, state) {
|
|
8863
|
+
let index = seek(source, position, state);
|
|
8864
|
+
if (index === source.length) return index;
|
|
8865
|
+
const char = source[index];
|
|
8866
|
+
switch (char) {
|
|
8867
|
+
case ':':
|
|
8868
|
+
index = source.startsWith('//', index + 1) ? (0, text_1.backToUrlHead)(source, position, index) : index;
|
|
8869
|
+
break;
|
|
8870
|
+
case '@':
|
|
8871
|
+
index = ~state & 1 /* State.autolink */ ? (0, text_1.backToEmailHead)(source, position, index) : index;
|
|
8872
|
+
break;
|
|
8873
|
+
}
|
|
8874
|
+
return index;
|
|
8875
|
+
}
|
|
8876
|
+
function seek(source, position, state) {
|
|
8877
|
+
const cat = category(source[position]);
|
|
8878
|
+
for (let i = position + 1; i < source.length; ++i) {
|
|
8879
|
+
const char = source[i];
|
|
8880
|
+
switch (char) {
|
|
8881
|
+
case '\\':
|
|
8882
|
+
case '!':
|
|
8883
|
+
case '$':
|
|
8884
|
+
case '"':
|
|
8885
|
+
case '`':
|
|
8886
|
+
case '[':
|
|
8887
|
+
case ']':
|
|
8888
|
+
case '(':
|
|
8889
|
+
case ')':
|
|
8890
|
+
case '{':
|
|
8891
|
+
case '}':
|
|
8892
|
+
case '<':
|
|
8893
|
+
case '>':
|
|
8894
|
+
case '(':
|
|
8895
|
+
case ')':
|
|
8896
|
+
case '[':
|
|
8897
|
+
case ']':
|
|
8898
|
+
case '{':
|
|
8899
|
+
case '}':
|
|
8900
|
+
case '-':
|
|
8901
|
+
case '+':
|
|
8902
|
+
case '*':
|
|
8903
|
+
case '=':
|
|
8904
|
+
case '~':
|
|
8905
|
+
case '^':
|
|
8906
|
+
case '_':
|
|
8907
|
+
case ',':
|
|
8908
|
+
case '.':
|
|
8909
|
+
case ';':
|
|
8910
|
+
case ':':
|
|
8911
|
+
case '!':
|
|
8912
|
+
case '?':
|
|
8913
|
+
case '/':
|
|
8914
|
+
case '|':
|
|
8915
|
+
case '\r':
|
|
8916
|
+
case '\n':
|
|
8917
|
+
return i;
|
|
8918
|
+
case '@':
|
|
8919
|
+
case '#':
|
|
8920
|
+
if (~state & 1 /* State.autolink */) return i;
|
|
8921
|
+
continue;
|
|
8922
|
+
case ':':
|
|
8923
|
+
if (source[i + 1] === '/' && source[i + 2] === '/') return i;
|
|
8924
|
+
continue;
|
|
8925
|
+
default:
|
|
8926
|
+
if (cat && !category(char)) return i;
|
|
8927
|
+
continue;
|
|
8928
|
+
}
|
|
8929
|
+
}
|
|
8930
|
+
return source.length;
|
|
8931
|
+
}
|
|
8932
|
+
function category(char) {
|
|
8933
|
+
return char <= '\x7E' && '\x21' <= char;
|
|
8934
|
+
}
|
|
8881
8935
|
|
|
8882
8936
|
/***/ },
|
|
8883
8937
|
|