@lupinum/ginko-editor 0.1.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/CHANGELOG.md +7 -73
  2. package/LICENSE +1 -1
  3. package/README.md +15 -340
  4. package/dist/assets.d.ts +70 -0
  5. package/dist/assets.js +31 -0
  6. package/dist/core/component-props.d.ts +87 -0
  7. package/dist/core/component-props.js +134 -0
  8. package/dist/core/convert.d.ts +24 -0
  9. package/dist/core/convert.js +278 -0
  10. package/dist/core/editor.d.ts +60 -0
  11. package/dist/core/editor.js +85 -0
  12. package/dist/core/extensions.d.ts +38 -0
  13. package/dist/core/extensions.js +444 -0
  14. package/dist/core/file-images.d.ts +9 -0
  15. package/dist/core/file-images.js +54 -0
  16. package/dist/core/image-frame.d.ts +23 -0
  17. package/dist/core/image-frame.js +24 -0
  18. package/dist/core/index.d.ts +17 -0
  19. package/dist/core/index.js +17 -0
  20. package/dist/core/link-card.d.ts +20 -0
  21. package/dist/core/link-card.js +70 -0
  22. package/dist/core/link.d.ts +3 -0
  23. package/dist/core/link.js +8 -0
  24. package/dist/core/move.d.ts +11 -0
  25. package/dist/core/move.js +37 -0
  26. package/dist/core/paste-html.d.ts +6 -0
  27. package/dist/core/paste-html.js +384 -0
  28. package/dist/core/paste.d.ts +21 -0
  29. package/dist/core/paste.js +108 -0
  30. package/dist/core/problems.d.ts +31 -0
  31. package/dist/core/problems.js +54 -0
  32. package/dist/core/search.d.ts +47 -0
  33. package/dist/core/search.js +148 -0
  34. package/dist/core/slash.d.ts +93 -0
  35. package/dist/core/slash.js +215 -0
  36. package/dist/core/table.d.ts +34 -0
  37. package/dist/core/table.js +141 -0
  38. package/dist/core/uploads.d.ts +23 -0
  39. package/dist/core/uploads.js +71 -0
  40. package/dist/core/use-editor.d.ts +19 -0
  41. package/dist/core/use-editor.js +53 -0
  42. package/dist/index.d.ts +6 -15
  43. package/dist/index.js +6 -5668
  44. package/dist/issues.d.ts +49 -0
  45. package/dist/issues.js +9 -0
  46. package/dist/today.d.ts +6 -0
  47. package/dist/today.js +19 -0
  48. package/dist/useUpload.d.ts +48 -0
  49. package/dist/useUpload.js +59 -0
  50. package/dist/values.d.ts +14 -0
  51. package/dist/values.js +36 -0
  52. package/package.json +35 -95
  53. package/dist/GinkoEditor.vue.d.ts +0 -96
  54. package/dist/GinkoImagePicker.vue.d.ts +0 -36
  55. package/dist/agent/AGENTS.md +0 -13
  56. package/dist/agent/pages/docs/getting-started/collaboration.md +0 -435
  57. package/dist/agent/pages/docs/getting-started/component-coverage.md +0 -107
  58. package/dist/agent/pages/docs/getting-started/customize.md +0 -384
  59. package/dist/agent/pages/docs/getting-started/images.md +0 -188
  60. package/dist/agent/pages/docs/getting-started/in-place-editing.md +0 -110
  61. package/dist/agent/pages/docs/getting-started/layout-blocks.md +0 -148
  62. package/dist/agent/pages/docs/getting-started/runtime.md +0 -111
  63. package/dist/agent/pages/docs/getting-started.md +0 -128
  64. package/dist/authoring-D7MJezVG.js +0 -1780
  65. package/dist/authoring-D7MJezVG.js.map +0 -1
  66. package/dist/authoring.d.ts +0 -122
  67. package/dist/authoring.js +0 -2
  68. package/dist/collaboration.d.ts +0 -14
  69. package/dist/collaboration.js +0 -907
  70. package/dist/collaboration.js.map +0 -1
  71. package/dist/composables/useAssetRequests.d.ts +0 -44
  72. package/dist/composables/useCollaborationBinding.d.ts +0 -59
  73. package/dist/composables/useDevice.d.ts +0 -10
  74. package/dist/composables/useInsertMenu.d.ts +0 -67
  75. package/dist/composables/useMarkdownSync.d.ts +0 -96
  76. package/dist/composables/useStableAuthoringKit.d.ts +0 -16
  77. package/dist/documentConfig-Z6LdrWZj.js +0 -2360
  78. package/dist/documentConfig-Z6LdrWZj.js.map +0 -1
  79. package/dist/editorProps.d.ts +0 -124
  80. package/dist/index.js.map +0 -1
  81. package/dist/layout-kit.d.ts +0 -922
  82. package/dist/lib/collaboration/presence-record.d.ts +0 -18
  83. package/dist/lib/collaboration/presence.d.ts +0 -103
  84. package/dist/lib/collaboration/protocol.d.ts +0 -133
  85. package/dist/lib/collaboration/recovery.d.ts +0 -45
  86. package/dist/lib/collaboration/session.d.ts +0 -163
  87. package/dist/lib/collaboration/validation.d.ts +0 -42
  88. package/dist/lib/component-converters.d.ts +0 -119
  89. package/dist/lib/config/documentConfig.d.ts +0 -19
  90. package/dist/lib/config/editorConfig.d.ts +0 -38
  91. package/dist/lib/container-items.d.ts +0 -55
  92. package/dist/lib/conversionInvariants.d.ts +0 -3
  93. package/dist/lib/conversionLogger.d.ts +0 -10
  94. package/dist/lib/conversionPipeline.d.ts +0 -17
  95. package/dist/lib/conversionState.d.ts +0 -10
  96. package/dist/lib/conversionTypes.d.ts +0 -50
  97. package/dist/lib/editor-operations.d.ts +0 -39
  98. package/dist/lib/environment.d.ts +0 -6
  99. package/dist/lib/extensions/code-block.d.ts +0 -18
  100. package/dist/lib/extensions/component-boundary.d.ts +0 -9
  101. package/dist/lib/extensions/container-items.d.ts +0 -29
  102. package/dist/lib/extensions/element.d.ts +0 -19
  103. package/dist/lib/extensions/file.d.ts +0 -24
  104. package/dist/lib/extensions/heading.d.ts +0 -5
  105. package/dist/lib/extensions/image-upload.d.ts +0 -39
  106. package/dist/lib/extensions/image.d.ts +0 -39
  107. package/dist/lib/extensions/index.d.ts +0 -10
  108. package/dist/lib/extensions/inline-element.d.ts +0 -13
  109. package/dist/lib/extensions/markdown-clipboard.d.ts +0 -21
  110. package/dist/lib/extensions/profile.d.ts +0 -11
  111. package/dist/lib/extensions/slot.d.ts +0 -16
  112. package/dist/lib/extensions/span-style.d.ts +0 -15
  113. package/dist/lib/extensions/video.d.ts +0 -15
  114. package/dist/lib/image-properties.d.ts +0 -20
  115. package/dist/lib/input-rules.d.ts +0 -7
  116. package/dist/lib/markdown.d.ts +0 -11
  117. package/dist/lib/marks.d.ts +0 -7
  118. package/dist/lib/mdcToTiptap.d.ts +0 -20
  119. package/dist/lib/mdcTypes.d.ts +0 -20
  120. package/dist/lib/nodes.d.ts +0 -57
  121. package/dist/lib/nodeviews/block-actions.d.ts +0 -7
  122. package/dist/lib/nodeviews/code.d.ts +0 -4
  123. package/dist/lib/nodeviews/columns.d.ts +0 -17
  124. package/dist/lib/nodeviews/component.d.ts +0 -6
  125. package/dist/lib/nodeviews/icons.d.ts +0 -26
  126. package/dist/lib/nodeviews/image.d.ts +0 -9
  127. package/dist/lib/nodeviews/items.d.ts +0 -15
  128. package/dist/lib/nodeviews/lifecycle.d.ts +0 -45
  129. package/dist/lib/nodeviews/popover.d.ts +0 -15
  130. package/dist/lib/nodeviews/settings.d.ts +0 -11
  131. package/dist/lib/nodeviews/table-operations.d.ts +0 -50
  132. package/dist/lib/nodeviews/table.d.ts +0 -4
  133. package/dist/lib/profiles.d.ts +0 -62
  134. package/dist/lib/property-input.d.ts +0 -10
  135. package/dist/lib/property-step.d.ts +0 -77
  136. package/dist/lib/props.d.ts +0 -13
  137. package/dist/lib/stripStyleNodes.d.ts +0 -2
  138. package/dist/lib/tiptapToMdc.d.ts +0 -18
  139. package/dist/presence-record-CLdPZWKC.js +0 -291
  140. package/dist/presence-record-CLdPZWKC.js.map +0 -1
  141. package/dist/runtime.d.ts +0 -13
  142. package/dist/runtime.js +0 -3
  143. package/dist/style.css +0 -2
  144. package/dist/types.d.ts +0 -126
  145. package/dist/ui/GinkoActionButton.vue.d.ts +0 -8
  146. package/dist/ui/GinkoInsertMenu.vue.d.ts +0 -49
  147. package/dist/ui/GinkoKeyboardDock.vue.d.ts +0 -15
  148. package/dist/ui/GinkoNodePopover.vue.d.ts +0 -21
  149. package/dist/ui/GinkoRecipeIcon.vue.d.ts +0 -6
  150. package/dist/ui/GinkoSelectionToolbar.vue.d.ts +0 -10
  151. package/dist/ui/GinkoToolbar.vue.d.ts +0 -26
  152. package/dist/ui/GinkoToolbarIcon.vue.d.ts +0 -6
  153. package/dist/ui/block-shortcuts.d.ts +0 -6
  154. package/dist/ui/commands.d.ts +0 -78
  155. package/dist/ui/context.d.ts +0 -23
  156. package/dist/ui/editor-keyboard.d.ts +0 -15
  157. package/dist/ui/messages.d.ts +0 -214
  158. package/dist/ui/messages.de.d.ts +0 -6
  159. package/dist/ui/recipe-command.d.ts +0 -14
  160. package/dist/ui/recipe-search.d.ts +0 -47
  161. package/dist/ui/slash-command.d.ts +0 -17
  162. package/dist/ui/writingRecipes.d.ts +0 -13
  163. package/skills/ginko-editor/SKILL.md +0 -40
  164. package/skills/ginko-editor/agents/openai.yaml +0 -4
  165. package/skills/ginko-editor/references/in-place-editing.md +0 -50
  166. package/skills/ginko-editor/references/quickstart.md +0 -55
@@ -1,2360 +0,0 @@
1
- import { classifyPortableMarkdownElement as e, createHeadingIdGenerator as t, headingSlugText as n, parseMdcDocument as r, projectMdcDocument as i, serializeMdcDocument as a, validateStoredPortableMarkdownAst as o } from "@lupinum/ginko-content/cms-contract";
2
- import { Fragment as s, Slice as c } from "@tiptap/pm/model";
3
- import { Step as l, StepMap as u, StepResult as d } from "@tiptap/pm/transform";
4
- import { Plugin as ee, PluginKey as te, TextSelection as f } from "@tiptap/pm/state";
5
- import { InputRule as ne, Node as p, callOrReturn as re, getSchema as ie, mergeAttributes as m } from "@tiptap/core";
6
- import { Table as ae } from "@tiptap/extension-table";
7
- import { TableCell as oe } from "@tiptap/extension-table-cell";
8
- import { TableHeader as se } from "@tiptap/extension-table-header";
9
- import { TableRow as ce } from "@tiptap/extension-table-row";
10
- import le from "@tiptap/starter-kit";
11
- import ue from "@tiptap/extension-code-block";
12
- import de from "@tiptap/extension-heading";
13
- //#region src/lib/property-step.ts
14
- var fe = "ginkoSetNodePropertyV1", pe = "ginkoSetComponentVariantV1", h = /* @__PURE__ */ new Set([
15
- "element",
16
- "inline-element",
17
- "image",
18
- "file",
19
- "video"
20
- ]), me = /* @__PURE__ */ new Set([
21
- "__proto__",
22
- "prototype",
23
- "constructor"
24
- ]), he = Symbol.for("@lupinum/ginko-editor/property-steps/v1"), ge = "ginkoSetNodeAttributeV1", _e = Symbol.for("@lupinum/ginko-editor/attribute-step/v1");
25
- function g(e, t = 0) {
26
- if (t > 32) throw RangeError("Property value is too deeply nested.");
27
- if (e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e)) return e;
28
- if (Array.isArray(e)) return e.map((e) => g(e, t + 1));
29
- if (e && typeof e == "object" && [Object.prototype, null].includes(Object.getPrototypeOf(e))) return Object.fromEntries(Object.entries(e).map(([e, n]) => [e, g(n, t + 1)]));
30
- throw RangeError("Property value must be JSON data.");
31
- }
32
- var ve = class e extends l {
33
- pos;
34
- key;
35
- value;
36
- constructor(e, t, n) {
37
- if (super(), this.pos = e, this.key = t, !Number.isSafeInteger(e) || e < 0 || !t || me.has(t)) throw RangeError("Invalid property step position or key.");
38
- this.value = n === void 0 ? void 0 : g(n);
39
- }
40
- apply(e) {
41
- if (this.pos >= e.content.size) return d.fail("Property position is outside the document.");
42
- let t = e.nodeAt(this.pos);
43
- if (!t || !h.has(t.type.name)) return d.fail("No property node at this position.");
44
- let n = { ...t.attrs.props };
45
- this.value === void 0 ? delete n[this.key] : n[this.key] = this.value;
46
- let r = t.type.create({
47
- ...t.attrs,
48
- props: n
49
- }, null, t.marks);
50
- return d.fromReplace(e, this.pos, this.pos + 1, new c(s.from(r), 0, +!t.isLeaf));
51
- }
52
- getMap() {
53
- return u.empty;
54
- }
55
- invert(t) {
56
- let n = t.nodeAt(this.pos);
57
- if (!n || !h.has(n.type.name)) throw RangeError("No property node to invert.");
58
- return new e(this.pos, this.key, n.attrs.props?.[this.key]);
59
- }
60
- map(t) {
61
- let n = t.mapResult(this.pos, 1);
62
- return n.deleted ? null : new e(n.pos, this.key, this.value);
63
- }
64
- merge(t) {
65
- return t instanceof e && t.pos === this.pos && t.key === this.key ? new e(this.pos, this.key, t.value) : null;
66
- }
67
- toJSON() {
68
- return {
69
- stepType: fe,
70
- pos: this.pos,
71
- key: this.key,
72
- ...this.value === void 0 ? { remove: !0 } : { value: this.value }
73
- };
74
- }
75
- static fromJSON(t, n) {
76
- if (!n || typeof n != "object" || !("pos" in n) || !("key" in n) || typeof n.pos != "number" || typeof n.key != "string") throw RangeError("Invalid property step.");
77
- if ("remove" in n) {
78
- if (n.remove !== !0 || "value" in n) throw RangeError("Invalid property removal.");
79
- return new e(n.pos, n.key, void 0);
80
- }
81
- if (!("value" in n)) throw RangeError("Property step needs a value.");
82
- return new e(n.pos, n.key, g(n.value));
83
- }
84
- }, ye = class e extends l {
85
- pos;
86
- tag;
87
- syntax;
88
- constructor(e, t, n) {
89
- if (super(), this.pos = e, this.tag = t, !Number.isSafeInteger(e) || e < 0 || !/^[a-z][a-z0-9-]*$/.test(t)) throw RangeError("Invalid component variant step.");
90
- this.syntax = n === void 0 ? void 0 : g(n);
91
- }
92
- apply(e) {
93
- if (this.pos >= e.content.size) return d.fail("Variant position is outside the document.");
94
- let t = e.nodeAt(this.pos);
95
- if (t?.type.name !== "element") return d.fail("No component at this position.");
96
- let n = { ...t.attrs.props };
97
- this.syntax === void 0 ? delete n.$ : n.$ = this.syntax;
98
- let r = t.type.create({
99
- ...t.attrs,
100
- tag: this.tag,
101
- props: n
102
- }, null, t.marks);
103
- return d.fromReplace(e, this.pos, this.pos + 1, new c(s.from(r), 0, 1));
104
- }
105
- getMap() {
106
- return u.empty;
107
- }
108
- invert(t) {
109
- let n = t.nodeAt(this.pos);
110
- if (n?.type.name !== "element") throw RangeError("No component to invert.");
111
- return new e(this.pos, n.attrs.tag, n.attrs.props?.$);
112
- }
113
- map(t) {
114
- let n = t.mapResult(this.pos, 1);
115
- return n.deleted ? null : new e(n.pos, this.tag, this.syntax);
116
- }
117
- merge(t) {
118
- return t instanceof e && t.pos === this.pos ? new e(this.pos, t.tag, t.syntax) : null;
119
- }
120
- toJSON() {
121
- return {
122
- stepType: pe,
123
- pos: this.pos,
124
- tag: this.tag,
125
- ...this.syntax === void 0 ? { removeSyntax: !0 } : { syntax: this.syntax }
126
- };
127
- }
128
- static fromJSON(t, n) {
129
- if (!n || typeof n != "object" || !("pos" in n) || !("tag" in n) || typeof n.pos != "number" || typeof n.tag != "string") throw RangeError("Invalid variant step.");
130
- if ("removeSyntax" in n) {
131
- if (n.removeSyntax !== !0 || "syntax" in n) throw RangeError("Invalid variant syntax removal.");
132
- return new e(n.pos, n.tag, void 0);
133
- }
134
- if (!("syntax" in n)) throw RangeError("Variant step needs source syntax.");
135
- return new e(n.pos, n.tag, g(n.syntax));
136
- }
137
- }, be = class e extends l {
138
- pos;
139
- key;
140
- value;
141
- constructor(e, t, n) {
142
- if (super(), this.pos = e, this.key = t, !Number.isSafeInteger(e) || e < 0 || !t || t === "props" || me.has(t)) throw RangeError("Invalid node attribute step.");
143
- this.value = g(n);
144
- }
145
- apply(e) {
146
- if (this.pos >= e.content.size) return d.fail("Attribute position is outside the document.");
147
- let t = e.nodeAt(this.pos);
148
- if (!t || t.isText || !Object.hasOwn(t.type.spec.attrs ?? {}, this.key)) return d.fail("Unknown node attribute.");
149
- let n = t.type.create({
150
- ...t.attrs,
151
- [this.key]: this.value
152
- }, null, t.marks);
153
- return d.fromReplace(e, this.pos, this.pos + 1, new c(s.from(n), 0, +!t.isLeaf));
154
- }
155
- getMap() {
156
- return u.empty;
157
- }
158
- invert(t) {
159
- let n = t.nodeAt(this.pos);
160
- if (!n || !Object.hasOwn(n.attrs, this.key)) throw RangeError("No node attribute to invert.");
161
- return new e(this.pos, this.key, n.attrs[this.key]);
162
- }
163
- map(t) {
164
- let n = t.mapResult(this.pos, 1);
165
- return n.deleted ? null : new e(n.pos, this.key, this.value);
166
- }
167
- merge(t) {
168
- return t instanceof e && t.pos === this.pos && t.key === this.key ? new e(this.pos, this.key, t.value) : null;
169
- }
170
- toJSON() {
171
- return {
172
- stepType: ge,
173
- pos: this.pos,
174
- key: this.key,
175
- value: this.value
176
- };
177
- }
178
- static fromJSON(t, n) {
179
- if (!n || typeof n != "object" || !("pos" in n) || !("key" in n) || !("value" in n) || typeof n.pos != "number" || typeof n.key != "string") throw RangeError("Invalid node attribute step.");
180
- return new e(n.pos, n.key, g(n.value));
181
- }
182
- };
183
- function xe() {
184
- Reflect.get(l, he) !== !0 && (l.jsonID(fe, ve), l.jsonID(pe, ye), Object.defineProperty(l, he, { value: !0 })), Reflect.get(l, _e) !== !0 && (l.jsonID(ge, be), Object.defineProperty(l, _e, { value: !0 }));
185
- }
186
- //#endregion
187
- //#region src/lib/conversionInvariants.ts
188
- var Se = /* @__PURE__ */ new Set([
189
- "hardBreak",
190
- "inline-element",
191
- "span-style",
192
- "text"
193
- ]), Ce = /* @__PURE__ */ new Set([
194
- "blockquote",
195
- "bulletList",
196
- "codeBlock",
197
- "comment",
198
- "element",
199
- "file",
200
- "heading",
201
- "horizontalRule",
202
- "image",
203
- "listItem",
204
- "orderedList",
205
- "paragraph",
206
- "slot",
207
- "table",
208
- "tableCell",
209
- "tableHeader",
210
- "tableRow",
211
- "video"
212
- ]), we = /* @__PURE__ */ new Set([
213
- "bold",
214
- "code",
215
- "italic",
216
- "strike",
217
- "link"
218
- ]);
219
- function _(e, t, n, r = "error", i = "validate") {
220
- return {
221
- code: e,
222
- context: n,
223
- message: t,
224
- phase: i,
225
- severity: r
226
- };
227
- }
228
- function v(e) {
229
- return Se.has(e);
230
- }
231
- function Te(e) {
232
- return Ce.has(e);
233
- }
234
- function Ee(e) {
235
- return v(e) || Te(e);
236
- }
237
- function De(e, t, n, r) {
238
- if (!e || typeof e != "object") {
239
- t.push(_("invalid_node_shape", "Node is not a valid object", {
240
- depth: r,
241
- parentType: n
242
- }));
243
- return;
244
- }
245
- if (!e.type || typeof e.type != "string") {
246
- t.push(_("missing_node_type", "Node is missing a valid \"type\"", {
247
- depth: r,
248
- parentType: n
249
- }));
250
- return;
251
- }
252
- if (Ee(e.type) || t.push(_("unknown_node_type", `Unknown node type "${e.type}"`, {
253
- depth: r,
254
- nodeType: e.type,
255
- parentType: n
256
- })), e.type === "text") {
257
- for (let i of e.marks ?? []) we.has(i.type) || t.push(_("unknown_mark_type", `Unsupported text formatting "${i.type}"`, {
258
- depth: r,
259
- parentType: n
260
- }));
261
- typeof e.text != "string" && t.push(_("invalid_text_node", "Text node is missing string text", {
262
- depth: r,
263
- parentType: n
264
- })), Array.isArray(e.content) && e.content.length > 0 && t.push(_("text_node_has_children", "Text node must not contain child content", {
265
- depth: r,
266
- parentType: n
267
- }));
268
- return;
269
- }
270
- if (e.type === "paragraph") {
271
- let n = Array.isArray(e.content) ? e.content : [];
272
- for (let e of n) {
273
- let n = e?.type;
274
- (!n || !v(n)) && t.push(_("block_inside_paragraph", "Paragraph contains non-inline child node", {
275
- childType: n ?? null,
276
- depth: r
277
- }));
278
- }
279
- }
280
- if (e.type === "listItem") {
281
- let n = Array.isArray(e.content) ? e.content : [];
282
- n.length === 0 && t.push(_("list_item_empty", "List item must contain at least one child node", { depth: r })), n[0]?.type !== "paragraph" && t.push(_("list_item_first_child_not_paragraph", "List item must start with paragraph node", {
283
- depth: r,
284
- firstChildType: n[0]?.type ?? null
285
- }));
286
- }
287
- if (Array.isArray(e.content)) for (let n of e.content) De(n, t, e.type, r + 1);
288
- }
289
- function y(e) {
290
- let t = [];
291
- if (!e || typeof e != "object") return t.push(_("invalid_doc_shape", "Document payload is not a valid object")), t;
292
- if (e.type !== "doc" && t.push(_("invalid_doc_root_type", "Root document type must be \"doc\"", { actual: e.type ?? null })), !Array.isArray(e.content)) return t.push(_("missing_doc_content", "Root document must contain a content array")), t;
293
- if (e.content.length === 0) return t.push(_("empty_doc", "Root document content is empty", void 0, "warn")), t;
294
- for (let n of e.content) n?.type && v(n.type) && t.push(_("inline_node_at_root", "Inline node found at document root", { childType: n.type })), De(n, t, "doc", 1);
295
- return t;
296
- }
297
- //#endregion
298
- //#region src/lib/conversionLogger.ts
299
- var Oe = 0;
300
- function b() {
301
- return (/* @__PURE__ */ new Date()).toISOString();
302
- }
303
- function ke() {
304
- return Oe += 1, `conv_${Date.now().toString(36)}_${Oe.toString(36)}`;
305
- }
306
- function x(e) {
307
- return {
308
- traceId: ke(),
309
- timeline: [{
310
- at: b(),
311
- kind: "start",
312
- data: e
313
- }]
314
- };
315
- }
316
- function S(e, t, n) {
317
- e.timeline.push({
318
- at: b(),
319
- kind: "phase",
320
- phase: t,
321
- data: n
322
- });
323
- }
324
- function C(e, t) {
325
- e.timeline.push({
326
- at: b(),
327
- kind: "issue",
328
- phase: t.phase,
329
- issueCode: t.code,
330
- message: t.message,
331
- severity: t.severity,
332
- data: t.context
333
- }), t.severity;
334
- }
335
- function w(e, t) {
336
- return e.timeline.push({
337
- at: b(),
338
- kind: "finish",
339
- data: t
340
- }), e.timeline;
341
- }
342
- //#endregion
343
- //#region src/lib/stripStyleNodes.ts
344
- function T(e) {
345
- let t = (e) => {
346
- if (e.type === "element" && e.tag === "style") return null;
347
- if (e.type === "element") {
348
- let n = (e.children || []).map((e) => t(e)).filter(Boolean);
349
- return {
350
- ...e,
351
- children: n
352
- };
353
- }
354
- if (e.type === "root") {
355
- let n = (e.children || []).map((e) => t(e)).filter(Boolean);
356
- return {
357
- ...e,
358
- children: n
359
- };
360
- }
361
- return e;
362
- };
363
- return t(e);
364
- }
365
- //#endregion
366
- //#region src/lib/markdown.ts
367
- var Ae = { componentSyntax: "colon" }, je = /* @__PURE__ */ new Set([
368
- "thead",
369
- "tbody",
370
- "tfoot"
371
- ]);
372
- function Me(e) {
373
- let n = t();
374
- return T({
375
- children: E(e.nodes, n),
376
- type: "root"
377
- });
378
- }
379
- var Ne = /^h([1-6])$/;
380
- function Pe(e, t, r, i) {
381
- let a = Ne.exec(e)?.[1];
382
- if (!a) return t;
383
- let o = i(n(r), Number(a));
384
- if (t.id !== o) return t;
385
- let s = { ...t };
386
- return delete s.id, s;
387
- }
388
- async function Fe(e, t = {}) {
389
- if (!e || !e.children?.length) return "";
390
- let n = await a({
391
- frontmatter: {},
392
- meta: {},
393
- nodes: Re(T(e).children || [], t)
394
- }, Ae);
395
- return n.trim() ? n.endsWith("\n") ? n : `${n}\n` : "";
396
- }
397
- function E(e, t) {
398
- return e.flatMap((e) => Ie(e, t));
399
- }
400
- function Ie(e, t) {
401
- if (typeof e == "string") return e ? [{
402
- type: "text",
403
- value: e
404
- }] : [];
405
- let [n, r, ...i] = e;
406
- if (n === null) return [{
407
- type: "comment",
408
- value: String(i[0] ?? "")
409
- }];
410
- if (je.has(n)) return E(i, t);
411
- let a = Pe(n, Le(r), i, t);
412
- return [{
413
- children: E(i, t),
414
- props: a,
415
- tag: n,
416
- type: "element"
417
- }];
418
- }
419
- function Le(e = {}) {
420
- let t = {};
421
- for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
422
- return t;
423
- }
424
- function Re(e, t) {
425
- return e.flatMap((e) => {
426
- let n = ze(e, t);
427
- return e.type === "element" && e.props?.__mdc_block === !0 ? [[
428
- "p",
429
- {},
430
- ...n
431
- ]] : n;
432
- });
433
- }
434
- function ze(e, t) {
435
- if (e.type === "text") return [e.value ?? ""];
436
- if (e.type === "comment") return [[
437
- null,
438
- {},
439
- e.value ?? ""
440
- ]];
441
- let n = Be(e.props || {});
442
- return e.tag === "video" && t.videoOutput === "html" ? [["video", {
443
- controls: !0,
444
- ...n.height === void 0 ? {} : { height: n.height },
445
- ...n.src === void 0 ? {} : { src: n.src },
446
- ...n.title === void 0 ? {} : { title: n.title },
447
- ...n.width === void 0 ? {} : { width: n.width },
448
- $: { html: 1 }
449
- }]] : [[
450
- e.tag,
451
- n,
452
- ...Re(e.children || [], t)
453
- ]];
454
- }
455
- function Be(e) {
456
- let t = {};
457
- for (let [n, r] of Object.entries(e)) r !== void 0 && (n.startsWith("__mdc_") || (t[n] = r));
458
- return t;
459
- }
460
- //#endregion
461
- //#region src/lib/nodes.ts
462
- function D(e, t) {
463
- let n = e, r = Number.parseInt(n.tag?.charAt(1) || "1", 10), { id: i, ...a } = n.props ?? {}, o = { level: r };
464
- return typeof i == "string" && i && (o.id = i), t({
465
- ...n,
466
- props: a
467
- }, "heading", { attrs: o });
468
- }
469
- function Ve(e, t, n = {}) {
470
- e.children = e.children?.filter((e) => !(e.type === "text" && !e.value)) || [];
471
- let r = e.children.map((n) => t(n, e)).flat().filter(Boolean);
472
- if (n.allowImageLift !== !1 && r.length === 1 && r[0]?.type === "image") return r[0];
473
- let i = !e.props || Object.keys(e.props).length === 0 ? void 0 : e.props, a = /* @__PURE__ */ new Set([
474
- "hardBreak",
475
- "inline-element",
476
- "span-style",
477
- "text"
478
- ]);
479
- if (r.some((e) => {
480
- let t = e?.type;
481
- return !t || !a.has(t);
482
- })) {
483
- let e = [], t = [], o = () => {
484
- t.length !== 0 && (e.push({
485
- attrs: i,
486
- content: t,
487
- type: "paragraph"
488
- }), t = []);
489
- };
490
- for (let s of r) {
491
- let r = s?.type;
492
- r && a.has(r) ? t.push(s) : (o(), n.allowImageLift === !1 && e.length === 0 && e.push({
493
- attrs: i,
494
- content: [],
495
- type: "paragraph"
496
- }), e.push(s));
497
- }
498
- if (o(), e.length > 0) return e;
499
- }
500
- return {
501
- attrs: i,
502
- content: r,
503
- type: "paragraph"
504
- };
505
- }
506
- function He(e, t) {
507
- let n = e.children || [], r = [
508
- "blockquote",
509
- "h1",
510
- "h2",
511
- "h3",
512
- "h4",
513
- "h5",
514
- "h6",
515
- "hr",
516
- "ol",
517
- "p",
518
- "pre",
519
- "table",
520
- "ul"
521
- ], i = n.some((e) => e.type === "element" && r.includes(e.tag || "")), a;
522
- return a = i ? n : [{
523
- children: n,
524
- props: {},
525
- tag: "p",
526
- type: "element"
527
- }], t(e, "listItem", { children: a });
528
- }
529
- function Ue(e, t, n) {
530
- let r = e.children || [], i = [
531
- "blockquote",
532
- "h1",
533
- "h2",
534
- "h3",
535
- "h4",
536
- "h5",
537
- "h6",
538
- "hr",
539
- "ol",
540
- "p",
541
- "pre",
542
- "table",
543
- "ul"
544
- ], a = r.some((e) => e.type === "element" && i.includes(e.tag || "")), o;
545
- o = a ? r : [{
546
- children: r,
547
- props: {},
548
- tag: "p",
549
- type: "element"
550
- }];
551
- let s = typeof e.props?.style == "string" ? e.props.style : "", c = /(?:^|;)\s*text-align:\s*(left|center|right)\s*(?:;|$)/i.exec(s)?.[1]?.toLowerCase();
552
- return n(e, t, {
553
- attrs: { align: c },
554
- children: o
555
- });
556
- }
557
- function We(e, t, n) {
558
- let r = n(e, "codeBlock", { attrs: {
559
- filename: e.props?.filename,
560
- language: e.props?.language ?? null
561
- } }), i = e.props?.code, a = typeof i == "string" ? i : t(e), o = r.content;
562
- (!o || o.length === 0) && a && (r.content = [{
563
- text: a,
564
- type: "text"
565
- }]);
566
- let s = r.content || [];
567
- return s.length === 1 && s[0]?.text === "" && (r.content = []), s.forEach((e) => {
568
- delete e.marks;
569
- }), r;
570
- }
571
- function Ge(e, t, n) {
572
- let r = O(e.props?.style), i = O(e.props?.class) || O(e.props?.className), a = {
573
- class: t(i) ? String(i).trim() : void 0,
574
- style: t(r) ? String(r).trim() : void 0
575
- }, o = {
576
- ...e,
577
- props: { ...e.props }
578
- };
579
- return delete o.props.style, delete o.props.class, delete o.props.className, n(o, "span-style", { attrs: a });
580
- }
581
- function O(e) {
582
- return typeof e == "string" ? e : void 0;
583
- }
584
- function Ke(e, t) {
585
- let n = e.props || {}, r = n.name || n.slotName || "default", i = Je(e.children || []);
586
- return t(e, "slot", {
587
- attrs: { name: r },
588
- children: i
589
- });
590
- }
591
- var qe = /* @__PURE__ */ new Set([
592
- "blockquote",
593
- "h1",
594
- "h2",
595
- "h3",
596
- "h4",
597
- "h5",
598
- "h6",
599
- "hr",
600
- "ol",
601
- "p",
602
- "pre",
603
- "table",
604
- "template",
605
- "ul"
606
- ]);
607
- function Je(e) {
608
- let t = [], n = [], r = () => {
609
- n.length !== 0 && (t.push({
610
- children: n,
611
- props: {},
612
- tag: "p",
613
- type: "element"
614
- }), n = []);
615
- };
616
- for (let i of e) {
617
- let e = i.type === "element" ? i.props?.$ : void 0, a = e && typeof e == "object" && !Array.isArray(e) && e.block === 1;
618
- i.type === "element" && (qe.has(i.tag || "") || a) ? (r(), t.push(i)) : n.push(i);
619
- }
620
- return r(), t;
621
- }
622
- //#endregion
623
- //#region src/lib/component-converters.ts
624
- function Ye(e, t) {
625
- let n = e;
626
- return t(n, "file", { attrs: { props: n.props || {} } });
627
- }
628
- function k(e, t) {
629
- let n = e;
630
- return t(n, "image", { attrs: { props: n.props || {} } });
631
- }
632
- function Xe(e, t) {
633
- let n = e;
634
- return t(n, "video", { attrs: { ...n.props } });
635
- }
636
- function Ze(e, t) {
637
- return t(e, "comment", { attrs: { text: e.value } });
638
- }
639
- function Qe(e, t) {
640
- let n = e;
641
- return t(n, "blockquote", { children: n.children?.length ? Je(n.children) : [{
642
- type: "element",
643
- tag: "p",
644
- props: {},
645
- children: []
646
- }] });
647
- }
648
- function $e(e, t) {
649
- return t(e, "horizontalRule");
650
- }
651
- function et(e, t) {
652
- return t(e, "hardBreak");
653
- }
654
- function tt(e, t) {
655
- return t(e, "table");
656
- }
657
- function nt(e, t) {
658
- return t(e, "tableRow");
659
- }
660
- function rt(e, t) {
661
- return t(e, "tableHeader");
662
- }
663
- function it(e, t) {
664
- return t(e, "tableCell");
665
- }
666
- function at(e, t) {
667
- let n = e;
668
- return t(n, "orderedList", {
669
- attrs: { start: n.props?.start },
670
- children: n.children?.length ? n.children : [{
671
- type: "element",
672
- tag: "li",
673
- props: {},
674
- children: []
675
- }]
676
- });
677
- }
678
- function ot(e, t) {
679
- let n = e;
680
- return t(n, "bulletList", { children: n.children?.length ? n.children : [{
681
- type: "element",
682
- tag: "li",
683
- props: {},
684
- children: []
685
- }] });
686
- }
687
- function st(e, t) {
688
- return t(e);
689
- }
690
- function ct(e, t) {
691
- return t(e);
692
- }
693
- function lt(e, t) {
694
- return t(e);
695
- }
696
- function ut(e, t) {
697
- return t(e);
698
- }
699
- function dt(e, t) {
700
- return t(e);
701
- }
702
- function ft(e) {
703
- return {
704
- text: e.value,
705
- type: "text"
706
- };
707
- }
708
- //#endregion
709
- //#region src/lib/marks.ts
710
- var A = {
711
- a: "link",
712
- code: "code",
713
- del: "strike",
714
- em: "italic",
715
- strong: "bold"
716
- };
717
- function j(e) {
718
- if (e.type === "text") return e.value;
719
- let t = "";
720
- return e.children?.forEach((e) => {
721
- t += j(e);
722
- }), t;
723
- }
724
- function pt(e, t, n = [], r) {
725
- let i = { ...e.props }, a = [...n, {
726
- attrs: i,
727
- type: t
728
- }];
729
- if (e.type === "element" && e.tag === "code") {
730
- let t = j(e);
731
- return t ? [{
732
- marks: [...a].reverse(),
733
- text: t,
734
- type: "text"
735
- }] : [];
736
- }
737
- let o = e.children || [], s = [];
738
- for (let t of o) if (t.type === "text") {
739
- let e = j(t);
740
- if (!e) continue;
741
- s.push({
742
- marks: [...a].reverse(),
743
- text: e,
744
- type: "text"
745
- });
746
- } else if (t.type === "element" && t.tag && A[t.tag]) {
747
- let e = pt(t, A[t.tag], a, r);
748
- s.push(...e);
749
- } else if (t.type === "element" && r) {
750
- let n = r(t, e);
751
- n.content?.length && n.content.forEach((e) => {
752
- e.type === "text" && (e.marks = [...a].reverse());
753
- }), s.push(n);
754
- } else r && s.push(r(t, e));
755
- return s.filter((e) => e != null);
756
- }
757
- //#endregion
758
- //#region src/lib/props.ts
759
- function M(e) {
760
- if (!e) return !1;
761
- let t = String(e).trim();
762
- if (!t) return !1;
763
- let n = t.toLowerCase();
764
- return n !== "null" && n !== "undefined";
765
- }
766
- function N(e) {
767
- let t = e.trim();
768
- if (!t) return null;
769
- if (t.startsWith("./") || t.startsWith("../") || t.startsWith("/")) return t;
770
- try {
771
- let e = new URL(t);
772
- if (e.protocol === "http:" || e.protocol === "https:") return t;
773
- } catch {
774
- return null;
775
- }
776
- return null;
777
- }
778
- function mt(e) {
779
- return e.trim().startsWith("data:image/") ? e.trim() : N(e);
780
- }
781
- function ht(e) {
782
- let t = N(e);
783
- if (t) return t;
784
- let n = e.trim();
785
- try {
786
- return new URL(n).protocol === "blob:" ? n : null;
787
- } catch {
788
- return null;
789
- }
790
- }
791
- function P(e) {
792
- return mt(e) ?? ht(e);
793
- }
794
- function F(e) {
795
- let t = e.getAttribute("data-ginko-props");
796
- if (t) try {
797
- let e = JSON.parse(t, (e, t) => {
798
- if (typeof t == "number" && !Number.isFinite(t)) throw TypeError("Non-finite media property");
799
- return t;
800
- });
801
- return !e || typeof e != "object" || Array.isArray(e) ? void 0 : e;
802
- } catch {
803
- return;
804
- }
805
- }
806
- function gt(e) {
807
- let t = {};
808
- return M(e?.style) && (t.style = String(e.style).trim()), M(e?.class) && (t.class = String(e.class).trim()), t;
809
- }
810
- function _t(e, t) {
811
- return Object.entries({
812
- ...e,
813
- ...t
814
- }).map(([e, t]) => e === "className" ? ["class", typeof t == "string" ? t : t.join(" ")] : [e.trim(), t]).filter(([e]) => !!String(e).trim());
815
- }
816
- //#endregion
817
- //#region src/lib/mdcToTiptap.ts
818
- function vt(e, t) {
819
- let n = Object.entries(A).map(([t, n]) => [t, (t) => pt(t, n, [], e)]);
820
- return {
821
- ...Object.fromEntries(n),
822
- blockquote: (e) => Qe(e, t),
823
- br: (e) => et(e, t),
824
- comment: (e) => Ze(e, t),
825
- file: (e) => Ye(e, t),
826
- Image: (e) => k(e, t),
827
- image: (e) => k(e, t),
828
- img: (e) => k(e, t),
829
- video: (e) => Xe(e, t),
830
- h1: (e) => D(e, t),
831
- h2: (e) => D(e, t),
832
- h3: (e) => D(e, t),
833
- h4: (e) => D(e, t),
834
- h5: (e) => D(e, t),
835
- h6: (e) => D(e, t),
836
- hr: (e) => $e(e, t),
837
- li: (e) => st(e, (e) => He(e, t)),
838
- ol: (e) => at(e, t),
839
- p: (t) => ct(t, (t, n) => Ve(t, e, n)),
840
- pre: (e) => lt(e, (e) => We(e, xt, t)),
841
- span: (e) => ut(e, (e) => Ge(e, M, t)),
842
- table: (e) => tt(e, t),
843
- td: (e) => it(e, (e, n) => Ue(e, n, t)),
844
- template: (e) => dt(e, (e) => Ke(e, t)),
845
- text: ft,
846
- th: (e) => rt(e, (e, n) => Ue(e, n, t)),
847
- tr: (e) => nt(e, t),
848
- ul: (e) => ot(e, t),
849
- root: (t) => yt(t, e)
850
- };
851
- }
852
- function yt(e, t) {
853
- return {
854
- content: (e.children || []).flatMap((n) => t(n, e)),
855
- type: "doc"
856
- };
857
- }
858
- function bt(e, t, n = {}, r) {
859
- let { attrs: i = {}, children: a } = n, o = i.props, s = e.props || {}, c = {
860
- ...o || {},
861
- ...s
862
- }, l = [];
863
- for (let [e, t] of Object.entries(c)) {
864
- if (t === void 0 || e.startsWith("__mdc_")) continue;
865
- let n = e.trim();
866
- if (n === "class" || n === "className") {
867
- let e = typeof t == "string" ? t : t.join(" ");
868
- l.push(["class", e]);
869
- } else l.push([n, t]);
870
- }
871
- let u = {
872
- attrs: i,
873
- type: t
874
- };
875
- l.length > 0 && (u.attrs.props = Object.fromEntries(l));
876
- let d = a || e.children || [];
877
- return d.length > 0 && (u.content = d.flatMap((t) => r(t, e)).filter(Boolean)), u;
878
- }
879
- function xt(e) {
880
- let t = "", n = (e) => {
881
- if (e.type === "text") {
882
- t += e.value || "";
883
- return;
884
- }
885
- e.type === "element" && (e.children || []).forEach((e) => n(e));
886
- };
887
- return (e.children || []).forEach((e) => n(e)), t;
888
- }
889
- function I(e) {
890
- if (Array.isArray(e)) return e.filter((e) => !(e?.type === "text" && (!e.text || e.text === ""))).map((e) => I(e));
891
- if (e && typeof e == "object") {
892
- let t = { ...e };
893
- return t.content &&= I(t.content), t;
894
- }
895
- return e;
896
- }
897
- function St(e) {
898
- function t(i, a) {
899
- return Tt(i, a, e, r, t, n);
900
- }
901
- let n = (e, n, r) => bt(e, n, r, t), r = vt(t, n);
902
- return t;
903
- }
904
- var Ct = {
905
- src: ["asset"],
906
- id: ["string"],
907
- filename: ["string"],
908
- alt: ["string"],
909
- title: ["string"],
910
- width: ["string", "number"],
911
- height: ["string", "number"]
912
- };
913
- function wt(e, t) {
914
- if (e.type !== "element" || e.tag !== "image" || e.children?.length || typeof e.props?.id != "string" || !e.props.id || e.props.src !== e.props.id || !t || !("version" in t) || t.version !== 2) return !1;
915
- let n = t.components.image, r = n?.media;
916
- return !n || n.kind !== "block" || n.slots.length !== 0 || n.allowedChildren?.length !== 0 || r?.sourceProp !== "src" || r.altProp !== "alt" || r.titleProp !== "title" || r.filenameProp !== "filename" || Object.keys(n.props).length !== Object.keys(Ct).length ? !1 : Object.entries(Ct).every(([e, t]) => {
917
- let r = n.props[e];
918
- return r?.required === (e === "src") && r.allowedValues === null && r.types.length === t.length && r.types.every((e, n) => e === t[n]);
919
- });
920
- }
921
- function Tt(t, n, r, i, a, o) {
922
- let s = t.type === "element" ? t.tag : t.type;
923
- if (s === "p" && n?.tag === "li") return Ve(t, a, { allowImageLift: !1 });
924
- let c = t.type === "element" ? e(t, r ?? { components: {} }) : void 0;
925
- if ((!(c?.kind === "component" && c.registered) || wt(t, r)) && i[s]) return i[s](t);
926
- let l = c?.kind === "component" && c.form === "inline";
927
- return n?.tag === "p" || l ? o(t, "inline-element", { attrs: { tag: s } }) : (t.type === "element" && t.children?.[0]?.type === "text" && (t = {
928
- ...t,
929
- children: [{
930
- children: t.children,
931
- props: {},
932
- tag: "p",
933
- type: "element"
934
- }],
935
- props: {
936
- ...t.props,
937
- __tiptapWrap: !0
938
- }
939
- }), o(t, "element", { attrs: { tag: s } }));
940
- }
941
- function Et(e, t) {
942
- let n = T(e);
943
- n.children = (n.children || []).filter((e) => e.type !== "text");
944
- let r = St(t)(n), i;
945
- return i = Array.isArray(r) ? {
946
- type: "doc",
947
- content: r
948
- } : r, (!i.content || i.content.length === 0) && (i.content = [{
949
- content: [],
950
- type: "paragraph"
951
- }]), I(i);
952
- }
953
- //#endregion
954
- //#region src/lib/profiles.ts
955
- var Dt = "ginkoProfileExempt", L = [
956
- "doc",
957
- "paragraph",
958
- "text",
959
- "hardBreak"
960
- ], Ot = [
961
- "bold",
962
- "italic",
963
- "link"
964
- ], R = {
965
- plain: {
966
- name: "plain",
967
- nodes: new Set(L),
968
- marks: /* @__PURE__ */ new Set(),
969
- headingLevels: []
970
- },
971
- inline: {
972
- name: "inline",
973
- nodes: new Set(L),
974
- marks: new Set(Ot),
975
- headingLevels: []
976
- },
977
- article: {
978
- name: "article",
979
- nodes: /* @__PURE__ */ new Set([
980
- ...L,
981
- "heading",
982
- "bulletList",
983
- "orderedList",
984
- "listItem",
985
- "blockquote",
986
- "horizontalRule",
987
- "image"
988
- ]),
989
- marks: new Set(Ot),
990
- headingLevels: [
991
- 2,
992
- 3,
993
- 4
994
- ]
995
- },
996
- full: {
997
- name: "full",
998
- headingLevels: [
999
- 1,
1000
- 2,
1001
- 3,
1002
- 4,
1003
- 5,
1004
- 6
1005
- ]
1006
- }
1007
- };
1008
- function kt(e) {
1009
- return e ? typeof e == "string" ? R[e] : e : R.full;
1010
- }
1011
- function z(e) {
1012
- return !!e.nodes || !!e.marks;
1013
- }
1014
- function B(e, t, n) {
1015
- return e.nodes && !e.nodes.has(t) ? !1 : t === "heading" && n && typeof n.level == "number" ? e.headingLevels.includes(n.level) : !0;
1016
- }
1017
- function V(e, t) {
1018
- return !e.marks || e.marks.has(t);
1019
- }
1020
- function At(e) {
1021
- return !e.nodes || [...e.nodes].some((e) => !L.includes(e));
1022
- }
1023
- function jt(e) {
1024
- return !e.nodes || [...e.nodes, ...e.marks ?? []];
1025
- }
1026
- function Mt(e, t) {
1027
- let n = kt(t), r = [];
1028
- if (!z(n)) return r;
1029
- let i = (e, t, i) => {
1030
- B(n, e, t) || r.push(e === "heading" && typeof t?.level == "number" ? {
1031
- kind: "node",
1032
- type: e,
1033
- level: t.level
1034
- } : {
1035
- kind: "node",
1036
- type: e
1037
- });
1038
- for (let e of i) V(n, e.type) || r.push({
1039
- kind: "mark",
1040
- type: e.type
1041
- });
1042
- };
1043
- if (Nt(e)) e.descendants((e) => i(e.type.name, e.attrs, e.marks.map((e) => ({ type: e.type.name }))));
1044
- else {
1045
- let t = (e) => {
1046
- for (let n of e.content ?? []) i(n.type ?? "", n.attrs, n.marks ?? []), t(n);
1047
- };
1048
- t(e);
1049
- }
1050
- return r;
1051
- }
1052
- function Nt(e) {
1053
- return typeof e.descendants == "function";
1054
- }
1055
- function Pt(e, t) {
1056
- if (!z(t)) return 0;
1057
- let n = 0;
1058
- return e.descendants((e) => {
1059
- B(t, e.type.name, e.attrs) || n++;
1060
- for (let r of e.marks) V(t, r.type.name) || n++;
1061
- }), n;
1062
- }
1063
- function H(e, t, n) {
1064
- if (!z(n)) return e;
1065
- let r = [], i = [], a = () => {
1066
- i.length && (r.push(t.nodes.paragraph.create(null, i)), i = []);
1067
- };
1068
- return e.forEach((e) => {
1069
- if (e.isInline) {
1070
- i.push(...U(e, t, n));
1071
- return;
1072
- }
1073
- a(), r.push(...Lt(e, t, n));
1074
- }), r.length ? (a(), s.fromArray(r)) : s.fromArray(i);
1075
- }
1076
- function Ft(e, t, n) {
1077
- if (!z(n)) return e;
1078
- let r = H(e.content, t, n);
1079
- if (r.eq(e.content)) return e;
1080
- let i = c.maxOpen(r);
1081
- return new c(r, Math.min(e.openStart, i.openStart), Math.min(e.openEnd, i.openEnd));
1082
- }
1083
- function It(e, t) {
1084
- return e.filter((e) => V(t, e.type.name));
1085
- }
1086
- function U(e, t, n) {
1087
- if (e.isText) return [e.mark(It(e.marks, n))];
1088
- if (B(n, e.type.name, e.attrs)) return [e.type.create(e.attrs, null, It(e.marks, n))];
1089
- let r = [];
1090
- return e.content.forEach((e) => r.push(...U(e, t, n))), r;
1091
- }
1092
- function Lt(e, t, n) {
1093
- let r = t.nodes.paragraph, i = e.type.name;
1094
- if (e.isTextblock) {
1095
- let a = Rt(e, t, n);
1096
- if (B(n, i, e.attrs)) return [e.type.create(e.attrs, a, e.marks)];
1097
- if (i === "heading" && n.headingLevels.length) {
1098
- let t = zt(n.headingLevels, Number(e.attrs.level));
1099
- return [e.type.create({
1100
- ...e.attrs,
1101
- level: t
1102
- }, a, e.marks)];
1103
- }
1104
- return [r.create(null, a)];
1105
- }
1106
- if (e.isAtom || e.isLeaf) return B(n, i, e.attrs) ? [e] : [];
1107
- let a = H(e.content, t, n);
1108
- if (B(n, i, e.attrs)) {
1109
- let t = e.type.createAndFill(e.attrs, a, e.marks);
1110
- if (t) return [t];
1111
- }
1112
- let o = [];
1113
- return a.forEach((e) => {
1114
- o.push(e.isInline ? r.create(null, e) : e);
1115
- }), o;
1116
- }
1117
- function Rt(e, t, n) {
1118
- let r = [], i = t.nodes.hardBreak, a = !!i && B(n, "hardBreak");
1119
- return e.content.forEach((o) => {
1120
- if (!o.isText || !e.type.spec.code || !o.text?.includes("\n")) {
1121
- r.push(...U(o, t, n));
1122
- return;
1123
- }
1124
- o.text.split("\n").forEach((e, n) => {
1125
- n && r.push(a ? i.create() : t.text(" ")), e && r.push(t.text(e));
1126
- });
1127
- }), r;
1128
- }
1129
- function zt(e, t) {
1130
- return e.reduce((e, n) => Math.abs(n - t) < Math.abs(e - t) ? n : e, e[0]);
1131
- }
1132
- //#endregion
1133
- //#region src/lib/image-properties.ts
1134
- var Bt = {
1135
- id: "text",
1136
- filename: "text",
1137
- src: "text",
1138
- alt: "text",
1139
- title: "text",
1140
- width: "number",
1141
- height: "number",
1142
- fit: "text",
1143
- quality: "number",
1144
- format: "text",
1145
- focalX: "number",
1146
- focalY: "number",
1147
- cropX: "number",
1148
- cropY: "number",
1149
- cropWidth: "number",
1150
- cropHeight: "number",
1151
- class: "text"
1152
- }, Vt = /^\s+/, Ht = /\s+$/, W = {
1153
- bold: "strong",
1154
- code: "code",
1155
- italic: "em",
1156
- strike: "del"
1157
- };
1158
- function Ut(e) {
1159
- if (e == null) return !1;
1160
- if (typeof e != "string") return !0;
1161
- let t = e.trim();
1162
- if (!t) return !1;
1163
- let n = t.toLowerCase();
1164
- return n !== "undefined" && n !== "null";
1165
- }
1166
- function Wt(e) {
1167
- if (!Ut(e)) return null;
1168
- if (typeof e == "number") return Number.isFinite(e) ? e : null;
1169
- if (typeof e != "string") return null;
1170
- let t = e.trim();
1171
- if (!t) return null;
1172
- let n = Number(t);
1173
- return Number.isFinite(n) ? t : null;
1174
- }
1175
- function Gt(e, t) {
1176
- return q(e, t, "blockquote");
1177
- }
1178
- function Kt(e, t) {
1179
- return q(e, t, "strong");
1180
- }
1181
- function qt(e, t) {
1182
- return q(e, t, "br");
1183
- }
1184
- function Jt(e, t) {
1185
- return q(e, t, "ul");
1186
- }
1187
- function Yt(e, t) {
1188
- return q(e, t, "code", { props: e.attrs || {} });
1189
- }
1190
- function Xt(e) {
1191
- return {
1192
- type: "comment",
1193
- value: e.attrs.text
1194
- };
1195
- }
1196
- function Zt(e, t) {
1197
- return {
1198
- children: (e.content || []).flatMap((e) => K(e, t)),
1199
- type: "root"
1200
- };
1201
- }
1202
- function Qt(e, t) {
1203
- return bn(e, t);
1204
- }
1205
- function $t(e, t) {
1206
- return q(e, t, "br");
1207
- }
1208
- function en(e, t) {
1209
- return xn(e, t);
1210
- }
1211
- function tn(e, t) {
1212
- return q(e, t, "hr");
1213
- }
1214
- function nn(e, t) {
1215
- return Sn(e, t);
1216
- }
1217
- function rn(e, t) {
1218
- return q(e, t, "em");
1219
- }
1220
- function an(e, t) {
1221
- return q(e, t, "ol", { props: { start: e.attrs?.start } });
1222
- }
1223
- function on(e, t) {
1224
- return q(e, t, "p");
1225
- }
1226
- function sn(e, t) {
1227
- return q(e, t, "template", { props: { name: e.attrs?.name || "default" } });
1228
- }
1229
- function cn(e, t) {
1230
- return q(e, t, "span", { props: gt(e.attrs) });
1231
- }
1232
- function ln(e, t) {
1233
- return q(e, t, "del");
1234
- }
1235
- function un(e, t) {
1236
- return q(e, t, "table");
1237
- }
1238
- function dn(e, t) {
1239
- return q(e, t, "td", { props: pn(e) });
1240
- }
1241
- function fn(e, t) {
1242
- return q(e, t, "th", { props: pn(e) });
1243
- }
1244
- function pn(e) {
1245
- let t = e.attrs?.align;
1246
- return [
1247
- "left",
1248
- "center",
1249
- "right"
1250
- ].includes(t) ? { style: `text-align:${t}` } : {};
1251
- }
1252
- function mn(e, t) {
1253
- return q(e, t, "tr");
1254
- }
1255
- function hn(e, t) {
1256
- return Dn(e, t);
1257
- }
1258
- var G = {
1259
- blockquote: Gt,
1260
- bold: Kt,
1261
- br: qt,
1262
- bulletList: Jt,
1263
- code: Yt,
1264
- codeBlock: yn,
1265
- comment: Xt,
1266
- doc: Zt,
1267
- element: q,
1268
- file: Qt,
1269
- hardBreak: $t,
1270
- heading: en,
1271
- horizontalRule: tn,
1272
- image: nn,
1273
- "inline-element": q,
1274
- italic: rn,
1275
- link: wn,
1276
- listItem: Tn,
1277
- orderedList: an,
1278
- paragraph: on,
1279
- slot: sn,
1280
- "span-style": cn,
1281
- strike: ln,
1282
- table: un,
1283
- tableCell: dn,
1284
- tableHeader: fn,
1285
- tableRow: mn,
1286
- text: En,
1287
- video: hn
1288
- };
1289
- function K(e, t) {
1290
- if (!e) return {
1291
- children: [],
1292
- props: {},
1293
- tag: "p",
1294
- type: "element"
1295
- };
1296
- if (e.type && G[e.type]) return G[e.type](e, t);
1297
- throw Error(`Cannot convert unknown editor node: ${String(e.type)}`);
1298
- }
1299
- async function gn(e, t) {
1300
- return _n(e, t);
1301
- }
1302
- function _n(e, t) {
1303
- let n = { options: t || {} };
1304
- return T(K(structuredClone(e), n));
1305
- }
1306
- function q(e, t, n, r = {}) {
1307
- let { props: i = {}, ...a } = r, o = e.content || [];
1308
- if (e.attrs?.props?.__tiptapWrap) {
1309
- if (o.length === 1 && o[0]?.type === "slot") {
1310
- let e = o[0];
1311
- e.content = jn(e.content || []);
1312
- }
1313
- delete e.attrs.props.__tiptapWrap;
1314
- }
1315
- let s = _t(e.attrs?.props || {}, i);
1316
- return e.type === "paragraph" ? !o || o.length === 0 ? {
1317
- children: [],
1318
- props: {},
1319
- tag: "p",
1320
- type: "element"
1321
- } : vn(e, t, s, a) : (o = An(o), o = jn(o), {
1322
- children: e.children || o.flatMap((e) => K(e, t)),
1323
- tag: n || e.attrs?.tag,
1324
- type: "element",
1325
- ...a,
1326
- props: Object.fromEntries(s)
1327
- });
1328
- }
1329
- function vn(e, t, n, r = {}) {
1330
- let i = [], a = [], o = null;
1331
- function s(e) {
1332
- return e.type === "text" && e.marks?.length === 1 && e.marks[0]?.type ? e.marks[0] : e.type === "link-element" && e.content && e.content.length === 1 && e.content[0] && e.content[0].type === "text" && e.content[0].marks?.length === 1 && e.content[0].marks[0]?.type ? e.content[0].marks[0] : null;
1333
- }
1334
- function c(e, t) {
1335
- return !e && !t ? !0 : !e || !t ? !1 : e.type === t.type && JSON.stringify(e.attrs || {}) === JSON.stringify(t.attrs || {});
1336
- }
1337
- e.content.forEach((e) => {
1338
- let t = s(e);
1339
- c(t, o) || (a.length > 0 && i.push({
1340
- content: a,
1341
- mark: o
1342
- }), a = [], o = t), a.push(e);
1343
- }), a.length > 0 && i.push({
1344
- content: a,
1345
- mark: o
1346
- });
1347
- let l = kn(i.map((e) => {
1348
- if (e.content.length > 1 && e.mark && W[e.mark.type]) {
1349
- e.content.forEach((e) => {
1350
- e.type === "text" ? delete e.marks : e.type === "link-element" && e.content?.[0] && delete e.content[0].marks;
1351
- });
1352
- let n = W[e.mark.type];
1353
- return e.mark.attrs && Object.keys(e.mark.attrs).length > 0 ? {
1354
- children: e.content.flatMap((e) => K(e, t)),
1355
- tag: n,
1356
- type: "element",
1357
- props: e.mark.attrs
1358
- } : {
1359
- children: e.content.flatMap((e) => K(e, t)),
1360
- tag: n,
1361
- type: "element"
1362
- };
1363
- }
1364
- return e.content.flatMap((e) => K(e, t));
1365
- }).flat(), Object.values(W));
1366
- return {
1367
- tag: "p",
1368
- type: "element",
1369
- ...r,
1370
- children: l,
1371
- props: Object.fromEntries(n)
1372
- };
1373
- }
1374
- function yn(e, t) {
1375
- let n = q(e, t, "pre"), r = e.attrs?.code || On(e) || "", i = e.attrs?.language || "", a = e.attrs?.filename;
1376
- return n.props.language = i, a && (n.props.filename = a), n.children = [{
1377
- children: [{
1378
- type: "text",
1379
- value: r
1380
- }],
1381
- props: { __ignoreMap: "" },
1382
- tag: "code",
1383
- type: "element"
1384
- }], n;
1385
- }
1386
- function bn(e, t) {
1387
- let n = e.attrs?.props || {}, r = t.options.fileOutput ?? "mdc", i = {};
1388
- if (n.id && (i.id = n.id), n.filename && (i.filename = n.filename), n.title && (i.title = n.title), n.type && (i.type = n.type), n.size && (i.size = n.size), n.src && (i.src = n.src), r === "markdown") {
1389
- let e = i.title || i.filename || i.src || "Download";
1390
- return {
1391
- children: [{
1392
- type: "text",
1393
- value: String(e)
1394
- }],
1395
- props: {
1396
- __mdc_block: !0,
1397
- href: i.src,
1398
- title: i.title
1399
- },
1400
- tag: "a",
1401
- type: "element"
1402
- };
1403
- }
1404
- return q(e, t, "file", { props: i });
1405
- }
1406
- function xn(e, t) {
1407
- let n = q(e, t, `h${e.attrs?.level || 1}`), r = e.attrs?.id;
1408
- return typeof r == "string" && r ? n.props.id = r : delete n.props.id, n;
1409
- }
1410
- function Sn(e, t) {
1411
- let n = e.attrs?.props || {}, r = n.src || e.attrs?.src, i = t.options.imageOutput ?? "mdc", a = {};
1412
- for (let [t, i] of Object.entries(Bt)) {
1413
- let o = t === "src" ? r : t === "alt" ? n.alt || e.attrs?.alt : n[t];
1414
- if (i === "number") {
1415
- let e = Wt(o);
1416
- e !== null && (a[t] = e);
1417
- } else (t === "id" || t === "filename" ? o : Ut(o)) && (a[t] = o);
1418
- }
1419
- let o = [
1420
- "fit",
1421
- "quality",
1422
- "format",
1423
- "focalX",
1424
- "focalY",
1425
- "cropX",
1426
- "cropY",
1427
- "cropWidth",
1428
- "cropHeight"
1429
- ].some((e) => {
1430
- let t = n[e];
1431
- return t != null && t !== "";
1432
- }), s = {
1433
- ...e,
1434
- attrs: {
1435
- ...e.attrs || {},
1436
- props: {}
1437
- }
1438
- };
1439
- if (i === "markdown") return q(s, t, "img", { props: {
1440
- ...a.alt === void 0 ? {} : { alt: a.alt },
1441
- ...a.src === void 0 ? {} : { src: a.src },
1442
- ...a.title === void 0 ? {} : { title: a.title },
1443
- __mdc_block: !0
1444
- } });
1445
- if (n.id || o) return q(s, t, "image", { props: a });
1446
- let c = e.attrs?.tag;
1447
- return c === "nuxt-img" || c === "nuxt-picture" ? q(s, t, c, { props: a }) : q(s, t, "img", { props: {
1448
- ...a,
1449
- __mdc_block: !0
1450
- } });
1451
- }
1452
- var Cn = "noopener noreferrer nofollow";
1453
- function wn(e) {
1454
- let { class: t, href: n, rel: r, target: i, ...a } = e.attrs || {}, o = {};
1455
- n && (o.href = n), i && (o.target = i), r && r !== Cn && (o.rel = r), t && (o.class = t);
1456
- for (let [e, t] of Object.entries(a)) t == null || t === "" || (o[e] = String(t));
1457
- return {
1458
- children: e.children || [],
1459
- props: o,
1460
- tag: "a",
1461
- type: "element"
1462
- };
1463
- }
1464
- function Tn(e, t) {
1465
- return q(e, t, "li");
1466
- }
1467
- function En(e, t) {
1468
- let n = e.text || "", r = n.match(Vt)?.[0] || "", i = n.match(Ht)?.[0] || "", a = n.trim();
1469
- if (!e.marks?.length) return {
1470
- type: "text",
1471
- value: n
1472
- };
1473
- let o = e.marks.reduce((e, n) => {
1474
- let r = n.type;
1475
- return r && G[r] ? G[r]({
1476
- ...n,
1477
- children: [e]
1478
- }, t) : e;
1479
- }, {
1480
- type: "text",
1481
- value: a
1482
- }), s = [];
1483
- return r && s.push({
1484
- type: "text",
1485
- value: r
1486
- }), s.push(o), i && s.push({
1487
- type: "text",
1488
- value: i
1489
- }), s.filter(Boolean);
1490
- }
1491
- function Dn(e, t) {
1492
- let n = e.attrs?.props || {}, r = {};
1493
- return e.attrs?.src && (r.src = e.attrs.src), e.attrs?.title && (r.title = e.attrs.title), e.attrs?.width && (r.width = e.attrs.width), e.attrs?.height && (r.height = e.attrs.height), n.src && (r.src = n.src), n.title && (r.title = n.title), n.width && (r.width = n.width), n.height && (r.height = n.height), q(e, t, "video", { props: r });
1494
- }
1495
- function On(e) {
1496
- if (e.type === "text") return e.text;
1497
- let t = "";
1498
- return e.content?.forEach((e) => {
1499
- t += On(e);
1500
- }), t;
1501
- }
1502
- function kn(e, t) {
1503
- if (!Array.isArray(e)) return e;
1504
- let n = [], r = 0;
1505
- for (; r < e.length;) {
1506
- let i = e[r], a = e[r + 1], o = e[r + 2];
1507
- i && o && i.type === "element" && o.type === "element" && i.tag === o.tag && t.includes(i.tag) && JSON.stringify(i.props || {}) === JSON.stringify(o.props || {}) && a && a.type === "text" && a.value === " " ? (n.push({
1508
- ...i,
1509
- children: [
1510
- ...i.children || [],
1511
- {
1512
- type: "text",
1513
- value: " "
1514
- },
1515
- ...o.children || []
1516
- ]
1517
- }), r += 3) : (i && n.push(i), r++);
1518
- }
1519
- return n;
1520
- }
1521
- function An(e) {
1522
- return e.length === 1 && e[0]?.type === "slot" && e[0].attrs?.name === "default" ? e[0].content || [] : e;
1523
- }
1524
- function jn(e) {
1525
- return e.length === 1 && e[0]?.type === "paragraph" ? e[0].content || [] : e;
1526
- }
1527
- //#endregion
1528
- //#region src/lib/conversionPipeline.ts
1529
- function J(e, t, n, r, i, a = "error") {
1530
- return {
1531
- code: t,
1532
- context: i,
1533
- detail: r,
1534
- message: n,
1535
- phase: e,
1536
- severity: a
1537
- };
1538
- }
1539
- function Y(e, t, n, r, i = !1) {
1540
- return {
1541
- fallbackUsed: i,
1542
- issues: t,
1543
- ok: !0,
1544
- timeline: n,
1545
- traceId: e,
1546
- value: r
1547
- };
1548
- }
1549
- function X(e, t, n, r = !1) {
1550
- return {
1551
- fallbackUsed: r,
1552
- issues: t,
1553
- ok: !1,
1554
- timeline: n,
1555
- traceId: e
1556
- };
1557
- }
1558
- function Mn(e) {
1559
- return {
1560
- errors: e.filter((e) => e.severity === "error"),
1561
- warnings: e.filter((e) => e.severity === "warn")
1562
- };
1563
- }
1564
- async function Nn(e, t) {
1565
- try {
1566
- return Z(await r(e, { autoClose: !1 }), t);
1567
- } catch (e) {
1568
- return J("validate", "authoring_kit_rejected", "This document violates the editor authoring kit.", e);
1569
- }
1570
- }
1571
- function Z(e, t) {
1572
- let n = o(i(e).body, t.policy);
1573
- if (n.ok) return;
1574
- let r = n.issues[0];
1575
- return J("validate", "authoring_kit_rejected", "This document violates the editor authoring kit.", /* @__PURE__ */ TypeError(`Invalid authoring kit: source is outside policy (${r?.code} at ${r?.path.join(".")}).`));
1576
- }
1577
- async function Pn(e) {
1578
- let t;
1579
- try {
1580
- t = await r(e, { autoClose: !1 });
1581
- } catch (t) {
1582
- return Q(e, t);
1583
- }
1584
- return Fn(e, t);
1585
- }
1586
- function Q(e, t) {
1587
- let n = x({ direction: "markdown_to_tiptap" }), r = [];
1588
- S(n, "parse_mdc", { inputLength: e.length });
1589
- let i = J("parse_mdc", "parse_mdc_failed", "Failed to parse MDC markdown", t, {
1590
- inputLength: e.length,
1591
- preview: e.slice(0, 200)
1592
- });
1593
- return r.push(i), C(n, i), X(n.traceId, r, w(n, { status: "failed" }));
1594
- }
1595
- function Fn(e, t, n) {
1596
- let r = x({ direction: "markdown_to_tiptap" }), i = [];
1597
- S(r, "parse_mdc", { inputLength: e.length });
1598
- let a;
1599
- try {
1600
- a = Me(t);
1601
- } catch (t) {
1602
- return Q(e, t);
1603
- }
1604
- S(r, "mdc_to_tiptap");
1605
- let o;
1606
- try {
1607
- o = Et(a, n);
1608
- } catch (e) {
1609
- let t = J("mdc_to_tiptap", "mdc_to_tiptap_failed", "Failed to convert MDC AST to TipTap JSON", e);
1610
- return i.push(t), C(r, t), X(r.traceId, i, w(r, { status: "failed" }));
1611
- }
1612
- S(r, "validate");
1613
- let s = y(o);
1614
- for (let e of s) i.push(e), C(r, e);
1615
- let { errors: c } = Mn(i);
1616
- return c.length > 0 ? X(r.traceId, i, w(r, { status: "failed" })) : Y(r.traceId, i, w(r, { status: "ok" }), o);
1617
- }
1618
- async function In(e, t, n, i, a = "document") {
1619
- let o;
1620
- try {
1621
- o = await r(e, { autoClose: !1 });
1622
- } catch (t) {
1623
- return Q(e, t);
1624
- }
1625
- let s = Fn(e, o, i?.policy);
1626
- if (!s.ok || !s.value) return s;
1627
- if (i && a === "document") {
1628
- let e = Z(o, i);
1629
- if (e) return {
1630
- ...s,
1631
- issues: [...s.issues, e],
1632
- ok: !1
1633
- };
1634
- }
1635
- let c = s.value;
1636
- if (n) try {
1637
- let e = n.nodeFromJSON(s.value);
1638
- e.check(), c = e.toJSON();
1639
- } catch (e) {
1640
- let t = J("validate", "visual_schema_unsupported", "This document contains nodes that the visual editor does not support.", e);
1641
- return {
1642
- ...s,
1643
- issues: [...s.issues, t],
1644
- ok: !1
1645
- };
1646
- }
1647
- let l = await zn(c, t);
1648
- if (!l.ok || l.value === void 0) return {
1649
- ...s,
1650
- issues: [...s.issues, ...l.issues],
1651
- ok: !1
1652
- };
1653
- try {
1654
- let t = await r(l.value, { autoClose: !1 });
1655
- if ($(Ln(o)) !== $(Ln(t))) {
1656
- let t = J("validate", "source_only_required", "This document contains content that visual editing cannot preserve.", void 0, { inputLength: e.length });
1657
- return {
1658
- ...s,
1659
- issues: [...s.issues, t],
1660
- ok: !1
1661
- };
1662
- }
1663
- } catch (e) {
1664
- let t = J("validate", "visual_compatibility_failed", "Could not verify that visual editing preserves this document.", e);
1665
- return {
1666
- ...s,
1667
- issues: [...s.issues, t],
1668
- ok: !1
1669
- };
1670
- }
1671
- return {
1672
- ...s,
1673
- value: c
1674
- };
1675
- }
1676
- function $(e) {
1677
- return Array.isArray(e) ? `[${e.map($).join(",")}]` : e && typeof e == "object" ? `{${Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => `${JSON.stringify(e)}:${$(t)}`).join(",")}}` : JSON.stringify(e);
1678
- }
1679
- function Ln(e) {
1680
- return {
1681
- frontmatter: e.frontmatter ?? {},
1682
- meta: e.meta ?? {},
1683
- nodes: Rn(e.nodes ?? [])
1684
- };
1685
- }
1686
- function Rn(e) {
1687
- return e.flatMap((e) => {
1688
- if (!Array.isArray(e) || typeof e[0] != "string") return [e];
1689
- let [t, n, ...r] = e, i = { ...n && typeof n == "object" ? n : {} }, a = i.$;
1690
- a && typeof a == "object" && "syntax" in a && (a.syntax === "angle" || a.syntax === "colon") && "block" in a && (i.$ = {
1691
- component: 1,
1692
- block: a.block
1693
- }), t === "a" && i.rel === "noopener noreferrer nofollow" && delete i.rel;
1694
- let o = Rn(r);
1695
- return t === "p" && o.length > 0 && o.every((e) => Array.isArray(e) && (e[0] === "a" || e[0] === "img")) ? o : [[
1696
- t,
1697
- i,
1698
- ...o
1699
- ]];
1700
- });
1701
- }
1702
- async function zn(e, t) {
1703
- let n = x({ direction: "tiptap_to_markdown" }), r = [];
1704
- S(n, "validate");
1705
- let i = y(e);
1706
- for (let e of i) r.push(e), C(n, e);
1707
- if (i.filter((e) => e.severity === "error").length > 0) return X(n.traceId, r, w(n, { status: "failed" }));
1708
- S(n, "tiptap_to_mdc");
1709
- let a;
1710
- try {
1711
- a = await gn(e, t);
1712
- } catch (e) {
1713
- let t = J("tiptap_to_mdc", "tiptap_to_mdc_failed", "Failed to convert TipTap JSON to MDC AST", e);
1714
- return r.push(t), C(n, t), X(n.traceId, r, w(n, { status: "failed" }));
1715
- }
1716
- S(n, "stringify_mdc");
1717
- let o;
1718
- try {
1719
- o = await Fe(a, { videoOutput: t?.videoOutput });
1720
- } catch (e) {
1721
- let t = J("stringify_mdc", "stringify_mdc_failed", "Failed to stringify MDC AST to markdown", e);
1722
- return r.push(t), C(n, t), X(n.traceId, r, w(n, { status: "failed" }));
1723
- }
1724
- return Y(n.traceId, r, w(n, { status: "ok" }), o);
1725
- }
1726
- function Bn(e, t) {
1727
- let n = x({ direction: "tiptap_to_editor" }), r = [];
1728
- S(n, "validate");
1729
- let i = y(t);
1730
- for (let e of i) r.push(e), C(n, e);
1731
- if (i.filter((e) => e.severity === "error").length > 0) return X(n.traceId, r, w(n, { status: "failed" }));
1732
- S(n, "set_content");
1733
- try {
1734
- let i = e.schema.nodeFromJSON(t);
1735
- if (i.check(), i.eq(e.state.doc)) return Y(n.traceId, r, w(n, { status: "ok" }), t);
1736
- let { from: a, to: o } = e.state.selection, s = e.isFocused, c = e.state.tr.replaceWith(0, e.state.doc.content.size, i.content).setMeta("addToHistory", !1).setMeta(Dt, !0);
1737
- c.setSelection(f.between(c.doc.resolve(Math.min(a, c.doc.content.size)), c.doc.resolve(Math.min(o, c.doc.content.size)))), e.view.dispatch(c), s && !e.isFocused && e.view.focus();
1738
- } catch (e) {
1739
- let t = J("set_content", "set_content_failed", "Failed to apply TipTap JSON to editor", e);
1740
- return r.push(t), C(n, t), X(n.traceId, r, w(n, { status: "failed" }));
1741
- }
1742
- return Y(n.traceId, r, w(n, { status: "ok" }), t);
1743
- }
1744
- //#endregion
1745
- //#region src/lib/extensions/code-block.ts
1746
- var Vn = ue.extend({
1747
- addAttributes() {
1748
- return {
1749
- filename: { default: null },
1750
- language: { default: null }
1751
- };
1752
- },
1753
- addOptions() {
1754
- return {
1755
- ...this.parent?.(),
1756
- theme: "github-dark"
1757
- };
1758
- },
1759
- addStorage() {
1760
- return { theme: this.options.theme };
1761
- }
1762
- }), Hn = /^::([a-z-]+)\s$/i, Un = p.create({
1763
- name: "element",
1764
- group: "block",
1765
- content: "block*",
1766
- inline: !1,
1767
- isolating: !0,
1768
- selectable: !0,
1769
- priority: 1e3,
1770
- addAttributes() {
1771
- return {
1772
- props: {
1773
- default: {},
1774
- parseHTML(e) {
1775
- return JSON.parse(e.getAttribute("props") || "{}");
1776
- }
1777
- },
1778
- tag: { default: "div" }
1779
- };
1780
- },
1781
- addCommands() {
1782
- return { setElement: (e, t) => ({ chain: n, state: r }) => {
1783
- let { from: i } = r.selection, a = {
1784
- attrs: {
1785
- tag: e,
1786
- props: { $: {
1787
- syntax: "angle",
1788
- block: 1,
1789
- sourceName: e.charAt(0).toUpperCase() + e.slice(1)
1790
- } }
1791
- },
1792
- type: "element"
1793
- };
1794
- t && (a.content = [{
1795
- attrs: { name: t },
1796
- content: [{
1797
- content: [],
1798
- type: "paragraph"
1799
- }],
1800
- type: "slot"
1801
- }]);
1802
- let o = n().insertContentAt(i, a);
1803
- return t || o.insertContentAt(i + 1, [{
1804
- content: [],
1805
- type: "paragraph"
1806
- }]), o.run();
1807
- } };
1808
- },
1809
- addInputRules() {
1810
- return [new ne({
1811
- find: Hn,
1812
- handler: ({ chain: e, match: t, range: n }) => {
1813
- let r = {
1814
- attrs: {
1815
- tag: t[1],
1816
- props: { $: {
1817
- syntax: "colon",
1818
- block: 1,
1819
- sourceName: t[1]
1820
- } }
1821
- },
1822
- content: [{
1823
- attrs: { name: "default" },
1824
- content: [{
1825
- content: [],
1826
- type: "paragraph"
1827
- }],
1828
- type: "slot"
1829
- }],
1830
- type: "element"
1831
- };
1832
- e().deleteRange(n).insertContentAt(n.from, r).run();
1833
- }
1834
- })];
1835
- },
1836
- addOptions() {
1837
- return { HTMLAttributes: {} };
1838
- },
1839
- parseHTML() {
1840
- return [{ tag: "div[data-type=\"element\"]" }];
1841
- },
1842
- renderHTML({ HTMLAttributes: e }) {
1843
- let t = m(e, { "data-type": "element" }), n = typeof t.tag == "string" ? t.tag : "";
1844
- t["data-label"] = this.options.getAuthoringKit?.()?.authoring[n]?.label ?? n;
1845
- let r = t.props?.title;
1846
- return typeof r == "string" && r.trim() && (t["data-title"] = r), t.props = JSON.stringify(t.props || {}), [
1847
- "div",
1848
- t,
1849
- 0
1850
- ];
1851
- }
1852
- }), Wn = p.create({
1853
- name: "file",
1854
- draggable: !1,
1855
- addAttributes() {
1856
- return { props: {
1857
- default: {},
1858
- parseHTML: (e) => F(e) ?? {
1859
- filename: e.getAttribute("data-filename") || "",
1860
- id: e.getAttribute("data-file-id") || "",
1861
- size: e.getAttribute("data-size") || "",
1862
- src: e.getAttribute("href") || "",
1863
- title: e.getAttribute("title") || "",
1864
- type: e.getAttribute("data-file-type") || ""
1865
- }
1866
- } };
1867
- },
1868
- addCommands() {
1869
- return {
1870
- addFile: () => ({ commands: e }) => e.insertContent({
1871
- attrs: { props: {} },
1872
- type: this.name
1873
- }),
1874
- setFile: (e) => ({ commands: t }) => t.insertContent({
1875
- attrs: { props: e },
1876
- type: this.name
1877
- })
1878
- };
1879
- },
1880
- addOptions() {
1881
- return {
1882
- HTMLAttributes: {},
1883
- inline: !1
1884
- };
1885
- },
1886
- group() {
1887
- return this.options.inline ? "inline" : "block";
1888
- },
1889
- inline() {
1890
- return this.options.inline;
1891
- },
1892
- parseHTML() {
1893
- return [{
1894
- tag: "a[data-type=\"file\"]",
1895
- priority: 1100
1896
- }];
1897
- },
1898
- renderHTML({ node: e }) {
1899
- let t = e.attrs.props || {}, n = { "data-type": "file" }, r = N(String(t.src || "")) ?? ht(this.options.resolveSrc?.(t) || "");
1900
- return r && (n.href = r), n["data-ginko-props"] = JSON.stringify(t), t.title && (n.title = String(t.title)), t.id && (n["data-file-id"] = String(t.id)), t.filename && (n["data-filename"] = String(t.filename)), t.type && (n["data-file-type"] = String(t.type)), t.size && (n["data-size"] = String(t.size)), [
1901
- "a",
1902
- m(this.options.HTMLAttributes, n),
1903
- t.title || t.filename || t.src || "File"
1904
- ];
1905
- }
1906
- }), Gn = de.extend({
1907
- addOptions() {
1908
- return {
1909
- ...this.parent?.(),
1910
- levels: [
1911
- 1,
1912
- 2,
1913
- 3,
1914
- 4,
1915
- 5,
1916
- 6
1917
- ],
1918
- showMarkers: !1
1919
- };
1920
- },
1921
- parseHTML() {
1922
- return [
1923
- 1,
1924
- 2,
1925
- 3,
1926
- 4,
1927
- 5,
1928
- 6
1929
- ].map((e) => ({
1930
- tag: `h${e}`,
1931
- attrs: { level: e }
1932
- }));
1933
- },
1934
- addStorage() {
1935
- return { showMarkers: this.options.showMarkers };
1936
- },
1937
- addKeyboardShortcuts() {
1938
- return { Backspace: ({ editor: e }) => Kn(e) };
1939
- },
1940
- addProseMirrorPlugins() {
1941
- return [new ee({
1942
- key: new te("ginkoUniqueHeadingIds"),
1943
- appendTransaction(e, t, n) {
1944
- if (!e.some((e) => e.docChanged)) return null;
1945
- let r = /* @__PURE__ */ new Set(), i = n.tr;
1946
- return n.doc.descendants((e, t) => {
1947
- e.type.name !== "heading" || !e.attrs.id || (r.has(e.attrs.id) ? i.setNodeAttribute(t, "id", null) : r.add(e.attrs.id));
1948
- }), i.docChanged ? i.setMeta("addToHistory", !1) : null;
1949
- }
1950
- })];
1951
- },
1952
- addAttributes() {
1953
- return {
1954
- ...this.parent?.(),
1955
- id: {
1956
- default: null,
1957
- keepOnSplit: !1,
1958
- parseHTML: (e) => e.getAttribute("data-ginko-heading-id"),
1959
- renderHTML: (e) => e.id ? { "data-ginko-heading-id": e.id } : {}
1960
- }
1961
- };
1962
- }
1963
- });
1964
- function Kn(e) {
1965
- let { state: t } = e, { selection: n } = t, { $from: r, empty: i } = n;
1966
- if (r.parent.type.name !== "heading") return !1;
1967
- let a = r.parent.textContent, o = r.parentOffset === 0, s = a.length;
1968
- return s === 1 && r.parentOffset === 1 && i ? qn(e, t, r) : s === 0 && o ? Jn(e, t, r) : !1;
1969
- }
1970
- function qn(e, t, n) {
1971
- let r = n.before(n.depth), i = n.parent, a = t.tr, o = t.schema.nodes.heading;
1972
- if (!o) return !1;
1973
- let s = i.attrs.level, c = o.create({
1974
- level: s,
1975
- id: i.attrs.id
1976
- });
1977
- return a.replaceWith(r, r + i.nodeSize, c), a.setSelection(f.near(a.doc.resolve(r + 1))), e.view.dispatch(a), !0;
1978
- }
1979
- function Jn(e, t, n) {
1980
- let r = n.before(n.depth), i = n.parent, a = t.tr, o = t.schema.nodes.paragraph;
1981
- if (!o) return !1;
1982
- let s = o.create();
1983
- return a.replaceWith(r, r + i.nodeSize, s), a.setSelection(f.near(a.doc.resolve(r + 1))), e.view.dispatch(a), !0;
1984
- }
1985
- //#endregion
1986
- //#region src/lib/extensions/image.ts
1987
- var Yn = p.create({
1988
- name: "image",
1989
- draggable: !1,
1990
- addAttributes() {
1991
- return { props: {
1992
- default: {},
1993
- parseHTML: (e) => F(e) ?? {
1994
- alt: e.getAttribute("alt") || "",
1995
- class: e.getAttribute("class") || "",
1996
- filename: e.getAttribute("data-filename") || "",
1997
- height: e.getAttribute("height") || "",
1998
- id: e.getAttribute("data-file-id") || "",
1999
- src: e.getAttribute("src") || "",
2000
- title: e.getAttribute("title") || "",
2001
- width: e.getAttribute("width") || ""
2002
- }
2003
- } };
2004
- },
2005
- addCommands() {
2006
- return { setImage: (e) => ({ commands: t }) => t.insertContent({
2007
- attrs: { props: e },
2008
- type: this.name
2009
- }) };
2010
- },
2011
- addOptions() {
2012
- return {
2013
- allowBase64: !1,
2014
- HTMLAttributes: {},
2015
- inline: !1,
2016
- resolveSrc: void 0
2017
- };
2018
- },
2019
- group() {
2020
- return this.options.inline ? "inline" : "block";
2021
- },
2022
- inline() {
2023
- return this.options.inline;
2024
- },
2025
- parseHTML() {
2026
- return [{
2027
- tag: "img[data-ginko-props]",
2028
- getAttrs: (e) => F(e) ? null : !1
2029
- }, { tag: this.options.allowBase64 ? "img[src]" : "img[src]:not([src^=\"data:\"])" }];
2030
- },
2031
- renderHTML({ node: e }) {
2032
- let t = e.attrs.props || {}, n = {}, r = String(t.src || "");
2033
- n["data-ginko-props"] = JSON.stringify(t);
2034
- let i = this.options.resolveSrc?.(t), a = P(String(i || "")) ?? mt(r);
2035
- return a && (n.src = a), t.alt && (n.alt = String(t.alt)), t.title && (n.title = String(t.title)), t.width && (n.width = String(t.width)), t.height && (n.height = String(t.height)), t.class && (n.class = String(t.class)), t.id && (n["data-file-id"] = String(t.id)), t.filename && (n["data-filename"] = String(t.filename)), ["img", m(this.options.HTMLAttributes, n)];
2036
- }
2037
- });
2038
- //#endregion
2039
- //#region src/lib/input-rules.ts
2040
- function Xn(e) {
2041
- return new ne({
2042
- find: e.find,
2043
- handler: ({ match: t, range: n, state: r }) => {
2044
- if (!t[1]) return;
2045
- let i = re(e.getAttributes, void 0, t) || {}, a = re(e.getText, void 0, t) || "", { tr: o } = r, s = n.from, c = n.to, l = e.type.create(i), u = s + t[0].lastIndexOf(t[1]);
2046
- u > c ? u = c : c = u + t[1].length;
2047
- let d = t[0].at(-1);
2048
- d && o.insertText(d, s + t[0].length - 1), o.replaceWith(u, c, l), o.insertText(a, u + 1), o.scrollIntoView();
2049
- }
2050
- });
2051
- }
2052
- //#endregion
2053
- //#region src/lib/extensions/inline-element.ts
2054
- var Zn = /(?:^|\s)(:([a-z-]+)(?:\[([^\]]*)\])?)\s$/i, Qn = p.create({
2055
- name: "inline-element",
2056
- group: "inline",
2057
- content: "inline*",
2058
- inline: !0,
2059
- priority: 1e3,
2060
- addAttributes() {
2061
- return {
2062
- props: {
2063
- default: {},
2064
- parseHTML(e) {
2065
- return JSON.parse(e.getAttribute("props") || "{}");
2066
- }
2067
- },
2068
- tag: { default: "div" }
2069
- };
2070
- },
2071
- addCommands() {
2072
- return { setInlineElement: (e) => ({ chain: t, state: n }) => t().insertContentAt(n.selection.from, {
2073
- attrs: {
2074
- tag: e,
2075
- props: { $: {
2076
- syntax: "angle",
2077
- block: 0,
2078
- sourceName: e.charAt(0).toUpperCase() + e.slice(1)
2079
- } }
2080
- },
2081
- type: "inline-element"
2082
- }).run() };
2083
- },
2084
- addInputRules() {
2085
- return [Xn({
2086
- find: Zn,
2087
- getAttributes: (e) => ({
2088
- tag: e[2],
2089
- props: { $: {
2090
- syntax: "colon",
2091
- block: 0,
2092
- sourceName: e[2]
2093
- } }
2094
- }),
2095
- getText: (e) => e[3] ?? "",
2096
- type: this.type
2097
- })];
2098
- },
2099
- addOptions() {
2100
- return { HTMLAttributes: {} };
2101
- },
2102
- parseHTML() {
2103
- return [{ tag: "span[data-type=\"inline-element\"]" }];
2104
- },
2105
- renderHTML({ HTMLAttributes: e }) {
2106
- let t = m(e, { "data-type": "inline-element" });
2107
- return t.props = JSON.stringify(t.props || {}), [
2108
- "span",
2109
- t,
2110
- 0
2111
- ];
2112
- }
2113
- }), $n = p.create({
2114
- name: "slot",
2115
- content: "block*",
2116
- group: "block",
2117
- inline: !1,
2118
- isolating: !0,
2119
- selectable: !1,
2120
- priority: 1e3,
2121
- addAttributes() {
2122
- return {
2123
- name: { default: "default" },
2124
- props: {
2125
- default: {},
2126
- parseHTML(e) {
2127
- return JSON.parse(e.getAttribute("props") || "{}");
2128
- }
2129
- }
2130
- };
2131
- },
2132
- addCommands() {
2133
- return { handleSlotBackspace: () => () => !1 };
2134
- },
2135
- addKeyboardShortcuts() {
2136
- return { Backspace: ({ editor: e }) => e.commands.handleSlotBackspace() };
2137
- },
2138
- addOptions() {
2139
- return {
2140
- HTMLAttributes: {},
2141
- nestable: !1
2142
- };
2143
- },
2144
- parseHTML() {
2145
- return [{ tag: "div[data-type=\"Slot\"]" }];
2146
- },
2147
- addNodeView() {
2148
- return ({ node: e, editor: t, getPos: n }) => {
2149
- let r = document.createElement("div");
2150
- r.dataset.type = "Slot", r.setAttribute("name", e.attrs.name);
2151
- let i = n(), a = i === void 0 ? void 0 : t.state.doc.resolve(i).parent, o = this.options.getAuthoringKit?.()?.authoring[a?.attrs.tag]?.slots?.[e.attrs.name]?.label;
2152
- return r.dataset.label = o ?? (e.attrs.name === "default" ? "Content" : e.attrs.name), {
2153
- dom: r,
2154
- contentDOM: r
2155
- };
2156
- };
2157
- },
2158
- renderHTML({ HTMLAttributes: e }) {
2159
- return [
2160
- "div",
2161
- m(e, { "data-type": "Slot" }),
2162
- 0
2163
- ];
2164
- }
2165
- });
2166
- //#endregion
2167
- //#region src/lib/extensions/span-style.ts
2168
- function er(e) {
2169
- let t = {};
2170
- return e?.style?.trim() && (t.style = e.style.trim()), e?.class?.trim() && (t.class = e.class.trim()), t;
2171
- }
2172
- function tr(e, t, n) {
2173
- let { from: r } = e.selection, i = null;
2174
- if (e.doc.nodesBetween(r, r, (e, t) => {
2175
- if (e.type === n) return i = {
2176
- node: e,
2177
- pos: t
2178
- }, !1;
2179
- }), !i) return !1;
2180
- let a = i, o = e.tr.replaceWith(a.pos, a.pos + a.node.nodeSize, a.node.content);
2181
- return t?.(o), !0;
2182
- }
2183
- var nr = p.create({
2184
- name: "span-style",
2185
- inline: !0,
2186
- group: "inline",
2187
- content: "text*",
2188
- addAttributes() {
2189
- return {
2190
- class: {
2191
- default: null,
2192
- parseHTML: (e) => e.getAttribute("class")
2193
- },
2194
- style: {
2195
- default: null,
2196
- parseHTML: (e) => e.getAttribute("style")
2197
- }
2198
- };
2199
- },
2200
- addCommands() {
2201
- return {
2202
- setSpanStyle: (e) => ({ chain: t, state: n }) => {
2203
- let r = er(e), { empty: i, from: a, to: o } = n.selection;
2204
- if (i) return t().insertContent({
2205
- attrs: r,
2206
- content: [{
2207
- text: "",
2208
- type: "text"
2209
- }],
2210
- type: this.name
2211
- }).focus().run();
2212
- let s = n.doc.slice(a, o).content.toJSON();
2213
- return t().insertContentAt({
2214
- from: a,
2215
- to: o
2216
- }, {
2217
- attrs: r,
2218
- content: s,
2219
- type: this.name
2220
- }).focus().run();
2221
- },
2222
- unsetSpanStyle: () => ({ dispatch: e, state: t }) => tr(t, e, this.type),
2223
- updateSpanStyle: (e) => ({ chain: t }) => t().updateAttributes(this.name, er(e)).run()
2224
- };
2225
- },
2226
- parseHTML() {
2227
- return [{ tag: "span:not([data-type])" }];
2228
- },
2229
- renderHTML({ HTMLAttributes: e }) {
2230
- let t = { ...e };
2231
- return t.style || delete t.style, t.class || delete t.class, [
2232
- "span",
2233
- m(t),
2234
- 0
2235
- ];
2236
- }
2237
- }), rr = p.create({
2238
- name: "video",
2239
- group: "block",
2240
- inline: !1,
2241
- selectable: !1,
2242
- priority: 1e3,
2243
- addAttributes() {
2244
- return {
2245
- alt: { default: null },
2246
- height: { default: null },
2247
- key: { default: "" },
2248
- props: {
2249
- default: null,
2250
- parseHTML(e) {
2251
- return JSON.parse(e.getAttribute("props") || "{}");
2252
- }
2253
- },
2254
- src: { default: null },
2255
- title: { default: null },
2256
- width: { default: null }
2257
- };
2258
- },
2259
- addCommands() {
2260
- return {
2261
- addVideo: () => ({ chain: e, state: t }) => {
2262
- let { selection: n } = t, r = {
2263
- from: n.from,
2264
- to: n.to
2265
- }, i = `${Date.now() % 1e6}-${Number.parseInt(String(Math.random() * 1e3))}`;
2266
- return e().insertContentAt(r, {
2267
- attrs: {
2268
- key: i,
2269
- tag: "video"
2270
- },
2271
- type: this.name
2272
- }).run();
2273
- },
2274
- setVideo: (e) => ({ chain: t, state: n }) => {
2275
- let { selection: r } = n, i = {
2276
- from: r.from,
2277
- to: r.to
2278
- }, a = `${Date.now() % 1e6}-${Number.parseInt(String(Math.random() * 1e3))}`;
2279
- return t().insertContentAt(i, {
2280
- attrs: {
2281
- ...e,
2282
- key: a,
2283
- props: e,
2284
- tag: "video"
2285
- },
2286
- type: this.name
2287
- }).run();
2288
- }
2289
- };
2290
- },
2291
- addOptions() {
2292
- return { HTMLAttributes: {} };
2293
- },
2294
- parseHTML() {
2295
- return [{ tag: "div[data-type=\"video\"]" }];
2296
- },
2297
- renderHTML({ HTMLAttributes: e }) {
2298
- return ["div", m(this.options.HTMLAttributes, e, { "data-type": "video" })];
2299
- }
2300
- });
2301
- //#endregion
2302
- //#region src/lib/config/documentConfig.ts
2303
- function ir(e = {}) {
2304
- return xe(), [
2305
- le.configure({
2306
- codeBlock: !1,
2307
- heading: !1,
2308
- underline: !1,
2309
- link: {
2310
- HTMLAttributes: { target: null },
2311
- defaultProtocol: "https",
2312
- openOnClick: !1
2313
- }
2314
- }),
2315
- Gn.configure({
2316
- levels: [...e.headingLevels ?? [
2317
- 1,
2318
- 2,
2319
- 3,
2320
- 4,
2321
- 5,
2322
- 6
2323
- ]],
2324
- showMarkers: e.showMarkdownMarkers ?? !1
2325
- }),
2326
- ae.extend({ addNodeView() {
2327
- return e.nodeViews?.table ?? null;
2328
- } }).configure({
2329
- renderWrapper: !0,
2330
- resizable: !1
2331
- }),
2332
- ce,
2333
- se.extend({ content: "paragraph+" }),
2334
- oe.extend({ content: "paragraph+" }),
2335
- Un.extend({ addNodeView() {
2336
- return e.nodeViews?.element ?? null;
2337
- } }).configure({
2338
- getAuthoringKit: e.getAuthoringKit,
2339
- getOutputOptions: e.getOutputOptions
2340
- }),
2341
- $n.configure({ getAuthoringKit: e.getAuthoringKit }),
2342
- Qn,
2343
- Vn.extend({ addNodeView() {
2344
- return e.nodeViews?.codeBlock ?? null;
2345
- } }).configure({ theme: e.codeBlockTheme ?? "github-dark" }),
2346
- Yn.extend({ addNodeView() {
2347
- return e.nodeViews?.image ?? null;
2348
- } }).configure({ resolveSrc: e.resolveAsset }),
2349
- rr,
2350
- Wn.configure({ resolveSrc: e.resolveAsset }),
2351
- nr
2352
- ];
2353
- }
2354
- function ar() {
2355
- return ie(ir());
2356
- }
2357
- //#endregion
2358
- export { be as C, ye as S, jt as _, zn as a, Ft as b, Bt as c, Mt as d, z as f, Dt as g, B as h, Pn as i, Pt as l, V as m, ar as n, In as o, At as p, Bn as r, Nn as s, ir as t, R as u, kt as v, ve as w, P as x, H as y };
2359
-
2360
- //# sourceMappingURL=documentConfig-Z6LdrWZj.js.map