@templatical/editor 0.10.4 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/{AiChatSidebar-Djjqrmoh.js → AiChatSidebar-Cm5RM5Qh.js} +8 -8
  2. package/dist/{AiFeatureMenu-DR56EYbL.js → AiFeatureMenu-DBWcfcWl.js} +6 -6
  3. package/dist/{BlockIssueBadge-ySMhwDRR.js → BlockIssueBadge-BF4sdsr4.js} +4 -4
  4. package/dist/{CloudEditor-BLlRKq5D.js → CloudEditor-C6cSXtcP.js} +162 -160
  5. package/dist/{CollaboratorBar-BlXmZrIj.js → CollaboratorBar-B8-AQfG2.js} +3 -3
  6. package/dist/{CommentsSidebar-XcYtqAn8.js → CommentsSidebar-BQJzyCc6.js} +11 -11
  7. package/dist/{CountdownBlock-sAAv3BHE.js → CountdownBlock-D_AsF4F3.js} +1 -1
  8. package/dist/{CountdownToolbar-CUvqPILZ.js → CountdownToolbar-BGTkFky9.js} +2 -2
  9. package/dist/{DesignReferenceSidebar-B0Upq2MY.js → DesignReferenceSidebar-O3epZMXD.js} +6 -6
  10. package/dist/{IssuesPanel-BvcqQ0ec.js → IssuesPanel-CPBbR8yp.js} +7 -7
  11. package/dist/{ModuleBrowserModal-BdOB1Lbt.js → ModuleBrowserModal-B_tLzFAk.js} +9 -9
  12. package/dist/{ModulePreviewCanvas-BeglLfBF.js → ModulePreviewCanvas-B7pNpAHM.js} +2 -2
  13. package/dist/{NumberWithSuffix-Cb7HI_yW.js → NumberWithSuffix-eI9pPDWT.js} +1 -1
  14. package/dist/{ParagraphEditor-4Wrd3nnB.js → ParagraphEditor-DmA9K7dx.js} +27 -27
  15. package/dist/{RichTextEditorContent-D-uKzBDa.js → RichTextEditorContent-Dvn4woIt.js} +6 -6
  16. package/dist/{SaveModuleDialog-ueFhCVWN.js → SaveModuleDialog-B8ypoxdj.js} +6 -6
  17. package/dist/{SnapshotHistory-DNuw_gCY.js → SnapshotHistory-BTHd7CVP.js} +7 -7
  18. package/dist/{TemplateScoringPanel-bkIhEokb.js → TemplateScoringPanel-Bt5Rsgen.js} +12 -12
  19. package/dist/{TestEmailModal-Tg30-itu.js → TestEmailModal-CBIFMzK6.js} +4 -4
  20. package/dist/{TitleEditor-CY8QWbEw.js → TitleEditor-C9jDA5lI.js} +12 -12
  21. package/dist/{TplModal-D338Vv9U.js → TplModal-ND4fiqOS.js} +3 -3
  22. package/dist/{blockTypeIcons-CYoPwoH9.js → blockTypeIcons-Bn-_Smlm.js} +5 -5
  23. package/dist/bundle-stats.json +6 -6
  24. package/dist/cdn/chunks/{AiFeatureMenu-DRWRoPdh.js → AiFeatureMenu-BuSO0dXP.js} +8 -8
  25. package/dist/cdn/chunks/{AiFeatureMenu-DRWRoPdh.js.map → AiFeatureMenu-BuSO0dXP.js.map} +1 -1
  26. package/dist/cdn/chunks/{BlockIssueBadge-D2ApLp61.js → BlockIssueBadge-sv3IZ1Pb.js} +4 -4
  27. package/dist/cdn/chunks/{BlockIssueBadge-D2ApLp61.js.map → BlockIssueBadge-sv3IZ1Pb.js.map} +1 -1
  28. package/dist/cdn/chunks/{CloudEditor-gvOOuXac.js → CloudEditor-hxoqsTsq.js} +242 -240
  29. package/dist/cdn/chunks/CloudEditor-hxoqsTsq.js.map +1 -0
  30. package/dist/cdn/chunks/{CollaboratorBar-BZK3R383.js → CollaboratorBar-DFqsaNX0.js} +3 -3
  31. package/dist/cdn/chunks/{CollaboratorBar-BZK3R383.js.map → CollaboratorBar-DFqsaNX0.js.map} +1 -1
  32. package/dist/cdn/chunks/{CountdownBlock-DU5YmjFP.js → CountdownBlock-PpH3fxAX.js} +2 -2
  33. package/dist/cdn/chunks/{CountdownBlock-DU5YmjFP.js.map → CountdownBlock-PpH3fxAX.js.map} +1 -1
  34. package/dist/cdn/chunks/{CountdownToolbar-C1nlFm4e.js → CountdownToolbar-CZN92Bhz.js} +3 -3
  35. package/dist/cdn/chunks/{CountdownToolbar-C1nlFm4e.js.map → CountdownToolbar-CZN92Bhz.js.map} +1 -1
  36. package/dist/cdn/chunks/{IssuesPanel-R3M60NTk.js → IssuesPanel-wQjrnuyc.js} +7 -7
  37. package/dist/cdn/chunks/{IssuesPanel-R3M60NTk.js.map → IssuesPanel-wQjrnuyc.js.map} +1 -1
  38. package/dist/cdn/chunks/{ModuleBrowserModal-DMithQu8.js → ModuleBrowserModal-348wCgft.js} +8 -8
  39. package/dist/cdn/chunks/{ModuleBrowserModal-DMithQu8.js.map → ModuleBrowserModal-348wCgft.js.map} +1 -1
  40. package/dist/cdn/chunks/{ModulePreviewCanvas-BNKbV_c2.js → ModulePreviewCanvas-Cf6DUHml.js} +22 -22
  41. package/dist/cdn/chunks/{ModulePreviewCanvas-BNKbV_c2.js.map → ModulePreviewCanvas-Cf6DUHml.js.map} +1 -1
  42. package/dist/cdn/chunks/{NumberWithSuffix-C5zNn3Oc.js → NumberWithSuffix-Deo8EOSz.js} +2 -2
  43. package/dist/cdn/chunks/{NumberWithSuffix-C5zNn3Oc.js.map → NumberWithSuffix-Deo8EOSz.js.map} +1 -1
  44. package/dist/cdn/chunks/{ParagraphEditor-H136qVNI.js → ParagraphEditor-Cbl_gBYM.js} +53 -53
  45. package/dist/cdn/chunks/{ParagraphEditor-H136qVNI.js.map → ParagraphEditor-Cbl_gBYM.js.map} +1 -1
  46. package/dist/cdn/chunks/{RichTextEditorContent-BxW6vSck.js → RichTextEditorContent-TBPzn3RC.js} +4 -4
  47. package/dist/cdn/chunks/{RichTextEditorContent-BxW6vSck.js.map → RichTextEditorContent-TBPzn3RC.js.map} +1 -1
  48. package/dist/cdn/chunks/{SaveModuleDialog-BaiynUWb.js → SaveModuleDialog-CxdYMutK.js} +4 -4
  49. package/dist/cdn/chunks/{SaveModuleDialog-BaiynUWb.js.map → SaveModuleDialog-CxdYMutK.js.map} +1 -1
  50. package/dist/cdn/chunks/{TitleEditor-BBsR46vE.js → TitleEditor--XulEf7R.js} +9 -9
  51. package/dist/cdn/chunks/{TitleEditor-BBsR46vE.js.map → TitleEditor--XulEf7R.js.map} +1 -1
  52. package/dist/cdn/chunks/{blockTypeIcons-CX05RINM.js → blockTypeIcons-BJND4L-A.js} +6 -6
  53. package/dist/cdn/chunks/{blockTypeIcons-CX05RINM.js.map → blockTypeIcons-BJND4L-A.js.map} +1 -1
  54. package/dist/{de-DIAGP7yH.js → cdn/chunks/de-BJMLpg_p.js} +6 -0
  55. package/dist/cdn/chunks/{de-DIAGP7yH.js.map → de-BJMLpg_p.js.map} +1 -1
  56. package/dist/{en-nqIW8Q9W.js → cdn/chunks/en-DFMMw7SL.js} +6 -0
  57. package/dist/cdn/chunks/{en-nqIW8Q9W.js.map → en-DFMMw7SL.js.map} +1 -1
  58. package/dist/cdn/chunks/{extensions-2LuW8PHB.js → extensions-BtWoLy6E.js} +28 -28
  59. package/dist/cdn/chunks/{extensions-2LuW8PHB.js.map → extensions-BtWoLy6E.js.map} +1 -1
  60. package/dist/cdn/chunks/{features-CxHQG9xr.js → features-mO5NzwnN.js} +657 -678
  61. package/dist/cdn/chunks/features-mO5NzwnN.js.map +1 -0
  62. package/dist/cdn/chunks/{icons-DrsFvnNP.js → icons-CuXm6XAT.js} +2 -2
  63. package/dist/cdn/chunks/{icons-DrsFvnNP.js.map → icons-CuXm6XAT.js.map} +1 -1
  64. package/dist/cdn/chunks/{media-library-CDXkfBa7.js → media-library-BtNzYUTi.js} +524 -524
  65. package/dist/cdn/chunks/{media-library-CDXkfBa7.js.map → media-library-BtNzYUTi.js.map} +1 -1
  66. package/dist/cdn/chunks/{pt-BR-DCNnLLx9.js → pt-BR-C-9aWLlR.js} +5 -1
  67. package/dist/cdn/chunks/{pt-BR-DCNnLLx9.js.map → pt-BR-C-9aWLlR.js.map} +1 -1
  68. package/dist/cdn/chunks/{quality-HR87TCZc.js → quality-YKe19zp8.js} +481 -481
  69. package/dist/cdn/chunks/{quality-HR87TCZc.js.map → quality-YKe19zp8.js.map} +1 -1
  70. package/dist/cdn/chunks/{renderer-Dh5WdraW.js → renderer-BcOaxCs6.js} +9 -9
  71. package/dist/cdn/chunks/{renderer-Dh5WdraW.js.map → renderer-BcOaxCs6.js.map} +1 -1
  72. package/dist/cdn/chunks/{src-fyYLC_tY.js → src-B_ZRmuit.js} +63 -63
  73. package/dist/cdn/chunks/{src-fyYLC_tY.js.map → src-B_ZRmuit.js.map} +1 -1
  74. package/dist/cdn/chunks/{styles-NhU45rEI.js → styles-DDBCCJ-l.js} +675 -626
  75. package/dist/cdn/chunks/styles-DDBCCJ-l.js.map +1 -0
  76. package/dist/cdn/chunks/{tiptap-CfnwT9a8.js → tiptap-BAwu9VcJ.js} +4454 -3328
  77. package/dist/cdn/chunks/tiptap-BAwu9VcJ.js.map +1 -0
  78. package/dist/cdn/editor.css +1 -1
  79. package/dist/cdn/editor.js +104 -102
  80. package/dist/cdn/editor.js.map +1 -1
  81. package/dist/{check-B4oiQEsJ.js → check-BsNM6BDs.js} +1 -1
  82. package/dist/{chevron-down-BrL7CDST.js → chevron-down-fcsZ5DU7.js} +1 -1
  83. package/dist/{circle-alert-Ddf06I0D.js → circle-alert-BZTbwc-B.js} +1 -1
  84. package/dist/{clock-CbIkIHL5.js → clock-B7iQRubC.js} +1 -1
  85. package/dist/{createLucideIcon-Bn5l6hkC.js → createLucideIcon-C_fetdGM.js} +2 -2
  86. package/dist/{cdn/chunks/de-DIAGP7yH.js → de-BJMLpg_p.js} +4 -2
  87. package/dist/{dist-BRvZBY6r.js → dist-B4NkMBYc.js} +2 -2
  88. package/dist/{dist-DDB4TfTY.js → dist-BLcYl_de.js} +2 -2
  89. package/dist/{dist-DS9NXb20.js → dist-BOHAk4zI.js} +2 -2
  90. package/dist/dist-BsB4nPJD.js +5 -0
  91. package/dist/{dist-B6B8IO1W.js → dist-ByBVNmRN.js} +2 -2
  92. package/dist/dist-CD3wbUoR.js +5 -0
  93. package/dist/{dist-DbGsZrPu.js → dist-Cwl7XXr4.js} +806 -601
  94. package/dist/{dist-BShwEwPy.js → dist-Dem8ODLh.js} +1512 -1501
  95. package/dist/{dist-BdIM5Jt8.js → dist-Dhs3W2WW.js} +2 -2
  96. package/dist/{dist-ZiEahccA.js → dist-XdF11ZkX.js} +2 -2
  97. package/dist/{dist-BhZo8-eC.js → dist-c2sj5PQ5.js} +2 -2
  98. package/dist/{dist-Ctv43HTN.js → dist-eVlXvuKI.js} +3 -3
  99. package/dist/{cdn/chunks/en-nqIW8Q9W.js → en-DFMMw7SL.js} +4 -2
  100. package/dist/extensions-B2lSGCA8.js +1720 -0
  101. package/dist/{image-up-D3KvvHLf.js → image-up-1xrPPJYH.js} +1 -1
  102. package/dist/index.d.ts +61 -0
  103. package/dist/{info-RwcI2EUD.js → info-ByAFxArD.js} +1 -1
  104. package/dist/keys-DsRdOmg3.js +10 -0
  105. package/dist/{list-checks-ruqK9lCo.js → list-checks-CKUP4UZU.js} +1 -1
  106. package/dist/{loader-circle-D4SXJ8eQ.js → loader-circle-BuxX338d.js} +1 -1
  107. package/dist/{message-circle-p9UiFyS7.js → message-circle-nLwqegRi.js} +1 -1
  108. package/dist/{pt-BR-DCNnLLx9.js → pt-BR-C-9aWLlR.js} +4 -0
  109. package/dist/{refresh-cw-C8HbO4hg.js → refresh-cw-DAkD6iDI.js} +1 -1
  110. package/dist/{scan-line-CmPIMm63.js → scan-line-DEELRJJ5.js} +1 -1
  111. package/dist/{send-DacXlri3.js → send-DCMgrNT4.js} +1 -1
  112. package/dist/{shield-check-BdrHnTnJ.js → shield-check-BFtVr_ov.js} +1 -1
  113. package/dist/{sparkles-tT7wcus5.js → sparkles-CeYIQ5RJ.js} +1 -1
  114. package/dist/style.css +1 -1
  115. package/dist/{styles-BmZWc8sc.js → styles-DZcQGzsN.js} +735 -686
  116. package/dist/templatical-editor.js +118 -116
  117. package/dist/{text-align-start-DaSSBZVi.js → text-align-start-BsmIoqLS.js} +1 -1
  118. package/dist/{trash-2-B0uIJOwX.js → trash-2-C2S4-CIH.js} +1 -1
  119. package/dist/{triangle-alert-FLQWRf-c.js → triangle-alert-DMdedF6W.js} +1 -1
  120. package/dist/{useCloudI18n-Lh0xWlQ4.js → useCloudI18n-BEuiZdzs.js} +1 -1
  121. package/dist/{useEditorCore-CMukR8kX.js → useEditorCore-D00QzW07.js} +742 -763
  122. package/dist/{useI18n-CNEz8RK7.js → useI18n-DNspT6uw.js} +1 -1
  123. package/dist/{useMergeTag-C54tabTK.js → useMergeTag-abutjUud.js} +1 -1
  124. package/dist/{usePopoverRoot-dvg2XFmj.js → usePopoverRoot-DG3mlvd1.js} +1 -1
  125. package/dist/{x-BROzFhGs.js → x-_9jw816B.js} +1 -1
  126. package/package.json +25 -25
  127. package/dist/cdn/chunks/CloudEditor-gvOOuXac.js.map +0 -1
  128. package/dist/cdn/chunks/features-CxHQG9xr.js.map +0 -1
  129. package/dist/cdn/chunks/styles-NhU45rEI.js.map +0 -1
  130. package/dist/cdn/chunks/tiptap-CfnwT9a8.js.map +0 -1
  131. package/dist/dist-BVKpiz3S.js +0 -5
  132. package/dist/dist-BzeOnbU8.js +0 -5
  133. package/dist/extensions-CqrSpX_i.js +0 -806
  134. package/dist/keys-DSm2p8zn.js +0 -10
@@ -0,0 +1,1720 @@
1
+ import { A as e, B as t, E as n, M as r, S as i, X as a, a as o, at as s, b as c, c as l, d as u, f as d, h as f, l as p, m, n as h, ot as g, p as _, rt as v, s as y, st as b, z as x } from "./vue.runtime.esm-bundler-mPytWZFh.js";
2
+ import { C as S, D as C, n as w, w as T } from "./dist-D6L_WdRL.js";
3
+ import { t as ee } from "./useI18n-DNspT6uw.js";
4
+ import { t as E } from "./useMergeTag-abutjUud.js";
5
+ import { F as D, Sn as O, i as k, o as A, p as j, qt as M, u as te, vn as ne, xn as re, yn as ie } from "./dist-Dem8ODLh.js";
6
+ import { n as ae, t as oe } from "./dist-c2sj5PQ5.js";
7
+ //#region src/extensions/FontSize.ts
8
+ var se = k.create({
9
+ name: "fontSize",
10
+ addOptions() {
11
+ return { types: ["textStyle"] };
12
+ },
13
+ addGlobalAttributes() {
14
+ return [{
15
+ types: this.options.types,
16
+ attributes: { fontSize: {
17
+ default: null,
18
+ parseHTML: (e) => e.style.fontSize?.replace(/['"]+/g, "") || null,
19
+ renderHTML: (e) => e.fontSize ? { style: `font-size: ${e.fontSize}` } : {}
20
+ } }
21
+ }];
22
+ },
23
+ addCommands() {
24
+ return {
25
+ setFontSize: (e) => ({ chain: t }) => t().setMark("textStyle", { fontSize: e }).run(),
26
+ unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
27
+ };
28
+ }
29
+ }), ce = k.create({
30
+ name: "letterSpacing",
31
+ addOptions() {
32
+ return { types: ["textStyle"] };
33
+ },
34
+ addGlobalAttributes() {
35
+ return [{
36
+ types: this.options.types,
37
+ attributes: { letterSpacing: {
38
+ default: null,
39
+ parseHTML: (e) => e.style.letterSpacing?.replace(/['"]+/g, "") || null,
40
+ renderHTML: (e) => e.letterSpacing ? { style: `letter-spacing: ${e.letterSpacing}` } : {}
41
+ } }
42
+ }];
43
+ },
44
+ addCommands() {
45
+ return {
46
+ setLetterSpacing: (e) => ({ chain: t }) => t().setMark("textStyle", { letterSpacing: e }).run(),
47
+ unsetLetterSpacing: () => ({ chain: e }) => e().setMark("textStyle", { letterSpacing: null }).removeEmptyTextStyle().run()
48
+ };
49
+ }
50
+ }), le = k.create({
51
+ name: "lineHeight",
52
+ addOptions() {
53
+ return {
54
+ types: ["paragraph"],
55
+ defaultLineHeight: "1.5"
56
+ };
57
+ },
58
+ addGlobalAttributes() {
59
+ return [{
60
+ types: this.options.types,
61
+ attributes: { lineHeight: {
62
+ default: null,
63
+ parseHTML: (e) => e.style.lineHeight || null,
64
+ renderHTML: (e) => e.lineHeight ? { style: `line-height: ${e.lineHeight}` } : {}
65
+ } }
66
+ }];
67
+ },
68
+ addCommands() {
69
+ return {
70
+ setLineHeight: (e) => ({ commands: t }) => this.options.types.every((n) => t.updateAttributes(n, { lineHeight: e })),
71
+ unsetLineHeight: () => ({ commands: e }) => this.options.types.every((t) => e.resetAttributes(t, "lineHeight"))
72
+ };
73
+ }
74
+ }), ue = [
75
+ "aria-label",
76
+ "data-tooltip",
77
+ "onKeydown"
78
+ ], de = ["aria-label", "onKeydown"], fe = ["aria-label"], pe = /* @__PURE__ */ c({
79
+ __name: "LogicMergeTagNodeView",
80
+ props: {
81
+ node: {},
82
+ editor: {},
83
+ getPos: { type: Function },
84
+ deleteNode: { type: Function },
85
+ updateAttributes: { type: Function }
86
+ },
87
+ setup(r) {
88
+ let i = r, { syntax: c } = E(), { t: p } = ee(), h = u(() => C(i.node.attrs.value, c)), w = u(() => S(i.node.attrs.value, c)), T = a(!1), D = a(""), O = a(null), k = !1;
89
+ function A() {
90
+ D.value = i.node.attrs.value, k = !1, T.value = !0, n(() => {
91
+ O.value?.focus(), O.value?.select();
92
+ });
93
+ }
94
+ function j() {
95
+ if (k) return;
96
+ k = !0;
97
+ let e = D.value.trim();
98
+ if (!e) {
99
+ T.value = !1;
100
+ return;
101
+ }
102
+ e !== i.node.attrs.value && i.updateAttributes({
103
+ value: e,
104
+ keyword: C(e, c) ? S(e, c) : ""
105
+ }), T.value = !1;
106
+ }
107
+ function M(e) {
108
+ e.key === "Enter" ? (e.preventDefault(), j()) : e.key === "Escape" && (T.value = !1);
109
+ }
110
+ return (n, i) => (e(), _(v(oe), {
111
+ as: "span",
112
+ class: s(h.value ? "tpl-logic-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.8em] tpl:font-bold tpl:tracking-wide tpl:uppercase tpl:select-none" : ""),
113
+ style: g(h.value ? "background-color: transparent; border: 1.5px solid color-mix(in srgb, var(--tpl-primary) 50%, transparent); color: var(--tpl-primary);" : ""),
114
+ contenteditable: "false"
115
+ }, {
116
+ default: x(() => [T.value ? t((e(), f("input", {
117
+ key: 0,
118
+ ref_key: "inputRef",
119
+ ref: O,
120
+ "onUpdate:modelValue": i[0] ||= (e) => D.value = e,
121
+ type: "text",
122
+ class: "tpl:w-40 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:normal-case tpl:outline-none tpl:text-[var(--tpl-primary)]",
123
+ onBlur: j,
124
+ onKeydown: M
125
+ }, null, 544)), [[o, D.value]]) : h.value ? (e(), f("span", {
126
+ key: 1,
127
+ role: "button",
128
+ tabindex: "0",
129
+ "aria-label": v(p).mergeTag.editValue,
130
+ class: "tpl-tooltip tpl:cursor-pointer",
131
+ "data-tooltip": r.node.attrs.value,
132
+ onClick: l(A, ["stop"]),
133
+ onKeydown: [y(l(A, ["stop"]), ["enter"]), y(l(A, ["prevent", "stop"]), ["space"])]
134
+ }, b(w.value), 41, ue)) : (e(), f("span", {
135
+ key: 2,
136
+ role: "button",
137
+ tabindex: "0",
138
+ "aria-label": v(p).mergeTag.editValue,
139
+ onClick: l(A, ["stop"]),
140
+ onKeydown: [y(l(A, ["stop"]), ["enter"]), y(l(A, ["prevent", "stop"]), ["space"])]
141
+ }, b(r.node.attrs.value), 41, de)), h.value ? (e(), f("button", {
142
+ key: 3,
143
+ type: "button",
144
+ "aria-label": v(p).mergeTag.deleteMergeTag,
145
+ class: "tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all hover:tpl:opacity-100 tpl:text-[var(--tpl-primary)]",
146
+ contenteditable: "false",
147
+ onClick: i[1] ||= l((...e) => r.deleteNode && r.deleteNode(...e), ["stop", "prevent"])
148
+ }, [...i[2] ||= [d("svg", {
149
+ width: "10",
150
+ height: "10",
151
+ viewBox: "0 0 24 24",
152
+ fill: "none",
153
+ stroke: "currentColor",
154
+ "stroke-width": "3",
155
+ "aria-hidden": "true"
156
+ }, [d("line", {
157
+ x1: "18",
158
+ y1: "6",
159
+ x2: "6",
160
+ y2: "18"
161
+ }), d("line", {
162
+ x1: "6",
163
+ y1: "6",
164
+ x2: "18",
165
+ y2: "18"
166
+ })], -1)]], 8, fe)) : m("", !0)]),
167
+ _: 1
168
+ }, 8, ["class", "style"]));
169
+ }
170
+ });
171
+ //#endregion
172
+ //#region src/extensions/isNodeSelected.ts
173
+ function N(e, t) {
174
+ let { $from: n, $to: r } = e.state.selection;
175
+ return n.pos === r.pos ? n.pos > 0 && n.nodeBefore?.type.name === t || n.nodeAfter?.type.name === t : !1;
176
+ }
177
+ //#endregion
178
+ //#region src/extensions/renderVueNodeView.ts
179
+ function me(e) {
180
+ return ae(e);
181
+ }
182
+ //#endregion
183
+ //#region src/extensions/LogicMergeTagNode.ts
184
+ var he = te.create({
185
+ name: "logicMergeTagNode",
186
+ group: "inline",
187
+ inline: !0,
188
+ atom: !0,
189
+ addOptions() {
190
+ return { syntax: w.liquid };
191
+ },
192
+ addAttributes() {
193
+ return {
194
+ value: {
195
+ default: "",
196
+ parseHTML: (e) => e.getAttribute("data-logic-merge-tag") || ""
197
+ },
198
+ keyword: {
199
+ default: "",
200
+ parseHTML: (e) => e.getAttribute("data-keyword") || e.textContent || ""
201
+ }
202
+ };
203
+ },
204
+ parseHTML() {
205
+ return [{ tag: "span[data-logic-merge-tag]" }];
206
+ },
207
+ renderHTML({ node: e, HTMLAttributes: t }) {
208
+ if (!C(e.attrs.value, this.options.syntax)) return [
209
+ "span",
210
+ {},
211
+ e.attrs.value
212
+ ];
213
+ let n = S(e.attrs.value, this.options.syntax);
214
+ return [
215
+ "span",
216
+ M(t, {
217
+ "data-logic-merge-tag": e.attrs.value,
218
+ "data-keyword": n
219
+ }),
220
+ n
221
+ ];
222
+ },
223
+ addNodeView() {
224
+ return me(pe);
225
+ },
226
+ addKeyboardShortcuts() {
227
+ return {
228
+ Backspace: () => N(this.editor, this.name),
229
+ Delete: () => N(this.editor, this.name)
230
+ };
231
+ },
232
+ addInputRules() {
233
+ return [new A({
234
+ find: RegExp(this.options.syntax.logic.source + "$", ""),
235
+ handler: ({ state: e, range: t, match: n }) => {
236
+ let r = n[0];
237
+ if (!C(r, this.options.syntax)) return;
238
+ let i = S(r, this.options.syntax), a = this.type.create({
239
+ value: r,
240
+ keyword: i
241
+ });
242
+ e.tr.replaceWith(t.from, t.to, a);
243
+ }
244
+ })];
245
+ },
246
+ addPasteRules() {
247
+ return [new j({
248
+ find: new RegExp(this.options.syntax.logic.source, "g"),
249
+ handler: ({ state: e, range: t, match: n }) => {
250
+ let r = n[0];
251
+ if (!C(r, this.options.syntax)) return;
252
+ let i = S(r, this.options.syntax), a = this.type.create({
253
+ value: r,
254
+ keyword: i
255
+ });
256
+ e.tr.replaceWith(t.from, t.to, a);
257
+ }
258
+ })];
259
+ }
260
+ }), ge = [
261
+ "aria-label",
262
+ "data-tooltip",
263
+ "onKeydown"
264
+ ], _e = ["aria-label"], ve = /* @__PURE__ */ c({
265
+ __name: "MergeTagNodeView",
266
+ props: {
267
+ node: {},
268
+ deleteNode: { type: Function },
269
+ updateAttributes: { type: Function }
270
+ },
271
+ setup(r) {
272
+ let i = r, { getMergeTagLabel: s } = E(), { t: c } = ee(), p = u(() => s(i.node.attrs.value)), m = a(!1), h = a(""), g = a(null);
273
+ function S() {
274
+ h.value = i.node.attrs.value, m.value = !0, n(() => {
275
+ g.value?.focus(), g.value?.select();
276
+ });
277
+ }
278
+ function C() {
279
+ let e = h.value.trim();
280
+ e && e !== i.node.attrs.value && i.updateAttributes({
281
+ value: e,
282
+ label: s(e)
283
+ }), m.value = !1;
284
+ }
285
+ function w(e) {
286
+ e.key === "Enter" ? (e.preventDefault(), C()) : e.key === "Escape" && (m.value = !1);
287
+ }
288
+ return (n, i) => (e(), _(v(oe), {
289
+ as: "span",
290
+ class: "tpl-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.9em] tpl:font-medium tpl:select-none tpl:text-[var(--tpl-primary)]",
291
+ style: { "background-color": "color-mix(in srgb, var(--tpl-primary) 20%, transparent)" },
292
+ contenteditable: "false"
293
+ }, {
294
+ default: x(() => [m.value ? t((e(), f("input", {
295
+ key: 0,
296
+ ref_key: "inputRef",
297
+ ref: g,
298
+ "onUpdate:modelValue": i[0] ||= (e) => h.value = e,
299
+ type: "text",
300
+ class: "tpl:w-32 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:outline-none tpl:text-[var(--tpl-primary)]",
301
+ onBlur: C,
302
+ onKeydown: w
303
+ }, null, 544)), [[o, h.value]]) : (e(), f("span", {
304
+ key: 1,
305
+ role: "button",
306
+ tabindex: "0",
307
+ "aria-label": v(c).mergeTag.editValue,
308
+ class: "tpl-tooltip tpl:cursor-pointer",
309
+ "data-tooltip": r.node.attrs.value,
310
+ onClick: l(S, ["stop"]),
311
+ onKeydown: [y(l(S, ["stop"]), ["enter"]), y(l(S, ["prevent", "stop"]), ["space"])]
312
+ }, b(p.value), 41, ge)), d("button", {
313
+ type: "button",
314
+ "aria-label": v(c).mergeTag.deleteMergeTag,
315
+ class: "tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all hover:tpl:opacity-100 tpl:text-[var(--tpl-primary)]",
316
+ contenteditable: "false",
317
+ onClick: i[1] ||= l((...e) => r.deleteNode && r.deleteNode(...e), ["stop", "prevent"])
318
+ }, [...i[2] ||= [d("svg", {
319
+ width: "10",
320
+ height: "10",
321
+ viewBox: "0 0 24 24",
322
+ fill: "none",
323
+ stroke: "currentColor",
324
+ "stroke-width": "3",
325
+ "aria-hidden": "true"
326
+ }, [d("line", {
327
+ x1: "18",
328
+ y1: "6",
329
+ x2: "6",
330
+ y2: "18"
331
+ }), d("line", {
332
+ x1: "6",
333
+ y1: "6",
334
+ x2: "18",
335
+ y2: "18"
336
+ })], -1)]], 8, _e)]),
337
+ _: 1
338
+ }));
339
+ }
340
+ }), ye = te.create({
341
+ name: "mergeTagNode",
342
+ group: "inline",
343
+ inline: !0,
344
+ atom: !0,
345
+ addOptions() {
346
+ return {
347
+ mergeTags: [],
348
+ syntax: w.liquid
349
+ };
350
+ },
351
+ addAttributes() {
352
+ return {
353
+ label: {
354
+ default: "",
355
+ parseHTML: (e) => e.getAttribute("data-label") || e.textContent || ""
356
+ },
357
+ value: {
358
+ default: "",
359
+ parseHTML: (e) => e.getAttribute("data-merge-tag") || ""
360
+ }
361
+ };
362
+ },
363
+ parseHTML() {
364
+ return [{ tag: "span[data-merge-tag]" }];
365
+ },
366
+ renderHTML({ node: e, HTMLAttributes: t }) {
367
+ let n = T(e.attrs.value, this.options.mergeTags);
368
+ return [
369
+ "span",
370
+ M(t, {
371
+ "data-merge-tag": e.attrs.value,
372
+ "data-label": n
373
+ }),
374
+ n
375
+ ];
376
+ },
377
+ addNodeView() {
378
+ return me(ve);
379
+ },
380
+ addCommands() {
381
+ return { insertMergeTag: (e) => ({ commands: t }) => t.insertContent({
382
+ type: this.name,
383
+ attrs: {
384
+ label: e.label,
385
+ value: e.value
386
+ }
387
+ }) };
388
+ },
389
+ addKeyboardShortcuts() {
390
+ return {
391
+ Backspace: () => N(this.editor, this.name),
392
+ Delete: () => N(this.editor, this.name)
393
+ };
394
+ },
395
+ addInputRules() {
396
+ return [new A({
397
+ find: RegExp(this.options.syntax.value.source + "$", ""),
398
+ handler: ({ state: e, range: t, match: n }) => {
399
+ let r = n[0], i = T(r, this.options.mergeTags), a = this.type.create({
400
+ label: i,
401
+ value: r
402
+ });
403
+ e.tr.replaceWith(t.from, t.to, a);
404
+ }
405
+ })];
406
+ },
407
+ addPasteRules() {
408
+ return [new j({
409
+ find: new RegExp(this.options.syntax.value.source, "g"),
410
+ handler: ({ state: e, range: t, match: n }) => {
411
+ let r = n[0], i = T(r, this.options.mergeTags), a = this.type.create({
412
+ label: i,
413
+ value: r
414
+ });
415
+ e.tr.replaceWith(t.from, t.to, a);
416
+ }
417
+ })];
418
+ }
419
+ }), be = Math.min, P = Math.max, F = Math.round, xe = Math.floor, I = (e) => ({
420
+ x: e,
421
+ y: e
422
+ }), Se = {
423
+ left: "right",
424
+ right: "left",
425
+ bottom: "top",
426
+ top: "bottom"
427
+ };
428
+ function Ce(e, t) {
429
+ return typeof e == "function" ? e(t) : e;
430
+ }
431
+ function L(e) {
432
+ return e.split("-")[0];
433
+ }
434
+ function R(e) {
435
+ return e.split("-")[1];
436
+ }
437
+ function we(e) {
438
+ return e === "x" ? "y" : "x";
439
+ }
440
+ function Te(e) {
441
+ return e === "y" ? "height" : "width";
442
+ }
443
+ function z(e) {
444
+ let t = e[0];
445
+ return t === "t" || t === "b" ? "y" : "x";
446
+ }
447
+ function Ee(e) {
448
+ return we(z(e));
449
+ }
450
+ function De(e, t, n) {
451
+ n === void 0 && (n = !1);
452
+ let r = R(e), i = Ee(e), a = Te(i), o = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
453
+ return t.reference[a] > t.floating[a] && (o = Ie(o)), [o, Ie(o)];
454
+ }
455
+ function Oe(e) {
456
+ let t = Ie(e);
457
+ return [
458
+ ke(e),
459
+ t,
460
+ ke(t)
461
+ ];
462
+ }
463
+ function ke(e) {
464
+ return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
465
+ }
466
+ var Ae = ["left", "right"], je = ["right", "left"], Me = ["top", "bottom"], Ne = ["bottom", "top"];
467
+ function Pe(e, t, n) {
468
+ switch (e) {
469
+ case "top":
470
+ case "bottom": return n ? t ? je : Ae : t ? Ae : je;
471
+ case "left":
472
+ case "right": return t ? Me : Ne;
473
+ default: return [];
474
+ }
475
+ }
476
+ function Fe(e, t, n, r) {
477
+ let i = R(e), a = Pe(L(e), n === "start", r);
478
+ return i && (a = a.map((e) => e + "-" + i), t && (a = a.concat(a.map(ke)))), a;
479
+ }
480
+ function Ie(e) {
481
+ let t = L(e);
482
+ return Se[t] + e.slice(t.length);
483
+ }
484
+ function Le(e) {
485
+ return {
486
+ top: 0,
487
+ right: 0,
488
+ bottom: 0,
489
+ left: 0,
490
+ ...e
491
+ };
492
+ }
493
+ function Re(e) {
494
+ return typeof e == "number" ? {
495
+ top: e,
496
+ right: e,
497
+ bottom: e,
498
+ left: e
499
+ } : Le(e);
500
+ }
501
+ function ze(e) {
502
+ let { x: t, y: n, width: r, height: i } = e;
503
+ return {
504
+ width: r,
505
+ height: i,
506
+ top: n,
507
+ left: t,
508
+ right: t + r,
509
+ bottom: n + i,
510
+ x: t,
511
+ y: n
512
+ };
513
+ }
514
+ //#endregion
515
+ //#region ../../node_modules/.pnpm/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
516
+ function Be(e, t, n) {
517
+ let { reference: r, floating: i } = e, a = z(t), o = Ee(t), s = Te(o), c = L(t), l = a === "y", u = r.x + r.width / 2 - i.width / 2, d = r.y + r.height / 2 - i.height / 2, f = r[s] / 2 - i[s] / 2, p;
518
+ switch (c) {
519
+ case "top":
520
+ p = {
521
+ x: u,
522
+ y: r.y - i.height
523
+ };
524
+ break;
525
+ case "bottom":
526
+ p = {
527
+ x: u,
528
+ y: r.y + r.height
529
+ };
530
+ break;
531
+ case "right":
532
+ p = {
533
+ x: r.x + r.width,
534
+ y: d
535
+ };
536
+ break;
537
+ case "left":
538
+ p = {
539
+ x: r.x - i.width,
540
+ y: d
541
+ };
542
+ break;
543
+ default: p = {
544
+ x: r.x,
545
+ y: r.y
546
+ };
547
+ }
548
+ switch (R(t)) {
549
+ case "start":
550
+ p[o] -= f * (n && l ? -1 : 1);
551
+ break;
552
+ case "end":
553
+ p[o] += f * (n && l ? -1 : 1);
554
+ break;
555
+ }
556
+ return p;
557
+ }
558
+ async function Ve(e, t) {
559
+ t === void 0 && (t = {});
560
+ let { x: n, y: r, platform: i, rects: a, elements: o, strategy: s } = e, { boundary: c = "clippingAncestors", rootBoundary: l = "viewport", elementContext: u = "floating", altBoundary: d = !1, padding: f = 0 } = Ce(t, e), p = Re(f), m = o[d ? u === "floating" ? "reference" : "floating" : u], h = ze(await i.getClippingRect({
561
+ element: await (i.isElement == null ? void 0 : i.isElement(m)) ?? !0 ? m : m.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(o.floating)),
562
+ boundary: c,
563
+ rootBoundary: l,
564
+ strategy: s
565
+ })), g = u === "floating" ? {
566
+ x: n,
567
+ y: r,
568
+ width: a.floating.width,
569
+ height: a.floating.height
570
+ } : a.reference, _ = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(o.floating)), v = await (i.isElement == null ? void 0 : i.isElement(_)) && await (i.getScale == null ? void 0 : i.getScale(_)) || {
571
+ x: 1,
572
+ y: 1
573
+ }, y = ze(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
574
+ elements: o,
575
+ rect: g,
576
+ offsetParent: _,
577
+ strategy: s
578
+ }) : g);
579
+ return {
580
+ top: (h.top - y.top + p.top) / v.y,
581
+ bottom: (y.bottom - h.bottom + p.bottom) / v.y,
582
+ left: (h.left - y.left + p.left) / v.x,
583
+ right: (y.right - h.right + p.right) / v.x
584
+ };
585
+ }
586
+ var He = 50, Ue = async (e, t, n) => {
587
+ let { placement: r = "bottom", strategy: i = "absolute", middleware: a = [], platform: o } = n, s = o.detectOverflow ? o : {
588
+ ...o,
589
+ detectOverflow: Ve
590
+ }, c = await (o.isRTL == null ? void 0 : o.isRTL(t)), l = await o.getElementRects({
591
+ reference: e,
592
+ floating: t,
593
+ strategy: i
594
+ }), { x: u, y: d } = Be(l, r, c), f = r, p = 0, m = {};
595
+ for (let n = 0; n < a.length; n++) {
596
+ let h = a[n];
597
+ if (!h) continue;
598
+ let { name: g, fn: _ } = h, { x: v, y, data: b, reset: x } = await _({
599
+ x: u,
600
+ y: d,
601
+ initialPlacement: r,
602
+ placement: f,
603
+ strategy: i,
604
+ middlewareData: m,
605
+ rects: l,
606
+ platform: s,
607
+ elements: {
608
+ reference: e,
609
+ floating: t
610
+ }
611
+ });
612
+ u = v ?? u, d = y ?? d, m[g] = {
613
+ ...m[g],
614
+ ...b
615
+ }, x && p < He && (p++, typeof x == "object" && (x.placement && (f = x.placement), x.rects && (l = x.rects === !0 ? await o.getElementRects({
616
+ reference: e,
617
+ floating: t,
618
+ strategy: i
619
+ }) : x.rects), {x: u, y: d} = Be(l, f, c)), n = -1);
620
+ }
621
+ return {
622
+ x: u,
623
+ y: d,
624
+ placement: f,
625
+ strategy: i,
626
+ middlewareData: m
627
+ };
628
+ }, We = function(e) {
629
+ return e === void 0 && (e = {}), {
630
+ name: "flip",
631
+ options: e,
632
+ async fn(t) {
633
+ var n;
634
+ let { placement: r, middlewareData: i, rects: a, initialPlacement: o, platform: s, elements: c } = t, { mainAxis: l = !0, crossAxis: u = !0, fallbackPlacements: d, fallbackStrategy: f = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: m = !0, ...h } = Ce(e, t);
635
+ if ((n = i.arrow) != null && n.alignmentOffset) return {};
636
+ let g = L(r), _ = z(o), v = L(o) === o, y = await (s.isRTL == null ? void 0 : s.isRTL(c.floating)), b = d || (v || !m ? [Ie(o)] : Oe(o)), x = p !== "none";
637
+ !d && x && b.push(...Fe(o, m, p, y));
638
+ let S = [o, ...b], C = await s.detectOverflow(t, h), w = [], T = i.flip?.overflows || [];
639
+ if (l && w.push(C[g]), u) {
640
+ let e = De(r, a, y);
641
+ w.push(C[e[0]], C[e[1]]);
642
+ }
643
+ if (T = [...T, {
644
+ placement: r,
645
+ overflows: w
646
+ }], !w.every((e) => e <= 0)) {
647
+ let e = (i.flip?.index || 0) + 1, t = S[e];
648
+ if (t && (!(u === "alignment" && _ !== z(t)) || T.every((e) => z(e.placement) === _ ? e.overflows[0] > 0 : !0))) return {
649
+ data: {
650
+ index: e,
651
+ overflows: T
652
+ },
653
+ reset: { placement: t }
654
+ };
655
+ let n = T.filter((e) => e.overflows[0] <= 0).sort((e, t) => e.overflows[1] - t.overflows[1])[0]?.placement;
656
+ if (!n) switch (f) {
657
+ case "bestFit": {
658
+ let e = T.filter((e) => {
659
+ if (x) {
660
+ let t = z(e.placement);
661
+ return t === _ || t === "y";
662
+ }
663
+ return !0;
664
+ }).map((e) => [e.placement, e.overflows.filter((e) => e > 0).reduce((e, t) => e + t, 0)]).sort((e, t) => e[1] - t[1])[0]?.[0];
665
+ e && (n = e);
666
+ break;
667
+ }
668
+ case "initialPlacement":
669
+ n = o;
670
+ break;
671
+ }
672
+ if (r !== n) return { reset: { placement: n } };
673
+ }
674
+ return {};
675
+ }
676
+ };
677
+ }, Ge = /*#__PURE__*/ new Set(["left", "top"]);
678
+ async function Ke(e, t) {
679
+ let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = L(n), s = R(n), c = z(n) === "y", l = Ge.has(o) ? -1 : 1, u = a && c ? -1 : 1, d = Ce(t, e), { mainAxis: f, crossAxis: p, alignmentAxis: m } = typeof d == "number" ? {
680
+ mainAxis: d,
681
+ crossAxis: 0,
682
+ alignmentAxis: null
683
+ } : {
684
+ mainAxis: d.mainAxis || 0,
685
+ crossAxis: d.crossAxis || 0,
686
+ alignmentAxis: d.alignmentAxis
687
+ };
688
+ return s && typeof m == "number" && (p = s === "end" ? m * -1 : m), c ? {
689
+ x: p * u,
690
+ y: f * l
691
+ } : {
692
+ x: f * l,
693
+ y: p * u
694
+ };
695
+ }
696
+ var qe = function(e) {
697
+ return e === void 0 && (e = 0), {
698
+ name: "offset",
699
+ options: e,
700
+ async fn(t) {
701
+ var n;
702
+ let { x: r, y: i, placement: a, middlewareData: o } = t, s = await Ke(t, e);
703
+ return a === o.offset?.placement && (n = o.arrow) != null && n.alignmentOffset ? {} : {
704
+ x: r + s.x,
705
+ y: i + s.y,
706
+ data: {
707
+ ...s,
708
+ placement: a
709
+ }
710
+ };
711
+ }
712
+ };
713
+ };
714
+ //#endregion
715
+ //#region ../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
716
+ function Je() {
717
+ return typeof window < "u";
718
+ }
719
+ function B(e) {
720
+ return Ye(e) ? (e.nodeName || "").toLowerCase() : "#document";
721
+ }
722
+ function V(e) {
723
+ var t;
724
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
725
+ }
726
+ function H(e) {
727
+ return ((Ye(e) ? e.ownerDocument : e.document) || window.document)?.documentElement;
728
+ }
729
+ function Ye(e) {
730
+ return Je() ? e instanceof Node || e instanceof V(e).Node : !1;
731
+ }
732
+ function U(e) {
733
+ return Je() ? e instanceof Element || e instanceof V(e).Element : !1;
734
+ }
735
+ function W(e) {
736
+ return Je() ? e instanceof HTMLElement || e instanceof V(e).HTMLElement : !1;
737
+ }
738
+ function Xe(e) {
739
+ return !Je() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof V(e).ShadowRoot;
740
+ }
741
+ function G(e) {
742
+ let { overflow: t, overflowX: n, overflowY: r, display: i } = Y(e);
743
+ return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && i !== "inline" && i !== "contents";
744
+ }
745
+ function Ze(e) {
746
+ return /^(table|td|th)$/.test(B(e));
747
+ }
748
+ function K(e) {
749
+ try {
750
+ if (e.matches(":popover-open")) return !0;
751
+ } catch {}
752
+ try {
753
+ return e.matches(":modal");
754
+ } catch {
755
+ return !1;
756
+ }
757
+ }
758
+ var Qe = /transform|translate|scale|rotate|perspective|filter/, $e = /paint|layout|strict|content/, q = (e) => !!e && e !== "none", et;
759
+ function tt(e) {
760
+ let t = U(e) ? Y(e) : e;
761
+ return q(t.transform) || q(t.translate) || q(t.scale) || q(t.rotate) || q(t.perspective) || !rt() && (q(t.backdropFilter) || q(t.filter)) || Qe.test(t.willChange || "") || $e.test(t.contain || "");
762
+ }
763
+ function nt(e) {
764
+ let t = X(e);
765
+ for (; W(t) && !J(t);) {
766
+ if (tt(t)) return t;
767
+ if (K(t)) return null;
768
+ t = X(t);
769
+ }
770
+ return null;
771
+ }
772
+ function rt() {
773
+ return et ??= typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"), et;
774
+ }
775
+ function J(e) {
776
+ return /^(html|body|#document)$/.test(B(e));
777
+ }
778
+ function Y(e) {
779
+ return V(e).getComputedStyle(e);
780
+ }
781
+ function it(e) {
782
+ return U(e) ? {
783
+ scrollLeft: e.scrollLeft,
784
+ scrollTop: e.scrollTop
785
+ } : {
786
+ scrollLeft: e.scrollX,
787
+ scrollTop: e.scrollY
788
+ };
789
+ }
790
+ function X(e) {
791
+ if (B(e) === "html") return e;
792
+ let t = e.assignedSlot || e.parentNode || Xe(e) && e.host || H(e);
793
+ return Xe(t) ? t.host : t;
794
+ }
795
+ function at(e) {
796
+ let t = X(e);
797
+ return J(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : W(t) && G(t) ? t : at(t);
798
+ }
799
+ function Z(e, t, n) {
800
+ t === void 0 && (t = []), n === void 0 && (n = !0);
801
+ let r = at(e), i = r === e.ownerDocument?.body, a = V(r);
802
+ if (i) {
803
+ let e = ot(a);
804
+ return t.concat(a, a.visualViewport || [], G(r) ? r : [], e && n ? Z(e) : []);
805
+ } else return t.concat(r, Z(r, [], n));
806
+ }
807
+ function ot(e) {
808
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
809
+ }
810
+ //#endregion
811
+ //#region ../../node_modules/.pnpm/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
812
+ function st(e) {
813
+ let t = Y(e), n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0, i = W(e), a = i ? e.offsetWidth : n, o = i ? e.offsetHeight : r, s = F(n) !== a || F(r) !== o;
814
+ return s && (n = a, r = o), {
815
+ width: n,
816
+ height: r,
817
+ $: s
818
+ };
819
+ }
820
+ function ct(e) {
821
+ return U(e) ? e : e.contextElement;
822
+ }
823
+ function Q(e) {
824
+ let t = ct(e);
825
+ if (!W(t)) return I(1);
826
+ let n = t.getBoundingClientRect(), { width: r, height: i, $: a } = st(t), o = (a ? F(n.width) : n.width) / r, s = (a ? F(n.height) : n.height) / i;
827
+ return (!o || !Number.isFinite(o)) && (o = 1), (!s || !Number.isFinite(s)) && (s = 1), {
828
+ x: o,
829
+ y: s
830
+ };
831
+ }
832
+ var lt = /*#__PURE__*/ I(0);
833
+ function ut(e) {
834
+ let t = V(e);
835
+ return !rt() || !t.visualViewport ? lt : {
836
+ x: t.visualViewport.offsetLeft,
837
+ y: t.visualViewport.offsetTop
838
+ };
839
+ }
840
+ function dt(e, t, n) {
841
+ return t === void 0 && (t = !1), !n || t && n !== V(e) ? !1 : t;
842
+ }
843
+ function $(e, t, n, r) {
844
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
845
+ let i = e.getBoundingClientRect(), a = ct(e), o = I(1);
846
+ t && (r ? U(r) && (o = Q(r)) : o = Q(e));
847
+ let s = dt(a, n, r) ? ut(a) : I(0), c = (i.left + s.x) / o.x, l = (i.top + s.y) / o.y, u = i.width / o.x, d = i.height / o.y;
848
+ if (a) {
849
+ let e = V(a), t = r && U(r) ? V(r) : r, n = e, i = ot(n);
850
+ for (; i && r && t !== n;) {
851
+ let e = Q(i), t = i.getBoundingClientRect(), r = Y(i), a = t.left + (i.clientLeft + parseFloat(r.paddingLeft)) * e.x, o = t.top + (i.clientTop + parseFloat(r.paddingTop)) * e.y;
852
+ c *= e.x, l *= e.y, u *= e.x, d *= e.y, c += a, l += o, n = V(i), i = ot(n);
853
+ }
854
+ }
855
+ return ze({
856
+ width: u,
857
+ height: d,
858
+ x: c,
859
+ y: l
860
+ });
861
+ }
862
+ function ft(e, t) {
863
+ let n = it(e).scrollLeft;
864
+ return t ? t.left + n : $(H(e)).left + n;
865
+ }
866
+ function pt(e, t) {
867
+ let n = e.getBoundingClientRect();
868
+ return {
869
+ x: n.left + t.scrollLeft - ft(e, n),
870
+ y: n.top + t.scrollTop
871
+ };
872
+ }
873
+ function mt(e) {
874
+ let { elements: t, rect: n, offsetParent: r, strategy: i } = e, a = i === "fixed", o = H(r), s = t ? K(t.floating) : !1;
875
+ if (r === o || s && a) return n;
876
+ let c = {
877
+ scrollLeft: 0,
878
+ scrollTop: 0
879
+ }, l = I(1), u = I(0), d = W(r);
880
+ if ((d || !d && !a) && ((B(r) !== "body" || G(o)) && (c = it(r)), d)) {
881
+ let e = $(r);
882
+ l = Q(r), u.x = e.x + r.clientLeft, u.y = e.y + r.clientTop;
883
+ }
884
+ let f = o && !d && !a ? pt(o, c) : I(0);
885
+ return {
886
+ width: n.width * l.x,
887
+ height: n.height * l.y,
888
+ x: n.x * l.x - c.scrollLeft * l.x + u.x + f.x,
889
+ y: n.y * l.y - c.scrollTop * l.y + u.y + f.y
890
+ };
891
+ }
892
+ function ht(e) {
893
+ return Array.from(e.getClientRects());
894
+ }
895
+ function gt(e) {
896
+ let t = H(e), n = it(e), r = e.ownerDocument.body, i = P(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), a = P(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight), o = -n.scrollLeft + ft(e), s = -n.scrollTop;
897
+ return Y(r).direction === "rtl" && (o += P(t.clientWidth, r.clientWidth) - i), {
898
+ width: i,
899
+ height: a,
900
+ x: o,
901
+ y: s
902
+ };
903
+ }
904
+ var _t = 25;
905
+ function vt(e, t) {
906
+ let n = V(e), r = H(e), i = n.visualViewport, a = r.clientWidth, o = r.clientHeight, s = 0, c = 0;
907
+ if (i) {
908
+ a = i.width, o = i.height;
909
+ let e = rt();
910
+ (!e || e && t === "fixed") && (s = i.offsetLeft, c = i.offsetTop);
911
+ }
912
+ let l = ft(r);
913
+ if (l <= 0) {
914
+ let e = r.ownerDocument, t = e.body, n = getComputedStyle(t), i = e.compatMode === "CSS1Compat" && parseFloat(n.marginLeft) + parseFloat(n.marginRight) || 0, o = Math.abs(r.clientWidth - t.clientWidth - i);
915
+ o <= _t && (a -= o);
916
+ } else l <= _t && (a += l);
917
+ return {
918
+ width: a,
919
+ height: o,
920
+ x: s,
921
+ y: c
922
+ };
923
+ }
924
+ function yt(e, t) {
925
+ let n = $(e, !0, t === "fixed"), r = n.top + e.clientTop, i = n.left + e.clientLeft, a = W(e) ? Q(e) : I(1);
926
+ return {
927
+ width: e.clientWidth * a.x,
928
+ height: e.clientHeight * a.y,
929
+ x: i * a.x,
930
+ y: r * a.y
931
+ };
932
+ }
933
+ function bt(e, t, n) {
934
+ let r;
935
+ if (t === "viewport") r = vt(e, n);
936
+ else if (t === "document") r = gt(H(e));
937
+ else if (U(t)) r = yt(t, n);
938
+ else {
939
+ let n = ut(e);
940
+ r = {
941
+ x: t.x - n.x,
942
+ y: t.y - n.y,
943
+ width: t.width,
944
+ height: t.height
945
+ };
946
+ }
947
+ return ze(r);
948
+ }
949
+ function xt(e, t) {
950
+ let n = X(e);
951
+ return n === t || !U(n) || J(n) ? !1 : Y(n).position === "fixed" || xt(n, t);
952
+ }
953
+ function St(e, t) {
954
+ let n = t.get(e);
955
+ if (n) return n;
956
+ let r = Z(e, [], !1).filter((e) => U(e) && B(e) !== "body"), i = null, a = Y(e).position === "fixed", o = a ? X(e) : e;
957
+ for (; U(o) && !J(o);) {
958
+ let t = Y(o), n = tt(o);
959
+ !n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && (i.position === "absolute" || i.position === "fixed") || G(o) && !n && xt(e, o)) ? r = r.filter((e) => e !== o) : i = t, o = X(o);
960
+ }
961
+ return t.set(e, r), r;
962
+ }
963
+ function Ct(e) {
964
+ let { element: t, boundary: n, rootBoundary: r, strategy: i } = e, a = [...n === "clippingAncestors" ? K(t) ? [] : St(t, this._c) : [].concat(n), r], o = bt(t, a[0], i), s = o.top, c = o.right, l = o.bottom, u = o.left;
965
+ for (let e = 1; e < a.length; e++) {
966
+ let n = bt(t, a[e], i);
967
+ s = P(n.top, s), c = be(n.right, c), l = be(n.bottom, l), u = P(n.left, u);
968
+ }
969
+ return {
970
+ width: c - u,
971
+ height: l - s,
972
+ x: u,
973
+ y: s
974
+ };
975
+ }
976
+ function wt(e) {
977
+ let { width: t, height: n } = st(e);
978
+ return {
979
+ width: t,
980
+ height: n
981
+ };
982
+ }
983
+ function Tt(e, t, n) {
984
+ let r = W(t), i = H(t), a = n === "fixed", o = $(e, !0, a, t), s = {
985
+ scrollLeft: 0,
986
+ scrollTop: 0
987
+ }, c = I(0);
988
+ function l() {
989
+ c.x = ft(i);
990
+ }
991
+ if (r || !r && !a) if ((B(t) !== "body" || G(i)) && (s = it(t)), r) {
992
+ let e = $(t, !0, a, t);
993
+ c.x = e.x + t.clientLeft, c.y = e.y + t.clientTop;
994
+ } else i && l();
995
+ a && !r && i && l();
996
+ let u = i && !r && !a ? pt(i, s) : I(0);
997
+ return {
998
+ x: o.left + s.scrollLeft - c.x - u.x,
999
+ y: o.top + s.scrollTop - c.y - u.y,
1000
+ width: o.width,
1001
+ height: o.height
1002
+ };
1003
+ }
1004
+ function Et(e) {
1005
+ return Y(e).position === "static";
1006
+ }
1007
+ function Dt(e, t) {
1008
+ if (!W(e) || Y(e).position === "fixed") return null;
1009
+ if (t) return t(e);
1010
+ let n = e.offsetParent;
1011
+ return H(e) === n && (n = n.ownerDocument.body), n;
1012
+ }
1013
+ function Ot(e, t) {
1014
+ let n = V(e);
1015
+ if (K(e)) return n;
1016
+ if (!W(e)) {
1017
+ let t = X(e);
1018
+ for (; t && !J(t);) {
1019
+ if (U(t) && !Et(t)) return t;
1020
+ t = X(t);
1021
+ }
1022
+ return n;
1023
+ }
1024
+ let r = Dt(e, t);
1025
+ for (; r && Ze(r) && Et(r);) r = Dt(r, t);
1026
+ return r && J(r) && Et(r) && !tt(r) ? n : r || nt(e) || n;
1027
+ }
1028
+ var kt = async function(e) {
1029
+ let t = this.getOffsetParent || Ot, n = this.getDimensions, r = await n(e.floating);
1030
+ return {
1031
+ reference: Tt(e.reference, await t(e.floating), e.strategy),
1032
+ floating: {
1033
+ x: 0,
1034
+ y: 0,
1035
+ width: r.width,
1036
+ height: r.height
1037
+ }
1038
+ };
1039
+ };
1040
+ function At(e) {
1041
+ return Y(e).direction === "rtl";
1042
+ }
1043
+ var jt = {
1044
+ convertOffsetParentRelativeRectToViewportRelativeRect: mt,
1045
+ getDocumentElement: H,
1046
+ getClippingRect: Ct,
1047
+ getOffsetParent: Ot,
1048
+ getElementRects: kt,
1049
+ getClientRects: ht,
1050
+ getDimensions: wt,
1051
+ getScale: Q,
1052
+ isElement: U,
1053
+ isRTL: At
1054
+ };
1055
+ function Mt(e, t) {
1056
+ return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1057
+ }
1058
+ function Nt(e, t) {
1059
+ let n = null, r, i = H(e);
1060
+ function a() {
1061
+ var e;
1062
+ clearTimeout(r), (e = n) == null || e.disconnect(), n = null;
1063
+ }
1064
+ function o(s, c) {
1065
+ s === void 0 && (s = !1), c === void 0 && (c = 1), a();
1066
+ let l = e.getBoundingClientRect(), { left: u, top: d, width: f, height: p } = l;
1067
+ if (s || t(), !f || !p) return;
1068
+ let m = xe(d), h = xe(i.clientWidth - (u + f)), g = xe(i.clientHeight - (d + p)), _ = xe(u), v = {
1069
+ rootMargin: -m + "px " + -h + "px " + -g + "px " + -_ + "px",
1070
+ threshold: P(0, be(1, c)) || 1
1071
+ }, y = !0;
1072
+ function b(t) {
1073
+ let n = t[0].intersectionRatio;
1074
+ if (n !== c) {
1075
+ if (!y) return o();
1076
+ n ? o(!1, n) : r = setTimeout(() => {
1077
+ o(!1, 1e-7);
1078
+ }, 1e3);
1079
+ }
1080
+ n === 1 && !Mt(l, e.getBoundingClientRect()) && o(), y = !1;
1081
+ }
1082
+ try {
1083
+ n = new IntersectionObserver(b, {
1084
+ ...v,
1085
+ root: i.ownerDocument
1086
+ });
1087
+ } catch {
1088
+ n = new IntersectionObserver(b, v);
1089
+ }
1090
+ n.observe(e);
1091
+ }
1092
+ return o(!0), a;
1093
+ }
1094
+ function Pt(e, t, n, r) {
1095
+ r === void 0 && (r = {});
1096
+ let { ancestorScroll: i = !0, ancestorResize: a = !0, elementResize: o = typeof ResizeObserver == "function", layoutShift: s = typeof IntersectionObserver == "function", animationFrame: c = !1 } = r, l = ct(e), u = i || a ? [...l ? Z(l) : [], ...t ? Z(t) : []] : [];
1097
+ u.forEach((e) => {
1098
+ i && e.addEventListener("scroll", n, { passive: !0 }), a && e.addEventListener("resize", n);
1099
+ });
1100
+ let d = l && s ? Nt(l, n) : null, f = -1, p = null;
1101
+ o && (p = new ResizeObserver((e) => {
1102
+ let [r] = e;
1103
+ r && r.target === l && p && t && (p.unobserve(t), cancelAnimationFrame(f), f = requestAnimationFrame(() => {
1104
+ var e;
1105
+ (e = p) == null || e.observe(t);
1106
+ })), n();
1107
+ }), l && !c && p.observe(l), t && p.observe(t));
1108
+ let m, h = c ? $(e) : null;
1109
+ c && g();
1110
+ function g() {
1111
+ let t = $(e);
1112
+ h && !Mt(h, t) && n(), h = t, m = requestAnimationFrame(g);
1113
+ }
1114
+ return n(), () => {
1115
+ var e;
1116
+ u.forEach((e) => {
1117
+ i && e.removeEventListener("scroll", n), a && e.removeEventListener("resize", n);
1118
+ }), d?.(), (e = p) == null || e.disconnect(), p = null, c && cancelAnimationFrame(m);
1119
+ };
1120
+ }
1121
+ var Ft = qe, It = We, Lt = (e, t, n) => {
1122
+ let r = /* @__PURE__ */ new Map(), i = {
1123
+ platform: jt,
1124
+ ...n
1125
+ }, a = {
1126
+ ...i.platform,
1127
+ _c: r
1128
+ };
1129
+ return Ue(e, t, {
1130
+ ...i,
1131
+ platform: a
1132
+ });
1133
+ };
1134
+ //#endregion
1135
+ //#region ../../node_modules/.pnpm/@tiptap+suggestion@3.27.1_@floating-ui+dom@1.7.6_@tiptap+core@3.27.1_@tiptap+pm@3.27.1__@tiptap+pm@3.27.1/node_modules/@tiptap/suggestion/dist/index.js
1136
+ function Rt(e) {
1137
+ let { char: t, allowSpaces: n, allowToIncludeChar: r, allowedPrefixes: i, startOfLine: a, $position: o } = e, s = n && !r, c = D(t), l = RegExp(`\\s${c}$`), u = a ? "^" : "", d = r ? "" : c, f = RegExp(s ? `${u}${c}.*?(?=\\s${d}|$)` : `${u}(?:^)?${c}[^\\s${d}]*`, "gm"), p = o.nodeBefore?.isText && o.nodeBefore.text;
1138
+ if (!p) return null;
1139
+ let m = o.pos - p.length, h = Array.from(p.matchAll(f)).pop();
1140
+ if (!h || h.input === void 0 || h.index === void 0) return null;
1141
+ let g = h.input.slice(Math.max(0, h.index - 1), h.index), _ = RegExp(`^[${i?.join("")}\0]?$`).test(g);
1142
+ if (i !== null && !_) return null;
1143
+ let v = m + h.index, y = v + h[0].length;
1144
+ return s && l.test(p.slice(y - 1, y + 1)) && (h[0] += " ", y += 1), v < o.pos && y >= o.pos ? {
1145
+ range: {
1146
+ from: v,
1147
+ to: y
1148
+ },
1149
+ query: h[0].slice(t.length),
1150
+ text: h[0]
1151
+ } : null;
1152
+ }
1153
+ function zt(e) {
1154
+ return e.docChanged ? e.steps.some((e) => {
1155
+ let t = e.slice;
1156
+ if (!t?.content) return !1;
1157
+ let n = t.content.textBetween(0, t.content.size, "\n");
1158
+ return /\s/.test(n);
1159
+ }) : !1;
1160
+ }
1161
+ function Bt(e) {
1162
+ return () => {
1163
+ let t = e.state.selection.$anchor.pos, { top: n, right: r, bottom: i, left: a } = e.view.coordsAtPos(t);
1164
+ try {
1165
+ return new DOMRect(a, n, r - a, i - n);
1166
+ } catch {
1167
+ return null;
1168
+ }
1169
+ };
1170
+ }
1171
+ function Vt(e, t, n, r) {
1172
+ return n ? () => {
1173
+ let n = r.getState(e.state)?.decorationId;
1174
+ return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect() || null;
1175
+ } : Bt(e);
1176
+ }
1177
+ function Ht({ match: e, dismissedRange: t, state: n, transaction: r, editor: i, shouldResetDismissed: a, effectiveAllowSpaces: o }) {
1178
+ return a?.({
1179
+ editor: i,
1180
+ state: n,
1181
+ range: t,
1182
+ match: e,
1183
+ transaction: r,
1184
+ allowSpaces: o
1185
+ }) ? !1 : o ? e.range.from === t.from : e.range.from === t.from && !zt(r);
1186
+ }
1187
+ function Ut({ view: e, pluginKeyRef: t }) {
1188
+ let n = e.state.tr.setMeta(t, { exit: !0 });
1189
+ e.dispatch(n);
1190
+ }
1191
+ function Wt({ pluginKey: e, decorationTag: t, decorationClass: n, decorationContent: r, decorationEmptyClass: i, renderer: a, dispatchExit: o }) {
1192
+ return {
1193
+ handleKeyDown(t, n) {
1194
+ var r;
1195
+ let i = e.getState(t.state);
1196
+ return i.active ? n.key === "Escape" || n.key === "Esc" ? ((r = a?.onKeyDown) == null || r.call(a, {
1197
+ view: t,
1198
+ event: n,
1199
+ range: i.range
1200
+ }), o(t), !0) : (a?.onKeyDown)?.call(a, {
1201
+ view: t,
1202
+ event: n,
1203
+ range: i.range
1204
+ }) || !1 : !1;
1205
+ },
1206
+ decorations(a) {
1207
+ let { active: o, range: s, decorationId: c, query: l } = e.getState(a);
1208
+ if (!o) return null;
1209
+ let u = !l?.length, d = [n];
1210
+ return u && d.push(i), ie.create(a.doc, [ne.inline(s.from, s.to, {
1211
+ nodeName: t,
1212
+ class: d.join(" "),
1213
+ "data-decoration-id": c || void 0,
1214
+ "data-decoration-content": r
1215
+ })]);
1216
+ }
1217
+ };
1218
+ }
1219
+ function Gt({ editor: e, char: t, effectiveAllowSpaces: n, allowToIncludeChar: r, allowedPrefixes: i, startOfLine: a, findSuggestionMatch: o, allow: s, shouldShow: c, shouldKeepDismissed: l, pluginKey: u }) {
1220
+ return {
1221
+ init() {
1222
+ return {
1223
+ active: !1,
1224
+ range: {
1225
+ from: 0,
1226
+ to: 0
1227
+ },
1228
+ query: null,
1229
+ text: null,
1230
+ composing: !1,
1231
+ dismissedRange: null
1232
+ };
1233
+ },
1234
+ apply(d, f, p, m) {
1235
+ let { isEditable: h } = e, { composing: g } = e.view, { selection: _ } = d, { empty: v, from: y } = _, b = { ...f }, x = d.getMeta(u);
1236
+ if (x && x.exit) return b.active = !1, b.decorationId = null, b.range = {
1237
+ from: 0,
1238
+ to: 0
1239
+ }, b.query = null, b.text = null, b.dismissedRange = f.active ? { ...f.range } : f.dismissedRange, b;
1240
+ if (b.composing = g, d.docChanged && b.dismissedRange !== null && (b.dismissedRange = {
1241
+ from: d.mapping.map(b.dismissedRange.from),
1242
+ to: d.mapping.map(b.dismissedRange.to)
1243
+ }), h && (v || e.view.composing)) {
1244
+ (y < f.range.from || y > f.range.to) && !g && !f.composing && (b.active = !1);
1245
+ let u = o({
1246
+ char: t,
1247
+ allowSpaces: n,
1248
+ allowToIncludeChar: r,
1249
+ allowedPrefixes: i,
1250
+ startOfLine: a,
1251
+ $position: _.$from
1252
+ }), p = `id_${Math.floor(Math.random() * 4294967295)}`;
1253
+ u && s({
1254
+ editor: e,
1255
+ state: m,
1256
+ range: u.range,
1257
+ isActive: f.active
1258
+ }) && (!c || c({
1259
+ editor: e,
1260
+ range: u.range,
1261
+ query: u.query,
1262
+ text: u.text,
1263
+ transaction: d
1264
+ })) ? (b.dismissedRange !== null && !l({
1265
+ match: u,
1266
+ dismissedRange: b.dismissedRange,
1267
+ state: m,
1268
+ transaction: d
1269
+ }) && (b.dismissedRange = null), b.dismissedRange === null ? (b.active = !0, b.decorationId = f.decorationId || p, b.range = u.range, b.query = u.query, b.text = u.text) : b.active = !1) : (u || (b.dismissedRange = null), b.active = !1);
1270
+ } else b.active = !1;
1271
+ return b.active || (b.decorationId = null, b.range = {
1272
+ from: 0,
1273
+ to: 0
1274
+ }, b.query = null, b.text = null), b;
1275
+ }
1276
+ };
1277
+ }
1278
+ function Kt({ editor: e, items: t }) {
1279
+ let n = null, r = null, i = null, a = () => {
1280
+ r !== null && (clearTimeout(r), r = null), i?.(), i = null;
1281
+ }, o = (e) => new Promise((t) => {
1282
+ i = t, r = setTimeout(() => {
1283
+ r = null;
1284
+ let e = i;
1285
+ i = null, e?.();
1286
+ }, e);
1287
+ }), s = () => {
1288
+ n?.abort(), a(), n = null;
1289
+ };
1290
+ return {
1291
+ abort: s,
1292
+ fetch: async (r, i) => {
1293
+ s(), n = new AbortController();
1294
+ let a = n;
1295
+ if (i > 0 && await o(i), n !== a || a.signal.aborted) return { status: "aborted" };
1296
+ try {
1297
+ let i = await t({
1298
+ editor: e,
1299
+ query: r,
1300
+ signal: a.signal
1301
+ });
1302
+ return n !== a || a.signal.aborted ? { status: "aborted" } : {
1303
+ status: "resolved",
1304
+ items: i
1305
+ };
1306
+ } catch {
1307
+ return n !== a || a.signal.aborted ? { status: "aborted" } : { status: "error" };
1308
+ }
1309
+ }
1310
+ };
1311
+ }
1312
+ function qt({ placement: e, offset: t, flip: n, floatingUi: r }) {
1313
+ let i = [Ft({
1314
+ mainAxis: t.mainAxis ?? 4,
1315
+ crossAxis: t.crossAxis ?? 0
1316
+ })];
1317
+ return n && i.push(It()), r?.middleware?.length && i.push(...r.middleware), {
1318
+ placement: e,
1319
+ strategy: r?.strategy ?? "absolute",
1320
+ middleware: i
1321
+ };
1322
+ }
1323
+ function Jt(e) {
1324
+ if (e instanceof HTMLElement) return e;
1325
+ if (typeof e == "string") try {
1326
+ let t = document.querySelector(e);
1327
+ if (t) return t;
1328
+ } catch {
1329
+ return document.body;
1330
+ }
1331
+ return document.body;
1332
+ }
1333
+ function Yt({ getReferenceRect: e, contextElement: t, config: n, container: r, dismissOnOutsideClick: i, dismiss: a }) {
1334
+ return (o, s = {}) => {
1335
+ let c = {
1336
+ getBoundingClientRect: () => e() ?? new DOMRect(),
1337
+ contextElement: t
1338
+ }, l = !1, u = !o.isConnected;
1339
+ u && Jt(r).appendChild(o), s.onPosition || (o.style.visibility = "hidden", o.style.width = "max-content");
1340
+ let d = Pt(c, o, () => {
1341
+ Lt(c, o, {
1342
+ placement: n.placement,
1343
+ strategy: n.strategy,
1344
+ middleware: n.middleware
1345
+ }).then(({ x: e, y: t, placement: n, strategy: r }) => {
1346
+ if (s.onPosition) {
1347
+ s.onPosition({
1348
+ x: e,
1349
+ y: t,
1350
+ placement: n,
1351
+ strategy: r
1352
+ });
1353
+ return;
1354
+ }
1355
+ Object.assign(o.style, {
1356
+ position: r,
1357
+ left: `${e}px`,
1358
+ top: `${t}px`
1359
+ }), l || (l = !0, o.style.visibility = "");
1360
+ });
1361
+ }, s.autoUpdate), f;
1362
+ return i && (f = (e) => {
1363
+ let n = e.target;
1364
+ !(n instanceof Node) || o.contains(n) || t.contains(n) || a();
1365
+ }, document.addEventListener("pointerdown", f, !0)), () => {
1366
+ d(), f && document.removeEventListener("pointerdown", f, !0), u && o.remove();
1367
+ };
1368
+ };
1369
+ }
1370
+ function Xt({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i, debounce: a, initialItems: o, placement: s, offset: c, container: l, flip: u, floatingUi: d, dismissOnOutsideClick: f, command: p, clientRectFor: m, dispatchExit: h }) {
1371
+ let g, _ = Kt({
1372
+ editor: e,
1373
+ items: n
1374
+ }), v = qt({
1375
+ placement: s,
1376
+ offset: c,
1377
+ flip: u,
1378
+ floatingUi: d
1379
+ });
1380
+ function y(e, t) {
1381
+ var n, i, a;
1382
+ switch (e) {
1383
+ case "started":
1384
+ (n = r?.onStart) == null || n.call(r, t);
1385
+ break;
1386
+ case "updated":
1387
+ (i = r?.onUpdate) == null || i.call(r, t);
1388
+ break;
1389
+ case "stopped":
1390
+ (a = r?.onExit) == null || a.call(r, t);
1391
+ break;
1392
+ default: break;
1393
+ }
1394
+ }
1395
+ return {
1396
+ update: async (n, d) => {
1397
+ var b, x;
1398
+ let S = t.getState(d), C = t.getState(n.state);
1399
+ if (!S || !C) return;
1400
+ let w = null, T = S.query !== C.query, ee = S.text !== C.text, E = S.range.from !== C.range.from || S.range.to !== C.range.to, D = T || ee || E;
1401
+ if (!S.active && C.active) w = "started";
1402
+ else if (S.active && !C.active) w = "stopped";
1403
+ else if (C.active && D) w = "updated";
1404
+ else return;
1405
+ let O = w === "stopped" ? S : C, k = n.dom.querySelector(`[data-decoration-id="${O.decorationId}"]`), A = m(n, k), j = i === 0 || (O.query ? O.query.length >= i : !1), M = (w === "started" || w === "updated") && j;
1406
+ if (g = {
1407
+ editor: e,
1408
+ range: O.range,
1409
+ query: O.query || "",
1410
+ text: O.text || "",
1411
+ items: o ?? [],
1412
+ command: (t) => p({
1413
+ editor: e,
1414
+ range: O.range,
1415
+ props: t
1416
+ }),
1417
+ decorationNode: k,
1418
+ clientRect: A,
1419
+ loading: M,
1420
+ placement: s,
1421
+ offset: {
1422
+ mainAxis: c.mainAxis ?? 4,
1423
+ crossAxis: c.crossAxis ?? 0
1424
+ },
1425
+ container: l,
1426
+ flip: u,
1427
+ floatingUi: v,
1428
+ mount: Yt({
1429
+ getReferenceRect: A,
1430
+ contextElement: n.dom,
1431
+ config: v,
1432
+ container: l,
1433
+ dismissOnOutsideClick: f,
1434
+ dismiss: () => h(e.view)
1435
+ })
1436
+ }, w === "started" && ((b = r?.onBeforeStart) == null || b.call(r, g)), w === "updated" && ((x = r?.onBeforeUpdate) == null || x.call(r, g)), w === "started" && y(w, g), w === "started" || w === "updated") if (!M) _.abort(), g = {
1437
+ ...g,
1438
+ items: o ?? [],
1439
+ loading: !1
1440
+ };
1441
+ else {
1442
+ g = {
1443
+ ...g,
1444
+ items: o ?? [],
1445
+ loading: !0
1446
+ }, w = "updated", y(w, g);
1447
+ let e = await _.fetch(O.query || "", a);
1448
+ if (e.status === "aborted") return;
1449
+ if (!t.getState(n.state)?.active) {
1450
+ _.abort();
1451
+ return;
1452
+ }
1453
+ g = e.status === "resolved" ? {
1454
+ ...g,
1455
+ items: e.items,
1456
+ loading: !1
1457
+ } : {
1458
+ ...g,
1459
+ loading: !1
1460
+ };
1461
+ }
1462
+ if (w === "stopped") {
1463
+ _.abort(), y(w, g), g = void 0;
1464
+ return;
1465
+ }
1466
+ w === "updated" && y(w, g);
1467
+ },
1468
+ destroy: () => {
1469
+ var e;
1470
+ _.abort(), g && ((e = r?.onExit) == null || e.call(r, g));
1471
+ }
1472
+ };
1473
+ }
1474
+ var Zt = new O("suggestion");
1475
+ function Qt({ pluginKey: e = Zt, editor: t, char: n = "@", allowSpaces: r = !1, allowToIncludeChar: i = !1, allowedPrefixes: a = [" "], startOfLine: o = !1, decorationTag: s = "span", decorationClass: c = "suggestion", decorationContent: l = "", decorationEmptyClass: u = "is-empty", command: d = () => null, items: f = () => [], minQueryLength: p = 0, debounce: m = 0, initialItems: h, placement: g = "bottom-start", offset: _ = {}, container: v, flip: y = !0, floatingUi: b, dismissOnOutsideClick: x = !0, render: S = () => ({}), allow: C = () => !0, findSuggestionMatch: w = Rt, shouldShow: T, shouldResetDismissed: ee }) {
1476
+ let E = S?.(), D = r && !i, O = (n, r) => Vt(t, n, r, e);
1477
+ function k(e) {
1478
+ return Ht({
1479
+ ...e,
1480
+ editor: t,
1481
+ shouldResetDismissed: ee,
1482
+ effectiveAllowSpaces: D
1483
+ });
1484
+ }
1485
+ let A = (t) => Ut({
1486
+ view: t,
1487
+ pluginKeyRef: e
1488
+ });
1489
+ return new re({
1490
+ key: e,
1491
+ view: () => Xt({
1492
+ editor: t,
1493
+ pluginKey: e,
1494
+ items: f,
1495
+ renderer: E,
1496
+ minQueryLength: p,
1497
+ debounce: m,
1498
+ initialItems: h,
1499
+ placement: g,
1500
+ offset: _,
1501
+ container: v,
1502
+ flip: y,
1503
+ floatingUi: b,
1504
+ dismissOnOutsideClick: x,
1505
+ command: d,
1506
+ clientRectFor: O,
1507
+ dispatchExit: A
1508
+ }),
1509
+ state: Gt({
1510
+ editor: t,
1511
+ char: n,
1512
+ effectiveAllowSpaces: D,
1513
+ allowToIncludeChar: i,
1514
+ allowedPrefixes: a,
1515
+ startOfLine: o,
1516
+ findSuggestionMatch: w,
1517
+ allow: C,
1518
+ shouldShow: T,
1519
+ shouldKeepDismissed: k,
1520
+ pluginKey: e
1521
+ }),
1522
+ props: Wt({
1523
+ pluginKey: e,
1524
+ decorationTag: s,
1525
+ decorationClass: c,
1526
+ decorationContent: l,
1527
+ decorationEmptyClass: u,
1528
+ renderer: E,
1529
+ dispatchExit: A
1530
+ })
1531
+ });
1532
+ }
1533
+ var $t = Qt, en = ["id"], tn = {
1534
+ key: 0,
1535
+ class: "tpl:px-3 tpl:py-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]",
1536
+ "data-testid": "merge-tag-suggestion-empty"
1537
+ }, nn = [
1538
+ "id",
1539
+ "aria-selected",
1540
+ "data-selected",
1541
+ "data-merge-tag-value",
1542
+ "onMousedown",
1543
+ "onMousemove"
1544
+ ], rn = { class: "tpl:font-medium" }, an = { class: "tpl:text-[var(--tpl-text-dim)] tpl:font-mono" }, on = /* @__PURE__ */ c({
1545
+ __name: "MergeTagSuggestionList",
1546
+ props: {
1547
+ items: {},
1548
+ selectedIndex: {},
1549
+ emptyText: {},
1550
+ listId: {}
1551
+ },
1552
+ emits: ["select", "hover"],
1553
+ setup(t) {
1554
+ let n = t;
1555
+ function i(e) {
1556
+ return n.listId ? `${n.listId}-opt-${e}` : void 0;
1557
+ }
1558
+ return (n, a) => (e(), f("div", {
1559
+ id: t.listId,
1560
+ class: "tpl:min-w-[200px] tpl:max-w-[320px] tpl:max-h-[50vh] tpl:overflow-y-auto tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:py-1 tpl:shadow-lg",
1561
+ role: "listbox",
1562
+ "data-testid": "merge-tag-suggestion-list"
1563
+ }, [t.items.length === 0 ? (e(), f("div", tn, b(t.emptyText), 1)) : m("", !0), (e(!0), f(p, null, r(t.items, (r, a) => (e(), f("button", {
1564
+ key: r.value,
1565
+ id: i(a),
1566
+ type: "button",
1567
+ role: "option",
1568
+ "aria-selected": a === t.selectedIndex,
1569
+ "data-selected": a === t.selectedIndex ? "true" : "false",
1570
+ "data-merge-tag-value": r.value,
1571
+ class: s(["tpl:flex tpl:w-full tpl:flex-col tpl:items-start tpl:gap-0.5 tpl:px-3 tpl:py-1.5 tpl:text-left tpl:text-xs tpl:transition-colors", a === t.selectedIndex ? "tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary)]" : "tpl:text-[var(--tpl-text)] hover:tpl:bg-[var(--tpl-bg-hover)]"]),
1572
+ onMousedown: l((e) => n.$emit("select", r), ["prevent", "stop"]),
1573
+ onMousemove: (e) => a !== t.selectedIndex && n.$emit("hover", a)
1574
+ }, [d("span", rn, b(r.label), 1), d("span", an, b(r.value), 1)], 42, nn))), 128))], 8, en));
1575
+ }
1576
+ }), sn = 10, cn = 0;
1577
+ function ln(e, t) {
1578
+ let n = t.trim().toLowerCase();
1579
+ return n === "" ? e.slice(0, sn) : e.filter((e) => {
1580
+ let t = e.label.toLowerCase(), r = e.value.toLowerCase();
1581
+ return t.includes(n) || r.includes(n);
1582
+ }).slice(0, sn);
1583
+ }
1584
+ function un(e, t, n, r) {
1585
+ return t.length === 0 ? e.key === "Enter" || e.key === "Tab" : e.key === "ArrowDown" ? (n.value = (n.value + 1) % t.length, !0) : e.key === "ArrowUp" ? (n.value = (n.value - 1 + t.length) % t.length, !0) : e.key === "Enter" || e.key === "Tab" ? (r(t[n.value]), !0) : !1;
1586
+ }
1587
+ function dn(e, t) {
1588
+ return () => {
1589
+ let n = null, r = null, o = null, s = a([]), c = a(0), l = null, u = `tpl-merge-tag-suggestion-${++cn}`, d = null, f = [], p = null;
1590
+ function m() {
1591
+ b(d?.() ?? null);
1592
+ }
1593
+ function g() {
1594
+ m(), p !== null && cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1595
+ p = null, m();
1596
+ });
1597
+ }
1598
+ function _(e) {
1599
+ let t = [], n = e?.parentElement ?? null;
1600
+ for (; n && n !== document.body && n !== document.documentElement;) {
1601
+ let e = window.getComputedStyle(n), r = e.overflow + e.overflowX + e.overflowY;
1602
+ /(auto|scroll|overlay)/.test(r) && t.push(n), n = n.parentElement;
1603
+ }
1604
+ return t;
1605
+ }
1606
+ function v(e) {
1607
+ f = [window, ..._(e)];
1608
+ for (let e of f) e.addEventListener("scroll", m, {
1609
+ passive: !0,
1610
+ capture: !0
1611
+ });
1612
+ window.addEventListener("resize", m, { passive: !0 });
1613
+ }
1614
+ function y() {
1615
+ for (let e of f) e.removeEventListener("scroll", m, { capture: !0 });
1616
+ window.removeEventListener("resize", m), f = [];
1617
+ }
1618
+ function b(e) {
1619
+ if (!r || !e || e.bottom < 0 || e.top > window.innerHeight) return;
1620
+ r.style.position = "fixed", r.style.left = `${e.left}px`, r.style.zIndex = "9999", r.style.top = `${e.bottom}px`;
1621
+ let t = r.offsetHeight;
1622
+ if (t !== 0 && window.innerHeight - e.bottom < t) {
1623
+ let n = Math.max(0, e.top - t);
1624
+ r.style.top = `${n}px`;
1625
+ }
1626
+ }
1627
+ function x(e, t) {
1628
+ let n = t?.closest("[data-tpl-theme]");
1629
+ if (!n) return;
1630
+ let r = n.getAttribute("data-tpl-theme");
1631
+ r && e.setAttribute("data-tpl-theme", r);
1632
+ let i = window.getComputedStyle(n);
1633
+ for (let t = 0; t < i.length; t++) {
1634
+ let n = i[t];
1635
+ n.startsWith("--tpl-") && e.style.setProperty(n, i.getPropertyValue(n));
1636
+ }
1637
+ e.style.fontFamily = i.fontFamily, e.style.fontSize = i.fontSize, e.style.lineHeight = i.lineHeight;
1638
+ }
1639
+ function S(e) {
1640
+ o && (e ? (o.setAttribute("role", "combobox"), o.setAttribute("aria-haspopup", "listbox"), o.setAttribute("aria-expanded", "true"), o.setAttribute("aria-controls", u)) : (o.removeAttribute("aria-expanded"), o.removeAttribute("aria-controls"), o.removeAttribute("aria-activedescendant"), o.removeAttribute("aria-haspopup"), o.removeAttribute("role")));
1641
+ }
1642
+ function C() {
1643
+ if (o) {
1644
+ if (s.value.length === 0) {
1645
+ o.removeAttribute("aria-activedescendant");
1646
+ return;
1647
+ }
1648
+ o.setAttribute("aria-activedescendant", `${u}-opt-${c.value}`);
1649
+ }
1650
+ }
1651
+ function w(e) {
1652
+ l?.(e);
1653
+ }
1654
+ return {
1655
+ onStart: (a) => {
1656
+ s.value = a.items, c.value = 0, l = (e) => a.command(e), r = document.createElement("div"), r.setAttribute("data-testid", "merge-tag-suggestion-popup");
1657
+ let f = a.editor.view?.dom;
1658
+ o = f ?? null, x(r, f ?? null), (t?.value ?? document.body).appendChild(r), n = h({ render() {
1659
+ return i(on, {
1660
+ items: s.value,
1661
+ selectedIndex: c.value,
1662
+ emptyText: e,
1663
+ listId: u,
1664
+ onSelect: (e) => w(e),
1665
+ onHover: (e) => {
1666
+ c.value = e, C();
1667
+ }
1668
+ });
1669
+ } }), n.mount(r), S(!0), C(), d = a.clientRect ?? null, g(), v(f ?? null);
1670
+ },
1671
+ onUpdate: (e) => {
1672
+ s.value = e.items, c.value >= e.items.length && (c.value = 0), l = (t) => e.command(t), C(), d = e.clientRect ?? null, g();
1673
+ },
1674
+ onKeyDown: (e) => {
1675
+ if (e.event.key === "Escape") return !0;
1676
+ let t = un(e.event, s.value, c, w);
1677
+ return t && C(), t;
1678
+ },
1679
+ onExit: () => {
1680
+ p !== null && (cancelAnimationFrame(p), p = null), y(), S(!1), n?.unmount(), r?.remove(), n = null, r = null, o = null, l = null, d = null;
1681
+ }
1682
+ };
1683
+ };
1684
+ }
1685
+ var fn = k.create({
1686
+ name: "mergeTagSuggestion",
1687
+ addOptions() {
1688
+ return {
1689
+ mergeTags: [],
1690
+ char: "{{",
1691
+ emptyText: "No matching merge tags",
1692
+ popoverRoot: null
1693
+ };
1694
+ },
1695
+ addProseMirrorPlugins() {
1696
+ let e = this.options.mergeTags, t = this.options.emptyText, n = this.options.popoverRoot, r = {
1697
+ char: this.options.char,
1698
+ allowSpaces: !1,
1699
+ startOfLine: !1,
1700
+ allowedPrefixes: null,
1701
+ items: ({ query: t }) => ln(e, t),
1702
+ command: ({ editor: e, range: t, props: n }) => {
1703
+ e.chain().focus().insertContentAt(t, {
1704
+ type: "mergeTagNode",
1705
+ attrs: {
1706
+ label: n.label,
1707
+ value: n.value
1708
+ }
1709
+ }).run();
1710
+ },
1711
+ render: dn(t, n)
1712
+ };
1713
+ return [$t({
1714
+ editor: this.editor,
1715
+ ...r
1716
+ })];
1717
+ }
1718
+ });
1719
+ //#endregion
1720
+ export { se as FontSize, ce as LetterSpacing, le as LineHeight, he as LogicMergeTagNode, ye as MergeTagNode, fn as MergeTagSuggestion, ln as filterMergeTags, un as handleSuggestionKeyDown };