markdown-flow-ui 0.2.36-dev.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/dist/_virtual/index.es4.js +5 -5
- package/dist/_virtual/index.es5.js +5 -5
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index5.cjs +1 -1
- package/dist/_virtual/variable-marker.cjs +2 -0
- package/dist/_virtual/variable-marker.cjs.map +1 -0
- package/dist/_virtual/variable-marker.es.js +5 -0
- package/dist/_virtual/variable-marker.es.js.map +1 -0
- package/dist/components/ContentRender/ContentRender.cjs +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
- package/dist/components/ContentRender/ContentRender.es.js +206 -205
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/utils/inline-code-ranges.cjs +9 -9
- package/dist/components/ContentRender/utils/inline-code-ranges.cjs.map +1 -1
- package/dist/components/ContentRender/utils/inline-code-ranges.d.ts +3 -0
- package/dist/components/ContentRender/utils/inline-code-ranges.es.js +185 -161
- package/dist/components/ContentRender/utils/inline-code-ranges.es.js.map +1 -1
- package/dist/components/ContentRender/utils/mermaid-parse.cjs +4 -4
- package/dist/components/ContentRender/utils/mermaid-parse.cjs.map +1 -1
- package/dist/components/ContentRender/utils/mermaid-parse.es.js +53 -48
- package/dist/components/ContentRender/utils/mermaid-parse.es.js.map +1 -1
- package/dist/components/ContentRender/utils/split-content.cjs +6 -6
- package/dist/components/ContentRender/utils/split-content.cjs.map +1 -1
- package/dist/components/ContentRender/utils/split-content.d.ts +1 -0
- package/dist/components/ContentRender/utils/split-content.es.js +361 -313
- package/dist/components/ContentRender/utils/split-content.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +278 -283
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js +57 -58
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +19 -19
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +5 -5
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +15 -15
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +13 -13
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +15 -15
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +177 -176
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs +2 -1
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.d.ts +3 -1
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js +38 -55
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.d.ts +2 -2
- package/dist/components/MarkdownFlowEditor/utils.es.js +34 -31
- package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/lib/interaction-defaults.cjs +1 -1
- package/dist/lib/interaction-defaults.cjs.map +1 -1
- package/dist/lib/interaction-defaults.es.js +124 -133
- package/dist/lib/interaction-defaults.es.js.map +1 -1
- package/dist/lib/interaction-defaults.failure.test.d.ts +1 -0
- package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
- package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
- package/dist/node_modules/remark-flow/dist/escaping.cjs +2 -2
- package/dist/node_modules/remark-flow/dist/escaping.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/escaping.es.js +128 -63
- package/dist/node_modules/remark-flow/dist/escaping.es.js.map +1 -1
- package/dist/node_modules/remark-flow/dist/index.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/index.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/index.es.js +49 -37
- package/dist/node_modules/remark-flow/dist/index.es.js.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-parser.es.js +260 -255
- package/dist/node_modules/remark-flow/dist/interaction-parser.es.js.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +71 -42
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-syntax.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-syntax.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-syntax.es.js +501 -46
- package/dist/node_modules/remark-flow/dist/interaction-syntax.es.js.map +1 -1
- package/dist/node_modules/remark-flow/dist/variable-marker.cjs +2 -0
- package/dist/node_modules/remark-flow/dist/variable-marker.cjs.map +1 -0
- package/dist/node_modules/remark-flow/dist/variable-marker.es.js +77 -0
- package/dist/node_modules/remark-flow/dist/variable-marker.es.js.map +1 -0
- package/dist/node_modules/remark-flow/dist/variable-name.cjs +14 -1
- package/dist/node_modules/remark-flow/dist/variable-name.cjs.map +1 -1
- package/dist/node_modules/remark-flow/dist/variable-name.es.js +742 -25
- package/dist/node_modules/remark-flow/dist/variable-name.es.js.map +1 -1
- package/dist/node_modules/unified/lib/index.cjs +1 -1
- package/dist/node_modules/unified/lib/index.es.js +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getMarkdownSourceAnalysis as
|
|
2
|
-
import { findResumedProseFence as
|
|
3
|
-
import { readHtmlMarkup as
|
|
4
|
-
const
|
|
1
|
+
import { getMarkdownSourceAnalysis as H, getInlineCodeRanges as Y } from "./inline-code-ranges.es.js";
|
|
2
|
+
import { findResumedProseFence as ee } from "./resumed-prose-fence.es.js";
|
|
3
|
+
import { readHtmlMarkup as F, findStreamingHtmlElementEnd as _, findStreamingHtmlBlockEnd as te, isHtmlRawTextTag as W } from "./html-block-end.es.js";
|
|
4
|
+
const ne = /<(?:!doctype(?=[\s>])|(?:script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\s/>])/i, ie = /* @__PURE__ */ new Set([
|
|
5
5
|
"div",
|
|
6
6
|
"style",
|
|
7
7
|
"script",
|
|
@@ -38,7 +38,7 @@ const Y = /<(?:!doctype(?=[\s>])|(?:script|style|link|iframe|html|head|body|meta
|
|
|
38
38
|
"title",
|
|
39
39
|
"base",
|
|
40
40
|
"template"
|
|
41
|
-
]),
|
|
41
|
+
]), se = /* @__PURE__ */ new Set([
|
|
42
42
|
"pre",
|
|
43
43
|
"details",
|
|
44
44
|
"summary",
|
|
@@ -48,7 +48,7 @@ const Y = /<(?:!doctype(?=[\s>])|(?:script|style|link|iframe|html|head|body|meta
|
|
|
48
48
|
"ol",
|
|
49
49
|
"dl",
|
|
50
50
|
"table"
|
|
51
|
-
]),
|
|
51
|
+
]), oe = /* @__PURE__ */ new Set([
|
|
52
52
|
"script",
|
|
53
53
|
"style",
|
|
54
54
|
"link",
|
|
@@ -60,448 +60,496 @@ const Y = /<(?:!doctype(?=[\s>])|(?:script|style|link|iframe|html|head|body|meta
|
|
|
60
60
|
"title",
|
|
61
61
|
"base",
|
|
62
62
|
"template"
|
|
63
|
-
]),
|
|
63
|
+
]), le = [
|
|
64
64
|
/<svg[\s\S]*?<\/svg>/i,
|
|
65
65
|
/<img\b[^>]*?>/i,
|
|
66
66
|
/```mermaid[\s\S]*?```/i,
|
|
67
67
|
/```[a-zA-Z0-9]+[\s\S]*?```/i
|
|
68
|
-
],
|
|
69
|
-
|
|
68
|
+
], $ = /!\[[^\]]*]\([^\s)\n]+(?:\s+"[^"]*")?\)/i, G = new RegExp(
|
|
69
|
+
$.source,
|
|
70
70
|
"iy"
|
|
71
|
-
),
|
|
72
|
-
const
|
|
71
|
+
), z = /<iframe\b[^>]*\bdata-tag\s*=\s*(["'])video\1[^>]*>[\s\S]*?<\/iframe>/i, K = /<\/[a-z][^>]*>\s*\n(?=[^\s<])/gi, U = /<custom-button-after-content\b[\s\S]*?<\/custom-button-after-content>/gi, j = /^"[\s\S]*"$/, ae = /```mermaid[\s\S]*?```/i, q = (e) => e.split(/\r?\n/).map((i) => i.trim()).find(Boolean) ?? "", re = (e, i = []) => {
|
|
72
|
+
const s = (a) => {
|
|
73
|
+
let l = e.indexOf("```", a);
|
|
74
|
+
for (; l !== -1 && P(l, i); )
|
|
75
|
+
l = e.indexOf("```", l + 3);
|
|
76
|
+
return l;
|
|
77
|
+
}, n = s(0);
|
|
73
78
|
if (n === -1) return null;
|
|
74
|
-
const
|
|
75
|
-
return
|
|
79
|
+
const t = s(n + 3);
|
|
80
|
+
return t === -1 ? {
|
|
76
81
|
start: n,
|
|
77
82
|
block: e.slice(n),
|
|
78
83
|
complete: !1
|
|
79
84
|
} : {
|
|
80
85
|
start: n,
|
|
81
|
-
end:
|
|
82
|
-
block: e.slice(n,
|
|
86
|
+
end: t + 3,
|
|
87
|
+
block: e.slice(n, t + 3),
|
|
83
88
|
complete: !0
|
|
84
89
|
};
|
|
85
|
-
},
|
|
86
|
-
const
|
|
87
|
-
return
|
|
88
|
-
},
|
|
89
|
-
if (!
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
const t =
|
|
90
|
+
}, ce = (e) => {
|
|
91
|
+
const i = e.split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
|
|
92
|
+
return i.length <= 1 ? e : i[0];
|
|
93
|
+
}, Z = (e, i, s = !1) => {
|
|
94
|
+
if (!j.test(e)) return e;
|
|
95
|
+
const n = e.slice(1, -1);
|
|
96
|
+
if (!i) return n;
|
|
97
|
+
const t = n.match(ae);
|
|
93
98
|
if (!t || typeof t.index != "number")
|
|
94
|
-
return
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
97
|
-
return
|
|
98
|
-
const
|
|
99
|
+
return n;
|
|
100
|
+
const a = n.slice(0, t.index), l = n.slice(t.index + t[0].length), c = q(a), r = q(l);
|
|
101
|
+
if (!c || !r)
|
|
102
|
+
return n;
|
|
103
|
+
const f = s ? `
|
|
99
104
|
` : "";
|
|
100
|
-
return `${
|
|
101
|
-
},
|
|
102
|
-
const
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
n.push({ start: t, end: l.index + 3 });
|
|
111
|
-
}
|
|
112
|
-
return n;
|
|
113
|
-
}, B = (e, n) => {
|
|
105
|
+
return `${c}${f}${t[0]}${f}${r}`;
|
|
106
|
+
}, Re = (e) => j.test(e) && T(e, !0).some((s) => s.type === "sandbox") ? Z(e, !0, !0) : e, de = (e, i = []) => {
|
|
107
|
+
const s = [], n = [...e.matchAll(/```/g)].map((t) => t.index).filter((t) => !P(t, i));
|
|
108
|
+
for (let t = 0; t < n.length; t += 2)
|
|
109
|
+
s.push({
|
|
110
|
+
start: n[t],
|
|
111
|
+
end: n[t + 1] === void 0 ? e.length : n[t + 1] + 3
|
|
112
|
+
});
|
|
113
|
+
return s;
|
|
114
|
+
}, C = (e, i) => {
|
|
114
115
|
let s = 0;
|
|
115
|
-
for (let
|
|
116
|
+
for (let n = i - 1; n >= 0 && e[n] === "\\"; n--) s++;
|
|
116
117
|
return s % 2 === 1;
|
|
117
|
-
},
|
|
118
|
-
const
|
|
119
|
-
let
|
|
120
|
-
for (; (
|
|
121
|
-
if (!
|
|
122
|
-
return
|
|
118
|
+
}, P = (e, i) => i.some(({ start: s, end: n }) => e >= s && e < n), L = (e, i, s) => {
|
|
119
|
+
const n = i.flags.includes("g") ? i.flags : `${i.flags}g`, t = new RegExp(i.source, n);
|
|
120
|
+
let a;
|
|
121
|
+
for (; (a = t.exec(e)) !== null; )
|
|
122
|
+
if (!C(e, a.index) && !P(a.index, s))
|
|
123
|
+
return a.index;
|
|
123
124
|
return -1;
|
|
124
|
-
},
|
|
125
|
-
let s = e.length,
|
|
126
|
-
for (
|
|
127
|
-
if (!(
|
|
128
|
-
s =
|
|
125
|
+
}, fe = (e, i) => {
|
|
126
|
+
let s = e.length, n;
|
|
127
|
+
for (K.lastIndex = 0; n = K.exec(e); )
|
|
128
|
+
if (!(n.index <= i)) {
|
|
129
|
+
s = n.index + n[0].length;
|
|
129
130
|
break;
|
|
130
131
|
}
|
|
131
132
|
return s;
|
|
132
|
-
},
|
|
133
|
+
}, ue = (e) => {
|
|
133
134
|
if (!e.length) return e;
|
|
134
|
-
const
|
|
135
|
+
const i = [];
|
|
135
136
|
return e.forEach((s) => {
|
|
136
137
|
if (s.type !== "sandbox") {
|
|
137
|
-
|
|
138
|
+
i.push(s);
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
|
-
|
|
141
|
-
let
|
|
142
|
-
for (; (t =
|
|
143
|
-
const
|
|
144
|
-
|
|
141
|
+
U.lastIndex = 0;
|
|
142
|
+
let n = 0, t;
|
|
143
|
+
for (; (t = U.exec(s.value)) !== null; ) {
|
|
144
|
+
const l = s.value.slice(n, t.index);
|
|
145
|
+
l.trim() && i.push({ type: "sandbox", value: l }), i.push({ type: "markdown", value: t[0] }), n = t.index + t[0].length;
|
|
145
146
|
}
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
}),
|
|
149
|
-
},
|
|
147
|
+
const a = s.value.slice(n);
|
|
148
|
+
a.trim() && i.push({ type: "sandbox", value: a });
|
|
149
|
+
}), i;
|
|
150
|
+
}, me = (e, i) => {
|
|
150
151
|
let s = null;
|
|
151
|
-
return
|
|
152
|
-
const t = i.exec(e)?.index ?? -1;
|
|
152
|
+
return le.forEach((n) => {
|
|
153
|
+
const t = i ? L(e, n, i) : n.exec(e)?.index ?? -1;
|
|
153
154
|
if (t === -1) return;
|
|
154
|
-
const
|
|
155
|
-
if (!
|
|
156
|
-
const
|
|
157
|
-
(!s || t < s.start) && (s = { start: t, end:
|
|
155
|
+
const a = n.exec(e.slice(t));
|
|
156
|
+
if (!a) return;
|
|
157
|
+
const l = t + a[0].length;
|
|
158
|
+
(!s || t < s.start) && (s = { start: t, end: l });
|
|
158
159
|
}), s;
|
|
159
|
-
},
|
|
160
|
-
const s =
|
|
160
|
+
}, he = (...e) => e.reduce((i, s) => s && (!i || s.start < i.start) ? s : i, null), X = (e, i) => {
|
|
161
|
+
const s = L(
|
|
161
162
|
e,
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
$,
|
|
164
|
+
i
|
|
164
165
|
);
|
|
165
166
|
if (s === -1) return null;
|
|
166
|
-
const
|
|
167
|
-
return
|
|
168
|
-
},
|
|
169
|
-
const s =
|
|
167
|
+
const n = e.slice(s).match($);
|
|
168
|
+
return n ? { start: s, end: s + n[0].length } : null;
|
|
169
|
+
}, pe = (e, i) => {
|
|
170
|
+
const s = L(
|
|
170
171
|
e,
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
z,
|
|
173
|
+
i
|
|
173
174
|
);
|
|
174
175
|
if (s === -1) return null;
|
|
175
|
-
const
|
|
176
|
-
return
|
|
177
|
-
},
|
|
178
|
-
if (
|
|
179
|
-
const s = e.slice(
|
|
180
|
-
if (!
|
|
181
|
-
const t =
|
|
182
|
-
start:
|
|
176
|
+
const n = e.slice(s).match(z);
|
|
177
|
+
return n ? { start: s, end: s + n[0].length } : null;
|
|
178
|
+
}, ge = (e) => z.test(e.trim()), D = (e, i) => {
|
|
179
|
+
if (i === -1) return null;
|
|
180
|
+
const s = e.slice(i), n = /^<([a-z]+)/i.exec(s);
|
|
181
|
+
if (!n) return null;
|
|
182
|
+
const t = n[1].toLowerCase(), a = () => ({
|
|
183
|
+
start: i,
|
|
183
184
|
end: e.length,
|
|
184
185
|
immediate: !0,
|
|
185
186
|
pending: !0
|
|
186
187
|
});
|
|
187
|
-
if (
|
|
188
|
-
return
|
|
189
|
-
if (t !== "iframe" || !/[\s/>]/.test(s[
|
|
188
|
+
if (n[0].length === s.length && "iframe".startsWith(t))
|
|
189
|
+
return a();
|
|
190
|
+
if (t !== "iframe" || !/[\s/>]/.test(s[n[0].length] ?? ""))
|
|
190
191
|
return null;
|
|
191
|
-
const
|
|
192
|
-
let
|
|
193
|
-
for (let
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
196
|
-
|
|
197
|
-
else if (
|
|
198
|
-
|
|
199
|
-
else if (
|
|
200
|
-
|
|
192
|
+
const l = i + n[0].length;
|
|
193
|
+
let c = "", r = -1;
|
|
194
|
+
for (let M = l; M < e.length; M += 1) {
|
|
195
|
+
const k = e[M];
|
|
196
|
+
if (c)
|
|
197
|
+
k === c && (c = "");
|
|
198
|
+
else if (k === '"' || k === "'")
|
|
199
|
+
c = k;
|
|
200
|
+
else if (k === ">") {
|
|
201
|
+
r = M + 1;
|
|
201
202
|
break;
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
|
-
if (
|
|
205
|
-
const
|
|
206
|
-
let
|
|
207
|
-
for (; (
|
|
208
|
-
if (
|
|
209
|
-
|
|
205
|
+
if (r === -1) return a();
|
|
206
|
+
const f = e.slice(l, r - 1), p = /([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]*)))?/g;
|
|
207
|
+
let o, b = !1;
|
|
208
|
+
for (; (o = p.exec(f)) !== null; )
|
|
209
|
+
if (o[1].toLowerCase() === "data-tag") {
|
|
210
|
+
b = (o[2] ?? o[3] ?? o[4] ?? "").toLowerCase() === "video";
|
|
210
211
|
break;
|
|
211
212
|
}
|
|
212
|
-
if (!
|
|
213
|
-
const
|
|
213
|
+
if (!b) return null;
|
|
214
|
+
const g = /<\/iframe\s*>/i.exec(e.slice(r));
|
|
214
215
|
return {
|
|
215
|
-
start:
|
|
216
|
-
end:
|
|
216
|
+
start: i,
|
|
217
|
+
end: g ? r + g.index + g[0].length : e.length,
|
|
217
218
|
immediate: !0
|
|
218
219
|
};
|
|
219
|
-
},
|
|
220
|
+
}, be = (e, i) => {
|
|
220
221
|
const s = /^\s*\|.+\|\s*$/gm;
|
|
221
|
-
let
|
|
222
|
-
for (; (
|
|
223
|
-
const
|
|
224
|
-
if (!
|
|
225
|
-
t =
|
|
222
|
+
let n, t = -1;
|
|
223
|
+
for (; (n = s.exec(e)) !== null; ) {
|
|
224
|
+
const r = n[0].match(/^\s*/)?.[0].length ?? 0, f = n.index + r;
|
|
225
|
+
if (!P(f, i)) {
|
|
226
|
+
t = f;
|
|
226
227
|
break;
|
|
227
228
|
}
|
|
228
229
|
}
|
|
229
230
|
if (t === -1) return null;
|
|
230
|
-
const
|
|
231
|
-
`),
|
|
232
|
-
for (const
|
|
233
|
-
if (!
|
|
234
|
-
|
|
231
|
+
const a = e.slice(t).split(`
|
|
232
|
+
`), l = [];
|
|
233
|
+
for (const r of a) {
|
|
234
|
+
if (!r.trim().startsWith("|")) break;
|
|
235
|
+
l.push(r);
|
|
235
236
|
}
|
|
236
|
-
const
|
|
237
|
+
const c = l.join(`
|
|
237
238
|
`);
|
|
238
|
-
return { start: t, block:
|
|
239
|
-
},
|
|
240
|
-
const s = /^<([a-z][a-z0-9:-]*)(?=[\s/>])/i.exec(e.slice(
|
|
241
|
-
return s ?
|
|
242
|
-
},
|
|
243
|
-
const s = /^<([a-z][a-z0-9:-]*)(?=[\s/>])/i.exec(e.slice(
|
|
244
|
-
return !!(s &&
|
|
245
|
-
},
|
|
246
|
-
let
|
|
247
|
-
for (;
|
|
248
|
-
if (e[
|
|
249
|
-
|
|
239
|
+
return { start: t, block: c, end: t + c.length };
|
|
240
|
+
}, J = (e, i) => {
|
|
241
|
+
const s = /^<([a-z][a-z0-9:-]*)(?=[\s/>])/i.exec(e.slice(i));
|
|
242
|
+
return s ? ie.has(s[1].toLowerCase()) : /^<!doctype(?=[\s>])/i.test(e.slice(i));
|
|
243
|
+
}, Q = (e, i) => {
|
|
244
|
+
const s = /^<([a-z][a-z0-9:-]*)(?=[\s/>])/i.exec(e.slice(i));
|
|
245
|
+
return !!(s && se.has(s[1].toLowerCase()));
|
|
246
|
+
}, xe = (e, i, s) => {
|
|
247
|
+
let n = i;
|
|
248
|
+
for (; n < s; ) {
|
|
249
|
+
if (e[n] !== "<") {
|
|
250
|
+
n += 1;
|
|
250
251
|
continue;
|
|
251
252
|
}
|
|
252
|
-
const t =
|
|
253
|
-
if (
|
|
253
|
+
const t = F(e, n), a = t.kind === "tag" ? t.closing ? void 0 : t.name : /^<([a-z][a-z0-9:-]*)(?=[\s/>])/i.exec(e.slice(n))?.[1].toLowerCase();
|
|
254
|
+
if (a && oe.has(a) && !(a === "iframe" && D(e, n)))
|
|
254
255
|
return !0;
|
|
255
256
|
if (t.kind === "incomplete" || t.kind === "invalid") {
|
|
256
257
|
if (t.kind === "incomplete") break;
|
|
257
|
-
|
|
258
|
+
n += 1;
|
|
258
259
|
continue;
|
|
259
260
|
}
|
|
260
|
-
if (t.kind === "tag" && !t.closing &&
|
|
261
|
-
|
|
261
|
+
if (t.kind === "tag" && !t.closing && W(t.name)) {
|
|
262
|
+
n = _(e, n);
|
|
262
263
|
continue;
|
|
263
264
|
}
|
|
264
|
-
|
|
265
|
+
n = t.end;
|
|
265
266
|
}
|
|
266
267
|
return !1;
|
|
267
|
-
},
|
|
268
|
-
const
|
|
269
|
-
for (let
|
|
270
|
-
const
|
|
271
|
-
|
|
268
|
+
}, ke = (e) => {
|
|
269
|
+
const i = /* @__PURE__ */ new Map(), s = [...e.matchAll(/`+|\$+/g)], n = /* @__PURE__ */ new Map();
|
|
270
|
+
for (let l = s.length - 1; l >= 0; l -= 1) {
|
|
271
|
+
const c = s[l], r = c[0], f = n.get(r);
|
|
272
|
+
f !== void 0 && i.set(c.index, f + r.length), (r[0] === "`" || !C(e, c.index)) && n.set(r, c.index);
|
|
272
273
|
}
|
|
273
274
|
const t = [];
|
|
274
|
-
let
|
|
275
|
-
for (const
|
|
275
|
+
let a = 0;
|
|
276
|
+
for (const l of e.split(`
|
|
276
277
|
`)) {
|
|
277
|
-
const
|
|
278
|
-
(!
|
|
278
|
+
const c = a + (l.match(/^[ \t]*/)?.[0].length ?? 0);
|
|
279
|
+
(!l.trim() || J(e, c)) && t.push(a), a += l.length + 1;
|
|
279
280
|
}
|
|
280
|
-
return { nextClosing:
|
|
281
|
-
},
|
|
282
|
-
const
|
|
283
|
-
if (
|
|
281
|
+
return { nextClosing: i, boundaries: t };
|
|
282
|
+
}, ve = (e, i, s) => {
|
|
283
|
+
const n = e[i];
|
|
284
|
+
if (n !== "`" && n !== "$" || C(e, i)) return;
|
|
284
285
|
let t = 1;
|
|
285
|
-
for (; e[
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
288
|
-
if (
|
|
289
|
-
let
|
|
290
|
-
for (;
|
|
291
|
-
const
|
|
292
|
-
s.boundaries[
|
|
286
|
+
for (; e[i + t] === n; ) t += 1;
|
|
287
|
+
const a = i + t, l = n === "$" && t > 2 ? void 0 : s.nextClosing.get(i);
|
|
288
|
+
if (l === void 0) return { markerEnd: a };
|
|
289
|
+
if (n === "$" && t === 2) return { markerEnd: a, end: l };
|
|
290
|
+
let c = 0, r = s.boundaries.length;
|
|
291
|
+
for (; c < r; ) {
|
|
292
|
+
const f = c + r >>> 1;
|
|
293
|
+
s.boundaries[f] <= i ? c = f + 1 : r = f;
|
|
293
294
|
}
|
|
294
|
-
return
|
|
295
|
-
},
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
return l <= (s.boundaries[c] ?? e.length) ? { markerEnd: a, end: l } : { markerEnd: a };
|
|
296
|
+
}, Se = (e, i, s) => {
|
|
297
|
+
if (i.pending) {
|
|
298
|
+
s.push({
|
|
299
|
+
type: "sandbox",
|
|
300
|
+
value: e.slice(i.start, i.end),
|
|
301
|
+
pending: !0
|
|
302
|
+
});
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
let n = i.start, t = n;
|
|
306
|
+
for (; t < i.end; ) {
|
|
298
307
|
if (e[t] !== "<") {
|
|
299
308
|
t += 1;
|
|
300
309
|
continue;
|
|
301
310
|
}
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
304
|
-
if (
|
|
311
|
+
const a = F(e, t);
|
|
312
|
+
if (a.kind === "incomplete") break;
|
|
313
|
+
if (a.kind === "invalid") {
|
|
305
314
|
t += 1;
|
|
306
315
|
continue;
|
|
307
316
|
}
|
|
308
|
-
if (
|
|
309
|
-
if (
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
317
|
+
if (a.kind === "tag" && !a.closing) {
|
|
318
|
+
if (a.name === "custom-button-after-content") {
|
|
319
|
+
const l = Math.min(
|
|
320
|
+
_(e, t),
|
|
321
|
+
i.end
|
|
313
322
|
);
|
|
314
323
|
if (/<\/custom-button-after-content\s*>$/i.test(
|
|
315
|
-
e.slice(t,
|
|
324
|
+
e.slice(t, l)
|
|
316
325
|
)) {
|
|
317
|
-
t >
|
|
326
|
+
t > n && s.push({
|
|
318
327
|
type: "sandbox",
|
|
319
|
-
value: e.slice(
|
|
328
|
+
value: e.slice(n, t)
|
|
320
329
|
}), s.push({
|
|
321
330
|
type: "markdown",
|
|
322
|
-
value: e.slice(t,
|
|
323
|
-
}),
|
|
331
|
+
value: e.slice(t, l)
|
|
332
|
+
}), n = l, t = l;
|
|
324
333
|
continue;
|
|
325
334
|
}
|
|
326
335
|
}
|
|
327
|
-
if (
|
|
328
|
-
t =
|
|
336
|
+
if (W(a.name)) {
|
|
337
|
+
t = _(e, t);
|
|
329
338
|
continue;
|
|
330
339
|
}
|
|
331
340
|
}
|
|
332
|
-
t =
|
|
341
|
+
t = a.end;
|
|
333
342
|
}
|
|
334
|
-
|
|
335
|
-
},
|
|
336
|
-
const
|
|
343
|
+
n < i.end && s.push({ type: "sandbox", value: e.slice(n, i.end) });
|
|
344
|
+
}, ye = (e, i, s) => {
|
|
345
|
+
const n = [], t = e.split(`
|
|
337
346
|
`);
|
|
338
|
-
let
|
|
339
|
-
for (let
|
|
340
|
-
const
|
|
341
|
-
for (;
|
|
342
|
-
const
|
|
343
|
-
if (/^[ \t]*\|.+\|[ \t]*\r?$/.test(
|
|
344
|
-
let
|
|
345
|
-
for (;
|
|
346
|
-
|
|
347
|
-
for (; s[
|
|
348
|
-
s[
|
|
347
|
+
let a = 0, l = 0, c = 0;
|
|
348
|
+
for (let r = 0; r < t.length; r += 1) {
|
|
349
|
+
const f = t[r], p = a + (f.match(/^[ \t]*/)?.[0].length ?? 0);
|
|
350
|
+
for (; i[l]?.end <= p; ) l += 1;
|
|
351
|
+
const o = i[l];
|
|
352
|
+
if (/^[ \t]*\|.+\|[ \t]*\r?$/.test(f) && !(o && o.start <= p)) {
|
|
353
|
+
let b = a + f.length;
|
|
354
|
+
for (; r + 1 < t.length && t[r + 1].trim().startsWith("|"); )
|
|
355
|
+
a += t[r].length + 1, r += 1, b = a + t[r].length;
|
|
356
|
+
for (; s[c]?.end <= p; ) c += 1;
|
|
357
|
+
s[c]?.start < b || n.push({ start: p, end: b, type: "markdown" });
|
|
349
358
|
}
|
|
350
|
-
|
|
359
|
+
a += t[r].length + 1;
|
|
351
360
|
}
|
|
352
|
-
return
|
|
353
|
-
},
|
|
354
|
-
const
|
|
355
|
-
let r = 0,
|
|
361
|
+
return n;
|
|
362
|
+
}, Ee = (e, i, s) => {
|
|
363
|
+
const n = [], t = new Set(s.comments), a = s.literal.filter((u) => !t.has(u)), l = [];
|
|
364
|
+
let c = 0, r = 0, f = 0, p = 0, o = 0, b = !1, g;
|
|
356
365
|
for (; o < e.length; ) {
|
|
357
|
-
for (; s.fences[
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
|
|
366
|
+
for (; s.fences[r]?.end <= o; ) r += 1;
|
|
367
|
+
const u = s.fences[r];
|
|
368
|
+
if (u?.start === o) {
|
|
369
|
+
n.push({ ...u, type: "markdown" }), l.push(u), o = u.end;
|
|
361
370
|
continue;
|
|
362
371
|
}
|
|
363
|
-
for (;
|
|
364
|
-
const
|
|
365
|
-
if (
|
|
366
|
-
|
|
372
|
+
for (; a[c]?.end <= o; ) c += 1;
|
|
373
|
+
const A = a[c];
|
|
374
|
+
if (A && A.start <= o) {
|
|
375
|
+
l.push(A), o = A.end;
|
|
367
376
|
continue;
|
|
368
377
|
}
|
|
369
|
-
for (; s.html[
|
|
370
|
-
const
|
|
371
|
-
if (
|
|
372
|
-
const
|
|
373
|
-
if (
|
|
374
|
-
for (
|
|
375
|
-
o =
|
|
378
|
+
for (; s.html[f]?.end <= o; ) f += 1;
|
|
379
|
+
const I = s.html[f];
|
|
380
|
+
if (b && I && I.start <= o) {
|
|
381
|
+
const h = ee(e, o);
|
|
382
|
+
if (h) {
|
|
383
|
+
for (n.push(h), l.push(h); a[c]?.start < h.end; ) c += 1;
|
|
384
|
+
o = h.end;
|
|
376
385
|
continue;
|
|
377
386
|
}
|
|
378
|
-
(e[o] === "`" || e[o] === "$") && (
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
381
|
-
|
|
387
|
+
(e[o] === "`" || e[o] === "$") && (g ??= ke(e));
|
|
388
|
+
const S = g && ve(e, o, g);
|
|
389
|
+
if (S) {
|
|
390
|
+
S.end !== void 0 && l.push({ start: o, end: S.end }), o = S.end ?? S.markerEnd;
|
|
382
391
|
continue;
|
|
383
392
|
}
|
|
384
393
|
}
|
|
385
|
-
if (e[o] === "!" && !
|
|
386
|
-
|
|
387
|
-
const
|
|
388
|
-
if (
|
|
389
|
-
|
|
394
|
+
if (e[o] === "!" && !C(e, o)) {
|
|
395
|
+
G.lastIndex = o;
|
|
396
|
+
const h = G.exec(e);
|
|
397
|
+
if (h) {
|
|
398
|
+
n.push({
|
|
390
399
|
start: o,
|
|
391
|
-
end: o +
|
|
400
|
+
end: o + h[0].length,
|
|
392
401
|
type: "markdown"
|
|
393
|
-
}), o +=
|
|
402
|
+
}), o += h[0].length;
|
|
394
403
|
continue;
|
|
395
404
|
}
|
|
396
405
|
}
|
|
397
|
-
if (e[o] !== "<" ||
|
|
406
|
+
if (e[o] !== "<" || C(e, o)) {
|
|
398
407
|
o += 1;
|
|
399
408
|
continue;
|
|
400
409
|
}
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
410
|
+
const d = F(e, o);
|
|
411
|
+
for (; s.interactions[p]?.end <= o; )
|
|
412
|
+
p += 1;
|
|
413
|
+
const O = s.interactions[p], v = I?.start === o && O && O.start >= I.end ? I.end : void 0;
|
|
414
|
+
if (J(e, o)) {
|
|
415
|
+
const h = D(e, o), S = Q(e, o);
|
|
416
|
+
let m = h?.end ?? (S ? _(e, o) : te(e, o, (y) => {
|
|
417
|
+
const V = D(e, y);
|
|
418
|
+
return !!(V && !V.pending) || Q(e, y);
|
|
419
|
+
}));
|
|
420
|
+
I?.start === o && (d.kind === "declaration" || d.kind === "tag" && ["script", "style", "pre", "textarea"].includes(d.name)) && s.documentVariables.some(
|
|
421
|
+
(y) => y.start >= m && y.start < I.end
|
|
422
|
+
) && (m = Math.max(m, I.end));
|
|
423
|
+
const x = v !== void 0 && m > v, w = x && (d.kind === "incomplete" || d.kind === "tag" && ["script", "style", "pre", "textarea"].includes(d.name) && s.documentVariables.some(
|
|
424
|
+
(y) => y.start > o && y.start < d.end
|
|
425
|
+
));
|
|
426
|
+
x && (m = v);
|
|
427
|
+
const B = S && !w && !xe(e, o, m);
|
|
428
|
+
n.push({
|
|
408
429
|
start: o,
|
|
409
|
-
end:
|
|
410
|
-
type:
|
|
411
|
-
...
|
|
412
|
-
...
|
|
413
|
-
}), o =
|
|
430
|
+
end: m,
|
|
431
|
+
type: h || B ? "markdown" : "sandbox",
|
|
432
|
+
...h?.immediate || B ? { immediate: !0 } : {},
|
|
433
|
+
...h?.pending || w || B && d.kind === "incomplete" ? { pending: !0 } : {}
|
|
434
|
+
}), o = m, b = !0;
|
|
414
435
|
continue;
|
|
415
436
|
}
|
|
416
|
-
if (
|
|
417
|
-
if (!
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
} else if (!
|
|
421
|
-
const
|
|
422
|
-
|
|
437
|
+
if (d.kind === "tag")
|
|
438
|
+
if (!d.closing && (d.name === "svg" || d.name === "img")) {
|
|
439
|
+
const h = d.name === "img" ? d.end : _(e, o);
|
|
440
|
+
n.push({ start: o, end: h, type: "markdown" }), o = h;
|
|
441
|
+
} else if (!d.closing && W(d.name)) {
|
|
442
|
+
const h = _(e, o);
|
|
443
|
+
if (v !== void 0 && h > v) {
|
|
444
|
+
n.push({
|
|
445
|
+
start: o,
|
|
446
|
+
end: v,
|
|
447
|
+
type: "sandbox",
|
|
448
|
+
pending: !0
|
|
449
|
+
}), o = v;
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
l.push({ start: o, end: h }), o = h;
|
|
423
453
|
} else
|
|
424
|
-
o =
|
|
425
|
-
else
|
|
454
|
+
o = d.end;
|
|
455
|
+
else if (d.kind === "comment" || d.kind === "declaration")
|
|
456
|
+
d.kind === "comment" && l.push({ start: o, end: d.end }), o = d.end;
|
|
457
|
+
else if (d.kind === "incomplete") {
|
|
458
|
+
if (v !== void 0) {
|
|
459
|
+
n.push({
|
|
460
|
+
start: o,
|
|
461
|
+
end: v,
|
|
462
|
+
type: "sandbox",
|
|
463
|
+
pending: !0
|
|
464
|
+
}), o = v;
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
/^<svg(?=[\s/>])/i.test(e.slice(o)) && n.push({ start: o, end: e.length, type: "markdown" }), o = e.length;
|
|
468
|
+
} else
|
|
469
|
+
o += 1;
|
|
426
470
|
}
|
|
427
|
-
const
|
|
428
|
-
let
|
|
429
|
-
for (const
|
|
430
|
-
for (;
|
|
431
|
-
|
|
432
|
-
|
|
471
|
+
const M = ye(e, l, n), k = [];
|
|
472
|
+
let N = 0;
|
|
473
|
+
for (const u of n) {
|
|
474
|
+
for (; M[N]?.start < u.start; )
|
|
475
|
+
k.push(M[N++]);
|
|
476
|
+
k.push(u);
|
|
433
477
|
}
|
|
434
|
-
|
|
435
|
-
const
|
|
436
|
-
let
|
|
437
|
-
for (const
|
|
438
|
-
|
|
478
|
+
k.push(...M.slice(N));
|
|
479
|
+
const R = [];
|
|
480
|
+
let E = 0;
|
|
481
|
+
for (const u of k)
|
|
482
|
+
u.start < E || (i && u.start > E && R.push({ type: "text", value: e.slice(E, u.start) }), u.type === "sandbox" ? Se(e, u, R) : R.push({
|
|
439
483
|
type: "markdown",
|
|
440
|
-
value: e.slice(
|
|
441
|
-
...
|
|
442
|
-
...
|
|
443
|
-
}),
|
|
444
|
-
return
|
|
445
|
-
},
|
|
484
|
+
value: e.slice(u.start, u.end),
|
|
485
|
+
...u.immediate ? { immediate: !0 } : {},
|
|
486
|
+
...u.pending ? { pending: !0 } : {}
|
|
487
|
+
}), E = u.end);
|
|
488
|
+
return i && E < e.length && R.push({ type: "text", value: e.slice(E) }), R;
|
|
489
|
+
}, T = (e, i = !1, s = !1, n) => {
|
|
446
490
|
if (s)
|
|
447
|
-
return
|
|
491
|
+
return Ee(
|
|
448
492
|
e,
|
|
449
|
-
|
|
450
|
-
|
|
493
|
+
i,
|
|
494
|
+
n ?? H(e)
|
|
451
495
|
);
|
|
452
|
-
const t =
|
|
496
|
+
const t = Z(e, i), a = (m) => ue(m), l = (m) => !!m.trim(), r = H(t).variables, f = Y(t), p = re(t, r), o = [
|
|
497
|
+
...de(t, r),
|
|
498
|
+
...f,
|
|
499
|
+
...r
|
|
500
|
+
], b = L(
|
|
453
501
|
t,
|
|
454
|
-
|
|
455
|
-
|
|
502
|
+
ne,
|
|
503
|
+
o
|
|
456
504
|
);
|
|
457
|
-
if (
|
|
458
|
-
if (!
|
|
459
|
-
return
|
|
460
|
-
{ type: "markdown", value:
|
|
505
|
+
if (p) {
|
|
506
|
+
if (!p.complete)
|
|
507
|
+
return a([
|
|
508
|
+
{ type: "markdown", value: i ? t : p.block }
|
|
461
509
|
]);
|
|
462
|
-
if (!
|
|
463
|
-
return
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
return
|
|
510
|
+
if (!i)
|
|
511
|
+
return a([{ type: "markdown", value: p.block }]);
|
|
512
|
+
const m = [], x = ce(t.slice(0, p.start));
|
|
513
|
+
l(x) && m.push({ type: "text", value: x }), m.push({ type: "markdown", value: p.block });
|
|
514
|
+
const w = t.slice(p.end);
|
|
515
|
+
return l(w) && m.push(...T(w, !0)), a(m);
|
|
468
516
|
}
|
|
469
|
-
const
|
|
517
|
+
const g = L(
|
|
470
518
|
t,
|
|
471
519
|
/<svg\b/i,
|
|
472
|
-
|
|
473
|
-
),
|
|
474
|
-
if (
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
const
|
|
478
|
-
return
|
|
520
|
+
o
|
|
521
|
+
), M = b !== -1 && g !== -1 && b < g, k = X(t, o), N = !!k && g !== -1 && k.start < g;
|
|
522
|
+
if (g !== -1 && !M && !N) {
|
|
523
|
+
const m = t.slice(0, g), x = t.indexOf("</svg>", g), w = x === -1 ? `${t.slice(g)}</svg>` : t.slice(g, x + 6), B = x === -1 ? "" : t.slice(x + 6);
|
|
524
|
+
if (i) {
|
|
525
|
+
const y = [];
|
|
526
|
+
return l(m) && y.push({ type: "text", value: m }), y.push({ type: "markdown", value: w }), l(B) && y.push(...T(B, !0)), a(y);
|
|
479
527
|
}
|
|
480
|
-
if (
|
|
481
|
-
return
|
|
528
|
+
if (x === -1)
|
|
529
|
+
return a([{ type: "markdown", value: w }]);
|
|
482
530
|
}
|
|
483
|
-
const
|
|
484
|
-
if (
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
const
|
|
488
|
-
return
|
|
531
|
+
const R = be(t, r);
|
|
532
|
+
if (R) {
|
|
533
|
+
const m = [], x = t.slice(0, R.start);
|
|
534
|
+
i && l(x) && m.push(...T(x, !0)), m.push({ type: "markdown", value: R.block });
|
|
535
|
+
const w = t.slice(R.end);
|
|
536
|
+
return l(w) && w.length < t.length && m.push(...T(w, i)), a(m);
|
|
489
537
|
}
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
538
|
+
const E = he(
|
|
539
|
+
me(t, r),
|
|
540
|
+
X(t, o),
|
|
541
|
+
pe(t, o)
|
|
494
542
|
);
|
|
495
|
-
if (
|
|
496
|
-
return
|
|
497
|
-
const
|
|
498
|
-
return
|
|
499
|
-
type:
|
|
500
|
-
value:
|
|
501
|
-
}),
|
|
543
|
+
if (b === -1 && !E)
|
|
544
|
+
return i && l(t) ? [{ type: "text", value: t }] : [];
|
|
545
|
+
const u = !!E && (b === -1 || E.start <= b), A = u ? E.start : b, I = u ? E.end : fe(t, A), d = t.slice(A, I), O = u && ge(d), v = O ? t.slice(0, A).trimEnd() : t.slice(0, A), h = O ? t.slice(I).trimStart() : t.slice(I), S = [];
|
|
546
|
+
return i && l(v) && S.push({ type: "text", value: v }), S.push({
|
|
547
|
+
type: u ? "markdown" : "sandbox",
|
|
548
|
+
value: d
|
|
549
|
+
}), l(h) && S.push(...T(h, i)), a(S);
|
|
502
550
|
};
|
|
503
551
|
export {
|
|
504
|
-
|
|
505
|
-
|
|
552
|
+
Re as normalizeWrappedSandboxContent,
|
|
553
|
+
T as splitContentSegments
|
|
506
554
|
};
|
|
507
555
|
//# sourceMappingURL=split-content.es.js.map
|