@editora/core 1.0.7 → 1.0.9

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 (87) hide show
  1. package/README.md +5 -0
  2. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
  3. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
  4. package/dist/ApprovalWorkflowPlugin.native-449ce66c.mjs +1115 -0
  5. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
  6. package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
  7. package/dist/BlocksLibraryPlugin.native-1cc51e63.mjs +1386 -0
  8. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
  9. package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
  10. package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
  11. package/dist/CitationsPlugin.native-169fb1e8.mjs +1532 -0
  12. package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
  13. package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
  14. package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
  15. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
  16. package/dist/ConditionalContentPlugin.native-4983143a.mjs +1424 -0
  17. package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
  18. package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
  19. package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
  20. package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
  21. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
  22. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
  23. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
  24. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
  25. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
  26. package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
  27. package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
  28. package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
  29. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
  30. package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
  31. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
  32. package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
  33. package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
  34. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
  35. package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
  36. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
  37. package/dist/MentionPlugin.native-3b1e8c05.mjs +778 -0
  38. package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
  39. package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
  40. package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
  41. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
  42. package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
  43. package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
  44. package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
  45. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
  46. package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
  47. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
  48. package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
  49. package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
  50. package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
  51. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
  52. package/dist/TrackChangesPlugin.native-e96da509.mjs +818 -0
  53. package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
  54. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
  55. package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
  56. package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
  57. package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
  58. package/dist/documentManager-8327fb6e.mjs +9166 -0
  59. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
  60. package/dist/editora.min.js +14 -13
  61. package/dist/editora.umd.js +14 -13
  62. package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
  63. package/dist/index-072ef022.js +11 -0
  64. package/dist/index-49d31221.mjs +16860 -0
  65. package/dist/{index-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-b47a189f.mjs +5782 -0
  68. package/dist/index.esm.js +12 -7
  69. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
  70. package/dist/plugin-loader.js +77 -40
  71. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
  72. package/dist/style.css +1 -0
  73. package/dist/webcomponent-core.js +546 -414
  74. package/dist/webcomponent-core.min.css +1 -1
  75. package/dist/webcomponent-core.min.js +40 -39
  76. package/dist/webcomponent.cjs.js +1 -1
  77. package/dist/webcomponent.esm.js +1 -1
  78. package/dist/webcomponent.js +484 -315
  79. package/dist/webcomponent.min.css +1 -1
  80. package/dist/webcomponent.min.js +6035 -558
  81. package/package.json +11 -5
  82. package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
  83. package/dist/core.css +0 -1
  84. package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
  85. package/dist/index-BpE6GFbz.js +0 -10
  86. package/dist/index-BslAFzmv.mjs +0 -16544
  87. package/dist/index.es-BYD2KEo6.mjs +0 -6666
@@ -0,0 +1,1115 @@
1
+ const w = ".rte-content, .editora-content", F = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", ee = "__editoraCommandEditorRoot", te = "rte-approval-workflow-styles", d = "rte-approval-panel", h = "approval", y = "approvalWorkflow", v = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', ue = {
2
+ panelTitle: "Approval Workflow",
3
+ panelAriaLabel: "Approval workflow panel",
4
+ statusLabel: "Status",
5
+ statusDraftText: "Draft",
6
+ statusReviewText: "In Review",
7
+ statusApprovedText: "Approved",
8
+ requestReviewText: "Request Review",
9
+ approveText: "Approve",
10
+ reopenDraftText: "Reopen Draft",
11
+ addCommentText: "Add Comment",
12
+ actorLabel: "Actor",
13
+ actorPlaceholder: "Reviewer name",
14
+ commentLabel: "Comment",
15
+ commentPlaceholder: "Add review note or sign-off context",
16
+ closeText: "Close",
17
+ commentsHeading: "Comments",
18
+ signoffsHeading: "Sign-offs",
19
+ noCommentsText: "No comments yet.",
20
+ noSignoffsText: "No sign-offs yet.",
21
+ summaryPrefix: "Workflow",
22
+ lockedSuffix: "Locked",
23
+ shortcutText: "Shortcuts: Ctrl/Cmd+Alt+Shift+A/R/P/D",
24
+ approveCommentRequiredText: "Approval comment is required."
25
+ }, fe = {
26
+ draft: "statusDraftText",
27
+ review: "statusReviewText",
28
+ approved: "statusApprovedText"
29
+ }, p = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new Set();
30
+ let _ = 0, me = 0, oe = 0, re = 0, R = null, g = null, T = null, L = null, S = null;
31
+ function c(e) {
32
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
33
+ }
34
+ function be(e) {
35
+ return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
36
+ }
37
+ function ne(e) {
38
+ return e === "review" || e === "approved" ? e : "draft";
39
+ }
40
+ function z(e = {}) {
41
+ var t;
42
+ return {
43
+ defaultStatus: ne(e.defaultStatus),
44
+ lockOnApproval: e.lockOnApproval !== !1,
45
+ maxHistoryEntries: Math.max(10, Math.min(500, Number((t = e.maxHistoryEntries) != null ? t : 120))),
46
+ requireCommentOnApprove: !!e.requireCommentOnApprove,
47
+ defaultActor: (e.defaultActor || "system").trim() || "system",
48
+ labels: {
49
+ ...ue,
50
+ ...e.labels || {}
51
+ },
52
+ normalizeText: e.normalizeText || be
53
+ };
54
+ }
55
+ function U(e) {
56
+ return e.closest(F) || e;
57
+ }
58
+ function B(e) {
59
+ if (!e)
60
+ return null;
61
+ if (e.matches(w))
62
+ return e;
63
+ const t = e.querySelector(w);
64
+ return t instanceof HTMLElement ? t : null;
65
+ }
66
+ function ve() {
67
+ if (typeof window == "undefined")
68
+ return null;
69
+ const e = window[ee];
70
+ if (!(e instanceof HTMLElement))
71
+ return null;
72
+ window[ee] = null;
73
+ const t = B(e);
74
+ if (t)
75
+ return t;
76
+ const o = e.closest(F);
77
+ if (o) {
78
+ const a = B(o);
79
+ if (a)
80
+ return a;
81
+ }
82
+ return null;
83
+ }
84
+ function ge(e) {
85
+ const t = e.closest("[data-editora-editor]");
86
+ if (t && B(t) === e)
87
+ return t;
88
+ let o = e;
89
+ for (; o; ) {
90
+ if (o.matches(F) && (o === e || B(o) === e))
91
+ return o;
92
+ o = o.parentElement;
93
+ }
94
+ return U(e);
95
+ }
96
+ function W(e) {
97
+ return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
98
+ }
99
+ function he(e) {
100
+ const t = U(e);
101
+ if (W(t))
102
+ return !0;
103
+ const o = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
104
+ return W(o) ? !0 : W(document.documentElement) || W(document.body);
105
+ }
106
+ function K(e, t) {
107
+ e.classList.remove("rte-approval-theme-dark"), he(t) && e.classList.add("rte-approval-theme-dark");
108
+ }
109
+ function le(e) {
110
+ return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
111
+ }
112
+ function x(e, t = !0) {
113
+ if (D(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
114
+ return e.contentElement;
115
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
116
+ const n = e.editorElement;
117
+ if (n.matches(w))
118
+ return n;
119
+ const l = n.querySelector(w);
120
+ if (l instanceof HTMLElement)
121
+ return l;
122
+ }
123
+ const o = ve();
124
+ if (o)
125
+ return o;
126
+ const a = window.getSelection();
127
+ if (a && a.rangeCount > 0) {
128
+ const n = le(a.getRangeAt(0).startContainer), l = n == null ? void 0 : n.closest(w);
129
+ if (l)
130
+ return l;
131
+ }
132
+ const r = document.activeElement;
133
+ if (r) {
134
+ if (r.matches(w))
135
+ return r;
136
+ const n = r.closest(w);
137
+ if (n)
138
+ return n;
139
+ }
140
+ return g && g.isConnected ? g : (g && !g.isConnected && (g = null), t ? document.querySelector(w) : null);
141
+ }
142
+ function D() {
143
+ Array.from(H).forEach((t) => {
144
+ var o;
145
+ t.isConnected || ((o = k.get(t)) == null || o.remove(), k.delete(t), O.delete(t), p.delete(t), I.delete(t), H.delete(t), g === t && (g = null));
146
+ });
147
+ }
148
+ function xe(e) {
149
+ return e ? !!(e.closest(`.${d}`) || e.closest(w) || e.closest(F)) : !1;
150
+ }
151
+ function we() {
152
+ const e = window.getSelection();
153
+ if (!e || e.rangeCount === 0)
154
+ return !1;
155
+ const t = e.getRangeAt(0).startContainer, o = le(t);
156
+ return !!(o != null && o.closest(w));
157
+ }
158
+ function C(e, t, o) {
159
+ const a = ge(e);
160
+ Array.from(
161
+ a.querySelectorAll(
162
+ `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
163
+ )
164
+ ).forEach((n) => {
165
+ n.classList.toggle("active", o), n.setAttribute("aria-pressed", o ? "true" : "false"), n.setAttribute("data-active", o ? "true" : "false");
166
+ });
167
+ }
168
+ function ie(e, t, o) {
169
+ t !== null ? e.setAttribute("contenteditable", t) : e.setAttribute("contenteditable", "true"), o !== null ? e.setAttribute("data-readonly", o) : e.removeAttribute("data-readonly");
170
+ }
171
+ function Y(e) {
172
+ e.dispatchEvent(new Event("input", { bubbles: !0 }));
173
+ }
174
+ function X(e, t) {
175
+ if (t === e.innerHTML)
176
+ return;
177
+ const o = window.execEditorCommand || window.executeEditorCommand;
178
+ if (typeof o == "function")
179
+ try {
180
+ o("recordDomTransaction", e, t, e.innerHTML);
181
+ } catch (a) {
182
+ }
183
+ }
184
+ function J() {
185
+ return oe += 1, `approval-comment-${Date.now().toString(36)}-${oe.toString(36)}`;
186
+ }
187
+ function ke() {
188
+ return re += 1, `approval-signoff-${Date.now().toString(36)}-${re.toString(36)}`;
189
+ }
190
+ function se(e) {
191
+ return {
192
+ status: e.status,
193
+ locked: e.locked,
194
+ comments: e.comments.map((t) => ({ ...t })),
195
+ signoffs: e.signoffs.map((t) => ({ ...t })),
196
+ updatedAt: e.updatedAt
197
+ };
198
+ }
199
+ function ye(e, t) {
200
+ const o = fe[e];
201
+ return t.labels[o] || e;
202
+ }
203
+ function pe(e, t, o) {
204
+ var a, r;
205
+ if (e.setAttribute("data-approval-status", t.status), e.setAttribute("data-approval-locked", t.locked ? "true" : "false"), e.classList.toggle("rte-approval-locked-editor", t.locked), C(e, "toggleApprovalWorkflowPanel", Z(e)), C(e, "requestApprovalReview", t.status === "review"), C(e, "approveDocument", t.status === "approved"), C(e, "reopenDraft", t.status === "draft"), t.status === "approved" && o.lockOnApproval) {
206
+ t.locked || (t.preApprovalContentEditable = e.getAttribute("contenteditable"), t.preApprovalReadonly = e.getAttribute("data-readonly")), e.setAttribute("contenteditable", "false"), e.setAttribute("data-readonly", "true"), t.locked = !0;
207
+ return;
208
+ }
209
+ t.locked = !1, ie(
210
+ e,
211
+ (a = t.preApprovalContentEditable) != null ? a : t.originalContentEditable,
212
+ (r = t.preApprovalReadonly) != null ? r : t.originalReadonly
213
+ ), t.preApprovalContentEditable = null, t.preApprovalReadonly = null;
214
+ }
215
+ function f(e, t) {
216
+ let o = I.get(e);
217
+ return o || (o = {
218
+ status: t.defaultStatus,
219
+ locked: !1,
220
+ comments: [],
221
+ signoffs: [],
222
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
223
+ originalContentEditable: e.getAttribute("contenteditable"),
224
+ originalReadonly: e.getAttribute("data-readonly"),
225
+ preApprovalContentEditable: null,
226
+ preApprovalReadonly: null
227
+ }, I.set(e, o), H.add(e), pe(e, o, t), o);
228
+ }
229
+ function j(e, t) {
230
+ return e.length <= t ? e : e.slice(e.length - t);
231
+ }
232
+ function M(e, t) {
233
+ const o = e.querySelector(".rte-approval-live");
234
+ o && (o.textContent = t);
235
+ }
236
+ function Ae(e, t) {
237
+ const o = se(t);
238
+ e.__approvalWorkflowState = o, e.dispatchEvent(
239
+ new CustomEvent("editora:approval-state-changed", {
240
+ bubbles: !0,
241
+ detail: {
242
+ state: o
243
+ }
244
+ })
245
+ );
246
+ }
247
+ function q(e) {
248
+ const t = k.get(e);
249
+ if (!t)
250
+ return;
251
+ const o = p.get(e) || R;
252
+ if (!o)
253
+ return;
254
+ const a = f(e, o), r = t.querySelector(".rte-approval-summary"), n = t.querySelector('[data-action="request-review"]'), l = t.querySelector('[data-action="approve"]'), s = t.querySelector('[data-action="reopen-draft"]'), u = t.querySelector(".rte-approval-comments-list"), m = t.querySelector(".rte-approval-signoffs-list");
255
+ if (r) {
256
+ const i = ye(a.status, o);
257
+ r.textContent = `${o.labels.summaryPrefix}: ${i} | Comments: ${a.comments.length} | Sign-offs: ${a.signoffs.length}${a.locked ? ` | ${o.labels.lockedSuffix}` : ""}`;
258
+ }
259
+ n && (n.disabled = a.status !== "draft"), l && (l.disabled = a.status === "approved"), s && (s.disabled = a.status === "draft"), u && (a.comments.length === 0 ? u.innerHTML = `<li class="rte-approval-empty">${c(o.labels.noCommentsText)}</li>` : u.innerHTML = a.comments.slice().reverse().map(
260
+ (i) => `
261
+ <li class="rte-approval-item rte-approval-item-${i.kind}" role="listitem">
262
+ <div class="rte-approval-item-head">
263
+ <span class="rte-approval-item-author">${c(i.author)}</span>
264
+ <time class="rte-approval-item-time" datetime="${c(i.createdAt)}">${c(
265
+ new Date(i.createdAt).toLocaleString()
266
+ )}</time>
267
+ </div>
268
+ <p class="rte-approval-item-message">${c(i.message)}</p>
269
+ </li>
270
+ `
271
+ ).join("")), m && (a.signoffs.length === 0 ? m.innerHTML = `<li class="rte-approval-empty">${c(o.labels.noSignoffsText)}</li>` : m.innerHTML = a.signoffs.slice().reverse().map(
272
+ (i) => `
273
+ <li class="rte-approval-item" role="listitem">
274
+ <div class="rte-approval-item-head">
275
+ <span class="rte-approval-item-author">${c(i.author)}</span>
276
+ <time class="rte-approval-item-time" datetime="${c(i.createdAt)}">${c(
277
+ new Date(i.createdAt).toLocaleString()
278
+ )}</time>
279
+ </div>
280
+ <p class="rte-approval-item-message">${c(i.comment || "Approved")}</p>
281
+ </li>
282
+ `
283
+ ).join(""));
284
+ }
285
+ function G(e, t, o) {
286
+ t.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), pe(e, t, o), q(e), Ae(e, t);
287
+ }
288
+ function ae(e, t, o, a) {
289
+ e.comments.push({
290
+ id: J(),
291
+ author: o || t.defaultActor,
292
+ message: a,
293
+ kind: "system",
294
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
295
+ }), e.comments = j(e.comments, t.maxHistoryEntries);
296
+ }
297
+ function E(e, t, o, a) {
298
+ const r = f(e, o);
299
+ if (r.status === t)
300
+ return !1;
301
+ const n = e.innerHTML;
302
+ return r.status = t, t === "review" ? ae(r, o, a, "Review requested.") : t === "draft" && ae(r, o, a, "Returned to draft."), G(e, r, o), Y(e), X(e, n), !0;
303
+ }
304
+ function ce(e, t, o, a) {
305
+ const r = a.normalizeText(t);
306
+ if (!r)
307
+ return !1;
308
+ const n = a.normalizeText(o) || a.defaultActor, l = f(e, a), s = e.innerHTML;
309
+ return l.comments.push({
310
+ id: J(),
311
+ author: n,
312
+ message: r,
313
+ kind: "comment",
314
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
315
+ }), l.comments = j(l.comments, a.maxHistoryEntries), G(e, l, a), Y(e), X(e, s), !0;
316
+ }
317
+ function Q(e, t, o, a) {
318
+ const r = t.normalizeText(o) || t.defaultActor, n = t.normalizeText(a);
319
+ if (t.requireCommentOnApprove && !n)
320
+ return !1;
321
+ const l = f(e, t), s = e.innerHTML;
322
+ return l.status = "approved", l.signoffs.push({
323
+ id: ke(),
324
+ author: r,
325
+ comment: n || void 0,
326
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
327
+ }), l.signoffs = j(l.signoffs, t.maxHistoryEntries), n && (l.comments.push({
328
+ id: J(),
329
+ author: r,
330
+ message: n,
331
+ kind: "system",
332
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
333
+ }), l.comments = j(l.comments, t.maxHistoryEntries)), G(e, l, t), Y(e), X(e, s), !0;
334
+ }
335
+ function N(e, t) {
336
+ return e.querySelector(`[data-field="${t}"]`);
337
+ }
338
+ function Se(e) {
339
+ var a, r;
340
+ const t = ((a = N(e, "actor")) == null ? void 0 : a.value) || "", o = ((r = N(e, "comment")) == null ? void 0 : r.value) || "";
341
+ return { actor: t, comment: o };
342
+ }
343
+ function V(e, t) {
344
+ if (!t.classList.contains("show"))
345
+ return;
346
+ const a = U(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 420), n = Math.max(10, window.innerWidth - r - 10), l = Math.min(Math.max(10, a.right - r), n), s = Math.max(10, Math.min(window.innerHeight - 10 - 280, a.top + 12));
347
+ t.style.width = `${r}px`, t.style.left = `${l}px`, t.style.top = `${s}px`, t.style.maxHeight = `${Math.max(280, window.innerHeight - 24)}px`;
348
+ }
349
+ function $e(e) {
350
+ const t = k.get(e);
351
+ if (t)
352
+ return t;
353
+ const o = p.get(e) || R || z(), a = `rte-approval-panel-${me++}`, r = document.createElement("section");
354
+ return r.className = d, r.id = a, r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "false"), r.setAttribute("aria-label", o.labels.panelAriaLabel), r.setAttribute("tabindex", "-1"), r.innerHTML = `
355
+ <header class="rte-approval-header">
356
+ <h2 class="rte-approval-title">${c(o.labels.panelTitle)}</h2>
357
+ <button type="button" class="rte-approval-icon-btn" data-action="close" aria-label="${c(
358
+ o.labels.closeText
359
+ )}">✕</button>
360
+ </header>
361
+ <div class="rte-approval-body">
362
+ <p class="rte-approval-summary" aria-live="polite"></p>
363
+
364
+ <div class="rte-approval-controls" role="toolbar" aria-label="Approval actions">
365
+ <button type="button" class="rte-approval-btn" data-action="request-review">${c(
366
+ o.labels.requestReviewText
367
+ )}</button>
368
+ <button type="button" class="rte-approval-btn rte-approval-btn-primary" data-action="approve">${c(
369
+ o.labels.approveText
370
+ )}</button>
371
+ <button type="button" class="rte-approval-btn" data-action="reopen-draft">${c(
372
+ o.labels.reopenDraftText
373
+ )}</button>
374
+ </div>
375
+
376
+ <div class="rte-approval-form">
377
+ <label class="rte-approval-label">
378
+ ${c(o.labels.actorLabel)}
379
+ <input type="text" data-field="actor" class="rte-approval-field" autocomplete="off" placeholder="${c(
380
+ o.labels.actorPlaceholder
381
+ )}" />
382
+ </label>
383
+ <label class="rte-approval-label">
384
+ ${c(o.labels.commentLabel)}
385
+ <textarea data-field="comment" class="rte-approval-field" rows="2" placeholder="${c(
386
+ o.labels.commentPlaceholder
387
+ )}"></textarea>
388
+ </label>
389
+ <button type="button" class="rte-approval-btn" data-action="add-comment">${c(
390
+ o.labels.addCommentText
391
+ )}</button>
392
+ </div>
393
+
394
+ <section class="rte-approval-section" aria-label="${c(o.labels.commentsHeading)}">
395
+ <h3 class="rte-approval-section-title">${c(o.labels.commentsHeading)}</h3>
396
+ <ul class="rte-approval-comments-list" role="list"></ul>
397
+ </section>
398
+
399
+ <section class="rte-approval-section" aria-label="${c(o.labels.signoffsHeading)}">
400
+ <h3 class="rte-approval-section-title">${c(o.labels.signoffsHeading)}</h3>
401
+ <ul class="rte-approval-signoffs-list" role="list"></ul>
402
+ </section>
403
+
404
+ <p class="rte-approval-shortcut">${c(o.labels.shortcutText)}</p>
405
+ <span class="rte-approval-live" aria-live="polite"></span>
406
+ </div>
407
+ `, r.addEventListener("click", (n) => {
408
+ const l = n.target;
409
+ if (!l)
410
+ return;
411
+ const s = l.closest("[data-action]");
412
+ if (!s)
413
+ return;
414
+ const u = s.getAttribute("data-action") || "", m = p.get(e) || R || o;
415
+ if (p.set(e, m), f(e, m), u === "close") {
416
+ P(e, !0);
417
+ return;
418
+ }
419
+ const i = Se(r);
420
+ if (u === "request-review") {
421
+ E(e, "review", m, i.actor || m.defaultActor) && M(r, "Status changed to review.");
422
+ return;
423
+ }
424
+ if (u === "reopen-draft") {
425
+ E(e, "draft", m, i.actor || m.defaultActor) && M(r, "Status changed to draft.");
426
+ return;
427
+ }
428
+ if (u === "approve") {
429
+ const b = Q(e, m, i.actor, i.comment);
430
+ if (!b && m.requireCommentOnApprove) {
431
+ M(r, m.labels.approveCommentRequiredText);
432
+ return;
433
+ }
434
+ if (b) {
435
+ const $ = N(r, "comment");
436
+ $ && ($.value = ""), M(r, "Document approved and signed off.");
437
+ }
438
+ return;
439
+ }
440
+ if (u === "add-comment") {
441
+ if (!ce(e, i.comment, i.actor, m))
442
+ return;
443
+ const $ = N(r, "comment");
444
+ $ && ($.value = ""), M(r, "Comment added.");
445
+ return;
446
+ }
447
+ }), r.addEventListener("keydown", (n) => {
448
+ n.key === "Escape" && (n.preventDefault(), P(e, !0));
449
+ }), K(r, e), document.body.appendChild(r), k.set(e, r), O.set(e, !1), q(e), r;
450
+ }
451
+ function Z(e) {
452
+ return O.get(e) === !0;
453
+ }
454
+ function A(e) {
455
+ D();
456
+ const t = $e(e);
457
+ k.forEach((o, a) => {
458
+ a !== e && P(a, !1);
459
+ }), t.classList.add("show"), O.set(e, !0), C(e, "toggleApprovalWorkflowPanel", !0), K(t, e), V(e, t), q(e);
460
+ }
461
+ function P(e, t = !1) {
462
+ const o = k.get(e);
463
+ o && (o.classList.remove("show"), O.set(e, !1), C(e, "toggleApprovalWorkflowPanel", !1), t && e.focus({ preventScroll: !0 }));
464
+ }
465
+ function de(e, t) {
466
+ const o = Z(e);
467
+ return (typeof t == "boolean" ? t : !o) ? A(e) : P(e), !0;
468
+ }
469
+ function Ee(e) {
470
+ const t = e.key.toLowerCase();
471
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "a";
472
+ }
473
+ function Ce(e) {
474
+ const t = e.key.toLowerCase();
475
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "r";
476
+ }
477
+ function Te(e) {
478
+ const t = e.key.toLowerCase();
479
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "p";
480
+ }
481
+ function Le(e) {
482
+ const t = e.key.toLowerCase();
483
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "d";
484
+ }
485
+ function Re(e) {
486
+ R = e, T || (T = (t) => {
487
+ D();
488
+ const o = t.target, a = o == null ? void 0 : o.closest(w);
489
+ if (!a)
490
+ return;
491
+ g = a;
492
+ const r = p.get(a) || e;
493
+ p.set(a, r), f(a, r);
494
+ const n = k.get(a);
495
+ n && (K(n, a), V(a, n));
496
+ }, document.addEventListener("focusin", T, !0)), L || (L = (t) => {
497
+ if (t.defaultPrevented)
498
+ return;
499
+ const o = Ee(t), a = Ce(t), r = Te(t), n = Le(t), l = t.key === "Escape";
500
+ if (!l && !o && !a && !r && !n)
501
+ return;
502
+ D();
503
+ const s = t.target, u = !!(s != null && s.closest(`.${d} input, .${d} textarea, .${d} select`));
504
+ if (!xe(s) && !we())
505
+ return;
506
+ const i = x(void 0, !1);
507
+ if (!i)
508
+ return;
509
+ const b = p.get(i) || R || e;
510
+ p.set(i, b);
511
+ const $ = f(i, b);
512
+ if (g = i, l && Z(i)) {
513
+ t.preventDefault(), P(i, !0);
514
+ return;
515
+ }
516
+ if (!u) {
517
+ if (o) {
518
+ t.preventDefault(), t.stopPropagation(), de(i);
519
+ return;
520
+ }
521
+ if (a) {
522
+ t.preventDefault(), t.stopPropagation(), E(i, "review", b, b.defaultActor) && A(i);
523
+ return;
524
+ }
525
+ if (r) {
526
+ t.preventDefault(), t.stopPropagation(), Q(i, b, b.defaultActor, "Approved via keyboard shortcut.") && A(i);
527
+ return;
528
+ }
529
+ n && (t.preventDefault(), t.stopPropagation(), $.status !== "draft" && E(i, "draft", b, b.defaultActor) && A(i));
530
+ }
531
+ }, document.addEventListener("keydown", L, !0)), S || (S = () => {
532
+ D(), k.forEach((t, o) => {
533
+ !o.isConnected || !t.isConnected || (K(t, o), V(o, t));
534
+ });
535
+ }, window.addEventListener("scroll", S, !0), window.addEventListener("resize", S));
536
+ }
537
+ function Me(e) {
538
+ var o, a;
539
+ const t = I.get(e);
540
+ t && (e.classList.remove("rte-approval-locked-editor"), e.removeAttribute("data-approval-status"), e.removeAttribute("data-approval-locked"), ie(
541
+ e,
542
+ (o = t.preApprovalContentEditable) != null ? o : t.originalContentEditable,
543
+ (a = t.preApprovalReadonly) != null ? a : t.originalReadonly
544
+ ));
545
+ }
546
+ function De() {
547
+ T && (document.removeEventListener("focusin", T, !0), T = null), L && (document.removeEventListener("keydown", L, !0), L = null), S && (window.removeEventListener("scroll", S, !0), window.removeEventListener("resize", S), S = null), k.forEach((e) => e.remove()), k.clear(), H.forEach((e) => Me(e)), H.clear(), R = null, g = null;
548
+ }
549
+ function He() {
550
+ if (typeof document == "undefined" || document.getElementById(te))
551
+ return;
552
+ const e = document.createElement("style");
553
+ e.id = te, e.textContent = `
554
+ .rte-toolbar-group-items.${h},
555
+ .editora-toolbar-group-items.${h},
556
+ .rte-toolbar-group-items.${y},
557
+ .editora-toolbar-group-items.${y} {
558
+ display: flex;
559
+ border: 1px solid #ccc;
560
+ border-radius: 3px;
561
+ background: #fff;
562
+ }
563
+
564
+ .rte-toolbar-group-items.${h} .rte-toolbar-button,
565
+ .editora-toolbar-group-items.${h} .editora-toolbar-button,
566
+ .rte-toolbar-group-items.${y} .rte-toolbar-button,
567
+ .editora-toolbar-group-items.${y} .editora-toolbar-button {
568
+ border: none;
569
+ border-radius: 0;
570
+ border-right: 1px solid #ccc;
571
+ }
572
+
573
+ .rte-toolbar-button[data-command="toggleApprovalWorkflowPanel"].active,
574
+ .editora-toolbar-button[data-command="toggleApprovalWorkflowPanel"].active,
575
+ .rte-toolbar-button[data-command="reopenDraft"].active,
576
+ .editora-toolbar-button[data-command="reopenDraft"].active {
577
+ background-color: #ccc;
578
+ }
579
+
580
+ ${v} .rte-toolbar-button[data-command="toggleApprovalWorkflowPanel"].active,
581
+ ${v} .editora-toolbar-button[data-command="toggleApprovalWorkflowPanel"].active,
582
+ ${v} .rte-toolbar-button[data-command="reopenDraft"].active,
583
+ ${v} .editora-toolbar-button[data-command="reopenDraft"].active {
584
+ background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
585
+ }
586
+
587
+ .rte-toolbar-group-items.${h} .rte-toolbar-item:last-child .rte-toolbar-button,
588
+ .editora-toolbar-group-items.${h} .editora-toolbar-item:last-child .editora-toolbar-button,
589
+ .rte-toolbar-group-items.${y} .rte-toolbar-item:last-child .rte-toolbar-button,
590
+ .editora-toolbar-group-items.${y} .editora-toolbar-item:last-child .editora-toolbar-button {
591
+ border-right: none;
592
+ }
593
+
594
+ ${v} .rte-toolbar-group-items.${h},
595
+ ${v} .editora-toolbar-group-items.${h},
596
+ ${v} .rte-toolbar-group-items.${y},
597
+ ${v} .editora-toolbar-group-items.${y},
598
+ .${d}.rte-approval-theme-dark {
599
+ border-color: #566275;
600
+ }
601
+ ${v} .rte-toolbar-group-items.${h} .rte-toolbar-button svg,
602
+ ${v} .editora-toolbar-group-items.${h} .editora-toolbar-button svg,
603
+ ${v} .rte-toolbar-group-items.${y} .rte-toolbar-button svg,
604
+ ${v} .editora-toolbar-group-items.${y} .editora-toolbar-button svg
605
+ {
606
+ fill: none;
607
+ }
608
+
609
+ ${v} .rte-toolbar-group-items.${h} .rte-toolbar-button,
610
+ ${v} .editora-toolbar-group-items.${h} .editora-toolbar-button
611
+ {
612
+ border-color: #566275;
613
+ }
614
+
615
+ .rte-approval-locked-editor {
616
+ background-image: repeating-linear-gradient(
617
+ -45deg,
618
+ rgba(30, 64, 175, 0.04),
619
+ rgba(30, 64, 175, 0.04) 8px,
620
+ rgba(30, 64, 175, 0.08) 8px,
621
+ rgba(30, 64, 175, 0.08) 16px
622
+ );
623
+ }
624
+
625
+ .${d} {
626
+ position: fixed;
627
+ z-index: 1500;
628
+ right: 16px;
629
+ top: 16px;
630
+ width: min(420px, calc(100vw - 20px));
631
+ max-height: calc(100vh - 24px);
632
+ display: none;
633
+ flex-direction: column;
634
+ border-radius: 12px;
635
+ border: 1px solid #d1d5db;
636
+ background: #ffffff;
637
+ color: #0f172a;
638
+ box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
639
+ overflow: hidden;
640
+ }
641
+
642
+ .${d}.show {
643
+ display: flex;
644
+ }
645
+
646
+ .${d}.rte-approval-theme-dark {
647
+ background: #0f172a;
648
+ color: #e2e8f0;
649
+ border-color: #334155;
650
+ box-shadow: 0 20px 40px rgba(2, 6, 23, 0.5);
651
+ }
652
+
653
+ .rte-approval-header {
654
+ display: flex;
655
+ align-items: center;
656
+ justify-content: space-between;
657
+ padding: 10px 12px;
658
+ border-bottom: 1px solid #e2e8f0;
659
+ background: #f8fafc;
660
+ }
661
+
662
+ .${d}.rte-approval-theme-dark .rte-approval-header {
663
+ border-bottom-color: #334155;
664
+ background: #111827;
665
+ }
666
+
667
+ .rte-approval-title {
668
+ margin: 0;
669
+ font-size: 14px;
670
+ font-weight: 700;
671
+ }
672
+
673
+ .rte-approval-icon-btn {
674
+ border: 1px solid #cbd5e1;
675
+ background: #ffffff;
676
+ color: #0f172a;
677
+ border-radius: 6px;
678
+ cursor: pointer;
679
+ min-width: 34px;
680
+ min-height: 34px;
681
+ width: 34px;
682
+ height: 34px;
683
+ padding: 0;
684
+ display: inline-flex;
685
+ align-items: center;
686
+ justify-content: center;
687
+ font-size: 16px;
688
+ line-height: 1;
689
+ font-weight: 600;
690
+ }
691
+
692
+ .rte-approval-icon-btn:hover,
693
+ .rte-approval-icon-btn:focus-visible {
694
+ outline: none;
695
+ border-color: #3b82f6;
696
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
697
+ }
698
+
699
+ .${d}.rte-approval-theme-dark .rte-approval-icon-btn {
700
+ background: #0f172a;
701
+ border-color: #475569;
702
+ color: #e2e8f0;
703
+ }
704
+
705
+ .${d}.rte-approval-theme-dark .rte-approval-icon-btn:hover,
706
+ .${d}.rte-approval-theme-dark .rte-approval-icon-btn:focus-visible {
707
+ border-color: #60a5fa;
708
+ box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
709
+ }
710
+
711
+ .rte-approval-body {
712
+ display: flex;
713
+ flex-direction: column;
714
+ gap: 10px;
715
+ padding: 12px;
716
+ overflow: auto;
717
+ }
718
+
719
+ .rte-approval-summary {
720
+ margin: 0;
721
+ font-size: 12px;
722
+ color: #475569;
723
+ }
724
+
725
+ .${d}.rte-approval-theme-dark .rte-approval-summary {
726
+ color: #94a3b8;
727
+ }
728
+
729
+ .rte-approval-controls {
730
+ display: flex;
731
+ flex-wrap: wrap;
732
+ gap: 8px;
733
+ }
734
+
735
+ .rte-approval-btn {
736
+ border: 1px solid #cbd5e1;
737
+ background: #f8fafc;
738
+ color: inherit;
739
+ border-radius: 8px;
740
+ padding: 6px 10px;
741
+ font-size: 12px;
742
+ font-weight: 600;
743
+ cursor: pointer;
744
+ }
745
+
746
+ .rte-approval-btn:disabled {
747
+ opacity: 0.5;
748
+ cursor: not-allowed;
749
+ }
750
+
751
+ .rte-approval-btn:hover:not(:disabled),
752
+ .rte-approval-btn:focus-visible:not(:disabled) {
753
+ outline: none;
754
+ border-color: #1d4ed8;
755
+ box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
756
+ }
757
+
758
+ .rte-approval-btn-primary {
759
+ background: #1d4ed8;
760
+ border-color: #1d4ed8;
761
+ color: #ffffff;
762
+ }
763
+
764
+ .rte-approval-btn-primary:hover:not(:disabled),
765
+ .rte-approval-btn-primary:focus-visible:not(:disabled) {
766
+ background: #1e40af;
767
+ border-color: #1e40af;
768
+ }
769
+
770
+ .${d}.rte-approval-theme-dark .rte-approval-btn {
771
+ border-color: #334155;
772
+ background: #0b1220;
773
+ color: #e2e8f0;
774
+ }
775
+
776
+ .${d}.rte-approval-theme-dark .rte-approval-btn-primary {
777
+ border-color: #2563eb;
778
+ background: #2563eb;
779
+ color: #ffffff;
780
+ }
781
+
782
+ .rte-approval-form {
783
+ display: grid;
784
+ grid-template-columns: 1fr;
785
+ gap: 8px;
786
+ border: 1px solid #e2e8f0;
787
+ border-radius: 10px;
788
+ padding: 8px;
789
+ }
790
+
791
+ .${d}.rte-approval-theme-dark .rte-approval-form {
792
+ border-color: #334155;
793
+ }
794
+
795
+ .rte-approval-label {
796
+ display: flex;
797
+ flex-direction: column;
798
+ gap: 4px;
799
+ font-size: 12px;
800
+ font-weight: 600;
801
+ }
802
+
803
+ .rte-approval-field {
804
+ width: 100%;
805
+ box-sizing: border-box;
806
+ min-height: 30px;
807
+ border-radius: 8px;
808
+ border: 1px solid #cbd5e1;
809
+ background: #ffffff;
810
+ color: inherit;
811
+ font-size: 13px;
812
+ padding: 6px 8px;
813
+ }
814
+
815
+ .rte-approval-field:focus-visible {
816
+ outline: none;
817
+ border-color: #1d4ed8;
818
+ box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
819
+ }
820
+
821
+ .${d}.rte-approval-theme-dark .rte-approval-field {
822
+ border-color: #334155;
823
+ background: #0b1220;
824
+ color: #e2e8f0;
825
+ }
826
+
827
+ .rte-approval-section {
828
+ border: 1px solid #e2e8f0;
829
+ border-radius: 10px;
830
+ padding: 8px;
831
+ }
832
+
833
+ .${d}.rte-approval-theme-dark .rte-approval-section {
834
+ border-color: #334155;
835
+ }
836
+
837
+ .rte-approval-section-title {
838
+ margin: 0 0 8px;
839
+ font-size: 12px;
840
+ font-weight: 700;
841
+ }
842
+
843
+ .rte-approval-comments-list,
844
+ .rte-approval-signoffs-list {
845
+ margin: 0;
846
+ padding: 0;
847
+ list-style: none;
848
+ display: flex;
849
+ flex-direction: column;
850
+ gap: 6px;
851
+ max-height: 150px;
852
+ overflow: auto;
853
+ }
854
+
855
+ .rte-approval-item {
856
+ border: 1px solid #dbeafe;
857
+ background: #eff6ff;
858
+ border-radius: 8px;
859
+ padding: 6px;
860
+ }
861
+
862
+ .rte-approval-item-comment {
863
+ border-color: #e2e8f0;
864
+ background: #f8fafc;
865
+ }
866
+
867
+ .${d}.rte-approval-theme-dark .rte-approval-item {
868
+ border-color: #334155;
869
+ background: #111827;
870
+ }
871
+
872
+ .rte-approval-item-head {
873
+ display: flex;
874
+ align-items: center;
875
+ justify-content: space-between;
876
+ gap: 8px;
877
+ margin-bottom: 4px;
878
+ }
879
+
880
+ .rte-approval-item-author {
881
+ font-size: 12px;
882
+ font-weight: 700;
883
+ }
884
+
885
+ .rte-approval-item-time {
886
+ font-size: 11px;
887
+ color: #64748b;
888
+ }
889
+
890
+ .${d}.rte-approval-theme-dark .rte-approval-item-time {
891
+ color: #94a3b8;
892
+ }
893
+
894
+ .rte-approval-item-message {
895
+ margin: 0;
896
+ font-size: 12px;
897
+ line-height: 1.35;
898
+ white-space: pre-wrap;
899
+ }
900
+
901
+ .rte-approval-empty {
902
+ border: 1px dashed #cbd5e1;
903
+ border-radius: 8px;
904
+ padding: 8px;
905
+ font-size: 12px;
906
+ color: #64748b;
907
+ }
908
+
909
+ .${d}.rte-approval-theme-dark .rte-approval-empty {
910
+ border-color: #334155;
911
+ color: #94a3b8;
912
+ }
913
+
914
+ .rte-approval-shortcut {
915
+ margin: 0;
916
+ font-size: 11px;
917
+ color: #64748b;
918
+ }
919
+
920
+ .${d}.rte-approval-theme-dark .rte-approval-shortcut {
921
+ color: #94a3b8;
922
+ }
923
+
924
+ .rte-approval-live {
925
+ position: absolute;
926
+ width: 1px;
927
+ height: 1px;
928
+ margin: -1px;
929
+ padding: 0;
930
+ overflow: hidden;
931
+ clip: rect(0 0 0 0);
932
+ border: 0;
933
+ }
934
+
935
+ @media (max-width: 768px) {
936
+ .${d} {
937
+ left: 10px !important;
938
+ right: 10px;
939
+ top: 10px !important;
940
+ width: auto !important;
941
+ max-height: calc(100vh - 20px);
942
+ }
943
+ }
944
+ `, document.head.appendChild(e);
945
+ }
946
+ const qe = (e = {}) => {
947
+ const t = z(e);
948
+ return He(), {
949
+ name: "approvalWorkflow",
950
+ toolbar: [
951
+ {
952
+ id: "approvalWorkflowGroup",
953
+ label: "Approval",
954
+ type: "group",
955
+ command: "approvalWorkflow",
956
+ items: [
957
+ {
958
+ id: "approvalWorkflow",
959
+ label: "Approval Workflow",
960
+ command: "toggleApprovalWorkflowPanel",
961
+ shortcut: "Mod-Alt-Shift-a",
962
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4" y="5" width="16" height="14" rx="2.5" stroke="currentColor" stroke-width="1.7"/><path d="M8 10h8M8 14h5" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="m16.5 16 1.8 1.8 3.2-3.2" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>'
963
+ },
964
+ {
965
+ id: "approvalRequestReview",
966
+ label: "Request Review",
967
+ command: "requestApprovalReview",
968
+ shortcut: "Mod-Alt-Shift-r",
969
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><circle cx="11" cy="11" r="6.5" stroke="currentColor" stroke-width="1.7"/><path d="M11 8v3l2 2" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M17.5 17.5 20 20" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>'
970
+ },
971
+ {
972
+ id: "approvalApprove",
973
+ label: "Approve",
974
+ command: "approveDocument",
975
+ shortcut: "Mod-Alt-Shift-p",
976
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M5 12.5 9.5 17 19 7.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><rect x="3.8" y="3.8" width="16.4" height="16.4" rx="3" stroke="currentColor" stroke-width="1.4"/></svg>'
977
+ },
978
+ {
979
+ id: "approvalReopen",
980
+ label: "Reopen Draft",
981
+ command: "reopenDraft",
982
+ shortcut: "Mod-Alt-Shift-d",
983
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8 8H4v4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M5 12a7 7 0 1 0 2-4.95" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>'
984
+ }
985
+ ]
986
+ }
987
+ ],
988
+ commands: {
989
+ approvalWorkflow: (o, a) => {
990
+ const r = x(a);
991
+ if (!r)
992
+ return !1;
993
+ const n = p.get(r) || t;
994
+ return p.set(r, n), f(r, n), g = r, A(r), q(r), !0;
995
+ },
996
+ toggleApprovalWorkflowPanel: (o, a) => {
997
+ const r = x(a);
998
+ if (!r)
999
+ return !1;
1000
+ const n = p.get(r) || t;
1001
+ return p.set(r, n), f(r, n), g = r, de(r, typeof o == "boolean" ? o : void 0);
1002
+ },
1003
+ requestApprovalReview: (o, a) => {
1004
+ const r = x(a);
1005
+ if (!r)
1006
+ return !1;
1007
+ const n = p.get(r) || t;
1008
+ p.set(r, n), f(r, n);
1009
+ const l = E(r, "review", n, n.defaultActor);
1010
+ return A(r), l;
1011
+ },
1012
+ approveDocument: (o, a) => {
1013
+ const r = x(a);
1014
+ if (!r)
1015
+ return !1;
1016
+ const n = p.get(r) || t;
1017
+ p.set(r, n), f(r, n);
1018
+ const l = typeof o == "object" && o ? String(o.author || "") : n.defaultActor, s = typeof o == "object" && o ? String(o.comment || "") : typeof o == "string" ? o : "", u = Q(r, n, l, s);
1019
+ return u && A(r), u;
1020
+ },
1021
+ reopenDraft: (o, a) => {
1022
+ const r = x(a);
1023
+ if (!r)
1024
+ return !1;
1025
+ const n = p.get(r) || t;
1026
+ p.set(r, n), f(r, n);
1027
+ const l = E(r, "draft", n, n.defaultActor);
1028
+ return l && A(r), l;
1029
+ },
1030
+ addApprovalComment: (o, a) => {
1031
+ const r = x(a);
1032
+ if (!r)
1033
+ return !1;
1034
+ const n = p.get(r) || t;
1035
+ p.set(r, n), f(r, n);
1036
+ const l = typeof o == "object" && o ? String(o.author || "") : n.defaultActor, s = typeof o == "object" && o ? String(o.message || "") : typeof o == "string" ? o : "", u = ce(r, s, l, n);
1037
+ return u && A(r), u;
1038
+ },
1039
+ setApprovalStatus: (o, a) => {
1040
+ const r = x(a);
1041
+ if (!r || !o)
1042
+ return !1;
1043
+ const n = ne(o), l = p.get(r) || t;
1044
+ p.set(r, l), f(r, l);
1045
+ const s = E(r, n, l, l.defaultActor);
1046
+ return s && A(r), s;
1047
+ },
1048
+ setApprovalWorkflowOptions: (o, a) => {
1049
+ const r = x(a);
1050
+ if (!r || !o || typeof o != "object")
1051
+ return !1;
1052
+ const n = p.get(r) || t, l = z({
1053
+ ...n,
1054
+ ...o,
1055
+ labels: {
1056
+ ...n.labels,
1057
+ ...o.labels || {}
1058
+ },
1059
+ normalizeText: o.normalizeText || n.normalizeText
1060
+ });
1061
+ p.set(r, l);
1062
+ const s = f(r, l);
1063
+ return G(r, s, l), !0;
1064
+ },
1065
+ getApprovalWorkflowState: (o, a) => {
1066
+ const r = x(a);
1067
+ if (!r)
1068
+ return !1;
1069
+ const n = p.get(r) || t;
1070
+ p.set(r, n);
1071
+ const l = f(r, n), s = se(l);
1072
+ if (typeof o == "function")
1073
+ try {
1074
+ o(s);
1075
+ } catch (u) {
1076
+ }
1077
+ return r.__approvalWorkflowState = s, r.dispatchEvent(
1078
+ new CustomEvent("editora:approval-state", {
1079
+ bubbles: !0,
1080
+ detail: {
1081
+ state: s
1082
+ }
1083
+ })
1084
+ ), !0;
1085
+ }
1086
+ },
1087
+ keymap: {
1088
+ "Mod-Alt-Shift-a": "toggleApprovalWorkflowPanel",
1089
+ "Mod-Alt-Shift-A": "toggleApprovalWorkflowPanel",
1090
+ "Mod-Alt-Shift-r": "requestApprovalReview",
1091
+ "Mod-Alt-Shift-R": "requestApprovalReview",
1092
+ "Mod-Alt-Shift-p": "approveDocument",
1093
+ "Mod-Alt-Shift-P": "approveDocument",
1094
+ "Mod-Alt-Shift-d": "reopenDraft",
1095
+ "Mod-Alt-Shift-D": "reopenDraft"
1096
+ },
1097
+ init: function(a) {
1098
+ _ += 1;
1099
+ const r = this && typeof this.__pluginConfig == "object" ? z({ ...t, ...this.__pluginConfig }) : t;
1100
+ Re(r);
1101
+ const n = x(
1102
+ a != null && a.editorElement ? { editorElement: a.editorElement } : void 0,
1103
+ !1
1104
+ );
1105
+ n && (p.set(n, r), f(n, r), g = n, q(n));
1106
+ },
1107
+ destroy: () => {
1108
+ _ = Math.max(0, _ - 1), !(_ > 0) && De();
1109
+ }
1110
+ };
1111
+ };
1112
+ export {
1113
+ qe as ApprovalWorkflowPlugin
1114
+ };
1115
+ //# sourceMappingURL=ApprovalWorkflowPlugin.native-449ce66c.mjs.map