@levo-so/site-runtime 0.3.9 → 0.3.10

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.
@@ -1,795 +1,11 @@
1
- import { r as e } from "./ThemeProvider-DutrjSTF.js";
2
- import { n as t } from "./LevoProvider-Bsjkcwc8.js";
3
- import { i as n, r, t as i } from "./Dialog-dT7y641z.js";
4
- import { t as a } from "./inlineCollectionTheme-CWcMCUti.js";
5
- import { c as o, g as s, h as c, i as l, m as u, r as d, u as f } from "./usePopupRedirect-CAAdcpaW-D9XoiVhG.js";
6
- import { n as p, r as m, t as h } from "./nodeAlignment-COvc-rIj.js";
7
- import { c as ee } from "react/compiler-runtime";
8
- import g from "clsx";
9
- import { Fragment as te, jsx as _, jsxs as v } from "react/jsx-runtime";
10
- import y, { Suspense as ne, lazy as b, useMemo as x, useState as re } from "react";
11
- import { IconCheck as ie, IconCopy as ae } from "@tabler/icons-react";
12
- import { Extension as S, Mark as C, Node as w, extensions as T, getAttributesFromExtensions as E, getExtensionField as D, getSchema as O, getSchemaByResolvedExtensions as k, getStyleProperty as A, markInputRule as j, markPasteRule as M, mergeAttributes as N, resolveExtensions as oe, splitExtensions as se, textblockTypeInputRule as ce } from "@tiptap/core";
13
- import { DOMParser as le, Node as P, Schema as ue } from "@tiptap/pm/model";
14
- import { jsx as F } from "@tiptap/core/jsx-runtime";
15
- import { BulletList as de, ListItem as fe, OrderedList as pe } from "@tiptap/extension-list";
16
- import { Color as me, TextStyle as he } from "@tiptap/extension-text-style";
17
- import { Document as ge } from "@tiptap/extension-document";
18
- import { Link as I } from "@tiptap/extension-link";
19
- import { Subscript as L } from "@tiptap/extension-subscript";
20
- import { Superscript as _e } from "@tiptap/extension-superscript";
21
- import { Typography as ve } from "@tiptap/extension-typography";
22
- import { UniqueID as ye } from "@tiptap/extension-unique-id";
23
- //#region ../../node_modules/.pnpm/@tiptap+html@3.30.0_@tiptap+core@3.30.0_@tiptap+pm@3.30.0__@tiptap+pm@3.30.0_happy-dom@20.9.0/node_modules/@tiptap/html/dist/index.js
24
- function be(e, t, n) {
25
- if (typeof window > "u") throw Error("generateJSON can only be used in a browser environment\nIf you want to use this in a Node environment, use the `@tiptap/html/server` import instead.");
26
- let r = O(t), i = new window.DOMParser().parseFromString(e, "text/html");
27
- if (!i) throw Error("Failed to parse HTML string");
28
- return le.fromSchema(r).parse(i.body, n).toJSON();
29
- }
30
- //#endregion
31
- //#region ../../node_modules/.pnpm/@tiptap+static-renderer@3.30.0_@tiptap+core@3.30.0_@tiptap+pm@3.30.0__@tiptap+pm@3.30.0_32db194579d7d1b9da503a9162bec3c3/node_modules/@tiptap/static-renderer/dist/pm/react/index.js
32
- function xe(e, t, n) {
33
- let r = e.attrs;
34
- return r ? t.filter((t) => t.type === (typeof e.type == "string" ? e.type : e.type.name) ? n ? t.attribute.rendered : !0 : !1).map((e) => e.attribute.renderHTML && e.attribute.renderHTML(r) || { [e.name]: e.name in r ? r[e.name] : e.attribute.default }).reduce((e, t) => N(e, t), {}) : {};
35
- }
36
- function R(e, t) {
37
- return xe(e, t, !0);
38
- }
39
- function Se(e, t) {
40
- return t?.textDirection ? [T.TextDirection.configure({ direction: t.textDirection }), ...e] : e;
41
- }
42
- function Ce(e, t, n, r) {
43
- let i = D(t, "renderHTML", {
44
- name: t.name,
45
- options: t.options,
46
- storage: t.storage,
47
- parent: t.parent
48
- });
49
- return i ? [t.name, ({ node: r, children: a }) => {
50
- try {
51
- return e(i({
52
- node: r,
53
- HTMLAttributes: R(r, n)
54
- }))(a);
55
- } catch (e) {
56
- throw Error(`[tiptap error]: Node ${t.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`, { cause: e });
57
- }
58
- }] : r?.unhandledNode ? [t.name, r.unhandledNode] : [t.name, () => {
59
- throw Error(`[tiptap error]: Node ${t.name} cannot be rendered, it is missing a "renderToHTML" method, please implement it or override the corresponding "nodeMapping" method to have a custom rendering`);
60
- }];
61
- }
62
- function we(e, t, n, r) {
63
- let i = D(t, "renderHTML", {
64
- name: t.name,
65
- options: t.options,
66
- storage: t.storage,
67
- parent: t.parent
68
- });
69
- return i ? [t.name, ({ mark: r, children: a }) => {
70
- try {
71
- return e(i({
72
- mark: r,
73
- HTMLAttributes: R(r, n)
74
- }))(a);
75
- } catch (e) {
76
- throw Error(`[tiptap error]: Mark ${t.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`, { cause: e });
77
- }
78
- }] : r?.unhandledMark ? [t.name, r.unhandledMark] : [t.name, () => {
79
- throw Error(`Node ${t.name} cannot be rendered, it is missing a "renderToHTML" method`);
80
- }];
81
- }
82
- var z = "__tiptapUnhandledNode__", B = "__tiptapUnhandledMark__", V = "__originalType", H = "__originalAttrs", U = {
83
- [V]: { default: "" },
84
- [H]: { default: {} }
85
- };
86
- function Te(e, t) {
87
- let n = !1, r = (e) => {
88
- var i, a;
89
- n || (e.type && !(e.type in t.nodes) && (n = !0), (i = e.marks) == null || i.forEach((e) => {
90
- e.type && !(e.type in t.marks) && (n = !0);
91
- }), (a = e.content) == null || a.forEach(r));
92
- };
93
- return r(e), n;
94
- }
95
- function Ee(e, t, n) {
96
- let r = !!n?.unhandledNode, i = !!n?.unhandledMark, a = (e) => i && !(e.type in t.marks) ? {
97
- type: B,
98
- attrs: {
99
- [V]: e.type,
100
- [H]: e.attrs ?? {}
101
- }
102
- } : e, o = (e) => r && e.type != null && !(e.type in t.nodes), s = (e, t) => ({
103
- ...t,
104
- type: z,
105
- attrs: {
106
- [V]: e.type,
107
- [H]: e.attrs ?? {}
108
- }
109
- }), c = (e) => {
110
- let t = {
111
- ...e,
112
- marks: e.marks?.map(a),
113
- content: e.content?.map(c)
114
- };
115
- return o(e) ? s(e, t) : t;
116
- };
117
- return c(e);
118
- }
119
- function De(e) {
120
- return new ue({
121
- topNode: e.spec.topNode,
122
- nodes: e.spec.nodes.addToEnd(z, { attrs: U }),
123
- marks: e.spec.marks.addToEnd(B, { attrs: U })
124
- });
125
- }
126
- function Oe(e, t, n) {
127
- if (e instanceof P) return e;
128
- let r = k(t);
129
- return Te(e, r) ? P.fromJSON(De(r), Ee(e, r, n)) : P.fromJSON(r, e);
130
- }
131
- function W(e) {
132
- return e.type === z || e.type === B ? {
133
- ...e,
134
- type: e.attrs[V],
135
- attrs: e.attrs[H]
136
- } : e;
137
- }
138
- function G(e) {
139
- let t = W(e);
140
- return {
141
- ...t,
142
- marks: t.marks?.map((e) => W(e)),
143
- content: t.content?.map(G)
144
- };
145
- }
146
- function K(e) {
147
- let t = Object.assign(/* @__PURE__ */ Object.create(null), {
148
- type: { name: e.attrs[V] },
149
- attrs: e.attrs[H],
150
- toJSON: () => G(e.toJSON())
151
- });
152
- return new Proxy(e, { get(e, n) {
153
- let r = t[n];
154
- if (r !== void 0) return r;
155
- let i = e[n];
156
- return typeof i == "function" ? i.bind(e) : i;
157
- } });
158
- }
159
- function ke(e) {
160
- return (t) => e({
161
- ...t,
162
- node: K(t.node)
163
- });
164
- }
165
- function Ae(e) {
166
- return (t) => e({
167
- ...t,
168
- mark: K(t.mark)
169
- });
170
- }
171
- function je({ renderer: e, domOutputSpecToElement: t, mapDefinedTypes: n, content: r, extensions: i, options: a }) {
172
- i = oe(i);
173
- let o = E(i), { nodeExtensions: s, markExtensions: c } = se(i), { unhandledNode: l, unhandledMark: u, nodeMapping: d, markMapping: f } = a ?? {};
174
- return r = Oe(r, i, a), e({
175
- ...a,
176
- nodeMapping: {
177
- ...Object.fromEntries(s.filter((e) => e.name in n ? !1 : d ? !(e.name in d) : !0).map((e) => Ce(t, e, o, a))),
178
- ...n,
179
- ...d,
180
- ...l ? { [z]: ke(l) } : {}
181
- },
182
- markMapping: {
183
- ...Object.fromEntries(c.filter((e) => f ? !(e.name in f) : !0).map((e) => we(t, e, o, a))),
184
- ...f,
185
- ...u ? { [B]: Ae(u) } : {}
186
- }
187
- })({ content: r });
188
- }
189
- function Me(e, { nodeMapping: t, markMapping: n, unhandledNode: r, unhandledMark: i }) {
190
- return function a({ content: o, parent: s }) {
191
- let c = typeof o.type == "string" ? o.type : o.type?.name ?? "", l = t[c] ?? r;
192
- if (!l) throw Error(`missing handler for node type ${c}`);
193
- let u = e({
194
- component: l,
195
- props: {
196
- node: o,
197
- parent: s,
198
- renderElement: a,
199
- get children() {
200
- let e = [];
201
- return o.content && o.content.forEach((t) => {
202
- e.push(a({
203
- content: t,
204
- parent: o
205
- }));
206
- }), e;
207
- }
208
- }
209
- });
210
- return o.marks ? o.marks.reduce((t, r) => {
211
- let a = typeof r.type == "string" ? r.type : r.type.name, c = n[a] ?? i;
212
- if (!c) throw Error(`missing handler for mark type ${a}`);
213
- return e({
214
- component: c,
215
- props: {
216
- mark: r,
217
- parent: s,
218
- node: o,
219
- children: t
220
- }
221
- });
222
- }, u) : u;
223
- };
224
- }
225
- function Ne(e) {
226
- let t = 0;
227
- return Me(({ component: e, props: { children: n, ...r } }) => y.createElement(e, Object.assign(r, { key: t++ }), [].concat(n)), e);
228
- }
229
- var Pe = {
230
- colspan: "colSpan",
231
- rowspan: "rowSpan"
232
- };
233
- function q(e, t) {
234
- return e ? Object.entries(e).reduce((e, [t, n]) => {
235
- if (t === "class") return Object.assign(e, { className: n });
236
- if (t === "style" && typeof n == "string") {
237
- let t = {};
238
- return n.split(";").forEach((e) => {
239
- let [n, r] = e.split(":");
240
- if (n && r) {
241
- let e = n.trim().replace(/-([a-z])/g, (e) => e[1].toUpperCase());
242
- t[e] = r.trim();
243
- }
244
- }), Object.assign(e, { style: t });
245
- }
246
- let r = Pe[t] ?? t;
247
- return Object.assign(e, { [r]: n });
248
- }, { key: t }) : { key: t };
249
- }
250
- function J(e, t = 0) {
251
- if (typeof e == "string") return () => e;
252
- if (typeof e == "object" && "length" in e) {
253
- let [n, r, i, ...a] = e, o = n.split(" ");
254
- if (o.length > 1 && (n = o[1], r === void 0 && (r = { xmlns: o[0] }), r === 0 && (r = { xmlns: o[0] }, i = 0), typeof r == "object" && (r = Object.assign(r, { xmlns: o[0] }))), r === void 0) return () => y.createElement(n, q(void 0, t.toString()));
255
- if (r === 0) return (e) => y.createElement(n, q(void 0, t.toString()), e);
256
- if (typeof r == "object") return Array.isArray(r) ? i === void 0 || i === 0 ? (e) => y.createElement(n, q(void 0, t.toString()), J(r, t++)(e)) : (e) => y.createElement(n, q(void 0, t.toString()), J(r)(e), [i].concat(a).map((n) => J(n, t++)(e))) : i === void 0 ? () => y.createElement(n, q(r, t.toString())) : i === 0 ? (e) => y.createElement(n, q(r, t.toString()), e) : (e) => y.createElement(n, q(r, t.toString()), [i].concat(a).map((n) => J(n, t++)(e)));
257
- }
258
- throw Error("[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping", { cause: e });
259
- }
260
- function Fe({ content: e, extensions: t, staticEditorOptions: n, options: r }) {
261
- return je({
262
- renderer: Ne,
263
- domOutputSpecToElement: J,
264
- mapDefinedTypes: {
265
- doc: ({ children: e }) => y.createElement(y.Fragment, {}, e),
266
- text: ({ node: e }) => e.text ?? ""
267
- },
268
- content: e,
269
- extensions: Se(t, n),
270
- options: r
271
- });
272
- }
273
- //#endregion
274
- //#region ../../node_modules/.pnpm/@tiptap+extension-bold@3.30.0_@tiptap+core@3.30.0_@tiptap+pm@3.30.0_/node_modules/@tiptap/extension-bold/dist/index.js
275
- var Ie = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Le = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, Re = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, ze = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Be = C.create({
276
- name: "bold",
277
- addOptions() {
278
- return { HTMLAttributes: {} };
279
- },
280
- parseHTML() {
281
- return [
282
- { tag: "strong" },
283
- {
284
- tag: "b",
285
- getAttrs: (e) => e.style.fontWeight !== "normal" && null
286
- },
287
- {
288
- style: "font-weight=400",
289
- clearMark: (e) => e.type.name === this.name
290
- },
291
- {
292
- style: "font-weight",
293
- getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
294
- }
295
- ];
296
- },
297
- renderHTML({ HTMLAttributes: e }) {
298
- return /* @__PURE__ */ F("strong", {
299
- ...N(this.options.HTMLAttributes, e),
300
- children: /* @__PURE__ */ F("slot", {})
301
- });
302
- },
303
- markdownTokenName: "strong",
304
- parseMarkdown: (e, t) => t.applyMark("bold", t.parseInline(e.tokens || [])),
305
- markdownOptions: { htmlReopen: {
306
- open: "<strong>",
307
- close: "</strong>"
308
- } },
309
- renderMarkdown: (e, t) => `**${t.renderChildren(e)}**`,
310
- addCommands() {
311
- return {
312
- setBold: () => ({ commands: e }) => e.setMark(this.name),
313
- toggleBold: () => ({ commands: e }) => e.toggleMark(this.name),
314
- unsetBold: () => ({ commands: e }) => e.unsetMark(this.name)
315
- };
316
- },
317
- addKeyboardShortcuts() {
318
- return {
319
- "Mod-b": () => this.editor.commands.toggleBold(),
320
- "Mod-B": () => this.editor.commands.toggleBold()
321
- };
322
- },
323
- addInputRules() {
324
- return [j({
325
- find: Ie,
326
- type: this.type
327
- }), j({
328
- find: Re,
329
- type: this.type
330
- })];
331
- },
332
- addPasteRules() {
333
- return [M({
334
- find: Le,
335
- type: this.type
336
- }), M({
337
- find: ze,
338
- type: this.type
339
- })];
340
- }
341
- }), Ve = (e) => {
342
- let t = /`([^`]+)`(?!`)$/.exec(e);
343
- return !t || t.index > 0 && e[t.index - 1] === "`" ? null : {
344
- index: t.index,
345
- text: t[0],
346
- replaceWith: t[1]
347
- };
348
- }, He = (e) => {
349
- let t = /`([^`]+)`(?!`)/g, n = [], r;
350
- for (; (r = t.exec(e)) !== null;) r.index > 0 && e[r.index - 1] === "`" || n.push({
351
- index: r.index,
352
- text: r[0],
353
- replaceWith: r[1]
354
- });
355
- return n;
356
- }, Ue = C.create({
357
- name: "code",
358
- addOptions() {
359
- return { HTMLAttributes: {} };
360
- },
361
- excludes: "_",
362
- code: !0,
363
- exitable: !0,
364
- parseHTML() {
365
- return [{ tag: "code" }];
366
- },
367
- renderHTML({ HTMLAttributes: e }) {
368
- return [
369
- "code",
370
- N(this.options.HTMLAttributes, e),
371
- 0
372
- ];
373
- },
374
- markdownTokenName: "codespan",
375
- parseMarkdown: (e, t) => t.applyMark("code", [{
376
- type: "text",
377
- text: e.text || ""
378
- }]),
379
- renderMarkdown: (e, t) => e.content ? `\`${t.renderChildren(e.content)}\`` : "",
380
- addCommands() {
381
- return {
382
- setCode: () => ({ commands: e }) => e.setMark(this.name),
383
- toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
384
- unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
385
- };
386
- },
387
- addKeyboardShortcuts() {
388
- return { "Mod-e": () => this.editor.commands.toggleCode() };
389
- },
390
- addInputRules() {
391
- return [j({
392
- find: Ve,
393
- type: this.type
394
- })];
395
- },
396
- addPasteRules() {
397
- return [M({
398
- find: He,
399
- type: this.type
400
- })];
401
- }
402
- }), We = w.create({
403
- name: "hardBreak",
404
- markdownTokenName: "br",
405
- addOptions() {
406
- return {
407
- keepMarks: !0,
408
- HTMLAttributes: {}
409
- };
410
- },
411
- inline: !0,
412
- group: "inline",
413
- selectable: !1,
414
- linebreakReplacement: !0,
415
- parseHTML() {
416
- return [{ tag: "br" }];
417
- },
418
- renderHTML({ HTMLAttributes: e }) {
419
- return ["br", N(this.options.HTMLAttributes, e)];
420
- },
421
- renderText() {
422
- return "\n";
423
- },
424
- renderMarkdown: () => " \n",
425
- parseMarkdown: () => ({ type: "hardBreak" }),
426
- addCommands() {
427
- return { setHardBreak: () => ({ commands: e, chain: t, state: n, editor: r }) => e.first([() => e.exitCode(), () => e.command(() => {
428
- let { selection: e, storedMarks: i } = n;
429
- if (e.$from.parent.type.spec.isolating) return !1;
430
- let { keepMarks: a } = this.options, { splittableMarks: o } = r.extensionManager, s = i || e.$to.parentOffset && e.$from.marks();
431
- return t().insertContent({ type: this.name }).command(({ tr: e, dispatch: t }) => {
432
- if (t && s && a) {
433
- let t = s.filter((e) => o.includes(e.type.name));
434
- e.ensureMarks(t);
435
- }
436
- return !0;
437
- }).scrollIntoView().run();
438
- })]) };
439
- },
440
- addKeyboardShortcuts() {
441
- return {
442
- "Mod-Enter": () => this.editor.commands.setHardBreak(),
443
- "Shift-Enter": () => this.editor.commands.setHardBreak()
444
- };
445
- }
446
- }), Ge = w.create({
447
- name: "heading",
448
- addOptions() {
449
- return {
450
- levels: [
451
- 1,
452
- 2,
453
- 3,
454
- 4,
455
- 5,
456
- 6
457
- ],
458
- HTMLAttributes: {}
459
- };
460
- },
461
- content: "inline*",
462
- group: "block",
463
- defining: !0,
464
- addAttributes() {
465
- return { level: {
466
- default: 1,
467
- rendered: !1
468
- } };
469
- },
470
- parseHTML() {
471
- return this.options.levels.map((e) => ({
472
- tag: `h${e}`,
473
- attrs: { level: e }
474
- }));
475
- },
476
- renderHTML({ node: e, HTMLAttributes: t }) {
477
- return [
478
- `h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`,
479
- N(this.options.HTMLAttributes, t),
480
- 0
481
- ];
482
- },
483
- parseMarkdown: (e, t) => t.createNode("heading", { level: e.depth || 1 }, t.parseInline(e.tokens || [])),
484
- renderMarkdown: (e, t) => {
485
- let n = e.attrs?.level ? parseInt(e.attrs.level, 10) : 1, r = "#".repeat(n);
486
- return e.content ? `${r} ${t.renderChildren(e.content)}` : "";
487
- },
488
- addCommands() {
489
- return {
490
- setHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.setNode(this.name, e) : !1,
491
- toggleHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.toggleNode(this.name, "paragraph", e) : !1
492
- };
493
- },
494
- addKeyboardShortcuts() {
495
- return this.options.levels.reduce((e, t) => ({
496
- ...e,
497
- [`Mod-Alt-${t}`]: () => this.editor.commands.toggleHeading({ level: t })
498
- }), {});
499
- },
500
- addInputRules() {
501
- return this.options.levels.map((e) => ce({
502
- find: RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
503
- type: this.type,
504
- getAttributes: { level: e }
505
- }));
506
- }
507
- }), Ke = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, qe = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, Je = C.create({
508
- name: "highlight",
509
- addOptions() {
510
- return {
511
- multicolor: !1,
512
- HTMLAttributes: {}
513
- };
514
- },
515
- addAttributes() {
516
- return this.options.multicolor ? { color: {
517
- default: null,
518
- parseHTML: (e) => e.getAttribute("data-color") || A(e, "background-color") || e.style.backgroundColor,
519
- renderHTML: (e) => e.color ? {
520
- "data-color": e.color,
521
- style: `background-color: ${e.color}; color: inherit`
522
- } : {}
523
- } } : {};
524
- },
525
- parseHTML() {
526
- return [{ tag: "mark" }];
527
- },
528
- renderHTML({ HTMLAttributes: e }) {
529
- return [
530
- "mark",
531
- N(this.options.HTMLAttributes, e),
532
- 0
533
- ];
534
- },
535
- renderMarkdown: (e, t) => `==${t.renderChildren(e)}==`,
536
- parseMarkdown: (e, t) => t.applyMark("highlight", t.parseInline(e.tokens || [])),
537
- markdownTokenizer: {
538
- name: "highlight",
539
- level: "inline",
540
- start: (e) => e.indexOf("=="),
541
- tokenize(e, t, n) {
542
- let r = /^(==)([^=]+)(==)/.exec(e);
543
- if (r) {
544
- let e = r[2].trim(), t = n.inlineTokens(e);
545
- return {
546
- type: "highlight",
547
- raw: r[0],
548
- text: e,
549
- tokens: t
550
- };
551
- }
552
- }
553
- },
554
- addCommands() {
555
- return {
556
- setHighlight: (e) => ({ commands: t }) => t.setMark(this.name, e),
557
- toggleHighlight: (e) => ({ commands: t }) => t.toggleMark(this.name, e),
558
- unsetHighlight: () => ({ commands: e }) => e.unsetMark(this.name)
559
- };
560
- },
561
- addKeyboardShortcuts() {
562
- return { "Mod-Shift-h": () => this.editor.commands.toggleHighlight() };
563
- },
564
- addInputRules() {
565
- return [j({
566
- find: Ke,
567
- type: this.type
568
- })];
569
- },
570
- addPasteRules() {
571
- return [M({
572
- find: qe,
573
- type: this.type
574
- })];
575
- }
576
- }), Ye = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Xe = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, Ze = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, Qe = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, $e = C.create({
577
- name: "italic",
578
- addOptions() {
579
- return { HTMLAttributes: {} };
580
- },
581
- parseHTML() {
582
- return [
583
- { tag: "em" },
584
- {
585
- tag: "i",
586
- getAttrs: (e) => e.style.fontStyle !== "normal" && null
587
- },
588
- {
589
- style: "font-style=normal",
590
- clearMark: (e) => e.type.name === this.name
591
- },
592
- { style: "font-style=italic" }
593
- ];
594
- },
595
- renderHTML({ HTMLAttributes: e }) {
596
- return [
597
- "em",
598
- N(this.options.HTMLAttributes, e),
599
- 0
600
- ];
601
- },
602
- addCommands() {
603
- return {
604
- setItalic: () => ({ commands: e }) => e.setMark(this.name),
605
- toggleItalic: () => ({ commands: e }) => e.toggleMark(this.name),
606
- unsetItalic: () => ({ commands: e }) => e.unsetMark(this.name)
607
- };
608
- },
609
- markdownTokenName: "em",
610
- parseMarkdown: (e, t) => t.applyMark("italic", t.parseInline(e.tokens || [])),
611
- markdownOptions: { htmlReopen: {
612
- open: "<em>",
613
- close: "</em>"
614
- } },
615
- renderMarkdown: (e, t) => `*${t.renderChildren(e)}*`,
616
- addKeyboardShortcuts() {
617
- return {
618
- "Mod-i": () => this.editor.commands.toggleItalic(),
619
- "Mod-I": () => this.editor.commands.toggleItalic()
620
- };
621
- },
622
- addInputRules() {
623
- return [j({
624
- find: Ye,
625
- type: this.type
626
- }), j({
627
- find: Ze,
628
- type: this.type
629
- })];
630
- },
631
- addPasteRules() {
632
- return [M({
633
- find: Xe,
634
- type: this.type
635
- }), M({
636
- find: Qe,
637
- type: this.type
638
- })];
639
- }
640
- }), Y = "&nbsp;", X = "\xA0", et = w.create({
641
- name: "paragraph",
642
- priority: 1e3,
643
- addOptions() {
644
- return { HTMLAttributes: {} };
645
- },
646
- group: "block",
647
- content: "inline*",
648
- parseHTML() {
649
- return [{ tag: "p" }];
650
- },
651
- renderHTML({ HTMLAttributes: e }) {
652
- return [
653
- "p",
654
- N(this.options.HTMLAttributes, e),
655
- 0
656
- ];
657
- },
658
- parseMarkdown: (e, t) => {
659
- let n = e.tokens || [];
660
- if (n.length === 1 && n[0].type === "image") return t.parseChildren([n[0]]);
661
- let r = t.parseInline(n);
662
- return n.length === 1 && n[0].type === "text" && (n[0].raw === Y || n[0].text === Y || n[0].raw === X || n[0].text === X) && r.length === 1 && r[0].type === "text" && (r[0].text === Y || r[0].text === X) ? t.createNode("paragraph", void 0, []) : t.createNode("paragraph", void 0, r);
663
- },
664
- renderMarkdown: (e, t, n) => {
665
- if (!e) return "";
666
- let r = Array.isArray(e.content) ? e.content : [];
667
- if (r.length === 0) {
668
- let e = Array.isArray(n?.previousNode?.content) ? n.previousNode.content : [];
669
- return n?.previousNode?.type === "paragraph" && e.length === 0 ? Y : "";
670
- }
671
- return t.renderChildren(r);
672
- },
673
- addCommands() {
674
- return { setParagraph: () => ({ commands: e }) => e.setNode(this.name) };
675
- },
676
- addKeyboardShortcuts() {
677
- return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
678
- }
679
- }), tt = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, nt = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, rt = C.create({
680
- name: "strike",
681
- addOptions() {
682
- return { HTMLAttributes: {} };
683
- },
684
- parseHTML() {
685
- return [
686
- { tag: "s" },
687
- { tag: "del" },
688
- { tag: "strike" },
689
- {
690
- style: "text-decoration",
691
- consuming: !1,
692
- getAttrs: (e) => e.includes("line-through") ? {} : !1
693
- }
694
- ];
695
- },
696
- renderHTML({ HTMLAttributes: e }) {
697
- return [
698
- "s",
699
- N(this.options.HTMLAttributes, e),
700
- 0
701
- ];
702
- },
703
- markdownTokenName: "del",
704
- parseMarkdown: (e, t) => t.applyMark("strike", t.parseInline(e.tokens || [])),
705
- renderMarkdown: (e, t) => `~~${t.renderChildren(e)}~~`,
706
- addCommands() {
707
- return {
708
- setStrike: () => ({ commands: e }) => e.setMark(this.name),
709
- toggleStrike: () => ({ commands: e }) => e.toggleMark(this.name),
710
- unsetStrike: () => ({ commands: e }) => e.unsetMark(this.name)
711
- };
712
- },
713
- addKeyboardShortcuts() {
714
- return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
715
- },
716
- addInputRules() {
717
- return [j({
718
- find: tt,
719
- type: this.type
720
- })];
721
- },
722
- addPasteRules() {
723
- return [M({
724
- find: nt,
725
- type: this.type
726
- })];
727
- }
728
- }), it = w.create({
729
- name: "text",
730
- group: "inline",
731
- parseMarkdown: (e) => ({
732
- type: "text",
733
- text: e.text || ""
734
- }),
735
- renderMarkdown: (e) => e.text || ""
736
- }), at = C.create({
737
- name: "underline",
738
- addOptions() {
739
- return { HTMLAttributes: {} };
740
- },
741
- parseHTML() {
742
- return [{ tag: "u" }, {
743
- style: "text-decoration",
744
- consuming: !1,
745
- getAttrs: (e) => e.includes("underline") ? {} : !1
746
- }];
747
- },
748
- renderHTML({ HTMLAttributes: e }) {
749
- return [
750
- "u",
751
- N(this.options.HTMLAttributes, e),
752
- 0
753
- ];
754
- },
755
- parseMarkdown(e, t) {
756
- return t.applyMark(this.name || "underline", t.parseInline(e.tokens || []));
757
- },
758
- renderMarkdown(e, t) {
759
- return `++${t.renderChildren(e)}++`;
760
- },
761
- markdownTokenizer: {
762
- name: "underline",
763
- level: "inline",
764
- start(e) {
765
- return e.indexOf("++");
766
- },
767
- tokenize(e, t, n) {
768
- let r = /^(\+\+)([\s\S]+?)(\+\+)/.exec(e);
769
- if (!r) return;
770
- let i = r[2].trim();
771
- return {
772
- type: "underline",
773
- raw: r[0],
774
- text: i,
775
- tokens: n.inlineTokens(i)
776
- };
777
- }
778
- },
779
- addCommands() {
780
- return {
781
- setUnderline: () => ({ commands: e }) => e.setMark(this.name),
782
- toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name),
783
- unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name)
784
- };
785
- },
786
- addKeyboardShortcuts() {
787
- return {
788
- "Mod-u": () => this.editor.commands.toggleUnderline(),
789
- "Mod-U": () => this.editor.commands.toggleUnderline()
790
- };
791
- }
792
- }), ot = {
1
+ import e from "react";
2
+ import { Extension as t, Mark as n, Node as r, extensions as i, getAttributesFromExtensions as a, getExtensionField as o, getSchema as s, getSchemaByResolvedExtensions as c, getStyleProperty as l, markInputRule as u, markPasteRule as d, mergeAttributes as f, resolveExtensions as ee, splitExtensions as te, textblockTypeInputRule as p } from "@tiptap/core";
3
+ import { Color as m } from "@tiptap/extension-text-style";
4
+ import { BulletList as h, ListItem as ne, OrderedList as re } from "@tiptap/extension-list";
5
+ import { jsx as g } from "@tiptap/core/jsx-runtime";
6
+ import { DOMParser as ie, Node as _, Schema as ae } from "@tiptap/pm/model";
7
+ //#region ../../libraries/editor-core/dist/extensions/emoji/emojiMap.js
8
+ var oe = {
793
9
  100: "1f4af",
794
10
  1234: "1f522",
795
11
  regional_indicator_a: "🇦",
@@ -2723,200 +1939,833 @@ var Ie = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Le = /(?:^|\s)(
2723
1939
  england: "1f3f4-e0067-e0062-e0065-e006e-e0067-e007f",
2724
1940
  scotland: "1f3f4-e0067-e0062-e0073-e0063-e0074-e007f",
2725
1941
  wales: "1f3f4-e0067-e0062-e0077-e006c-e0073-e007f"
2726
- }, st = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64", Z = (e) => /^[A-Fa-f0-9-]+$/.test(e), ct = w.create({
1942
+ }, se = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64", ce = (e) => /^[A-Fa-f0-9-]+$/.test(e), le = r.create({
2727
1943
  name: "emoji",
2728
1944
  inline: !0,
2729
1945
  group: "inline",
2730
1946
  selectable: !1,
2731
1947
  atom: !0,
2732
1948
  addAttributes() {
2733
- return { name: {
2734
- default: null,
2735
- parseHTML: (e) => e.dataset.name,
2736
- renderHTML: (e) => ({ "data-name": e.name })
1949
+ return { name: {
1950
+ default: null,
1951
+ parseHTML: (e) => e.dataset.name,
1952
+ renderHTML: (e) => ({ "data-name": e.name })
1953
+ } };
1954
+ },
1955
+ parseHTML() {
1956
+ return [{ tag: "span[data-type=\"emoji\"]" }];
1957
+ },
1958
+ renderHTML({ HTMLAttributes: e, node: t }) {
1959
+ let n = f(e, { "data-type": "emoji" }), r = t.attrs.name, i = r ? oe[r] : void 0;
1960
+ return i ? ce(i) ? [
1961
+ "span",
1962
+ n,
1963
+ ["img", {
1964
+ src: `${se}/${i}.png`,
1965
+ draggable: "false",
1966
+ loading: "lazy",
1967
+ align: "absmiddle",
1968
+ alt: `${r} emoji`
1969
+ }]
1970
+ ] : [
1971
+ "span",
1972
+ n,
1973
+ i
1974
+ ] : [
1975
+ "span",
1976
+ n,
1977
+ `:${r || "emoji"}:`
1978
+ ];
1979
+ }
1980
+ }), ue = t.create({
1981
+ name: "fontSize",
1982
+ addOptions() {
1983
+ return { types: ["textStyle"] };
1984
+ },
1985
+ addGlobalAttributes() {
1986
+ return [{
1987
+ types: this.options.types,
1988
+ attributes: { fontSize: {
1989
+ default: null,
1990
+ parseHTML: (e) => e.style.fontSize.replace(/['"]+/g, ""),
1991
+ renderHTML: (e) => e.fontSize ? { style: `font-size: ${e.fontSize}` } : {}
1992
+ } }
1993
+ }];
1994
+ },
1995
+ addCommands() {
1996
+ return {
1997
+ setFontSize: (e) => ({ chain: t }) => t().setMark("textStyle", { fontSize: e }).run(),
1998
+ unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
1999
+ };
2000
+ }
2001
+ }), de = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, v = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, y = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, b = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, x = n.create({
2002
+ name: "bold",
2003
+ addOptions() {
2004
+ return { HTMLAttributes: {} };
2005
+ },
2006
+ parseHTML() {
2007
+ return [
2008
+ { tag: "strong" },
2009
+ {
2010
+ tag: "b",
2011
+ getAttrs: (e) => e.style.fontWeight !== "normal" && null
2012
+ },
2013
+ {
2014
+ style: "font-weight=400",
2015
+ clearMark: (e) => e.type.name === this.name
2016
+ },
2017
+ {
2018
+ style: "font-weight",
2019
+ getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
2020
+ }
2021
+ ];
2022
+ },
2023
+ renderHTML({ HTMLAttributes: e }) {
2024
+ return /* @__PURE__ */ g("strong", {
2025
+ ...f(this.options.HTMLAttributes, e),
2026
+ children: /* @__PURE__ */ g("slot", {})
2027
+ });
2028
+ },
2029
+ markdownTokenName: "strong",
2030
+ parseMarkdown: (e, t) => t.applyMark("bold", t.parseInline(e.tokens || [])),
2031
+ markdownOptions: { htmlReopen: {
2032
+ open: "<strong>",
2033
+ close: "</strong>"
2034
+ } },
2035
+ renderMarkdown: (e, t) => `**${t.renderChildren(e)}**`,
2036
+ addCommands() {
2037
+ return {
2038
+ setBold: () => ({ commands: e }) => e.setMark(this.name),
2039
+ toggleBold: () => ({ commands: e }) => e.toggleMark(this.name),
2040
+ unsetBold: () => ({ commands: e }) => e.unsetMark(this.name)
2041
+ };
2042
+ },
2043
+ addKeyboardShortcuts() {
2044
+ return {
2045
+ "Mod-b": () => this.editor.commands.toggleBold(),
2046
+ "Mod-B": () => this.editor.commands.toggleBold()
2047
+ };
2048
+ },
2049
+ addInputRules() {
2050
+ return [u({
2051
+ find: de,
2052
+ type: this.type
2053
+ }), u({
2054
+ find: y,
2055
+ type: this.type
2056
+ })];
2057
+ },
2058
+ addPasteRules() {
2059
+ return [d({
2060
+ find: v,
2061
+ type: this.type
2062
+ }), d({
2063
+ find: b,
2064
+ type: this.type
2065
+ })];
2066
+ }
2067
+ }), S = (e) => {
2068
+ let t = /`([^`]+)`(?!`)$/.exec(e);
2069
+ return !t || t.index > 0 && e[t.index - 1] === "`" ? null : {
2070
+ index: t.index,
2071
+ text: t[0],
2072
+ replaceWith: t[1]
2073
+ };
2074
+ }, C = (e) => {
2075
+ let t = /`([^`]+)`(?!`)/g, n = [], r;
2076
+ for (; (r = t.exec(e)) !== null;) r.index > 0 && e[r.index - 1] === "`" || n.push({
2077
+ index: r.index,
2078
+ text: r[0],
2079
+ replaceWith: r[1]
2080
+ });
2081
+ return n;
2082
+ }, w = n.create({
2083
+ name: "code",
2084
+ addOptions() {
2085
+ return { HTMLAttributes: {} };
2086
+ },
2087
+ excludes: "_",
2088
+ code: !0,
2089
+ exitable: !0,
2090
+ parseHTML() {
2091
+ return [{ tag: "code" }];
2092
+ },
2093
+ renderHTML({ HTMLAttributes: e }) {
2094
+ return [
2095
+ "code",
2096
+ f(this.options.HTMLAttributes, e),
2097
+ 0
2098
+ ];
2099
+ },
2100
+ markdownTokenName: "codespan",
2101
+ parseMarkdown: (e, t) => t.applyMark("code", [{
2102
+ type: "text",
2103
+ text: e.text || ""
2104
+ }]),
2105
+ renderMarkdown: (e, t) => e.content ? `\`${t.renderChildren(e.content)}\`` : "",
2106
+ addCommands() {
2107
+ return {
2108
+ setCode: () => ({ commands: e }) => e.setMark(this.name),
2109
+ toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
2110
+ unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
2111
+ };
2112
+ },
2113
+ addKeyboardShortcuts() {
2114
+ return { "Mod-e": () => this.editor.commands.toggleCode() };
2115
+ },
2116
+ addInputRules() {
2117
+ return [u({
2118
+ find: S,
2119
+ type: this.type
2120
+ })];
2121
+ },
2122
+ addPasteRules() {
2123
+ return [d({
2124
+ find: C,
2125
+ type: this.type
2126
+ })];
2127
+ }
2128
+ }), T = r.create({
2129
+ name: "hardBreak",
2130
+ markdownTokenName: "br",
2131
+ addOptions() {
2132
+ return {
2133
+ keepMarks: !0,
2134
+ HTMLAttributes: {}
2135
+ };
2136
+ },
2137
+ inline: !0,
2138
+ group: "inline",
2139
+ selectable: !1,
2140
+ linebreakReplacement: !0,
2141
+ parseHTML() {
2142
+ return [{ tag: "br" }];
2143
+ },
2144
+ renderHTML({ HTMLAttributes: e }) {
2145
+ return ["br", f(this.options.HTMLAttributes, e)];
2146
+ },
2147
+ renderText() {
2148
+ return "\n";
2149
+ },
2150
+ renderMarkdown: () => " \n",
2151
+ parseMarkdown: () => ({ type: "hardBreak" }),
2152
+ addCommands() {
2153
+ return { setHardBreak: () => ({ commands: e, chain: t, state: n, editor: r }) => e.first([() => e.exitCode(), () => e.command(() => {
2154
+ let { selection: e, storedMarks: i } = n;
2155
+ if (e.$from.parent.type.spec.isolating) return !1;
2156
+ let { keepMarks: a } = this.options, { splittableMarks: o } = r.extensionManager, s = i || e.$to.parentOffset && e.$from.marks();
2157
+ return t().insertContent({ type: this.name }).command(({ tr: e, dispatch: t }) => {
2158
+ if (t && s && a) {
2159
+ let t = s.filter((e) => o.includes(e.type.name));
2160
+ e.ensureMarks(t);
2161
+ }
2162
+ return !0;
2163
+ }).scrollIntoView().run();
2164
+ })]) };
2165
+ },
2166
+ addKeyboardShortcuts() {
2167
+ return {
2168
+ "Mod-Enter": () => this.editor.commands.setHardBreak(),
2169
+ "Shift-Enter": () => this.editor.commands.setHardBreak()
2170
+ };
2171
+ }
2172
+ }), E = r.create({
2173
+ name: "heading",
2174
+ addOptions() {
2175
+ return {
2176
+ levels: [
2177
+ 1,
2178
+ 2,
2179
+ 3,
2180
+ 4,
2181
+ 5,
2182
+ 6
2183
+ ],
2184
+ HTMLAttributes: {}
2185
+ };
2186
+ },
2187
+ content: "inline*",
2188
+ group: "block",
2189
+ defining: !0,
2190
+ addAttributes() {
2191
+ return { level: {
2192
+ default: 1,
2193
+ rendered: !1
2737
2194
  } };
2738
2195
  },
2739
2196
  parseHTML() {
2740
- return [{ tag: "span[data-type=\"emoji\"]" }];
2197
+ return this.options.levels.map((e) => ({
2198
+ tag: `h${e}`,
2199
+ attrs: { level: e }
2200
+ }));
2741
2201
  },
2742
- renderHTML({ HTMLAttributes: e, node: t }) {
2743
- let n = N(e, { "data-type": "emoji" }), r = t.attrs.name, i = r ? ot[r] : void 0;
2744
- return i ? Z(i) ? [
2745
- "span",
2746
- n,
2747
- ["img", {
2748
- src: `${st}/${i}.png`,
2749
- draggable: "false",
2750
- loading: "lazy",
2751
- align: "absmiddle",
2752
- alt: `${r} emoji`
2753
- }]
2754
- ] : [
2755
- "span",
2756
- n,
2757
- i
2758
- ] : [
2759
- "span",
2760
- n,
2761
- `:${r || "emoji"}:`
2202
+ renderHTML({ node: e, HTMLAttributes: t }) {
2203
+ return [
2204
+ `h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`,
2205
+ f(this.options.HTMLAttributes, t),
2206
+ 0
2207
+ ];
2208
+ },
2209
+ parseMarkdown: (e, t) => t.createNode("heading", { level: e.depth || 1 }, t.parseInline(e.tokens || [])),
2210
+ renderMarkdown: (e, t) => {
2211
+ let n = e.attrs?.level ? parseInt(e.attrs.level, 10) : 1, r = "#".repeat(n);
2212
+ return e.content ? `${r} ${t.renderChildren(e.content)}` : "";
2213
+ },
2214
+ addCommands() {
2215
+ return {
2216
+ setHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.setNode(this.name, e) : !1,
2217
+ toggleHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.toggleNode(this.name, "paragraph", e) : !1
2218
+ };
2219
+ },
2220
+ addKeyboardShortcuts() {
2221
+ return this.options.levels.reduce((e, t) => ({
2222
+ ...e,
2223
+ [`Mod-Alt-${t}`]: () => this.editor.commands.toggleHeading({ level: t })
2224
+ }), {});
2225
+ },
2226
+ addInputRules() {
2227
+ return this.options.levels.map((e) => p({
2228
+ find: RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
2229
+ type: this.type,
2230
+ getAttributes: { level: e }
2231
+ }));
2232
+ }
2233
+ }), D = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, O = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, k = n.create({
2234
+ name: "highlight",
2235
+ addOptions() {
2236
+ return {
2237
+ multicolor: !1,
2238
+ HTMLAttributes: {}
2239
+ };
2240
+ },
2241
+ addAttributes() {
2242
+ return this.options.multicolor ? { color: {
2243
+ default: null,
2244
+ parseHTML: (e) => e.getAttribute("data-color") || l(e, "background-color") || e.style.backgroundColor,
2245
+ renderHTML: (e) => e.color ? {
2246
+ "data-color": e.color,
2247
+ style: `background-color: ${e.color}; color: inherit`
2248
+ } : {}
2249
+ } } : {};
2250
+ },
2251
+ parseHTML() {
2252
+ return [{ tag: "mark" }];
2253
+ },
2254
+ renderHTML({ HTMLAttributes: e }) {
2255
+ return [
2256
+ "mark",
2257
+ f(this.options.HTMLAttributes, e),
2258
+ 0
2259
+ ];
2260
+ },
2261
+ renderMarkdown: (e, t) => `==${t.renderChildren(e)}==`,
2262
+ parseMarkdown: (e, t) => t.applyMark("highlight", t.parseInline(e.tokens || [])),
2263
+ markdownTokenizer: {
2264
+ name: "highlight",
2265
+ level: "inline",
2266
+ start: (e) => e.indexOf("=="),
2267
+ tokenize(e, t, n) {
2268
+ let r = /^(==)([^=]+)(==)/.exec(e);
2269
+ if (r) {
2270
+ let e = r[2].trim(), t = n.inlineTokens(e);
2271
+ return {
2272
+ type: "highlight",
2273
+ raw: r[0],
2274
+ text: e,
2275
+ tokens: t
2276
+ };
2277
+ }
2278
+ }
2279
+ },
2280
+ addCommands() {
2281
+ return {
2282
+ setHighlight: (e) => ({ commands: t }) => t.setMark(this.name, e),
2283
+ toggleHighlight: (e) => ({ commands: t }) => t.toggleMark(this.name, e),
2284
+ unsetHighlight: () => ({ commands: e }) => e.unsetMark(this.name)
2285
+ };
2286
+ },
2287
+ addKeyboardShortcuts() {
2288
+ return { "Mod-Shift-h": () => this.editor.commands.toggleHighlight() };
2289
+ },
2290
+ addInputRules() {
2291
+ return [u({
2292
+ find: D,
2293
+ type: this.type
2294
+ })];
2295
+ },
2296
+ addPasteRules() {
2297
+ return [d({
2298
+ find: O,
2299
+ type: this.type
2300
+ })];
2301
+ }
2302
+ }), A = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, j = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, M = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, N = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, P = n.create({
2303
+ name: "italic",
2304
+ addOptions() {
2305
+ return { HTMLAttributes: {} };
2306
+ },
2307
+ parseHTML() {
2308
+ return [
2309
+ { tag: "em" },
2310
+ {
2311
+ tag: "i",
2312
+ getAttrs: (e) => e.style.fontStyle !== "normal" && null
2313
+ },
2314
+ {
2315
+ style: "font-style=normal",
2316
+ clearMark: (e) => e.type.name === this.name
2317
+ },
2318
+ { style: "font-style=italic" }
2319
+ ];
2320
+ },
2321
+ renderHTML({ HTMLAttributes: e }) {
2322
+ return [
2323
+ "em",
2324
+ f(this.options.HTMLAttributes, e),
2325
+ 0
2326
+ ];
2327
+ },
2328
+ addCommands() {
2329
+ return {
2330
+ setItalic: () => ({ commands: e }) => e.setMark(this.name),
2331
+ toggleItalic: () => ({ commands: e }) => e.toggleMark(this.name),
2332
+ unsetItalic: () => ({ commands: e }) => e.unsetMark(this.name)
2333
+ };
2334
+ },
2335
+ markdownTokenName: "em",
2336
+ parseMarkdown: (e, t) => t.applyMark("italic", t.parseInline(e.tokens || [])),
2337
+ markdownOptions: { htmlReopen: {
2338
+ open: "<em>",
2339
+ close: "</em>"
2340
+ } },
2341
+ renderMarkdown: (e, t) => `*${t.renderChildren(e)}*`,
2342
+ addKeyboardShortcuts() {
2343
+ return {
2344
+ "Mod-i": () => this.editor.commands.toggleItalic(),
2345
+ "Mod-I": () => this.editor.commands.toggleItalic()
2346
+ };
2347
+ },
2348
+ addInputRules() {
2349
+ return [u({
2350
+ find: A,
2351
+ type: this.type
2352
+ }), u({
2353
+ find: M,
2354
+ type: this.type
2355
+ })];
2356
+ },
2357
+ addPasteRules() {
2358
+ return [d({
2359
+ find: j,
2360
+ type: this.type
2361
+ }), d({
2362
+ find: N,
2363
+ type: this.type
2364
+ })];
2365
+ }
2366
+ }), F = "&nbsp;", I = "\xA0", L = r.create({
2367
+ name: "paragraph",
2368
+ priority: 1e3,
2369
+ addOptions() {
2370
+ return { HTMLAttributes: {} };
2371
+ },
2372
+ group: "block",
2373
+ content: "inline*",
2374
+ parseHTML() {
2375
+ return [{ tag: "p" }];
2376
+ },
2377
+ renderHTML({ HTMLAttributes: e }) {
2378
+ return [
2379
+ "p",
2380
+ f(this.options.HTMLAttributes, e),
2381
+ 0
2382
+ ];
2383
+ },
2384
+ parseMarkdown: (e, t) => {
2385
+ let n = e.tokens || [];
2386
+ if (n.length === 1 && n[0].type === "image") return t.parseChildren([n[0]]);
2387
+ let r = t.parseInline(n);
2388
+ return n.length === 1 && n[0].type === "text" && (n[0].raw === F || n[0].text === F || n[0].raw === I || n[0].text === I) && r.length === 1 && r[0].type === "text" && (r[0].text === F || r[0].text === I) ? t.createNode("paragraph", void 0, []) : t.createNode("paragraph", void 0, r);
2389
+ },
2390
+ renderMarkdown: (e, t, n) => {
2391
+ if (!e) return "";
2392
+ let r = Array.isArray(e.content) ? e.content : [];
2393
+ if (r.length === 0) {
2394
+ let e = Array.isArray(n?.previousNode?.content) ? n.previousNode.content : [];
2395
+ return n?.previousNode?.type === "paragraph" && e.length === 0 ? F : "";
2396
+ }
2397
+ return t.renderChildren(r);
2398
+ },
2399
+ addCommands() {
2400
+ return { setParagraph: () => ({ commands: e }) => e.setNode(this.name) };
2401
+ },
2402
+ addKeyboardShortcuts() {
2403
+ return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
2404
+ }
2405
+ }), R = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, z = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, B = n.create({
2406
+ name: "strike",
2407
+ addOptions() {
2408
+ return { HTMLAttributes: {} };
2409
+ },
2410
+ parseHTML() {
2411
+ return [
2412
+ { tag: "s" },
2413
+ { tag: "del" },
2414
+ { tag: "strike" },
2415
+ {
2416
+ style: "text-decoration",
2417
+ consuming: !1,
2418
+ getAttrs: (e) => e.includes("line-through") ? {} : !1
2419
+ }
2420
+ ];
2421
+ },
2422
+ renderHTML({ HTMLAttributes: e }) {
2423
+ return [
2424
+ "s",
2425
+ f(this.options.HTMLAttributes, e),
2426
+ 0
2762
2427
  ];
2428
+ },
2429
+ markdownTokenName: "del",
2430
+ parseMarkdown: (e, t) => t.applyMark("strike", t.parseInline(e.tokens || [])),
2431
+ renderMarkdown: (e, t) => `~~${t.renderChildren(e)}~~`,
2432
+ addCommands() {
2433
+ return {
2434
+ setStrike: () => ({ commands: e }) => e.setMark(this.name),
2435
+ toggleStrike: () => ({ commands: e }) => e.toggleMark(this.name),
2436
+ unsetStrike: () => ({ commands: e }) => e.unsetMark(this.name)
2437
+ };
2438
+ },
2439
+ addKeyboardShortcuts() {
2440
+ return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
2441
+ },
2442
+ addInputRules() {
2443
+ return [u({
2444
+ find: R,
2445
+ type: this.type
2446
+ })];
2447
+ },
2448
+ addPasteRules() {
2449
+ return [d({
2450
+ find: z,
2451
+ type: this.type
2452
+ })];
2763
2453
  }
2764
- }), lt = S.create({
2765
- name: "fontSize",
2454
+ }), V = r.create({
2455
+ name: "text",
2456
+ group: "inline",
2457
+ parseMarkdown: (e) => ({
2458
+ type: "text",
2459
+ text: e.text || ""
2460
+ }),
2461
+ renderMarkdown: (e) => e.text || ""
2462
+ }), fe = n.create({
2463
+ name: "underline",
2766
2464
  addOptions() {
2767
- return { types: ["textStyle"] };
2465
+ return { HTMLAttributes: {} };
2768
2466
  },
2769
- addGlobalAttributes() {
2770
- return [{
2771
- types: this.options.types,
2772
- attributes: { fontSize: {
2773
- default: null,
2774
- parseHTML: (e) => e.style.fontSize.replace(/['"]+/g, ""),
2775
- renderHTML: (e) => e.fontSize ? { style: `font-size: ${e.fontSize}` } : {}
2776
- } }
2467
+ parseHTML() {
2468
+ return [{ tag: "u" }, {
2469
+ style: "text-decoration",
2470
+ consuming: !1,
2471
+ getAttrs: (e) => e.includes("underline") ? {} : !1
2777
2472
  }];
2778
2473
  },
2474
+ renderHTML({ HTMLAttributes: e }) {
2475
+ return [
2476
+ "u",
2477
+ f(this.options.HTMLAttributes, e),
2478
+ 0
2479
+ ];
2480
+ },
2481
+ parseMarkdown(e, t) {
2482
+ return t.applyMark(this.name || "underline", t.parseInline(e.tokens || []));
2483
+ },
2484
+ renderMarkdown(e, t) {
2485
+ return `++${t.renderChildren(e)}++`;
2486
+ },
2487
+ markdownTokenizer: {
2488
+ name: "underline",
2489
+ level: "inline",
2490
+ start(e) {
2491
+ return e.indexOf("++");
2492
+ },
2493
+ tokenize(e, t, n) {
2494
+ let r = /^(\+\+)([\s\S]+?)(\+\+)/.exec(e);
2495
+ if (!r) return;
2496
+ let i = r[2].trim();
2497
+ return {
2498
+ type: "underline",
2499
+ raw: r[0],
2500
+ text: i,
2501
+ tokens: n.inlineTokens(i)
2502
+ };
2503
+ }
2504
+ },
2779
2505
  addCommands() {
2780
2506
  return {
2781
- setFontSize: (e) => ({ chain: t }) => t().setMark("textStyle", { fontSize: e }).run(),
2782
- unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
2507
+ setUnderline: () => ({ commands: e }) => e.setMark(this.name),
2508
+ toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name),
2509
+ unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name)
2510
+ };
2511
+ },
2512
+ addKeyboardShortcuts() {
2513
+ return {
2514
+ "Mod-u": () => this.editor.commands.toggleUnderline(),
2515
+ "Mod-U": () => this.editor.commands.toggleUnderline()
2783
2516
  };
2784
2517
  }
2785
- }), Q = [
2786
- ge,
2787
- et,
2788
- it,
2789
- Ge,
2790
- Be,
2791
- $e,
2792
- rt,
2793
- Ue,
2794
- de,
2795
- pe,
2796
- fe,
2797
- We,
2798
- at,
2799
- I.configure({ openOnClick: !1 }),
2800
- he,
2801
- lt,
2802
- ve,
2803
- _e,
2804
- L,
2805
- me,
2806
- Je.configure({ multicolor: !0 }),
2807
- ct,
2808
- h,
2809
- ye.configure({ types: [
2810
- "paragraph",
2811
- "heading",
2812
- "bulletList",
2813
- "orderedList"
2814
- ] })
2815
- ], $ = (e) => be(e, Q), ut = ({ content: e, className: t, ref: n, ...r }) => {
2816
- let i = x(() => e ? typeof e == "string" ? e ? $(e) : null : e.json && Object.keys(e.json).length > 0 ? e.json : e.html ? $(e.html) : null : null, [e]), a = x(() => i ? Fe({
2817
- content: i,
2818
- extensions: Q
2819
- }) : null, [i]);
2820
- return a ? /* @__PURE__ */ _("div", {
2821
- ref: n,
2822
- className: g(m, t),
2823
- ...r,
2824
- children: a
2825
- }) : null;
2826
- }, dt = /* @__PURE__ */ s({ PopupBody: () => gt }), ft = b(() => import("./dist-orLT2eNz.js").then((e) => e.t).then((e) => ({ default: e.CollectionFormBuilder }))), pt = p({ baseSpacing: ".625rem" }), mt = { style: a({ form: { gap: "1rem" } }) }, ht = {
2827
- left: o,
2828
- center: d,
2829
- right: l
2830
- }, gt = (a) => {
2831
- let o = ee(33), { disableInteraction: s } = a, { popup: l, callbacks: d, client: p, preview: m } = u(), h = d?.onAction, g = c(l), { content: y } = l, [b, x] = re(!1), S;
2832
- o[0] !== y.action || o[1] !== h || o[2] !== l ? (S = () => {
2833
- if (y.action?.type !== "redirect" || !y.action.copyValue) return;
2834
- let e = y.action.copyValue;
2835
- navigator.clipboard.writeText(e).then(() => {
2836
- x(!0), setTimeout(() => x(!1), 2e3), h?.(l, {
2837
- action_type: "copy",
2838
- copy_value: e
2839
- });
2518
+ });
2519
+ //#endregion
2520
+ //#region ../../node_modules/.pnpm/@tiptap+html@3.30.0_@tiptap+core@3.30.0_@tiptap+pm@3.30.0__@tiptap+pm@3.30.0_happy-dom@20.9.0/node_modules/@tiptap/html/dist/index.js
2521
+ function pe(e, t, n) {
2522
+ if (typeof window > "u") throw Error("generateJSON can only be used in a browser environment\nIf you want to use this in a Node environment, use the `@tiptap/html/server` import instead.");
2523
+ let r = s(t), i = new window.DOMParser().parseFromString(e, "text/html");
2524
+ if (!i) throw Error("Failed to parse HTML string");
2525
+ return ie.fromSchema(r).parse(i.body, n).toJSON();
2526
+ }
2527
+ //#endregion
2528
+ //#region ../../node_modules/.pnpm/@tiptap+static-renderer@3.30.0_@tiptap+core@3.30.0_@tiptap+pm@3.30.0__@tiptap+pm@3.30.0_32db194579d7d1b9da503a9162bec3c3/node_modules/@tiptap/static-renderer/dist/pm/react/index.js
2529
+ function me(e, t, n) {
2530
+ let r = e.attrs;
2531
+ return r ? t.filter((t) => t.type === (typeof e.type == "string" ? e.type : e.type.name) ? n ? t.attribute.rendered : !0 : !1).map((e) => e.attribute.renderHTML && e.attribute.renderHTML(r) || { [e.name]: e.name in r ? r[e.name] : e.attribute.default }).reduce((e, t) => f(e, t), {}) : {};
2532
+ }
2533
+ function H(e, t) {
2534
+ return me(e, t, !0);
2535
+ }
2536
+ function he(e, t) {
2537
+ return t?.textDirection ? [i.TextDirection.configure({ direction: t.textDirection }), ...e] : e;
2538
+ }
2539
+ function ge(e, t, n, r) {
2540
+ let i = o(t, "renderHTML", {
2541
+ name: t.name,
2542
+ options: t.options,
2543
+ storage: t.storage,
2544
+ parent: t.parent
2545
+ });
2546
+ return i ? [t.name, ({ node: r, children: a }) => {
2547
+ try {
2548
+ return e(i({
2549
+ node: r,
2550
+ HTMLAttributes: H(r, n)
2551
+ }))(a);
2552
+ } catch (e) {
2553
+ throw Error(`[tiptap error]: Node ${t.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`, { cause: e });
2554
+ }
2555
+ }] : r?.unhandledNode ? [t.name, r.unhandledNode] : [t.name, () => {
2556
+ throw Error(`[tiptap error]: Node ${t.name} cannot be rendered, it is missing a "renderToHTML" method, please implement it or override the corresponding "nodeMapping" method to have a custom rendering`);
2557
+ }];
2558
+ }
2559
+ function _e(e, t, n, r) {
2560
+ let i = o(t, "renderHTML", {
2561
+ name: t.name,
2562
+ options: t.options,
2563
+ storage: t.storage,
2564
+ parent: t.parent
2565
+ });
2566
+ return i ? [t.name, ({ mark: r, children: a }) => {
2567
+ try {
2568
+ return e(i({
2569
+ mark: r,
2570
+ HTMLAttributes: H(r, n)
2571
+ }))(a);
2572
+ } catch (e) {
2573
+ throw Error(`[tiptap error]: Mark ${t.name} cannot be rendered, it's "renderToHTML" method threw an error: ${e.message}`, { cause: e });
2574
+ }
2575
+ }] : r?.unhandledMark ? [t.name, r.unhandledMark] : [t.name, () => {
2576
+ throw Error(`Node ${t.name} cannot be rendered, it is missing a "renderToHTML" method`);
2577
+ }];
2578
+ }
2579
+ var U = "__tiptapUnhandledNode__", W = "__tiptapUnhandledMark__", G = "__originalType", K = "__originalAttrs", q = {
2580
+ [G]: { default: "" },
2581
+ [K]: { default: {} }
2582
+ };
2583
+ function ve(e, t) {
2584
+ let n = !1, r = (e) => {
2585
+ var i, a;
2586
+ n || (e.type && !(e.type in t.nodes) && (n = !0), (i = e.marks) == null || i.forEach((e) => {
2587
+ e.type && !(e.type in t.marks) && (n = !0);
2588
+ }), (a = e.content) == null || a.forEach(r));
2589
+ };
2590
+ return r(e), n;
2591
+ }
2592
+ function ye(e, t, n) {
2593
+ let r = !!n?.unhandledNode, i = !!n?.unhandledMark, a = (e) => i && !(e.type in t.marks) ? {
2594
+ type: W,
2595
+ attrs: {
2596
+ [G]: e.type,
2597
+ [K]: e.attrs ?? {}
2598
+ }
2599
+ } : e, o = (e) => r && e.type != null && !(e.type in t.nodes), s = (e, t) => ({
2600
+ ...t,
2601
+ type: U,
2602
+ attrs: {
2603
+ [G]: e.type,
2604
+ [K]: e.attrs ?? {}
2605
+ }
2606
+ }), c = (e) => {
2607
+ let t = {
2608
+ ...e,
2609
+ marks: e.marks?.map(a),
2610
+ content: e.content?.map(c)
2611
+ };
2612
+ return o(e) ? s(e, t) : t;
2613
+ };
2614
+ return c(e);
2615
+ }
2616
+ function be(e) {
2617
+ return new ae({
2618
+ topNode: e.spec.topNode,
2619
+ nodes: e.spec.nodes.addToEnd(U, { attrs: q }),
2620
+ marks: e.spec.marks.addToEnd(W, { attrs: q })
2621
+ });
2622
+ }
2623
+ function xe(e, t, n) {
2624
+ if (e instanceof _) return e;
2625
+ let r = c(t);
2626
+ return ve(e, r) ? _.fromJSON(be(r), ye(e, r, n)) : _.fromJSON(r, e);
2627
+ }
2628
+ function J(e) {
2629
+ return e.type === U || e.type === W ? {
2630
+ ...e,
2631
+ type: e.attrs[G],
2632
+ attrs: e.attrs[K]
2633
+ } : e;
2634
+ }
2635
+ function Y(e) {
2636
+ let t = J(e);
2637
+ return {
2638
+ ...t,
2639
+ marks: t.marks?.map((e) => J(e)),
2640
+ content: t.content?.map(Y)
2641
+ };
2642
+ }
2643
+ function X(e) {
2644
+ let t = Object.assign(/* @__PURE__ */ Object.create(null), {
2645
+ type: { name: e.attrs[G] },
2646
+ attrs: e.attrs[K],
2647
+ toJSON: () => Y(e.toJSON())
2648
+ });
2649
+ return new Proxy(e, { get(e, n) {
2650
+ let r = t[n];
2651
+ if (r !== void 0) return r;
2652
+ let i = e[n];
2653
+ return typeof i == "function" ? i.bind(e) : i;
2654
+ } });
2655
+ }
2656
+ function Se(e) {
2657
+ return (t) => e({
2658
+ ...t,
2659
+ node: X(t.node)
2660
+ });
2661
+ }
2662
+ function Ce(e) {
2663
+ return (t) => e({
2664
+ ...t,
2665
+ mark: X(t.mark)
2666
+ });
2667
+ }
2668
+ function we({ renderer: e, domOutputSpecToElement: t, mapDefinedTypes: n, content: r, extensions: i, options: o }) {
2669
+ i = ee(i);
2670
+ let s = a(i), { nodeExtensions: c, markExtensions: l } = te(i), { unhandledNode: u, unhandledMark: d, nodeMapping: f, markMapping: p } = o ?? {};
2671
+ return r = xe(r, i, o), e({
2672
+ ...o,
2673
+ nodeMapping: {
2674
+ ...Object.fromEntries(c.filter((e) => e.name in n ? !1 : f ? !(e.name in f) : !0).map((e) => ge(t, e, s, o))),
2675
+ ...n,
2676
+ ...f,
2677
+ ...u ? { [U]: Se(u) } : {}
2678
+ },
2679
+ markMapping: {
2680
+ ...Object.fromEntries(l.filter((e) => p ? !(e.name in p) : !0).map((e) => _e(t, e, s, o))),
2681
+ ...p,
2682
+ ...d ? { [W]: Ce(d) } : {}
2683
+ }
2684
+ })({ content: r });
2685
+ }
2686
+ function Te(e, { nodeMapping: t, markMapping: n, unhandledNode: r, unhandledMark: i }) {
2687
+ return function a({ content: o, parent: s }) {
2688
+ let c = typeof o.type == "string" ? o.type : o.type?.name ?? "", l = t[c] ?? r;
2689
+ if (!l) throw Error(`missing handler for node type ${c}`);
2690
+ let u = e({
2691
+ component: l,
2692
+ props: {
2693
+ node: o,
2694
+ parent: s,
2695
+ renderElement: a,
2696
+ get children() {
2697
+ let e = [];
2698
+ return o.content && o.content.forEach((t) => {
2699
+ e.push(a({
2700
+ content: t,
2701
+ parent: o
2702
+ }));
2703
+ }), e;
2704
+ }
2705
+ }
2840
2706
  });
2841
- }, o[0] = y.action, o[1] = h, o[2] = l, o[3] = S) : S = o[3];
2842
- let C = S, w = y.align ?? "left", T = y.size ?? "medium", E;
2843
- o[4] === T ? E = o[5] : (E = f({ size: T }), o[4] = T, o[5] = E);
2844
- let D;
2845
- o[6] === s ? D = o[7] : (D = s ? { pointerEvents: "none" } : void 0, o[6] = s, o[7] = D);
2846
- let O;
2847
- o[8] !== w || o[9] !== y.description || o[10] !== y.heading ? (O = (y.heading || y.description) && /* @__PURE__ */ v(i, {
2848
- className: "zv6sjd4",
2849
- style: { textAlign: w },
2850
- children: [y.heading && /* @__PURE__ */ _(n, { children: y.heading }), y.description && /* @__PURE__ */ _(r, { children: y.description })]
2851
- }), o[8] = w, o[9] = y.description, o[10] = y.heading, o[11] = O) : O = o[11];
2852
- let k;
2853
- o[12] === y.body ? k = o[13] : (k = (y.body?.html || y.body?.json) && /* @__PURE__ */ _(ut, {
2854
- className: "zv6sjd5",
2855
- style: pt,
2856
- content: y.body
2857
- }), o[12] = y.body, o[13] = k);
2858
- let A;
2859
- o[14] !== w || o[15] !== p || o[16] !== y.action || o[17] !== h || o[18] !== l || o[19] !== m ? (A = y.action?.type === "form" && p && /* @__PURE__ */ _("div", {
2860
- className: "zv6sjd7",
2861
- children: /* @__PURE__ */ _(ne, { children: /* @__PURE__ */ _(t, {
2862
- client: p,
2863
- children: /* @__PURE__ */ _(ft, {
2864
- collection_id: y.action.collectionKey,
2865
- formVariant: y.action.formVariant,
2866
- theme: mt,
2867
- uiConfig: {
2868
- hideFormHeading: !0,
2869
- hideSectionHeadings: !0
2870
- },
2871
- successConfig: y.action.successRedirectUrl ? { action: {
2872
- type: "redirect",
2873
- value: y.action.successRedirectUrl
2874
- } } : void 0,
2875
- submitButtonConfig: {
2876
- show: !0,
2877
- text: y.action.label || "Submit",
2878
- styles: y.action.fullWidth && (y.action.formVariant ?? "default") === "default" ? "zv6sjdb" : ht[w]
2879
- },
2880
- workspace_id: p.workspace,
2881
- containerStyles: "zv6sjd6",
2882
- preview: m,
2883
- onSuccess: () => {
2884
- y.action?.type === "form" && h?.(l, {
2885
- action_type: "form_submit",
2886
- collection_key: y.action.collectionKey
2887
- });
2707
+ return o.marks ? o.marks.reduce((t, r) => {
2708
+ let a = typeof r.type == "string" ? r.type : r.type.name, c = n[a] ?? i;
2709
+ if (!c) throw Error(`missing handler for mark type ${a}`);
2710
+ return e({
2711
+ component: c,
2712
+ props: {
2713
+ mark: r,
2714
+ parent: s,
2715
+ node: o,
2716
+ children: t
2888
2717
  }
2889
- })
2890
- }) })
2891
- }), o[14] = w, o[15] = p, o[16] = y.action, o[17] = h, o[18] = l, o[19] = m, o[20] = A) : A = o[20];
2892
- let j;
2893
- o[21] !== y.action || o[22] !== b || o[23] !== C || o[24] !== g ? (j = y.action?.type === "redirect" && /* @__PURE__ */ v(te, { children: [y.action.copyValue && /* @__PURE__ */ v("button", {
2894
- type: "button",
2895
- className: "zv6sjdd",
2896
- onClick: C,
2897
- children: [/* @__PURE__ */ _("span", {
2898
- className: "zv6sjde",
2899
- children: y.action.copyValue
2900
- }), _(b ? ie : ae, {
2901
- size: 18,
2902
- className: "zv6sjdf"
2903
- })]
2904
- }), /* @__PURE__ */ _(e, {
2905
- className: "zv6sjdc",
2906
- onClick: () => g?.(),
2907
- children: y.action.label || "Button"
2908
- })] }), o[21] = y.action, o[22] = b, o[23] = C, o[24] = g, o[25] = j) : j = o[25];
2909
- let M;
2910
- return o[26] !== E || o[27] !== D || o[28] !== O || o[29] !== k || o[30] !== A || o[31] !== j ? (M = /* @__PURE__ */ v("div", {
2911
- className: E,
2912
- style: D,
2913
- children: [
2914
- O,
2915
- k,
2916
- A,
2917
- j
2918
- ]
2919
- }), o[26] = E, o[27] = D, o[28] = O, o[29] = k, o[30] = A, o[31] = j, o[32] = M) : M = o[32], M;
2718
+ });
2719
+ }, u) : u;
2720
+ };
2721
+ }
2722
+ function Z(t) {
2723
+ let n = 0;
2724
+ return Te(({ component: t, props: { children: r, ...i } }) => e.createElement(t, Object.assign(i, { key: n++ }), [].concat(r)), t);
2725
+ }
2726
+ var Ee = {
2727
+ colspan: "colSpan",
2728
+ rowspan: "rowSpan"
2920
2729
  };
2730
+ function Q(e, t) {
2731
+ return e ? Object.entries(e).reduce((e, [t, n]) => {
2732
+ if (t === "class") return Object.assign(e, { className: n });
2733
+ if (t === "style" && typeof n == "string") {
2734
+ let t = {};
2735
+ return n.split(";").forEach((e) => {
2736
+ let [n, r] = e.split(":");
2737
+ if (n && r) {
2738
+ let e = n.trim().replace(/-([a-z])/g, (e) => e[1].toUpperCase());
2739
+ t[e] = r.trim();
2740
+ }
2741
+ }), Object.assign(e, { style: t });
2742
+ }
2743
+ let r = Ee[t] ?? t;
2744
+ return Object.assign(e, { [r]: n });
2745
+ }, { key: t }) : { key: t };
2746
+ }
2747
+ function $(t, n = 0) {
2748
+ if (typeof t == "string") return () => t;
2749
+ if (typeof t == "object" && "length" in t) {
2750
+ let [r, i, a, ...o] = t, s = r.split(" ");
2751
+ if (s.length > 1 && (r = s[1], i === void 0 && (i = { xmlns: s[0] }), i === 0 && (i = { xmlns: s[0] }, a = 0), typeof i == "object" && (i = Object.assign(i, { xmlns: s[0] }))), i === void 0) return () => e.createElement(r, Q(void 0, n.toString()));
2752
+ if (i === 0) return (t) => e.createElement(r, Q(void 0, n.toString()), t);
2753
+ if (typeof i == "object") return Array.isArray(i) ? a === void 0 || a === 0 ? (t) => e.createElement(r, Q(void 0, n.toString()), $(i, n++)(t)) : (t) => e.createElement(r, Q(void 0, n.toString()), $(i)(t), [a].concat(o).map((e) => $(e, n++)(t))) : a === void 0 ? () => e.createElement(r, Q(i, n.toString())) : a === 0 ? (t) => e.createElement(r, Q(i, n.toString()), t) : (t) => e.createElement(r, Q(i, n.toString()), [a].concat(o).map((e) => $(e, n++)(t)));
2754
+ }
2755
+ throw Error("[tiptap error]: Unsupported DomOutputSpec type, check the `renderHTML` method output or implement a node mapping", { cause: t });
2756
+ }
2757
+ function De({ content: t, extensions: n, staticEditorOptions: r, options: i }) {
2758
+ return we({
2759
+ renderer: Z,
2760
+ domOutputSpecToElement: $,
2761
+ mapDefinedTypes: {
2762
+ doc: ({ children: t }) => e.createElement(e.Fragment, {}, t),
2763
+ text: ({ node: e }) => e.text ?? ""
2764
+ },
2765
+ content: t,
2766
+ extensions: he(n, r),
2767
+ options: i
2768
+ });
2769
+ }
2921
2770
  //#endregion
2922
- export { dt as n };
2771
+ export { ue as _, B as a, ne as c, E as d, T as f, x as g, h, V as i, P as l, w as m, pe as n, L as o, m as p, fe as r, re as s, De as t, k as u, le as v };