markdown-flow-ui 0.3.1 → 0.3.2-dev.2

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 (85) hide show
  1. package/README.md +13 -0
  2. package/dist/_virtual/index.es3.js +4 -5
  3. package/dist/_virtual/index.es3.js.map +1 -1
  4. package/dist/_virtual/index.es4.js +5 -4
  5. package/dist/_virtual/index.es4.js.map +1 -1
  6. package/dist/_virtual/index3.cjs +1 -1
  7. package/dist/_virtual/index4.cjs +1 -1
  8. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
  9. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
  10. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +2 -0
  11. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +444 -415
  12. package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
  13. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
  14. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
  15. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.d.ts +1 -0
  16. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +71 -68
  17. package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
  18. package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +22 -0
  19. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
  20. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +2 -1
  21. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +16 -14
  22. package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -1
  23. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
  24. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +2 -1
  25. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +19 -17
  26. package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js.map +1 -1
  27. package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
  28. package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +2 -1
  29. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +15 -13
  30. package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
  31. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
  32. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +2 -1
  33. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +21 -19
  34. package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js.map +1 -1
  35. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
  36. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +2 -1
  37. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +27 -25
  38. package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js.map +1 -1
  39. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
  40. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +2 -1
  41. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +21 -19
  42. package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
  43. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
  44. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +2 -1
  45. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +19 -17
  46. package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js.map +1 -1
  47. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
  48. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +2 -1
  49. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +18 -16
  50. package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -1
  51. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
  52. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +2 -1
  53. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +17 -15
  54. package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js.map +1 -1
  55. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
  56. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +2 -1
  57. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +25 -23
  58. package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js.map +1 -1
  59. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
  60. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +2 -1
  61. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +28 -26
  62. package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
  63. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
  64. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
  65. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.d.ts +5 -1
  66. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +154 -149
  67. package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
  68. package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
  69. package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
  70. package/dist/components/MarkdownFlowEditor/utils.d.ts +2 -0
  71. package/dist/components/MarkdownFlowEditor/utils.es.js +54 -52
  72. package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
  73. package/dist/components/ui/inputGroup/textarea.cjs +1 -1
  74. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  75. package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
  76. package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
  77. package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
  78. package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  79. package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
  80. package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  81. package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
  82. package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
  83. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
  84. package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +1 -1
  85. package/package.json +1 -1
@@ -1,22 +1,22 @@
1
- import { SelectedOption as d } from "./types.es.js";
2
- import { getVideoEmbedUrl as f } from "./utils/video.es.js";
3
- import { d as m } from "../../_virtual/index.es.js";
4
- const c = "===", x = (t, e) => {
1
+ import { SelectedOption as u } from "./types.es.js";
2
+ import { getVideoEmbedUrl as $ } from "./utils/video.es.js";
3
+ import { d } from "../../_virtual/index.es.js";
4
+ const s = "===", z = (t, e) => {
5
5
  switch (t) {
6
- case d.Image:
6
+ case u.Image:
7
7
  return {
8
8
  resourceUrl: e.url,
9
9
  resourceTitle: e.title,
10
10
  scalePercent: e.scalePercent
11
11
  };
12
- case d.Video:
12
+ case u.Video:
13
13
  return {
14
14
  resourceUrl: e.url,
15
15
  resourceTitle: e.title
16
16
  };
17
- case d.Variable:
17
+ case u.Variable:
18
18
  return {
19
- variableName: m.normalizeVariableName(e.title ?? "") ?? void 0
19
+ variableName: d.normalizeVariableName(e.title ?? "") ?? void 0
20
20
  };
21
21
  default:
22
22
  return {
@@ -25,18 +25,18 @@ const c = "===", x = (t, e) => {
25
25
  };
26
26
  }
27
27
  };
28
- function z(t, e) {
29
- return (o) => {
30
- const a = o.matchBefore(/\/(\w*)$/);
31
- if (!a) return null;
32
- const s = (r, n, i, l, u) => {
28
+ function v(t, e, { enableVariables: n = !0 } = {}) {
29
+ return (a) => {
30
+ const m = a.matchBefore(/\/(\w*)$/);
31
+ if (!m) return null;
32
+ const o = (r, c, i, l, f) => {
33
33
  r.dispatch({
34
34
  changes: { from: i, to: l, insert: "" }
35
- }), t(u);
35
+ }), t(f);
36
36
  };
37
37
  return {
38
- from: a.from,
39
- to: a.to,
38
+ from: m.from,
39
+ to: m.to,
40
40
  options: [
41
41
  // {
42
42
  // label: labels?.divider ?? "Divider",
@@ -50,22 +50,24 @@ function z(t, e) {
50
50
  // handleSelect(view, _, from, to, SelectedOption.FixedText);
51
51
  // },
52
52
  // },
53
- {
54
- label: e?.variable ?? "Variable",
55
- apply: (r, n, i, l) => {
56
- s(r, n, i, l, d.Variable);
53
+ ...n ? [
54
+ {
55
+ label: e?.variable ?? "Variable",
56
+ apply: (r, c, i, l) => {
57
+ o(r, c, i, l, u.Variable);
58
+ }
57
59
  }
58
- },
60
+ ] : [],
59
61
  {
60
62
  label: e?.image ?? "Image",
61
- apply: (r, n, i, l) => {
62
- s(r, n, i, l, d.Image);
63
+ apply: (r, c, i, l) => {
64
+ o(r, c, i, l, u.Image);
63
65
  }
64
66
  },
65
67
  {
66
68
  label: e?.video ?? "Video",
67
- apply: (r, n, i, l) => {
68
- s(r, n, i, l, d.Video);
69
+ apply: (r, c, i, l) => {
70
+ o(r, c, i, l, u.Video);
69
71
  }
70
72
  }
71
73
  ],
@@ -73,40 +75,40 @@ function z(t, e) {
73
75
  };
74
76
  };
75
77
  }
76
- const $ = (t) => f(t), p = (t) => t.replace(/&/g, "&").replace(/"/g, """), g = (t) => t.replace(/([\[\]\\])/g, "\\$1"), V = (t) => Math.max(1, Math.min(1e3, Math.round(t))), b = (t) => {
78
+ const g = (t) => $(t), p = (t) => t.replace(/&/g, "&").replace(/"/g, """), V = (t) => t.replace(/([\[\]\\])/g, "\\$1"), w = (t) => Math.max(1, Math.min(1e3, Math.round(t))), b = (t) => {
77
79
  const e = t.trim();
78
80
  return e ? new RegExp(
79
- `^${c}\\s*[\\s\\S]*?\\s*${c}$`
80
- ).test(e) ? e : `${c} ${e} ${c}` : `${c}${c}`;
81
- }, v = (t) => {
82
- const e = t.trim(), o = new RegExp(
83
- `^${c}\\s*([\\s\\S]*?)\\s*${c}$`
81
+ `^${s}\\s*[\\s\\S]*?\\s*${s}$`
82
+ ).test(e) ? e : `${s} ${e} ${s}` : `${s}${s}`;
83
+ }, U = (t) => {
84
+ const e = t.trim(), n = new RegExp(
85
+ `^${s}\\s*([\\s\\S]*?)\\s*${s}$`
84
86
  );
85
- return (e.match(o)?.[1] ?? e).trim();
86
- }, U = ({
87
+ return (e.match(n)?.[1] ?? e).trim();
88
+ }, k = ({
87
89
  resourceUrl: t,
88
90
  resourceTitle: e,
89
- scalePercent: o
91
+ scalePercent: n
90
92
  }) => {
91
- const a = typeof o == "number" ? V(o) : void 0, s = p(t), r = e ? p(e) : void 0, n = e ? g(e) : "", i = typeof a == "number" && a !== 100 ? ` width="${a}%"` : "", l = r ? ` alt="${r}" title="${r}"` : "", u = !a || a === 100 ? `![${n}](${t})` : `<img src="${s}"${l}${i} />`;
92
- return b(u);
93
- }, k = (t, e) => {
94
- const o = $(t), a = e ? p(e) : "", s = p(t), r = p(o), n = `<iframe data-tag="video" data-title="${a}" data-url="${s}" class="w-full aspect-video rounded-lg border-0" src="${r}" allowfullscreen="" allow="autoplay; encrypted-media"></iframe>`;
95
- return b(n);
96
- }, E = m.extractVariableNames, I = m.findDocumentVariableMarkers, P = m.findVariableMarkers, T = m.formatVariableReference, y = m.normalizeVariableName, R = m.trimVariablePadding;
93
+ const a = typeof n == "number" ? w(n) : void 0, m = p(t), o = e ? p(e) : void 0, r = e ? V(e) : "", c = typeof a == "number" && a !== 100 ? ` width="${a}%"` : "", i = o ? ` alt="${o}" title="${o}"` : "", l = !a || a === 100 ? `![${r}](${t})` : `<img src="${m}"${i}${c} />`;
94
+ return b(l);
95
+ }, E = (t, e) => {
96
+ const n = g(t), a = e ? p(e) : "", m = p(t), o = p(n), r = `<iframe data-tag="video" data-title="${a}" data-url="${m}" class="w-full aspect-video rounded-lg border-0" src="${o}" allowfullscreen="" allow="autoplay; encrypted-media"></iframe>`;
97
+ return b(r);
98
+ }, I = d.extractVariableNames, P = d.findDocumentVariableMarkers, T = d.findVariableMarkers, y = d.formatVariableReference, R = d.normalizeVariableName, S = d.trimVariablePadding;
97
99
  export {
98
- z as createSlashCommands,
99
- E as extractVariableNames,
100
- I as findDocumentVariableMarkers,
101
- P as findVariableMarkers,
102
- T as formatVariableReference,
103
- $ as getEmbedUrl,
104
- U as getImageContentToInsert,
105
- k as getVideoContentToInsert,
106
- y as normalizeVariableName,
107
- x as parseContentInfo,
108
- R as trimVariablePadding,
109
- v as unwrapFixedOutput,
100
+ v as createSlashCommands,
101
+ I as extractVariableNames,
102
+ P as findDocumentVariableMarkers,
103
+ T as findVariableMarkers,
104
+ y as formatVariableReference,
105
+ g as getEmbedUrl,
106
+ k as getImageContentToInsert,
107
+ E as getVideoContentToInsert,
108
+ R as normalizeVariableName,
109
+ z as parseContentInfo,
110
+ S as trimVariablePadding,
111
+ U as unwrapFixedOutput,
110
112
  b as wrapWithFixedOutput
111
113
  };
112
114
  //# sourceMappingURL=utils.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.es.js","sources":["../../../src/components/MarkdownFlowEditor/utils.ts"],"sourcesContent":["import {\n type CompletionContext,\n type CompletionResult,\n} from \"@codemirror/autocomplete\";\nimport { EditorView } from \"@codemirror/view\";\nimport { SelectedOption } from \"./types\";\nimport { getVideoEmbedUrl } from \"./utils/video\";\n\nimport {\n createVariableExpressionRegex,\n extractVariableNames,\n findVariableMarkers,\n findDocumentVariableMarkers,\n formatVariableReference,\n formatVariableAssignment,\n isValidVariableName,\n normalizeVariableName,\n trimVariablePadding,\n} from \"remark-flow\";\n\nconst FIXED_OUTPUT_MARKER = \"===\";\nconst createVariableExpressionRegexp = () =>\n createVariableExpressionRegex(\"gu\");\n\nconst parseContentInfo = (\n type: SelectedOption,\n dataset: { title?: string; url?: string; scalePercent?: number }\n) => {\n switch (type) {\n case SelectedOption.Image:\n return {\n resourceUrl: dataset.url,\n resourceTitle: dataset.title,\n scalePercent: dataset.scalePercent,\n };\n\n case SelectedOption.Video:\n return {\n resourceUrl: dataset.url,\n resourceTitle: dataset.title,\n };\n case SelectedOption.Variable:\n return {\n variableName: normalizeVariableName(dataset.title ?? \"\") ?? undefined,\n };\n default:\n return {\n resourceUrl: dataset.url ?? \"\",\n resourceTitle: dataset.title ?? \"\",\n };\n }\n};\n\nfunction createSlashCommands(\n onSelectOption: (selectedOption: SelectedOption) => void,\n labels?: {\n divider?: string;\n fixedText?: string;\n image?: string;\n video?: string;\n variable?: string;\n }\n) {\n return (context: CompletionContext): CompletionResult | null => {\n const word = context.matchBefore(/\\/(\\w*)$/);\n if (!word) return null;\n\n const handleSelect = (\n view: EditorView,\n _: any,\n from: number,\n to: number,\n selectedOption: SelectedOption\n ) => {\n view.dispatch({\n changes: { from, to, insert: \"\" },\n });\n onSelectOption(selectedOption);\n };\n\n return {\n from: word.from,\n to: word.to,\n options: [\n // {\n // label: labels?.divider ?? \"Divider\",\n // apply: (view, _, from, to) => {\n // handleSelect(view, _, from, to, SelectedOption.Divider);\n // },\n // },\n // {\n // label: labels?.fixedText ?? \"Fixed Text\",\n // apply: (view, _, from, to) => {\n // handleSelect(view, _, from, to, SelectedOption.FixedText);\n // },\n // },\n {\n label: labels?.variable ?? \"Variable\",\n apply: (view, _, from, to) => {\n handleSelect(view, _, from, to, SelectedOption.Variable);\n },\n },\n {\n label: labels?.image ?? \"Image\",\n apply: (view, _, from, to) => {\n handleSelect(view, _, from, to, SelectedOption.Image);\n },\n },\n {\n label: labels?.video ?? \"Video\",\n apply: (view, _, from, to) => {\n handleSelect(view, _, from, to, SelectedOption.Video);\n },\n },\n ],\n filter: false,\n };\n };\n}\n\nconst getEmbedUrl = (url: string) => {\n return getVideoEmbedUrl(url);\n};\n\nconst escapeHtmlAttribute = (value: string) =>\n value.replace(/&/g, \"&amp;\").replace(/\"/g, \"&quot;\");\n\nconst escapeMarkdownText = (text: string) =>\n text.replace(/([\\[\\]\\\\])/g, \"\\\\$1\");\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst wrapWithFixedOutput = (content: string) => {\n const normalizedContent = content.trim();\n if (!normalizedContent) {\n return `${FIXED_OUTPUT_MARKER}${FIXED_OUTPUT_MARKER}`;\n }\n const wrappedPattern = new RegExp(\n `^${FIXED_OUTPUT_MARKER}\\\\s*[\\\\s\\\\S]*?\\\\s*${FIXED_OUTPUT_MARKER}$`\n );\n if (wrappedPattern.test(normalizedContent)) {\n return normalizedContent;\n }\n return `${FIXED_OUTPUT_MARKER} ${normalizedContent} ${FIXED_OUTPUT_MARKER}`;\n};\n\nconst unwrapFixedOutput = (content: string) => {\n const normalizedContent = content.trim();\n const wrappedPattern = new RegExp(\n `^${FIXED_OUTPUT_MARKER}\\\\s*([\\\\s\\\\S]*?)\\\\s*${FIXED_OUTPUT_MARKER}$`\n );\n const match = normalizedContent.match(wrappedPattern);\n return (match?.[1] ?? normalizedContent).trim();\n};\n\nconst getImageContentToInsert = ({\n resourceUrl,\n resourceTitle,\n scalePercent,\n}: {\n resourceUrl: string;\n resourceTitle?: string;\n scalePercent?: number;\n}) => {\n const clampedScale =\n typeof scalePercent === \"number\"\n ? clampScalePercent(scalePercent)\n : undefined;\n const sanitizedHtmlUrl = escapeHtmlAttribute(resourceUrl);\n const sanitizedTitle = resourceTitle\n ? escapeHtmlAttribute(resourceTitle)\n : undefined;\n const markdownTitle = resourceTitle ? escapeMarkdownText(resourceTitle) : \"\";\n const widthAttribute =\n typeof clampedScale === \"number\" && clampedScale !== 100\n ? ` width=\"${clampedScale}%\"`\n : \"\";\n const htmlTitleAttributes = sanitizedTitle\n ? ` alt=\"${sanitizedTitle}\" title=\"${sanitizedTitle}\"`\n : \"\";\n const imageMarkup =\n !clampedScale || clampedScale === 100\n ? `![${markdownTitle}](${resourceUrl})`\n : `<img src=\"${sanitizedHtmlUrl}\"${htmlTitleAttributes}${widthAttribute} />`;\n\n return wrapWithFixedOutput(imageMarkup);\n};\n\nconst getVideoContentToInsert = (\n resourceUrl: string,\n resourceTitle: string\n) => {\n const embedUrl = getEmbedUrl(resourceUrl);\n const sanitizedTitle = resourceTitle\n ? escapeHtmlAttribute(resourceTitle)\n : \"\";\n const sanitizedResourceUrl = escapeHtmlAttribute(resourceUrl);\n const sanitizedEmbedUrl = escapeHtmlAttribute(embedUrl);\n const videoMarkup = `<iframe data-tag=\"video\" data-title=\"${sanitizedTitle}\" data-url=\"${sanitizedResourceUrl}\" class=\"w-full aspect-video rounded-lg border-0\" src=\"${sanitizedEmbedUrl}\" allowfullscreen=\"\" allow=\"autoplay; encrypted-media\"></iframe>`;\n\n return wrapWithFixedOutput(videoMarkup);\n};\n\nexport {\n createSlashCommands,\n parseContentInfo,\n getEmbedUrl,\n getImageContentToInsert,\n getVideoContentToInsert,\n isValidVariableName,\n normalizeVariableName,\n trimVariablePadding,\n extractVariableNames,\n findVariableMarkers,\n findDocumentVariableMarkers,\n formatVariableReference,\n formatVariableAssignment,\n createVariableExpressionRegexp,\n wrapWithFixedOutput,\n unwrapFixedOutput,\n};\n"],"names":["FIXED_OUTPUT_MARKER","parseContentInfo","type","dataset","SelectedOption","normalizeVariableName","createSlashCommands","onSelectOption","labels","context","word","handleSelect","view","_","from","to","selectedOption","getEmbedUrl","url","getVideoEmbedUrl","escapeHtmlAttribute","value","escapeMarkdownText","text","clampScalePercent","wrapWithFixedOutput","content","normalizedContent","unwrapFixedOutput","wrappedPattern","getImageContentToInsert","resourceUrl","resourceTitle","scalePercent","clampedScale","sanitizedHtmlUrl","sanitizedTitle","markdownTitle","widthAttribute","htmlTitleAttributes","imageMarkup","getVideoContentToInsert","embedUrl","sanitizedResourceUrl","sanitizedEmbedUrl","videoMarkup"],"mappings":";;;AAoBA,MA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AAMC,IACJ,OAAOD,KAAiB,WACpBT,EAAkBS,CAAY,IAC9B,QACAE,IAAmBf,EAAoBW,CAAW,GAClDK,IAAiBJ,IACnBZ,EAAoBY,CAAa,IACjC,QACEK,IAAgBL,IAAgBV,EAAmBU,CAAa,IAAI,IACpEM,IACJ,OAAOJ,KAAiB,YAAYA,MAAiB,MACjD,WAAWA,CAAY,OACvB,IACAK,IAAsBH,IACxB,SAASA,CAAc,YAAYA,CAAc,MACjD,IACEI,IACJ,CAACN,KAAgBA,MAAiB,MAC9B,KAAKG,CAAa,KAAKN,CAAW,MAClC,aAAaI,CAAgB,IAAII,CAAmB,GAAGD,CAAc;AAE3E,SAAOb,EAAoBe,CAAW;AACxC,GAEMC,IAA0B,CAC9BV,GACAC,MACG;AACH,QAAMU,IAAWzB,EAAYc,CAAW,GAClCK,IAAiBJ,IACnBZ,EAAoBY,CAAa,IACjC,IACEW,IAAuBvB,EAAoBW,CAAW,GACtDa,IAAoBxB,EAAoBsB,CAAQ,GAChDG,IAAc,wCAAwCT,CAAc,eAAeO,CAAoB,0DAA0DC,CAAiB;AAExL,SAAOnB,EAAoBoB,CAAW;AACxC;"}
1
+ {"version":3,"file":"utils.es.js","sources":["../../../src/components/MarkdownFlowEditor/utils.ts"],"sourcesContent":["import {\n type Completion,\n type CompletionContext,\n type CompletionResult,\n} from \"@codemirror/autocomplete\";\nimport { EditorView } from \"@codemirror/view\";\nimport { SelectedOption } from \"./types\";\nimport { getVideoEmbedUrl } from \"./utils/video\";\n\nimport {\n createVariableExpressionRegex,\n extractVariableNames,\n findVariableMarkers,\n findDocumentVariableMarkers,\n formatVariableReference,\n formatVariableAssignment,\n isValidVariableName,\n normalizeVariableName,\n trimVariablePadding,\n} from \"remark-flow\";\n\nconst FIXED_OUTPUT_MARKER = \"===\";\nconst createVariableExpressionRegexp = () =>\n createVariableExpressionRegex(\"gu\");\n\nconst parseContentInfo = (\n type: SelectedOption,\n dataset: { title?: string; url?: string; scalePercent?: number }\n) => {\n switch (type) {\n case SelectedOption.Image:\n return {\n resourceUrl: dataset.url,\n resourceTitle: dataset.title,\n scalePercent: dataset.scalePercent,\n };\n\n case SelectedOption.Video:\n return {\n resourceUrl: dataset.url,\n resourceTitle: dataset.title,\n };\n case SelectedOption.Variable:\n return {\n variableName: normalizeVariableName(dataset.title ?? \"\") ?? undefined,\n };\n default:\n return {\n resourceUrl: dataset.url ?? \"\",\n resourceTitle: dataset.title ?? \"\",\n };\n }\n};\n\nfunction createSlashCommands(\n onSelectOption: (selectedOption: SelectedOption) => void,\n labels?: {\n divider?: string;\n fixedText?: string;\n image?: string;\n video?: string;\n variable?: string;\n },\n { enableVariables = true }: { enableVariables?: boolean } = {}\n) {\n return (context: CompletionContext): CompletionResult | null => {\n const word = context.matchBefore(/\\/(\\w*)$/);\n if (!word) return null;\n\n const handleSelect = (\n view: EditorView,\n _: any,\n from: number,\n to: number,\n selectedOption: SelectedOption\n ) => {\n view.dispatch({\n changes: { from, to, insert: \"\" },\n });\n onSelectOption(selectedOption);\n };\n\n return {\n from: word.from,\n to: word.to,\n options: [\n // {\n // label: labels?.divider ?? \"Divider\",\n // apply: (view, _, from, to) => {\n // handleSelect(view, _, from, to, SelectedOption.Divider);\n // },\n // },\n // {\n // label: labels?.fixedText ?? \"Fixed Text\",\n // apply: (view, _, from, to) => {\n // handleSelect(view, _, from, to, SelectedOption.FixedText);\n // },\n // },\n ...(enableVariables\n ? [\n {\n label: labels?.variable ?? \"Variable\",\n apply: (\n view: EditorView,\n _: Completion,\n from: number,\n to: number\n ) => {\n handleSelect(view, _, from, to, SelectedOption.Variable);\n },\n },\n ]\n : []),\n {\n label: labels?.image ?? \"Image\",\n apply: (view, _, from, to) => {\n handleSelect(view, _, from, to, SelectedOption.Image);\n },\n },\n {\n label: labels?.video ?? \"Video\",\n apply: (view, _, from, to) => {\n handleSelect(view, _, from, to, SelectedOption.Video);\n },\n },\n ],\n filter: false,\n };\n };\n}\n\nconst getEmbedUrl = (url: string) => {\n return getVideoEmbedUrl(url);\n};\n\nconst escapeHtmlAttribute = (value: string) =>\n value.replace(/&/g, \"&amp;\").replace(/\"/g, \"&quot;\");\n\nconst escapeMarkdownText = (text: string) =>\n text.replace(/([\\[\\]\\\\])/g, \"\\\\$1\");\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst wrapWithFixedOutput = (content: string) => {\n const normalizedContent = content.trim();\n if (!normalizedContent) {\n return `${FIXED_OUTPUT_MARKER}${FIXED_OUTPUT_MARKER}`;\n }\n const wrappedPattern = new RegExp(\n `^${FIXED_OUTPUT_MARKER}\\\\s*[\\\\s\\\\S]*?\\\\s*${FIXED_OUTPUT_MARKER}$`\n );\n if (wrappedPattern.test(normalizedContent)) {\n return normalizedContent;\n }\n return `${FIXED_OUTPUT_MARKER} ${normalizedContent} ${FIXED_OUTPUT_MARKER}`;\n};\n\nconst unwrapFixedOutput = (content: string) => {\n const normalizedContent = content.trim();\n const wrappedPattern = new RegExp(\n `^${FIXED_OUTPUT_MARKER}\\\\s*([\\\\s\\\\S]*?)\\\\s*${FIXED_OUTPUT_MARKER}$`\n );\n const match = normalizedContent.match(wrappedPattern);\n return (match?.[1] ?? normalizedContent).trim();\n};\n\nconst getImageContentToInsert = ({\n resourceUrl,\n resourceTitle,\n scalePercent,\n}: {\n resourceUrl: string;\n resourceTitle?: string;\n scalePercent?: number;\n}) => {\n const clampedScale =\n typeof scalePercent === \"number\"\n ? clampScalePercent(scalePercent)\n : undefined;\n const sanitizedHtmlUrl = escapeHtmlAttribute(resourceUrl);\n const sanitizedTitle = resourceTitle\n ? escapeHtmlAttribute(resourceTitle)\n : undefined;\n const markdownTitle = resourceTitle ? escapeMarkdownText(resourceTitle) : \"\";\n const widthAttribute =\n typeof clampedScale === \"number\" && clampedScale !== 100\n ? ` width=\"${clampedScale}%\"`\n : \"\";\n const htmlTitleAttributes = sanitizedTitle\n ? ` alt=\"${sanitizedTitle}\" title=\"${sanitizedTitle}\"`\n : \"\";\n const imageMarkup =\n !clampedScale || clampedScale === 100\n ? `![${markdownTitle}](${resourceUrl})`\n : `<img src=\"${sanitizedHtmlUrl}\"${htmlTitleAttributes}${widthAttribute} />`;\n\n return wrapWithFixedOutput(imageMarkup);\n};\n\nconst getVideoContentToInsert = (\n resourceUrl: string,\n resourceTitle: string\n) => {\n const embedUrl = getEmbedUrl(resourceUrl);\n const sanitizedTitle = resourceTitle\n ? escapeHtmlAttribute(resourceTitle)\n : \"\";\n const sanitizedResourceUrl = escapeHtmlAttribute(resourceUrl);\n const sanitizedEmbedUrl = escapeHtmlAttribute(embedUrl);\n const videoMarkup = `<iframe data-tag=\"video\" data-title=\"${sanitizedTitle}\" data-url=\"${sanitizedResourceUrl}\" class=\"w-full aspect-video rounded-lg border-0\" src=\"${sanitizedEmbedUrl}\" allowfullscreen=\"\" allow=\"autoplay; encrypted-media\"></iframe>`;\n\n return wrapWithFixedOutput(videoMarkup);\n};\n\nexport {\n createSlashCommands,\n parseContentInfo,\n getEmbedUrl,\n getImageContentToInsert,\n getVideoContentToInsert,\n isValidVariableName,\n normalizeVariableName,\n trimVariablePadding,\n extractVariableNames,\n findVariableMarkers,\n findDocumentVariableMarkers,\n formatVariableReference,\n formatVariableAssignment,\n createVariableExpressionRegexp,\n wrapWithFixedOutput,\n unwrapFixedOutput,\n};\n"],"names":["FIXED_OUTPUT_MARKER","parseContentInfo","type","dataset","SelectedOption","normalizeVariableName","createSlashCommands","onSelectOption","labels","enableVariables","context","word","handleSelect","view","_","from","to","selectedOption","getEmbedUrl","url","getVideoEmbedUrl","escapeHtmlAttribute","value","escapeMarkdownText","text","clampScalePercent","wrapWithFixedOutput","content","normalizedContent","unwrapFixedOutput","wrappedPattern","getImageContentToInsert","resourceUrl","resourceTitle","scalePercent","clampedScale","sanitizedHtmlUrl","sanitizedTitle","markdownTitle","widthAttribute","htmlTitleAttributes","imageMarkup","getVideoContentToInsert","embedUrl","sanitizedResourceUrl","sanitizedEmbedUrl","videoMarkup"],"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AAC3C,GAEMG,IAA0B,CAAC;AAAA,EAC/B,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AACF,MAIM;AACJ,QAAMC,IACJ,OAAOD,KAAiB,WACpBT,EAAkBS,CAAY,IAC9B,QACAE,IAAmBf,EAAoBW,CAAW,GAClDK,IAAiBJ,IACnBZ,EAAoBY,CAAa,IACjC,QACEK,IAAgBL,IAAgBV,EAAmBU,CAAa,IAAI,IACpEM,IACJ,OAAOJ,KAAiB,YAAYA,MAAiB,MACjD,WAAWA,CAAY,OACvB,IACAK,IAAsBH,IACxB,SAASA,CAAc,YAAYA,CAAc,MACjD,IACEI,IACJ,CAACN,KAAgBA,MAAiB,MAC9B,KAAKG,CAAa,KAAKN,CAAW,MAClC,aAAaI,CAAgB,IAAII,CAAmB,GAAGD,CAAc;AAE3E,SAAOb,EAAoBe,CAAW;AACxC,GAEMC,IAA0B,CAC9BV,GACAC,MACG;AACH,QAAMU,IAAWzB,EAAYc,CAAW,GAClCK,IAAiBJ,IACnBZ,EAAoBY,CAAa,IACjC,IACEW,IAAuBvB,EAAoBW,CAAW,GACtDa,IAAoBxB,EAAoBsB,CAAQ,GAChDG,IAAc,wCAAwCT,CAAc,eAAeO,CAAoB,0DAA0DC,CAAiB;AAExL,SAAOnB,EAAoBoB,CAAW;AACxC;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),d=require("react"),u=require("../../../node_modules/rc-textarea/es/TextArea.cjs");require("../../../_virtual/index3.cjs");require("../../../node_modules/rc-resize-observer/es/index.cjs");require("../../../node_modules/rc-util/es/hooks/useLayoutEffect.cjs");require("../../../node_modules/rc-util/es/raf.cjs");const s=require("../../../lib/utils.cjs");function c(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const l=c(d),i=l.forwardRef(({className:e,autoSize:t={minRows:1},style:r,...a},n)=>o.jsx(u.default,{ref:n,autoSize:t,className:s.cn("border-input placeholder:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 w-full rounded-md border bg-transparent pl-3 py-1.5 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50","resize-none",e),style:{whiteSpace:"pre-wrap",wordBreak:"break-word",...r},...a}));i.displayName="Textarea";exports.Textarea=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),d=require("react"),u=require("../../../node_modules/rc-textarea/es/TextArea.cjs");require("../../../_virtual/index4.cjs");require("../../../node_modules/rc-resize-observer/es/index.cjs");require("../../../node_modules/rc-util/es/hooks/useLayoutEffect.cjs");require("../../../node_modules/rc-util/es/raf.cjs");const s=require("../../../lib/utils.cjs");function c(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const l=c(d),i=l.forwardRef(({className:e,autoSize:t={minRows:1},style:r,...a},n)=>o.jsx(u.default,{ref:n,autoSize:t,className:s.cn("border-input placeholder:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 w-full rounded-md border bg-transparent pl-3 py-1.5 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50","resize-none",e),style:{whiteSpace:"pre-wrap",wordBreak:"break-word",...r},...a}));i.displayName="Textarea";exports.Textarea=i;
2
2
  //# sourceMappingURL=textarea.cjs.map
@@ -1,7 +1,7 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import * as d from "react";
3
3
  import n from "../../../node_modules/rc-textarea/es/TextArea.es.js";
4
- import "../../../_virtual/index.es3.js";
4
+ import "../../../_virtual/index.es4.js";
5
5
  import "../../../node_modules/rc-resize-observer/es/index.es.js";
6
6
  import "../../../node_modules/rc-util/es/hooks/useLayoutEffect.es.js";
7
7
  import "../../../node_modules/rc-util/es/raf.es.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const H=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),te=require("../../@babel/runtime/helpers/esm/extends.cjs"),i=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),oe=require("../../@babel/runtime/helpers/esm/typeof.cjs"),u=require("../../../_virtual/index3.cjs"),n=require("react"),T=require("./utils/commonUtils.cjs");var de=n.forwardRef(function(e,U){var p,x,y,$=e.inputElement,N=e.children,r=e.prefixCls,k=e.prefix,f=e.suffix,C=e.addonBefore,W=e.addonAfter,z=e.className,J=e.style,m=e.disabled,I=e.readOnly,K=e.focused,E=e.triggerFocus,d=e.allowClear,b=e.value,h=e.handleReset,L=e.hidden,t=e.classes,a=e.classNames,g=e.dataAttrs,o=e.styles,l=e.components,w=e.onClear,M=N??$,Q=l?.affixWrapper||"span",V=l?.groupWrapper||"span",X=l?.wrapper||"span",S=l?.groupAddon||"span",A=n.useRef(null),Y=function(s){var q;(q=A.current)!==null&&q!==void 0&&q.contains(s.target)&&E?.()},j=T.hasPrefixSuffix(e),c=n.cloneElement(M,{value:b,className:u.default((p=M.props)===null||p===void 0?void 0:p.className,!j&&a?.variant)||null}),B=n.useRef(null);if(n.useImperativeHandle(U,function(){return{nativeElement:B.current||A.current}}),j){var D=null;if(d){var Z=!m&&!I&&b,R="".concat(r,"-clear-icon"),P=oe.default(d)==="object"&&d!==null&&d!==void 0&&d.clearIcon?d.clearIcon:"✖";D=n.createElement("button",{type:"button",tabIndex:-1,onClick:function(s){h?.(s),w?.()},onMouseDown:function(s){return s.preventDefault()},className:u.default(R,i.default(i.default({},"".concat(R,"-hidden"),!Z),"".concat(R,"-has-suffix"),!!f))},P)}var v="".concat(r,"-affix-wrapper"),ee=u.default(v,i.default(i.default(i.default(i.default(i.default({},"".concat(r,"-disabled"),m),"".concat(v,"-disabled"),m),"".concat(v,"-focused"),K),"".concat(v,"-readonly"),I),"".concat(v,"-input-with-clear-btn"),f&&d&&b),t?.affixWrapper,a?.affixWrapper,a?.variant),ae=(f||d)&&n.createElement("span",{className:u.default("".concat(r,"-suffix"),a?.suffix),style:o?.suffix},D,f);c=n.createElement(Q,te.default({className:ee,style:o?.affixWrapper,onClick:Y},g?.affixWrapper,{ref:A}),k&&n.createElement("span",{className:u.default("".concat(r,"-prefix"),a?.prefix),style:o?.prefix},k),c,ae)}if(T.hasAddon(e)){var _="".concat(r,"-group"),O="".concat(_,"-addon"),F="".concat(_,"-wrapper"),ne=u.default("".concat(r,"-wrapper"),_,t?.wrapper,a?.wrapper),le=u.default(F,i.default({},"".concat(F,"-disabled"),m),t?.group,a?.groupWrapper);c=n.createElement(V,{className:le,ref:B},n.createElement(X,{className:ne},C&&n.createElement(S,{className:O},C),c,W&&n.createElement(S,{className:O},W)))}return n.cloneElement(c,{className:u.default((x=c.props)===null||x===void 0?void 0:x.className,z)||null,style:H.default(H.default({},(y=c.props)===null||y===void 0?void 0:y.style),J),hidden:L})});exports.default=de;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const H=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),te=require("../../@babel/runtime/helpers/esm/extends.cjs"),i=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),oe=require("../../@babel/runtime/helpers/esm/typeof.cjs"),u=require("../../../_virtual/index4.cjs"),n=require("react"),T=require("./utils/commonUtils.cjs");var de=n.forwardRef(function(e,U){var p,x,y,$=e.inputElement,N=e.children,r=e.prefixCls,k=e.prefix,f=e.suffix,C=e.addonBefore,W=e.addonAfter,z=e.className,J=e.style,m=e.disabled,I=e.readOnly,K=e.focused,E=e.triggerFocus,d=e.allowClear,b=e.value,h=e.handleReset,L=e.hidden,t=e.classes,a=e.classNames,g=e.dataAttrs,o=e.styles,l=e.components,w=e.onClear,M=N??$,Q=l?.affixWrapper||"span",V=l?.groupWrapper||"span",X=l?.wrapper||"span",S=l?.groupAddon||"span",A=n.useRef(null),Y=function(s){var q;(q=A.current)!==null&&q!==void 0&&q.contains(s.target)&&E?.()},j=T.hasPrefixSuffix(e),c=n.cloneElement(M,{value:b,className:u.default((p=M.props)===null||p===void 0?void 0:p.className,!j&&a?.variant)||null}),B=n.useRef(null);if(n.useImperativeHandle(U,function(){return{nativeElement:B.current||A.current}}),j){var D=null;if(d){var Z=!m&&!I&&b,R="".concat(r,"-clear-icon"),P=oe.default(d)==="object"&&d!==null&&d!==void 0&&d.clearIcon?d.clearIcon:"✖";D=n.createElement("button",{type:"button",tabIndex:-1,onClick:function(s){h?.(s),w?.()},onMouseDown:function(s){return s.preventDefault()},className:u.default(R,i.default(i.default({},"".concat(R,"-hidden"),!Z),"".concat(R,"-has-suffix"),!!f))},P)}var v="".concat(r,"-affix-wrapper"),ee=u.default(v,i.default(i.default(i.default(i.default(i.default({},"".concat(r,"-disabled"),m),"".concat(v,"-disabled"),m),"".concat(v,"-focused"),K),"".concat(v,"-readonly"),I),"".concat(v,"-input-with-clear-btn"),f&&d&&b),t?.affixWrapper,a?.affixWrapper,a?.variant),ae=(f||d)&&n.createElement("span",{className:u.default("".concat(r,"-suffix"),a?.suffix),style:o?.suffix},D,f);c=n.createElement(Q,te.default({className:ee,style:o?.affixWrapper,onClick:Y},g?.affixWrapper,{ref:A}),k&&n.createElement("span",{className:u.default("".concat(r,"-prefix"),a?.prefix),style:o?.prefix},k),c,ae)}if(T.hasAddon(e)){var _="".concat(r,"-group"),O="".concat(_,"-addon"),F="".concat(_,"-wrapper"),ne=u.default("".concat(r,"-wrapper"),_,t?.wrapper,a?.wrapper),le=u.default(F,i.default({},"".concat(F,"-disabled"),m),t?.group,a?.groupWrapper);c=n.createElement(V,{className:le,ref:B},n.createElement(X,{className:ne},C&&n.createElement(S,{className:O},C),c,W&&n.createElement(S,{className:O},W)))}return n.cloneElement(c,{className:u.default((x=c.props)===null||x===void 0?void 0:x.className,z)||null,style:H.default(H.default({},(y=c.props)===null||y===void 0?void 0:y.style),J),hidden:L})});exports.default=de;
2
2
  //# sourceMappingURL=BaseInput.cjs.map
@@ -2,7 +2,7 @@ import $ from "../../@babel/runtime/helpers/esm/objectSpread2.es.js";
2
2
  import oe from "../../@babel/runtime/helpers/esm/extends.es.js";
3
3
  import r from "../../@babel/runtime/helpers/esm/defineProperty.es.js";
4
4
  import te from "../../@babel/runtime/helpers/esm/typeof.es.js";
5
- import d from "../../../_virtual/index.es3.js";
5
+ import d from "../../../_virtual/index.es4.js";
6
6
  import l, { useRef as q, cloneElement as ie } from "react";
7
7
  import { hasPrefixSuffix as re, hasAddon as de } from "./utils/commonUtils.es.js";
8
8
  var xe = /* @__PURE__ */ l.forwardRef(function(e, z) {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Y=require("../../@babel/runtime/helpers/esm/extends.cjs"),F=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),N=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),J=require("../../@babel/runtime/helpers/esm/typeof.cjs"),f=require("../../@babel/runtime/helpers/esm/slicedToArray.cjs"),K=require("../../@babel/runtime/helpers/esm/objectWithoutProperties.cjs"),Q=require("../../../_virtual/index3.cjs"),ee=require("../../rc-resize-observer/es/index.cjs"),j=require("../../rc-util/es/hooks/useLayoutEffect.cjs"),te=require("../../rc-util/es/hooks/useMergedState.cjs"),w=require("../../rc-util/es/raf.cjs"),ae=require("react"),re=require("./calculateNodeHeight.cjs");function ne(n){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(o,e,s.get?s:{enumerable:!0,get:()=>n[e]})}}return o.default=n,Object.freeze(o)}const t=ne(ae);var ue=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],g=0,m=1,_=2,le=t.forwardRef(function(n,o){var e=n,s=e.prefixCls,O=e.defaultValue,p=e.value,a=e.autoSize,i=e.onResize,T=e.className,$=e.style,b=e.disabled,c=e.onChange,d=e.onInternalAutoSize,P=K.default(e,ue),V=te.default(O,{value:p,postState:function(r){return r??""}}),y=f.default(V,2),D=y[0],Z=y[1],H=function(r){Z(r.target.value),c?.(r)},S=t.useRef();t.useImperativeHandle(o,function(){return{textArea:S.current}});var L=t.useMemo(function(){return a&&J.default(a)==="object"?[a.minRows,a.maxRows]:[]},[a]),E=f.default(L,2),q=E[0],x=E[1],R=!!a,k=t.useState(_),A=f.default(k,2),u=A[0],v=A[1],B=t.useState(),I=f.default(B,2),G=I[0],U=I[1],M=function(){v(g),process.env.NODE_ENV==="test"&&d?.()};j.default(function(){R&&M()},[p,q,x,R]),j.default(function(){if(u===g)v(m);else if(u===m){var l=re.default(S.current,!1,q,x);v(_),U(l)}},[u]);var h=t.useRef(),C=function(){w.default.cancel(h.current)},W=function(r){u===_&&(i?.(r),a&&(C(),h.current=w.default(function(){M()})))};t.useEffect(function(){return C},[]);var X=R?G:null,z=N.default(N.default({},$),X);return(u===g||u===m)&&(z.overflowY="hidden",z.overflowX="hidden"),t.createElement(ee.default,{onResize:W,disabled:!(a||i)},t.createElement("textarea",Y.default({},P,{ref:S,style:z,className:Q.default(s,T,F.default({},"".concat(s,"-disabled"),b)),disabled:b,value:D,onChange:H})))});exports.default=le;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Y=require("../../@babel/runtime/helpers/esm/extends.cjs"),F=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),N=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),J=require("../../@babel/runtime/helpers/esm/typeof.cjs"),f=require("../../@babel/runtime/helpers/esm/slicedToArray.cjs"),K=require("../../@babel/runtime/helpers/esm/objectWithoutProperties.cjs"),Q=require("../../../_virtual/index4.cjs"),ee=require("../../rc-resize-observer/es/index.cjs"),j=require("../../rc-util/es/hooks/useLayoutEffect.cjs"),te=require("../../rc-util/es/hooks/useMergedState.cjs"),w=require("../../rc-util/es/raf.cjs"),ae=require("react"),re=require("./calculateNodeHeight.cjs");function ne(n){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(o,e,s.get?s:{enumerable:!0,get:()=>n[e]})}}return o.default=n,Object.freeze(o)}const t=ne(ae);var ue=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],g=0,m=1,_=2,le=t.forwardRef(function(n,o){var e=n,s=e.prefixCls,O=e.defaultValue,p=e.value,a=e.autoSize,i=e.onResize,T=e.className,$=e.style,b=e.disabled,c=e.onChange,d=e.onInternalAutoSize,P=K.default(e,ue),V=te.default(O,{value:p,postState:function(r){return r??""}}),y=f.default(V,2),D=y[0],Z=y[1],H=function(r){Z(r.target.value),c?.(r)},S=t.useRef();t.useImperativeHandle(o,function(){return{textArea:S.current}});var L=t.useMemo(function(){return a&&J.default(a)==="object"?[a.minRows,a.maxRows]:[]},[a]),E=f.default(L,2),q=E[0],x=E[1],R=!!a,k=t.useState(_),A=f.default(k,2),u=A[0],v=A[1],B=t.useState(),I=f.default(B,2),G=I[0],U=I[1],M=function(){v(g),process.env.NODE_ENV==="test"&&d?.()};j.default(function(){R&&M()},[p,q,x,R]),j.default(function(){if(u===g)v(m);else if(u===m){var l=re.default(S.current,!1,q,x);v(_),U(l)}},[u]);var h=t.useRef(),C=function(){w.default.cancel(h.current)},W=function(r){u===_&&(i?.(r),a&&(C(),h.current=w.default(function(){M()})))};t.useEffect(function(){return C},[]);var X=R?G:null,z=N.default(N.default({},$),X);return(u===g||u===m)&&(z.overflowY="hidden",z.overflowX="hidden"),t.createElement(ee.default,{onResize:W,disabled:!(a||i)},t.createElement("textarea",Y.default({},P,{ref:S,style:z,className:Q.default(s,T,F.default({},"".concat(s,"-disabled"),b)),disabled:b,value:D,onChange:H})))});exports.default=le;
2
2
  //# sourceMappingURL=ResizableTextArea.cjs.map
@@ -4,7 +4,7 @@ import w from "../../@babel/runtime/helpers/esm/objectSpread2.es.js";
4
4
  import J from "../../@babel/runtime/helpers/esm/typeof.es.js";
5
5
  import s from "../../@babel/runtime/helpers/esm/slicedToArray.es.js";
6
6
  import K from "../../@babel/runtime/helpers/esm/objectWithoutProperties.es.js";
7
- import Q from "../../../_virtual/index.es3.js";
7
+ import Q from "../../../_virtual/index.es4.js";
8
8
  import ee from "../../rc-resize-observer/es/index.es.js";
9
9
  import M from "../../rc-util/es/hooks/useLayoutEffect.es.js";
10
10
  import te from "../../rc-util/es/hooks/useMergedState.es.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const be=require("../../@babel/runtime/helpers/esm/extends.cjs"),X=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),d=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),ze=require("../../@babel/runtime/helpers/esm/toConsumableArray.cjs"),x=require("../../@babel/runtime/helpers/esm/slicedToArray.cjs"),qe=require("../../@babel/runtime/helpers/esm/objectWithoutProperties.cjs"),g=require("../../../_virtual/index3.cjs"),Te=require("../../rc-input/es/BaseInput.cjs"),Ae=require("../../rc-util/es/hooks/useMergedState.cjs"),n=require("react"),Fe=require("../../rc-input/es/hooks/useCount.cjs"),Y=require("../../rc-input/es/utils/commonUtils.cjs"),Ne=require("./ResizableTextArea.cjs");var Oe=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],$e=n.forwardRef(function(t,Z){var C,B=t.defaultValue,_=t.value,p=t.onFocus,y=t.onBlur,L=t.onChange,R=t.allowClear,M=t.maxLength,S=t.onCompositionStart,w=t.onCompositionEnd,ee=t.suffix,P=t.prefixCls,s=P===void 0?"rc-textarea":P,E=t.showCount,te=t.count,ae=t.className,v=t.style,m=t.disabled,ne=t.hidden,l=t.classNames,i=t.styles,b=t.onResize,oe=t.onClear,D=t.onPressEnter,K=t.readOnly,V=t.autoSize,z=t.onKeyDown,le=qe.default(t,Oe),re=Ae.default(B,{value:_,defaultValue:B}),W=x.default(re,2),q=W[0],j=W[1],T=q==null?"":String(q),ue=n.useState(!1),k=x.default(ue,2),se=k[0],A=k[1],F=n.useRef(!1),ie=n.useState(null),H=x.default(ie,2),de=H[0],ce=H[1],U=n.useRef(null),N=n.useRef(null),r=function(){var e;return(e=N.current)===null||e===void 0?void 0:e.textArea},G=function(){r().focus()};n.useImperativeHandle(Z,function(){var a;return{resizableTextArea:N.current,focus:G,blur:function(){r().blur()},nativeElement:((a=U.current)===null||a===void 0?void 0:a.nativeElement)||r()}}),n.useEffect(function(){A(function(a){return!m&&a})},[m]);var fe=n.useState(null),J=x.default(fe,2),O=J[0],ve=J[1];n.useEffect(function(){if(O){var a;(a=r()).setSelectionRange.apply(a,ze.default(O))}},[O]);var o=Fe.default(te,E),c=(C=o.max)!==null&&C!==void 0?C:M,me=Number(c)>0,$=o.strategy(T),he=!!c&&$>c,Q=function(e,u){var h=u;!F.current&&o.exceedFormatter&&o.max&&o.strategy(u)>o.max&&(h=o.exceedFormatter(u,{max:o.max}),u!==h&&ve([r().selectionStart||0,r().selectionEnd||0])),j(h),Y.resolveOnChange(e.currentTarget,e,L,h)},xe=function(e){F.current=!0,S?.(e)},ge=function(e){F.current=!1,Q(e,e.currentTarget.value),w?.(e)},Ce=function(e){Q(e,e.target.value)},pe=function(e){e.key==="Enter"&&D&&D(e),z?.(e)},ye=function(e){A(!0),p?.(e)},Re=function(e){A(!1),y?.(e)},Se=function(e){j(""),G(),Y.resolveOnChange(r(),e,L)},I=ee,f;o.show&&(o.showFormatter?f=o.showFormatter({value:T,count:$,maxLength:c}):f="".concat($).concat(me?" / ".concat(c):""),I=n.createElement(n.Fragment,null,I,n.createElement("span",{className:g.default("".concat(s,"-data-count"),l?.count),style:i?.count},f)));var we=function(e){var u;b?.(e),(u=r())!==null&&u!==void 0&&u.style.height&&ce(!0)},Ee=!V&&!E&&!R;return n.createElement(Te.default,{ref:U,value:T,allowClear:R,handleReset:Se,suffix:I,prefixCls:s,classNames:d.default(d.default({},l),{},{affixWrapper:g.default(l?.affixWrapper,X.default(X.default({},"".concat(s,"-show-count"),E),"".concat(s,"-textarea-allow-clear"),R))}),disabled:m,focused:se,className:g.default(ae,he&&"".concat(s,"-out-of-range")),style:d.default(d.default({},v),de&&!Ee?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof f=="string"?f:void 0}},hidden:ne,readOnly:K,onClear:oe},n.createElement(Ne.default,be.default({},le,{autoSize:V,maxLength:M,onKeyDown:pe,onChange:Ce,onFocus:ye,onBlur:Re,onCompositionStart:xe,onCompositionEnd:ge,className:g.default(l?.textarea),style:d.default(d.default({},i?.textarea),{},{resize:v?.resize}),disabled:m,prefixCls:s,onResize:we,ref:N,readOnly:K})))});exports.default=$e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const be=require("../../@babel/runtime/helpers/esm/extends.cjs"),X=require("../../@babel/runtime/helpers/esm/defineProperty.cjs"),d=require("../../@babel/runtime/helpers/esm/objectSpread2.cjs"),ze=require("../../@babel/runtime/helpers/esm/toConsumableArray.cjs"),x=require("../../@babel/runtime/helpers/esm/slicedToArray.cjs"),qe=require("../../@babel/runtime/helpers/esm/objectWithoutProperties.cjs"),g=require("../../../_virtual/index4.cjs"),Te=require("../../rc-input/es/BaseInput.cjs"),Ae=require("../../rc-util/es/hooks/useMergedState.cjs"),n=require("react"),Fe=require("../../rc-input/es/hooks/useCount.cjs"),Y=require("../../rc-input/es/utils/commonUtils.cjs"),Ne=require("./ResizableTextArea.cjs");var Oe=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],$e=n.forwardRef(function(t,Z){var C,B=t.defaultValue,_=t.value,p=t.onFocus,y=t.onBlur,L=t.onChange,R=t.allowClear,M=t.maxLength,S=t.onCompositionStart,w=t.onCompositionEnd,ee=t.suffix,P=t.prefixCls,s=P===void 0?"rc-textarea":P,E=t.showCount,te=t.count,ae=t.className,v=t.style,m=t.disabled,ne=t.hidden,l=t.classNames,i=t.styles,b=t.onResize,oe=t.onClear,D=t.onPressEnter,K=t.readOnly,V=t.autoSize,z=t.onKeyDown,le=qe.default(t,Oe),re=Ae.default(B,{value:_,defaultValue:B}),W=x.default(re,2),q=W[0],j=W[1],T=q==null?"":String(q),ue=n.useState(!1),k=x.default(ue,2),se=k[0],A=k[1],F=n.useRef(!1),ie=n.useState(null),H=x.default(ie,2),de=H[0],ce=H[1],U=n.useRef(null),N=n.useRef(null),r=function(){var e;return(e=N.current)===null||e===void 0?void 0:e.textArea},G=function(){r().focus()};n.useImperativeHandle(Z,function(){var a;return{resizableTextArea:N.current,focus:G,blur:function(){r().blur()},nativeElement:((a=U.current)===null||a===void 0?void 0:a.nativeElement)||r()}}),n.useEffect(function(){A(function(a){return!m&&a})},[m]);var fe=n.useState(null),J=x.default(fe,2),O=J[0],ve=J[1];n.useEffect(function(){if(O){var a;(a=r()).setSelectionRange.apply(a,ze.default(O))}},[O]);var o=Fe.default(te,E),c=(C=o.max)!==null&&C!==void 0?C:M,me=Number(c)>0,$=o.strategy(T),he=!!c&&$>c,Q=function(e,u){var h=u;!F.current&&o.exceedFormatter&&o.max&&o.strategy(u)>o.max&&(h=o.exceedFormatter(u,{max:o.max}),u!==h&&ve([r().selectionStart||0,r().selectionEnd||0])),j(h),Y.resolveOnChange(e.currentTarget,e,L,h)},xe=function(e){F.current=!0,S?.(e)},ge=function(e){F.current=!1,Q(e,e.currentTarget.value),w?.(e)},Ce=function(e){Q(e,e.target.value)},pe=function(e){e.key==="Enter"&&D&&D(e),z?.(e)},ye=function(e){A(!0),p?.(e)},Re=function(e){A(!1),y?.(e)},Se=function(e){j(""),G(),Y.resolveOnChange(r(),e,L)},I=ee,f;o.show&&(o.showFormatter?f=o.showFormatter({value:T,count:$,maxLength:c}):f="".concat($).concat(me?" / ".concat(c):""),I=n.createElement(n.Fragment,null,I,n.createElement("span",{className:g.default("".concat(s,"-data-count"),l?.count),style:i?.count},f)));var we=function(e){var u;b?.(e),(u=r())!==null&&u!==void 0&&u.style.height&&ce(!0)},Ee=!V&&!E&&!R;return n.createElement(Te.default,{ref:U,value:T,allowClear:R,handleReset:Se,suffix:I,prefixCls:s,classNames:d.default(d.default({},l),{},{affixWrapper:g.default(l?.affixWrapper,X.default(X.default({},"".concat(s,"-show-count"),E),"".concat(s,"-textarea-allow-clear"),R))}),disabled:m,focused:se,className:g.default(ae,he&&"".concat(s,"-out-of-range")),style:d.default(d.default({},v),de&&!Ee?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof f=="string"?f:void 0}},hidden:ne,readOnly:K,onClear:oe},n.createElement(Ne.default,be.default({},le,{autoSize:V,maxLength:M,onKeyDown:pe,onChange:Ce,onFocus:ye,onBlur:Re,onCompositionStart:xe,onCompositionEnd:ge,className:g.default(l?.textarea),style:d.default(d.default({},i?.textarea),{},{resize:v?.resize}),disabled:m,prefixCls:s,onResize:we,ref:N,readOnly:K})))});exports.default=$e;
2
2
  //# sourceMappingURL=TextArea.cjs.map
@@ -4,7 +4,7 @@ import d from "../../@babel/runtime/helpers/esm/objectSpread2.es.js";
4
4
  import Ae from "../../@babel/runtime/helpers/esm/toConsumableArray.es.js";
5
5
  import x from "../../@babel/runtime/helpers/esm/slicedToArray.es.js";
6
6
  import Fe from "../../@babel/runtime/helpers/esm/objectWithoutProperties.es.js";
7
- import h from "../../../_virtual/index.es3.js";
7
+ import h from "../../../_virtual/index.es4.js";
8
8
  import Ne from "../../rc-input/es/BaseInput.es.js";
9
9
  import Te from "../../rc-util/es/hooks/useMergedState.es.js";
10
10
  import o, { useRef as Y, useImperativeHandle as $e, useEffect as Ie } from "react";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./TextArea.cjs");require("../../../_virtual/index3.cjs");require("../../rc-resize-observer/es/index.cjs");require("../../rc-util/es/hooks/useLayoutEffect.cjs");require("react");require("../../rc-util/es/raf.cjs");exports.default=e.default;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./TextArea.cjs");require("../../../_virtual/index4.cjs");require("../../rc-resize-observer/es/index.cjs");require("../../rc-util/es/hooks/useLayoutEffect.cjs");require("react");require("../../rc-util/es/raf.cjs");exports.default=e.default;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
1
  import t from "./TextArea.es.js";
2
- import "../../../_virtual/index.es3.js";
2
+ import "../../../_virtual/index.es4.js";
3
3
  import "../../rc-resize-observer/es/index.es.js";
4
4
  import "../../rc-util/es/hooks/useLayoutEffect.es.js";
5
5
  import "react";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../_virtual/interaction-plugin-core.cjs"),P=require("../../../_virtual/index4.cjs"),b=require("./interaction-parser.cjs"),E=require("./escaping.cjs"),T=require("./interaction-syntax.cjs"),N=require("./variable-name.cjs");var v;function O(){if(v)return _.__exports;v=1,Object.defineProperty(_.__exports,"__esModule",{value:!0}),_.__exports.transformInteractionsInTree=q;const p=P.default,y=b.__require(),f=E.__require(),d=T.__require(),h=N.__require();function g(e,s,l,o,r){return[{type:"text",value:e.substring(0,s)},{type:"element",data:{hName:r,hProperties:o}},{type:"text",value:e.substring(l)}]}function m(e,s,l){const o=(0,f.readInteraction)(e);if(!o?.complete||o.end!==e.length)return null;const r=(0,h.trimVariablePadding)(o.content);if(r.startsWith("%{")&&!r.startsWith("%{{"))return null;try{return s.parse(e).error?null:s.parseToRemarkFormat(e)}catch(n){return console.warn(`Failed to parse ${l} syntax:`,n),null}}function q(e,s){const l=e.data,o=new y.InteractionParser;if(l?.[d.TOKENIZED_TREE]===!0){(0,p.visit)(e,d.VARIABLE_NODE,(r,n,a)=>{n===null||a===null||a.children.splice(n,1,{type:"text",value:r.value})}),(0,p.visit)(e,d.INTERACTION_NODE,(r,n,a)=>{if(n===null||a===null)return;const i=r.value,t=m(i,o,s);a.children.splice(n,1,t?{type:"element",data:{hName:"custom-variable",hProperties:t}}:{type:"text",value:i})});return}(0,p.visit)(e,"text",(r,n,a)=>{if(n===null||a===null)return;const i=r.value;let t=0;for(;t<i.length;){if(i.startsWith("{{",t)){const c=(0,h.readVariableMarker)(i,t);if(!c)return;t=c.end;continue}if(!i.startsWith("?[",t)){t+=1;continue}const u=(0,f.readInteraction)(i,t);if(!u){t+=2;continue}if(!u.complete)return;const I=i.slice(u.start,u.end);try{const c=m(I,o,s);if(!c){t=u.end;continue}const x=g(i,u.start,u.end,c,"custom-variable");a.children.splice(n,1,...x);return}catch(c){console.warn(`Failed to parse ${s} syntax:`,c);return}}})}return _.__exports}exports.__require=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../_virtual/interaction-plugin-core.cjs"),P=require("../../../_virtual/index3.cjs"),b=require("./interaction-parser.cjs"),E=require("./escaping.cjs"),T=require("./interaction-syntax.cjs"),N=require("./variable-name.cjs");var v;function O(){if(v)return _.__exports;v=1,Object.defineProperty(_.__exports,"__esModule",{value:!0}),_.__exports.transformInteractionsInTree=q;const p=P.default,y=b.__require(),f=E.__require(),d=T.__require(),h=N.__require();function g(e,s,l,o,r){return[{type:"text",value:e.substring(0,s)},{type:"element",data:{hName:r,hProperties:o}},{type:"text",value:e.substring(l)}]}function m(e,s,l){const o=(0,f.readInteraction)(e);if(!o?.complete||o.end!==e.length)return null;const r=(0,h.trimVariablePadding)(o.content);if(r.startsWith("%{")&&!r.startsWith("%{{"))return null;try{return s.parse(e).error?null:s.parseToRemarkFormat(e)}catch(n){return console.warn(`Failed to parse ${l} syntax:`,n),null}}function q(e,s){const l=e.data,o=new y.InteractionParser;if(l?.[d.TOKENIZED_TREE]===!0){(0,p.visit)(e,d.VARIABLE_NODE,(r,n,a)=>{n===null||a===null||a.children.splice(n,1,{type:"text",value:r.value})}),(0,p.visit)(e,d.INTERACTION_NODE,(r,n,a)=>{if(n===null||a===null)return;const i=r.value,t=m(i,o,s);a.children.splice(n,1,t?{type:"element",data:{hName:"custom-variable",hProperties:t}}:{type:"text",value:i})});return}(0,p.visit)(e,"text",(r,n,a)=>{if(n===null||a===null)return;const i=r.value;let t=0;for(;t<i.length;){if(i.startsWith("{{",t)){const c=(0,h.readVariableMarker)(i,t);if(!c)return;t=c.end;continue}if(!i.startsWith("?[",t)){t+=1;continue}const u=(0,f.readInteraction)(i,t);if(!u){t+=2;continue}if(!u.complete)return;const I=i.slice(u.start,u.end);try{const c=m(I,o,s);if(!c){t=u.end;continue}const x=g(i,u.start,u.end,c,"custom-variable");a.children.splice(n,1,...x);return}catch(c){console.warn(`Failed to parse ${s} syntax:`,c);return}}})}return _.__exports}exports.__require=O;
2
2
  //# sourceMappingURL=interaction-plugin-core.cjs.map
@@ -1,5 +1,5 @@
1
1
  import { __exports as p } from "../../../_virtual/interaction-plugin-core.es.js";
2
- import P from "../../../_virtual/index.es4.js";
2
+ import P from "../../../_virtual/index.es3.js";
3
3
  import { __require as x } from "./interaction-parser.es.js";
4
4
  import { __require as b } from "./escaping.es.js";
5
5
  import { __require as N } from "./interaction-syntax.es.js";
package/package.json CHANGED
@@ -196,7 +196,7 @@
196
196
  ]
197
197
  }
198
198
  },
199
- "version": "0.3.1",
199
+ "version": "0.3.2-dev.2",
200
200
  "type": "module",
201
201
  "exports": {
202
202
  ".": {