fable-editor 1.2.2 → 1.2.4

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.
@@ -9,19 +9,19 @@ var Et = { exports: {} }, J = {};
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
- var Qt;
12
+ var Gt;
13
13
  function $e() {
14
- if (Qt) return J;
15
- Qt = 1;
16
- var u = ce, t = Symbol.for("react.element"), e = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, s = u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
17
- function n(r, o, c) {
18
- var d, p = {}, m = null, b = null;
14
+ if (Gt) return J;
15
+ Gt = 1;
16
+ var p = ce, t = Symbol.for("react.element"), e = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, s = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = { key: !0, ref: !0, __self: !0, __source: !0 };
17
+ function l(r, o, c) {
18
+ var d, u = {}, m = null, b = null;
19
19
  c !== void 0 && (m = "" + c), o.key !== void 0 && (m = "" + o.key), o.ref !== void 0 && (b = o.ref);
20
- for (d in o) i.call(o, d) && !l.hasOwnProperty(d) && (p[d] = o[d]);
21
- if (r && r.defaultProps) for (d in o = r.defaultProps, o) p[d] === void 0 && (p[d] = o[d]);
22
- return { $$typeof: t, type: r, key: m, ref: b, props: p, _owner: s.current };
20
+ for (d in o) i.call(o, d) && !n.hasOwnProperty(d) && (u[d] = o[d]);
21
+ if (r && r.defaultProps) for (d in o = r.defaultProps, o) u[d] === void 0 && (u[d] = o[d]);
22
+ return { $$typeof: t, type: r, key: m, ref: b, props: u, _owner: s.current };
23
23
  }
24
- return J.Fragment = e, J.jsx = n, J.jsxs = n, J;
24
+ return J.Fragment = e, J.jsx = l, J.jsxs = l, J;
25
25
  }
26
26
  var tt = {};
27
27
  /**
@@ -36,14 +36,14 @@ var tt = {};
36
36
  var Kt;
37
37
  function je() {
38
38
  return Kt || (Kt = 1, process.env.NODE_ENV !== "production" && function() {
39
- var u = ce, t = Symbol.for("react.element"), e = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), n = Symbol.for("react.provider"), r = Symbol.for("react.context"), o = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), y = Symbol.iterator, g = "@@iterator";
39
+ var p = ce, t = Symbol.for("react.element"), e = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), n = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), r = Symbol.for("react.context"), o = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), u = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), y = Symbol.iterator, g = "@@iterator";
40
40
  function x(a) {
41
41
  if (a === null || typeof a != "object")
42
42
  return null;
43
43
  var f = y && a[y] || a[g];
44
44
  return typeof f == "function" ? f : null;
45
45
  }
46
- var w = u.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
46
+ var w = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
47
47
  function E(a) {
48
48
  {
49
49
  for (var f = arguments.length, v = new Array(f > 1 ? f - 1 : 0), T = 1; T < f; T++)
@@ -64,13 +64,13 @@ function je() {
64
64
  var H = !1, $ = !1, O = !1, _ = !1, et = !1, Mt;
65
65
  Mt = Symbol.for("react.module.reference");
66
66
  function de(a) {
67
- return !!(typeof a == "string" || typeof a == "function" || a === i || a === l || et || a === s || a === c || a === d || _ || a === b || H || $ || O || typeof a == "object" && a !== null && (a.$$typeof === m || a.$$typeof === p || a.$$typeof === n || a.$$typeof === r || a.$$typeof === o || // This needs to include all possible module reference object
67
+ return !!(typeof a == "string" || typeof a == "function" || a === i || a === n || et || a === s || a === c || a === d || _ || a === b || H || $ || O || typeof a == "object" && a !== null && (a.$$typeof === m || a.$$typeof === u || a.$$typeof === l || a.$$typeof === r || a.$$typeof === o || // This needs to include all possible module reference object
68
68
  // types supported by any Flight configuration anywhere since
69
69
  // we don't know which Flight build this will end up being used
70
70
  // with.
71
71
  a.$$typeof === Mt || a.getModuleId !== void 0));
72
72
  }
73
- function pe(a, f, v) {
73
+ function ue(a, f, v) {
74
74
  var T = a.displayName;
75
75
  if (T)
76
76
  return T;
@@ -92,7 +92,7 @@ function je() {
92
92
  return "Fragment";
93
93
  case e:
94
94
  return "Portal";
95
- case l:
95
+ case n:
96
96
  return "Profiler";
97
97
  case s:
98
98
  return "StrictMode";
@@ -106,12 +106,12 @@ function je() {
106
106
  case r:
107
107
  var f = a;
108
108
  return kt(f) + ".Consumer";
109
- case n:
109
+ case l:
110
110
  var v = a;
111
111
  return kt(v._context) + ".Provider";
112
112
  case o:
113
- return pe(a, a.render, "ForwardRef");
114
- case p:
113
+ return ue(a, a.render, "ForwardRef");
114
+ case u:
115
115
  var T = a.displayName || null;
116
116
  return T !== null ? T : W(a.type) || "Memo";
117
117
  case m: {
@@ -125,13 +125,13 @@ function je() {
125
125
  }
126
126
  return null;
127
127
  }
128
- var V = Object.assign, Q = 0, Lt, Ht, It, At, qt, Rt, Pt;
128
+ var V = Object.assign, G = 0, Lt, Ht, It, At, qt, Rt, Pt;
129
129
  function Bt() {
130
130
  }
131
131
  Bt.__reactDisabledLog = !0;
132
- function ue() {
132
+ function pe() {
133
133
  {
134
- if (Q === 0) {
134
+ if (G === 0) {
135
135
  Lt = console.log, Ht = console.info, It = console.warn, At = console.error, qt = console.group, Rt = console.groupCollapsed, Pt = console.groupEnd;
136
136
  var a = {
137
137
  configurable: !0,
@@ -149,12 +149,12 @@ function je() {
149
149
  groupEnd: a
150
150
  });
151
151
  }
152
- Q++;
152
+ G++;
153
153
  }
154
154
  }
155
155
  function me() {
156
156
  {
157
- if (Q--, Q === 0) {
157
+ if (G--, G === 0) {
158
158
  var a = {
159
159
  configurable: !0,
160
160
  enumerable: !0,
@@ -184,10 +184,10 @@ function je() {
184
184
  })
185
185
  });
186
186
  }
187
- Q < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
187
+ G < 0 && E("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
188
188
  }
189
189
  }
190
- var ut = w.ReactCurrentDispatcher, mt;
190
+ var pt = w.ReactCurrentDispatcher, mt;
191
191
  function it(a, f, v) {
192
192
  {
193
193
  if (mt === void 0)
@@ -206,7 +206,7 @@ function je() {
206
206
  var fe = typeof WeakMap == "function" ? WeakMap : Map;
207
207
  st = new fe();
208
208
  }
209
- function Dt(a, f) {
209
+ function Nt(a, f) {
210
210
  if (!a || ft)
211
211
  return "";
212
212
  {
@@ -219,7 +219,7 @@ function je() {
219
219
  var L = Error.prepareStackTrace;
220
220
  Error.prepareStackTrace = void 0;
221
221
  var I;
222
- I = ut.current, ut.current = null, ue();
222
+ I = pt.current, pt.current = null, pe();
223
223
  try {
224
224
  if (f) {
225
225
  var M = function() {
@@ -232,37 +232,37 @@ function je() {
232
232
  }), typeof Reflect == "object" && Reflect.construct) {
233
233
  try {
234
234
  Reflect.construct(M, []);
235
- } catch (N) {
236
- T = N;
235
+ } catch (D) {
236
+ T = D;
237
237
  }
238
238
  Reflect.construct(a, [], M);
239
239
  } else {
240
240
  try {
241
241
  M.call();
242
- } catch (N) {
243
- T = N;
242
+ } catch (D) {
243
+ T = D;
244
244
  }
245
245
  a.call(M.prototype);
246
246
  }
247
247
  } else {
248
248
  try {
249
249
  throw Error();
250
- } catch (N) {
251
- T = N;
250
+ } catch (D) {
251
+ T = D;
252
252
  }
253
253
  a();
254
254
  }
255
- } catch (N) {
256
- if (N && T && typeof N.stack == "string") {
257
- for (var S = N.stack.split(`
258
- `), D = T.stack.split(`
259
- `), R = S.length - 1, P = D.length - 1; R >= 1 && P >= 0 && S[R] !== D[P]; )
255
+ } catch (D) {
256
+ if (D && T && typeof D.stack == "string") {
257
+ for (var S = D.stack.split(`
258
+ `), N = T.stack.split(`
259
+ `), R = S.length - 1, P = N.length - 1; R >= 1 && P >= 0 && S[R] !== N[P]; )
260
260
  P--;
261
261
  for (; R >= 1 && P >= 0; R--, P--)
262
- if (S[R] !== D[P]) {
262
+ if (S[R] !== N[P]) {
263
263
  if (R !== 1 || P !== 1)
264
264
  do
265
- if (R--, P--, P < 0 || S[R] !== D[P]) {
265
+ if (R--, P--, P < 0 || S[R] !== N[P]) {
266
266
  var F = `
267
267
  ` + S[R].replace(" at new ", " at ");
268
268
  return a.displayName && F.includes("<anonymous>") && (F = F.replace("<anonymous>", a.displayName)), typeof a == "function" && st.set(a, F), F;
@@ -272,23 +272,23 @@ function je() {
272
272
  }
273
273
  }
274
274
  } finally {
275
- ft = !1, ut.current = I, me(), Error.prepareStackTrace = L;
275
+ ft = !1, pt.current = I, me(), Error.prepareStackTrace = L;
276
276
  }
277
- var G = a ? a.displayName || a.name : "", U = G ? it(G) : "";
277
+ var Q = a ? a.displayName || a.name : "", U = Q ? it(Q) : "";
278
278
  return typeof a == "function" && st.set(a, U), U;
279
279
  }
280
280
  function ge(a, f, v) {
281
- return Dt(a, !1);
281
+ return Nt(a, !1);
282
282
  }
283
283
  function ve(a) {
284
284
  var f = a.prototype;
285
285
  return !!(f && f.isReactComponent);
286
286
  }
287
- function lt(a, f, v) {
287
+ function nt(a, f, v) {
288
288
  if (a == null)
289
289
  return "";
290
290
  if (typeof a == "function")
291
- return Dt(a, ve(a));
291
+ return Nt(a, ve(a));
292
292
  if (typeof a == "string")
293
293
  return it(a);
294
294
  switch (a) {
@@ -301,22 +301,22 @@ function je() {
301
301
  switch (a.$$typeof) {
302
302
  case o:
303
303
  return ge(a.render);
304
- case p:
305
- return lt(a.type, f, v);
304
+ case u:
305
+ return nt(a.type, f, v);
306
306
  case m: {
307
307
  var T = a, L = T._payload, I = T._init;
308
308
  try {
309
- return lt(I(L), f, v);
309
+ return nt(I(L), f, v);
310
310
  } catch {
311
311
  }
312
312
  }
313
313
  }
314
314
  return "";
315
315
  }
316
- var K = Object.prototype.hasOwnProperty, Nt = {}, Zt = w.ReactDebugCurrentFrame;
317
- function nt(a) {
316
+ var K = Object.prototype.hasOwnProperty, Dt = {}, Zt = w.ReactDebugCurrentFrame;
317
+ function lt(a) {
318
318
  if (a) {
319
- var f = a._owner, v = lt(a.type, a._source, f ? f.type : null);
319
+ var f = a._owner, v = nt(a.type, a._source, f ? f.type : null);
320
320
  Zt.setExtraStackFrame(v);
321
321
  } else
322
322
  Zt.setExtraStackFrame(null);
@@ -329,14 +329,14 @@ function je() {
329
329
  var S = void 0;
330
330
  try {
331
331
  if (typeof a[M] != "function") {
332
- var D = Error((T || "React class") + ": " + v + " type `" + M + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[M] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
333
- throw D.name = "Invariant Violation", D;
332
+ var N = Error((T || "React class") + ": " + v + " type `" + M + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[M] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
333
+ throw N.name = "Invariant Violation", N;
334
334
  }
335
335
  S = a[M](f, M, T, v, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
336
336
  } catch (R) {
337
337
  S = R;
338
338
  }
339
- S && !(S instanceof Error) && (nt(L), E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", T || "React class", v, M, typeof S), nt(null)), S instanceof Error && !(S.message in Nt) && (Nt[S.message] = !0, nt(L), E("Failed %s type: %s", v, S.message), nt(null));
339
+ S && !(S instanceof Error) && (lt(L), E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", T || "React class", v, M, typeof S), lt(null)), S instanceof Error && !(S.message in Dt) && (Dt[S.message] = !0, lt(L), E("Failed %s type: %s", v, S.message), lt(null));
340
340
  }
341
341
  }
342
342
  }
@@ -442,8 +442,8 @@ function je() {
442
442
  };
443
443
  function He(a, f, v, T, L) {
444
444
  {
445
- var I, M = {}, S = null, D = null;
446
- v !== void 0 && (_t(v), S = "" + v), Ee(f) && (_t(f.key), S = "" + f.key), Te(f) && (D = f.ref, Se(f, L));
445
+ var I, M = {}, S = null, N = null;
446
+ v !== void 0 && (_t(v), S = "" + v), Ee(f) && (_t(f.key), S = "" + f.key), Te(f) && (N = f.ref, Se(f, L));
447
447
  for (I in f)
448
448
  K.call(f, I) && !we.hasOwnProperty(I) && (M[I] = f[I]);
449
449
  if (a && a.defaultProps) {
@@ -451,17 +451,17 @@ function je() {
451
451
  for (I in R)
452
452
  M[I] === void 0 && (M[I] = R[I]);
453
453
  }
454
- if (S || D) {
454
+ if (S || N) {
455
455
  var P = typeof a == "function" ? a.displayName || a.name || "Unknown" : a;
456
- S && Me(M, P), D && ke(M, P);
456
+ S && Me(M, P), N && ke(M, P);
457
457
  }
458
- return Le(a, S, D, L, T, Ft.current, M);
458
+ return Le(a, S, N, L, T, Ft.current, M);
459
459
  }
460
460
  }
461
461
  var vt = w.ReactCurrentOwner, Wt = w.ReactDebugCurrentFrame;
462
462
  function Y(a) {
463
463
  if (a) {
464
- var f = a._owner, v = lt(a.type, a._source, f ? f.type : null);
464
+ var f = a._owner, v = nt(a.type, a._source, f ? f.type : null);
465
465
  Wt.setExtraStackFrame(v);
466
466
  } else
467
467
  Wt.setExtraStackFrame(null);
@@ -541,7 +541,7 @@ Check the top-level render call using <` + v + ">.");
541
541
  v = f.propTypes;
542
542
  else if (typeof f == "object" && (f.$$typeof === o || // Note: Memo only checks outer props here.
543
543
  // Inner props are checked in the reconciler.
544
- f.$$typeof === p))
544
+ f.$$typeof === u))
545
545
  v = f.propTypes;
546
546
  else
547
547
  return;
@@ -569,14 +569,14 @@ Check the top-level render call using <` + v + ">.");
569
569
  }
570
570
  }
571
571
  var Yt = {};
572
- function Gt(a, f, v, T, L, I) {
572
+ function Qt(a, f, v, T, L, I) {
573
573
  {
574
574
  var M = de(a);
575
575
  if (!M) {
576
576
  var S = "";
577
577
  (a === void 0 || typeof a == "object" && a !== null && Object.keys(a).length === 0) && (S += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
578
- var D = Ie();
579
- D ? S += D : S += Vt();
578
+ var N = Ie();
579
+ N ? S += N : S += Vt();
580
580
  var R;
581
581
  a === null ? R = "null" : gt(a) ? R = "array" : a !== void 0 && a.$$typeof === t ? (R = "<" + (W(a.type) || "Unknown") + " />", S = " Did you accidentally export a JSX literal instead of a component?") : R = typeof a, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, S);
582
582
  }
@@ -588,8 +588,8 @@ Check the top-level render call using <` + v + ">.");
588
588
  if (F !== void 0)
589
589
  if (T)
590
590
  if (gt(F)) {
591
- for (var G = 0; G < F.length; G++)
592
- Xt(F[G], a);
591
+ for (var Q = 0; Q < F.length; Q++)
592
+ Xt(F[Q], a);
593
593
  Object.freeze && Object.freeze(F);
594
594
  } else
595
595
  E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
@@ -597,11 +597,11 @@ Check the top-level render call using <` + v + ">.");
597
597
  Xt(F, a);
598
598
  }
599
599
  if (K.call(f, "key")) {
600
- var U = W(a), N = Object.keys(f).filter(function(Oe) {
600
+ var U = W(a), D = Object.keys(f).filter(function(Oe) {
601
601
  return Oe !== "key";
602
- }), xt = N.length > 0 ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}";
602
+ }), xt = D.length > 0 ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}";
603
603
  if (!Yt[U + xt]) {
604
- var Ze = N.length > 0 ? "{" + N.join(": ..., ") + ": ...}" : "{}";
604
+ var Ze = D.length > 0 ? "{" + D.join(": ..., ") + ": ...}" : "{}";
605
605
  E(`A props object containing a "key" prop is being spread into JSX:
606
606
  let props = %s;
607
607
  <%s {...props} />
@@ -614,13 +614,13 @@ React keys must be passed directly to JSX without using spread:
614
614
  }
615
615
  }
616
616
  function Pe(a, f, v) {
617
- return Gt(a, f, v, !0);
617
+ return Qt(a, f, v, !0);
618
618
  }
619
619
  function Be(a, f, v) {
620
- return Gt(a, f, v, !1);
620
+ return Qt(a, f, v, !1);
621
621
  }
622
- var De = Be, Ne = Pe;
623
- tt.Fragment = i, tt.jsx = De, tt.jsxs = Ne;
622
+ var Ne = Be, De = Pe;
623
+ tt.Fragment = i, tt.jsx = Ne, tt.jsxs = De;
624
624
  }()), tt;
625
625
  }
626
626
  process.env.NODE_ENV === "production" ? Et.exports = $e() : Et.exports = je();
@@ -1011,8 +1011,8 @@ const Ve = {
1011
1011
  emcat_flags: "أعلام"
1012
1012
  }
1013
1013
  };
1014
- function Ct(u) {
1015
- return Ve[u];
1014
+ function Ct(p) {
1015
+ return Ve[p];
1016
1016
  }
1017
1017
  const Ue = "undo redo | preview print | importword revhistory | fontfamily fontsize | fontsizeincrease fontsizedecrease | bold italic underline strikethrough | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | link blockquote code changecase lineheight wordspacing letterspacing | removeformat | blocks | ltr rtl | quickimage quickvideo quicktable codesample template charmap emoji | fullscreen sourcecode", ze = "file edit view insert format tools table help", Xe = [
1018
1018
  ["Andale Mono", "andale mono,times"],
@@ -1034,7 +1034,7 @@ const Ue = "undo redo | preview print | importword revhistory | fontfamily fonts
1034
1034
  ["Verdana", "verdana,geneva"],
1035
1035
  ["Webdings", "webdings"],
1036
1036
  ["Wingdings", "wingdings,zapf dingbats"]
1037
- ], Ye = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], Ge = 1, Qe = 100, Jt = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], te = ["1px", "2px", "4px", "6px", "8px", "12px"], ee = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], ie = [
1037
+ ], Ye = ["8px", "9px", "10px", "11px", "12px", "14px", "16px", "18px", "20px", "24px", "28px", "32px", "36px", "48px", "72px", "96px"], Qe = 1, Ge = 100, Jt = ["1", "1.15", "1.4", "1.5", "1.75", "2", "2.5", "3"], te = ["1px", "2px", "4px", "6px", "8px", "12px"], ee = ["0.5px", "1px", "1.5px", "2px", "3px", "4px"], ie = [
1038
1038
  ["plain", "Plain text"],
1039
1039
  ["html", "HTML/XML"],
1040
1040
  ["css", "CSS"],
@@ -2151,8 +2151,8 @@ const Ue = "undo redo | preview print | importword revhistory | fontfamily fonts
2151
2151
  "🇲🇦"
2152
2152
  ]
2153
2153
  }
2154
- ], k = (u, t) => `<svg viewBox="${t || "0 0 24 24"}">${u}</svg>`, C = (u) => k(`<path class="f" d="${u}"/>`, "0 -960 960 960"), rt = (u, t = 7.5) => k(
2155
- '<path d="M10 6h10M10 12h10M10 18h10"/>' + u.map(
2154
+ ], k = (p, t) => `<svg viewBox="${t || "0 0 24 24"}">${p}</svg>`, C = (p) => k(`<path class="f" d="${p}"/>`, "0 -960 960 960"), rt = (p, t = 7.5) => k(
2155
+ '<path d="M10 6h10M10 12h10M10 18h10"/>' + p.map(
2156
2156
  (e, i) => `<text x="2.5" y="${8.4 + i * 6}" font-size="${t}" stroke="none" fill="#222f3e" font-family="Arial">${e}</text>`
2157
2157
  ).join("")
2158
2158
  ), h = {
@@ -2478,7 +2478,7 @@ const Ue = "undo redo | preview print | importword revhistory | fontfamily fonts
2478
2478
  "box-sizing",
2479
2479
  "list-style-type",
2480
2480
  "white-space"
2481
- ]), le = {
2481
+ ]), ne = {
2482
2482
  "*": ["dir", "lang", "colspan", "rowspan"],
2483
2483
  a: ["href", "target", "rel", "title"],
2484
2484
  img: ["src", "alt", "width", "height", "title"],
@@ -2487,82 +2487,82 @@ const Ue = "undo redo | preview print | importword revhistory | fontfamily fonts
2487
2487
  th: ["width", "valign"],
2488
2488
  table: ["width", "cellpadding", "cellspacing"]
2489
2489
  };
2490
- function pt(u) {
2491
- const t = {}, e = u.getAttribute && u.getAttribute("style");
2490
+ function ut(p) {
2491
+ const t = {}, e = p.getAttribute && p.getAttribute("style");
2492
2492
  return e && e.split(";").forEach((i) => {
2493
2493
  const s = i.indexOf(":");
2494
2494
  s < 1 || (t[i.slice(0, s).trim().toLowerCase()] = i.slice(s + 1).trim());
2495
2495
  }), t;
2496
2496
  }
2497
- function li(u) {
2498
- return u.replace(/<!--\[if !supportLists\]-->([\s\S]*?)<!--\[endif\]-->/gi, "$1").replace(/<!--\[if !supportLists\]>([\s\S]*?)<!\[endif\]-->/gi, "$1").replace(/<!\[if !supportLists\]>([\s\S]*?)<!\[endif\]>/gi, "$1").replace(/<!--\[if [\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<(script|style|xml|title)[\s\S]*?<\/\1>/gi, "").replace(/<\/?(meta|link)[^>]*>/gi, "").replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<\/?(o|v|w|m|st1):[^>]*>/gi, "");
2497
+ function ni(p) {
2498
+ return p.replace(/<!--\[if !supportLists\]-->([\s\S]*?)<!--\[endif\]-->/gi, "$1").replace(/<!--\[if !supportLists\]>([\s\S]*?)<!\[endif\]-->/gi, "$1").replace(/<!\[if !supportLists\]>([\s\S]*?)<!\[endif\]>/gi, "$1").replace(/<!--\[if [\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<(script|style|xml|title)[\s\S]*?<\/\1>/gi, "").replace(/<\/?(meta|link)[^>]*>/gi, "").replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<\/?(o|v|w|m|st1):[^>]*>/gi, "");
2499
2499
  }
2500
- function ni(u) {
2501
- return /^[0-9]+[\.\)،]/.test(u) ? { ordered: !0 } : /^[٠-٩۰-۹]+/.test(u) ? { ordered: !0, style: "arabic-indic" } : /^[ivxlc]{2,}[\.\)]/.test(u) ? { ordered: !0, style: "lower-roman" } : /^[IVXLC]{2,}[\.\)]/.test(u) ? { ordered: !0, style: "upper-roman" } : /^[a-z][\.\)]/.test(u) ? { ordered: !0, style: "lower-alpha" } : /^[A-Z][\.\)]/.test(u) ? { ordered: !0, style: "upper-alpha" } : /^[ء-ي][\.\)،-]/.test(u) ? { ordered: !0, style: "arabic-indic" } : { ordered: !1 };
2500
+ function li(p) {
2501
+ return /^[0-9]+[\.\)،]/.test(p) ? { ordered: !0 } : /^[٠-٩۰-۹]+/.test(p) ? { ordered: !0, style: "arabic-indic" } : /^[ivxlc]{2,}[\.\)]/.test(p) ? { ordered: !0, style: "lower-roman" } : /^[IVXLC]{2,}[\.\)]/.test(p) ? { ordered: !0, style: "upper-roman" } : /^[a-z][\.\)]/.test(p) ? { ordered: !0, style: "lower-alpha" } : /^[A-Z][\.\)]/.test(p) ? { ordered: !0, style: "upper-alpha" } : /^[ء-ي][\.\)،-]/.test(p) ? { ordered: !0, style: "arabic-indic" } : { ordered: !1 };
2502
2502
  }
2503
- function oi(u) {
2503
+ function oi(p) {
2504
2504
  const t = (s) => {
2505
- const l = (s.getAttribute("style") || "") + " " + (s.className || "");
2506
- return /mso-list\s*:(?!\s*ignore)/i.test(l) || /MsoListParagraph/i.test(l);
2505
+ const n = (s.getAttribute("style") || "") + " " + (s.className || "");
2506
+ return /mso-list\s*:(?!\s*ignore)/i.test(n) || /MsoListParagraph/i.test(n);
2507
2507
  }, e = [];
2508
2508
  let i = null;
2509
- Array.from(u.body.querySelectorAll("p")).forEach((s) => {
2509
+ Array.from(p.body.querySelectorAll("p")).forEach((s) => {
2510
2510
  if (!t(s)) {
2511
2511
  i = null;
2512
2512
  return;
2513
2513
  }
2514
- const l = s.previousElementSibling;
2515
- i && l && i[i.length - 1] === l ? i.push(s) : (i = [s], e.push(i));
2514
+ const n = s.previousElementSibling;
2515
+ i && n && i[i.length - 1] === n ? i.push(s) : (i = [s], e.push(i));
2516
2516
  }), e.forEach((s) => {
2517
- const l = [], n = s[0];
2517
+ const n = [], l = s[0];
2518
2518
  s.forEach((r) => {
2519
2519
  var w, E, A;
2520
2520
  const c = +(((w = (r.getAttribute("style") || "").match(/level(\d+)/i)) == null ? void 0 : w[1]) || 1), d = Array.from(r.querySelectorAll("span")).find(
2521
2521
  (H) => /mso-list\s*:\s*ignore/i.test(H.getAttribute("style") || "")
2522
- ), p = d ? ((E = d.textContent) == null ? void 0 : E.trim()) || "" : (((A = r.textContent) == null ? void 0 : A.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: b } = ni(p);
2523
- for (d && d.remove(); l.length && l[l.length - 1].level > c; ) l.pop();
2524
- if (!l.length || l[l.length - 1].level < c) {
2525
- const H = u.createElement(m ? "ol" : "ul");
2526
- if (m && b && (H.style.listStyleType = b), l.length) {
2527
- const $ = l[l.length - 1].list;
2522
+ ), u = d ? ((E = d.textContent) == null ? void 0 : E.trim()) || "" : (((A = r.textContent) == null ? void 0 : A.trim().match(/^\S{1,4}/)) || [""])[0], { ordered: m, style: b } = li(u);
2523
+ for (d && d.remove(); n.length && n[n.length - 1].level > c; ) n.pop();
2524
+ if (!n.length || n[n.length - 1].level < c) {
2525
+ const H = p.createElement(m ? "ol" : "ul");
2526
+ if (m && b && (H.style.listStyleType = b), n.length) {
2527
+ const $ = n[n.length - 1].list;
2528
2528
  ($.lastElementChild || $).appendChild(H);
2529
2529
  } else
2530
- n.parentNode.insertBefore(H, n);
2531
- l.push({ list: H, level: c });
2530
+ l.parentNode.insertBefore(H, l);
2531
+ n.push({ list: H, level: c });
2532
2532
  }
2533
- const y = u.createElement("li"), g = pt(r), x = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((H) => g[H]).map((H) => H + ":" + g[H]).join(";");
2533
+ const y = p.createElement("li"), g = ut(r), x = ["text-align", "direction", "unicode-bidi", "color", "font-size", "font-family", "background-color"].filter((H) => g[H]).map((H) => H + ":" + g[H]).join(";");
2534
2534
  for (x && y.setAttribute("style", x), r.getAttribute("dir") && y.setAttribute("dir", r.getAttribute("dir")); r.firstChild; ) y.appendChild(r.firstChild);
2535
- l[l.length - 1].list.appendChild(y), r.remove();
2535
+ n[n.length - 1].list.appendChild(y), r.remove();
2536
2536
  });
2537
2537
  });
2538
2538
  }
2539
- function ri(u) {
2540
- u.querySelectorAll('b[id^="docs-internal-guid"]').forEach((t) => {
2539
+ function ri(p) {
2540
+ p.querySelectorAll('b[id^="docs-internal-guid"]').forEach((t) => {
2541
2541
  for (; t.firstChild; ) t.parentNode.insertBefore(t.firstChild, t);
2542
2542
  t.remove();
2543
2543
  });
2544
2544
  }
2545
- function ai(u) {
2546
- u.querySelectorAll("table").forEach((t) => {
2545
+ function ai(p) {
2546
+ p.querySelectorAll("table").forEach((t) => {
2547
2547
  const e = t;
2548
- pt(e)["border-collapse"] || (e.style.borderCollapse = "collapse");
2549
- }), u.querySelectorAll("[align]").forEach((t) => {
2548
+ ut(e)["border-collapse"] || (e.style.borderCollapse = "collapse");
2549
+ }), p.querySelectorAll("[align]").forEach((t) => {
2550
2550
  const e = t, i = e.getAttribute("align").toLowerCase();
2551
2551
  e.tagName.toLowerCase() === "table" ? i === "center" ? (e.style.marginLeft = e.style.marginLeft || "auto", e.style.marginRight = e.style.marginRight || "auto") : i === "right" ? e.style.marginLeft = e.style.marginLeft || "auto" : i === "left" && (e.style.marginRight = e.style.marginRight || "auto") : ["left", "right", "center", "justify"].includes(i) && (e.style.textAlign = e.style.textAlign || i, Array.from(e.children).forEach((s) => {
2552
2552
  if (s.tagName.toLowerCase() !== "table") return;
2553
- const l = s;
2554
- i === "center" ? (l.style.marginLeft = l.style.marginLeft || "auto", l.style.marginRight = l.style.marginRight || "auto") : i === "right" ? l.style.marginLeft = l.style.marginLeft || "auto" : i === "left" && (l.style.marginRight = l.style.marginRight || "auto");
2553
+ const n = s;
2554
+ i === "center" ? (n.style.marginLeft = n.style.marginLeft || "auto", n.style.marginRight = n.style.marginRight || "auto") : i === "right" ? n.style.marginLeft = n.style.marginLeft || "auto" : i === "left" && (n.style.marginRight = n.style.marginRight || "auto");
2555
2555
  })), e.removeAttribute("align");
2556
- }), u.querySelectorAll("center table").forEach((t) => {
2556
+ }), p.querySelectorAll("center table").forEach((t) => {
2557
2557
  const e = t;
2558
2558
  e.style.marginLeft = e.style.marginLeft || "auto", e.style.marginRight = e.style.marginRight || "auto";
2559
- }), u.querySelectorAll("[bgcolor]").forEach((t) => {
2559
+ }), p.querySelectorAll("[bgcolor]").forEach((t) => {
2560
2560
  const e = t;
2561
2561
  e.style.backgroundColor = e.style.backgroundColor || e.getAttribute("bgcolor"), e.removeAttribute("bgcolor");
2562
2562
  });
2563
2563
  }
2564
- function ht(u, t) {
2565
- Array.from(u.childNodes).forEach((e) => {
2564
+ function ht(p, t) {
2565
+ Array.from(p.childNodes).forEach((e) => {
2566
2566
  if (e.nodeType === Node.COMMENT_NODE) {
2567
2567
  e.remove();
2568
2568
  return;
@@ -2594,10 +2594,10 @@ function ht(u, t) {
2594
2594
  i.remove();
2595
2595
  return;
2596
2596
  }
2597
- const l = /* @__PURE__ */ new Set([...le["*"] || [], ...le[s] || []]);
2597
+ const n = /* @__PURE__ */ new Set([...ne["*"] || [], ...ne[s] || []]);
2598
2598
  if (Array.from(i.attributes).forEach((o) => {
2599
2599
  const c = o.name.toLowerCase();
2600
- c !== "style" && !l.has(c) && i.removeAttribute(o.name);
2600
+ c !== "style" && !n.has(c) && i.removeAttribute(o.name);
2601
2601
  }), s === "a") {
2602
2602
  const o = i.getAttribute("href") || "";
2603
2603
  /^(https?:|mailto:|tel:|#)/i.test(o) || i.removeAttribute("href");
@@ -2610,8 +2610,8 @@ function ht(u, t) {
2610
2610
  return;
2611
2611
  }
2612
2612
  }
2613
- const n = pt(i), r = [];
2614
- for (const [o, c] of Object.entries(n))
2613
+ const l = ut(i), r = [];
2614
+ for (const [o, c] of Object.entries(l))
2615
2615
  si.has(o) && (/expression|javascript|url\s*\(\s*['"]?\s*file:/i.test(c) || o === "font-weight" && /^(400|normal)$/i.test(c) || o === "font-style" && /^normal$/i.test(c) || o === "text-decoration" && /^none$/i.test(c) || r.push(o + ":" + c));
2616
2616
  if (r.length ? i.setAttribute("style", r.join(";")) : i.removeAttribute("style"), i.removeAttribute("class"), ht(i, t), s === "span" && !i.attributes.length) {
2617
2617
  for (; i.firstChild; ) i.parentNode.insertBefore(i.firstChild, i);
@@ -2619,112 +2619,112 @@ function ht(u, t) {
2619
2619
  }
2620
2620
  });
2621
2621
  }
2622
- function ci(u) {
2622
+ function ci(p) {
2623
2623
  const t = [], e = /<style[^>]*>([\s\S]*?)<\/style>/gi;
2624
2624
  let i;
2625
- for (; i = e.exec(u); ) {
2625
+ for (; i = e.exec(p); ) {
2626
2626
  let s = i[1].replace(/<!--|-->/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
2627
2627
  s = s.replace(/@media[^{]*\{(?:[^{}]*\{[^{}]*\})*[^{}]*\}/gi, ""), s = s.replace(/@[\w-]+[^{]*\{[^{}]*\}/g, "");
2628
- let l;
2629
- const n = /([^{}]+)\{([^}]*)\}/g;
2630
- for (; l = n.exec(s); ) {
2631
- const r = l[2].split(";").map((o) => {
2628
+ let n;
2629
+ const l = /([^{}]+)\{([^}]*)\}/g;
2630
+ for (; n = l.exec(s); ) {
2631
+ const r = n[2].split(";").map((o) => {
2632
2632
  const c = o.indexOf(":");
2633
2633
  return c < 1 ? null : [o.slice(0, c).trim().toLowerCase(), o.slice(c + 1).trim()];
2634
2634
  }).filter((o) => !!o && !!o[1]);
2635
- r.length && l[1].split(",").map((o) => o.trim()).filter((o) => o && !o.startsWith("@")).forEach((o) => t.push({ sel: o, decls: r }));
2635
+ r.length && n[1].split(",").map((o) => o.trim()).filter((o) => o && !o.startsWith("@")).forEach((o) => t.push({ sel: o, decls: r }));
2636
2636
  }
2637
2637
  }
2638
2638
  return t;
2639
2639
  }
2640
- function hi(u, t) {
2640
+ function hi(p, t) {
2641
2641
  if (!t.length) return;
2642
2642
  const e = /* @__PURE__ */ new Map();
2643
2643
  t.forEach(({ sel: i, decls: s }) => {
2644
- let l;
2644
+ let n;
2645
2645
  try {
2646
- l = u.querySelectorAll(i);
2646
+ n = p.querySelectorAll(i);
2647
2647
  } catch {
2648
2648
  return;
2649
2649
  }
2650
- l.forEach((n) => {
2651
- let r = e.get(n);
2652
- r || (r = {}, e.set(n, r)), s.forEach(([o, c]) => {
2650
+ n.forEach((l) => {
2651
+ let r = e.get(l);
2652
+ r || (r = {}, e.set(l, r)), s.forEach(([o, c]) => {
2653
2653
  r[o] = c;
2654
2654
  });
2655
2655
  });
2656
2656
  }), e.forEach((i, s) => {
2657
- const l = pt(s), n = s.hasAttribute("dir"), r = s.hasAttribute("align"), o = Object.entries(i).filter(([p]) => !(p in l || (p === "direction" || p === "unicode-bidi") && n || p === "text-align" && (r || n) || (p === "background" || p === "background-color") && s.hasAttribute("bgcolor")));
2657
+ const n = ut(s), l = s.hasAttribute("dir"), r = s.hasAttribute("align"), o = Object.entries(i).filter(([u]) => !(u in n || (u === "direction" || u === "unicode-bidi") && l || u === "text-align" && (r || l) || (u === "background" || u === "background-color") && s.hasAttribute("bgcolor")));
2658
2658
  if (!o.length) return;
2659
- const c = o.map(([p, m]) => p + ":" + m).join(";"), d = s.getAttribute("style");
2659
+ const c = o.map(([u, m]) => u + ":" + m).join(";"), d = s.getAttribute("style");
2660
2660
  s.setAttribute("style", d ? c + ";" + d : c);
2661
2661
  });
2662
2662
  }
2663
- function he(u) {
2664
- return u.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
2663
+ function he(p) {
2664
+ return p.replace(/[ﭐ-﷿ﹰ-ﻼ]+/g, (t) => t.normalize("NFKC"));
2665
2665
  }
2666
- function di(u) {
2667
- const t = u.createTreeWalker(u.body, NodeFilter.SHOW_TEXT, null);
2666
+ function di(p) {
2667
+ const t = p.createTreeWalker(p.body, NodeFilter.SHOW_TEXT, null);
2668
2668
  let e;
2669
2669
  for (; e = t.nextNode(); )
2670
2670
  /[ﭐ-﷿ﹰ-ﻼ]/.test(e.nodeValue || "") && (e.nodeValue = he(e.nodeValue || ""));
2671
2671
  }
2672
- function pi(u, t = "ltr") {
2673
- const e = ci(u), i = new DOMParser().parseFromString(li(u), "text/html");
2672
+ function ui(p, t = "ltr") {
2673
+ const e = ci(p), i = new DOMParser().parseFromString(ni(p), "text/html");
2674
2674
  hi(i, e), /class="?Mso|mso-|urn:schemas-microsoft-com/i.test(i.body.innerHTML) && oi(i), ri(i), ai(i), ht(i.body, i), di(i);
2675
- const s = (l) => {
2676
- var n;
2677
- return l && l.tagName === "P" && !((n = l.textContent) != null && n.trim()) && !l.querySelector("img,table");
2675
+ const s = (n) => {
2676
+ var l;
2677
+ return n && n.tagName === "P" && !((l = n.textContent) != null && l.trim()) && !n.querySelector("img,table");
2678
2678
  };
2679
2679
  for (; s(i.body.firstElementChild); ) i.body.firstElementChild.remove();
2680
2680
  for (; s(i.body.lastElementChild); ) i.body.lastElementChild.remove();
2681
2681
  return i.body.innerHTML.trim();
2682
2682
  }
2683
- function ui(u) {
2684
- const t = he(u).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2683
+ function pi(p) {
2684
+ const t = he(p).replace(/\r/g, ""), e = (i) => i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2685
2685
  return /\n/.test(t) ? t.split(/\n{2,}/).map((i) => `<p dir="auto">${e(i).replace(/\n/g, "<br>") || "<br>"}</p>`).join("") : e(t);
2686
2686
  }
2687
- function mi(u) {
2688
- const t = new DataView(u), e = /* @__PURE__ */ new Map();
2687
+ function mi(p) {
2688
+ const t = new DataView(p), e = /* @__PURE__ */ new Map();
2689
2689
  let i = -1;
2690
- for (let r = u.byteLength - 22; r >= Math.max(0, u.byteLength - 22 - 65535); r--)
2690
+ for (let r = p.byteLength - 22; r >= Math.max(0, p.byteLength - 22 - 65535); r--)
2691
2691
  if (t.getUint32(r, !0) === 101010256) {
2692
2692
  i = r;
2693
2693
  break;
2694
2694
  }
2695
2695
  if (i < 0) throw new Error("EOCD not found");
2696
2696
  const s = t.getUint16(i + 10, !0);
2697
- let l = t.getUint32(i + 16, !0);
2698
- const n = new TextDecoder();
2699
- for (let r = 0; r < s && t.getUint32(l, !0) === 33639248; r++) {
2700
- const o = t.getUint16(l + 10, !0), c = t.getUint32(l + 20, !0), d = t.getUint16(l + 28, !0), p = t.getUint16(l + 30, !0), m = t.getUint16(l + 32, !0), b = t.getUint32(l + 42, !0), y = n.decode(new Uint8Array(u, l + 46, d));
2701
- e.set(y, { name: y, method: o, compSize: c, localOffset: b }), l += 46 + d + p + m;
2697
+ let n = t.getUint32(i + 16, !0);
2698
+ const l = new TextDecoder();
2699
+ for (let r = 0; r < s && t.getUint32(n, !0) === 33639248; r++) {
2700
+ const o = t.getUint16(n + 10, !0), c = t.getUint32(n + 20, !0), d = t.getUint16(n + 28, !0), u = t.getUint16(n + 30, !0), m = t.getUint16(n + 32, !0), b = t.getUint32(n + 42, !0), y = l.decode(new Uint8Array(p, n + 46, d));
2701
+ e.set(y, { name: y, method: o, compSize: c, localOffset: b }), n += 46 + d + u + m;
2702
2702
  }
2703
2703
  return e;
2704
2704
  }
2705
- async function ne(u, t) {
2706
- const e = new DataView(u, t.localOffset);
2705
+ async function le(p, t) {
2706
+ const e = new DataView(p, t.localOffset);
2707
2707
  if (e.getUint32(0, !0) !== 67324752) throw new Error("Bad local header");
2708
- const i = e.getUint16(26, !0), s = e.getUint16(28, !0), l = t.localOffset + 30 + i + s, n = new Uint8Array(u.slice(l, l + t.compSize));
2709
- if (t.method === 0) return n;
2708
+ const i = e.getUint16(26, !0), s = e.getUint16(28, !0), n = t.localOffset + 30 + i + s, l = new Uint8Array(p.slice(n, n + t.compSize));
2709
+ if (t.method === 0) return l;
2710
2710
  if (t.method !== 8) throw new Error("Unsupported compression method " + t.method);
2711
- const r = new Blob([n]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
2711
+ const r = new Blob([l]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
2712
2712
  return new Uint8Array(await new Response(r).arrayBuffer());
2713
2713
  }
2714
- const oe = (u) => u.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), dt = (u, t) => Array.from(u.children).filter((e) => e.localName === t), B = (u, ...t) => {
2715
- let e = u;
2714
+ const oe = (p) => p.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;"), dt = (p, t) => Array.from(p.children).filter((e) => e.localName === t), B = (p, ...t) => {
2715
+ let e = p;
2716
2716
  for (const i of t) {
2717
2717
  if (!e) return null;
2718
2718
  e = Array.from(e.children).find((s) => s.localName === i) || null;
2719
2719
  }
2720
2720
  return e;
2721
- }, q = (u, t = "val") => {
2722
- if (!u) return "";
2723
- for (const e of Array.from(u.attributes))
2721
+ }, q = (p, t = "val") => {
2722
+ if (!p) return "";
2723
+ for (const e of Array.from(p.attributes))
2724
2724
  if (e.localName === t) return e.value;
2725
2725
  return "";
2726
- }, at = (u, t) => {
2727
- const e = u ? B(u, t) : null;
2726
+ }, at = (p, t) => {
2727
+ const e = p ? B(p, t) : null;
2728
2728
  if (!e) return !1;
2729
2729
  const i = q(e);
2730
2730
  return i !== "false" && i !== "0";
@@ -2753,10 +2753,10 @@ const oe = (u) => u.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "
2753
2753
  bmp: "image/bmp",
2754
2754
  webp: "image/webp"
2755
2755
  };
2756
- function gi(u) {
2756
+ function gi(p) {
2757
2757
  let t = "";
2758
- for (let e = 0; e < u.length; e += 32768)
2759
- t += String.fromCharCode(...u.subarray(e, e + 32768));
2758
+ for (let e = 0; e < p.length; e += 32768)
2759
+ t += String.fromCharCode(...p.subarray(e, e + 32768));
2760
2760
  return btoa(t);
2761
2761
  }
2762
2762
  class vi {
@@ -2765,22 +2765,22 @@ class vi {
2765
2765
  }
2766
2766
  convertBody(t) {
2767
2767
  let e = "", i = [];
2768
- const s = (l) => {
2769
- for (; i.length > l; ) e += `</${i.pop()}>`;
2768
+ const s = (n) => {
2769
+ for (; i.length > n; ) e += `</${i.pop()}>`;
2770
2770
  };
2771
- for (const l of Array.from(t.children))
2772
- if (l.localName === "p") {
2773
- const n = this.paraList(l);
2774
- if (n) {
2775
- const r = n.ilvl + 1;
2771
+ for (const n of Array.from(t.children))
2772
+ if (n.localName === "p") {
2773
+ const l = this.paraList(n);
2774
+ if (l) {
2775
+ const r = l.ilvl + 1;
2776
2776
  for (; i.length > r; ) e += `</${i.pop()}>`;
2777
- for (i.length === r && i[r - 1] !== n.type && (e += `</${i.pop()}>`); i.length < r; )
2778
- e += `<${n.type}>`, i.push(n.type);
2779
- e += `<li>${this.runsOf(l) || "<br>"}</li>`;
2777
+ for (i.length === r && i[r - 1] !== l.type && (e += `</${i.pop()}>`); i.length < r; )
2778
+ e += `<${l.type}>`, i.push(l.type);
2779
+ e += `<li>${this.runsOf(n) || "<br>"}</li>`;
2780
2780
  continue;
2781
2781
  }
2782
- s(0), e += this.convertPara(l);
2783
- } else l.localName === "tbl" ? (s(0), e += this.convertTable(l)) : l.localName;
2782
+ s(0), e += this.convertPara(n);
2783
+ } else n.localName === "tbl" ? (s(0), e += this.convertTable(n)) : n.localName;
2784
2784
  return s(0), e || "<p><br></p>";
2785
2785
  }
2786
2786
  paraList(t) {
@@ -2794,11 +2794,11 @@ class vi {
2794
2794
  convertPara(t) {
2795
2795
  const e = B(t, "pPr"), i = q(B(t, "pPr", "pStyle"));
2796
2796
  let s = "p";
2797
- const l = /^Heading([1-6])$/i.exec(i);
2798
- l ? s = "h" + l[1] : /^Title$/i.test(i) && (s = "h1");
2799
- const n = [], r = q(B(t, "pPr", "jc"));
2800
- r === "center" ? n.push("text-align:center") : r === "right" || r === "end" ? n.push("text-align:right") : (r === "both" || r === "distribute") && n.push("text-align:justify"), e && B(e, "bidi") && n.push("direction:rtl");
2801
- const o = this.runsOf(t), c = n.length ? ` style="${n.join(";")}"` : "";
2797
+ const n = /^Heading([1-6])$/i.exec(i);
2798
+ n ? s = "h" + n[1] : /^Title$/i.test(i) && (s = "h1");
2799
+ const l = [], r = q(B(t, "pPr", "jc"));
2800
+ r === "center" ? l.push("text-align:center") : r === "right" || r === "end" ? l.push("text-align:right") : (r === "both" || r === "distribute") && l.push("text-align:justify"), e && B(e, "bidi") && l.push("direction:rtl");
2801
+ const o = this.runsOf(t), c = l.length ? ` style="${l.join(";")}"` : "";
2802
2802
  return `<${s}${c}>${o || "<br>"}</${s}>`;
2803
2803
  }
2804
2804
  runsOf(t) {
@@ -2807,23 +2807,23 @@ class vi {
2807
2807
  if (i.localName === "r") e += this.convertRun(i);
2808
2808
  else if (i.localName === "hyperlink") {
2809
2809
  let s = this.rels.get(q(i, "id")) || "";
2810
- const l = q(i, "anchor");
2811
- !s && l && (s = "#" + l);
2812
- const n = this.runsOf(i);
2813
- e += s ? `<a href="${oe(s)}">${n}</a>` : n;
2810
+ const n = q(i, "anchor");
2811
+ !s && n && (s = "#" + n);
2812
+ const l = this.runsOf(i);
2813
+ e += s ? `<a href="${oe(s)}">${l}</a>` : l;
2814
2814
  } else (i.localName === "smartTag" || i.localName === "ins") && (e += this.runsOf(i));
2815
2815
  return e;
2816
2816
  }
2817
2817
  convertRun(t) {
2818
2818
  const e = B(t, "rPr");
2819
2819
  let i = "";
2820
- for (const p of Array.from(t.children))
2821
- p.localName === "t" ? i += oe(p.textContent || "") : p.localName === "br" || p.localName === "cr" ? i += "<br>" : p.localName === "tab" ? i += "&emsp;" : (p.localName === "drawing" || p.localName === "pict" || p.localName === "object") && (i += this.convertImage(p));
2820
+ for (const u of Array.from(t.children))
2821
+ u.localName === "t" ? i += oe(u.textContent || "") : u.localName === "br" || u.localName === "cr" ? i += "<br>" : u.localName === "tab" ? i += "&emsp;" : (u.localName === "drawing" || u.localName === "pict" || u.localName === "object") && (i += this.convertImage(u));
2822
2822
  if (!i) return "";
2823
- const s = [], l = q(e ? B(e, "color") : null);
2824
- l && l !== "auto" && s.push("color:#" + l);
2825
- const n = q(e ? B(e, "highlight") : null);
2826
- n && re[n] && s.push("background-color:" + re[n]);
2823
+ const s = [], n = q(e ? B(e, "color") : null);
2824
+ n && n !== "auto" && s.push("color:#" + n);
2825
+ const l = q(e ? B(e, "highlight") : null);
2826
+ l && re[l] && s.push("background-color:" + re[l]);
2827
2827
  const r = parseFloat(q(e ? B(e, "sz") : null));
2828
2828
  r && s.push("font-size:" + Math.round(r / 2 * (4 / 3)) + "px");
2829
2829
  const o = e ? B(e, "rFonts") : null, c = q(o, "ascii") || q(o, "cs");
@@ -2841,35 +2841,35 @@ class vi {
2841
2841
  for (const o of Array.from(r.children)) s(o);
2842
2842
  };
2843
2843
  if (s(t), !e) return "";
2844
- const l = this.images.get(e);
2845
- if (!l) return "";
2846
- const n = i ? ` width="${i}"` : "";
2847
- return `<img src="${l}" alt=""${n}>`;
2844
+ const n = this.images.get(e);
2845
+ if (!n) return "";
2846
+ const l = i ? ` width="${i}"` : "";
2847
+ return `<img src="${n}" alt=""${l}>`;
2848
2848
  }
2849
2849
  convertTable(t) {
2850
2850
  let e = '<table style="border-collapse:collapse;width:100%"><tbody>';
2851
2851
  for (const i of dt(t, "tr")) {
2852
2852
  e += "<tr>";
2853
2853
  for (const s of dt(i, "tc")) {
2854
- const l = parseInt(q(B(s, "tcPr", "gridSpan")) || "1", 10) || 1, n = l > 1 ? ` colspan="${l}"` : "";
2854
+ const n = parseInt(q(B(s, "tcPr", "gridSpan")) || "1", 10) || 1, l = n > 1 ? ` colspan="${n}"` : "";
2855
2855
  let r = "";
2856
2856
  for (const o of Array.from(s.children))
2857
2857
  o.localName === "p" ? r += this.convertPara(o) : o.localName === "tbl" && (r += this.convertTable(o));
2858
- e += `<td style="border:1px solid #b9c2cc"${n}>${r || "<br>"}</td>`;
2858
+ e += `<td style="border:1px solid #b9c2cc"${l}>${r || "<br>"}</td>`;
2859
2859
  }
2860
2860
  e += "</tr>";
2861
2861
  }
2862
2862
  return e + "</tbody></table>";
2863
2863
  }
2864
2864
  }
2865
- async function bi(u) {
2866
- const t = u instanceof ArrayBuffer ? u : await u.arrayBuffer(), e = mi(t), i = new TextDecoder(), s = async (y) => {
2865
+ async function bi(p) {
2866
+ const t = p instanceof ArrayBuffer ? p : await p.arrayBuffer(), e = mi(t), i = new TextDecoder(), s = async (y) => {
2867
2867
  const g = e.get(y);
2868
- return g ? new DOMParser().parseFromString(i.decode(await ne(t, g)), "application/xml") : null;
2869
- }, l = await s("word/document.xml"), n = l == null ? void 0 : l.getElementsByTagName("*");
2868
+ return g ? new DOMParser().parseFromString(i.decode(await le(t, g)), "application/xml") : null;
2869
+ }, n = await s("word/document.xml"), l = n == null ? void 0 : n.getElementsByTagName("*");
2870
2870
  let r = null;
2871
- if (n) {
2872
- for (const y of Array.from(n))
2871
+ if (l) {
2872
+ for (const y of Array.from(l))
2873
2873
  if (y.localName === "body") {
2874
2874
  r = y;
2875
2875
  break;
@@ -2883,14 +2883,14 @@ async function bi(u) {
2883
2883
  const g = y.getAttribute("Id") || "", x = y.getAttribute("Target") || "", w = y.getAttribute("Type") || "";
2884
2884
  /hyperlink/i.test(w) ? o.set(g, x) : /image/i.test(w) && c.set(g, x);
2885
2885
  }
2886
- const p = /* @__PURE__ */ new Map();
2886
+ const u = /* @__PURE__ */ new Map();
2887
2887
  for (const [y, g] of c) {
2888
2888
  const x = g.startsWith("/") ? g.slice(1) : "word/" + g.replace(/^\.\//, ""), w = e.get(x);
2889
2889
  if (!w) continue;
2890
2890
  const E = (x.split(".").pop() || "").toLowerCase(), A = fi[E];
2891
2891
  if (A)
2892
2892
  try {
2893
- p.set(y, `data:${A};base64,${gi(await ne(t, w))}`);
2893
+ u.set(y, `data:${A};base64,${gi(await le(t, w))}`);
2894
2894
  } catch {
2895
2895
  }
2896
2896
  }
@@ -2908,7 +2908,7 @@ async function bi(u) {
2908
2908
  m.set(w, y.get(E) || "ul");
2909
2909
  }
2910
2910
  }
2911
- return new vi(o, p, m).convertBody(r);
2911
+ return new vi(o, u, m).convertBody(r);
2912
2912
  }
2913
2913
  const yi = ["nw", "ne", "sw", "se"], wt = ["img-left", "img-right", "img-top", "img-center"], Tt = {
2914
2914
  "img-left": "tplimgleft",
@@ -2925,32 +2925,32 @@ let Z = null, X = null, St = 0, ae = !1;
2925
2925
  function ct() {
2926
2926
  clearTimeout(St), X = null, Z && Z.classList.remove("show");
2927
2927
  }
2928
- function wi(u) {
2929
- const t = u.dataset.tip;
2928
+ function wi(p) {
2929
+ const t = p.dataset.tip;
2930
2930
  if (!t) return;
2931
- X = u, clearTimeout(St);
2931
+ X = p, clearTimeout(St);
2932
2932
  const e = Z && Z.classList.contains("show") ? 60 : 350;
2933
2933
  St = window.setTimeout(() => {
2934
- if (X !== u || !document.contains(u)) return;
2934
+ if (X !== p || !document.contains(p)) return;
2935
2935
  Z || (Z = document.createElement("div"), Z.className = "etip", document.body.appendChild(Z)), Z.textContent = t, Z.classList.add("show");
2936
- const i = u.getBoundingClientRect(), s = Z.offsetWidth, l = Z.offsetHeight;
2937
- let n = i.left + i.width / 2 - s / 2;
2938
- n = Math.max(6, Math.min(n, innerWidth - s - 6));
2936
+ const i = p.getBoundingClientRect(), s = Z.offsetWidth, n = Z.offsetHeight;
2937
+ let l = i.left + i.width / 2 - s / 2;
2938
+ l = Math.max(6, Math.min(l, innerWidth - s - 6));
2939
2939
  let r = i.bottom + 7;
2940
- r + l > innerHeight - 6 && (r = i.top - l - 7), Z.style.left = n + "px", Z.style.top = r + "px";
2940
+ r + n > innerHeight - 6 && (r = i.top - n - 7), Z.style.left = l + "px", Z.style.top = r + "px";
2941
2941
  }, e);
2942
2942
  }
2943
2943
  function Ti() {
2944
- ae || (ae = !0, document.addEventListener("mouseover", (u) => {
2945
- const t = u.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
2944
+ ae || (ae = !0, document.addEventListener("mouseover", (p) => {
2945
+ const t = p.target, e = t.closest ? t.closest("[title],[data-tip]") : null;
2946
2946
  if (!e || !e.closest(Ci) || e.closest(".earea")) {
2947
2947
  e !== X && ct();
2948
2948
  return;
2949
2949
  }
2950
2950
  const i = e.getAttribute("title");
2951
2951
  i && (e.dataset.tip = i, e.removeAttribute("title"), e.getAttribute("aria-label") || e.setAttribute("aria-label", i)), e !== X && wi(e);
2952
- }), document.addEventListener("mouseout", (u) => {
2953
- X && !X.contains(u.relatedTarget) && ct();
2952
+ }), document.addEventListener("mouseout", (p) => {
2953
+ X && !X.contains(p.relatedTarget) && ct();
2954
2954
  }), document.addEventListener("mousedown", ct, !0), addEventListener("scroll", ct, !0));
2955
2955
  }
2956
2956
  var j;
@@ -3014,14 +3014,14 @@ let Ei = (j = class {
3014
3014
  }
3015
3015
  bindGrip(t) {
3016
3016
  let e = 0, i = 0;
3017
- const s = (l) => {
3018
- e = l.clientY, i = this.ed.offsetHeight, l.preventDefault();
3019
- const n = (o) => {
3017
+ const s = (n) => {
3018
+ e = n.clientY, i = this.ed.offsetHeight, n.preventDefault();
3019
+ const l = (o) => {
3020
3020
  this.ed.style.height = Math.max(120, i + o.clientY - e) + "px";
3021
3021
  }, r = () => {
3022
- window.removeEventListener("mousemove", n), window.removeEventListener("mouseup", r);
3022
+ window.removeEventListener("mousemove", l), window.removeEventListener("mouseup", r);
3023
3023
  };
3024
- window.addEventListener("mousemove", n), window.addEventListener("mouseup", r);
3024
+ window.addEventListener("mousemove", l), window.addEventListener("mouseup", r);
3025
3025
  };
3026
3026
  t.addEventListener("mousedown", s), this.listeners.push(() => t.removeEventListener("mousedown", s));
3027
3027
  }
@@ -3037,13 +3037,13 @@ let Ei = (j = class {
3037
3037
  }), this.on(this.ed, "input", () => {
3038
3038
  this.refreshState(), this.onChange(), this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.positionVphCtx(), this.positionVidCtx(), this.positionCodeCtx();
3039
3039
  }), this.on(this.ed, "keydown", (t) => {
3040
- t.altKey && t.key === "0" && (t.preventDefault(), this.helpDlg()), (t.key === "Delete" || t.key === "Backspace") && this.phActive && (t.preventDefault(), this.removeImgPlaceholder()), (t.key === "Delete" || t.key === "Backspace") && this.vphActive && (t.preventDefault(), this.removeVphPlaceholder()), t.key === "`" && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryCodeTyping(t);
3040
+ t.altKey && t.key === "0" && (t.preventDefault(), this.helpDlg()), (t.key === "Delete" || t.key === "Backspace") && this.phActive && (t.preventDefault(), this.removeImgPlaceholder()), (t.key === "Delete" || t.key === "Backspace") && this.vphActive && (t.preventDefault(), this.removeVphPlaceholder()), t.key === "`" && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryCodeTyping(t), t.key === "Enter" && !t.shiftKey && !t.ctrlKey && !t.metaKey && !t.altKey && this.tryExitBlockquote(t);
3041
3041
  }), this.on(this.ed, "paste", (t) => this.handlePaste(t)), this.on(this.ed, "drop", (t) => {
3042
- var l, n, r, o;
3042
+ var n, l, r, o;
3043
3043
  t.preventDefault();
3044
- const e = t.target, i = (l = e.closest) == null ? void 0 : l.call(e, ".img-ph:not(.vid-ph)");
3044
+ const e = t.target, i = (n = e.closest) == null ? void 0 : n.call(e, ".img-ph:not(.vid-ph)");
3045
3045
  if (i && this.ed.contains(i) && !this.options.readonly) {
3046
- const c = Array.from(((n = t.dataTransfer) == null ? void 0 : n.files) || []).find((d) => d.type.startsWith("image/"));
3046
+ const c = Array.from(((l = t.dataTransfer) == null ? void 0 : l.files) || []).find((d) => d.type.startsWith("image/"));
3047
3047
  c && this.readImageFileInto(c, i);
3048
3048
  return;
3049
3049
  }
@@ -3053,15 +3053,15 @@ let Ei = (j = class {
3053
3053
  c && this.readVideoFileInto(c, s);
3054
3054
  }
3055
3055
  }), this.on(this.ed, "dragover", (t) => t.preventDefault()), this.on(this.ed, "mousedown", (t) => {
3056
- var d, p, m, b, y, g, x;
3056
+ var d, u, m, b, y, g, x;
3057
3057
  const e = t.target, i = (d = e.closest) == null ? void 0 : d.call(e, "table");
3058
3058
  i && this.ed.contains(i) ? this.selectTableForResize(i) : this.clearTableHandles();
3059
- const s = (p = e.closest) == null ? void 0 : p.call(e, ".img-ph:not(.vid-ph)");
3059
+ const s = (u = e.closest) == null ? void 0 : u.call(e, ".img-ph:not(.vid-ph)");
3060
3060
  s && this.ed.contains(s) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectImgPlaceholder(s)) : this.clearImgPlaceholderSel();
3061
- const l = (m = e.closest) == null ? void 0 : m.call(e, ".vid-ph");
3062
- l && this.ed.contains(l) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectVphPlaceholder(l)) : this.clearVphPlaceholderSel();
3063
- const n = (b = e.closest) == null ? void 0 : b.call(e, ".tpl");
3064
- n && this.ed.contains(n) && !this.options.readonly ? this.selectTemplate(n) : this.clearTplSel();
3061
+ const n = (m = e.closest) == null ? void 0 : m.call(e, ".vid-ph");
3062
+ n && this.ed.contains(n) && !this.options.readonly ? (t.preventDefault(), this.ed.focus(), this.selectVphPlaceholder(n)) : this.clearVphPlaceholderSel();
3063
+ const l = (b = e.closest) == null ? void 0 : b.call(e, ".tpl");
3064
+ l && this.ed.contains(l) && !this.options.readonly ? this.selectTemplate(l) : this.clearTplSel();
3065
3065
  const r = (y = e.closest) == null ? void 0 : y.call(e, "pre.code-block");
3066
3066
  r && this.ed.contains(r) && !this.options.readonly ? (t.preventDefault(), this.selectCodeEl(r)) : this.clearCodeSel();
3067
3067
  const o = (g = e.closest) == null ? void 0 : g.call(e, "img");
@@ -3074,11 +3074,11 @@ let Ei = (j = class {
3074
3074
  const e = (s = (i = t.target).closest) == null ? void 0 : s.call(i, "img");
3075
3075
  e && this.ed.contains(e) && (this.cancelImgHide(), this.selectImage(e));
3076
3076
  }), this.on(this.ed, "mouseout", (t) => {
3077
- var s, l, n, r;
3078
- const e = (l = (s = t.target).closest) == null ? void 0 : l.call(s, "img");
3077
+ var s, n, l, r;
3078
+ const e = (n = (s = t.target).closest) == null ? void 0 : n.call(s, "img");
3079
3079
  if (!e) return;
3080
3080
  const i = t.relatedTarget;
3081
- i && ((n = this.imgCtx) != null && n.contains(i) || this.imgHandles.some((o) => o.contains(i)) || ((r = i.closest) == null ? void 0 : r.call(i, "img")) === e) || this.scheduleImgHide();
3081
+ i && ((l = this.imgCtx) != null && l.contains(i) || this.imgHandles.some((o) => o.contains(i)) || ((r = i.closest) == null ? void 0 : r.call(i, "img")) === e) || this.scheduleImgHide();
3082
3082
  }), this.on(this.ed, "scroll", () => {
3083
3083
  this.positionTableHandles(), this.positionImageHandles(), this.positionImgPhCtx(), this.positionTplCtx(), this.positionVphCtx(), this.positionVidCtx(), this.positionCodeCtx();
3084
3084
  }), this.onWin(
@@ -3209,6 +3209,20 @@ let Ei = (j = class {
3209
3209
  }
3210
3210
  return null;
3211
3211
  }
3212
+ /** Enter on an empty last line inside a blockquote exits it into a plain paragraph, mirroring how lists exit on an empty item. */
3213
+ tryExitBlockquote(t) {
3214
+ const e = window.getSelection();
3215
+ if (!e || !e.isCollapsed || !e.anchorNode || !this.ed.contains(e.anchorNode)) return;
3216
+ const i = this.closestBlock(e.anchorNode);
3217
+ if (!i || i.tagName === "BLOCKQUOTE" || (i.textContent || "").trim() !== "") return;
3218
+ const s = i.closest("blockquote");
3219
+ if (!s || !this.ed.contains(s) || i !== s.lastElementChild) return;
3220
+ t.preventDefault();
3221
+ const n = document.createElement("p");
3222
+ n.appendChild(document.createElement("br")), s.after(n), i.remove(), s.firstElementChild || s.remove();
3223
+ const l = document.createRange();
3224
+ l.setStart(n, 0), l.collapse(!0), e.removeAllRanges(), e.addRange(l), this.saveSel(), this.onChange();
3225
+ }
3212
3226
  selectedBlocks() {
3213
3227
  const t = window.getSelection();
3214
3228
  if (!t || !t.rangeCount || !this.ed.contains(t.anchorNode)) return [];
@@ -3255,9 +3269,9 @@ let Ei = (j = class {
3255
3269
  i.className = "revlist";
3256
3270
  const s = document.createElement("div");
3257
3271
  s.className = "revprev";
3258
- const l = document.createElement("button");
3259
- l.type = "button", l.className = "revrestore", l.textContent = this.t("restore");
3260
- let n = this.revisions.length - 1;
3272
+ const n = document.createElement("button");
3273
+ n.type = "button", n.className = "revrestore", n.textContent = this.t("restore");
3274
+ let l = this.revisions.length - 1;
3261
3275
  const r = new Intl.DateTimeFormat(this.lang === "ar" ? "ar-AE" : "en-GB", {
3262
3276
  year: "numeric",
3263
3277
  month: "short",
@@ -3266,21 +3280,21 @@ let Ei = (j = class {
3266
3280
  minute: "2-digit",
3267
3281
  second: "2-digit"
3268
3282
  }), o = {}, c = (d) => {
3269
- n = d, this.revisions.forEach((p, m) => {
3283
+ l = d, this.revisions.forEach((u, m) => {
3270
3284
  var b;
3271
3285
  return (b = o[m]) == null ? void 0 : b.classList.toggle("on", m === d);
3272
- }), s.innerHTML = this.revisions[d].html, l.disabled = d === this.revisions.length - 1;
3286
+ }), s.innerHTML = this.revisions[d].html, n.disabled = d === this.revisions.length - 1;
3273
3287
  };
3274
3288
  for (let d = this.revisions.length - 1; d >= 0; d--) {
3275
- const p = this.revisions[d], m = document.createElement("button");
3289
+ const u = this.revisions[d], m = document.createElement("button");
3276
3290
  m.type = "button";
3277
- const b = (new DOMParser().parseFromString(p.html, "text/html").body.textContent || "").trim(), y = b ? b.split(/\s+/).length : 0, g = d === this.revisions.length - 1;
3278
- m.innerHTML = `<span>${g ? this.t("currentver") : r.format(new Date(p.time))}</span><span class="wc">${y} ${this.t("words")}</span>`, m.addEventListener("click", () => c(d)), o[d] = m, i.appendChild(m);
3291
+ const b = (new DOMParser().parseFromString(u.html, "text/html").body.textContent || "").trim(), y = b ? b.split(/\s+/).length : 0, g = d === this.revisions.length - 1;
3292
+ m.innerHTML = `<span>${g ? this.t("currentver") : r.format(new Date(u.time))}</span><span class="wc">${y} ${this.t("words")}</span>`, m.addEventListener("click", () => c(d)), o[d] = m, i.appendChild(m);
3279
3293
  }
3280
- i.append(l), l.addEventListener("click", () => {
3281
- const d = this.revisions[n];
3294
+ i.append(n), n.addEventListener("click", () => {
3295
+ const d = this.revisions[l];
3282
3296
  d && (this.recordRevision(), this.setContent(d.html), this.recordRevision(), this.closeDlg());
3283
- }), e.append(i, s), t.appendChild(e), c(n);
3297
+ }), e.append(i, s), t.appendChild(e), c(l);
3284
3298
  });
3285
3299
  }
3286
3300
  /* ---------------------------------------------------------- popups / menus */
@@ -3299,10 +3313,10 @@ let Ei = (j = class {
3299
3313
  o.target.tagName !== "INPUT" && o.preventDefault();
3300
3314
  }), document.body.appendChild(i);
3301
3315
  const s = e.getBoundingClientRect();
3302
- let n = this.dir() === "rtl" ? s.left - i.offsetWidth + 2 : s.right - 2;
3303
- n = Math.max(8, Math.min(n + scrollX, scrollX + innerWidth - i.offsetWidth - 8));
3316
+ let l = this.dir() === "rtl" ? s.left - i.offsetWidth + 2 : s.right - 2;
3317
+ l = Math.max(8, Math.min(l + scrollX, scrollX + innerWidth - i.offsetWidth - 8));
3304
3318
  let r = s.top + scrollY - 6;
3305
- r = Math.max(8 + scrollY, Math.min(r, scrollY + innerHeight - i.offsetHeight - 8)), i.style.left = n + "px", i.style.top = r + "px", this.openSubEl = i;
3319
+ r = Math.max(8 + scrollY, Math.min(r, scrollY + innerHeight - i.offsetHeight - 8)), i.style.left = l + "px", i.style.top = r + "px", this.openSubEl = i;
3306
3320
  }
3307
3321
  popup(t, e, i) {
3308
3322
  if (this.openPop && this.popAnchor === t) {
@@ -3312,9 +3326,9 @@ let Ei = (j = class {
3312
3326
  this.closePop();
3313
3327
  const s = document.createElement("div");
3314
3328
  s.className = "pop" + (i ? " " + i : ""), s.dir = this.dir(), e(s), document.body.appendChild(s);
3315
- const l = t.getBoundingClientRect();
3316
- s.style.minWidth = Math.max(160, Math.round(l.width)) + "px", s.style.top = l.bottom + scrollY + 2 + "px";
3317
- let r = this.dir() === "rtl" ? l.right - s.offsetWidth : l.left;
3329
+ const n = t.getBoundingClientRect();
3330
+ s.style.minWidth = Math.max(160, Math.round(n.width)) + "px", s.style.top = n.bottom + scrollY + 2 + "px";
3331
+ let r = this.dir() === "rtl" ? n.right - s.offsetWidth : n.left;
3318
3332
  r = Math.max(8, Math.min(r + scrollX, scrollX + innerWidth - s.offsetWidth - 8)), s.style.left = r + "px", s.addEventListener("mousedown", (o) => {
3319
3333
  o.target.tagName !== "INPUT" && o.preventDefault();
3320
3334
  }), this.openPop = s, this.popAnchor = t, t.classList.add("open");
@@ -3325,22 +3339,22 @@ let Ei = (j = class {
3325
3339
  t.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
3326
3340
  return;
3327
3341
  }
3328
- const s = !!(i.sub || i.subBuild), l = document.createElement("button");
3329
- l.className = "mi" + (i.on ? " on" : ""), l.innerHTML = `<span class="ic">${i.icon || ""}</span><span class="prev" ${i.previewStyle ? `style="${i.previewStyle}"` : ""}>${i.label}</span>${i.shortcut ? `<span class="sc">${i.shortcut}</span>` : ""}${s ? `<span class="subarrow">${h.chev}</span>` : ""}`, l.addEventListener("click", () => {
3342
+ const s = !!(i.sub || i.subBuild), n = document.createElement("button");
3343
+ n.className = "mi" + (i.on ? " on" : ""), n.innerHTML = `<span class="ic">${i.icon || ""}</span><span class="prev" ${i.previewStyle ? `style="${i.previewStyle}"` : ""}>${i.label}</span>${i.shortcut ? `<span class="sc">${i.shortcut}</span>` : ""}${s ? `<span class="subarrow">${h.chev}</span>` : ""}`, n.addEventListener("click", () => {
3330
3344
  i.action && (this.closePop(), i.action());
3331
- }), l.addEventListener("mouseenter", () => {
3332
- var n;
3333
- s ? this.openSubFor(i, l) : this.openSubEl && t !== this.openSubEl && this.closeSub(), (n = i.hover) == null || n.call(i, !0);
3334
- }), l.addEventListener("mouseleave", () => {
3335
- var n;
3336
- return (n = i.hover) == null ? void 0 : n.call(i, !1);
3337
- }), t.appendChild(l);
3345
+ }), n.addEventListener("mouseenter", () => {
3346
+ var l;
3347
+ s ? this.openSubFor(i, n) : this.openSubEl && t !== this.openSubEl && this.closeSub(), (l = i.hover) == null || l.call(i, !0);
3348
+ }), n.addEventListener("mouseleave", () => {
3349
+ var l;
3350
+ return (l = i.hover) == null ? void 0 : l.call(i, !1);
3351
+ }), t.appendChild(n);
3338
3352
  });
3339
3353
  }
3340
3354
  /* ---------------------------------------------------------- toolbar builders */
3341
3355
  tbtn(t, e, i, s) {
3342
- const l = document.createElement("button");
3343
- return l.className = "tbtn", l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (n) => n.preventDefault()), l.addEventListener("click", i), l;
3356
+ const n = document.createElement("button");
3357
+ return n.className = "tbtn", n.type = "button", n.title = e, n.innerHTML = t, s && (n.dataset.id = s), n.addEventListener("mousedown", (l) => l.preventDefault()), n.addEventListener("click", i), n;
3344
3358
  }
3345
3359
  /** Font-size increase / decrease step button. */
3346
3360
  stepBtn(t) {
@@ -3349,19 +3363,19 @@ let Ei = (j = class {
3349
3363
  }
3350
3364
  /** Toolbar icon button that opens a popup menu anchored to itself. */
3351
3365
  menuTbtn(t, e, i, s) {
3352
- const l = this.tbtn(t, e, () => i(l), s);
3353
- return l.classList.add("hasmenu"), l.insertAdjacentHTML("beforeend", h.chev), l.addEventListener("mousedown", () => this.saveSel()), l;
3366
+ const n = this.tbtn(t, e, () => i(n), s);
3367
+ return n.classList.add("hasmenu"), n.insertAdjacentHTML("beforeend", h.chev), n.addEventListener("mousedown", () => this.saveSel()), n;
3354
3368
  }
3355
3369
  /** Quick text-color chips plus a "more" chip that opens the full palette. */
3356
3370
  colorChips() {
3357
3371
  const t = (s) => {
3358
- const l = document.createElement("button");
3359
- return l.type = "button", l.className = "cchip", l.title = s, l.addEventListener("mousedown", (n) => {
3360
- n.preventDefault(), this.saveSel();
3361
- }), l;
3372
+ const n = document.createElement("button");
3373
+ return n.type = "button", n.className = "cchip", n.title = s, n.addEventListener("mousedown", (l) => {
3374
+ l.preventDefault(), this.saveSel();
3375
+ }), n;
3362
3376
  }, e = Ke.map((s) => {
3363
- const l = t(this.t("forecolor"));
3364
- return l.style.background = s, l.addEventListener("click", () => this.applyColor("fore", s)), l;
3377
+ const n = t(this.t("forecolor"));
3378
+ return n.style.background = s, n.addEventListener("click", () => this.applyColor("fore", s)), n;
3365
3379
  }), i = t(this.t("forecolor"));
3366
3380
  return i.classList.add("more"), i.dataset.cb = "fore", i.innerHTML = h.chev, i.addEventListener("click", () => this.colorMenu(i, "fore")), [...e, i];
3367
3381
  }
@@ -3372,18 +3386,18 @@ let Ei = (j = class {
3372
3386
  }), e;
3373
3387
  }
3374
3388
  tsel(t, e, i, s) {
3375
- const l = document.createElement("button");
3376
- return l.className = "tsel " + t, l.type = "button", l.dataset.id = e, l.innerHTML = `<span class="lbl empty">${i || ""}</span>${h.chev}`, l.addEventListener("mousedown", (n) => {
3377
- n.preventDefault(), this.saveSel();
3378
- }), l.addEventListener("click", () => s(l)), l;
3389
+ const n = document.createElement("button");
3390
+ return n.className = "tsel " + t, n.type = "button", n.dataset.id = e, n.innerHTML = `<span class="lbl empty">${i || ""}</span>${h.chev}`, n.addEventListener("mousedown", (l) => {
3391
+ l.preventDefault(), this.saveSel();
3392
+ }), n.addEventListener("click", () => s(n)), n;
3379
3393
  }
3380
3394
  setListStyle(t, e) {
3381
- var l, n;
3395
+ var n, l;
3382
3396
  this.restoreSel();
3383
3397
  const i = window.getSelection();
3384
3398
  if (!i) return;
3385
- let s = (l = this.closestBlock(i.anchorNode)) == null ? void 0 : l.closest(t);
3386
- s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (n = this.closestBlock(i.anchorNode)) == null ? void 0 : n.closest(t)), s && (s.style.listStyleType = e), this.saveSel(), this.onChange();
3399
+ let s = (n = this.closestBlock(i.anchorNode)) == null ? void 0 : n.closest(t);
3400
+ s || (this.exec(t === "ol" ? "insertOrderedList" : "insertUnorderedList"), s = (l = this.closestBlock(i.anchorNode)) == null ? void 0 : l.closest(t)), s && (s.style.listStyleType = e), this.saveSel(), this.onChange();
3387
3401
  }
3388
3402
  listMenu(t, e) {
3389
3403
  var c;
@@ -3395,7 +3409,7 @@ let Ei = (j = class {
3395
3409
  ] : [
3396
3410
  ["circle", h.ul_circle],
3397
3411
  ["square", h.ul_square]
3398
- ], l = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), n = window.getSelection(), r = n ? (c = this.closestBlock(n.anchorNode)) == null ? void 0 : c.closest(e) : null, o = r ? r.style.listStyleType : "";
3412
+ ], n = this.tArr(e === "ol" ? "liststyles_ol" : "liststyles_ul").slice(1), l = window.getSelection(), r = l ? (c = this.closestBlock(l.anchorNode)) == null ? void 0 : c.closest(e) : null, o = r ? r.style.listStyleType : "";
3399
3413
  this.popup(t, (d) => {
3400
3414
  this.menuItems(d, [
3401
3415
  {
@@ -3405,13 +3419,13 @@ let Ei = (j = class {
3405
3419
  action: () => this.exec(i)
3406
3420
  }
3407
3421
  ]), d.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
3408
- const p = document.createElement("div");
3409
- p.className = "mi-grid", s.forEach(([m, b], y) => {
3422
+ const u = document.createElement("div");
3423
+ u.className = "mi-grid", s.forEach(([m, b], y) => {
3410
3424
  const g = document.createElement("button");
3411
- g.className = "mi" + (o === m ? " on" : ""), g.innerHTML = `<span class="ic">${b}</span><span class="prev">${l[y]}</span>`, g.addEventListener("click", () => {
3425
+ g.className = "mi" + (o === m ? " on" : ""), g.innerHTML = `<span class="ic">${b}</span><span class="prev">${n[y]}</span>`, g.addEventListener("click", () => {
3412
3426
  this.closePop(), this.setListStyle(e, m);
3413
- }), p.appendChild(g);
3414
- }), d.appendChild(p);
3427
+ }), u.appendChild(g);
3428
+ }), d.appendChild(u);
3415
3429
  });
3416
3430
  }
3417
3431
  /** Shared color-picker popup body — swatch grid plus the current-color /
@@ -3419,16 +3433,16 @@ let Ei = (j = class {
3419
3433
  * table cell-background menu all show the identical popup. */
3420
3434
  buildPaletteInto(t, e, i) {
3421
3435
  const s = document.createElement("div");
3422
- s.className = "cpal", Je.forEach((p) => {
3436
+ s.className = "cpal", Je.forEach((u) => {
3423
3437
  const m = document.createElement("button");
3424
- m.type = "button", m.style.background = p, m.title = p, m.addEventListener("click", () => {
3425
- this.closePop(), i(p);
3438
+ m.type = "button", m.style.background = u, m.title = u, m.addEventListener("click", () => {
3439
+ this.closePop(), i(u);
3426
3440
  }), s.appendChild(m);
3427
3441
  }), t.appendChild(s), t.insertAdjacentHTML("beforeend", '<div class="sep"></div>');
3428
- const l = document.createElement("div");
3429
- l.className = "cfoot";
3430
- const n = /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000", r = document.createElement("div");
3431
- r.className = "cswatch cur", r.title = this.t("currentcolor"), r.style.background = n, r.innerHTML = h.check;
3442
+ const n = document.createElement("div");
3443
+ n.className = "cfoot";
3444
+ const l = /^#[0-9a-f]{6}$/i.test(e) ? e : "#000000", r = document.createElement("div");
3445
+ r.className = "cswatch cur", r.title = this.t("currentcolor"), r.style.background = l, r.innerHTML = h.check;
3432
3446
  const o = document.createElement("button");
3433
3447
  o.type = "button", o.className = "cswatch nocolor", o.title = this.t("removecolor"), o.addEventListener("click", () => {
3434
3448
  this.closePop(), i(null);
@@ -3436,16 +3450,16 @@ let Ei = (j = class {
3436
3450
  const c = document.createElement("label");
3437
3451
  c.className = "cswatch cwheel", c.title = this.t("customcolor"), c.innerHTML = h.palette;
3438
3452
  const d = document.createElement("input");
3439
- d.type = "color", d.value = n, d.addEventListener("change", () => {
3453
+ d.type = "color", d.value = l, d.addEventListener("change", () => {
3440
3454
  this.closePop(), i(d.value);
3441
- }), c.appendChild(d), l.append(r, o, c), t.appendChild(l);
3455
+ }), c.appendChild(d), n.append(r, o, c), t.appendChild(n);
3442
3456
  }
3443
3457
  colorMenu(t, e) {
3444
3458
  this.popup(
3445
3459
  t,
3446
3460
  (i) => {
3447
3461
  const s = e === "fore" ? this.foreColor : this.backColor;
3448
- this.buildPaletteInto(i, s, (l) => this.applyColor(e, l));
3462
+ this.buildPaletteInto(i, s, (n) => this.applyColor(e, n));
3449
3463
  },
3450
3464
  e === "fore" ? "pop-forecolor" : "pop-backcolor"
3451
3465
  );
@@ -3484,16 +3498,16 @@ let Ei = (j = class {
3484
3498
  const t = window.getSelection();
3485
3499
  if (!t) return;
3486
3500
  if (!t.rangeCount) {
3487
- const n = document.createRange();
3488
- n.selectNodeContents(this.ed), n.collapse(!0), t.addRange(n);
3501
+ const l = document.createRange();
3502
+ l.selectNodeContents(this.ed), l.collapse(!0), t.addRange(l);
3489
3503
  }
3490
3504
  if (!t.isCollapsed) return;
3491
3505
  const e = t.getRangeAt(0), i = e.startContainer;
3492
3506
  if (i.nodeType === 3) {
3493
- const n = i.data;
3507
+ const l = i.data;
3494
3508
  let r = e.startOffset, o = e.startOffset;
3495
- for (; r > 0 && /\S/.test(n[r - 1]); ) r--;
3496
- for (; o < n.length && /\S/.test(n[o]); ) o++;
3509
+ for (; r > 0 && /\S/.test(l[r - 1]); ) r--;
3510
+ for (; o < l.length && /\S/.test(l[o]); ) o++;
3497
3511
  if (o > r) {
3498
3512
  const c = document.createRange();
3499
3513
  c.setStart(i, r), c.setEnd(i, o), t.removeAllRanges(), t.addRange(c), this.savedRange = c.cloneRange();
@@ -3502,8 +3516,8 @@ let Ei = (j = class {
3502
3516
  }
3503
3517
  const s = document.createTextNode("​");
3504
3518
  e.insertNode(s);
3505
- const l = document.createRange();
3506
- l.setStart(s, 0), l.setEnd(s, 1), t.removeAllRanges(), t.addRange(l), this.savedRange = l.cloneRange();
3519
+ const n = document.createRange();
3520
+ n.setStart(s, 0), n.setEnd(s, 1), t.removeAllRanges(), t.addRange(n), this.savedRange = n.cloneRange();
3507
3521
  }
3508
3522
  applyFontSize(t) {
3509
3523
  this.restoreSel(), this.ensureSizeTarget(), document.execCommand("styleWithCSS", !1, "false"), document.execCommand("fontSize", !1, "7");
@@ -3521,7 +3535,7 @@ let Ei = (j = class {
3521
3535
  this.saveSel(), this.refreshState(), this.onChange();
3522
3536
  }
3523
3537
  stepFontSize(t) {
3524
- const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(Qe, Math.max(Ge, e + t));
3538
+ const e = parseInt(this.currentSize(), 10) || 14, i = Math.min(Ge, Math.max(Qe, e + t));
3525
3539
  i !== e && this.applyFontSize(i + "px");
3526
3540
  }
3527
3541
  /* ------------------------------------------------ case / spacing / link */
@@ -3529,15 +3543,15 @@ let Ei = (j = class {
3529
3543
  this.restoreSel();
3530
3544
  const e = window.getSelection();
3531
3545
  if (!e || !e.rangeCount || e.isCollapsed) return;
3532
- const i = e.getRangeAt(0), s = document.createTreeWalker(this.ed, NodeFilter.SHOW_TEXT), l = [];
3533
- let n;
3534
- for (; n = s.nextNode(); ) i.intersectsNode(n) && l.push(n);
3535
- l.forEach((r) => {
3546
+ const i = e.getRangeAt(0), s = document.createTreeWalker(this.ed, NodeFilter.SHOW_TEXT), n = [];
3547
+ let l;
3548
+ for (; l = s.nextNode(); ) i.intersectsNode(l) && n.push(l);
3549
+ n.forEach((r) => {
3536
3550
  const o = r === i.startContainer ? i.startOffset : 0, c = r === i.endContainer ? i.endOffset : r.data.length;
3537
3551
  if (c <= o) return;
3538
3552
  const d = r.data.slice(o, c);
3539
- let p = d;
3540
- t === "lower" ? p = d.toLowerCase() : t === "upper" ? p = d.toUpperCase() : p = d.replace(/(^|\s)(\S)/g, (m, b, y) => b + y.toUpperCase()), r.replaceData(o, c - o, p);
3553
+ let u = d;
3554
+ t === "lower" ? u = d.toLowerCase() : t === "upper" ? u = d.toUpperCase() : u = d.replace(/(^|\s)(\S)/g, (m, b, y) => b + y.toUpperCase()), r.replaceData(o, c - o, u);
3541
3555
  }), this.saveSel(), this.refreshState(), this.onChange();
3542
3556
  }
3543
3557
  caseItems() {
@@ -3553,8 +3567,8 @@ let Ei = (j = class {
3553
3567
  applyBlockStyle(t, e) {
3554
3568
  this.restoreSel();
3555
3569
  const i = this.selectedBlocks(), s = t === "lineHeight" ? "line-height" : t === "wordSpacing" ? "word-spacing" : "letter-spacing";
3556
- i.forEach((l) => {
3557
- e ? l.style[t] = e : l.style.removeProperty(s);
3570
+ i.forEach((n) => {
3571
+ e ? n.style[t] = e : n.style.removeProperty(s);
3558
3572
  }), this.saveSel(), this.onChange();
3559
3573
  }
3560
3574
  currentBlockStyle(t) {
@@ -3600,8 +3614,8 @@ let Ei = (j = class {
3600
3614
  action: () => {
3601
3615
  const s = document.createRange();
3602
3616
  s.selectNodeContents(t);
3603
- const l = window.getSelection();
3604
- l && (l.removeAllRanges(), l.addRange(s)), document.execCommand("unlink"), this.closeDlg(), this.onChange();
3617
+ const n = window.getSelection();
3618
+ n && (n.removeAllRanges(), n.addRange(s)), document.execCommand("unlink"), this.closeDlg(), this.onChange();
3605
3619
  }
3606
3620
  }), i.push(
3607
3621
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -3616,17 +3630,17 @@ let Ei = (j = class {
3616
3630
  return;
3617
3631
  }
3618
3632
  this.restoreSel();
3619
- const l = window.getSelection();
3620
- !l || l.isCollapsed ? document.execCommand("insertHTML", !1, `<a href="${s.replace(/"/g, "&quot;")}">${s.replace(/&/g, "&amp;").replace(/</g, "&lt;")}</a>`) : (document.execCommand("styleWithCSS", !1, "false"), document.execCommand("createLink", !1, s)), this.saveSel(), this.onChange();
3633
+ const n = window.getSelection();
3634
+ !n || n.isCollapsed ? document.execCommand("insertHTML", !1, `<a href="${s.replace(/"/g, "&quot;")}">${s.replace(/&/g, "&amp;").replace(/</g, "&lt;")}</a>`) : (document.execCommand("styleWithCSS", !1, "false"), document.execCommand("createLink", !1, s)), this.saveSel(), this.onChange();
3621
3635
  }
3622
3636
  }
3623
3637
  ), this.dialog(
3624
3638
  this.t("linkttl"),
3625
3639
  (s) => {
3626
- const l = document.createElement("div");
3627
- l.style.cssText = "display:flex;align-items:center;gap:10px;margin:10px 0;min-width:360px";
3628
- const n = document.createElement("span");
3629
- n.style.cssText = "width:60px;color:#556;flex:none", n.textContent = this.t("linkurl"), e = document.createElement("input"), e.type = "url", e.placeholder = "https://", e.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", e.value = (t == null ? void 0 : t.getAttribute("href")) || "", l.append(n, e), s.appendChild(l), setTimeout(() => e.focus(), 0);
3640
+ const n = document.createElement("div");
3641
+ n.style.cssText = "display:flex;align-items:center;gap:10px;margin:10px 0;min-width:360px";
3642
+ const l = document.createElement("span");
3643
+ l.style.cssText = "width:60px;color:#556;flex:none", l.textContent = this.t("linkurl"), e = document.createElement("input"), e.type = "url", e.placeholder = "https://", e.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", e.value = (t == null ? void 0 : t.getAttribute("href")) || "", n.append(l, e), s.appendChild(n), setTimeout(() => e.focus(), 0);
3630
3644
  },
3631
3645
  i
3632
3646
  );
@@ -3667,19 +3681,19 @@ let Ei = (j = class {
3667
3681
  i.className = "tgridwrap";
3668
3682
  const s = document.createElement("div");
3669
3683
  s.className = "tgrid";
3670
- const l = document.createElement("div");
3671
- l.className = "tgridlbl", l.textContent = "1 × 1";
3672
- const n = [];
3684
+ const n = document.createElement("div");
3685
+ n.className = "tgridlbl", n.textContent = "1 × 1";
3686
+ const l = [];
3673
3687
  for (let r = 0; r < 8; r++)
3674
3688
  for (let o = 0; o < 10; o++) {
3675
3689
  const c = document.createElement("span");
3676
3690
  c.dataset.r = String(r), c.dataset.c = String(o), c.addEventListener("mouseenter", () => {
3677
- n.forEach((d) => d.classList.toggle("hot", +d.dataset.r <= r && +d.dataset.c <= o)), l.textContent = o + 1 + " × " + (r + 1);
3691
+ l.forEach((d) => d.classList.toggle("hot", +d.dataset.r <= r && +d.dataset.c <= o)), n.textContent = o + 1 + " × " + (r + 1);
3678
3692
  }), c.addEventListener("click", () => {
3679
3693
  this.closePop(), this.insertTable(r + 1, o + 1), e == null || e();
3680
- }), n.push(c), s.appendChild(c);
3694
+ }), l.push(c), s.appendChild(c);
3681
3695
  }
3682
- i.append(s, l), t.appendChild(i);
3696
+ i.append(s, n), t.appendChild(i);
3683
3697
  }
3684
3698
  }
3685
3699
  insertTable(t, e) {
@@ -3687,7 +3701,7 @@ let Ei = (j = class {
3687
3701
  let i = '<table style="border-collapse:collapse;width:100%;table-layout:fixed"><tbody>';
3688
3702
  for (let s = 0; s < t; s++) {
3689
3703
  i += "<tr>";
3690
- for (let l = 0; l < e; l++) i += '<td style="border:1px solid #b9c2cc"><br></td>';
3704
+ for (let n = 0; n < e; n++) i += '<td style="border:1px solid #b9c2cc"><br></td>';
3691
3705
  i += "</tr>";
3692
3706
  }
3693
3707
  i += "</tbody></table><p><br></p>", document.execCommand("insertHTML", !1, i), this.saveSel(), this.onChange();
@@ -3765,13 +3779,13 @@ let Ei = (j = class {
3765
3779
  const t = this.options.toolbar === !0 ? Ue : this.options.toolbar, e = this.buildToolbarRegistry();
3766
3780
  this.parseToolbarString(t).forEach((i) => {
3767
3781
  const s = [];
3768
- i.forEach((l) => {
3769
- const n = e[l];
3770
- if (!n) {
3771
- console.warn(`FableEditor: unknown toolbar item "${l}"`);
3782
+ i.forEach((n) => {
3783
+ const l = e[n];
3784
+ if (!l) {
3785
+ console.warn(`FableEditor: unknown toolbar item "${n}"`);
3772
3786
  return;
3773
3787
  }
3774
- const r = n();
3788
+ const r = l();
3775
3789
  Array.isArray(r) ? s.push(...r) : s.push(r);
3776
3790
  }), s.length && this.toolbar.appendChild(this.group(...s));
3777
3791
  }), this.tbrMore = this.tbtn(h.more, this.t("more"), () => {
@@ -3876,8 +3890,8 @@ let Ei = (j = class {
3876
3890
  { label: this.t("wordspacing"), icon: h.wordspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("wordSpacing", te)) },
3877
3891
  { label: this.t("letterspacing"), icon: h.letterspacing, subBuild: (s) => this.menuItems(s, this.blockStyleItems("letterSpacing", ee)) },
3878
3892
  "|",
3879
- { label: this.t("forecolor"), icon: h.palette, subBuild: (s) => this.buildPaletteInto(s, this.foreColor, (l) => this.applyColor("fore", l)) },
3880
- { label: this.t("backcolor"), icon: h.backcolor, subBuild: (s) => this.buildPaletteInto(s, this.backColor, (l) => this.applyColor("back", l)) },
3893
+ { label: this.t("forecolor"), icon: h.palette, subBuild: (s) => this.buildPaletteInto(s, this.foreColor, (n) => this.applyColor("fore", n)) },
3894
+ { label: this.t("backcolor"), icon: h.backcolor, subBuild: (s) => this.buildPaletteInto(s, this.backColor, (n) => this.applyColor("back", n)) },
3881
3895
  "|",
3882
3896
  this.mItem("bullist", h.bullist, () => this.exec("insertUnorderedList")),
3883
3897
  this.mItem("numlist", h.numlist, () => this.exec("insertOrderedList")),
@@ -3951,10 +3965,10 @@ let Ei = (j = class {
3951
3965
  console.warn(`FableEditor: unknown menubar item "${s}"`);
3952
3966
  return;
3953
3967
  }
3954
- const l = document.createElement("button");
3955
- l.type = "button", l.textContent = this.t(s), l.dataset.menuKey = s, l.addEventListener("mousedown", (n) => {
3956
- n.preventDefault(), this.saveSel();
3957
- }), l.addEventListener("click", () => this.popup(l, (n) => this.menuItems(n, t[s]))), this.menubar.appendChild(l);
3968
+ const n = document.createElement("button");
3969
+ n.type = "button", n.textContent = this.t(s), n.dataset.menuKey = s, n.addEventListener("mousedown", (l) => {
3970
+ l.preventDefault(), this.saveSel();
3971
+ }), n.addEventListener("click", () => this.popup(n, (l) => this.menuItems(l, t[s]))), this.menubar.appendChild(n);
3958
3972
  });
3959
3973
  }
3960
3974
  /* ---------------------------------------------------------- table ops */
@@ -3965,24 +3979,24 @@ let Ei = (j = class {
3965
3979
  if (!e) return;
3966
3980
  const i = ((o = this.closestBlock(e.anchorNode)) == null ? void 0 : o.closest("td,th")) || (e.anchorNode && e.anchorNode.nodeType === 1 ? (d = (c = e.anchorNode).closest) == null ? void 0 : d.call(c, "td,th") : null);
3967
3981
  if (!i) return;
3968
- const s = i.parentElement, l = i.closest("table"), n = Array.from(s.children).indexOf(i), r = () => {
3969
- const p = s.cloneNode(!1);
3982
+ const s = i.parentElement, n = i.closest("table"), l = Array.from(s.children).indexOf(i), r = () => {
3983
+ const u = s.cloneNode(!1);
3970
3984
  return Array.from(s.children).forEach((m) => {
3971
3985
  const b = document.createElement("td"), y = m.getAttribute("style");
3972
- y && b.setAttribute("style", y), b.style.removeProperty("background-color"), b.innerHTML = "<br>", p.appendChild(b);
3973
- }), p;
3986
+ y && b.setAttribute("style", y), b.style.removeProperty("background-color"), b.innerHTML = "<br>", u.appendChild(b);
3987
+ }), u;
3974
3988
  };
3975
3989
  if (t === "rowabove" && s.before(r()), t === "rowbelow" && s.after(r()), t === "delrow") {
3976
- const p = s.parentElement;
3977
- s.remove(), p.querySelector("tr") || l.remove();
3990
+ const u = s.parentElement;
3991
+ s.remove(), u.querySelector("tr") || n.remove();
3978
3992
  }
3979
- (t === "colbefore" || t === "colafter") && l.querySelectorAll("tr").forEach((p) => {
3980
- const m = p.children[Math.min(n, p.children.length - 1)], b = document.createElement("td"), y = m.getAttribute("style");
3993
+ (t === "colbefore" || t === "colafter") && n.querySelectorAll("tr").forEach((u) => {
3994
+ const m = u.children[Math.min(l, u.children.length - 1)], b = document.createElement("td"), y = m.getAttribute("style");
3981
3995
  y && b.setAttribute("style", y), b.style.removeProperty("width"), b.style.removeProperty("background-color"), b.innerHTML = "<br>", t === "colbefore" ? m.before(b) : m.after(b);
3982
- }), t === "delcol" && (l.querySelectorAll("tr").forEach((p) => {
3996
+ }), t === "delcol" && (n.querySelectorAll("tr").forEach((u) => {
3983
3997
  var m;
3984
- return (m = p.children[n]) == null ? void 0 : m.remove();
3985
- }), l.querySelector("td,th") || l.remove()), t === "deltable" && l.remove(), this.onChange(), this.positionTableHandles();
3998
+ return (m = u.children[l]) == null ? void 0 : m.remove();
3999
+ }), n.querySelector("td,th") || n.remove()), t === "deltable" && n.remove(), this.onChange(), this.positionTableHandles();
3986
4000
  }
3987
4001
  /** Reorders the current row/column: 'rowup'/'rowdown' swap the caret's row with
3988
4002
  * its neighbour, 'colleft'/'colright' move the caret's column one position in
@@ -3991,7 +4005,7 @@ let Ei = (j = class {
3991
4005
  this.restoreSel();
3992
4006
  const e = this.currentCell();
3993
4007
  if (!e) return;
3994
- const i = e.parentElement, s = e.closest("table"), l = Array.from(i.children).indexOf(e);
4008
+ const i = e.parentElement, s = e.closest("table"), n = Array.from(i.children).indexOf(e);
3995
4009
  if (t === "rowup") {
3996
4010
  const o = i.previousElementSibling;
3997
4011
  o && o.before(i);
@@ -4000,17 +4014,17 @@ let Ei = (j = class {
4000
4014
  const o = i.nextElementSibling;
4001
4015
  o && o.after(i);
4002
4016
  }
4003
- t === "colleft" && l > 0 && s.querySelectorAll("tr").forEach((o) => {
4004
- const c = o.children[l], d = o.children[l - 1];
4017
+ t === "colleft" && n > 0 && s.querySelectorAll("tr").forEach((o) => {
4018
+ const c = o.children[n], d = o.children[n - 1];
4005
4019
  c && d && d.before(c);
4006
4020
  }), t === "colright" && s.querySelectorAll("tr").forEach((o) => {
4007
- const c = o.children[l], d = o.children[l + 1];
4021
+ const c = o.children[n], d = o.children[n + 1];
4008
4022
  c && d && d.after(c);
4009
4023
  });
4010
- const n = document.createRange();
4011
- n.selectNodeContents(e), n.collapse(!0);
4024
+ const l = document.createRange();
4025
+ l.selectNodeContents(e), l.collapse(!0);
4012
4026
  const r = window.getSelection();
4013
- r && (r.removeAllRanges(), r.addRange(n)), this.saveSel(), this.onChange(), this.positionTableHandles(), this.positionCellMarker();
4027
+ r && (r.removeAllRanges(), r.addRange(l)), this.saveSel(), this.onChange(), this.positionTableHandles(), this.positionCellMarker();
4014
4028
  }
4015
4029
  /** Align the whole table via auto margins — same semantics as the align
4016
4030
  * field in the table-properties dialog. */
@@ -4022,12 +4036,12 @@ let Ei = (j = class {
4022
4036
  * build header rows (the toolbar's backcolor highlights text, not cells). */
4023
4037
  buildCellFillInto(t) {
4024
4038
  const e = (s) => {
4025
- const l = this.currentCell();
4026
- if (!l) {
4039
+ const n = this.currentCell();
4040
+ if (!n) {
4027
4041
  alert(this.t("nocell"));
4028
4042
  return;
4029
4043
  }
4030
- this.setOrClear(l, "background-color", s || ""), this.onChange();
4044
+ this.setOrClear(n, "background-color", s || ""), this.onChange();
4031
4045
  }, i = this.currentCell();
4032
4046
  this.buildPaletteInto(t, this.cssToHex(i ? i.style.backgroundColor : ""), e);
4033
4047
  }
@@ -4047,8 +4061,8 @@ let Ei = (j = class {
4047
4061
  tablePropsDlg() {
4048
4062
  const t = this.tblActive;
4049
4063
  if (!t) return;
4050
- let e, i, s, l, n;
4051
- const r = "display:flex;align-items:center;gap:10px;margin:10px 0", o = "width:120px;color:#556;flex:none", c = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", d = t.querySelector("td,th"), p = t.style.width || "", m = d && d.style.padding ? parseFloat(d.style.padding) : "", b = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", y = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", g = t.style.marginLeft, x = t.style.marginRight, w = g === "auto" && x === "auto" ? "center" : g === "auto" ? "right" : x === "auto" && g === "0" ? "left" : "";
4064
+ let e, i, s, n, l;
4065
+ const r = "display:flex;align-items:center;gap:10px;margin:10px 0", o = "width:120px;color:#556;flex:none", c = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit", d = t.querySelector("td,th"), u = t.style.width || "", m = d && d.style.padding ? parseFloat(d.style.padding) : "", b = t.style.borderSpacing ? parseFloat(t.style.borderSpacing) : "", y = t.style.borderWidth ? parseFloat(t.style.borderWidth) : "", g = t.style.marginLeft, x = t.style.marginRight, w = g === "auto" && x === "auto" ? "center" : g === "auto" ? "right" : x === "auto" && g === "0" ? "left" : "";
4052
4066
  this.dialog(
4053
4067
  this.t("tablepropsttl"),
4054
4068
  (E) => {
@@ -4058,15 +4072,15 @@ let Ei = (j = class {
4058
4072
  const _ = document.createElement("span");
4059
4073
  _.style.cssText = o, _.textContent = this.t(H), O.append(_, $), E.appendChild(O);
4060
4074
  };
4061
- e = document.createElement("input"), e.type = "text", e.style.cssText = c, e.placeholder = "e.g. 600px or 100%", e.value = p, A("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = c, i.value = String(m), A("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = c, s.value = String(b), A("tblcellspacing", s), l = document.createElement("input"), l.type = "number", l.min = "0", l.style.cssText = c, l.value = String(y), A("tblborder", l), n = document.createElement("select"), n.style.cssText = c, [
4075
+ e = document.createElement("input"), e.type = "text", e.style.cssText = c, e.placeholder = "e.g. 600px or 100%", e.value = u, A("tblwidth", e), i = document.createElement("input"), i.type = "number", i.min = "0", i.style.cssText = c, i.value = String(m), A("tblcellpadding", i), s = document.createElement("input"), s.type = "number", s.min = "0", s.style.cssText = c, s.value = String(b), A("tblcellspacing", s), n = document.createElement("input"), n.type = "number", n.min = "0", n.style.cssText = c, n.value = String(y), A("tblborder", n), l = document.createElement("select"), l.style.cssText = c, [
4062
4076
  ["", "alignnone"],
4063
4077
  ["left", "alignleft"],
4064
4078
  ["center", "aligncenter"],
4065
4079
  ["right", "alignright"]
4066
4080
  ].forEach(([H, $]) => {
4067
4081
  const O = document.createElement("option");
4068
- O.value = H, O.textContent = this.t($), H === w && (O.selected = !0), n.appendChild(O);
4069
- }), A("tblalign", n);
4082
+ O.value = H, O.textContent = this.t($), H === w && (O.selected = !0), l.appendChild(O);
4083
+ }), A("tblalign", l);
4070
4084
  },
4071
4085
  [
4072
4086
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4078,8 +4092,8 @@ let Ei = (j = class {
4078
4092
  width: e.value.trim(),
4079
4093
  cellpadding: i.value.trim(),
4080
4094
  cellspacing: s.value.trim(),
4081
- border: l.value.trim(),
4082
- align: n.value
4095
+ border: n.value.trim(),
4096
+ align: l.value
4083
4097
  }), this.closeDlg(), this.onChange(), this.positionTableHandles();
4084
4098
  }
4085
4099
  }
@@ -4108,8 +4122,8 @@ let Ei = (j = class {
4108
4122
  formRow(t, e, i) {
4109
4123
  const s = document.createElement("div");
4110
4124
  s.style.cssText = "display:flex;align-items:center;gap:10px;margin:10px 0;min-width:360px";
4111
- const l = document.createElement("span");
4112
- l.style.cssText = "width:120px;color:#556;flex:none", l.textContent = e, s.append(l, i), t.appendChild(s);
4125
+ const n = document.createElement("span");
4126
+ n.style.cssText = "width:120px;color:#556;flex:none", n.textContent = e, s.append(n, i), t.appendChild(s);
4113
4127
  }
4114
4128
  formInput(t, e = "") {
4115
4129
  const i = document.createElement("input");
@@ -4117,9 +4131,9 @@ let Ei = (j = class {
4117
4131
  }
4118
4132
  formSelect(t, e) {
4119
4133
  const i = document.createElement("select");
4120
- return i.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit;background:#fff", t.forEach(([s, l]) => {
4121
- const n = document.createElement("option");
4122
- n.value = s, n.textContent = l, s === e && (n.selected = !0), i.appendChild(n);
4134
+ return i.style.cssText = "flex:1;border:1px solid #cfd6df;border-radius:6px;padding:7px 9px;font:14px inherit;background:#fff", t.forEach(([s, n]) => {
4135
+ const l = document.createElement("option");
4136
+ l.value = s, l.textContent = n, s === e && (l.selected = !0), i.appendChild(l);
4123
4137
  }), i;
4124
4138
  }
4125
4139
  formBg(t) {
@@ -4127,10 +4141,10 @@ let Ei = (j = class {
4127
4141
  e.style.cssText = "flex:1;display:flex;align-items:center;gap:8px";
4128
4142
  const i = this.toHexColor(t), s = document.createElement("input");
4129
4143
  s.type = "color", s.value = i || "#ffffff", s.style.cssText = "width:36px;height:29px;border:1px solid #cfd6df;border-radius:4px;padding:1px;background:none;cursor:pointer";
4130
- const l = document.createElement("label");
4131
- l.style.cssText = "display:flex;align-items:center;gap:6px;cursor:pointer;color:#556";
4132
- const n = document.createElement("input");
4133
- return n.type = "checkbox", n.checked = !!i, l.append(n, document.createTextNode(this.t("fill"))), s.addEventListener("input", () => n.checked = !0), e.append(s, l), { wrap: e, color: s, fill: n };
4144
+ const n = document.createElement("label");
4145
+ n.style.cssText = "display:flex;align-items:center;gap:6px;cursor:pointer;color:#556";
4146
+ const l = document.createElement("input");
4147
+ return l.type = "checkbox", l.checked = !!i, n.append(l, document.createTextNode(this.t("fill"))), s.addEventListener("input", () => l.checked = !0), e.append(s, n), { wrap: e, color: s, fill: l };
4134
4148
  }
4135
4149
  setOrClear(t, e, i) {
4136
4150
  i ? t.style.setProperty(e, /^(width|height)$/.test(e) && /^\d+$/.test(i) ? i + "px" : i) : t.style.removeProperty(e);
@@ -4141,7 +4155,7 @@ let Ei = (j = class {
4141
4155
  alert(this.t("nocell"));
4142
4156
  return;
4143
4157
  }
4144
- let e, i, s, l, n;
4158
+ let e, i, s, n, l;
4145
4159
  this.dialog(
4146
4160
  this.t("cellprops").replace("…", ""),
4147
4161
  (r) => {
@@ -4153,7 +4167,7 @@ let Ei = (j = class {
4153
4167
  ["right", this.t("alignright")]
4154
4168
  ],
4155
4169
  t.style.textAlign || ""
4156
- ), this.formRow(r, this.t("tblalign"), s), l = this.formSelect(
4170
+ ), this.formRow(r, this.t("tblalign"), s), n = this.formSelect(
4157
4171
  [
4158
4172
  ["", this.t("alignnone")],
4159
4173
  ["top", this.t("valigntop")],
@@ -4161,7 +4175,7 @@ let Ei = (j = class {
4161
4175
  ["bottom", this.t("valignbottom")]
4162
4176
  ],
4163
4177
  t.style.verticalAlign || ""
4164
- ), this.formRow(r, this.t("valign"), l), n = this.formBg(t.style.backgroundColor || ""), this.formRow(r, this.t("backcolor"), n.wrap);
4178
+ ), this.formRow(r, this.t("valign"), n), l = this.formBg(t.style.backgroundColor || ""), this.formRow(r, this.t("backcolor"), l.wrap);
4165
4179
  },
4166
4180
  [
4167
4181
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4169,7 +4183,7 @@ let Ei = (j = class {
4169
4183
  label: this.t("save"),
4170
4184
  primary: !0,
4171
4185
  action: () => {
4172
- this.setOrClear(t, "width", e.value.trim()), this.setOrClear(t, "height", i.value.trim()), this.setOrClear(t, "text-align", s.value), this.setOrClear(t, "vertical-align", l.value), this.setOrClear(t, "background-color", n.fill.checked ? n.color.value : ""), this.closeDlg(), this.onChange(), this.positionTableHandles();
4186
+ this.setOrClear(t, "width", e.value.trim()), this.setOrClear(t, "height", i.value.trim()), this.setOrClear(t, "text-align", s.value), this.setOrClear(t, "vertical-align", n.value), this.setOrClear(t, "background-color", l.fill.checked ? l.color.value : ""), this.closeDlg(), this.onChange(), this.positionTableHandles();
4173
4187
  }
4174
4188
  }
4175
4189
  ]
@@ -4185,8 +4199,8 @@ let Ei = (j = class {
4185
4199
  let i, s;
4186
4200
  this.dialog(
4187
4201
  this.t("rowprops").replace("…", ""),
4188
- (l) => {
4189
- i = this.formInput(e.style.height, "e.g. 40px"), this.formRow(l, this.t("tblheight"), i), s = this.formBg(e.style.backgroundColor || ""), this.formRow(l, this.t("backcolor"), s.wrap);
4202
+ (n) => {
4203
+ i = this.formInput(e.style.height, "e.g. 40px"), this.formRow(n, this.t("tblheight"), i), s = this.formBg(e.style.backgroundColor || ""), this.formRow(n, this.t("backcolor"), s.wrap);
4190
4204
  },
4191
4205
  [
4192
4206
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4206,12 +4220,12 @@ let Ei = (j = class {
4206
4220
  alert(this.t("nocell"));
4207
4221
  return;
4208
4222
  }
4209
- const e = t.parentElement, i = t.closest("table"), s = Array.from(e.children).indexOf(t), l = Array.from(i.rows).map((o) => o.cells[s]).filter(Boolean);
4210
- let n, r;
4223
+ const e = t.parentElement, i = t.closest("table"), s = Array.from(e.children).indexOf(t), n = Array.from(i.rows).map((o) => o.cells[s]).filter(Boolean);
4224
+ let l, r;
4211
4225
  this.dialog(
4212
4226
  this.t("colprops").replace("…", ""),
4213
4227
  (o) => {
4214
- n = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(o, this.t("tblwidth"), n), r = this.formBg(t.style.backgroundColor || ""), this.formRow(o, this.t("backcolor"), r.wrap);
4228
+ l = this.formInput(t.style.width, "e.g. 120px / 25%"), this.formRow(o, this.t("tblwidth"), l), r = this.formBg(t.style.backgroundColor || ""), this.formRow(o, this.t("backcolor"), r.wrap);
4215
4229
  },
4216
4230
  [
4217
4231
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4219,8 +4233,8 @@ let Ei = (j = class {
4219
4233
  label: this.t("save"),
4220
4234
  primary: !0,
4221
4235
  action: () => {
4222
- l.forEach((o) => {
4223
- this.setOrClear(o, "width", n.value.trim()), this.setOrClear(o, "background-color", r.fill.checked ? r.color.value : "");
4236
+ n.forEach((o) => {
4237
+ this.setOrClear(o, "width", l.value.trim()), this.setOrClear(o, "background-color", r.fill.checked ? r.color.value : "");
4224
4238
  }), this.closeDlg(), this.onChange(), this.positionTableHandles();
4225
4239
  }
4226
4240
  }
@@ -4235,11 +4249,11 @@ let Ei = (j = class {
4235
4249
  this.closeDlg(), this.closePop(), this.dlgOvl = document.createElement("div"), this.dlgOvl.className = "ovl";
4236
4250
  const s = document.createElement("div");
4237
4251
  s.className = "dlg", s.dir = this.dir(), s.innerHTML = `<header><span>${t}</span><button type="button">×</button></header>
4238
- <div class="body"></div><footer></footer>`, s.querySelector("header button").onclick = () => this.closeDlg(), e(s.querySelector(".body")), (i || [{ label: this.t("close"), primary: !0, action: () => this.closeDlg() }]).forEach((l) => {
4239
- const n = document.createElement("button");
4240
- n.type = "button", n.textContent = l.label, l.primary && (n.className = "pri"), n.onclick = l.action, s.querySelector("footer").appendChild(n);
4241
- }), this.dlgOvl.appendChild(s), this.dlgOvl.addEventListener("mousedown", (l) => {
4242
- l.target === this.dlgOvl && this.closeDlg();
4252
+ <div class="body"></div><footer></footer>`, s.querySelector("header button").onclick = () => this.closeDlg(), e(s.querySelector(".body")), (i || [{ label: this.t("close"), primary: !0, action: () => this.closeDlg() }]).forEach((n) => {
4253
+ const l = document.createElement("button");
4254
+ l.type = "button", l.textContent = n.label, n.primary && (l.className = "pri"), l.onclick = n.action, s.querySelector("footer").appendChild(l);
4255
+ }), this.dlgOvl.appendChild(s), this.dlgOvl.addEventListener("mousedown", (n) => {
4256
+ n.target === this.dlgOvl && this.closeDlg();
4243
4257
  }), document.body.appendChild(this.dlgOvl);
4244
4258
  }
4245
4259
  sourceDlg() {
@@ -4295,26 +4309,26 @@ let Ei = (j = class {
4295
4309
  * fixed category tabs on the left, the active category's glyphs on the right. */
4296
4310
  glyphPickerDlg(t, e, i) {
4297
4311
  this.saveSel(), this.dialog(t, (s) => {
4298
- const l = document.createElement("div");
4299
- l.className = "chmap";
4300
4312
  const n = document.createElement("div");
4301
- n.className = "chtabs";
4313
+ n.className = "chmap";
4314
+ const l = document.createElement("div");
4315
+ l.className = "chtabs";
4302
4316
  const r = document.createElement("div");
4303
4317
  r.className = "chpanel";
4304
4318
  const o = document.createElement("div");
4305
4319
  o.className = "chgrid" + (i ? " emgrid" : ""), r.appendChild(o);
4306
4320
  const c = (d) => {
4307
- n.querySelectorAll("button").forEach((p, m) => p.classList.toggle("on", m === d)), o.innerHTML = "", e[d].chars.forEach((p) => {
4321
+ l.querySelectorAll("button").forEach((u, m) => u.classList.toggle("on", m === d)), o.innerHTML = "", e[d].chars.forEach((u) => {
4308
4322
  const m = document.createElement("button");
4309
- m.type = "button", m.textContent = p, m.onclick = () => {
4310
- this.closeDlg(), this.exec("insertText", p);
4323
+ m.type = "button", m.textContent = u, m.onclick = () => {
4324
+ this.closeDlg(), this.exec("insertText", u);
4311
4325
  }, o.appendChild(m);
4312
4326
  }), r.scrollTop = 0;
4313
4327
  };
4314
- e.forEach((d, p) => {
4328
+ e.forEach((d, u) => {
4315
4329
  const m = document.createElement("button");
4316
- m.type = "button", m.textContent = this.t(d.key), m.addEventListener("click", () => c(p)), n.appendChild(m);
4317
- }), l.append(n, r), s.appendChild(l), c(0);
4330
+ m.type = "button", m.textContent = this.t(d.key), m.addEventListener("click", () => c(u)), l.appendChild(m);
4331
+ }), n.append(l, r), s.appendChild(n), c(0);
4318
4332
  });
4319
4333
  }
4320
4334
  charMap() {
@@ -4383,20 +4397,20 @@ let Ei = (j = class {
4383
4397
  const i = document.createElement("button");
4384
4398
  i.type = "button", i.className = "txtbtn", i.textContent = this.t("insertimg");
4385
4399
  const s = () => {
4386
- const l = e.value.trim(), n = this.phActive;
4387
- if (!n) return;
4388
- if (!/^(https?:|data:image\/|blob:)/i.test(l)) {
4400
+ const n = e.value.trim(), l = this.phActive;
4401
+ if (!l) return;
4402
+ if (!/^(https?:|data:image\/|blob:)/i.test(n)) {
4389
4403
  e.classList.add("err"), e.focus();
4390
4404
  return;
4391
4405
  }
4392
4406
  i.disabled = !0, e.disabled = !0;
4393
4407
  const r = new Image();
4394
- r.onload = () => this.replacePlaceholderWithImage(n, l, ""), r.onerror = () => {
4408
+ r.onload = () => this.replacePlaceholderWithImage(l, n, ""), r.onerror = () => {
4395
4409
  i.disabled = !1, e.disabled = !1, e.classList.add("err"), e.focus();
4396
- }, r.src = l;
4410
+ }, r.src = n;
4397
4411
  };
4398
- i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (l) => {
4399
- l.key === "Enter" ? (l.preventDefault(), s()) : l.key === "Escape" && (l.stopPropagation(), this.renderPhCtxButtons());
4412
+ i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (n) => {
4413
+ n.key === "Enter" ? (n.preventDefault(), s()) : n.key === "Escape" && (n.stopPropagation(), this.renderPhCtxButtons());
4400
4414
  }), t.append(e, i), this.positionImgPhCtx(), e.focus();
4401
4415
  }
4402
4416
  readImageFileInto(t, e) {
@@ -4416,11 +4430,11 @@ let Ei = (j = class {
4416
4430
  const i = t.name.replace(/"/g, "");
4417
4431
  e.classList.remove("upload-error"), e.classList.add("uploading");
4418
4432
  const s = e.querySelector("span");
4419
- s && (s.textContent = this.t("uploading")), this.imageUploadHandler(t).then((l) => {
4420
- this.ed.contains(e) && this.replacePlaceholderWithImage(e, l, i);
4421
- }).catch((l) => {
4422
- var n;
4423
- this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (n = this.onImageUploadError) == null || n.call(this, l, t));
4433
+ s && (s.textContent = this.t("uploading")), this.imageUploadHandler(t).then((n) => {
4434
+ this.ed.contains(e) && this.replacePlaceholderWithImage(e, n, i);
4435
+ }).catch((n) => {
4436
+ var l;
4437
+ this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (l = this.onImageUploadError) == null || l.call(this, n, t));
4424
4438
  });
4425
4439
  }
4426
4440
  replacePlaceholderWithImage(t, e, i) {
@@ -4436,8 +4450,8 @@ let Ei = (j = class {
4436
4450
  const t = this.phActive.getBoundingClientRect(), e = this.phCtx.offsetWidth, i = this.phCtx.offsetHeight;
4437
4451
  let s = t.left + scrollX + (t.width - e) / 2;
4438
4452
  s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
4439
- let l = t.bottom + scrollY + 8;
4440
- t.bottom + 8 + i > innerHeight - 4 && (l = Math.max(this.ctxMinTop(), t.top + scrollY - i - 8)), this.phCtx.style.left = s + "px", this.phCtx.style.top = l + "px";
4453
+ let n = t.bottom + scrollY + 8;
4454
+ t.bottom + 8 + i > innerHeight - 4 && (n = Math.max(this.ctxMinTop(), t.top + scrollY - i - 8)), this.phCtx.style.left = s + "px", this.phCtx.style.top = n + "px";
4441
4455
  }
4442
4456
  /* ---------------------------------------------------------- video upload placeholder */
4443
4457
  pickVideo() {
@@ -4483,25 +4497,25 @@ let Ei = (j = class {
4483
4497
  const i = document.createElement("button");
4484
4498
  i.type = "button", i.className = "txtbtn", i.textContent = this.t("insertvideo");
4485
4499
  const s = () => {
4486
- const l = e.value.trim(), n = this.vphActive;
4487
- if (!n) return;
4488
- if (!/^(https?:|data:video\/|blob:)/i.test(l)) {
4500
+ const n = e.value.trim(), l = this.vphActive;
4501
+ if (!l) return;
4502
+ if (!/^(https?:|data:video\/|blob:)/i.test(n)) {
4489
4503
  e.classList.add("err"), e.focus();
4490
4504
  return;
4491
4505
  }
4492
- const r = this.videoEmbedUrl(l);
4506
+ const r = this.videoEmbedUrl(n);
4493
4507
  if (r) {
4494
- this.replacePlaceholderWithEmbed(n, r);
4508
+ this.replacePlaceholderWithEmbed(l, r);
4495
4509
  return;
4496
4510
  }
4497
4511
  i.disabled = !0, e.disabled = !0;
4498
4512
  const o = document.createElement("video");
4499
- o.preload = "metadata", o.onloadedmetadata = () => this.replacePlaceholderWithVideo(n, l, ""), o.onerror = () => {
4513
+ o.preload = "metadata", o.onloadedmetadata = () => this.replacePlaceholderWithVideo(l, n, ""), o.onerror = () => {
4500
4514
  i.disabled = !1, e.disabled = !1, e.classList.add("err"), e.focus();
4501
- }, o.src = l;
4515
+ }, o.src = n;
4502
4516
  };
4503
- i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (l) => {
4504
- l.key === "Enter" ? (l.preventDefault(), s()) : l.key === "Escape" && (l.stopPropagation(), this.renderVphCtxButtons());
4517
+ i.addEventListener("click", s), e.addEventListener("input", () => e.classList.remove("err")), e.addEventListener("keydown", (n) => {
4518
+ n.key === "Enter" ? (n.preventDefault(), s()) : n.key === "Escape" && (n.stopPropagation(), this.renderVphCtxButtons());
4505
4519
  }), t.append(e, i), this.positionVphCtx(), e.focus();
4506
4520
  }
4507
4521
  readVideoFileInto(t, e) {
@@ -4521,11 +4535,11 @@ let Ei = (j = class {
4521
4535
  const i = t.name.replace(/"/g, "");
4522
4536
  e.classList.remove("upload-error"), e.classList.add("uploading");
4523
4537
  const s = e.querySelector("span");
4524
- s && (s.textContent = this.t("uploading")), this.videoUploadHandler(t).then((l) => {
4525
- this.ed.contains(e) && this.replacePlaceholderWithVideo(e, l, i);
4526
- }).catch((l) => {
4527
- var n;
4528
- this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (n = this.onVideoUploadError) == null || n.call(this, l, t));
4538
+ s && (s.textContent = this.t("uploading")), this.videoUploadHandler(t).then((n) => {
4539
+ this.ed.contains(e) && this.replacePlaceholderWithVideo(e, n, i);
4540
+ }).catch((n) => {
4541
+ var l;
4542
+ this.ed.contains(e) && (e.classList.remove("uploading"), e.classList.add("upload-error"), s && (s.textContent = this.t("uploadfailed")), (l = this.onVideoUploadError) == null || l.call(this, n, t));
4529
4543
  });
4530
4544
  }
4531
4545
  replacePlaceholderWithVideo(t, e, i) {
@@ -4546,8 +4560,8 @@ let Ei = (j = class {
4546
4560
  const t = this.vphActive.getBoundingClientRect(), e = this.vphCtx.offsetWidth, i = this.vphCtx.offsetHeight;
4547
4561
  let s = t.left + scrollX + (t.width - e) / 2;
4548
4562
  s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
4549
- let l = t.bottom + scrollY + 8;
4550
- t.bottom + 8 + i > innerHeight - 4 && (l = Math.max(this.ctxMinTop(), t.top + scrollY - i - 8)), this.vphCtx.style.left = s + "px", this.vphCtx.style.top = l + "px";
4563
+ let n = t.bottom + scrollY + 8;
4564
+ t.bottom + 8 + i > innerHeight - 4 && (n = Math.max(this.ctxMinTop(), t.top + scrollY - i - 8)), this.vphCtx.style.left = s + "px", this.vphCtx.style.top = n + "px";
4551
4565
  }
4552
4566
  /* ---------------------------------------------------------- video toolbar (post-insert) */
4553
4567
  cancelVidHide() {
@@ -4569,14 +4583,14 @@ let Ei = (j = class {
4569
4583
  (d = this.vidCtx) == null || d.replaceWith(c), this.vidCtx = c, this.positionVidCtx();
4570
4584
  }, s = (c) => {
4571
4585
  this.setVideoAlign(t, c), i();
4572
- }, l = t.style.float === "left", n = t.style.float === "right", r = !l && !n && t.style.marginLeft === "auto" && t.style.marginRight === "auto", o = (c, d, p, m) => {
4586
+ }, n = t.style.float === "left", l = t.style.float === "right", r = !n && !l && t.style.marginLeft === "auto" && t.style.marginRight === "auto", o = (c, d, u, m) => {
4573
4587
  const b = this.ctxBtn(c, d, m);
4574
- return b.classList.toggle("on", p), b;
4588
+ return b.classList.toggle("on", u), b;
4575
4589
  };
4576
4590
  return e.append(
4577
- o(h.alignleft, this.t("alignleft"), l, () => s("left")),
4591
+ o(h.alignleft, this.t("alignleft"), n, () => s("left")),
4578
4592
  o(h.aligncenter, this.t("aligncenter"), r, () => s("center")),
4579
- o(h.alignright, this.t("alignright"), n, () => s("right")),
4593
+ o(h.alignright, this.t("alignright"), l, () => s("right")),
4580
4594
  this.ctxSep(),
4581
4595
  o(h.trash, this.t("deletevideo"), !1, () => {
4582
4596
  t.remove(), this.clearVidHandles(), this.onChange();
@@ -4598,8 +4612,8 @@ let Ei = (j = class {
4598
4612
  const e = this.vidCtx.offsetWidth, i = this.vidCtx.offsetHeight;
4599
4613
  let s = t.left + scrollX + (t.width - e) / 2;
4600
4614
  s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
4601
- let l = t.top + scrollY - i - 8;
4602
- l < this.ctxMinTop() && (l = t.bottom + scrollY + 8), this.vidCtx.style.left = s + "px", this.vidCtx.style.top = l + "px";
4615
+ let n = t.top + scrollY - i - 8;
4616
+ n < this.ctxMinTop() && (n = t.bottom + scrollY + 8), this.vidCtx.style.left = s + "px", this.vidCtx.style.top = n + "px";
4603
4617
  }
4604
4618
  /* ---------------------------------------------------------- video dialog / embeds */
4605
4619
  /** Maps a page URL from a known video host to its iframe player URL. Returns
@@ -4618,12 +4632,12 @@ let Ei = (j = class {
4618
4632
  * (videoUploadHandler when configured, else inline base64). */
4619
4633
  videoDlg() {
4620
4634
  this.saveSel();
4621
- let t, e, i, s, l, n;
4635
+ let t, e, i, s, n, l;
4622
4636
  const r = (c, d) => {
4623
- const p = document.createElement("div");
4624
- p.className = "dfield";
4637
+ const u = document.createElement("div");
4638
+ u.className = "dfield";
4625
4639
  const m = document.createElement("label");
4626
- return m.textContent = this.t(c), p.append(m, d), p;
4640
+ return m.textContent = this.t(c), u.append(m, d), u;
4627
4641
  }, o = () => {
4628
4642
  const c = document.createElement("input");
4629
4643
  return c.type = "url", c;
@@ -4633,15 +4647,15 @@ let Ei = (j = class {
4633
4647
  (c) => {
4634
4648
  const d = document.createElement("div");
4635
4649
  d.className = "dtabs";
4636
- const p = [], m = (g, x) => {
4650
+ const u = [], m = (g, x) => {
4637
4651
  const w = document.createElement("button");
4638
4652
  w.type = "button", w.textContent = this.t(g);
4639
4653
  const E = document.createElement("div");
4640
4654
  E.className = "dtabpanel", x(E);
4641
- const A = p.length;
4642
- p.push(E), w.addEventListener("click", () => b(A)), d.appendChild(w);
4655
+ const A = u.length;
4656
+ u.push(E), w.addEventListener("click", () => b(A)), d.appendChild(w);
4643
4657
  }, b = (g) => {
4644
- d.querySelectorAll("button").forEach((x, w) => x.classList.toggle("on", w === g)), p.forEach((x, w) => x.style.display = w === g ? "" : "none");
4658
+ d.querySelectorAll("button").forEach((x, w) => x.classList.toggle("on", w === g)), u.forEach((x, w) => x.style.display = w === g ? "" : "none");
4645
4659
  };
4646
4660
  m("vidgeneral", (g) => {
4647
4661
  t = o(), t.placeholder = this.t("videourlph");
@@ -4676,10 +4690,10 @@ let Ei = (j = class {
4676
4690
  const x = document.createElement("p");
4677
4691
  x.textContent = this.t("vidembedhint"), x.style.cssText = "margin:0 0 8px;color:#556;font-size:13.5px", s = document.createElement("textarea"), s.style.cssText = "width:100%;box-sizing:border-box;height:160px", g.append(x, s);
4678
4692
  }), m("vidadvanced", (g) => {
4679
- l = o(), n = o(), g.append(r("vidaltsource", l), r("vidposter", n));
4693
+ n = o(), l = o(), g.append(r("vidaltsource", n), r("vidposter", l));
4680
4694
  });
4681
4695
  const y = document.createElement("div");
4682
- y.className = "dtabbody", p.forEach((g) => y.appendChild(g)), c.append(d, y), b(0), setTimeout(() => t.focus(), 0);
4696
+ y.className = "dtabbody", u.forEach((g) => y.appendChild(g)), c.append(d, y), b(0), setTimeout(() => t.focus(), 0);
4683
4697
  },
4684
4698
  [
4685
4699
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4687,7 +4701,7 @@ let Ei = (j = class {
4687
4701
  label: this.t("save"),
4688
4702
  primary: !0,
4689
4703
  action: () => {
4690
- const c = s.value.trim(), d = t.value.trim(), p = parseInt(e.value, 10) || 560, m = parseInt(i.value, 10) || 314;
4704
+ const c = s.value.trim(), d = t.value.trim(), u = parseInt(e.value, 10) || 560, m = parseInt(i.value, 10) || 314;
4691
4705
  if (this.closeDlg(), !c && !d) return;
4692
4706
  if (this.restoreSel(), c) {
4693
4707
  document.execCommand("insertHTML", !1, `<span class="video-embed" contenteditable="false">${c}</span>`), this.onChange();
@@ -4695,13 +4709,13 @@ let Ei = (j = class {
4695
4709
  }
4696
4710
  const b = this.videoEmbedUrl(d);
4697
4711
  if (b)
4698
- document.execCommand("insertHTML", !1, this.videoEmbedHTML(b, p, m));
4712
+ document.execCommand("insertHTML", !1, this.videoEmbedHTML(b, u, m));
4699
4713
  else {
4700
- const y = l.value.trim(), g = n.value.trim();
4714
+ const y = n.value.trim(), g = l.value.trim();
4701
4715
  document.execCommand(
4702
4716
  "insertHTML",
4703
4717
  !1,
4704
- `<video controls width="${p}" height="${m}"${g ? ` poster="${this.escapeAttr(g)}"` : ""}><source src="${this.escapeAttr(d)}">${y ? `<source src="${this.escapeAttr(y)}">` : ""}</video>`
4718
+ `<video controls width="${u}" height="${m}"${g ? ` poster="${this.escapeAttr(g)}"` : ""}><source src="${this.escapeAttr(d)}">${y ? `<source src="${this.escapeAttr(y)}">` : ""}</video>`
4705
4719
  );
4706
4720
  }
4707
4721
  this.onChange();
@@ -4736,16 +4750,16 @@ let Ei = (j = class {
4736
4750
  const i = e.firstChild, s = e.lastChild;
4737
4751
  for (; e.firstChild; ) e.parentNode.insertBefore(e.firstChild, e);
4738
4752
  if (e.remove(), i && s) {
4739
- const l = document.createRange();
4740
- l.setStartBefore(i), l.setEndAfter(s), t.removeAllRanges(), t.addRange(l);
4753
+ const n = document.createRange();
4754
+ n.setStartBefore(i), n.setEndAfter(s), t.removeAllRanges(), t.addRange(n);
4741
4755
  }
4742
4756
  } else {
4743
4757
  const i = t.getRangeAt(0);
4744
4758
  if (i.collapsed || this.closestBlock(i.startContainer) !== this.closestBlock(i.endContainer)) return;
4745
4759
  const s = document.createElement("code");
4746
4760
  s.appendChild(i.extractContents()), i.insertNode(s);
4747
- const l = document.createRange();
4748
- l.selectNodeContents(s), t.removeAllRanges(), t.addRange(l);
4761
+ const n = document.createRange();
4762
+ n.selectNodeContents(s), t.removeAllRanges(), t.addRange(n);
4749
4763
  }
4750
4764
  this.saveSel(), this.refreshState(), this.onChange();
4751
4765
  }
@@ -4757,15 +4771,15 @@ let Ei = (j = class {
4757
4771
  if (!e || !e.isCollapsed || !e.anchorNode) return;
4758
4772
  const i = e.anchorNode;
4759
4773
  if (i.nodeType !== Node.TEXT_NODE || !this.ed.contains(i) || (d = i.parentElement) != null && d.closest("code, pre")) return;
4760
- const l = (i.textContent || "").slice(0, e.anchorOffset).match(/(?:^|[^`])`([^`]+)$/);
4761
- if (!l) return;
4762
- const n = l[1];
4763
- if (/^\s|\s$/.test(n)) return;
4774
+ const n = (i.textContent || "").slice(0, e.anchorOffset).match(/(?:^|[^`])`([^`]+)$/);
4775
+ if (!n) return;
4776
+ const l = n[1];
4777
+ if (/^\s|\s$/.test(l)) return;
4764
4778
  t.preventDefault();
4765
4779
  const r = document.createRange();
4766
- r.setStart(i, e.anchorOffset - n.length - 1), r.setEnd(i, e.anchorOffset), r.deleteContents();
4780
+ r.setStart(i, e.anchorOffset - l.length - 1), r.setEnd(i, e.anchorOffset), r.deleteContents();
4767
4781
  const o = document.createElement("code");
4768
- o.textContent = n, r.insertNode(o);
4782
+ o.textContent = l, r.insertNode(o);
4769
4783
  const c = document.createRange();
4770
4784
  c.setStartAfter(o), c.collapse(!0), e.removeAllRanges(), e.addRange(c), this.saveSel(), this.onChange();
4771
4785
  }
@@ -4777,24 +4791,24 @@ let Ei = (j = class {
4777
4791
  let i = e;
4778
4792
  const s = document.createElement("div");
4779
4793
  s.className = "dsel";
4780
- const l = document.createElement("button");
4781
- l.type = "button", l.className = "dsel-btn";
4782
- const n = document.createElement("span");
4783
- n.className = "lbl", n.textContent = ((o = t.find(([c]) => c === e)) == null ? void 0 : o[1]) || "", l.append(n), l.insertAdjacentHTML("beforeend", h.chev);
4794
+ const n = document.createElement("button");
4795
+ n.type = "button", n.className = "dsel-btn";
4796
+ const l = document.createElement("span");
4797
+ l.className = "lbl", l.textContent = ((o = t.find(([c]) => c === e)) == null ? void 0 : o[1]) || "", n.append(l), n.insertAdjacentHTML("beforeend", h.chev);
4784
4798
  const r = document.createElement("div");
4785
4799
  return r.className = "dsel-list", t.forEach(([c, d]) => {
4786
- const p = document.createElement("button");
4787
- p.type = "button", p.textContent = d, p.classList.toggle("on", c === i), p.addEventListener("click", () => {
4788
- i = c, n.textContent = d, r.querySelectorAll("button").forEach((m) => m.classList.toggle("on", m === p)), s.classList.remove("open"), l.focus();
4789
- }), r.appendChild(p);
4790
- }), l.addEventListener("click", () => {
4800
+ const u = document.createElement("button");
4801
+ u.type = "button", u.textContent = d, u.classList.toggle("on", c === i), u.addEventListener("click", () => {
4802
+ i = c, l.textContent = d, r.querySelectorAll("button").forEach((m) => m.classList.toggle("on", m === u)), s.classList.remove("open"), n.focus();
4803
+ }), r.appendChild(u);
4804
+ }), n.addEventListener("click", () => {
4791
4805
  var c;
4792
4806
  s.classList.toggle("open"), s.classList.contains("open") && ((c = r.querySelector(".on")) == null || c.scrollIntoView({ block: "nearest" }));
4793
4807
  }), s.addEventListener("focusout", (c) => {
4794
4808
  s.contains(c.relatedTarget) || s.classList.remove("open");
4795
4809
  }), s.addEventListener("keydown", (c) => {
4796
- c.key === "Escape" && s.classList.contains("open") && (c.stopPropagation(), s.classList.remove("open"), l.focus());
4797
- }), s.append(l, r), { el: s, value: () => i };
4810
+ c.key === "Escape" && s.classList.contains("open") && (c.stopPropagation(), s.classList.remove("open"), n.focus());
4811
+ }), s.append(n, r), { el: s, value: () => i };
4798
4812
  }
4799
4813
  /** Insert/edit-code-sample dialog: language dropdown + monospace textarea to
4800
4814
  * paste or type code into. Inserts a non-editable <pre class="code-block">
@@ -4806,10 +4820,10 @@ let Ei = (j = class {
4806
4820
  this.t("codedlgttl"),
4807
4821
  (s) => {
4808
4822
  var r;
4809
- const l = document.createElement("div");
4810
- l.className = "dfield";
4811
- const n = document.createElement("label");
4812
- n.textContent = this.t("codelang"), e = this.dlgSelect(ie, (t == null ? void 0 : t.dataset.lang) || "plain"), l.append(n, e.el), i = document.createElement("textarea"), i.className = "code-input", i.spellcheck = !1, i.value = ((r = t == null ? void 0 : t.querySelector("code")) == null ? void 0 : r.textContent) || "", i.placeholder = "const answer = 42;", s.append(l, i), setTimeout(() => i.focus(), 0);
4823
+ const n = document.createElement("div");
4824
+ n.className = "dfield";
4825
+ const l = document.createElement("label");
4826
+ l.textContent = this.t("codelang"), e = this.dlgSelect(ie, (t == null ? void 0 : t.dataset.lang) || "plain"), n.append(l, e.el), i = document.createElement("textarea"), i.className = "code-input", i.spellcheck = !1, i.value = ((r = t == null ? void 0 : t.querySelector("code")) == null ? void 0 : r.textContent) || "", i.placeholder = "const answer = 42;", s.append(n, i), setTimeout(() => i.focus(), 0);
4813
4827
  },
4814
4828
  [
4815
4829
  { label: this.t("cancel"), action: () => this.closeDlg() },
@@ -4818,10 +4832,10 @@ let Ei = (j = class {
4818
4832
  primary: !0,
4819
4833
  action: () => {
4820
4834
  var r;
4821
- const s = i.value.replace(/\s+$/, ""), l = e.value(), n = ((r = ie.find(([o]) => o === l)) == null ? void 0 : r[1]) || l;
4835
+ const s = i.value.replace(/\s+$/, ""), n = e.value(), l = ((r = ie.find(([o]) => o === n)) == null ? void 0 : r[1]) || n;
4822
4836
  if (this.closeDlg(), !!s.trim()) {
4823
4837
  if (t) {
4824
- t.dataset.lang = l, t.setAttribute("data-lang-label", n);
4838
+ t.dataset.lang = n, t.setAttribute("data-lang-label", l);
4825
4839
  const o = t.querySelector("code") || t;
4826
4840
  o.textContent = s, this.clearCodeSel(), this.onChange();
4827
4841
  return;
@@ -4829,7 +4843,7 @@ let Ei = (j = class {
4829
4843
  this.restoreSel(), document.execCommand(
4830
4844
  "insertHTML",
4831
4845
  !1,
4832
- `<pre class="code-block" contenteditable="false" data-lang="${l}" data-lang-label="${this.escapeAttr(n)}"><code>${this.escHtml(s)}</code></pre><p><br></p>`
4846
+ `<pre class="code-block" contenteditable="false" data-lang="${n}" data-lang-label="${this.escapeAttr(l)}"><code>${this.escHtml(s)}</code></pre><p><br></p>`
4833
4847
  ), this.onChange();
4834
4848
  }
4835
4849
  }
@@ -4856,9 +4870,9 @@ let Ei = (j = class {
4856
4870
  ), e.addEventListener("mousedown", (i) => i.preventDefault()), document.body.appendChild(e), e;
4857
4871
  }
4858
4872
  copyCodeBlock(t) {
4859
- var s, l;
4873
+ var s, n;
4860
4874
  const e = ((s = t.querySelector("code")) == null ? void 0 : s.textContent) ?? t.textContent ?? "";
4861
- if ((l = navigator.clipboard) != null && l.writeText) {
4875
+ if ((n = navigator.clipboard) != null && n.writeText) {
4862
4876
  navigator.clipboard.writeText(e).catch(() => {
4863
4877
  });
4864
4878
  return;
@@ -4876,8 +4890,8 @@ let Ei = (j = class {
4876
4890
  const e = this.codeCtx.offsetWidth, i = this.codeCtx.offsetHeight;
4877
4891
  let s = t.left + scrollX + (t.width - e) / 2;
4878
4892
  s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
4879
- let l = t.top + scrollY - i - 8;
4880
- l < this.ctxMinTop() && (l = t.bottom + scrollY + 8), this.codeCtx.style.left = s + "px", this.codeCtx.style.top = l + "px";
4893
+ let n = t.top + scrollY - i - 8;
4894
+ n < this.ctxMinTop() && (n = t.bottom + scrollY + 8), this.codeCtx.style.left = s + "px", this.codeCtx.style.top = n + "px";
4881
4895
  }
4882
4896
  /* ---------------------------------------------------------- templates */
4883
4897
  templateMenu(t) {
@@ -4886,16 +4900,16 @@ let Ei = (j = class {
4886
4900
  /** Miniature div-based mockup of a layout, mirroring what the block looks
4887
4901
  like in the editor: grey box = image slot, bars = heading/paragraph. */
4888
4902
  tplPreviewHTML(t) {
4889
- const e = '<span class="pv-img"></span>', i = '<span class="pv-h"></span>', s = (o) => `<span class="pv-l" style="width:${o}%"></span>`, l = (o) => `<span class="pv-col">${o}</span>`, n = (o) => `<span class="pv-row">${o}</span>`, r = l(i + s(100) + s(88));
4890
- return t === "img-left" ? `<span class="pv">${n(e + r)}${s(100)}${s(72)}</span>` : t === "img-right" ? `<span class="pv">${n(r + e)}${s(100)}${s(72)}</span>` : t === "img-top" ? `<span class="pv pv-c">${e}${i}${s(100)}${s(72)}</span>` : `<span class="pv pv-c">${i}${s(100)}${s(72)}${e}</span>`;
4903
+ const e = '<span class="pv-img"></span>', i = '<span class="pv-h"></span>', s = (o) => `<span class="pv-l" style="width:${o}%"></span>`, n = (o) => `<span class="pv-col">${o}</span>`, l = (o) => `<span class="pv-row">${o}</span>`, r = n(i + s(100) + s(88));
4904
+ return t === "img-left" ? `<span class="pv">${l(e + r)}${s(100)}${s(72)}</span>` : t === "img-right" ? `<span class="pv">${l(r + e)}${s(100)}${s(72)}</span>` : t === "img-top" ? `<span class="pv pv-c">${e}${i}${s(100)}${s(72)}</span>` : `<span class="pv pv-c">${i}${s(100)}${s(72)}${e}</span>`;
4891
4905
  }
4892
4906
  buildTemplatePickInto(t, e) {
4893
4907
  const i = document.createElement("div");
4894
4908
  i.className = "tplpick", wt.forEach((s) => {
4895
- const l = document.createElement("button");
4896
- l.type = "button", l.className = "tpltile", l.title = this.t(Tt[s]), l.innerHTML = this.tplPreviewHTML(s) + `<span class="tpllbl">${this.t(Tt[s])}</span>`, l.addEventListener("click", () => {
4909
+ const n = document.createElement("button");
4910
+ n.type = "button", n.className = "tpltile", n.title = this.t(Tt[s]), n.innerHTML = this.tplPreviewHTML(s) + `<span class="tpllbl">${this.t(Tt[s])}</span>`, n.addEventListener("click", () => {
4897
4911
  this.closePop(), this.insertTemplate(s), e == null || e();
4898
- }), i.appendChild(l);
4912
+ }), i.appendChild(n);
4899
4913
  }), t.appendChild(i);
4900
4914
  }
4901
4915
  insertTemplate(t) {
@@ -4920,7 +4934,7 @@ let Ei = (j = class {
4920
4934
  setTplLayout(t) {
4921
4935
  const e = this.tplActive;
4922
4936
  if (!e) return;
4923
- wt.forEach((l) => e.classList.remove("tpl-" + l)), e.classList.add("tpl-" + t);
4937
+ wt.forEach((n) => e.classList.remove("tpl-" + n)), e.classList.add("tpl-" + t);
4924
4938
  const i = e.querySelector(":scope > .tpl-media"), s = e.querySelector(":scope > .tpl-text");
4925
4939
  i && s && (t === "img-center" ? e.appendChild(i) : e.insertBefore(i, s)), this.renderTplCtxButtons(), this.positionImgPhCtx(), this.positionImageHandles(), this.onChange();
4926
4940
  }
@@ -4937,8 +4951,8 @@ let Ei = (j = class {
4937
4951
  const t = this.tplActive.getBoundingClientRect(), e = this.tplCtx.offsetWidth, i = this.tplCtx.offsetHeight;
4938
4952
  let s = t.left + scrollX + (t.width - e) / 2;
4939
4953
  s = Math.max(8 + scrollX, Math.min(s, scrollX + innerWidth - e - 8));
4940
- let l = t.top + scrollY - i - 8;
4941
- l < this.ctxMinTop() && (l = t.bottom + scrollY + 8), this.tplCtx.style.left = s + "px", this.tplCtx.style.top = l + "px";
4954
+ let n = t.top + scrollY - i - 8;
4955
+ n < this.ctxMinTop() && (n = t.bottom + scrollY + 8), this.tplCtx.style.left = s + "px", this.tplCtx.style.top = n + "px";
4942
4956
  }
4943
4957
  pickWordDoc() {
4944
4958
  this.docInput.value = "", this.docInput.click();
@@ -4951,8 +4965,8 @@ let Ei = (j = class {
4951
4965
  }
4952
4966
  /* ---------------------------------------------------------- table resize */
4953
4967
  clearTableHandles() {
4954
- var t, e, i, s, l;
4955
- (t = this.tblCorner) == null || t.remove(), this.tblCorner = null, this.tblColBars.forEach((n) => n.remove()), this.tblColBars = [], (e = this.tblCtx) == null || e.remove(), this.tblCtx = null, (i = this.tblCellMark) == null || i.remove(), this.tblCellMark = null, (s = this.tblOpMark) == null || s.remove(), this.tblOpMark = null, this.tblOpMarkKind = null, (l = this.tblActive) == null || l.classList.remove("tbl-selected"), this.tblActive = null;
4968
+ var t, e, i, s, n;
4969
+ (t = this.tblCorner) == null || t.remove(), this.tblCorner = null, this.tblColBars.forEach((l) => l.remove()), this.tblColBars = [], (e = this.tblCtx) == null || e.remove(), this.tblCtx = null, (i = this.tblCellMark) == null || i.remove(), this.tblCellMark = null, (s = this.tblOpMark) == null || s.remove(), this.tblOpMark = null, this.tblOpMarkKind = null, (n = this.tblActive) == null || n.classList.remove("tbl-selected"), this.tblActive = null;
4956
4970
  }
4957
4971
  /** Blue outline around the cell that holds the caret, so it is clear
4958
4972
  which cell / row / column the table operations will target. */
@@ -4979,8 +4993,8 @@ let Ei = (j = class {
4979
4993
  return;
4980
4994
  }
4981
4995
  this.tblOpMark || (this.tblOpMark = document.createElement("div"), this.tblOpMark.className = "tbl-opmark", document.body.appendChild(this.tblOpMark));
4982
- const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), l = e.parentElement.getBoundingClientRect(), n = t === "row" ? l.left : s.left, r = t === "row" ? l.top : i.top, o = t === "row" ? l.width : s.width, c = t === "row" ? l.height : i.height;
4983
- this.tblOpMark.style.left = n + scrollX + "px", this.tblOpMark.style.top = r + scrollY + "px", this.tblOpMark.style.width = o + "px", this.tblOpMark.style.height = c + "px";
4996
+ const i = this.tblActive.getBoundingClientRect(), s = e.getBoundingClientRect(), n = e.parentElement.getBoundingClientRect(), l = t === "row" ? n.left : s.left, r = t === "row" ? n.top : i.top, o = t === "row" ? n.width : s.width, c = t === "row" ? n.height : i.height;
4997
+ this.tblOpMark.style.left = l + scrollX + "px", this.tblOpMark.style.top = r + scrollY + "px", this.tblOpMark.style.width = o + "px", this.tblOpMark.style.height = c + "px";
4984
4998
  }
4985
4999
  /** Lowest allowed top for floating context toolbars — keeps them from
4986
5000
  covering the editor menubar/toolbar when the target sits on the first line. */
@@ -4988,8 +5002,8 @@ let Ei = (j = class {
4988
5002
  return Math.max(scrollY + 4, this.ed.getBoundingClientRect().top + scrollY - 2);
4989
5003
  }
4990
5004
  ctxBtn(t, e, i, s) {
4991
- const l = document.createElement("button");
4992
- return l.type = "button", l.title = e, l.innerHTML = t, s && (l.dataset.id = s), l.addEventListener("mousedown", (n) => n.preventDefault()), l.addEventListener("click", i), l;
5005
+ const n = document.createElement("button");
5006
+ return n.type = "button", n.title = e, n.innerHTML = t, s && (n.dataset.id = s), n.addEventListener("mousedown", (l) => l.preventDefault()), n.addEventListener("click", i), n;
4993
5007
  }
4994
5008
  ctxSep() {
4995
5009
  const t = document.createElement("div");
@@ -4998,7 +5012,7 @@ let Ei = (j = class {
4998
5012
  buildTableCtxToolbar() {
4999
5013
  const t = document.createElement("div");
5000
5014
  t.className = "tblctx", t.dir = this.dir();
5001
- const e = (s, l) => (s.addEventListener("mouseenter", () => this.setOpTarget(l)), s.addEventListener("mouseleave", () => this.setOpTarget(null)), s), i = this.ctxBtn(h.palette, this.t("cellbg"), () => this.cellFillMenu(i));
5015
+ const e = (s, n) => (s.addEventListener("mouseenter", () => this.setOpTarget(n)), s.addEventListener("mouseleave", () => this.setOpTarget(null)), s), i = this.ctxBtn(h.palette, this.t("cellbg"), () => this.cellFillMenu(i));
5002
5016
  return t.append(
5003
5017
  e(this.ctxBtn(h.rowbefore, this.t("rowabove"), () => this.tableOp("rowabove")), "row"),
5004
5018
  e(this.ctxBtn(h.rowafter, this.t("rowbelow"), () => this.tableOp("rowbelow")), "row"),
@@ -5026,20 +5040,20 @@ let Ei = (j = class {
5026
5040
  this.clearTableHandles();
5027
5041
  return;
5028
5042
  }
5029
- const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, n = e.bottom + scrollY;
5030
- if (this.tblCorner && (this.tblCorner.style.top = n - 5 + "px", this.tblCorner.style.left = (t ? s - 5 : l - 5) + "px", this.tblCorner.style.cursor = t ? "nesw-resize" : "nwse-resize"), this.tblCtx) {
5043
+ const t = this.ed.getAttribute("dir") === "rtl", e = this.tblActive.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, n = e.right + scrollX, l = e.bottom + scrollY;
5044
+ if (this.tblCorner && (this.tblCorner.style.top = l - 5 + "px", this.tblCorner.style.left = (t ? s - 5 : n - 5) + "px", this.tblCorner.style.cursor = t ? "nesw-resize" : "nwse-resize"), this.tblCtx) {
5031
5045
  const o = this.tblCtx.offsetWidth, c = this.tblCtx.offsetHeight;
5032
- let d = s + (l - s) / 2 - o / 2;
5046
+ let d = s + (n - s) / 2 - o / 2;
5033
5047
  d = Math.max(8 + scrollX, Math.min(d, scrollX + innerWidth - o - 8));
5034
- let p = i - c - 8;
5035
- p < this.ctxMinTop() && (p = n + 8), this.tblCtx.style.left = d + "px", this.tblCtx.style.top = p + "px";
5048
+ let u = i - c - 8;
5049
+ u < this.ctxMinTop() && (u = l + 8), this.tblCtx.style.left = d + "px", this.tblCtx.style.top = u + "px";
5036
5050
  }
5037
5051
  this.tblColBars.forEach((o) => o.remove()), this.tblColBars = [];
5038
5052
  const r = this.tblActive.rows[0];
5039
5053
  if (r)
5040
5054
  for (let o = 0; o < r.cells.length - 1; o++) {
5041
- const c = r.cells[o].getBoundingClientRect(), d = (t ? c.left : c.right) + scrollX, p = document.createElement("div");
5042
- p.className = "tbl-colbar", p.style.top = i + "px", p.style.left = d + "px", p.style.height = n - i + "px", document.body.appendChild(p), p.addEventListener("mousedown", (m) => this.startColBarDrag(m, o)), this.tblColBars.push(p);
5055
+ const c = r.cells[o].getBoundingClientRect(), d = (t ? c.left : c.right) + scrollX, u = document.createElement("div");
5056
+ u.className = "tbl-colbar", u.style.top = i + "px", u.style.left = d + "px", u.style.height = l - i + "px", document.body.appendChild(u), u.addEventListener("mousedown", (m) => this.startColBarDrag(m, o)), this.tblColBars.push(u);
5043
5057
  }
5044
5058
  this.positionCellMarker(), this.positionOpMark();
5045
5059
  }
@@ -5056,13 +5070,13 @@ let Ei = (j = class {
5056
5070
  t.preventDefault();
5057
5071
  const e = this.tblActive;
5058
5072
  if (!e) return;
5059
- const i = this.ed.getAttribute("dir") === "rtl", s = t.clientX, l = e.getBoundingClientRect().width;
5060
- e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((n) => {
5073
+ const i = this.ed.getAttribute("dir") === "rtl", s = t.clientX, n = e.getBoundingClientRect().width;
5074
+ e.style.tableLayout = e.style.tableLayout || "fixed", this.withNoTextSelect((l) => {
5061
5075
  const r = (c) => {
5062
5076
  const d = i ? -(c.clientX - s) : c.clientX - s;
5063
- e.style.width = Math.max(60, Math.round(l + d)) + "px", this.positionTableHandles();
5077
+ e.style.width = Math.max(60, Math.round(n + d)) + "px", this.positionTableHandles();
5064
5078
  }, o = () => {
5065
- window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", o), n(), this.onChange();
5079
+ window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", o), l(), this.onChange();
5066
5080
  };
5067
5081
  window.addEventListener("mousemove", r), window.addEventListener("mouseup", o);
5068
5082
  });
@@ -5071,15 +5085,15 @@ let Ei = (j = class {
5071
5085
  t.preventDefault(), t.stopPropagation();
5072
5086
  const i = this.tblActive;
5073
5087
  if (!i) return;
5074
- const s = this.ed.getAttribute("dir") === "rtl", l = Array.from(i.rows), n = l.map((p) => p.cells[e]).filter(Boolean), r = l.map((p) => p.cells[e + 1]).filter(Boolean);
5075
- if (!n.length || !r.length) return;
5076
- const o = t.clientX, c = n[0].getBoundingClientRect().width, d = r[0].getBoundingClientRect().width;
5077
- i.style.tableLayout = "fixed", this.withNoTextSelect((p) => {
5088
+ const s = this.ed.getAttribute("dir") === "rtl", n = Array.from(i.rows), l = n.map((u) => u.cells[e]).filter(Boolean), r = n.map((u) => u.cells[e + 1]).filter(Boolean);
5089
+ if (!l.length || !r.length) return;
5090
+ const o = t.clientX, c = l[0].getBoundingClientRect().width, d = r[0].getBoundingClientRect().width;
5091
+ i.style.tableLayout = "fixed", this.withNoTextSelect((u) => {
5078
5092
  const m = (y) => {
5079
5093
  const g = (s ? -1 : 1) * (y.clientX - o);
5080
- n.forEach((x) => x.style.width = Math.max(24, Math.round(c + g)) + "px"), r.forEach((x) => x.style.width = Math.max(24, Math.round(d - g)) + "px"), this.positionTableHandles();
5094
+ l.forEach((x) => x.style.width = Math.max(24, Math.round(c + g)) + "px"), r.forEach((x) => x.style.width = Math.max(24, Math.round(d - g)) + "px"), this.positionTableHandles();
5081
5095
  }, b = () => {
5082
- window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", b), p(), this.onChange();
5096
+ window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", b), u(), this.onChange();
5083
5097
  };
5084
5098
  window.addEventListener("mousemove", m), window.addEventListener("mouseup", b);
5085
5099
  });
@@ -5110,14 +5124,14 @@ let Ei = (j = class {
5110
5124
  (d = this.imgCtx) == null || d.replaceWith(c), this.imgCtx = c, this.positionImageHandles();
5111
5125
  }, s = (c) => {
5112
5126
  this.setImageAlign(t, c), i();
5113
- }, l = t.style.float === "left", n = t.style.float === "right", r = !l && !n && t.style.marginLeft === "auto" && t.style.marginRight === "auto", o = (c, d, p, m) => {
5127
+ }, n = t.style.float === "left", l = t.style.float === "right", r = !n && !l && t.style.marginLeft === "auto" && t.style.marginRight === "auto", o = (c, d, u, m) => {
5114
5128
  const b = this.ctxBtn(c, d, m);
5115
- return b.classList.toggle("on", p), b;
5129
+ return b.classList.toggle("on", u), b;
5116
5130
  };
5117
5131
  return e.append(
5118
- o(h.alignleft, this.t("alignleft"), l, () => s("left")),
5132
+ o(h.alignleft, this.t("alignleft"), n, () => s("left")),
5119
5133
  o(h.aligncenter, this.t("aligncenter"), r, () => s("center")),
5120
- o(h.alignright, this.t("alignright"), n, () => s("right")),
5134
+ o(h.alignright, this.t("alignright"), l, () => s("right")),
5121
5135
  this.ctxSep(),
5122
5136
  o(h.rotateleft, this.t("rotateleft"), !1, () => {
5123
5137
  this.rotateImage(t, -90), i();
@@ -5159,21 +5173,21 @@ let Ei = (j = class {
5159
5173
  this.clearImageHandles();
5160
5174
  return;
5161
5175
  }
5162
- const t = this.imgActive.getBoundingClientRect(), e = t.top + scrollY, i = t.left + scrollX, s = t.right + scrollX, l = t.bottom + scrollY, n = {
5176
+ const t = this.imgActive.getBoundingClientRect(), e = t.top + scrollY, i = t.left + scrollX, s = t.right + scrollX, n = t.bottom + scrollY, l = {
5163
5177
  nw: [i, e],
5164
5178
  ne: [s, e],
5165
- sw: [i, l],
5166
- se: [s, l]
5179
+ sw: [i, n],
5180
+ se: [s, n]
5167
5181
  };
5168
5182
  if (this.imgHandles.forEach((r) => {
5169
- const [o, c] = n[r.dataset.corner];
5183
+ const [o, c] = l[r.dataset.corner];
5170
5184
  r.style.left = o - 5 + "px", r.style.top = c - 5 + "px";
5171
5185
  }), this.imgCtx) {
5172
5186
  const r = this.imgCtx.offsetWidth, o = this.imgCtx.offsetHeight;
5173
5187
  let c = i + (s - i) / 2 - r / 2;
5174
5188
  c = Math.max(8 + scrollX, Math.min(c, scrollX + innerWidth - r - 8));
5175
5189
  let d = e - o - 8;
5176
- d < this.ctxMinTop() && (d = l + 8), this.imgCtx.style.left = c + "px", this.imgCtx.style.top = d + "px";
5190
+ d < this.ctxMinTop() && (d = n + 8), this.imgCtx.style.left = c + "px", this.imgCtx.style.top = d + "px";
5177
5191
  }
5178
5192
  }
5179
5193
  startImageResizeDrag(t, e) {
@@ -5181,10 +5195,10 @@ let Ei = (j = class {
5181
5195
  const i = this.imgActive;
5182
5196
  if (!i) return;
5183
5197
  this.cancelImgHide();
5184
- const s = t.clientX, l = i.getBoundingClientRect().width, n = e === "nw" || e === "sw" ? -1 : 1;
5198
+ const s = t.clientX, n = i.getBoundingClientRect().width, l = e === "nw" || e === "sw" ? -1 : 1;
5185
5199
  this.withNoTextSelect((r) => {
5186
5200
  const o = (d) => {
5187
- i.style.width = Math.max(24, Math.round(l + n * (d.clientX - s))) + "px", i.style.height = "auto", this.positionImageHandles();
5201
+ i.style.width = Math.max(24, Math.round(n + l * (d.clientX - s))) + "px", i.style.height = "auto", this.positionImageHandles();
5188
5202
  }, c = () => {
5189
5203
  window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", c), r(), this.onChange();
5190
5204
  };
@@ -5193,7 +5207,22 @@ let Ei = (j = class {
5193
5207
  }
5194
5208
  /* ---------------------------------------------------------- selection bubble toolbar */
5195
5209
  toggleBlock(t) {
5196
- this.exec("formatBlock", this.currentBlock() === t ? "<p>" : "<" + t + ">");
5210
+ const e = this.currentBlock() === t;
5211
+ this.exec("formatBlock", e ? "<p>" : "<" + t + ">"), t === "blockquote" && e && this.unwrapBlockquote();
5212
+ }
5213
+ /** Some browsers leave the <blockquote> wrapper in place after formatBlock('<p>'); strip it manually if so. */
5214
+ unwrapBlockquote() {
5215
+ const t = window.getSelection();
5216
+ let e = t && this.ed.contains(t.anchorNode) ? t.anchorNode : null;
5217
+ for (; e && e !== this.ed; ) {
5218
+ if (e.nodeType === 1 && e.tagName === "BLOCKQUOTE") {
5219
+ const i = e, s = i.parentNode;
5220
+ for (; i.firstChild; ) s.insertBefore(i.firstChild, i);
5221
+ s.removeChild(i), this.onChange();
5222
+ return;
5223
+ }
5224
+ e = e.parentNode;
5225
+ }
5197
5226
  }
5198
5227
  clearSelToolbar() {
5199
5228
  var t;
@@ -5221,7 +5250,7 @@ let Ei = (j = class {
5221
5250
  () => this.colorMenu(e, "fore")
5222
5251
  ), i = this.ctxBtn(h.backcolor, this.t("backcolor"), () => this.colorMenu(i, "back"));
5223
5252
  (r = i.querySelector("svg")) == null || r.insertAdjacentHTML("afterend", '<span class="colorbar" data-cb="back"></span>');
5224
- const s = this.ctxBtn(h.caseic, this.t("changecase"), () => this.caseMenu(s)), l = this.ctxBtn(h.lineheight, this.t("lineheight"), () => this.lineHeightMenu(l)), n = this.ctxBtn(h.wordspacing, this.t("wordspacing"), () => this.wordSpacingMenu(n));
5253
+ const s = this.ctxBtn(h.caseic, this.t("changecase"), () => this.caseMenu(s)), n = this.ctxBtn(h.lineheight, this.t("lineheight"), () => this.lineHeightMenu(n)), l = this.ctxBtn(h.wordspacing, this.t("wordspacing"), () => this.wordSpacingMenu(l));
5225
5254
  return t.append(
5226
5255
  this.ctxBtn(h.bold, this.t("bold"), () => this.exec("bold"), "bold"),
5227
5256
  this.ctxBtn(h.italic, this.t("italic"), () => this.exec("italic"), "italic"),
@@ -5235,17 +5264,17 @@ let Ei = (j = class {
5235
5264
  this.ctxSep(),
5236
5265
  this.ctxBtn(h.link, this.t("linkttl"), () => this.linkDlg()),
5237
5266
  s,
5238
- l,
5239
- n
5267
+ n,
5268
+ l
5240
5269
  ), t.addEventListener("mousedown", (o) => o.preventDefault()), document.body.appendChild(t), this.syncColorSwatches(t), t;
5241
5270
  }
5242
5271
  positionSelToolbar(t) {
5243
5272
  if (!this.selCtx) return;
5244
- const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, l = e.right + scrollX, n = e.bottom + scrollY, r = this.selCtx.offsetWidth, o = this.selCtx.offsetHeight;
5245
- let c = s + (l - s) / 2 - r / 2;
5273
+ const e = t.getBoundingClientRect(), i = e.top + scrollY, s = e.left + scrollX, n = e.right + scrollX, l = e.bottom + scrollY, r = this.selCtx.offsetWidth, o = this.selCtx.offsetHeight;
5274
+ let c = s + (n - s) / 2 - r / 2;
5246
5275
  c = Math.max(8 + scrollX, Math.min(c, scrollX + innerWidth - r - 8));
5247
5276
  let d = i - o - 8;
5248
- d < this.ctxMinTop() && (d = n + 8), this.selCtx.style.left = c + "px", this.selCtx.style.top = d + "px";
5277
+ d < this.ctxMinTop() && (d = l + 8), this.selCtx.style.left = c + "px", this.selCtx.style.top = d + "px";
5249
5278
  }
5250
5279
  repositionSelToolbar() {
5251
5280
  if (!this.selCtx) return;
@@ -5256,8 +5285,13 @@ let Ei = (j = class {
5256
5285
  currentBlock() {
5257
5286
  const t = window.getSelection();
5258
5287
  if (!t || !t.anchorNode || !this.ed.contains(t.anchorNode)) return "p";
5259
- const e = this.closestBlock(t.anchorNode);
5260
- return e ? e.tagName.toLowerCase().replace("div", "p") : "p";
5288
+ let e = t.anchorNode;
5289
+ for (; e && e !== this.ed; ) {
5290
+ if (e.nodeType === 1 && e.tagName === "BLOCKQUOTE") return "blockquote";
5291
+ e = e.parentNode;
5292
+ }
5293
+ const i = this.closestBlock(t.anchorNode);
5294
+ return i ? i.tagName.toLowerCase().replace("div", "p") : "p";
5261
5295
  }
5262
5296
  /** Element whose computed font reflects the current caret, falling back to the editor root before any selection lands inside it. */
5263
5297
  fontRefEl() {
@@ -5275,7 +5309,7 @@ let Ei = (j = class {
5275
5309
  refreshState() {
5276
5310
  var o, c, d;
5277
5311
  const t = window.getSelection(), e = t ? this.ed.contains(t.anchorNode) : !1, i = this.currentBlock();
5278
- [this.toolbar, this.selCtx].filter(Boolean).forEach((p) => {
5312
+ [this.toolbar, this.selCtx].filter(Boolean).forEach((u) => {
5279
5313
  [
5280
5314
  "bold",
5281
5315
  "italic",
@@ -5288,22 +5322,22 @@ let Ei = (j = class {
5288
5322
  "insertOrderedList",
5289
5323
  "insertUnorderedList"
5290
5324
  ].forEach((b) => {
5291
- const y = p.querySelector(`[data-id=${b}]`);
5325
+ const y = u.querySelector(`[data-id=${b}]`);
5292
5326
  y && y.classList.toggle("on", e && document.queryCommandState(b));
5293
5327
  }), ["h2", "h3", "blockquote"].forEach((b) => {
5294
- const y = p.querySelector(`[data-id=${b}]`);
5328
+ const y = u.querySelector(`[data-id=${b}]`);
5295
5329
  y && y.classList.toggle("on", e && i === b);
5296
5330
  });
5297
- const m = p.querySelector("[data-id=code]");
5331
+ const m = u.querySelector("[data-id=code]");
5298
5332
  m && m.classList.toggle("on", e && !!this.closestInlineCode());
5299
5333
  });
5300
- const l = t ? this.closestBlock(t.anchorNode) : null, n = ((o = l == null ? void 0 : l.closest("[dir]")) == null ? void 0 : o.getAttribute("dir")) || this.ed.getAttribute("dir") || this.dir();
5301
- (c = this.toolbar.querySelector("[data-id=ltr]")) == null || c.classList.toggle("on", e && n === "ltr"), (d = this.toolbar.querySelector("[data-id=rtl]")) == null || d.classList.toggle("on", e && n === "rtl");
5302
- const r = (p, m, b) => {
5303
- const y = this.toolbar.querySelector(`[data-id=${p}] .lbl`);
5334
+ const n = t ? this.closestBlock(t.anchorNode) : null, l = ((o = n == null ? void 0 : n.closest("[dir]")) == null ? void 0 : o.getAttribute("dir")) || this.ed.getAttribute("dir") || this.dir();
5335
+ (c = this.toolbar.querySelector("[data-id=ltr]")) == null || c.classList.toggle("on", e && l === "ltr"), (d = this.toolbar.querySelector("[data-id=rtl]")) == null || d.classList.toggle("on", e && l === "rtl");
5336
+ const r = (u, m, b) => {
5337
+ const y = this.toolbar.querySelector(`[data-id=${u}] .lbl`);
5304
5338
  y && (y.textContent = m || b || "", y.classList.toggle("empty", !m));
5305
5339
  };
5306
- r("fontsel", this.currentFont()), r("sizesel", this.currentSize().replace("px", "")), e && r("blocksel", se.some((p) => p[0] === i) ? this.blockLabel(i) : this.t("para")), this.sbWords.textContent = this.countWords() + " " + this.t("words");
5340
+ r("fontsel", this.currentFont()), r("sizesel", this.currentSize().replace("px", "")), e && r("blocksel", se.some((u) => u[0] === i) ? this.blockLabel(i) : this.t("para")), this.sbWords.textContent = this.countWords() + " " + this.t("words");
5307
5341
  }
5308
5342
  countWords() {
5309
5343
  const t = (this.ed.textContent || "").trim();
@@ -5314,22 +5348,22 @@ let Ei = (j = class {
5314
5348
  const e = t.clipboardData;
5315
5349
  if (!e) return;
5316
5350
  t.preventDefault();
5317
- const i = e.getData("text/html"), s = Array.from(e.items).find((l) => l.type.startsWith("image/"));
5351
+ const i = e.getData("text/html"), s = Array.from(e.items).find((n) => n.type.startsWith("image/"));
5318
5352
  if (s && !i) {
5319
- const l = new FileReader();
5320
- l.onload = () => {
5321
- document.execCommand("insertHTML", !1, `<img src="${l.result}" alt="">`), this.onChange();
5322
- }, l.readAsDataURL(s.getAsFile());
5353
+ const n = new FileReader();
5354
+ n.onload = () => {
5355
+ document.execCommand("insertHTML", !1, `<img src="${n.result}" alt="">`), this.onChange();
5356
+ }, n.readAsDataURL(s.getAsFile());
5323
5357
  return;
5324
5358
  }
5325
5359
  if (!i) {
5326
- const l = e.getData("text/plain"), n = /^\S+$/.test(l.trim()) ? this.videoEmbedUrl(l.trim()) : null;
5327
- if (n) {
5328
- document.execCommand("insertHTML", !1, this.videoEmbedHTML(n)), this.onChange();
5360
+ const n = e.getData("text/plain"), l = /^\S+$/.test(n.trim()) ? this.videoEmbedUrl(n.trim()) : null;
5361
+ if (l) {
5362
+ document.execCommand("insertHTML", !1, this.videoEmbedHTML(l)), this.onChange();
5329
5363
  return;
5330
5364
  }
5331
5365
  }
5332
- i ? document.execCommand("insertHTML", !1, pi(i, this.dir())) : document.execCommand("insertHTML", !1, ui(e.getData("text/plain"))), this.onChange();
5366
+ i ? document.execCommand("insertHTML", !1, ui(i, this.dir())) : document.execCommand("insertHTML", !1, pi(e.getData("text/plain"))), this.onChange();
5333
5367
  }
5334
5368
  /* ---------------------------------------------------------- init */
5335
5369
  initUI() {
@@ -5337,8 +5371,8 @@ let Ei = (j = class {
5337
5371
  }
5338
5372
  }, j.instanceCounter = 0, j.TBR_COLLAPSE_MAX = 992, j);
5339
5373
  const Si = _e(
5340
- ({ value: u, defaultValue: t, onChange: e, onReady: i, className: s, style: l, ...n }, r) => {
5341
- const o = z(null), c = z(null), d = z(!1), p = z(u ?? t), m = z(null), b = z(e), y = z(i);
5374
+ ({ value: p, defaultValue: t, onChange: e, onReady: i, className: s, style: n, ...l }, r) => {
5375
+ const o = z(null), c = z(null), d = z(!1), u = z(p ?? t), m = z(null), b = z(e), y = z(i);
5342
5376
  return b.current = e, y.current = i, Fe(r, () => ({
5343
5377
  getContent: () => {
5344
5378
  var g;
@@ -5380,34 +5414,34 @@ const Si = _e(
5380
5414
  if (!o.current) return;
5381
5415
  const g = new Ei({
5382
5416
  target: o.current,
5383
- initialContent: p.current,
5417
+ initialContent: u.current,
5384
5418
  onChange: (x) => {
5385
5419
  var w;
5386
- d.current = !0, p.current = x, (w = b.current) == null || w.call(b, x);
5420
+ d.current = !0, u.current = x, (w = b.current) == null || w.call(b, x);
5387
5421
  },
5388
5422
  onReady: (x) => {
5389
5423
  var w;
5390
5424
  return (w = y.current) == null ? void 0 : w.call(y, x);
5391
5425
  },
5392
- ...n
5426
+ ...l
5393
5427
  });
5394
5428
  return c.current = g, () => {
5395
5429
  g.destroy(), c.current = null;
5396
5430
  };
5397
5431
  }, []), ot(() => {
5398
5432
  var g, x;
5399
- if (u !== void 0 && u !== p.current) {
5433
+ if (p !== void 0 && p !== u.current) {
5400
5434
  if (d.current) {
5401
5435
  d.current = !1;
5402
5436
  return;
5403
5437
  }
5404
5438
  if ((g = o.current) != null && g.contains(document.activeElement)) {
5405
- m.current = u;
5439
+ m.current = p;
5406
5440
  return;
5407
5441
  }
5408
- p.current = u, (x = c.current) == null || x.setContent(u);
5442
+ u.current = p, (x = c.current) == null || x.setContent(p);
5409
5443
  }
5410
- }, [u]), ot(() => {
5444
+ }, [p]), ot(() => {
5411
5445
  const g = o.current;
5412
5446
  if (!g) return;
5413
5447
  const x = (w) => {
@@ -5416,13 +5450,13 @@ const Si = _e(
5416
5450
  const E = w.relatedTarget;
5417
5451
  if (E && g.contains(E)) return;
5418
5452
  const A = m.current;
5419
- m.current = null, p.current = A, (H = c.current) == null || H.setContent(A);
5453
+ m.current = null, u.current = A, (H = c.current) == null || H.setContent(A);
5420
5454
  };
5421
5455
  return g.addEventListener("focusout", x), () => g.removeEventListener("focusout", x);
5422
5456
  }, []), ot(() => {
5423
5457
  var g;
5424
- n.language && ((g = c.current) == null || g.setLanguage(n.language));
5425
- }, [n.language]), /* @__PURE__ */ We.jsx("div", { ref: o, className: s, style: l });
5458
+ l.language && ((g = c.current) == null || g.setLanguage(l.language));
5459
+ }, [l.language]), /* @__PURE__ */ We.jsx("div", { ref: o, className: s, style: n });
5426
5460
  }
5427
5461
  );
5428
5462
  Si.displayName = "FableEditor";