@editora/plugins 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +5 -0
  2. package/dist/_commonjsHelpers-6763f629.js +1 -0
  3. package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +98 -80
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +128 -115
  8. package/dist/anchoredPopover-33f1358d.mjs +109 -0
  9. package/dist/anchoredPopover-8151d535.js +1 -0
  10. package/dist/approval-workflow.cjs.js +40 -40
  11. package/dist/approval-workflow.esm.js +249 -208
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +68 -55
  14. package/dist/blockquote.esm.js +2 -1
  15. package/dist/blocks-library.cjs.js +45 -45
  16. package/dist/blocks-library.esm.js +245 -178
  17. package/dist/capitalization.esm.js +2 -1
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +82 -58
  20. package/dist/citations.cjs.js +37 -37
  21. package/dist/citations.esm.js +512 -439
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +33 -27
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +93 -82
  26. package/dist/code.cjs.js +32 -32
  27. package/dist/code.esm.js +653 -594
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +158 -116
  30. package/dist/conditional-content.cjs.js +90 -90
  31. package/dist/conditional-content.esm.js +432 -371
  32. package/dist/content-rules.cjs.js +7 -7
  33. package/dist/content-rules.esm.js +159 -105
  34. package/dist/data-binding.cjs.js +46 -46
  35. package/dist/data-binding.esm.js +368 -328
  36. package/dist/direction.esm.js +18 -9
  37. package/dist/doc-schema.cjs.js +29 -29
  38. package/dist/doc-schema.esm.js +308 -240
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +5 -4
  41. package/dist/documentManager-25b6203c.mjs +9122 -0
  42. package/dist/documentManager-b69e7054.js +17 -0
  43. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +81 -73
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +77 -65
  48. package/dist/enterprise.cjs.js +1 -1
  49. package/dist/enterprise.esm.js +56 -54
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +47 -39
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +53 -37
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +117 -76
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +92 -70
  58. package/dist/html2canvas.esm-09133e29.js +22 -0
  59. package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +24 -12
  62. package/dist/index-656d224b.js +231 -0
  63. package/dist/index-6a8c48bb.js +1 -0
  64. package/dist/index-d027b7e2.mjs +16859 -0
  65. package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-730f2d98.mjs +5775 -0
  68. package/dist/index.es-dd40173b.js +18 -0
  69. package/dist/index.esm.js +128 -125
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +9 -8
  72. package/dist/jspdf.es.min-90db2c97.js +243 -0
  73. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +24 -11
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +30 -24
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +25 -20
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +61 -59
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +146 -139
  84. package/dist/media-manager.cjs.js +38 -38
  85. package/dist/media-manager.esm.js +325 -308
  86. package/dist/mentions.cjs.js +9 -9
  87. package/dist/mentions.esm.js +286 -238
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +216 -177
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +49 -33
  92. package/dist/pii-redaction.cjs.js +19 -19
  93. package/dist/pii-redaction.esm.js +463 -393
  94. package/dist/preview.esm.js +10 -5
  95. package/dist/print.cjs.js +4 -4
  96. package/dist/print.esm.js +20 -17
  97. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
  98. package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
  99. package/dist/slash-commands.cjs.js +3 -3
  100. package/dist/slash-commands.esm.js +212 -176
  101. package/dist/smart-paste.cjs.js +27 -27
  102. package/dist/smart-paste.esm.js +336 -280
  103. package/dist/special-characters.cjs.js +7 -7
  104. package/dist/special-characters.esm.js +69 -61
  105. package/dist/spell-check.cjs.js +5 -5
  106. package/dist/spell-check.esm.js +123 -97
  107. package/dist/strikethrough.cjs.js +1 -1
  108. package/dist/strikethrough.esm.js +19 -14
  109. package/dist/style.css +1 -0
  110. package/dist/table.cjs.js +4 -4
  111. package/dist/table.esm.js +225 -191
  112. package/dist/template.cjs.js +11 -11
  113. package/dist/template.esm.js +153 -124
  114. package/dist/text-alignment.cjs.js +1 -1
  115. package/dist/text-alignment.esm.js +27 -21
  116. package/dist/text-color.cjs.js +3 -3
  117. package/dist/text-color.esm.js +87 -70
  118. package/dist/track-changes.cjs.js +2 -2
  119. package/dist/track-changes.esm.js +162 -100
  120. package/dist/translation-workflow.cjs.js +74 -74
  121. package/dist/translation-workflow.esm.js +678 -602
  122. package/dist/version-diff.cjs.js +14 -14
  123. package/dist/version-diff.esm.js +157 -128
  124. package/package.json +13 -7
  125. package/LICENSE +0 -21
  126. package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
  127. package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
  128. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  129. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  130. package/dist/documentManager-CTqRftU8.mjs +0 -8369
  131. package/dist/documentManager-Jf0RbSks.js +0 -17
  132. package/dist/html2canvas.esm-B5qzocYs.js +0 -5
  133. package/dist/index-CvJk4DKa.js +0 -221
  134. package/dist/index-D3CycEFU.mjs +0 -16543
  135. package/dist/index-tqLTHcO6.js +0 -1
  136. package/dist/index.es-CE_A4QSm.js +0 -5
  137. package/dist/index.es-DQ78mYYo.mjs +0 -6665
  138. package/dist/jspdf.es.min-BoS80556.js +0 -77
  139. package/dist/plugins.css +0 -1
  140. /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
@@ -1,4 +1,4 @@
1
- const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", Te = "__editoraCommandEditorRoot", ve = "rte-translation-workflow-styles", u = "rte-translation-workflow-panel", y = "translation-workflow", $ = "translationWorkflow", h = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', $e = [
1
+ const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", Te = "__editoraCommandEditorRoot", ve = "rte-translation-workflow-styles", d = "rte-translation-workflow-panel", y = "translation-workflow", v = "translationWorkflow", k = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', $e = [
2
2
  "p",
3
3
  "h1",
4
4
  "h2",
@@ -97,59 +97,63 @@ const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-ed
97
97
  tokenMismatchMessage: "Tokens/placeholders do not match source segment.",
98
98
  untranslatedMessage: "Segment appears untranslated (same as source).",
99
99
  lengthOutOfRangeMessage: "Translation length is outside expected locale range."
100
- }, c = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new Set();
101
- let X = 0, _e = 0, Ae = 0, Fe = 0, k = null, x = null, D = null, z = null, N = null, O = null, I = null, _ = null;
100
+ }, u = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new Set();
101
+ let ee = 0, _e = 0, Ae = 0, Fe = 0, w = null, x = null, N = null, O = null, _ = null, F = null, I = null, W = null;
102
102
  function m(e) {
103
103
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
104
104
  }
105
105
  function We(e) {
106
106
  return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
107
107
  }
108
- function C(e, t, r) {
109
- return Number.isFinite(e) ? Math.max(t, Math.min(r, e)) : t;
108
+ function B(e, n, t) {
109
+ return Number.isFinite(e) ? Math.max(n, Math.min(t, e)) : n;
110
110
  }
111
- function A(e) {
111
+ function E(e) {
112
112
  return (e || "").trim() || "en-US";
113
113
  }
114
- function W(e) {
114
+ function j(e) {
115
115
  return e.trim().toLowerCase();
116
116
  }
117
117
  function Ke(e) {
118
118
  return e.replace(/"/g, "&quot;");
119
119
  }
120
- function Ve(e, t = 120) {
121
- return e.length <= t ? e : `${e.slice(0, Math.max(0, t - 1)).trimEnd()}…`;
120
+ function Ve(e, n = 120) {
121
+ return e.length <= n ? e : `${e.slice(0, Math.max(0, n - 1)).trimEnd()}…`;
122
122
  }
123
123
  function Re(e) {
124
- const t = e.match(/\{\{[^{}]+\}\}|%[A-Z0-9_]+%|\$\{[^{}]+\}/gi);
125
- return !t || t.length === 0 ? [] : t.map((r) => r.trim()).filter(Boolean);
126
- }
127
- function je(e, t) {
128
- const r = Re(e).sort(), n = Re(t).sort();
129
- if (r.length !== n.length) return !1;
130
- for (let a = 0; a < r.length; a += 1)
131
- if (r[a] !== n[a]) return !1;
124
+ const n = e.match(/\{\{[^{}]+\}\}|%[A-Z0-9_]+%|\$\{[^{}]+\}/gi);
125
+ return !n || n.length === 0 ? [] : n.map((t) => t.trim()).filter(Boolean);
126
+ }
127
+ function je(e, n) {
128
+ const t = Re(e).sort(), r = Re(n).sort();
129
+ if (t.length !== r.length)
130
+ return !1;
131
+ for (let a = 0; a < t.length; a += 1)
132
+ if (t[a] !== r[a])
133
+ return !1;
132
134
  return !0;
133
135
  }
134
- function Ue(e, t) {
135
- const r = Array.isArray(t) && t.length > 0 ? t : Ee, n = [], a = /* @__PURE__ */ new Set();
136
- return r.forEach((o) => {
137
- const l = W(o.locale || "");
138
- if (!l) return;
136
+ function Ue(e, n) {
137
+ const t = Array.isArray(n) && n.length > 0 ? n : Ee, r = [], a = /* @__PURE__ */ new Set();
138
+ return t.forEach((o) => {
139
+ const l = j(o.locale || "");
140
+ if (!l)
141
+ return;
139
142
  const s = l;
140
- a.has(s) || (a.add(s), n.push({
143
+ a.has(s) || (a.add(s), r.push({
141
144
  locale: s,
142
145
  label: (o.label || l).trim() || l,
143
- minLengthRatio: C(Number(o.minLengthRatio ?? 0.5), 0.1, 3),
144
- maxLengthRatio: C(Number(o.maxLengthRatio ?? 1.8), 0.2, 4),
146
+ minLengthRatio: B(Number(o.minLengthRatio ?? 0.5), 0.1, 3),
147
+ maxLengthRatio: B(Number(o.maxLengthRatio ?? 1.8), 0.2, 4),
145
148
  requireDifferentFromSource: o.requireDifferentFromSource !== !1,
146
149
  preserveTokens: o.preserveTokens !== !1
147
150
  }));
148
151
  }), e.forEach((o) => {
149
- const l = W(o);
150
- if (a.has(l)) return;
152
+ const l = j(o);
153
+ if (a.has(l))
154
+ return;
151
155
  const s = Ee.find((i) => l.startsWith(i.locale));
152
- n.push(
156
+ r.push(
153
157
  s ? { ...s, locale: l, label: o } : {
154
158
  locale: l,
155
159
  label: o,
@@ -159,32 +163,33 @@ function Ue(e, t) {
159
163
  preserveTokens: !0
160
164
  }
161
165
  );
162
- }), n;
166
+ }), r;
163
167
  }
164
- function oe(e = {}) {
165
- const t = e.normalizeText || We, r = A(e.sourceLocale || "en-US"), n = A(e.targetLocale || "fr-FR"), a = /* @__PURE__ */ new Set([r, n]);
168
+ function ae(e = {}) {
169
+ const n = e.normalizeText || We, t = E(e.sourceLocale || "en-US"), r = E(e.targetLocale || "fr-FR"), a = /* @__PURE__ */ new Set([t, r]);
166
170
  (Array.isArray(e.locales) ? e.locales : []).forEach((s) => {
167
- if (typeof s != "string") return;
168
- const i = A(s);
169
- a.add(i);
171
+ if (typeof s != "string")
172
+ return;
173
+ const i = E(s);
174
+ i && a.add(i);
170
175
  });
171
176
  const o = Array.from(a), l = Ue(o, e.localeRules);
172
177
  return {
173
- sourceLocale: r,
174
- targetLocale: n,
178
+ sourceLocale: t,
179
+ targetLocale: r,
175
180
  locales: o,
176
181
  localeRules: l,
177
182
  enableRealtime: e.enableRealtime !== !1,
178
- debounceMs: C(Number(e.debounceMs ?? 260), 60, 2e3),
179
- maxIssues: C(Number(e.maxIssues ?? 120), 5, 1e3),
180
- maxSegments: C(Number(e.maxSegments ?? 600), 20, 3e3),
181
- minSourceLengthForRatio: C(Number(e.minSourceLengthForRatio ?? 8), 2, 100),
183
+ debounceMs: B(Number(e.debounceMs ?? 260), 60, 2e3),
184
+ maxIssues: B(Number(e.maxIssues ?? 120), 5, 1e3),
185
+ maxSegments: B(Number(e.maxSegments ?? 600), 20, 3e3),
186
+ minSourceLengthForRatio: B(Number(e.minSourceLengthForRatio ?? 8), 2, 100),
182
187
  segmentSelector: (e.segmentSelector || $e).trim() || $e,
183
188
  labels: {
184
189
  ...Oe,
185
190
  ...e.labels || {}
186
191
  },
187
- normalizeText: t
192
+ normalizeText: n
188
193
  };
189
194
  }
190
195
  function Ge(e) {
@@ -192,13 +197,13 @@ function Ge(e) {
192
197
  sourceLocale: e.sourceLocale,
193
198
  targetLocale: e.targetLocale,
194
199
  locales: [...e.locales],
195
- localeRules: e.localeRules.map((t) => ({
196
- locale: t.locale,
197
- label: t.label,
198
- minLengthRatio: t.minLengthRatio,
199
- maxLengthRatio: t.maxLengthRatio,
200
- requireDifferentFromSource: t.requireDifferentFromSource,
201
- preserveTokens: t.preserveTokens
200
+ localeRules: e.localeRules.map((n) => ({
201
+ locale: n.locale,
202
+ label: n.label,
203
+ minLengthRatio: n.minLengthRatio,
204
+ maxLengthRatio: n.maxLengthRatio,
205
+ requireDifferentFromSource: n.requireDifferentFromSource,
206
+ preserveTokens: n.preserveTokens
202
207
  })),
203
208
  enableRealtime: e.enableRealtime,
204
209
  debounceMs: e.debounceMs,
@@ -210,164 +215,186 @@ function Ge(e) {
210
215
  normalizeText: e.normalizeText
211
216
  };
212
217
  }
213
- function xe(e) {
218
+ function we(e) {
214
219
  return e.closest(ke) || e;
215
220
  }
216
- function K(e) {
217
- if (!e) return null;
218
- if (e.matches(S)) return e;
219
- const t = e.querySelector(S);
220
- return t instanceof HTMLElement ? t : null;
221
+ function U(e) {
222
+ if (!e)
223
+ return null;
224
+ if (e.matches(S))
225
+ return e;
226
+ const n = e.querySelector(S);
227
+ return n instanceof HTMLElement ? n : null;
221
228
  }
222
229
  function Ye() {
223
- if (typeof window > "u") return null;
230
+ if (typeof window > "u")
231
+ return null;
224
232
  const e = window[Te];
225
- if (!(e instanceof HTMLElement)) return null;
233
+ if (!(e instanceof HTMLElement))
234
+ return null;
226
235
  window[Te] = null;
227
- const t = K(e);
228
- if (t) return t;
229
- const r = e.closest(ke);
230
- if (r) {
231
- const a = K(r);
232
- if (a) return a;
236
+ const n = U(e);
237
+ if (n)
238
+ return n;
239
+ const t = e.closest(ke);
240
+ if (t) {
241
+ const a = U(t);
242
+ if (a)
243
+ return a;
233
244
  }
234
- const n = e.closest(S);
235
- return n instanceof HTMLElement ? n : null;
245
+ const r = e.closest(S);
246
+ return r instanceof HTMLElement ? r : null;
236
247
  }
237
248
  function Ze(e) {
238
- const t = e.closest("[data-editora-editor]");
239
- if (t && K(t) === e)
240
- return t;
241
- let r = e;
242
- for (; r; ) {
243
- if (r.matches(ke) && (r === e || K(r) === e))
244
- return r;
245
- r = r.parentElement;
249
+ const n = e.closest("[data-editora-editor]");
250
+ if (n && U(n) === e)
251
+ return n;
252
+ let t = e;
253
+ for (; t; ) {
254
+ if (t.matches(ke) && (t === e || U(t) === e))
255
+ return t;
256
+ t = t.parentElement;
246
257
  }
247
- return xe(e);
258
+ return we(e);
248
259
  }
249
260
  function Ce(e) {
250
261
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
251
262
  }
252
- function ee(e) {
263
+ function te(e) {
253
264
  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;
254
265
  }
255
266
  function Je(e) {
256
- const t = xe(e);
257
- if (ee(t)) return !0;
258
- const r = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
259
- return ee(r) ? !0 : ee(document.documentElement) || ee(document.body);
267
+ const n = we(e);
268
+ if (te(n))
269
+ return !0;
270
+ const t = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
271
+ return te(t) ? !0 : te(document.documentElement) || te(document.body);
260
272
  }
261
- function ge(e, t) {
262
- e.classList.remove("rte-translation-workflow-theme-dark"), Je(t) && e.classList.add("rte-translation-workflow-theme-dark");
273
+ function ge(e, n) {
274
+ e.classList.remove("rte-translation-workflow-theme-dark"), Je(n) && e.classList.add("rte-translation-workflow-theme-dark");
263
275
  }
264
276
  function Qe(e) {
265
- for (let t = 0; t < e.length; t += 1) {
266
- const r = e[t];
267
- if (!(r.type !== "childList" || r.removedNodes.length === 0))
268
- for (let n = 0; n < r.removedNodes.length; n += 1) {
269
- const a = r.removedNodes[n];
270
- if (a.nodeType !== Node.ELEMENT_NODE) continue;
271
- const o = a;
272
- if (o.matches?.(S) || o.matches?.(`.${u}`) || o.querySelector?.(S) || o.querySelector?.(`.${u}`))
277
+ var n, t, r, a;
278
+ for (let o = 0; o < e.length; o += 1) {
279
+ const l = e[o];
280
+ if (!(l.type !== "childList" || l.removedNodes.length === 0))
281
+ for (let s = 0; s < l.removedNodes.length; s += 1) {
282
+ const i = l.removedNodes[s];
283
+ if (i.nodeType !== Node.ELEMENT_NODE)
284
+ continue;
285
+ const c = i;
286
+ if ((n = c.matches) != null && n.call(c, S) || (t = c.matches) != null && t.call(c, `.${d}`) || (r = c.querySelector) != null && r.call(c, S) || (a = c.querySelector) != null && a.call(c, `.${d}`))
273
287
  return !0;
274
288
  }
275
289
  }
276
290
  return !1;
277
291
  }
278
- function ae() {
279
- Array.from(U).forEach((t) => {
280
- t.isConnected || Se(t);
292
+ function le() {
293
+ Array.from(Z).forEach((n) => {
294
+ n.isConnected || Se(n);
281
295
  });
282
296
  }
283
- function T(e, t = !0, r = !0) {
284
- if (ae(), e?.contentElement instanceof HTMLElement) return e.contentElement;
285
- if (e?.editorElement instanceof HTMLElement) {
286
- const s = K(e.editorElement);
287
- if (s) return s;
297
+ function T(e, n = !0, t = !0) {
298
+ var s;
299
+ if (le(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
300
+ return e.contentElement;
301
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
302
+ const i = U(e.editorElement);
303
+ if (i)
304
+ return i;
288
305
  }
289
- const n = Ye();
290
- if (n) return n;
306
+ const r = Ye();
307
+ if (r)
308
+ return r;
291
309
  const a = window.getSelection();
292
310
  if (a && a.rangeCount > 0) {
293
- const s = Ce(a.getRangeAt(0).startContainer)?.closest(
311
+ const i = (s = Ce(a.getRangeAt(0).startContainer)) == null ? void 0 : s.closest(
294
312
  S
295
313
  );
296
- if (s) return s;
314
+ if (i)
315
+ return i;
297
316
  }
298
317
  const o = document.activeElement;
299
318
  if (o) {
300
- if (o.matches(S)) return o;
301
- const s = o.closest(S);
302
- if (s) return s;
319
+ if (o.matches(S))
320
+ return o;
321
+ const i = o.closest(S);
322
+ if (i)
323
+ return i;
303
324
  }
304
- if (r && x && x.isConnected)
325
+ if (t && x && x.isConnected)
305
326
  return x;
306
- if (!t) return null;
327
+ if (!n)
328
+ return null;
307
329
  const l = document.querySelector(S);
308
330
  return l instanceof HTMLElement ? l : null;
309
331
  }
310
332
  function Xe(e) {
311
- const t = e.target;
333
+ const n = e.target;
334
+ if (n) {
335
+ const r = n.closest(`.${d}`);
336
+ if (r) {
337
+ const o = Array.from(p.entries()).find(([, l]) => l === r);
338
+ if (o)
339
+ return o[0];
340
+ }
341
+ const a = n.closest(S);
342
+ if (a)
343
+ return a;
344
+ }
345
+ const t = document.activeElement;
312
346
  if (t) {
313
- const n = t.closest(`.${u}`);
314
- if (n) {
315
- const o = Array.from(p.entries()).find(([, l]) => l === n);
316
- if (o) return o[0];
347
+ const r = t.closest(`.${d}`);
348
+ if (r) {
349
+ const o = Array.from(p.entries()).find(([, l]) => l === r);
350
+ if (o)
351
+ return o[0];
317
352
  }
318
353
  const a = t.closest(S);
319
- if (a) return a;
320
- }
321
- const r = document.activeElement;
322
- if (r) {
323
- const n = r.closest(`.${u}`);
324
- if (n) {
325
- const o = Array.from(p.entries()).find(([, l]) => l === n);
326
- if (o) return o[0];
327
- }
328
- const a = r.closest(S);
329
- if (a) return a;
354
+ if (a)
355
+ return a;
330
356
  }
331
357
  return null;
332
358
  }
333
- function fe(e, t, r) {
334
- const n = Ze(e);
359
+ function fe(e, n, t) {
360
+ const r = Ze(e);
335
361
  Array.from(
336
- n.querySelectorAll(
337
- `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
362
+ r.querySelectorAll(
363
+ `.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`
338
364
  )
339
365
  ).forEach((o) => {
340
- o.classList.toggle("active", r), o.setAttribute("data-active", r ? "true" : "false"), o.setAttribute("aria-pressed", r ? "true" : "false");
366
+ o.classList.toggle("active", t), o.setAttribute("data-active", t ? "true" : "false"), o.setAttribute("aria-pressed", t ? "true" : "false");
341
367
  });
342
368
  }
343
- function we(e) {
344
- const t = le.get(e);
345
- typeof t == "number" && (window.clearTimeout(t), le.delete(e));
346
- }
347
- function et(e, t) {
348
- const r = W(t), n = e.localeRules.find((l) => W(l.locale) === r);
349
- if (n) return n;
350
- const a = r.split("-")[0], o = e.localeRules.find((l) => W(l.locale).split("-")[0] === a);
369
+ function xe(e) {
370
+ const n = se.get(e);
371
+ typeof n == "number" && (window.clearTimeout(n), se.delete(e));
372
+ }
373
+ function et(e, n) {
374
+ const t = j(n), r = e.localeRules.find((l) => j(l.locale) === t);
375
+ if (r)
376
+ return r;
377
+ const a = t.split("-")[0], o = e.localeRules.find((l) => j(l.locale).split("-")[0] === a);
351
378
  return o || {
352
- locale: r,
353
- label: t,
379
+ locale: t,
380
+ label: n,
354
381
  minLengthRatio: 0.5,
355
382
  maxLengthRatio: 1.8,
356
383
  requireDifferentFromSource: !0,
357
384
  preserveTokens: !0
358
385
  };
359
386
  }
360
- function te(e, t, r, n = {}) {
387
+ function ne(e, n, t, r = {}) {
361
388
  return Ae += 1, {
362
389
  id: `translation-workflow-issue-${Ae}`,
363
390
  type: e,
364
- severity: t,
365
- message: r,
366
- ...n
391
+ severity: n,
392
+ message: t,
393
+ ...r
367
394
  };
368
395
  }
369
- function ie(e, t) {
370
- if (t) {
396
+ function ce(e, n) {
397
+ if (n) {
371
398
  e.hasAttribute("data-translation-prev-contenteditable") || e.setAttribute(
372
399
  "data-translation-prev-contenteditable",
373
400
  e.hasAttribute("contenteditable") && e.getAttribute("contenteditable") || "inherit"
@@ -375,101 +402,107 @@ function ie(e, t) {
375
402
  return;
376
403
  }
377
404
  if (e.removeAttribute("data-translation-locked"), e.removeAttribute("aria-readonly"), e.classList.remove("rte-translation-segment-locked"), e.hasAttribute("data-translation-prev-contenteditable")) {
378
- const r = e.getAttribute("data-translation-prev-contenteditable") || "";
379
- r === "inherit" ? e.setAttribute("contenteditable", "true") : e.setAttribute("contenteditable", r), e.removeAttribute("data-translation-prev-contenteditable");
405
+ const t = e.getAttribute("data-translation-prev-contenteditable") || "";
406
+ t === "inherit" ? e.setAttribute("contenteditable", "true") : e.setAttribute("contenteditable", t), e.removeAttribute("data-translation-prev-contenteditable");
380
407
  } else
381
408
  e.setAttribute("contenteditable", "true");
382
409
  }
383
- function ce(e, t) {
384
- return e.querySelector(`[data-translation-segment-id="${Ke(t)}"]`);
410
+ function ue(e, n) {
411
+ return e.querySelector(`[data-translation-segment-id="${Ke(n)}"]`);
385
412
  }
386
413
  function He(e) {
387
- const t = window.getSelection();
388
- if (!t || t.rangeCount === 0) return null;
389
- const r = Ce(t.getRangeAt(0).startContainer);
390
- return !r || !e.contains(r) ? null : r.closest("[data-translation-segment-id]");
391
- }
392
- function tt(e, t) {
393
- const r = Array.from(e.querySelectorAll(t));
394
- if (r.length <= 1) return r;
395
- const n = new Set(r);
396
- return r.filter((a) => {
414
+ const n = window.getSelection();
415
+ if (!n || n.rangeCount === 0)
416
+ return null;
417
+ const t = Ce(n.getRangeAt(0).startContainer);
418
+ return !t || !e.contains(t) ? null : t.closest("[data-translation-segment-id]");
419
+ }
420
+ function tt(e, n) {
421
+ const t = Array.from(e.querySelectorAll(n));
422
+ if (t.length <= 1)
423
+ return t;
424
+ const r = new Set(t);
425
+ return t.filter((a) => {
397
426
  let o = a.parentElement;
398
427
  for (; o && o !== e; ) {
399
- if (n.has(o))
428
+ if (r.has(o))
400
429
  return !1;
401
430
  o = o.parentElement;
402
431
  }
403
432
  return !0;
404
433
  });
405
434
  }
406
- function nt(e, t, r) {
407
- let n = (r || "").trim();
408
- if (!n || t.has(n)) {
435
+ function nt(e, n, t) {
436
+ let r = (t || "").trim();
437
+ if (!r || n.has(r)) {
409
438
  do
410
- n = `translation-segment-${_e++}`;
411
- while (t.has(n));
412
- e.setAttribute("data-translation-segment-id", n);
439
+ r = `translation-segment-${_e++}`;
440
+ while (n.has(r));
441
+ e.setAttribute("data-translation-segment-id", r);
413
442
  }
414
- return n;
415
- }
416
- function me(e, t) {
417
- if (t.lockedSegmentIds.size === 0) return !1;
418
- let r = !1;
419
- return t.lockedSegmentIds.forEach((n) => {
420
- const a = ce(e, n);
421
- if (!a) return;
422
- ie(a, !0);
423
- const o = t.lockedHtmlBySegmentId.get(n);
443
+ return r;
444
+ }
445
+ function me(e, n) {
446
+ if (n.lockedSegmentIds.size === 0)
447
+ return !1;
448
+ let t = !1;
449
+ return n.lockedSegmentIds.forEach((r) => {
450
+ const a = ue(e, r);
451
+ if (!a)
452
+ return;
453
+ ce(a, !0);
454
+ const o = n.lockedHtmlBySegmentId.get(r);
424
455
  if (typeof o == "string") {
425
- a.innerHTML !== o && (a.innerHTML = o, r = !0);
456
+ a.innerHTML !== o && (a.innerHTML = o, t = !0);
426
457
  return;
427
458
  }
428
- t.lockedHtmlBySegmentId.set(n, a.innerHTML);
429
- }), r;
430
- }
431
- function M(e, t, r) {
432
- const n = tt(e, t.segmentSelector), a = [], o = /* @__PURE__ */ new Set();
433
- for (let l = 0; l < n.length && !(a.length >= t.maxSegments); l += 1) {
434
- const s = n[l], i = nt(s, o, s.getAttribute("data-translation-segment-id")), d = r.lockedSegmentIds.has(i), g = s.getAttribute("data-translation-locked") === "true", w = d || g;
435
- if (w)
436
- if (r.lockedSegmentIds.add(i), ie(s, !0), !r.lockedHtmlBySegmentId.has(i))
437
- r.lockedHtmlBySegmentId.set(i, s.innerHTML);
459
+ n.lockedHtmlBySegmentId.set(r, a.innerHTML);
460
+ }), t;
461
+ }
462
+ function M(e, n, t) {
463
+ var l;
464
+ const r = tt(e, n.segmentSelector), a = [], o = /* @__PURE__ */ new Set();
465
+ for (let s = 0; s < r.length && !(a.length >= n.maxSegments); s += 1) {
466
+ const i = r[s], c = nt(i, o, i.getAttribute("data-translation-segment-id")), g = t.lockedSegmentIds.has(c), h = i.getAttribute("data-translation-locked") === "true", R = g || h;
467
+ if (R)
468
+ if (t.lockedSegmentIds.add(c), ce(i, !0), !t.lockedHtmlBySegmentId.has(c))
469
+ t.lockedHtmlBySegmentId.set(c, i.innerHTML);
438
470
  else {
439
- const B = r.lockedHtmlBySegmentId.get(i) || "";
440
- s.innerHTML !== B && (s.innerHTML = B);
471
+ const H = t.lockedHtmlBySegmentId.get(c) || "";
472
+ i.innerHTML !== H && (i.innerHTML = H);
441
473
  }
442
474
  else
443
- r.lockedHtmlBySegmentId.delete(i);
444
- const v = t.normalizeText(s.textContent || "");
445
- if (!v) continue;
446
- r.sourceTextBySegmentId.has(i) || r.sourceTextBySegmentId.set(i, v);
447
- const G = r.sourceTextBySegmentId.get(i) || v;
475
+ t.lockedHtmlBySegmentId.delete(c);
476
+ const C = n.normalizeText(i.textContent || "");
477
+ if (!C)
478
+ continue;
479
+ t.sourceTextBySegmentId.has(c) || t.sourceTextBySegmentId.set(c, C);
480
+ const K = t.sourceTextBySegmentId.get(c) || C;
448
481
  a.push({
449
- id: i,
450
- tagName: s.tagName.toLowerCase(),
482
+ id: c,
483
+ tagName: i.tagName.toLowerCase(),
451
484
  index: a.length,
452
- text: v,
453
- sourceText: G,
454
- locked: w
455
- }), o.add(i);
485
+ text: C,
486
+ sourceText: K,
487
+ locked: R
488
+ }), o.add(c);
456
489
  }
457
- return Array.from(r.sourceTextBySegmentId.keys()).forEach((l) => {
458
- o.has(l) || r.sourceTextBySegmentId.delete(l);
459
- }), Array.from(r.lockedSegmentIds.keys()).forEach((l) => {
460
- o.has(l) || r.lockedSegmentIds.delete(l);
461
- }), Array.from(r.lockedHtmlBySegmentId.keys()).forEach((l) => {
462
- (!o.has(l) || !r.lockedSegmentIds.has(l)) && r.lockedHtmlBySegmentId.delete(l);
463
- }), (!r.selectedSegmentId || !a.some((l) => l.id === r.selectedSegmentId)) && (r.selectedSegmentId = a[0]?.id || null), a;
464
- }
465
- function b(e, t) {
466
- c.has(e) || c.set(e, t);
467
- let r = q.get(e);
468
- return r || (r = {
469
- sourceLocale: t.sourceLocale,
470
- targetLocale: t.targetLocale,
490
+ return Array.from(t.sourceTextBySegmentId.keys()).forEach((s) => {
491
+ o.has(s) || t.sourceTextBySegmentId.delete(s);
492
+ }), Array.from(t.lockedSegmentIds.keys()).forEach((s) => {
493
+ o.has(s) || t.lockedSegmentIds.delete(s);
494
+ }), Array.from(t.lockedHtmlBySegmentId.keys()).forEach((s) => {
495
+ (!o.has(s) || !t.lockedSegmentIds.has(s)) && t.lockedHtmlBySegmentId.delete(s);
496
+ }), (!t.selectedSegmentId || !a.some((s) => s.id === t.selectedSegmentId)) && (t.selectedSegmentId = ((l = a[0]) == null ? void 0 : l.id) || null), a;
497
+ }
498
+ function b(e, n) {
499
+ u.has(e) || u.set(e, n);
500
+ let t = D.get(e);
501
+ return t || (t = {
502
+ sourceLocale: n.sourceLocale,
503
+ targetLocale: n.targetLocale,
471
504
  selectedSegmentId: null,
472
- realtimeEnabled: t.enableRealtime,
505
+ realtimeEnabled: n.enableRealtime,
473
506
  segments: [],
474
507
  issues: [],
475
508
  sourceTextBySegmentId: /* @__PURE__ */ new Map(),
@@ -477,40 +510,41 @@ function b(e, t) {
477
510
  lockedHtmlBySegmentId: /* @__PURE__ */ new Map(),
478
511
  snapshot: "",
479
512
  lastRunAt: null
480
- }, q.set(e, r)), U.add(e), r;
513
+ }, D.set(e, t)), Z.add(e), t;
481
514
  }
482
515
  function Se(e) {
483
- we(e);
484
- const t = p.get(e);
485
- t && t.remove(), p.delete(e), j.delete(e);
486
- const r = q.get(e);
487
- r && (r.lockedSegmentIds.forEach((n) => {
488
- const a = ce(e, n);
489
- a && ie(a, !1);
490
- }), r.lockedHtmlBySegmentId.clear()), c.delete(e), re.delete(e), q.delete(e), U.delete(e), x === e && (x = null);
516
+ xe(e);
517
+ const n = p.get(e);
518
+ n && n.remove(), p.delete(e), Y.delete(e);
519
+ const t = D.get(e);
520
+ t && (t.lockedSegmentIds.forEach((r) => {
521
+ const a = ue(e, r);
522
+ a && ce(a, !1);
523
+ }), t.lockedHtmlBySegmentId.clear()), u.delete(e), oe.delete(e), D.delete(e), Z.delete(e), x === e && (x = null);
491
524
  }
492
525
  function ye(e) {
493
- return j.get(e) === !0;
526
+ return Y.get(e) === !0;
494
527
  }
495
- function be(e, t) {
496
- if (!t.classList.contains("show")) return;
497
- const r = xe(e).getBoundingClientRect(), n = Math.min(window.innerWidth - 20, 520), a = Math.max(10, window.innerWidth - n - 10), o = Math.min(Math.max(10, r.right - n), a), l = Math.max(10, Math.min(window.innerHeight - 10, r.top + 12));
498
- t.style.width = `${n}px`, t.style.left = `${o}px`, t.style.top = `${l}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
528
+ function be(e, n) {
529
+ if (!n.classList.contains("show"))
530
+ return;
531
+ const t = we(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 520), a = Math.max(10, window.innerWidth - r - 10), o = Math.min(Math.max(10, t.right - r), a), l = Math.max(10, Math.min(window.innerHeight - 10, t.top + 12));
532
+ n.style.width = `${r}px`, n.style.left = `${o}px`, n.style.top = `${l}px`, n.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
499
533
  }
500
- function H(e, t) {
501
- const r = e.querySelector(".rte-translation-live");
502
- r && (r.textContent = t);
534
+ function P(e, n) {
535
+ const t = e.querySelector(".rte-translation-live");
536
+ t && (t.textContent = n);
503
537
  }
504
- function rt(e, t) {
505
- return `${e.innerHTML}::${t.sourceLocale}::${t.targetLocale}::${Array.from(t.lockedSegmentIds).sort().join("|")}`;
538
+ function rt(e, n) {
539
+ return `${e.innerHTML}::${n.sourceLocale}::${n.targetLocale}::${Array.from(n.lockedSegmentIds).sort().join("|")}`;
506
540
  }
507
- function ot(e, t, r) {
508
- const n = [], a = et(r, t.targetLocale);
509
- for (let o = 0; o < e.length && !(n.length >= r.maxIssues); o += 1) {
510
- const l = e[o], s = r.normalizeText(l.sourceText || ""), i = r.normalizeText(l.text || "");
541
+ function ot(e, n, t) {
542
+ const r = [], a = et(t, n.targetLocale);
543
+ for (let o = 0; o < e.length && !(r.length >= t.maxIssues); o += 1) {
544
+ const l = e[o], s = t.normalizeText(l.sourceText || ""), i = t.normalizeText(l.text || "");
511
545
  if (!i) {
512
- n.push(
513
- te("missing-target", "error", r.labels.missingTargetMessage, {
546
+ r.push(
547
+ ne("missing-target", "error", t.labels.missingTargetMessage, {
514
548
  segmentId: l.id,
515
549
  sourceText: s,
516
550
  targetText: i,
@@ -519,26 +553,26 @@ function ot(e, t, r) {
519
553
  );
520
554
  continue;
521
555
  }
522
- if (a.preserveTokens && s && !je(s, i) && (n.push(
523
- te("token-mismatch", "error", r.labels.tokenMismatchMessage, {
556
+ if (a.preserveTokens && s && !je(s, i) && (r.push(
557
+ ne("token-mismatch", "error", t.labels.tokenMismatchMessage, {
524
558
  segmentId: l.id,
525
559
  sourceText: s,
526
560
  targetText: i,
527
561
  suggestion: "Preserve placeholders/tokens exactly (for example {{name}}, %ID%, ${value})."
528
562
  })
529
- ), n.length >= r.maxIssues) || a.requireDifferentFromSource && s && r.normalizeText(s) === r.normalizeText(i) && (n.push(
530
- te("untranslated", "warning", r.labels.untranslatedMessage, {
563
+ ), r.length >= t.maxIssues) || a.requireDifferentFromSource && s && t.normalizeText(s) === t.normalizeText(i) && (r.push(
564
+ ne("untranslated", "warning", t.labels.untranslatedMessage, {
531
565
  segmentId: l.id,
532
566
  sourceText: s,
533
567
  targetText: i,
534
568
  suggestion: "Translate the segment or mark it intentionally unchanged."
535
569
  })
536
- ), n.length >= r.maxIssues))
570
+ ), r.length >= t.maxIssues))
537
571
  break;
538
- if (s.length >= r.minSourceLengthForRatio) {
539
- const d = i.length / Math.max(1, s.length);
540
- (d < a.minLengthRatio || d > a.maxLengthRatio) && n.push(
541
- te("length-out-of-range", "warning", r.labels.lengthOutOfRangeMessage, {
572
+ if (s.length >= t.minSourceLengthForRatio) {
573
+ const c = i.length / Math.max(1, s.length);
574
+ (c < a.minLengthRatio || c > a.maxLengthRatio) && r.push(
575
+ ne("length-out-of-range", "warning", t.labels.lengthOutOfRangeMessage, {
542
576
  segmentId: l.id,
543
577
  sourceText: s,
544
578
  targetText: i,
@@ -547,80 +581,83 @@ function ot(e, t, r) {
547
581
  );
548
582
  }
549
583
  }
550
- return n;
584
+ return r;
551
585
  }
552
586
  function qe(e) {
553
- const t = c.get(e) || k, r = q.get(e);
587
+ const n = u.get(e) || w, t = D.get(e);
554
588
  return {
555
- sourceLocale: r?.sourceLocale || t?.sourceLocale || "en-US",
556
- targetLocale: r?.targetLocale || t?.targetLocale || "fr-FR",
557
- realtimeEnabled: r?.realtimeEnabled === !0,
558
- selectedSegmentId: r?.selectedSegmentId || null,
559
- segmentCount: r?.segments.length || 0,
560
- lockedSegmentCount: r ? r.segments.filter((n) => n.locked).length : 0,
561
- issues: r?.issues ? r.issues.map((n) => ({ ...n })) : [],
562
- segments: r?.segments.map((n) => ({
563
- id: n.id,
564
- tagName: n.tagName,
565
- index: n.index,
566
- sourceLength: n.sourceText.length,
567
- targetLength: n.text.length,
568
- locked: n.locked
569
- })) || [],
570
- lastRunAt: r?.lastRunAt || null
589
+ sourceLocale: (t == null ? void 0 : t.sourceLocale) || (n == null ? void 0 : n.sourceLocale) || "en-US",
590
+ targetLocale: (t == null ? void 0 : t.targetLocale) || (n == null ? void 0 : n.targetLocale) || "fr-FR",
591
+ realtimeEnabled: (t == null ? void 0 : t.realtimeEnabled) === !0,
592
+ selectedSegmentId: (t == null ? void 0 : t.selectedSegmentId) || null,
593
+ segmentCount: (t == null ? void 0 : t.segments.length) || 0,
594
+ lockedSegmentCount: t ? t.segments.filter((r) => r.locked).length : 0,
595
+ issues: t != null && t.issues ? t.issues.map((r) => ({ ...r })) : [],
596
+ segments: (t == null ? void 0 : t.segments.map((r) => ({
597
+ id: r.id,
598
+ tagName: r.tagName,
599
+ index: r.index,
600
+ sourceLength: r.sourceText.length,
601
+ targetLength: r.text.length,
602
+ locked: r.locked
603
+ }))) || [],
604
+ lastRunAt: (t == null ? void 0 : t.lastRunAt) || null
571
605
  };
572
606
  }
573
- function E(e) {
574
- const t = q.get(e), r = t && t.selectedSegmentId ? t.segments.find((n) => n.id === t.selectedSegmentId) : null;
575
- fe(e, "toggleTranslationWorkflowPanel", ye(e)), fe(e, "toggleTranslationRealtime", t?.realtimeEnabled === !0), fe(e, "toggleTranslationSegmentLock", r?.locked === !0);
607
+ function $(e) {
608
+ const n = D.get(e), t = n && n.selectedSegmentId ? n.segments.find((r) => r.id === n.selectedSegmentId) : null;
609
+ fe(e, "toggleTranslationWorkflowPanel", ye(e)), fe(e, "toggleTranslationRealtime", (n == null ? void 0 : n.realtimeEnabled) === !0), fe(e, "toggleTranslationSegmentLock", (t == null ? void 0 : t.locked) === !0);
576
610
  }
577
- function at(e, t) {
578
- const r = ce(e, t);
579
- if (!r) return;
611
+ function at(e, n) {
612
+ const t = ue(e, n);
613
+ if (!t)
614
+ return;
580
615
  try {
581
- r.scrollIntoView({ block: "nearest", inline: "nearest" });
616
+ t.scrollIntoView({ block: "nearest", inline: "nearest" });
582
617
  } catch {
583
618
  }
584
- const n = window.getSelection();
585
- if (!(!n || typeof document.createRange != "function"))
619
+ const r = window.getSelection();
620
+ if (!(!r || typeof document.createRange != "function"))
586
621
  try {
587
622
  const a = document.createRange();
588
- a.selectNodeContents(r), a.collapse(!0), n.removeAllRanges(), n.addRange(a), e.focus({ preventScroll: !0 });
623
+ a.selectNodeContents(t), a.collapse(!0), r.removeAllRanges(), r.addRange(a), e.focus({ preventScroll: !0 });
589
624
  } catch {
590
625
  }
591
626
  }
592
- function R(e) {
593
- const t = p.get(e);
594
- if (!t) return;
595
- const r = c.get(e) || k;
596
- if (!r) return;
597
- const n = b(e, r), a = t.querySelector(".rte-translation-source-label");
598
- a && (a.textContent = r.labels.sourceLocaleLabel);
599
- const o = t.querySelector(".rte-translation-target-label");
600
- o && (o.textContent = r.labels.targetLocaleLabel);
601
- const l = t.querySelector('[data-field="source-locale"]'), s = t.querySelector('[data-field="target-locale"]'), i = r.locales.map((f) => `<option value="${m(f)}">${m(f)}</option>`).join("");
602
- l && (l.innerHTML = i, l.value = n.sourceLocale), s && (s.innerHTML = i, s.value = n.targetLocale);
603
- const d = t.querySelector(".rte-translation-summary");
604
- if (d) {
605
- const f = n.issues.length, P = n.selectedSegmentId ? ` • ${r.labels.selectedSegmentPrefix}: ${n.selectedSegmentId}` : "";
606
- d.textContent = `${r.labels.summaryPrefix}: ${n.sourceLocale} → ${n.targetLocale} • ${f} issue${f === 1 ? "" : "s"}${P}`;
627
+ function A(e) {
628
+ const n = p.get(e);
629
+ if (!n)
630
+ return;
631
+ const t = u.get(e) || w;
632
+ if (!t)
633
+ return;
634
+ const r = b(e, t), a = n.querySelector(".rte-translation-source-label");
635
+ a && (a.textContent = t.labels.sourceLocaleLabel);
636
+ const o = n.querySelector(".rte-translation-target-label");
637
+ o && (o.textContent = t.labels.targetLocaleLabel);
638
+ const l = n.querySelector('[data-field="source-locale"]'), s = n.querySelector('[data-field="target-locale"]'), i = t.locales.map((f) => `<option value="${m(f)}">${m(f)}</option>`).join("");
639
+ l && (l.innerHTML = i, l.value = r.sourceLocale), s && (s.innerHTML = i, s.value = r.targetLocale);
640
+ const c = n.querySelector(".rte-translation-summary");
641
+ if (c) {
642
+ const f = r.issues.length, z = r.selectedSegmentId ? ` • ${t.labels.selectedSegmentPrefix}: ${r.selectedSegmentId}` : "";
643
+ c.textContent = `${t.labels.summaryPrefix}: ${r.sourceLocale} → ${r.targetLocale} • ${f} issue${f === 1 ? "" : "s"}${z}`;
607
644
  }
608
- const g = t.querySelector(".rte-translation-helper");
609
- g && (g.textContent = r.labels.helperText);
610
- const w = t.querySelector(".rte-translation-shortcut");
611
- w && (w.textContent = r.labels.shortcutText);
612
- const v = t.querySelector('[data-action="run-validation"]');
613
- v && (v.textContent = r.labels.validateText);
614
- const G = t.querySelector('[data-action="capture-source"]');
615
- G && (G.textContent = r.labels.captureSourceText);
616
- const B = t.querySelector('[data-action="toggle-realtime"]');
617
- B && (B.textContent = n.realtimeEnabled ? r.labels.realtimeOnText : r.labels.realtimeOffText, B.setAttribute("aria-pressed", n.realtimeEnabled ? "true" : "false"));
618
- const Y = t.querySelector('[data-action="lock-selected"]'), ue = n.selectedSegmentId && n.segments.find((f) => f.id === n.selectedSegmentId) || null;
619
- Y && (Y.textContent = ue?.locked ? r.labels.unlockSelectedText : r.labels.lockSelectedText, Y.disabled = !ue, Y.setAttribute("aria-pressed", ue?.locked ? "true" : "false"));
620
- const Le = t.querySelector('[data-action="close"]');
621
- Le && Le.setAttribute("aria-label", r.labels.closeText);
622
- const Z = t.querySelector(".rte-translation-issues"), F = t.querySelector(".rte-translation-empty");
623
- Z && (Z.setAttribute("aria-label", r.labels.issuesLabel), n.issues.length === 0 ? (Z.innerHTML = "", F && (F.hidden = !1, F.textContent = r.labels.noIssuesText)) : (F && (F.hidden = !0), Z.innerHTML = n.issues.map((f) => `
645
+ const g = n.querySelector(".rte-translation-helper");
646
+ g && (g.textContent = t.labels.helperText);
647
+ const h = n.querySelector(".rte-translation-shortcut");
648
+ h && (h.textContent = t.labels.shortcutText);
649
+ const R = n.querySelector('[data-action="run-validation"]');
650
+ R && (R.textContent = t.labels.validateText);
651
+ const C = n.querySelector('[data-action="capture-source"]');
652
+ C && (C.textContent = t.labels.captureSourceText);
653
+ const K = n.querySelector('[data-action="toggle-realtime"]');
654
+ K && (K.textContent = r.realtimeEnabled ? t.labels.realtimeOnText : t.labels.realtimeOffText, K.setAttribute("aria-pressed", r.realtimeEnabled ? "true" : "false"));
655
+ const H = n.querySelector('[data-action="lock-selected"]'), q = r.selectedSegmentId && r.segments.find((f) => f.id === r.selectedSegmentId) || null;
656
+ H && (H.textContent = q != null && q.locked ? t.labels.unlockSelectedText : t.labels.lockSelectedText, H.disabled = !q, H.setAttribute("aria-pressed", q != null && q.locked ? "true" : "false"));
657
+ const Le = n.querySelector('[data-action="close"]');
658
+ Le && Le.setAttribute("aria-label", t.labels.closeText);
659
+ const J = n.querySelector(".rte-translation-issues"), V = n.querySelector(".rte-translation-empty");
660
+ J && (J.setAttribute("aria-label", t.labels.issuesLabel), r.issues.length === 0 ? (J.innerHTML = "", V && (V.hidden = !1, V.textContent = t.labels.noIssuesText)) : (V && (V.hidden = !0), J.innerHTML = r.issues.map((f) => `
624
661
  <li class="rte-translation-issue ${f.severity === "error" ? "error" : f.severity === "warning" ? "warning" : "info"}" role="listitem" data-segment-id="${m(
625
662
  f.segmentId || ""
626
663
  )}">
@@ -628,11 +665,11 @@ function R(e) {
628
665
  ${f.suggestion ? `<p class="rte-translation-issue-suggestion">${m(f.suggestion)}</p>` : ""}
629
666
  </li>
630
667
  `).join("")));
631
- const de = t.querySelector(".rte-translation-segments");
632
- de && (de.setAttribute("aria-label", r.labels.segmentsLabel), de.innerHTML = n.segments.map((f) => {
633
- const P = f.id === n.selectedSegmentId ? "selected" : "", Ne = f.locked ? "locked" : "";
668
+ const de = n.querySelector(".rte-translation-segments");
669
+ de && (de.setAttribute("aria-label", t.labels.segmentsLabel), de.innerHTML = r.segments.map((f) => {
670
+ const z = f.id === r.selectedSegmentId ? "selected" : "", Ne = f.locked ? "locked" : "";
634
671
  return `
635
- <li class="rte-translation-segment-item ${P} ${Ne}" role="option" aria-selected="${f.id === n.selectedSegmentId ? "true" : "false"}" data-segment-id="${m(f.id)}">
672
+ <li class="rte-translation-segment-item ${z} ${Ne}" role="option" aria-selected="${f.id === r.selectedSegmentId ? "true" : "false"}" data-segment-id="${m(f.id)}">
636
673
  <button type="button" class="rte-translation-segment-select" data-action="select-segment" data-segment-id="${m(
637
674
  f.id
638
675
  )}" title="${m(f.text)}">
@@ -641,39 +678,41 @@ function R(e) {
641
678
  </button>
642
679
  <button type="button" class="rte-translation-segment-lock" data-action="toggle-lock" data-segment-id="${m(
643
680
  f.id
644
- )}" aria-label="${f.locked ? r.labels.unlockSegmentAriaLabel : r.labels.lockSegmentAriaLabel}" aria-pressed="${f.locked ? "true" : "false"}"></button>
681
+ )}" aria-label="${f.locked ? t.labels.unlockSegmentAriaLabel : t.labels.lockSegmentAriaLabel}" aria-pressed="${f.locked ? "true" : "false"}"></button>
645
682
  </li>
646
683
  `;
647
684
  }).join(""));
648
- const J = t.querySelector(".rte-translation-source-preview"), Q = t.querySelector(".rte-translation-target-preview");
649
- if (J || Q) {
650
- const f = n.selectedSegmentId && n.segments.find((P) => P.id === n.selectedSegmentId) || null;
651
- J && (J.textContent = f?.sourceText || "—", J.setAttribute("aria-label", r.labels.sourcePreviewLabel)), Q && (Q.textContent = f?.text || "—", Q.setAttribute("aria-label", r.labels.targetPreviewLabel));
685
+ const Q = n.querySelector(".rte-translation-source-preview"), X = n.querySelector(".rte-translation-target-preview");
686
+ if (Q || X) {
687
+ const f = r.selectedSegmentId && r.segments.find((z) => z.id === r.selectedSegmentId) || null;
688
+ Q && (Q.textContent = (f == null ? void 0 : f.sourceText) || "—", Q.setAttribute("aria-label", t.labels.sourcePreviewLabel)), X && (X.textContent = (f == null ? void 0 : f.text) || "—", X.setAttribute("aria-label", t.labels.targetPreviewLabel));
652
689
  }
653
- t.setAttribute("aria-label", r.labels.panelAriaLabel);
690
+ n.setAttribute("aria-label", t.labels.panelAriaLabel);
654
691
  }
655
692
  function Be(e) {
656
- const t = c.get(e) || k;
657
- if (!t) return;
658
- we(e);
659
- const r = window.setTimeout(() => {
660
- le.delete(e), L(e, "realtime", !1);
661
- }, t.debounceMs);
662
- le.set(e, r);
663
- }
664
- function L(e, t, r) {
665
- const n = c.get(e) || k;
666
- if (!n) return [];
667
- const a = b(e, n), o = me(e, a);
668
- a.segments = M(e, n, a);
693
+ const n = u.get(e) || w;
694
+ if (!n)
695
+ return;
696
+ xe(e);
697
+ const t = window.setTimeout(() => {
698
+ se.delete(e), L(e, "realtime", !1);
699
+ }, n.debounceMs);
700
+ se.set(e, t);
701
+ }
702
+ function L(e, n, t) {
703
+ const r = u.get(e) || w;
704
+ if (!r)
705
+ return [];
706
+ const a = b(e, r), o = me(e, a);
707
+ a.segments = M(e, r, a);
669
708
  const l = rt(e, a);
670
- if (!r && a.snapshot === l)
709
+ if (!t && a.snapshot === l)
671
710
  return a.issues;
672
- a.issues = ot(a.segments, a, n), a.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), a.snapshot = l, R(e), E(e), e.dispatchEvent(
711
+ a.issues = ot(a.segments, a, r), a.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), a.snapshot = l, A(e), $(e), e.dispatchEvent(
673
712
  new CustomEvent("editora:translation-workflow-validation", {
674
713
  bubbles: !0,
675
714
  detail: {
676
- reason: t,
715
+ reason: n,
677
716
  state: qe(e)
678
717
  }
679
718
  })
@@ -681,43 +720,48 @@ function L(e, t, r) {
681
720
  const s = p.get(e);
682
721
  if (s) {
683
722
  if (o)
684
- return H(s, n.labels.readonlySegmentMessage), a.issues;
685
- H(
723
+ return P(s, r.labels.readonlySegmentMessage), a.issues;
724
+ P(
686
725
  s,
687
- a.issues.length === 0 ? n.labels.noIssuesText : `${a.issues.length} issue${a.issues.length === 1 ? "" : "s"} detected.`
726
+ a.issues.length === 0 ? r.labels.noIssuesText : `${a.issues.length} issue${a.issues.length === 1 ? "" : "s"} detected.`
688
727
  );
689
728
  }
690
729
  return a.issues;
691
730
  }
692
731
  function Pe(e) {
693
- const t = c.get(e) || k;
694
- if (!t) return !1;
695
- const r = b(e, t), n = M(e, t, r);
696
- n.forEach((o) => {
697
- r.sourceTextBySegmentId.set(o.id, o.text);
698
- }), r.snapshot = "", L(e, "capture-source", !0);
732
+ const n = u.get(e) || w;
733
+ if (!n)
734
+ return !1;
735
+ const t = b(e, n), r = M(e, n, t);
736
+ r.forEach((o) => {
737
+ t.sourceTextBySegmentId.set(o.id, o.text);
738
+ }), t.snapshot = "", L(e, "capture-source", !0);
699
739
  const a = p.get(e);
700
- return a && H(a, t.labels.sourceCapturedMessage), e.dispatchEvent(
740
+ return a && P(a, n.labels.sourceCapturedMessage), e.dispatchEvent(
701
741
  new CustomEvent("editora:translation-source-captured", {
702
742
  bubbles: !0,
703
743
  detail: {
704
- sourceLocale: r.sourceLocale,
705
- segmentCount: n.length
744
+ sourceLocale: t.sourceLocale,
745
+ segmentCount: r.length
706
746
  }
707
747
  })
708
748
  ), !0;
709
749
  }
710
- function se(e, t, r) {
711
- const n = c.get(e) || k;
712
- if (!n) return !1;
713
- const a = b(e, n);
714
- a.segments = M(e, n, a);
715
- const o = He(e)?.getAttribute("data-translation-segment-id") || null, l = t || o || a.selectedSegmentId || a.segments[0]?.id || null;
716
- if (!l) return !1;
717
- const s = ce(e, l);
718
- if (!s) return !1;
719
- const i = typeof r == "boolean" ? r : !a.lockedSegmentIds.has(l);
720
- return i ? (a.lockedSegmentIds.add(l), a.lockedHtmlBySegmentId.set(l, s.innerHTML)) : (a.lockedSegmentIds.delete(l), a.lockedHtmlBySegmentId.delete(l)), ie(s, i), a.selectedSegmentId = l, a.snapshot = "", L(e, "lock-segment", !0), e.dispatchEvent(
750
+ function ie(e, n, t) {
751
+ var c, g;
752
+ const r = u.get(e) || w;
753
+ if (!r)
754
+ return !1;
755
+ const a = b(e, r);
756
+ a.segments = M(e, r, a);
757
+ const o = ((c = He(e)) == null ? void 0 : c.getAttribute("data-translation-segment-id")) || null, l = n || o || a.selectedSegmentId || ((g = a.segments[0]) == null ? void 0 : g.id) || null;
758
+ if (!l)
759
+ return !1;
760
+ const s = ue(e, l);
761
+ if (!s)
762
+ return !1;
763
+ const i = typeof t == "boolean" ? t : !a.lockedSegmentIds.has(l);
764
+ return i ? (a.lockedSegmentIds.add(l), a.lockedHtmlBySegmentId.set(l, s.innerHTML)) : (a.lockedSegmentIds.delete(l), a.lockedHtmlBySegmentId.delete(l)), ce(s, i), a.selectedSegmentId = l, a.snapshot = "", L(e, "lock-segment", !0), e.dispatchEvent(
721
765
  new CustomEvent("editora:translation-segment-lock", {
722
766
  bubbles: !0,
723
767
  detail: {
@@ -727,57 +771,63 @@ function se(e, t, r) {
727
771
  })
728
772
  ), !0;
729
773
  }
730
- function De(e, t) {
731
- const r = c.get(e) || k;
732
- if (!r) return !1;
733
- const n = b(e, r), a = typeof t == "boolean" ? t : !n.realtimeEnabled;
734
- return n.realtimeEnabled = a, a ? Be(e) : we(e), R(e), E(e), !0;
735
- }
736
- function pe(e, t, r = !0) {
737
- const n = c.get(e) || k;
738
- if (!n) return !1;
739
- const a = b(e, n);
740
- return a.segments = M(e, n, a), a.segments.some((o) => o.id === t) ? (a.selectedSegmentId = t, R(e), E(e), r && at(e, t), !0) : !1;
741
- }
742
- function ne(e, t) {
743
- const r = c.get(e) || k;
744
- if (!r) return !1;
745
- const n = b(e, r);
746
- if (n.segments = M(e, r, n), n.segments.length === 0) return !1;
774
+ function De(e, n) {
775
+ const t = u.get(e) || w;
776
+ if (!t)
777
+ return !1;
778
+ const r = b(e, t), a = typeof n == "boolean" ? n : !r.realtimeEnabled;
779
+ return r.realtimeEnabled = a, a ? Be(e) : xe(e), A(e), $(e), !0;
780
+ }
781
+ function pe(e, n, t = !0) {
782
+ const r = u.get(e) || w;
783
+ if (!r)
784
+ return !1;
785
+ const a = b(e, r);
786
+ return a.segments = M(e, r, a), a.segments.some((o) => o.id === n) ? (a.selectedSegmentId = n, A(e), $(e), t && at(e, n), !0) : !1;
787
+ }
788
+ function re(e, n) {
789
+ const t = u.get(e) || w;
790
+ if (!t)
791
+ return !1;
792
+ const r = b(e, t);
793
+ if (r.segments = M(e, t, r), r.segments.length === 0)
794
+ return !1;
747
795
  const a = Math.max(
748
796
  0,
749
- n.segments.findIndex((s) => s.id === n.selectedSegmentId)
797
+ r.segments.findIndex((s) => s.id === r.selectedSegmentId)
750
798
  );
751
799
  let o = a;
752
- t === "start" ? o = 0 : t === "end" ? o = n.segments.length - 1 : o = C(a + t, 0, n.segments.length - 1);
753
- const l = n.segments[o];
800
+ n === "start" ? o = 0 : n === "end" ? o = r.segments.length - 1 : o = B(a + n, 0, r.segments.length - 1);
801
+ const l = r.segments[o];
754
802
  return l ? pe(e, l.id, !0) : !1;
755
803
  }
756
- function V(e, t = !1) {
757
- const r = p.get(e);
758
- r && (r.classList.remove("show"), j.set(e, !1), E(e), t && e.focus({ preventScroll: !0 }));
804
+ function G(e, n = !1) {
805
+ const t = p.get(e);
806
+ t && (t.classList.remove("show"), Y.set(e, !1), $(e), n && e.focus({ preventScroll: !0 }));
759
807
  }
760
808
  function he(e) {
761
- const t = ut(e);
762
- p.forEach((n, a) => {
763
- a !== e && V(a, !1);
764
- }), t.classList.add("show"), j.set(e, !0), L(e, "panel-open", !1), R(e), be(e, t), E(e), t.querySelector('[data-field="target-locale"]')?.focus();
809
+ const n = ut(e);
810
+ p.forEach((r, a) => {
811
+ a !== e && G(a, !1);
812
+ }), n.classList.add("show"), Y.set(e, !0), L(e, "panel-open", !1), A(e), be(e, n), $(e);
813
+ const t = n.querySelector('[data-field="target-locale"]');
814
+ t == null || t.focus();
765
815
  }
766
- function ze(e, t) {
767
- const r = ye(e);
768
- return (typeof t == "boolean" ? t : !r) ? he(e) : V(e, !1), !0;
816
+ function ze(e, n) {
817
+ const t = ye(e);
818
+ return (typeof n == "boolean" ? n : !t) ? he(e) : G(e, !1), !0;
769
819
  }
770
820
  function lt(e) {
771
- const t = e.key.toLowerCase();
772
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "l";
821
+ const n = e.key.toLowerCase();
822
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "l";
773
823
  }
774
824
  function st(e) {
775
- const t = e.key.toLowerCase();
776
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "v";
825
+ const n = e.key.toLowerCase();
826
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "v";
777
827
  }
778
828
  function it(e) {
779
- const t = e.key.toLowerCase();
780
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "k";
829
+ const n = e.key.toLowerCase();
830
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "k";
781
831
  }
782
832
  function ct(e) {
783
833
  return e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey ? !0 : e.key === "Backspace" || e.key === "Delete" || e.key === "Enter";
@@ -786,16 +836,17 @@ function Ie(e) {
786
836
  return e instanceof HTMLElement ? e.closest('[data-translation-locked="true"]') : null;
787
837
  }
788
838
  function ut(e) {
789
- const t = p.get(e);
790
- if (t) return t;
791
- const r = c.get(e) || k || oe();
792
- b(e, r);
793
- const n = `rte-translation-workflow-panel-${Fe++}`, a = `${n}-source`, o = `${n}-target`, l = document.createElement("section");
794
- return l.className = u, l.id = n, l.setAttribute("role", "dialog"), l.setAttribute("aria-modal", "false"), l.setAttribute("aria-label", r.labels.panelAriaLabel), l.innerHTML = `
839
+ const n = p.get(e);
840
+ if (n)
841
+ return n;
842
+ const t = u.get(e) || w || ae();
843
+ b(e, t);
844
+ const r = `rte-translation-workflow-panel-${Fe++}`, a = `${r}-source`, o = `${r}-target`, l = document.createElement("section");
845
+ return l.className = d, l.id = r, l.setAttribute("role", "dialog"), l.setAttribute("aria-modal", "false"), l.setAttribute("aria-label", t.labels.panelAriaLabel), l.innerHTML = `
795
846
  <header class="rte-translation-header">
796
- <h2 class="rte-translation-title">${m(r.labels.panelTitle)}</h2>
847
+ <h2 class="rte-translation-title">${m(t.labels.panelTitle)}</h2>
797
848
  <button type="button" class="rte-translation-icon-btn" data-action="close" aria-label="${m(
798
- r.labels.closeText
849
+ t.labels.closeText
799
850
  )}">✕</button>
800
851
  </header>
801
852
  <div class="rte-translation-body">
@@ -819,45 +870,46 @@ function ut(e) {
819
870
  <p class="rte-translation-helper"></p>
820
871
  <p class="rte-translation-shortcut"></p>
821
872
  <div class="rte-translation-grid">
822
- <section class="rte-translation-segments-wrap" aria-label="${m(r.labels.segmentsLabel)}">
823
- <h3 class="rte-translation-subtitle">${m(r.labels.segmentsLabel)}</h3>
873
+ <section class="rte-translation-segments-wrap" aria-label="${m(t.labels.segmentsLabel)}">
874
+ <h3 class="rte-translation-subtitle">${m(t.labels.segmentsLabel)}</h3>
824
875
  <ul class="rte-translation-segments" role="listbox" tabindex="0" aria-label="${m(
825
- r.labels.segmentsLabel
876
+ t.labels.segmentsLabel
826
877
  )}"></ul>
827
878
  </section>
828
879
  <section class="rte-translation-preview-wrap">
829
- <h3 class="rte-translation-subtitle">${m(r.labels.sourcePreviewLabel)} / ${m(
830
- r.labels.targetPreviewLabel
880
+ <h3 class="rte-translation-subtitle">${m(t.labels.sourcePreviewLabel)} / ${m(
881
+ t.labels.targetPreviewLabel
831
882
  )}</h3>
832
883
  <div class="rte-translation-preview-block">
833
- <p class="rte-translation-preview-label">${m(r.labels.sourcePreviewLabel)}</p>
884
+ <p class="rte-translation-preview-label">${m(t.labels.sourcePreviewLabel)}</p>
834
885
  <p class="rte-translation-source-preview"></p>
835
886
  </div>
836
887
  <div class="rte-translation-preview-block">
837
- <p class="rte-translation-preview-label">${m(r.labels.targetPreviewLabel)}</p>
888
+ <p class="rte-translation-preview-label">${m(t.labels.targetPreviewLabel)}</p>
838
889
  <p class="rte-translation-target-preview"></p>
839
890
  </div>
840
891
  </section>
841
892
  </div>
842
893
  <section class="rte-translation-issues-wrap">
843
- <h3 class="rte-translation-subtitle">${m(r.labels.issuesLabel)}</h3>
844
- <ul class="rte-translation-issues" role="list" aria-label="${m(r.labels.issuesLabel)}"></ul>
894
+ <h3 class="rte-translation-subtitle">${m(t.labels.issuesLabel)}</h3>
895
+ <ul class="rte-translation-issues" role="list" aria-label="${m(t.labels.issuesLabel)}"></ul>
845
896
  <p class="rte-translation-empty" hidden></p>
846
897
  </section>
847
898
  </div>
848
899
  <div class="rte-translation-live" aria-live="polite" aria-atomic="true"></div>
849
900
  `, l.addEventListener("click", (s) => {
850
901
  const i = s.target;
851
- if (!i) return;
852
- const d = i.closest("[data-action]");
853
- if (!d) {
854
- const v = i.closest(".rte-translation-issue[data-segment-id]")?.getAttribute("data-segment-id") || "";
855
- v && pe(e, v, !0);
902
+ if (!i)
903
+ return;
904
+ const c = i.closest("[data-action]");
905
+ if (!c) {
906
+ const h = i.closest(".rte-translation-issue[data-segment-id]"), R = (h == null ? void 0 : h.getAttribute("data-segment-id")) || "";
907
+ R && pe(e, R, !0);
856
908
  return;
857
909
  }
858
- const g = d.getAttribute("data-action");
910
+ const g = c.getAttribute("data-action");
859
911
  if (g === "close") {
860
- V(e, !0);
912
+ G(e, !0);
861
913
  return;
862
914
  }
863
915
  if (g === "run-validation") {
@@ -869,7 +921,7 @@ function ut(e) {
869
921
  return;
870
922
  }
871
923
  if (g === "lock-selected") {
872
- se(e);
924
+ ie(e);
873
925
  return;
874
926
  }
875
927
  if (g === "toggle-realtime") {
@@ -877,126 +929,139 @@ function ut(e) {
877
929
  return;
878
930
  }
879
931
  if (g === "select-segment") {
880
- const w = d.getAttribute("data-segment-id") || "";
881
- w && pe(e, w, !0);
932
+ const h = c.getAttribute("data-segment-id") || "";
933
+ h && pe(e, h, !0);
882
934
  return;
883
935
  }
884
936
  if (g === "toggle-lock") {
885
- const w = d.getAttribute("data-segment-id") || "";
886
- w && se(e, w);
937
+ const h = c.getAttribute("data-segment-id") || "";
938
+ h && ie(e, h);
887
939
  }
888
940
  }), l.addEventListener("change", (s) => {
889
941
  const i = s.target;
890
- if (!(i instanceof HTMLSelectElement)) return;
891
- const d = c.get(e) || k;
892
- if (!d) return;
893
- const g = b(e, d);
942
+ if (!(i instanceof HTMLSelectElement))
943
+ return;
944
+ const c = u.get(e) || w;
945
+ if (!c)
946
+ return;
947
+ const g = b(e, c);
894
948
  if (i.getAttribute("data-field") === "source-locale") {
895
- g.sourceLocale = A(i.value), g.snapshot = "", L(e, "source-locale-change", !0);
949
+ g.sourceLocale = E(i.value), g.snapshot = "", L(e, "source-locale-change", !0);
896
950
  return;
897
951
  }
898
- i.getAttribute("data-field") === "target-locale" && (g.targetLocale = A(i.value), g.snapshot = "", L(e, "target-locale-change", !0));
952
+ i.getAttribute("data-field") === "target-locale" && (g.targetLocale = E(i.value), g.snapshot = "", L(e, "target-locale-change", !0));
899
953
  }), l.addEventListener("keydown", (s) => {
900
954
  const i = s.target;
901
955
  if (s.key === "Escape") {
902
- s.preventDefault(), V(e, !0);
956
+ s.preventDefault(), G(e, !0);
903
957
  return;
904
958
  }
905
- !i?.closest(".rte-translation-segments") || !Me.has(s.key) || (s.preventDefault(), s.key === "ArrowUp" ? ne(e, -1) : s.key === "ArrowDown" ? ne(e, 1) : s.key === "Home" ? ne(e, "start") : s.key === "End" && ne(e, "end"));
906
- }), ge(l, e), document.body.appendChild(l), p.set(e, l), j.set(e, !1), R(e), l;
959
+ !(i != null && i.closest(".rte-translation-segments")) || !Me.has(s.key) || (s.preventDefault(), s.key === "ArrowUp" ? re(e, -1) : s.key === "ArrowDown" ? re(e, 1) : s.key === "Home" ? re(e, "start") : s.key === "End" && re(e, "end"));
960
+ }), ge(l, e), document.body.appendChild(l), p.set(e, l), Y.set(e, !1), A(e), l;
907
961
  }
908
962
  function dt(e) {
909
- k = e, D || (D = (t) => {
910
- ae();
911
- const n = t.target?.closest(S);
912
- if (!n) return;
913
- const a = c.get(n) || e, o = b(n, a);
914
- c.set(n, a), x = n;
915
- const l = He(n)?.getAttribute("data-translation-segment-id") || null;
916
- l && (o.selectedSegmentId = l), E(n);
917
- const s = p.get(n);
918
- s && (ge(s, n), be(n, s), R(n));
919
- }, document.addEventListener("focusin", D, !0)), z || (z = (t) => {
920
- const n = t.target?.closest(S);
921
- if (!n) return;
922
- const a = c.get(n) || k;
923
- if (!a) return;
924
- const o = b(n, a), l = me(n, o);
925
- if (o.segments = M(n, a, o), !o.realtimeEnabled) {
963
+ w = e, N || (N = (n) => {
964
+ var i;
965
+ le();
966
+ const t = n.target, r = t == null ? void 0 : t.closest(S);
967
+ if (!r)
968
+ return;
969
+ const a = u.get(r) || e, o = b(r, a);
970
+ u.set(r, a), x = r;
971
+ const l = ((i = He(r)) == null ? void 0 : i.getAttribute("data-translation-segment-id")) || null;
972
+ l && (o.selectedSegmentId = l), $(r);
973
+ const s = p.get(r);
974
+ s && (ge(s, r), be(r, s), A(r));
975
+ }, document.addEventListener("focusin", N, !0)), O || (O = (n) => {
976
+ const t = n.target, r = t == null ? void 0 : t.closest(S);
977
+ if (!r)
978
+ return;
979
+ const a = u.get(r) || w;
980
+ if (!a)
981
+ return;
982
+ const o = b(r, a), l = me(r, o);
983
+ if (o.segments = M(r, a, o), !o.realtimeEnabled) {
926
984
  if (l) {
927
- const s = p.get(n);
928
- s && H(s, a.labels.readonlySegmentMessage);
985
+ const s = p.get(r);
986
+ s && P(s, a.labels.readonlySegmentMessage);
929
987
  }
930
- R(n), E(n);
988
+ A(r), $(r);
931
989
  return;
932
990
  }
933
- Be(n);
934
- }, document.addEventListener("input", z, !0)), N || (N = (t) => {
935
- const r = t, n = r.target, a = n?.closest(S);
936
- if (!a) return;
937
- const o = Ie(n);
938
- if (!o || !a.contains(o)) return;
939
- r.preventDefault();
940
- const l = p.get(a), s = c.get(a) || k;
941
- l && s && H(l, s.labels.readonlySegmentMessage);
942
- }, document.addEventListener("beforeinput", N, !0)), O || (O = (t) => {
943
- if (t.defaultPrevented) return;
944
- const r = t.target;
945
- if (r?.closest(`.${u}`) && t.key !== "Escape" && !Me.has(t.key)) return;
946
- const a = t.key === "Escape", o = lt(t), l = st(t), s = it(t), i = Ie(r);
991
+ Be(r);
992
+ }, document.addEventListener("input", O, !0)), _ || (_ = (n) => {
993
+ const t = n, r = t.target, a = r == null ? void 0 : r.closest(S);
994
+ if (!a)
995
+ return;
996
+ const o = Ie(r);
997
+ if (!o || !a.contains(o))
998
+ return;
999
+ t.preventDefault();
1000
+ const l = p.get(a), s = u.get(a) || w;
1001
+ l && s && P(l, s.labels.readonlySegmentMessage);
1002
+ }, document.addEventListener("beforeinput", _, !0)), F || (F = (n) => {
1003
+ if (n.defaultPrevented)
1004
+ return;
1005
+ const t = n.target;
1006
+ if ((t == null ? void 0 : t.closest(`.${d}`)) && n.key !== "Escape" && !Me.has(n.key))
1007
+ return;
1008
+ const a = n.key === "Escape", o = lt(n), l = st(n), s = it(n), i = Ie(t);
947
1009
  if (!a && !o && !l && !s && !i)
948
1010
  return;
949
- const d = Xe(t);
950
- if (!d) return;
951
- const g = c.get(d) || k || e;
952
- if (b(d, g), c.set(d, g), x = d, a && ye(d)) {
953
- t.preventDefault(), V(d, !0);
1011
+ const c = Xe(n);
1012
+ if (!c)
1013
+ return;
1014
+ const g = u.get(c) || w || e;
1015
+ if (b(c, g), u.set(c, g), x = c, a && ye(c)) {
1016
+ n.preventDefault(), G(c, !0);
954
1017
  return;
955
1018
  }
956
- if (i && d.contains(i) && ct(t)) {
957
- t.preventDefault();
958
- const w = p.get(d);
959
- w && H(w, g.labels.readonlySegmentMessage);
1019
+ if (i && c.contains(i) && ct(n)) {
1020
+ n.preventDefault();
1021
+ const h = p.get(c);
1022
+ h && P(h, g.labels.readonlySegmentMessage);
960
1023
  return;
961
1024
  }
962
1025
  if (o) {
963
- t.preventDefault(), t.stopPropagation(), ze(d);
1026
+ n.preventDefault(), n.stopPropagation(), ze(c);
964
1027
  return;
965
1028
  }
966
1029
  if (l) {
967
- t.preventDefault(), t.stopPropagation(), L(d, "shortcut", !0);
1030
+ n.preventDefault(), n.stopPropagation(), L(c, "shortcut", !0);
968
1031
  return;
969
1032
  }
970
- s && (t.preventDefault(), t.stopPropagation(), se(d));
971
- }, document.addEventListener("keydown", O, !0)), I || (I = () => {
972
- ae(), p.forEach((t, r) => {
973
- !r.isConnected || !t.isConnected || (ge(t, r), be(r, t));
1033
+ s && (n.preventDefault(), n.stopPropagation(), ie(c));
1034
+ }, document.addEventListener("keydown", F, !0)), I || (I = () => {
1035
+ le(), p.forEach((n, t) => {
1036
+ !t.isConnected || !n.isConnected || (ge(n, t), be(t, n));
974
1037
  });
975
- }, window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), !_ && typeof MutationObserver < "u" && document.body && (_ = new MutationObserver((t) => {
976
- Qe(t) && ae(), t.some((n) => n.type === "characterData" ? !0 : n.type === "childList" && (n.addedNodes.length > 0 || n.removedNodes.length > 0)) && U.forEach((n) => {
977
- const a = q.get(n);
978
- if (!a || a.lockedSegmentIds.size === 0 || !me(n, a)) return;
1038
+ }, window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), !W && typeof MutationObserver < "u" && document.body && (W = new MutationObserver((n) => {
1039
+ Qe(n) && le(), n.some((r) => r.type === "characterData" ? !0 : r.type === "childList" && (r.addedNodes.length > 0 || r.removedNodes.length > 0)) && Z.forEach((r) => {
1040
+ const a = D.get(r);
1041
+ if (!a || a.lockedSegmentIds.size === 0 || !me(r, a))
1042
+ return;
979
1043
  a.snapshot = "";
980
- const l = c.get(n) || k, s = p.get(n);
981
- s && l && H(s, l.labels.readonlySegmentMessage), l && (a.segments = M(n, l, a), R(n), E(n));
1044
+ const l = u.get(r) || w, s = p.get(r);
1045
+ s && l && P(s, l.labels.readonlySegmentMessage), l && (a.segments = M(r, l, a), A(r), $(r));
982
1046
  });
983
- }), _.observe(document.body, {
1047
+ }), W.observe(document.body, {
984
1048
  childList: !0,
985
1049
  subtree: !0,
986
1050
  characterData: !0
987
1051
  }));
988
1052
  }
989
1053
  function ft() {
990
- D && (document.removeEventListener("focusin", D, !0), D = null), z && (document.removeEventListener("input", z, !0), z = null), N && (document.removeEventListener("beforeinput", N, !0), N = null), O && (document.removeEventListener("keydown", O, !0), O = null), I && (window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), I = null), _ && (_.disconnect(), _ = null), p.forEach((t) => t.remove()), p.clear(), Array.from(U).forEach((t) => Se(t)), k = null, x = null;
1054
+ N && (document.removeEventListener("focusin", N, !0), N = null), O && (document.removeEventListener("input", O, !0), O = null), _ && (document.removeEventListener("beforeinput", _, !0), _ = null), F && (document.removeEventListener("keydown", F, !0), F = null), I && (window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), I = null), W && (W.disconnect(), W = null), p.forEach((n) => n.remove()), p.clear(), Array.from(Z).forEach((n) => Se(n)), w = null, x = null;
991
1055
  }
992
1056
  function gt() {
993
- if (typeof document > "u" || document.getElementById(ve)) return;
1057
+ if (typeof document > "u" || document.getElementById(ve))
1058
+ return;
994
1059
  const e = document.createElement("style");
995
1060
  e.id = ve, e.textContent = `
996
1061
  .rte-toolbar-group-items.${y},
997
1062
  .editora-toolbar-group-items.${y},
998
- .rte-toolbar-group-items.${$},
999
- .editora-toolbar-group-items.${$} {
1063
+ .rte-toolbar-group-items.${v},
1064
+ .editora-toolbar-group-items.${v} {
1000
1065
  display: flex;
1001
1066
  border: 1px solid #cbd5e1;
1002
1067
  border-radius: 4px;
@@ -1005,8 +1070,8 @@ function gt() {
1005
1070
 
1006
1071
  .rte-toolbar-group-items.${y} .rte-toolbar-button,
1007
1072
  .editora-toolbar-group-items.${y} .editora-toolbar-button,
1008
- .rte-toolbar-group-items.${$} .rte-toolbar-button,
1009
- .editora-toolbar-group-items.${$} .editora-toolbar-button {
1073
+ .rte-toolbar-group-items.${v} .rte-toolbar-button,
1074
+ .editora-toolbar-group-items.${v} .editora-toolbar-button {
1010
1075
  border: none;
1011
1076
  border-right: 1px solid #cbd5e1;
1012
1077
  border-radius: 0;
@@ -1014,15 +1079,15 @@ function gt() {
1014
1079
 
1015
1080
  .rte-toolbar-group-items.${y} .rte-toolbar-item:last-child .rte-toolbar-button,
1016
1081
  .editora-toolbar-group-items.${y} .editora-toolbar-item:last-child .editora-toolbar-button,
1017
- .rte-toolbar-group-items.${$} .rte-toolbar-item:last-child .rte-toolbar-button,
1018
- .editora-toolbar-group-items.${$} .editora-toolbar-item:last-child .editora-toolbar-button {
1082
+ .rte-toolbar-group-items.${v} .rte-toolbar-item:last-child .rte-toolbar-button,
1083
+ .editora-toolbar-group-items.${v} .editora-toolbar-item:last-child .editora-toolbar-button {
1019
1084
  border-right: none;
1020
1085
  }
1021
1086
 
1022
- ${h} .rte-toolbar-group-items.${y},
1023
- ${h} .editora-toolbar-group-items.${y},
1024
- ${h} .rte-toolbar-group-items.${$},
1025
- ${h} .editora-toolbar-group-items.${$} {
1087
+ ${k} .rte-toolbar-group-items.${y},
1088
+ ${k} .editora-toolbar-group-items.${y},
1089
+ ${k} .rte-toolbar-group-items.${v},
1090
+ ${k} .editora-toolbar-group-items.${v} {
1026
1091
  border-color: #566275;
1027
1092
  }
1028
1093
  .rte-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
@@ -1033,29 +1098,29 @@ function gt() {
1033
1098
  .editora-toolbar-button[data-command="toggleTranslationRealtime"].active {
1034
1099
  background: #ccc;
1035
1100
  }
1036
- ${h} .rte-toolbar-group-items.${y} .rte-toolbar-button svg,
1037
- ${h} .editora-toolbar-group-items.${y} .editora-toolbar-button svg,
1038
- ${h} .rte-toolbar-group-items.${$} .rte-toolbar-button svg,
1039
- ${h} .editora-toolbar-group-items.${$} .editora-toolbar-button svg
1101
+ ${k} .rte-toolbar-group-items.${y} .rte-toolbar-button svg,
1102
+ ${k} .editora-toolbar-group-items.${y} .editora-toolbar-button svg,
1103
+ ${k} .rte-toolbar-group-items.${v} .rte-toolbar-button svg,
1104
+ ${k} .editora-toolbar-group-items.${v} .editora-toolbar-button svg
1040
1105
  {
1041
1106
  fill: none;
1042
1107
  }
1043
- ${h} .rte-toolbar-group-items.${y} .rte-toolbar-button,
1044
- ${h} .editora-toolbar-group-items.${y} .editora-toolbar-button
1108
+ ${k} .rte-toolbar-group-items.${y} .rte-toolbar-button,
1109
+ ${k} .editora-toolbar-group-items.${y} .editora-toolbar-button
1045
1110
  {
1046
1111
  border-color: #566275;
1047
1112
  }
1048
1113
 
1049
- ${h} .rte-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
1050
- ${h} .editora-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
1051
- ${h} .rte-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
1052
- ${h} .editora-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
1053
- ${h} .rte-toolbar-button[data-command="toggleTranslationRealtime"].active,
1054
- ${h} .editora-toolbar-button[data-command="toggleTranslationRealtime"].active {
1114
+ ${k} .rte-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
1115
+ ${k} .editora-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
1116
+ ${k} .rte-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
1117
+ ${k} .editora-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
1118
+ ${k} .rte-toolbar-button[data-command="toggleTranslationRealtime"].active,
1119
+ ${k} .editora-toolbar-button[data-command="toggleTranslationRealtime"].active {
1055
1120
  background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
1056
1121
  }
1057
1122
 
1058
- .${u} {
1123
+ .${d} {
1059
1124
  position: fixed;
1060
1125
  z-index: 12000;
1061
1126
  display: none;
@@ -1069,12 +1134,12 @@ function gt() {
1069
1134
  overflow: hidden;
1070
1135
  }
1071
1136
 
1072
- .${u}.show {
1137
+ .${d}.show {
1073
1138
  display: flex;
1074
1139
  flex-direction: column;
1075
1140
  }
1076
1141
 
1077
- .${u}.rte-translation-workflow-theme-dark {
1142
+ .${d}.rte-translation-workflow-theme-dark {
1078
1143
  border-color: #334155;
1079
1144
  background: #0f172a;
1080
1145
  color: #e2e8f0;
@@ -1091,7 +1156,7 @@ function gt() {
1091
1156
  background: linear-gradient(180deg, #eff6ff 0%, #e2e8f0 100%);
1092
1157
  }
1093
1158
 
1094
- .${u}.rte-translation-workflow-theme-dark .rte-translation-header {
1159
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-header {
1095
1160
  border-color: #1e293b;
1096
1161
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
1097
1162
  }
@@ -1127,14 +1192,14 @@ function gt() {
1127
1192
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
1128
1193
  }
1129
1194
 
1130
- .${u}.rte-translation-workflow-theme-dark .rte-translation-icon-btn {
1195
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-icon-btn {
1131
1196
  border-color: #475569;
1132
1197
  background: #0f172a;
1133
1198
  color: #e2e8f0;
1134
1199
  }
1135
1200
 
1136
- .${u}.rte-translation-workflow-theme-dark .rte-translation-icon-btn:hover,
1137
- .${u}.rte-translation-workflow-theme-dark .rte-translation-icon-btn:focus-visible {
1201
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-icon-btn:hover,
1202
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-icon-btn:focus-visible {
1138
1203
  border-color: #60a5fa;
1139
1204
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
1140
1205
  }
@@ -1165,8 +1230,8 @@ function gt() {
1165
1230
  color: #334155;
1166
1231
  }
1167
1232
 
1168
- .${u}.rte-translation-workflow-theme-dark .rte-translation-source-label,
1169
- .${u}.rte-translation-workflow-theme-dark .rte-translation-target-label {
1233
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-source-label,
1234
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-target-label {
1170
1235
  color: #cbd5e1;
1171
1236
  }
1172
1237
 
@@ -1186,7 +1251,7 @@ function gt() {
1186
1251
  outline: none;
1187
1252
  }
1188
1253
 
1189
- .${u}.rte-translation-workflow-theme-dark .rte-translation-select {
1254
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-select {
1190
1255
  border-color: #334155;
1191
1256
  background: #0b1220;
1192
1257
  color: #e2e8f0;
@@ -1201,9 +1266,9 @@ function gt() {
1201
1266
  color: #475569;
1202
1267
  }
1203
1268
 
1204
- .${u}.rte-translation-workflow-theme-dark .rte-translation-summary,
1205
- .${u}.rte-translation-workflow-theme-dark .rte-translation-helper,
1206
- .${u}.rte-translation-workflow-theme-dark .rte-translation-shortcut {
1269
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-summary,
1270
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-helper,
1271
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-shortcut {
1207
1272
  color: #94a3b8;
1208
1273
  }
1209
1274
 
@@ -1248,13 +1313,13 @@ function gt() {
1248
1313
  background: #155e75;
1249
1314
  }
1250
1315
 
1251
- .${u}.rte-translation-workflow-theme-dark .rte-translation-btn {
1316
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-btn {
1252
1317
  border-color: #334155;
1253
1318
  background: #111827;
1254
1319
  color: #e2e8f0;
1255
1320
  }
1256
1321
 
1257
- .${u}.rte-translation-workflow-theme-dark .rte-translation-btn-primary {
1322
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-btn-primary {
1258
1323
  border-color: #22d3ee;
1259
1324
  background: #0e7490;
1260
1325
  color: #ecfeff;
@@ -1276,9 +1341,9 @@ function gt() {
1276
1341
  min-height: 120px;
1277
1342
  }
1278
1343
 
1279
- .${u}.rte-translation-workflow-theme-dark .rte-translation-segments-wrap,
1280
- .${u}.rte-translation-workflow-theme-dark .rte-translation-preview-wrap,
1281
- .${u}.rte-translation-workflow-theme-dark .rte-translation-issues-wrap {
1344
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segments-wrap,
1345
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-preview-wrap,
1346
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issues-wrap {
1282
1347
  border-color: #334155;
1283
1348
  background: #0b1220;
1284
1349
  }
@@ -1290,7 +1355,7 @@ function gt() {
1290
1355
  color: #334155;
1291
1356
  }
1292
1357
 
1293
- .${u}.rte-translation-workflow-theme-dark .rte-translation-subtitle {
1358
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-subtitle {
1294
1359
  color: #cbd5e1;
1295
1360
  }
1296
1361
 
@@ -1325,12 +1390,12 @@ function gt() {
1325
1390
  background: #fffbeb;
1326
1391
  }
1327
1392
 
1328
- .${u}.rte-translation-workflow-theme-dark .rte-translation-segment-item {
1393
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segment-item {
1329
1394
  border-color: #334155;
1330
1395
  background: #111827;
1331
1396
  }
1332
1397
 
1333
- .${u}.rte-translation-workflow-theme-dark .rte-translation-segment-item.locked {
1398
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segment-item.locked {
1334
1399
  border-color: rgba(245, 158, 11, 0.72);
1335
1400
  background: rgba(120, 53, 15, 0.28);
1336
1401
  }
@@ -1358,11 +1423,11 @@ function gt() {
1358
1423
  line-height: 1.3;
1359
1424
  }
1360
1425
 
1361
- .${u}.rte-translation-workflow-theme-dark .rte-translation-segment-meta {
1426
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segment-meta {
1362
1427
  color: #94a3b8;
1363
1428
  }
1364
1429
 
1365
- .${u}.rte-translation-workflow-theme-dark .rte-translation-segment-text {
1430
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segment-text {
1366
1431
  color: #e2e8f0;
1367
1432
  }
1368
1433
 
@@ -1392,7 +1457,7 @@ function gt() {
1392
1457
  opacity: 1;
1393
1458
  }
1394
1459
 
1395
- .${u}.rte-translation-workflow-theme-dark .rte-translation-segment-lock {
1460
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-segment-lock {
1396
1461
  border-color: #334155;
1397
1462
  background: #111827;
1398
1463
  }
@@ -1424,12 +1489,12 @@ function gt() {
1424
1489
  color: #1f2937;
1425
1490
  }
1426
1491
 
1427
- .${u}.rte-translation-workflow-theme-dark .rte-translation-preview-label {
1492
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-preview-label {
1428
1493
  color: #94a3b8;
1429
1494
  }
1430
1495
 
1431
- .${u}.rte-translation-workflow-theme-dark .rte-translation-source-preview,
1432
- .${u}.rte-translation-workflow-theme-dark .rte-translation-target-preview {
1496
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-source-preview,
1497
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-target-preview {
1433
1498
  border-color: #334155;
1434
1499
  background: #111827;
1435
1500
  color: #e2e8f0;
@@ -1470,23 +1535,23 @@ function gt() {
1470
1535
  background: #f0f9ff;
1471
1536
  }
1472
1537
 
1473
- .${u}.rte-translation-workflow-theme-dark .rte-translation-issue {
1538
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue {
1474
1539
  border-color: #334155;
1475
1540
  background: #111827;
1476
1541
  color: #e2e8f0;
1477
1542
  }
1478
1543
 
1479
- .${u}.rte-translation-workflow-theme-dark .rte-translation-issue.error {
1544
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue.error {
1480
1545
  border-color: rgba(239, 68, 68, 0.7);
1481
1546
  background: rgba(127, 29, 29, 0.28);
1482
1547
  }
1483
1548
 
1484
- .${u}.rte-translation-workflow-theme-dark .rte-translation-issue.warning {
1549
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue.warning {
1485
1550
  border-color: rgba(245, 158, 11, 0.72);
1486
1551
  background: rgba(120, 53, 15, 0.28);
1487
1552
  }
1488
1553
 
1489
- .${u}.rte-translation-workflow-theme-dark .rte-translation-issue.info {
1554
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue.info {
1490
1555
  border-color: rgba(14, 165, 233, 0.7);
1491
1556
  background: rgba(7, 89, 133, 0.28);
1492
1557
  }
@@ -1503,11 +1568,11 @@ function gt() {
1503
1568
  color: #475569;
1504
1569
  }
1505
1570
 
1506
- .${u}.rte-translation-workflow-theme-dark .rte-translation-issue-message {
1571
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue-message {
1507
1572
  color: #e2e8f0;
1508
1573
  }
1509
1574
 
1510
- .${u}.rte-translation-workflow-theme-dark .rte-translation-issue-suggestion {
1575
+ .${d}.rte-translation-workflow-theme-dark .rte-translation-issue-suggestion {
1511
1576
  color: #cbd5e1;
1512
1577
  }
1513
1578
 
@@ -1535,13 +1600,13 @@ function gt() {
1535
1600
  border-radius: 4px;
1536
1601
  }
1537
1602
 
1538
- ${h} [data-translation-locked="true"].rte-translation-segment-locked {
1603
+ ${k} [data-translation-locked="true"].rte-translation-segment-locked {
1539
1604
  outline-color: rgba(245, 158, 11, 0.75);
1540
1605
  background: rgba(120, 53, 15, 0.22);
1541
1606
  }
1542
1607
 
1543
1608
  @media (max-width: 920px) {
1544
- .${u} {
1609
+ .${d} {
1545
1610
  left: 10px !important;
1546
1611
  right: 10px;
1547
1612
  top: 10px !important;
@@ -1558,7 +1623,7 @@ function gt() {
1558
1623
  `, document.head.appendChild(e);
1559
1624
  }
1560
1625
  const mt = (e = {}) => {
1561
- const t = oe(e), r = /* @__PURE__ */ new Set();
1626
+ const n = ae(e), t = /* @__PURE__ */ new Set();
1562
1627
  return gt(), {
1563
1628
  name: "translationWorkflow",
1564
1629
  toolbar: [
@@ -1599,83 +1664,93 @@ const mt = (e = {}) => {
1599
1664
  }
1600
1665
  ],
1601
1666
  commands: {
1602
- translationWorkflow: (n, a) => {
1667
+ translationWorkflow: (r, a) => {
1603
1668
  const o = T(a, !1, !1);
1604
- if (!o) return !1;
1605
- const l = c.get(o) || t;
1606
- return b(o, l), c.set(o, l), x = o, he(o), !0;
1669
+ if (!o)
1670
+ return !1;
1671
+ const l = u.get(o) || n;
1672
+ return b(o, l), u.set(o, l), x = o, he(o), !0;
1607
1673
  },
1608
- openTranslationWorkflowPanel: (n, a) => {
1674
+ openTranslationWorkflowPanel: (r, a) => {
1609
1675
  const o = T(a, !1, !1);
1610
- if (!o) return !1;
1611
- const l = c.get(o) || t;
1612
- return b(o, l), c.set(o, l), x = o, he(o), !0;
1676
+ if (!o)
1677
+ return !1;
1678
+ const l = u.get(o) || n;
1679
+ return b(o, l), u.set(o, l), x = o, he(o), !0;
1613
1680
  },
1614
- toggleTranslationWorkflowPanel: (n, a) => {
1681
+ toggleTranslationWorkflowPanel: (r, a) => {
1615
1682
  const o = T(a, !1, !1);
1616
- if (!o) return !1;
1617
- const l = c.get(o) || t;
1618
- return b(o, l), c.set(o, l), x = o, ze(o, typeof n == "boolean" ? n : void 0);
1683
+ if (!o)
1684
+ return !1;
1685
+ const l = u.get(o) || n;
1686
+ return b(o, l), u.set(o, l), x = o, ze(o, typeof r == "boolean" ? r : void 0);
1619
1687
  },
1620
- runTranslationLocaleValidation: (n, a) => {
1688
+ runTranslationLocaleValidation: (r, a) => {
1621
1689
  const o = T(a, !1, !1);
1622
- if (!o) return !1;
1623
- const l = c.get(o) || t;
1624
- return b(o, l), c.set(o, l), x = o, L(o, "command", !0), !0;
1690
+ if (!o)
1691
+ return !1;
1692
+ const l = u.get(o) || n;
1693
+ return b(o, l), u.set(o, l), x = o, L(o, "command", !0), !0;
1625
1694
  },
1626
- toggleTranslationRealtime: (n, a) => {
1695
+ toggleTranslationRealtime: (r, a) => {
1627
1696
  const o = T(a, !1, !1);
1628
- if (!o) return !1;
1629
- const l = c.get(o) || t;
1630
- return b(o, l), c.set(o, l), x = o, De(o, typeof n == "boolean" ? n : void 0);
1697
+ if (!o)
1698
+ return !1;
1699
+ const l = u.get(o) || n;
1700
+ return b(o, l), u.set(o, l), x = o, De(o, typeof r == "boolean" ? r : void 0);
1631
1701
  },
1632
- toggleTranslationSegmentLock: (n, a) => {
1702
+ toggleTranslationSegmentLock: (r, a) => {
1633
1703
  const o = T(a, !1, !1);
1634
- if (!o) return !1;
1635
- const l = c.get(o) || t;
1636
- b(o, l), c.set(o, l), x = o;
1637
- const s = typeof n == "boolean" ? n : n?.locked, i = typeof n == "object" ? n?.segmentId : void 0;
1638
- return se(o, i, s);
1704
+ if (!o)
1705
+ return !1;
1706
+ const l = u.get(o) || n;
1707
+ b(o, l), u.set(o, l), x = o;
1708
+ const s = typeof r == "boolean" ? r : r == null ? void 0 : r.locked, i = typeof r == "object" ? r == null ? void 0 : r.segmentId : void 0;
1709
+ return ie(o, i, s);
1639
1710
  },
1640
- setTranslationLocales: (n, a) => {
1711
+ setTranslationLocales: (r, a) => {
1641
1712
  const o = T(a, !1, !1);
1642
- if (!o || !n || typeof n != "object") return !1;
1643
- const l = c.get(o) || t, s = b(o, l);
1644
- return c.set(o, l), typeof n.sourceLocale == "string" && n.sourceLocale.trim() && (s.sourceLocale = A(n.sourceLocale)), typeof n.targetLocale == "string" && n.targetLocale.trim() && (s.targetLocale = A(n.targetLocale)), s.snapshot = "", L(o, "set-locales", !0), !0;
1713
+ if (!o || !r || typeof r != "object")
1714
+ return !1;
1715
+ const l = u.get(o) || n, s = b(o, l);
1716
+ return u.set(o, l), typeof r.sourceLocale == "string" && r.sourceLocale.trim() && (s.sourceLocale = E(r.sourceLocale)), typeof r.targetLocale == "string" && r.targetLocale.trim() && (s.targetLocale = E(r.targetLocale)), s.snapshot = "", L(o, "set-locales", !0), !0;
1645
1717
  },
1646
- captureTranslationSourceSnapshot: (n, a) => {
1718
+ captureTranslationSourceSnapshot: (r, a) => {
1647
1719
  const o = T(a, !1, !1);
1648
- if (!o) return !1;
1649
- const l = c.get(o) || t;
1650
- return b(o, l), c.set(o, l), x = o, Pe(o);
1720
+ if (!o)
1721
+ return !1;
1722
+ const l = u.get(o) || n;
1723
+ return b(o, l), u.set(o, l), x = o, Pe(o);
1651
1724
  },
1652
- setTranslationWorkflowOptions: (n, a) => {
1725
+ setTranslationWorkflowOptions: (r, a) => {
1653
1726
  const o = T(a, !1, !1);
1654
- if (!o || !n || typeof n != "object") return !1;
1655
- const l = c.get(o) || t, s = re.get(o) || Ge(l), i = {
1727
+ if (!o || !r || typeof r != "object")
1728
+ return !1;
1729
+ const l = u.get(o) || n, s = oe.get(o) || Ge(l), i = {
1656
1730
  ...s,
1657
- ...n,
1731
+ ...r,
1658
1732
  labels: {
1659
1733
  ...s.labels || {},
1660
- ...n.labels || {}
1734
+ ...r.labels || {}
1661
1735
  },
1662
- localeRules: Array.isArray(n.localeRules) ? n.localeRules : s.localeRules,
1663
- locales: Array.isArray(n.locales) ? n.locales : s.locales,
1664
- normalizeText: n.normalizeText || l.normalizeText
1665
- }, d = oe(i);
1666
- c.set(o, d), re.set(o, i);
1667
- const g = b(o, d);
1668
- return typeof n.enableRealtime == "boolean" && (g.realtimeEnabled = n.enableRealtime), typeof n.sourceLocale == "string" && n.sourceLocale.trim() && (g.sourceLocale = A(n.sourceLocale)), typeof n.targetLocale == "string" && n.targetLocale.trim() && (g.targetLocale = A(n.targetLocale)), g.snapshot = "", L(o, "set-options", !0), R(o), E(o), !0;
1736
+ localeRules: Array.isArray(r.localeRules) ? r.localeRules : s.localeRules,
1737
+ locales: Array.isArray(r.locales) ? r.locales : s.locales,
1738
+ normalizeText: r.normalizeText || l.normalizeText
1739
+ }, c = ae(i);
1740
+ u.set(o, c), oe.set(o, i);
1741
+ const g = b(o, c);
1742
+ return typeof r.enableRealtime == "boolean" && (g.realtimeEnabled = r.enableRealtime), typeof r.sourceLocale == "string" && r.sourceLocale.trim() && (g.sourceLocale = E(r.sourceLocale)), typeof r.targetLocale == "string" && r.targetLocale.trim() && (g.targetLocale = E(r.targetLocale)), g.snapshot = "", L(o, "set-options", !0), A(o), $(o), !0;
1669
1743
  },
1670
- getTranslationWorkflowState: (n, a) => {
1744
+ getTranslationWorkflowState: (r, a) => {
1671
1745
  const o = T(a, !1, !1);
1672
- if (!o) return !1;
1673
- const l = c.get(o) || t;
1746
+ if (!o)
1747
+ return !1;
1748
+ const l = u.get(o) || n;
1674
1749
  b(o, l);
1675
1750
  const s = qe(o);
1676
- if (typeof n == "function")
1751
+ if (typeof r == "function")
1677
1752
  try {
1678
- n(s);
1753
+ r(s);
1679
1754
  } catch {
1680
1755
  }
1681
1756
  return o.__translationWorkflowState = s, o.dispatchEvent(
@@ -1695,21 +1770,22 @@ const mt = (e = {}) => {
1695
1770
  "Mod-Alt-Shift-K": "toggleTranslationSegmentLock"
1696
1771
  },
1697
1772
  init: function(a) {
1698
- X += 1;
1699
- const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, l = oe(o);
1773
+ ee += 1;
1774
+ const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, l = ae(o);
1700
1775
  dt(l);
1701
1776
  const s = T(
1702
- a?.editorElement ? { editorElement: a.editorElement } : void 0,
1777
+ a != null && a.editorElement ? { editorElement: a.editorElement } : void 0,
1703
1778
  !1,
1704
1779
  !1
1705
1780
  );
1706
- if (!s) return;
1707
- x = s, r.add(s);
1781
+ if (!s)
1782
+ return;
1783
+ x = s, t.add(s);
1708
1784
  const i = b(s, l);
1709
- c.set(s, l), re.set(s, o), i.segments = M(s, l, i), L(s, "init", !0), E(s);
1785
+ u.set(s, l), oe.set(s, o), i.segments = M(s, l, i), L(s, "init", !0), $(s);
1710
1786
  },
1711
1787
  destroy: () => {
1712
- r.forEach((n) => Se(n)), r.clear(), X = Math.max(0, X - 1), !(X > 0) && ft();
1788
+ t.forEach((r) => Se(r)), t.clear(), ee = Math.max(0, ee - 1), !(ee > 0) && ft();
1713
1789
  }
1714
1790
  };
1715
1791
  };