@editora/plugins 1.0.10 → 1.0.11

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