markdown-flow-ui 0.2.36-dev.1 → 0.3.0-dev.1

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.
Files changed (159) hide show
  1. package/README.md +11 -11
  2. package/dist/_virtual/index.es10.js +2 -2
  3. package/dist/_virtual/index.es3.js +5 -4
  4. package/dist/_virtual/index.es3.js.map +1 -1
  5. package/dist/_virtual/index.es4.js +4 -5
  6. package/dist/_virtual/index.es4.js.map +1 -1
  7. package/dist/_virtual/index.es5.js +5 -5
  8. package/dist/_virtual/index.es6.js +5 -3
  9. package/dist/_virtual/index.es6.js.map +1 -1
  10. package/dist/_virtual/index.es7.js +3 -5
  11. package/dist/_virtual/index.es7.js.map +1 -1
  12. package/dist/_virtual/index.es9.js +2 -2
  13. package/dist/_virtual/index10.cjs +1 -1
  14. package/dist/_virtual/index3.cjs +1 -1
  15. package/dist/_virtual/index4.cjs +1 -1
  16. package/dist/_virtual/index5.cjs +1 -1
  17. package/dist/_virtual/index6.cjs +1 -1
  18. package/dist/_virtual/index7.cjs +1 -1
  19. package/dist/_virtual/index9.cjs +1 -1
  20. package/dist/_virtual/variable-marker.cjs +2 -0
  21. package/dist/_virtual/variable-marker.cjs.map +1 -0
  22. package/dist/_virtual/variable-marker.es.js +5 -0
  23. package/dist/_virtual/variable-marker.es.js.map +1 -0
  24. package/dist/components/ContentRender/ContentRender.cjs +2 -2
  25. package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
  26. package/dist/components/ContentRender/ContentRender.es.js +206 -205
  27. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  28. package/dist/components/ContentRender/utils/inline-code-ranges.cjs +9 -9
  29. package/dist/components/ContentRender/utils/inline-code-ranges.cjs.map +1 -1
  30. package/dist/components/ContentRender/utils/inline-code-ranges.d.ts +3 -0
  31. package/dist/components/ContentRender/utils/inline-code-ranges.es.js +185 -161
  32. package/dist/components/ContentRender/utils/inline-code-ranges.es.js.map +1 -1
  33. package/dist/components/ContentRender/utils/mermaid-parse.cjs +4 -4
  34. package/dist/components/ContentRender/utils/mermaid-parse.cjs.map +1 -1
  35. package/dist/components/ContentRender/utils/mermaid-parse.es.js +53 -48
  36. package/dist/components/ContentRender/utils/mermaid-parse.es.js.map +1 -1
  37. package/dist/components/ContentRender/utils/split-content.cjs +6 -6
  38. package/dist/components/ContentRender/utils/split-content.cjs.map +1 -1
  39. package/dist/components/ContentRender/utils/split-content.d.ts +1 -0
  40. package/dist/components/ContentRender/utils/split-content.es.js +361 -313
  41. package/dist/components/ContentRender/utils/split-content.es.js.map +1 -1
  42. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
  43. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
  44. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +278 -283
  45. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
  46. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs +1 -1
  47. package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs.map +1 -1
  48. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js +57 -58
  49. package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js.map +1 -1
  50. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
  51. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +1 -1
  52. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +1 -1
  53. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
  54. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +1 -1
  55. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +19 -19
  56. package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
  57. package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +1 -1
  58. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +5 -5
  59. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
  60. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +1 -1
  61. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +1 -1
  62. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
  63. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +1 -1
  64. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +15 -15
  65. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
  66. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +1 -1
  67. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +13 -13
  68. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
  69. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +1 -1
  70. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +1 -1
  71. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
  72. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +1 -1
  73. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +1 -1
  74. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
  75. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +1 -1
  76. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +1 -1
  77. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
  78. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +1 -1
  79. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +15 -15
  80. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
  81. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +1 -1
  82. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +1 -1
  83. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
  84. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
  85. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +177 -176
  86. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
  87. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs +2 -1
  88. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs.map +1 -1
  89. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.d.ts +3 -1
  90. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js +38 -55
  91. package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js.map +1 -1
  92. package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
  93. package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
  94. package/dist/components/MarkdownFlowEditor/utils.d.ts +2 -2
  95. package/dist/components/MarkdownFlowEditor/utils.es.js +34 -31
  96. package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
  97. package/dist/components/ui/inputGroup/textarea.cjs +1 -1
  98. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  99. package/dist/lib/interaction-defaults.cjs +1 -1
  100. package/dist/lib/interaction-defaults.cjs.map +1 -1
  101. package/dist/lib/interaction-defaults.es.js +124 -133
  102. package/dist/lib/interaction-defaults.es.js.map +1 -1
  103. package/dist/lib/interaction-defaults.failure.test.d.ts +1 -0
  104. package/dist/node_modules/classnames/index.cjs +1 -1
  105. package/dist/node_modules/classnames/index.es.js +1 -1
  106. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs +1 -1
  107. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  108. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-AAMF2YG6.cjs +1 -1
  109. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-AAMF2YG6.es.js +1 -1
  110. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-OMD6QJNC.cjs +1 -1
  111. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-OMD6QJNC.es.js +1 -1
  112. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U37J5Y7L.cjs +1 -1
  113. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U37J5Y7L.es.js +1 -1
  114. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-WV7ZQ7D5.cjs +1 -1
  115. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-WV7ZQ7D5.es.js +1 -1
  116. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-4MX5Z3NR.cjs +1 -1
  117. package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-4MX5Z3NR.es.js +1 -1
  118. package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
  119. package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
  120. package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
  121. package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  122. package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
  123. package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  124. package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
  125. package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
  126. package/dist/node_modules/remark-flow/dist/escaping.cjs +2 -2
  127. package/dist/node_modules/remark-flow/dist/escaping.cjs.map +1 -1
  128. package/dist/node_modules/remark-flow/dist/escaping.es.js +128 -63
  129. package/dist/node_modules/remark-flow/dist/escaping.es.js.map +1 -1
  130. package/dist/node_modules/remark-flow/dist/index.cjs +1 -1
  131. package/dist/node_modules/remark-flow/dist/index.cjs.map +1 -1
  132. package/dist/node_modules/remark-flow/dist/index.es.js +49 -37
  133. package/dist/node_modules/remark-flow/dist/index.es.js.map +1 -1
  134. package/dist/node_modules/remark-flow/dist/interaction-parser.cjs +1 -1
  135. package/dist/node_modules/remark-flow/dist/interaction-parser.cjs.map +1 -1
  136. package/dist/node_modules/remark-flow/dist/interaction-parser.es.js +260 -255
  137. package/dist/node_modules/remark-flow/dist/interaction-parser.es.js.map +1 -1
  138. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
  139. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs.map +1 -1
  140. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +71 -42
  141. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js.map +1 -1
  142. package/dist/node_modules/remark-flow/dist/interaction-syntax.cjs +1 -1
  143. package/dist/node_modules/remark-flow/dist/interaction-syntax.cjs.map +1 -1
  144. package/dist/node_modules/remark-flow/dist/interaction-syntax.es.js +500 -46
  145. package/dist/node_modules/remark-flow/dist/interaction-syntax.es.js.map +1 -1
  146. package/dist/node_modules/remark-flow/dist/variable-marker.cjs +2 -0
  147. package/dist/node_modules/remark-flow/dist/variable-marker.cjs.map +1 -0
  148. package/dist/node_modules/remark-flow/dist/variable-marker.es.js +77 -0
  149. package/dist/node_modules/remark-flow/dist/variable-marker.es.js.map +1 -0
  150. package/dist/node_modules/remark-flow/dist/variable-name.cjs +14 -1
  151. package/dist/node_modules/remark-flow/dist/variable-name.cjs.map +1 -1
  152. package/dist/node_modules/remark-flow/dist/variable-name.es.js +742 -25
  153. package/dist/node_modules/remark-flow/dist/variable-name.es.js.map +1 -1
  154. package/dist/node_modules/style-to-object/cjs/index.cjs +1 -1
  155. package/dist/node_modules/style-to-object/cjs/index.cjs.map +1 -1
  156. package/dist/node_modules/style-to-object/cjs/index.es.js +1 -1
  157. package/dist/node_modules/unified/lib/index.cjs +1 -1
  158. package/dist/node_modules/unified/lib/index.es.js +1 -1
  159. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
- import { getMarkdownSourceAnalysis as Q, getInlineCodeRanges as j } from "./inline-code-ranges.es.js";
2
- import { findResumedProseFence as Z } from "./resumed-prose-fence.es.js";
3
- import { readHtmlMarkup as P, findStreamingHtmlElementEnd as A, findStreamingHtmlBlockEnd as J, isHtmlRawTextTag as $ } from "./html-block-end.es.js";
4
- const Y = /<(?:!doctype(?=[\s>])|(?:script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\s/>])/i, ee = /* @__PURE__ */ new Set([
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
- ]), te = /* @__PURE__ */ new Set([
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
- ]), ne = /* @__PURE__ */ new Set([
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
- ]), ie = [
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
- ], O = /!\[[^\]]*]\([^\s)\n]+(?:\s+"[^"]*")?\)/i, D = new RegExp(
69
- O.source,
68
+ ], $ = /!\[[^\]]*]\([^\s)\n]+(?:\s+"[^"]*")?\)/i, G = new RegExp(
69
+ $.source,
70
70
  "iy"
71
- ), L = /<iframe\b[^>]*\bdata-tag\s*=\s*(["'])video\1[^>]*>[\s\S]*?<\/iframe>/i, W = /<\/[a-z][^>]*>\s*\n(?=[^\s<])/gi, F = /<custom-button-after-content\b[\s\S]*?<\/custom-button-after-content>/gi, K = /^"[\s\S]*"$/, se = /```mermaid[\s\S]*?```/i, H = (e) => e.split(/\r?\n/).map((n) => n.trim()).find(Boolean) ?? "", oe = (e) => {
72
- const n = e.indexOf("```");
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 s = e.indexOf("```", n + 3);
75
- return s === -1 ? {
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: s + 3,
82
- block: e.slice(n, s + 3),
86
+ end: t + 3,
87
+ block: e.slice(n, t + 3),
83
88
  complete: !0
84
89
  };
85
- }, le = (e) => {
86
- const n = e.split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
87
- return n.length <= 1 ? e : n[0];
88
- }, U = (e, n, s = !1) => {
89
- if (!K.test(e)) return e;
90
- const i = e.slice(1, -1);
91
- if (!n) return i;
92
- const t = i.match(se);
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 i;
95
- const l = i.slice(0, t.index), a = i.slice(t.index + t[0].length), r = H(l), c = H(a);
96
- if (!r || !c)
97
- return i;
98
- const d = s ? `
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 `${r}${d}${t[0]}${d}${c}`;
101
- }, Ie = (e) => K.test(e) && w(e, !0).some((s) => s.type === "sandbox") ? U(e, !0, !0) : e, ae = (e) => {
102
- const n = [], s = /```/g;
103
- let i;
104
- for (; (i = s.exec(e)) !== null; ) {
105
- const t = i.index, l = s.exec(e);
106
- if (!l) {
107
- n.push({ start: t, end: e.length });
108
- break;
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 i = n - 1; i >= 0 && e[i] === "\\"; i--) s++;
116
+ for (let n = i - 1; n >= 0 && e[n] === "\\"; n--) s++;
116
117
  return s % 2 === 1;
117
- }, q = (e, n) => n.some(({ start: s, end: i }) => e >= s && e < i), N = (e, n, s) => {
118
- const i = n.flags.includes("g") ? n.flags : `${n.flags}g`, t = new RegExp(n.source, i);
119
- let l;
120
- for (; (l = t.exec(e)) !== null; )
121
- if (!B(e, l.index) && !q(l.index, s))
122
- return l.index;
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
- }, ce = (e, n) => {
125
- let s = e.length, i;
126
- for (W.lastIndex = 0; i = W.exec(e); )
127
- if (!(i.index <= n)) {
128
- s = i.index + i[0].length;
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
- }, re = (e) => {
133
+ }, ue = (e) => {
133
134
  if (!e.length) return e;
134
- const n = [];
135
+ const i = [];
135
136
  return e.forEach((s) => {
136
137
  if (s.type !== "sandbox") {
137
- n.push(s);
138
+ i.push(s);
138
139
  return;
139
140
  }
140
- F.lastIndex = 0;
141
- let i = 0, t;
142
- for (; (t = F.exec(s.value)) !== null; ) {
143
- const a = s.value.slice(i, t.index);
144
- a.trim() && n.push({ type: "sandbox", value: a }), n.push({ type: "markdown", value: t[0] }), i = t.index + t[0].length;
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 l = s.value.slice(i);
147
- l.trim() && n.push({ type: "sandbox", value: l });
148
- }), n;
149
- }, de = (e, n) => {
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 ie.forEach((i) => {
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 l = i.exec(e.slice(t));
155
- if (!l) return;
156
- const a = t + l[0].length;
157
- (!s || t < s.start) && (s = { start: t, end: a });
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
- }, fe = (...e) => e.reduce((n, s) => s && (!n || s.start < n.start) ? s : n, null), V = (e, n) => {
160
- const s = N(
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
- O,
163
- n
163
+ $,
164
+ i
164
165
  );
165
166
  if (s === -1) return null;
166
- const i = e.slice(s).match(O);
167
- return i ? { start: s, end: s + i[0].length } : null;
168
- }, me = (e, n) => {
169
- const s = N(
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
- L,
172
- n
172
+ z,
173
+ i
173
174
  );
174
175
  if (s === -1) return null;
175
- const i = e.slice(s).match(L);
176
- return i ? { start: s, end: s + i[0].length } : null;
177
- }, ue = (e) => L.test(e.trim()), C = (e, n) => {
178
- if (n === -1) return null;
179
- const s = e.slice(n), i = /^<([a-z]+)/i.exec(s);
180
- if (!i) return null;
181
- const t = i[1].toLowerCase(), l = () => ({
182
- start: n,
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 (i[0].length === s.length && "iframe".startsWith(t))
188
- return l();
189
- if (t !== "iframe" || !/[\s/>]/.test(s[i[0].length] ?? ""))
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 a = n + i[0].length;
192
- let r = "", c = -1;
193
- for (let v = a; v < e.length; v += 1) {
194
- const p = e[v];
195
- if (r)
196
- p === r && (r = "");
197
- else if (p === '"' || p === "'")
198
- r = p;
199
- else if (p === ">") {
200
- c = v + 1;
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 (c === -1) return l();
205
- const d = e.slice(a, c - 1), o = /([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]*)))?/g;
206
- let u, x = !1;
207
- for (; (u = o.exec(d)) !== null; )
208
- if (u[1].toLowerCase() === "data-tag") {
209
- x = (u[2] ?? u[3] ?? u[4] ?? "").toLowerCase() === "video";
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 (!x) return null;
213
- const I = /<\/iframe\s*>/i.exec(e.slice(c));
213
+ if (!b) return null;
214
+ const g = /<\/iframe\s*>/i.exec(e.slice(r));
214
215
  return {
215
- start: n,
216
- end: I ? c + I.index + I[0].length : e.length,
216
+ start: i,
217
+ end: g ? r + g.index + g[0].length : e.length,
217
218
  immediate: !0
218
219
  };
219
- }, he = (e, n) => {
220
+ }, be = (e, i) => {
220
221
  const s = /^\s*\|.+\|\s*$/gm;
221
- let i, t = -1;
222
- for (; (i = s.exec(e)) !== null; ) {
223
- const c = i[0].match(/^\s*/)?.[0].length ?? 0, d = i.index + c;
224
- if (!q(d, n)) {
225
- t = d;
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 l = e.slice(t).split(`
231
- `), a = [];
232
- for (const c of l) {
233
- if (!c.trim().startsWith("|")) break;
234
- a.push(c);
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 r = a.join(`
237
+ const c = l.join(`
237
238
  `);
238
- return { start: t, block: r, end: t + r.length };
239
- }, X = (e, n) => {
240
- const s = /^<([a-z][a-z0-9:-]*)(?=[\s/>])/i.exec(e.slice(n));
241
- return s ? ee.has(s[1].toLowerCase()) : /^<!doctype(?=[\s>])/i.test(e.slice(n));
242
- }, G = (e, n) => {
243
- const s = /^<([a-z][a-z0-9:-]*)(?=[\s/>])/i.exec(e.slice(n));
244
- return !!(s && te.has(s[1].toLowerCase()));
245
- }, ge = (e, n, s) => {
246
- let i = n;
247
- for (; i < s; ) {
248
- if (e[i] !== "<") {
249
- i += 1;
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 = P(e, i), l = t.kind === "tag" ? t.closing ? void 0 : t.name : /^<([a-z][a-z0-9:-]*)(?=[\s/>])/i.exec(e.slice(i))?.[1].toLowerCase();
253
- if (l && ne.has(l) && !(l === "iframe" && C(e, i)))
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
- i += 1;
258
+ n += 1;
258
259
  continue;
259
260
  }
260
- if (t.kind === "tag" && !t.closing && $(t.name)) {
261
- i = A(e, i);
261
+ if (t.kind === "tag" && !t.closing && W(t.name)) {
262
+ n = _(e, n);
262
263
  continue;
263
264
  }
264
- i = t.end;
265
+ n = t.end;
265
266
  }
266
267
  return !1;
267
- }, pe = (e) => {
268
- const n = /* @__PURE__ */ new Map(), s = [...e.matchAll(/`+|\$+/g)], i = /* @__PURE__ */ new Map();
269
- for (let a = s.length - 1; a >= 0; a -= 1) {
270
- const r = s[a], c = r[0], d = i.get(c);
271
- d !== void 0 && n.set(r.index, d + c.length), (c[0] === "`" || !B(e, r.index)) && i.set(c, r.index);
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 l = 0;
275
- for (const a of e.split(`
275
+ let a = 0;
276
+ for (const l of e.split(`
276
277
  `)) {
277
- const r = l + (a.match(/^[ \t]*/)?.[0].length ?? 0);
278
- (!a.trim() || X(e, r)) && t.push(l), l += a.length + 1;
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: n, boundaries: t };
281
- }, be = (e, n, s) => {
282
- const i = e[n];
283
- if (i !== "`" && i !== "$" || B(e, n)) return;
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[n + t] === i; ) t += 1;
286
- const l = n + t, a = i === "$" && t > 2 ? void 0 : s.nextClosing.get(n);
287
- if (a === void 0) return { markerEnd: l };
288
- if (i === "$" && t === 2) return { markerEnd: l, end: a };
289
- let r = 0, c = s.boundaries.length;
290
- for (; r < c; ) {
291
- const d = r + c >>> 1;
292
- s.boundaries[d] <= n ? r = d + 1 : c = d;
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 a <= (s.boundaries[r] ?? e.length) ? { markerEnd: l, end: a } : { markerEnd: l };
295
- }, xe = (e, n, s) => {
296
- let i = n.start, t = i;
297
- for (; t < n.end; ) {
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 l = P(e, t);
303
- if (l.kind === "incomplete") break;
304
- if (l.kind === "invalid") {
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 (l.kind === "tag" && !l.closing) {
309
- if (l.name === "custom-button-after-content") {
310
- const a = Math.min(
311
- A(e, t),
312
- n.end
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, a)
324
+ e.slice(t, l)
316
325
  )) {
317
- t > i && s.push({
326
+ t > n && s.push({
318
327
  type: "sandbox",
319
- value: e.slice(i, t)
328
+ value: e.slice(n, t)
320
329
  }), s.push({
321
330
  type: "markdown",
322
- value: e.slice(t, a)
323
- }), i = a, t = a;
331
+ value: e.slice(t, l)
332
+ }), n = l, t = l;
324
333
  continue;
325
334
  }
326
335
  }
327
- if ($(l.name)) {
328
- t = A(e, t);
336
+ if (W(a.name)) {
337
+ t = _(e, t);
329
338
  continue;
330
339
  }
331
340
  }
332
- t = l.end;
341
+ t = a.end;
333
342
  }
334
- i < n.end && s.push({ type: "sandbox", value: e.slice(i, n.end) });
335
- }, ke = (e, n, s) => {
336
- const i = [], t = e.split(`
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 l = 0, a = 0, r = 0;
339
- for (let c = 0; c < t.length; c += 1) {
340
- const d = t[c], o = l + (d.match(/^[ \t]*/)?.[0].length ?? 0);
341
- for (; n[a]?.end <= o; ) a += 1;
342
- const u = n[a];
343
- if (/^[ \t]*\|.+\|[ \t]*\r?$/.test(d) && !(u && u.start <= o)) {
344
- let x = l + d.length;
345
- for (; c + 1 < t.length && t[c + 1].trim().startsWith("|"); )
346
- l += t[c].length + 1, c += 1, x = l + t[c].length;
347
- for (; s[r]?.end <= o; ) r += 1;
348
- s[r]?.start < x || i.push({ start: o, end: x, type: "markdown" });
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
- l += t[c].length + 1;
359
+ a += t[r].length + 1;
351
360
  }
352
- return i;
353
- }, ve = (e, n, s) => {
354
- const i = [], t = new Set(s.comments), l = s.literal.filter((f) => !t.has(f)), a = [];
355
- let r = 0, c = 0, d = 0, o = 0, u = !1, x;
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[c]?.end <= o; ) c += 1;
358
- const f = s.fences[c];
359
- if (f?.start === o) {
360
- i.push({ ...f, type: "markdown" }), a.push(f), o = f.end;
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 (; l[r]?.end <= o; ) r += 1;
364
- const M = l[r];
365
- if (M && M.start <= o) {
366
- a.push(M), o = M.end;
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[d]?.end <= o; ) d += 1;
370
- const T = s.html[d];
371
- if (u && T && T.start <= o) {
372
- const m = Z(e, o);
373
- if (m) {
374
- for (i.push(m), a.push(m); l[r]?.start < m.end; ) r += 1;
375
- o = m.end;
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] === "$") && (x ??= pe(e));
379
- const E = x && be(e, o, x);
380
- if (E) {
381
- E.end !== void 0 && a.push({ start: o, end: E.end }), o = E.end ?? E.markerEnd;
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] === "!" && !B(e, o)) {
386
- D.lastIndex = o;
387
- const m = D.exec(e);
388
- if (m) {
389
- i.push({
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 + m[0].length,
400
+ end: o + h[0].length,
392
401
  type: "markdown"
393
- }), o += m[0].length;
402
+ }), o += h[0].length;
394
403
  continue;
395
404
  }
396
405
  }
397
- if (e[o] !== "<" || B(e, o)) {
406
+ if (e[o] !== "<" || C(e, o)) {
398
407
  o += 1;
399
408
  continue;
400
409
  }
401
- const g = P(e, o);
402
- if (X(e, o)) {
403
- const m = C(e, o), E = G(e, o), R = m?.end ?? (E ? A(e, o) : J(e, o, (b) => {
404
- const k = C(e, b);
405
- return !!(k && !k.pending) || G(e, b);
406
- })), h = E && !ge(e, o, R);
407
- i.push({
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: R,
410
- type: m || h ? "markdown" : "sandbox",
411
- ...m?.immediate || h ? { immediate: !0 } : {},
412
- ...m?.pending || h && g.kind === "incomplete" ? { pending: !0 } : {}
413
- }), o = R, u = !0;
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 (g.kind === "tag")
417
- if (!g.closing && (g.name === "svg" || g.name === "img")) {
418
- const m = g.name === "img" ? g.end : A(e, o);
419
- i.push({ start: o, end: m, type: "markdown" }), o = m;
420
- } else if (!g.closing && $(g.name)) {
421
- const m = A(e, o);
422
- a.push({ start: o, end: m }), o = m;
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 = g.end;
425
- else g.kind === "comment" || g.kind === "declaration" ? (g.kind === "comment" && a.push({ start: o, end: g.end }), o = g.end) : g.kind === "incomplete" ? (/^<svg(?=[\s/>])/i.test(e.slice(o)) && i.push({ start: o, end: e.length, type: "markdown" }), o = e.length) : o += 1;
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 I = ke(e, a, i), v = [];
428
- let p = 0;
429
- for (const f of i) {
430
- for (; I[p]?.start < f.start; )
431
- v.push(I[p++]);
432
- v.push(f);
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
- v.push(...I.slice(p));
435
- const S = [];
436
- let y = 0;
437
- for (const f of v)
438
- f.start < y || (n && f.start > y && S.push({ type: "text", value: e.slice(y, f.start) }), f.type === "sandbox" ? xe(e, f, S) : S.push({
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(f.start, f.end),
441
- ...f.immediate ? { immediate: !0 } : {},
442
- ...f.pending ? { pending: !0 } : {}
443
- }), y = f.end);
444
- return n && y < e.length && S.push({ type: "text", value: e.slice(y) }), S;
445
- }, w = (e, n = !1, s = !1, i) => {
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 ve(
491
+ return Ee(
448
492
  e,
449
- n,
450
- i ?? Q(e)
493
+ i,
494
+ n ?? H(e)
451
495
  );
452
- const t = U(e, n), l = (h) => re(h), a = (h) => !!h.trim(), r = j(t), c = oe(t), d = [...ae(t), ...r], o = N(
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
- Y,
455
- d
502
+ ne,
503
+ o
456
504
  );
457
- if (c) {
458
- if (!c.complete)
459
- return l([
460
- { type: "markdown", value: n ? t : c.block }
505
+ if (p) {
506
+ if (!p.complete)
507
+ return a([
508
+ { type: "markdown", value: i ? t : p.block }
461
509
  ]);
462
- if (!n)
463
- return l([{ type: "markdown", value: c.block }]);
464
- const h = [], b = le(t.slice(0, c.start));
465
- a(b) && h.push({ type: "text", value: b }), h.push({ type: "markdown", value: c.block });
466
- const k = t.slice(c.end);
467
- return a(k) && h.push(...w(k, !0)), l(h);
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 u = N(
517
+ const g = L(
470
518
  t,
471
519
  /<svg\b/i,
472
- d
473
- ), x = o !== -1 && u !== -1 && o < u, I = V(t, d), v = !!I && u !== -1 && I.start < u;
474
- if (u !== -1 && !x && !v) {
475
- const h = t.slice(0, u), b = t.indexOf("</svg>", u), k = b === -1 ? `${t.slice(u)}</svg>` : t.slice(u, b + 6), z = b === -1 ? "" : t.slice(b + 6);
476
- if (n) {
477
- const _ = [];
478
- return a(h) && _.push({ type: "text", value: h }), _.push({ type: "markdown", value: k }), a(z) && _.push(...w(z, !0)), l(_);
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 (b === -1)
481
- return l([{ type: "markdown", value: k }]);
528
+ if (x === -1)
529
+ return a([{ type: "markdown", value: w }]);
482
530
  }
483
- const p = he(t, []);
484
- if (p) {
485
- const h = [], b = t.slice(0, p.start);
486
- n && a(b) && h.push(...w(b, !0)), h.push({ type: "markdown", value: p.block });
487
- const k = t.slice(p.end);
488
- return a(k) && k.length < t.length && h.push(...w(k, n)), l(h);
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 S = fe(
491
- de(t),
492
- V(t, d),
493
- me(t, d)
538
+ const E = he(
539
+ me(t, r),
540
+ X(t, o),
541
+ pe(t, o)
494
542
  );
495
- if (o === -1 && !S)
496
- return n && a(t) ? [{ type: "text", value: t }] : [];
497
- const y = !!S && (o === -1 || S.start <= o), f = y ? S.start : o, M = y ? S.end : ce(t, f), T = t.slice(f, M), g = y && ue(T), m = g ? t.slice(0, f).trimEnd() : t.slice(0, f), E = g ? t.slice(M).trimStart() : t.slice(M), R = [];
498
- return n && a(m) && R.push({ type: "text", value: m }), R.push({
499
- type: y ? "markdown" : "sandbox",
500
- value: T
501
- }), a(E) && R.push(...w(E, n)), l(R);
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
- Ie as normalizeWrappedSandboxContent,
505
- w as splitContentSegments
552
+ Re as normalizeWrappedSandboxContent,
553
+ T as splitContentSegments
506
554
  };
507
555
  //# sourceMappingURL=split-content.es.js.map