@jackuait/blok 0.10.7 → 0.10.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/blok.mjs +2 -2
  2. package/dist/chunks/{blok-oWXfRfnM.mjs → blok-DbRn9adY.mjs} +2681 -2238
  3. package/dist/chunks/{constants-BQ1-lyZI.mjs → constants-C9lsSOXl.mjs} +4 -3
  4. package/dist/chunks/{core-C942GvJO.mjs → core-B7mxBIHA.mjs} +1 -1
  5. package/dist/chunks/{engine-javascript-Dd6ViPCH.mjs → engine-javascript-Bmmg8uL9.mjs} +1 -1
  6. package/dist/chunks/{i18next-loader-CIXsptng.mjs → i18next-loader-453gJdot.mjs} +1 -1
  7. package/dist/chunks/{tools-MuBQQyZ-.mjs → tools-D0W3_dlA.mjs} +504 -499
  8. package/dist/full.mjs +3 -3
  9. package/dist/react.mjs +3 -3
  10. package/dist/tools.mjs +2 -2
  11. package/package.json +3 -6
  12. package/src/components/block/index.ts +36 -0
  13. package/src/components/blocks.ts +191 -5
  14. package/src/components/modules/api/blocks.ts +20 -5
  15. package/src/components/modules/blockEvents/composers/keyboardNavigation.ts +17 -6
  16. package/src/components/modules/blockManager/blockManager.ts +364 -23
  17. package/src/components/modules/blockManager/hierarchy.ts +164 -8
  18. package/src/components/modules/blockManager/operations.ts +223 -26
  19. package/src/components/modules/blockManager/types.ts +13 -1
  20. package/src/components/modules/blockManager/yjs-sync.ts +48 -3
  21. package/src/components/modules/drag/DragController.ts +209 -8
  22. package/src/components/modules/drag/operations/DragOperations.ts +153 -20
  23. package/src/components/modules/paste/handlers/base.ts +48 -20
  24. package/src/components/modules/paste/handlers/blok-data-handler.ts +184 -44
  25. package/src/components/modules/paste/index.ts +20 -0
  26. package/src/components/modules/renderer.ts +9 -1
  27. package/src/components/modules/saver.ts +75 -5
  28. package/src/components/modules/toolbar/index.ts +41 -60
  29. package/src/components/modules/uiControllers/controllers/keyboard.ts +20 -0
  30. package/src/components/modules/yjs/block-observer.ts +87 -23
  31. package/src/components/modules/yjs/document-store.ts +37 -11
  32. package/src/components/modules/yjs/index.ts +83 -7
  33. package/src/components/modules/yjs/types.ts +35 -2
  34. package/src/components/modules/yjs/undo-history.ts +116 -5
  35. package/src/components/utils/data-model-transform.ts +247 -35
  36. package/src/components/utils/hierarchy-invariant.ts +137 -0
  37. package/src/markdown/markdown-handler.ts +9 -2
  38. package/src/styles/main.css +5 -0
  39. package/src/tools/callout/constants.ts +0 -1
  40. package/src/tools/callout/dom-builder.ts +1 -11
  41. package/src/tools/callout/index.ts +0 -6
  42. package/src/tools/header/index.ts +14 -1
  43. package/src/tools/table/table-operations.ts +9 -4
  44. package/src/tools/toggle/constants.ts +2 -1
  45. package/src/tools/toggle/dom-builder.ts +7 -0
  46. package/src/tools/toggle/index.ts +14 -1
  47. package/src/tools/toggle/toggle-lifecycle.ts +24 -0
  48. /package/dist/chunks/{lightweight-i18n-DTYoSr_o.mjs → lightweight-i18n-DSjG0iTr.mjs} +0 -0
  49. /package/dist/chunks/{objectWithoutProperties-D0XxKB4n.mjs → objectWithoutProperties-Dci1-l7D.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, Ct as o, D as s, Et as c, F as l, Ft as u, G as d, Gt as f, H as p, Ht as m, I as h, It as g, J as _, Jt as v, K as y, Kt as b, L as ee, Lt as x, M as te, Mt as S, Nn as ne, Nt as re, O as ie, Ot as C, P as ae, Pt as oe, Q as se, Qt as ce, R as le, Rn as w, Rt as ue, St as de, Tt as fe, U as pe, Ut as me, V as he, W as ge, Wt as _e, X as ve, Xt as ye, Y as be, Yt as xe, Z as Se, Zt as Ce, _n as we, _t as Te, a as Ee, at as De, bt as Oe, c as ke, cn as T, ct as Ae, d as je, dr as E, dt as Me, en as Ne, et as Pe, f as Fe, ft as Ie, g as Le, gt as Re, h as ze, ht as Be, i as Ve, ir as He, it as Ue, j as We, jt as Ge, k as Ke, kt as qe, l as Je, ln as Ye, lt as Xe, mn as Ze, mt as Qe, n as $e, nt as et, o as tt, ot as nt, p as rt, pn as D, pt as it, q as at, qt as ot, r as st, rn as ct, rt as lt, s as ut, sn as dt, st as ft, t as pt, tt as mt, u as O, un as ht, ur as k, ut as gt, v as _t, vn as vt, vt as yt, wt as bt, xt, z as St, zt as Ct } from "./constants-BQ1-lyZI.mjs";
1
+ import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, Ct as o, D as s, Et as c, F as l, Ft as u, G as d, Gt as f, H as p, Ht as m, I as h, It as g, J as _, Jt as v, K as y, Kt as b, L as ee, Lt as x, M as te, Mt as S, Nn as ne, Nt as re, O as ie, Ot as C, P as ae, Pt as oe, Q as se, Qt as ce, R as le, Rn as w, Rt as ue, St as de, Tt as fe, U as pe, Ut as me, V as he, W as ge, Wt as _e, X as ve, Xt as ye, Y as be, Yt as xe, Z as Se, Zt as Ce, _n as we, _t as Te, a as Ee, at as De, bt as Oe, c as ke, cn as T, ct as Ae, d as je, dr as E, dt as Me, en as Ne, et as Pe, f as Fe, ft as Ie, g as Le, gt as Re, h as ze, ht as Be, i as Ve, ir as He, it as Ue, j as We, jt as Ge, k as Ke, kt as qe, l as Je, ln as Ye, lt as Xe, mn as Ze, mt as Qe, n as $e, nt as et, o as tt, ot as nt, p as rt, pn as D, pt as it, q as at, qt as ot, r as st, rn as ct, rt as lt, s as ut, sn as dt, st as ft, t as pt, tt as mt, u as O, un as ht, ur as k, ut as gt, v as _t, vn as vt, vt as yt, wt as bt, xt, z as St, zt as Ct } from "./constants-C9lsSOXl.mjs";
2
2
  import { t as A } from "./objectSpread2-CWwMYL_U.mjs";
3
3
  import { n as j } from "./tw-CqxBf-1Y.mjs";
4
4
  //#region src/components/utils/html.ts
@@ -12,7 +12,7 @@ var wt = (e) => {
12
12
  t.removeChild(e);
13
13
  }
14
14
  }), t.innerHTML;
15
- }, Tt = [
15
+ }, M = [
16
16
  "empty:before:pointer-events-none",
17
17
  "empty:before:text-gray-text",
18
18
  "empty:before:cursor-text",
@@ -21,7 +21,7 @@ var wt = (e) => {
21
21
  "data-[blok-empty=true]:before:text-gray-text",
22
22
  "data-[blok-empty=true]:before:cursor-text",
23
23
  "data-[blok-empty=true]:before:content-[attr(data-placeholder)]"
24
- ], Et = [
24
+ ], Tt = [
25
25
  "empty:before:pointer-events-none",
26
26
  "empty:before:text-gray-text",
27
27
  "empty:before:cursor-text",
@@ -30,7 +30,7 @@ var wt = (e) => {
30
30
  "data-[empty=true]:before:text-gray-text",
31
31
  "data-[empty=true]:before:cursor-text",
32
32
  "data-[empty=true]:before:content-[attr(data-blok-placeholder-active)]"
33
- ], Dt = [
33
+ ], Et = [
34
34
  "empty:focus:before:pointer-events-none",
35
35
  "empty:focus:before:text-gray-text",
36
36
  "empty:focus:before:cursor-text",
@@ -39,7 +39,7 @@ var wt = (e) => {
39
39
  "[&[data-empty=true]:focus]:before:text-gray-text",
40
40
  "[&[data-empty=true]:focus]:before:cursor-text",
41
41
  "[&[data-empty=true]:focus]:before:content-[attr(data-blok-placeholder-active)]"
42
- ], Ot = [
42
+ ], Dt = [
43
43
  "empty:in-data-[blok-empty=true]:before:pointer-events-none",
44
44
  "empty:in-data-[blok-empty=true]:before:text-gray-text",
45
45
  "empty:in-data-[blok-empty=true]:before:cursor-text",
@@ -48,29 +48,29 @@ var wt = (e) => {
48
48
  "[[data-blok-empty=true]_&[data-empty=true]]:before:text-gray-text",
49
49
  "[[data-blok-empty=true]_&[data-empty=true]]:before:cursor-text",
50
50
  "[[data-blok-empty=true]_&[data-empty=true]]:before:content-[attr(data-blok-placeholder-active)]"
51
- ], kt = (e) => {
51
+ ], Ot = (e) => {
52
52
  let t = e.innerHTML.trim();
53
53
  return t === "" || t === "<br>";
54
- }, At = (e) => {
54
+ }, kt = (e) => {
55
55
  e.innerHTML === "<br>" && (e.innerHTML = "");
56
56
  let t = window.getSelection();
57
57
  if (!t) return;
58
58
  let n = document.createRange();
59
59
  n.selectNodeContents(e), n.collapse(!0), t.removeAllRanges(), t.addRange(n);
60
- }, jt = (e) => {
61
- kt(e) && At(e);
62
- }, M = (e, t, n = "data-placeholder") => {
60
+ }, At = (e) => {
61
+ Ot(e) && kt(e);
62
+ }, N = (e, t, n = "data-placeholder") => {
63
63
  e.setAttribute(n, t == null ? "" : t);
64
- let r = () => jt(e);
64
+ let r = () => At(e);
65
65
  return e.addEventListener("focus", r), () => {
66
66
  e.removeEventListener("focus", r), e.removeAttribute(n);
67
67
  };
68
- }, Mt, Nt = (e) => {
68
+ }, jt, Mt = (e) => {
69
69
  let t = document.createElement("div");
70
70
  t.innerHTML = e.trim();
71
71
  let n = document.createDocumentFragment();
72
72
  return n.append(...Array.from(t.childNodes)), n;
73
- }, Pt = class e {
73
+ }, Nt = class e {
74
74
  static get DEFAULT_PLACEHOLDER() {
75
75
  return "tools.paragraph.placeholder";
76
76
  }
@@ -89,20 +89,20 @@ var wt = (e) => {
89
89
  }
90
90
  drawView() {
91
91
  let t = document.createElement("DIV");
92
- t.className = j(this.api.styles.block, e.WRAPPER_CLASSES, Dt, Ot), t.setAttribute(k.tool, "paragraph"), t.contentEditable = "false";
92
+ t.className = j(this.api.styles.block, e.WRAPPER_CLASSES, Et, Dt), t.setAttribute(k.tool, "paragraph"), t.contentEditable = "false";
93
93
  let n = this.buildInlineStyles();
94
- return Object.keys(n).length > 0 && Object.assign(t.style, n), this._data.text ? t.innerHTML = this._data.text : this.readOnly && (t.innerHTML = "<br>"), this.readOnly || (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = M(t, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active")), t;
94
+ return Object.keys(n).length > 0 && Object.assign(t.style, n), this._data.text ? t.innerHTML = this._data.text : this.readOnly && (t.innerHTML = "<br>"), this.readOnly || (t.contentEditable = "true", t.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = N(t, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active")), t;
95
95
  }
96
96
  render() {
97
97
  return this._element || (this._element = this.drawView()), this._element;
98
98
  }
99
99
  setReadOnly(e) {
100
- this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), kt(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = M(this._element, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
100
+ this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), Ot(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = N(this._element, this.api.i18n.t(this._placeholder), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
101
101
  }
102
102
  merge(e) {
103
103
  if (!this._element) return;
104
104
  this._data.text += e.text;
105
- let t = Nt(e.text);
105
+ let t = Mt(e.text);
106
106
  this._element.appendChild(t), this._element.normalize();
107
107
  }
108
108
  validate(e) {
@@ -153,7 +153,7 @@ var wt = (e) => {
153
153
  };
154
154
  }
155
155
  };
156
- Mt = Pt, Mt.WRAPPER_CLASSES = [
156
+ jt = Nt, jt.WRAPPER_CLASSES = [
157
157
  "leading-[1.5]",
158
158
  "outline-hidden",
159
159
  "mt-px",
@@ -163,14 +163,14 @@ Mt = Pt, Mt.WRAPPER_CLASSES = [
163
163
  ];
164
164
  //#endregion
165
165
  //#region src/tools/toggle/dom-builder.ts
166
- var Ft = (e) => {
166
+ var Pt = (e) => {
167
167
  let { data: t, readOnly: n, isOpen: r, keydownHandler: i, onArrowClick: a, onBodyPlaceholderClick: o } = e, s = document.createElement("div");
168
- s.className = Ee, s.setAttribute(k.tool, rt), s.setAttribute(O.toggleOpen, String(r));
168
+ s.className = Ee, s.setAttribute(k.tool, rt), s.setAttribute(O.toggleOpen, String(r)), s.setAttribute(O.toggleEmpty, "true");
169
169
  let c = document.createElement("div");
170
170
  c.className = Fe;
171
- let l = It(r, a, {}, e.ariaLabels), u = Rt(t, n, i);
171
+ let l = Ft(r, a, {}, e.ariaLabels), u = Lt(t, n, i);
172
172
  c.appendChild(l), c.appendChild(u);
173
- let d = Lt(o, e.bodyPlaceholderText), f = document.createElement("div");
173
+ let d = It(o, e.bodyPlaceholderText), f = document.createElement("div");
174
174
  return f.className = je, f.setAttribute(O.toggleChildren, ""), f.setAttribute(k.nestedBlocks, ""), f.setAttribute("data-blok-mutation-free", "true"), f.id = `toggle-children-${Date.now()}-${Math.random().toString(36).slice(2)}`, l.setAttribute("aria-controls", f.id), s.appendChild(c), s.appendChild(d), s.appendChild(f), {
175
175
  wrapper: s,
176
176
  arrowElement: l,
@@ -178,7 +178,7 @@ var Ft = (e) => {
178
178
  bodyPlaceholderElement: d,
179
179
  childContainerElement: f
180
180
  };
181
- }, It = (e, t, n = {}, r = {
181
+ }, Ft = (e, t, n = {}, r = {
182
182
  collapse: "Collapse",
183
183
  expand: "Expand"
184
184
  }) => {
@@ -190,17 +190,22 @@ var Ft = (e) => {
190
190
  }), i.addEventListener("keydown", (e) => {
191
191
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), t());
192
192
  })), i;
193
- }, Lt = (e, t) => {
193
+ }, It = (e, t) => {
194
194
  let n = document.createElement("div");
195
195
  return n.className = ut, n.setAttribute(O.toggleBodyPlaceholder, ""), n.setAttribute("data-blok-mutation-free", "true"), n.textContent = t, e && n.addEventListener("click", e), n;
196
- }, Rt = (e, t, n) => {
196
+ }, Lt = (e, t, n) => {
197
197
  let r = document.createElement("div");
198
- return r.className = j(ke, Et, Ot), r.setAttribute(O.toggleContent, ""), r.contentEditable = t ? "false" : "true", r.innerHTML = e.text, n && r.addEventListener("keydown", n), r;
199
- }, zt = (e, t) => {
198
+ return r.className = j(ke, Tt, Dt), r.setAttribute(O.toggleContent, ""), r.contentEditable = t ? "false" : "true", r.innerHTML = e.text, n && r.addEventListener("keydown", n), r;
199
+ }, Rt = (e, t) => {
200
200
  for (let n of t) n.holder.parentElement !== e && (n.holder.closest(`[${k.nestedBlocks}]`) || e.appendChild(n.holder));
201
+ }, zt = (e, t) => {
202
+ var n;
203
+ if (e === null) return;
204
+ let r = ((n = t == null ? void 0 : t.textContent) == null ? "" : n).trim() === "";
205
+ e.setAttribute(O.toggleEmpty, String(r));
201
206
  }, Bt = (e) => {
202
- let t = Ft(e);
203
- return t.contentElement && M(t.contentElement, e.placeholder, "data-blok-placeholder-active"), t;
207
+ let t = Pt(e);
208
+ return t.contentElement && N(t.contentElement, e.placeholder, "data-blok-placeholder-active"), t;
204
209
  }, Vt = (e, t, n, r = {
205
210
  collapse: "Collapse",
206
211
  expand: "Expand"
@@ -209,7 +214,7 @@ var Ft = (e) => {
209
214
  i && (i.style.transform = n ? "rotate(90deg)" : ""), e.setAttribute("aria-label", n ? r.collapse : r.expand), e.setAttribute("aria-expanded", String(n)), t.setAttribute(O.toggleOpen, String(n));
210
215
  }, Ht = (e, t, n, r, i) => {
211
216
  let a = e.blocks.getChildren(t);
212
- !n && r && i && r.contains(document.activeElement) && i.focus(), r && zt(r, a);
217
+ !n && r && i && r.contains(document.activeElement) && i.focus(), r && Rt(r, a);
213
218
  for (let e of a) n ? e.holder.classList.remove("hidden") : e.holder.classList.add("hidden");
214
219
  r && (n ? r.removeAttribute("aria-hidden") : r.setAttribute("aria-hidden", "true"));
215
220
  }, Ut = (e, t, n, r, i) => {
@@ -296,7 +301,9 @@ var Ft = (e) => {
296
301
  }, Xt, Zt = class e {
297
302
  constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
298
303
  var a;
299
- this.placeholderCleanup = null, this._arrowElement = null, this._wrapper = null, this._headerRow = null, this._childContainerElement = null, this._bodyPlaceholderElement = null, this.handleKeyDown = (e) => {
304
+ this.placeholderCleanup = null, this._arrowElement = null, this._wrapper = null, this._headerRow = null, this._childContainerElement = null, this._bodyPlaceholderElement = null, this.handleChildContainerInput = () => {
305
+ zt(this._wrapper, this._childContainerElement);
306
+ }, this.handleKeyDown = (e) => {
300
307
  if (e.key === "Enter" && !e.shiftKey) {
301
308
  e.preventDefault(), this.handleEnter();
302
309
  return;
@@ -346,7 +353,7 @@ var Ft = (e) => {
346
353
  else {
347
354
  this._element.contentEditable = "true", this._data.isToggleable && this._element.addEventListener("keydown", this.handleKeyDown);
348
355
  let e = this.api.i18n.t(this.currentLevel.nameKey), t = this.resolvePlaceholderText(e);
349
- this.placeholderCleanup = M(this._element, t);
356
+ this.placeholderCleanup = N(this._element, t);
350
357
  }
351
358
  }
352
359
  expand() {
@@ -430,13 +437,13 @@ var Ft = (e) => {
430
437
  e.innerHTML = this._element.innerHTML, this._element.parentNode.replaceChild(e, this._element), this._element = e;
431
438
  }
432
439
  if (t.text !== void 0 && (this._element.innerHTML = this._data.text || ""), this._data.isToggleable) {
433
- if (this._element.setAttribute(O.toggleOpen, String(this._isOpen)), this._element.className = j(e.BASE_STYLES, this.currentLevel.styles, Tt, "pl-8"), !this._wrapper) this.createToggleWrapper();
440
+ if (this._element.setAttribute(O.toggleOpen, String(this._isOpen)), this._element.className = j(e.BASE_STYLES, this.currentLevel.styles, M, "pl-8"), !this._wrapper) this.createToggleWrapper();
434
441
  else if (!this._wrapper.querySelector(`[${O.toggleArrow}]`)) {
435
442
  var n;
436
443
  let e = this.buildArrow();
437
444
  this._arrowElement = e, ((n = this._headerRow) == null ? this._wrapper : n).prepend(e);
438
445
  }
439
- } else if (this._element.removeAttribute(O.toggleOpen), this._element.className = j(e.BASE_STYLES, this.currentLevel.styles, Tt), this._arrowElement = null, this._wrapper) {
446
+ } else if (this._element.removeAttribute(O.toggleOpen), this._element.className = j(e.BASE_STYLES, this.currentLevel.styles, M), this._arrowElement = null, this._wrapper) {
440
447
  let e = this._wrapper.parentNode;
441
448
  e && e.replaceChild(this._element, this._wrapper), this._wrapper = null, this._headerRow = null;
442
449
  }
@@ -446,32 +453,34 @@ var Ft = (e) => {
446
453
  }
447
454
  getTag() {
448
455
  let t = document.createElement(this.currentLevel.tag);
449
- t.innerHTML = this._data.text || "", t.className = j(e.BASE_STYLES, this.currentLevel.styles, Tt, this._data.isToggleable ? "pl-8" : "");
456
+ t.innerHTML = this._data.text || "", t.className = j(e.BASE_STYLES, this.currentLevel.styles, M, this._data.isToggleable ? "pl-8" : "");
450
457
  let { inlineStyles: n } = this.currentLevel;
451
458
  n && Object.assign(t.style, n), t.setAttribute(k.tool, "header"), t.contentEditable = this.readOnly ? "false" : "true", this._data.isToggleable && t.setAttribute(O.toggleOpen, String(this._isOpen));
452
459
  let r = this.api.i18n.t(this.currentLevel.nameKey), i = this.resolvePlaceholderText(r);
453
- return this.readOnly ? t.setAttribute("data-placeholder", i) : this.placeholderCleanup = M(t, i), !this.readOnly && this._data.isToggleable && t.addEventListener("keydown", this.handleKeyDown), t;
460
+ return this.readOnly ? t.setAttribute("data-placeholder", i) : this.placeholderCleanup = N(t, i), !this.readOnly && this._data.isToggleable && t.addEventListener("keydown", this.handleKeyDown), t;
454
461
  }
455
462
  buildArrow() {
456
- let e = It(this._isOpen, () => this.toggleOpen(), {}, {
463
+ let e = Ft(this._isOpen, () => this.toggleOpen(), {}, {
457
464
  collapse: this.api.i18n.t("tools.toggle.ariaLabelCollapse"),
458
465
  expand: this.api.i18n.t("tools.toggle.ariaLabelExpand")
459
466
  });
460
467
  return e.classList.add("absolute", "left-0", "top-1/2", "-translate-y-1/2"), e;
461
468
  }
462
469
  buildWrapper() {
463
- let e = document.createElement("div"), t = document.createElement("div");
470
+ let e = document.createElement("div");
471
+ e.setAttribute(O.toggleEmpty, "true");
472
+ let t = document.createElement("div");
464
473
  t.className = "relative", this._headerRow = t;
465
474
  let n = this.buildArrow();
466
475
  this._arrowElement = n, t.appendChild(n), t.appendChild(this._element), e.appendChild(t);
467
476
  let r = document.createElement("div");
468
477
  r.className = j(ut, "pl-8"), r.setAttribute(O.toggleBodyPlaceholder, ""), r.setAttribute("data-blok-mutation-free", "true"), r.textContent = this.api.i18n.t("tools.toggle.bodyPlaceholder"), this.readOnly || r.addEventListener("click", () => this.handleBodyPlaceholderClick()), this._bodyPlaceholderElement = r, e.appendChild(r);
469
478
  let i = document.createElement("div");
470
- return i.className = "pl-8", i.setAttribute(O.toggleChildren, ""), i.setAttribute(k.nestedBlocks, ""), i.setAttribute("data-blok-mutation-free", "true"), this._childContainerElement = i, e.appendChild(i), e;
479
+ return i.className = "pl-8", i.setAttribute(O.toggleChildren, ""), i.setAttribute(k.nestedBlocks, ""), i.setAttribute("data-blok-mutation-free", "true"), i.addEventListener("input", this.handleChildContainerInput), this._childContainerElement = i, e.appendChild(i), e;
471
480
  }
472
481
  createToggleWrapper() {
473
482
  let e = this._element.parentNode;
474
- this._wrapper = document.createElement("div");
483
+ this._wrapper = document.createElement("div"), this._wrapper.setAttribute(O.toggleEmpty, "true");
475
484
  let t = document.createElement("div");
476
485
  t.className = "relative", this._headerRow = t;
477
486
  let n = this.buildArrow();
@@ -504,7 +513,7 @@ var Ft = (e) => {
504
513
  this.blockId !== void 0 && Ht(this.api, this.blockId, this._isOpen, this._childContainerElement, this._arrowElement);
505
514
  }
506
515
  updateBodyPlaceholderVisibility() {
507
- this.blockId !== void 0 && Ut(this._bodyPlaceholderElement, this.api, this.blockId, this._isOpen, this.readOnly);
516
+ this.blockId !== void 0 && (Ut(this._bodyPlaceholderElement, this.api, this.blockId, this._isOpen, this.readOnly), zt(this._wrapper, this._childContainerElement));
508
517
  }
509
518
  handleBodyPlaceholderClick() {
510
519
  var e;
@@ -695,7 +704,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
695
704
  }, ln = (e) => {
696
705
  var t;
697
706
  let { data: n, itemColor: r, itemSize: i, placeholder: a, markerDepth: o } = e, s = document.createElement("div");
698
- s.setAttribute("role", "listitem"), s.className = j($t, "flex", ...Tt), r && (s.style.color = r), i && (s.style.fontSize = i);
707
+ s.setAttribute("role", "listitem"), s.className = j($t, "flex", ...M), r && (s.style.color = r), i && (s.style.fontSize = i);
699
708
  let c = (t = n.depth) == null ? 0 : t;
700
709
  if (c > 0) {
701
710
  let e = n.style === "ordered" ? 26 : 27;
@@ -704,7 +713,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
704
713
  let l = dn(n.style, o == null ? c : o);
705
714
  l.setAttribute("data-list-marker", "true"), l.setAttribute("data-blok-mutation-free", "true"), s.appendChild(l);
706
715
  let u = document.createElement("div");
707
- return u.className = j("flex-1 min-w-0 outline-hidden", ...Tt), u.setAttribute("data-blok-testid", an.contentContainer), u.contentEditable = e.readOnly ? "false" : "true", u.innerHTML = n.text, on(u, a), s.appendChild(u), s;
716
+ return u.className = j("flex-1 min-w-0 outline-hidden", ...M), u.setAttribute("data-blok-testid", an.contentContainer), u.contentEditable = e.readOnly ? "false" : "true", u.innerHTML = n.text, on(u, a), s.appendChild(u), s;
708
717
  }, un = (e) => {
709
718
  var t;
710
719
  let { data: n, itemColor: r, itemSize: i, placeholder: a, readOnly: o } = e, s = document.createElement("div");
@@ -714,7 +723,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
714
723
  let l = document.createElement("input");
715
724
  l.type = "checkbox", l.className = tn, l.checked = !!n.checked, l.disabled = o;
716
725
  let u = document.createElement("div");
717
- return u.className = j("flex-1 outline-hidden leading-[1.5]", n.checked ? "line-through opacity-60" : "", ...Tt), u.setAttribute("data-blok-testid", an.checklistContent), u.setAttribute("data-checked", String(n.checked)), u.contentEditable = o ? "false" : "true", u.innerHTML = n.text, on(u, a), s.appendChild(l), s.appendChild(u), s;
726
+ return u.className = j("flex-1 outline-hidden leading-[1.5]", n.checked ? "line-through opacity-60" : "", ...M), u.setAttribute("data-blok-testid", an.checklistContent), u.setAttribute("data-checked", String(n.checked)), u.contentEditable = o ? "false" : "true", u.innerHTML = n.text, on(u, a), s.appendChild(l), s.appendChild(u), s;
718
727
  }, dn = (e, t) => {
719
728
  let n = document.createElement("span");
720
729
  return n.className = "shrink-0 select-none", n.setAttribute("aria-hidden", "true"), n.contentEditable = "false", e === "ordered" ? (n.textContent = "1.", n.className = j(n.className, "text-right"), n.style.paddingRight = "11px", n.style.minWidth = "fit-content") : (n.textContent = fn(t), n.className = j(n.className, "w-6 text-center flex justify-center"), n.style.paddingLeft = "1px", n.style.paddingRight = "13px", n.style.fontSize = "24px", n.style.fontFamily = "Arial", n.style.lineHeight = "1.5rem"), n;
@@ -1421,7 +1430,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1421
1430
  return this.api.i18n.t(nn);
1422
1431
  }
1423
1432
  setupItemPlaceholder(e) {
1424
- this.readOnly || (this.placeholderCleanup = M(e, this.placeholder));
1433
+ this.readOnly || (this.placeholderCleanup = N(e, this.placeholder));
1425
1434
  }
1426
1435
  render() {
1427
1436
  var e, t;
@@ -1447,7 +1456,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1447
1456
  let t = this.getContentElement();
1448
1457
  t && (t.contentEditable = e ? "false" : "true");
1449
1458
  let n = this._element.querySelector("input[type=\"checkbox\"]");
1450
- n && (n.disabled = e), e ? (this.boundHandleKeyDown && this._element.removeEventListener("keydown", this.boundHandleKeyDown), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null)) : (this.boundHandleKeyDown && this._element.addEventListener("keydown", this.boundHandleKeyDown), t && (this.placeholderCleanup = M(t, this.placeholder)));
1459
+ n && (n.disabled = e), e ? (this.boundHandleKeyDown && this._element.removeEventListener("keydown", this.boundHandleKeyDown), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null)) : (this.boundHandleKeyDown && this._element.addEventListener("keydown", this.boundHandleKeyDown), t && (this.placeholderCleanup = N(t, this.placeholder)));
1451
1460
  }
1452
1461
  rendered() {
1453
1462
  this.updateMarkersAfterPositionChange();
@@ -1845,7 +1854,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1845
1854
  let t = e.querySelector("svg");
1846
1855
  t && (t.setAttribute("width", Tr), t.setAttribute("height", Tr), t.setAttribute("viewBox", "0 0 24 24"), t.classList.add("text-gray-500", "pointer-events-none"));
1847
1856
  }
1848
- }, N = "data-blok-table-row", P = "data-blok-table-cell", F = "data-blok-table-cell-row", I = "data-blok-table-cell-col", Dr = "1px solid var(--blok-table-border)", Or = [
1857
+ }, P = "data-blok-table-row", F = "data-blok-table-cell", I = "data-blok-table-cell-row", L = "data-blok-table-cell-col", Dr = "1px solid var(--blok-table-border)", Or = [
1849
1858
  "py-1",
1850
1859
  "px-2",
1851
1860
  "min-h-[2em]",
@@ -1882,7 +1891,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1882
1891
  let i = document.createElement("tbody");
1883
1892
  return Array.from({ length: e.rows }).forEach((t, n) => {
1884
1893
  let r = document.createElement("tr");
1885
- r.setAttribute(N, ""), Array.from({ length: e.cols }).forEach((t, i) => {
1894
+ r.setAttribute(P, ""), Array.from({ length: e.cols }).forEach((t, i) => {
1886
1895
  if (e.isSpannedCell(n, i)) return;
1887
1896
  let a = this.createCell(n, i), o = e.getCellSpan(n, i);
1888
1897
  o.colspan > 1 && (a.colSpan = o.colspan), o.rowspan > 1 && (a.rowSpan = o.rowspan), r.appendChild(a);
@@ -1891,11 +1900,11 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1891
1900
  }
1892
1901
  addRow(e, t) {
1893
1902
  var n;
1894
- let r = this.getColumnCount(e), i = this.createRow(r), a = (n = e.querySelector("tbody")) == null ? e : n, o = a.querySelectorAll(`[${N}]`);
1903
+ let r = this.getColumnCount(e), i = this.createRow(r), a = (n = e.querySelector("tbody")) == null ? e : n, o = a.querySelectorAll(`[${P}]`);
1895
1904
  return t !== void 0 && t < o.length ? a.insertBefore(i, o[t]) : a.appendChild(i), this.reindexCoordinates(e), i;
1896
1905
  }
1897
1906
  deleteRow(e, t) {
1898
- let n = e.querySelectorAll(`[${N}]`);
1907
+ let n = e.querySelectorAll(`[${P}]`);
1899
1908
  t < n.length && n[t].remove(), this.reindexCoordinates(e);
1900
1909
  }
1901
1910
  addColumn(e, t, n, r) {
@@ -1933,8 +1942,8 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1933
1942
  let i = r.querySelectorAll("col");
1934
1943
  t === void 0 || t >= i.length ? r.appendChild(e) : r.insertBefore(e, i[t]);
1935
1944
  }
1936
- e.querySelectorAll(`[${N}]`).forEach((e) => {
1937
- let n = e.querySelectorAll(`[${P}]`), r = t === void 0 || t >= n.length, i = this.createCell();
1945
+ e.querySelectorAll(`[${P}]`).forEach((e) => {
1946
+ let n = e.querySelectorAll(`[${F}]`), r = t === void 0 || t >= n.length, i = this.createCell();
1938
1947
  r ? e.appendChild(i) : e.insertBefore(i, n[t]);
1939
1948
  });
1940
1949
  }
@@ -1944,39 +1953,39 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1944
1953
  let e = n.querySelectorAll("col");
1945
1954
  t < e.length && e[t].remove();
1946
1955
  }
1947
- e.querySelectorAll(`[${N}]`).forEach((e) => {
1948
- let n = e.querySelectorAll(`[${P}]`);
1956
+ e.querySelectorAll(`[${P}]`).forEach((e) => {
1957
+ let n = e.querySelectorAll(`[${F}]`);
1949
1958
  t >= n.length || n[t].remove();
1950
1959
  }), this.reindexCoordinates(e);
1951
1960
  }
1952
1961
  moveRow(e, t, n) {
1953
1962
  var r;
1954
1963
  if (t === n) return;
1955
- let i = (r = e.querySelector("tbody")) == null ? e : r, a = Array.from(i.querySelectorAll(`[${N}]`));
1964
+ let i = (r = e.querySelector("tbody")) == null ? e : r, a = Array.from(i.querySelectorAll(`[${P}]`));
1956
1965
  if (t >= a.length || n >= a.length) return;
1957
1966
  let o = a[t];
1958
1967
  o.remove();
1959
- let s = Array.from(i.querySelectorAll(`[${N}]`));
1968
+ let s = Array.from(i.querySelectorAll(`[${P}]`));
1960
1969
  n >= s.length ? i.appendChild(o) : i.insertBefore(o, s[n]), this.reindexCoordinates(e);
1961
1970
  }
1962
1971
  moveColumn(e, t, n) {
1963
- t !== n && (this.reorderColElement(e, t, n), e.querySelectorAll(`[${N}]`).forEach((e) => {
1964
- let r = Array.from(e.querySelectorAll(`[${P}]`));
1972
+ t !== n && (this.reorderColElement(e, t, n), e.querySelectorAll(`[${P}]`).forEach((e) => {
1973
+ let r = Array.from(e.querySelectorAll(`[${F}]`));
1965
1974
  if (t >= r.length || n >= r.length) return;
1966
1975
  let i = r[t];
1967
1976
  i.remove();
1968
- let a = Array.from(e.querySelectorAll(`[${P}]`));
1977
+ let a = Array.from(e.querySelectorAll(`[${F}]`));
1969
1978
  n >= a.length ? e.appendChild(i) : e.insertBefore(i, a[n]);
1970
1979
  }), this.reindexCoordinates(e));
1971
1980
  }
1972
1981
  reindexCoordinates(e) {
1973
- let t = Array.from(e.querySelectorAll(`[${N}]`)), n = /* @__PURE__ */ new Map();
1982
+ let t = Array.from(e.querySelectorAll(`[${P}]`)), n = /* @__PURE__ */ new Map();
1974
1983
  t.forEach((e, t) => {
1975
1984
  var r;
1976
- let i = Array.from(e.querySelectorAll(`[${P}]`)), a = (r = n.get(t)) == null ? /* @__PURE__ */ new Set() : r;
1985
+ let i = Array.from(e.querySelectorAll(`[${F}]`)), a = (r = n.get(t)) == null ? /* @__PURE__ */ new Set() : r;
1977
1986
  i.reduce((e, r) => {
1978
1987
  let i = r, o = (e) => a.has(e) ? o(e + 1) : e, s = o(e);
1979
- r.setAttribute(F, String(t)), r.setAttribute(I, String(s));
1988
+ r.setAttribute(I, String(t)), r.setAttribute(L, String(s));
1980
1989
  let c = i.colSpan || 1, l = i.rowSpan || 1;
1981
1990
  return l > 1 && this.blockRowspanCols(n, t, s, l, c), s + c;
1982
1991
  }, 0), n.delete(t);
@@ -1993,20 +2002,20 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
1993
2002
  });
1994
2003
  }
1995
2004
  getRowCount(e) {
1996
- return e.querySelectorAll(`[${N}]`).length;
2005
+ return e.querySelectorAll(`[${P}]`).length;
1997
2006
  }
1998
2007
  getColumnCount(e) {
1999
2008
  let t = e.querySelector("colgroup");
2000
2009
  if (t) return t.querySelectorAll("col").length;
2001
- let n = e.querySelector(`[${N}]`);
2002
- return n ? n.querySelectorAll(`[${P}]`).length : 0;
2010
+ let n = e.querySelector(`[${P}]`);
2011
+ return n ? n.querySelectorAll(`[${F}]`).length : 0;
2003
2012
  }
2004
2013
  getCell(e, t, n) {
2005
- let r = e.querySelector(`[${F}="${t}"][${I}="${n}"]`);
2014
+ let r = e.querySelector(`[${I}="${t}"][${L}="${n}"]`);
2006
2015
  if (r) return r;
2007
- let i = e.querySelectorAll(`[${N}]`);
2016
+ let i = e.querySelectorAll(`[${P}]`);
2008
2017
  if (t >= i.length) return null;
2009
- let a = i[t].querySelectorAll(`[${P}]`);
2018
+ let a = i[t].querySelectorAll(`[${F}]`);
2010
2019
  return n >= a.length ? null : a[n];
2011
2020
  }
2012
2021
  getColWidths(e) {
@@ -2051,17 +2060,17 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2051
2060
  }
2052
2061
  createRow(e, t) {
2053
2062
  let n = document.createElement("tr");
2054
- return n.setAttribute(N, ""), Array.from({ length: e }).forEach((e, r) => {
2063
+ return n.setAttribute(P, ""), Array.from({ length: e }).forEach((e, r) => {
2055
2064
  n.appendChild(this.createCell(t, t === void 0 ? void 0 : r));
2056
2065
  }), n;
2057
2066
  }
2058
2067
  createCell(e, t) {
2059
2068
  let n = document.createElement("td");
2060
- n.className = j(Or), n.style.borderRight = Dr, n.style.borderBottom = Dr, n.style.overflow = "hidden", n.style.overflowWrap = "break-word", n.style.height = "0", n.setAttribute(P, ""), e !== void 0 && t !== void 0 && (n.setAttribute(F, String(e)), n.setAttribute(I, String(t)));
2069
+ n.className = j(Or), n.style.borderRight = Dr, n.style.borderBottom = Dr, n.style.overflow = "hidden", n.style.overflowWrap = "break-word", n.style.height = "0", n.setAttribute(F, ""), e !== void 0 && t !== void 0 && (n.setAttribute(I, String(e)), n.setAttribute(L, String(t)));
2061
2070
  let r = document.createElement("div");
2062
- return r.setAttribute(R, ""), r.setAttribute(k.nestedBlocks, ""), r.style.display = "flex", r.style.flexDirection = "column", r.style.minHeight = "100%", n.appendChild(r), n;
2071
+ return r.setAttribute(z, ""), r.setAttribute(k.nestedBlocks, ""), r.style.display = "flex", r.style.flexDirection = "column", r.style.minHeight = "100%", n.appendChild(r), n;
2063
2072
  }
2064
- }, L = (e) => typeof e == "object" && !!e && "blocks" in e, R = "data-blok-table-cell-blocks", jr = class {
2073
+ }, R = (e) => typeof e == "object" && !!e && "blocks" in e, z = "data-blok-table-cell-blocks", jr = class {
2065
2074
  constructor(e) {
2066
2075
  var t;
2067
2076
  this._activeCellWithBlocks = null, this.cellsPendingCheck = /* @__PURE__ */ new Set(), this.pendingCheckScheduled = !1, this.removedBlockCells = /* @__PURE__ */ new Map(), this.deferredEvents = [], this.isExitingTable = !1, this.handleBlockMutation = (e) => {
@@ -2087,9 +2096,9 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2087
2096
  this.claimBlockForCell(i.cell, n.target.id), this.syncBlockToModel(i.cell, n.target.id), this.cellsPendingCheck.delete(i.cell);
2088
2097
  return;
2089
2098
  }
2090
- let a = n.target.holder, o = a.closest(`[${R}]`);
2099
+ let a = n.target.holder, o = a.closest(`[${z}]`);
2091
2100
  o && this.stripPlaceholders(o);
2092
- let s = o && !this.model.findCellForBlock(n.target.id) ? o.closest(`[${P}]`) : null;
2101
+ let s = o && !this.model.findCellForBlock(n.target.id) ? o.closest(`[${F}]`) : null;
2093
2102
  if (s && this.syncBlockToModel(s, n.target.id), o) return;
2094
2103
  if (!this.gridElement.contains(a)) {
2095
2104
  let e = this.api.blocks.getBlockIndex(this.tableBlockId), t = e === void 0 ? null : this.api.blocks.getBlockByIndex(e);
@@ -2105,11 +2114,11 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2105
2114
  }, this.handleCellBlankSpaceClick = (e) => {
2106
2115
  let t = e.target;
2107
2116
  if (!t) return;
2108
- let n = t.hasAttribute(P), r = t.hasAttribute(R);
2117
+ let n = t.hasAttribute(F), r = t.hasAttribute(z);
2109
2118
  if (!n && !r) return;
2110
- let i = n ? t : t.closest(`[${P}]`);
2119
+ let i = n ? t : t.closest(`[${F}]`);
2111
2120
  if (!i) return;
2112
- let a = n ? i.querySelector(`[${R}]`) : t;
2121
+ let a = n ? i.querySelector(`[${z}]`) : t;
2113
2122
  if (!a) return;
2114
2123
  let o = a.querySelectorAll("[data-blok-id]"), s = o[o.length - 1];
2115
2124
  if (!s) return;
@@ -2207,7 +2216,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2207
2216
  this.clearActiveCellWithBlocks();
2208
2217
  let r = this.getCell(e.row, e.col);
2209
2218
  if (!r) return;
2210
- let i = r.querySelector(`[${R}]`);
2219
+ let i = r.querySelector(`[${z}]`);
2211
2220
  if (!i) return;
2212
2221
  let a = i.querySelectorAll("[contenteditable=\"true\"]");
2213
2222
  a.length !== 0 && ((t ? a[a.length - 1] : a[0]).focus(), (n = this.onNavigateToCell) == null || n.call(this, e));
@@ -2228,21 +2237,21 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2228
2237
  return r ? (n = r.querySelector(`[data-blok-table-cell-col="${t}"]`)) == null ? null : n : null;
2229
2238
  }
2230
2239
  initializeCells(e) {
2231
- let t = this.gridElement.querySelectorAll(`[${N}]`), n = [];
2240
+ let t = this.gridElement.querySelectorAll(`[${P}]`), n = [];
2232
2241
  return e.forEach((e, r) => {
2233
2242
  let i = t[r];
2234
2243
  if (!i) return;
2235
2244
  let a = [];
2236
2245
  e.forEach((e, t) => {
2237
- let n = i.querySelector(`[${I}="${t}"]`);
2246
+ let n = i.querySelector(`[${L}="${t}"]`);
2238
2247
  if (!n) return;
2239
- let r = n.querySelector(`[${R}]`);
2248
+ let r = n.querySelector(`[${z}]`);
2240
2249
  if (!r) return;
2241
- let o = L(e) && e.blocks.length > 0 ? [...e.blocks] : null, { mountedIds: s, replacements: c } = o ? this.mountBlocksInCell(r, o) : {
2250
+ let o = R(e) && e.blocks.length > 0 ? [...e.blocks] : null, { mountedIds: s, replacements: c } = o ? this.mountBlocksInCell(r, o) : {
2242
2251
  mountedIds: [],
2243
2252
  replacements: /* @__PURE__ */ new Map()
2244
2253
  }, l = {};
2245
- if (L(e) && (e.color !== void 0 && (l.color = e.color), e.textColor !== void 0 && (l.textColor = e.textColor)), s.length > 0) {
2254
+ if (R(e) && (e.color !== void 0 && (l.color = e.color), e.textColor !== void 0 && (l.textColor = e.textColor)), s.length > 0) {
2246
2255
  let e = o == null ? s : o, t = c.size > 0 ? e.map((e) => {
2247
2256
  var t;
2248
2257
  return (t = c.get(e)) == null ? e : t;
@@ -2290,7 +2299,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2290
2299
  }
2291
2300
  claimBlockForCell(e, t) {
2292
2301
  var n, r;
2293
- let i = e.querySelector(`[${R}]`);
2302
+ let i = e.querySelector(`[${z}]`);
2294
2303
  if (!i) return;
2295
2304
  let a = this.api.blocks.getBlockIndex(t);
2296
2305
  if (a === void 0) return;
@@ -2304,12 +2313,12 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2304
2313
  }
2305
2314
  findCellForAdjacentBlock(e) {
2306
2315
  if (e < 0 || e >= this.api.blocks.getBlocksCount()) return null;
2307
- let t = this.api.blocks.getBlockByIndex(e), n = t == null ? void 0 : t.holder.closest(`[${P}]`);
2316
+ let t = this.api.blocks.getBlockByIndex(e), n = t == null ? void 0 : t.holder.closest(`[${F}]`);
2308
2317
  return n && this.gridElement.contains(n) ? n : null;
2309
2318
  }
2310
2319
  ensureCellHasBlock(e) {
2311
2320
  var t, n;
2312
- let r = e.querySelector(`[${R}]`);
2321
+ let r = e.querySelector(`[${z}]`);
2313
2322
  r && r.querySelector("[data-blok-id]") === null && ((t = (n = this.api.blocks).transactWithoutCapture) == null || t.call(n, () => {
2314
2323
  let t = this.api.blocks.insert("paragraph", { text: "" }, {}, this.api.blocks.getBlocksCount(), !0);
2315
2324
  r.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId), this.syncBlockToModel(e, t.id), this.stripPlaceholders(r);
@@ -2335,11 +2344,11 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2335
2344
  n && this.model.addBlockToCell(n.row, n.col, t);
2336
2345
  }
2337
2346
  getCellPosition(e) {
2338
- let t = e.closest(`[${N}]`);
2347
+ let t = e.closest(`[${P}]`);
2339
2348
  if (!t) return null;
2340
- let n = Array.from(this.gridElement.querySelectorAll(`[${N}]`)).indexOf(t);
2349
+ let n = Array.from(this.gridElement.querySelectorAll(`[${P}]`)).indexOf(t);
2341
2350
  if (n < 0) return null;
2342
- let r = Array.from(t.querySelectorAll(`[${P}]`)).indexOf(e);
2351
+ let r = Array.from(t.querySelectorAll(`[${F}]`)).indexOf(e);
2343
2352
  return r < 0 ? null : {
2344
2353
  row: n,
2345
2354
  col: r
@@ -2347,7 +2356,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2347
2356
  }
2348
2357
  recordRemovedBlockCell(e) {
2349
2358
  if (e.index === void 0) return;
2350
- let t = e.target.holder.closest(`[${P}]`);
2359
+ let t = e.target.holder.closest(`[${F}]`);
2351
2360
  t && this.gridElement.contains(t) && this.removedBlockCells.set(e.target.id, {
2352
2361
  cell: t,
2353
2362
  index: e.index
@@ -2395,7 +2404,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2395
2404
  getBlockIdsFromCells(e) {
2396
2405
  let t = [];
2397
2406
  return Array.from(e).forEach((e) => {
2398
- let n = e.querySelector(`[${R}]`);
2407
+ let n = e.querySelector(`[${z}]`);
2399
2408
  n && n.querySelectorAll("[data-blok-id]").forEach((e) => {
2400
2409
  let n = e.getAttribute("data-blok-id");
2401
2410
  n && t.push(n);
@@ -2409,7 +2418,7 @@ var Qt = "outline-hidden py-[7px] mt-[2px] mb-px", $t = "outline-hidden pl-0.5 l
2409
2418
  });
2410
2419
  }
2411
2420
  deleteAllBlocks() {
2412
- let e = this.gridElement.querySelectorAll(`[${P}]`), t = this.getBlockIdsFromCells(e);
2421
+ let e = this.gridElement.querySelectorAll(`[${F}]`), t = this.getBlockIdsFromCells(e);
2413
2422
  this.deleteBlocks(t);
2414
2423
  }
2415
2424
  destroy() {
@@ -2613,7 +2622,7 @@ var Ir = (e) => {
2613
2622
  t !== 0 && this.showProgrammaticSelection(e, 0, e, t - 1);
2614
2623
  }
2615
2624
  selectColumn(e) {
2616
- let t = this.grid.querySelectorAll(`[${N}]`).length;
2625
+ let t = this.grid.querySelectorAll(`[${P}]`).length;
2617
2626
  t !== 0 && this.showProgrammaticSelection(0, e, t - 1, e);
2618
2627
  }
2619
2628
  clearActiveSelection() {
@@ -2747,7 +2756,7 @@ var Ir = (e) => {
2747
2756
  minCol: n,
2748
2757
  maxCol: r
2749
2758
  });
2750
- let { minRow: i, maxRow: a, minCol: o, maxCol: s } = this.lastPaintedRange, c = this.grid.querySelectorAll(`[${N}]`);
2759
+ let { minRow: i, maxRow: a, minCol: o, maxCol: s } = this.lastPaintedRange, c = this.grid.querySelectorAll(`[${P}]`);
2751
2760
  this.selectedCells = this.collectCellsInRange(c, i, a, o, s), this.selectedCells.forEach((e) => {
2752
2761
  e.setAttribute(Jr, "");
2753
2762
  });
@@ -2759,7 +2768,7 @@ var Ir = (e) => {
2759
2768
  repositionOverlay() {
2760
2769
  let e = this.lastPaintedRange;
2761
2770
  if (!e || !this.overlay) return;
2762
- let t = this.grid.querySelectorAll(`[${N}]`), n = this.findCellByCoordOrIndex(t, e.minRow, e.minCol), r = this.findCellByCoordOrIndex(t, e.maxRow, e.maxCol);
2771
+ let t = this.grid.querySelectorAll(`[${P}]`), n = this.findCellByCoordOrIndex(t, e.minRow, e.minCol), r = this.findCellByCoordOrIndex(t, e.maxRow, e.maxCol);
2763
2772
  if (!n || !r) return;
2764
2773
  let i = this.grid.getBoundingClientRect(), a = n.getBoundingClientRect(), o = r.getBoundingClientRect(), s = getComputedStyle(this.grid), c = parseFloat(s.borderTopWidth) || 0, l = parseFloat(s.borderLeftWidth) || 0, u = o.right - a.left + 1, d = o.bottom - a.top + 1, f = a.top - i.top - c - 1, p = a.left - i.left - l - 1;
2765
2774
  this.overlay.style.top = `${f}px`, this.overlay.style.left = `${p}px`, this.overlay.style.width = `${u}px`, this.overlay.style.height = `${d}px`, this.pill && (this.pill.style.left = `${p + u - 1}px`, this.pill.style.top = `${f + d / 2}px`);
@@ -2913,11 +2922,11 @@ var Ir = (e) => {
2913
2922
  }
2914
2923
  }
2915
2924
  resolveCellCoord(e) {
2916
- let t = e.closest(`[${P}]`);
2925
+ let t = e.closest(`[${F}]`);
2917
2926
  if (!t) return null;
2918
- let n = t.closest(`[${N}]`);
2927
+ let n = t.closest(`[${P}]`);
2919
2928
  if (!n || !this.grid.contains(n)) return null;
2920
- let r = t.getAttribute(F), i = t.getAttribute(I);
2929
+ let r = t.getAttribute(I), i = t.getAttribute(L);
2921
2930
  if (r !== null && i !== null) {
2922
2931
  let e = parseInt(r, 10), t = parseInt(i, 10);
2923
2932
  if (!isNaN(e) && !isNaN(t)) return {
@@ -2925,9 +2934,9 @@ var Ir = (e) => {
2925
2934
  col: t
2926
2935
  };
2927
2936
  }
2928
- let a = Array.from(this.grid.querySelectorAll(`[${N}]`)).indexOf(n);
2937
+ let a = Array.from(this.grid.querySelectorAll(`[${P}]`)).indexOf(n);
2929
2938
  if (a < 0) return null;
2930
- let o = Array.from(n.querySelectorAll(`[${P}]`)).indexOf(t);
2939
+ let o = Array.from(n.querySelectorAll(`[${F}]`)).indexOf(t);
2931
2940
  return o < 0 ? null : {
2932
2941
  row: a,
2933
2942
  col: o
@@ -2936,7 +2945,7 @@ var Ir = (e) => {
2936
2945
  clampExtentToEdge(e) {
2937
2946
  var t, n, r, i;
2938
2947
  if (!this.anchorCell || !this.isSelecting) return;
2939
- let a = this.grid.getBoundingClientRect(), o = this.grid.querySelectorAll(`[${N}]`).length, s = this.getLogicalColumnCount();
2948
+ let a = this.grid.getBoundingClientRect(), o = this.grid.querySelectorAll(`[${P}]`).length, s = this.getLogicalColumnCount();
2940
2949
  if (o === 0 || s === 0) return;
2941
2950
  let c = {
2942
2951
  row: this.clampAxis(e.clientY, a.top, a.bottom, o, (t = (n = this.extentCell) == null ? void 0 : n.row) == null ? this.anchorCell.row : t),
@@ -2946,12 +2955,12 @@ var Ir = (e) => {
2946
2955
  }
2947
2956
  collectCellsInRange(e, t, n, r, i) {
2948
2957
  if (this.grid.querySelector("[data-blok-table-cell-row]") === null) return Array.from(e).slice(t, n + 1).flatMap((e) => {
2949
- let t = e.querySelectorAll(`[${P}]`);
2958
+ let t = e.querySelectorAll(`[${F}]`);
2950
2959
  return Array.from(t).slice(r, i + 1).filter((e) => e instanceof HTMLElement);
2951
2960
  });
2952
- let a = this.grid.querySelectorAll(`[${P}]`);
2961
+ let a = this.grid.querySelectorAll(`[${F}]`);
2953
2962
  return Array.from(a).filter((e) => {
2954
- let a = e.getAttribute(F), o = e.getAttribute(I);
2963
+ let a = e.getAttribute(I), o = e.getAttribute(L);
2955
2964
  if (a === null || o === null) return !1;
2956
2965
  let s = Number(a), c = Number(o), l = e, u = s + (l.rowSpan || 1) - 1, d = c + (l.colSpan || 1) - 1;
2957
2966
  return s <= n && u >= t && c <= i && d >= r;
@@ -2959,8 +2968,8 @@ var Ir = (e) => {
2959
2968
  }
2960
2969
  findCellByCoordOrIndex(e, t, n) {
2961
2970
  var r, i, a;
2962
- return this.grid.querySelector(`[${F}="${t}"][${I}="${n}"]`) || ((r = e[t]) == null ? void 0 : r.querySelectorAll(`[${P}]`)[n]) || Array.from((i = (a = e[t]) == null ? void 0 : a.querySelectorAll("[data-blok-table-cell]")) == null ? [] : i).find((e) => {
2963
- let t = Number(e.getAttribute(I)), r = e.colSpan || 1;
2971
+ return this.grid.querySelector(`[${I}="${t}"][${L}="${n}"]`) || ((r = e[t]) == null ? void 0 : r.querySelectorAll(`[${F}]`)[n]) || Array.from((i = (a = e[t]) == null ? void 0 : a.querySelectorAll("[data-blok-table-cell]")) == null ? [] : i).find((e) => {
2972
+ let t = Number(e.getAttribute(L)), r = e.colSpan || 1;
2964
2973
  return t <= n && t + r - 1 >= n;
2965
2974
  });
2966
2975
  }
@@ -2968,22 +2977,22 @@ var Ir = (e) => {
2968
2977
  var e, t;
2969
2978
  let n = (e = this.grid.querySelector("colgroup")) == null ? void 0 : e.querySelectorAll("col").length;
2970
2979
  if (n !== void 0 && n > 0) return n;
2971
- let r = this.grid.querySelector(`[${N}]`);
2980
+ let r = this.grid.querySelector(`[${P}]`);
2972
2981
  return (t = r == null ? void 0 : r.querySelectorAll("[data-blok-table-cell]").length) == null ? 0 : t;
2973
2982
  }
2974
2983
  clampAxis(e, t, n, r, i) {
2975
2984
  return e < t ? 0 : e > n ? r - 1 : i;
2976
2985
  }
2977
- }, z = (e) => {
2986
+ }, B = (e) => {
2978
2987
  let t = e.querySelector("colgroup");
2979
2988
  if (!t) return [];
2980
2989
  let n = t.querySelectorAll("col"), r = n[0];
2981
2990
  if (r && r.style.width.endsWith("%")) {
2982
- let t = e.querySelector(`[${N}]`);
2983
- if (t) return Array.from(t.querySelectorAll(`[${P}]`)).map((e) => Math.round(e.getBoundingClientRect().width));
2991
+ let t = e.querySelector(`[${P}]`);
2992
+ if (t) return Array.from(t.querySelectorAll(`[${F}]`)).map((e) => Math.round(e.getBoundingClientRect().width));
2984
2993
  }
2985
2994
  return Array.from(n).map((e) => parseFloat(e.style.width) || 0);
2986
- }, B = (e, t) => {
2995
+ }, V = (e, t) => {
2987
2996
  let n = t.reduce((e, t) => e + t, 0), r = e;
2988
2997
  r.style.width = `${n + 1}px`;
2989
2998
  let i = e.querySelector("colgroup");
@@ -2993,24 +3002,24 @@ var Ir = (e) => {
2993
3002
  t < a.length && (a[t].style.width = `${e}px`);
2994
3003
  });
2995
3004
  }, ri = (e, t) => {
2996
- let n = Array.from(e.querySelectorAll(`[${N}]`)), r = n.findIndex((e) => Array.from(e.querySelectorAll(`[${P}]`)).includes(t));
3005
+ let n = Array.from(e.querySelectorAll(`[${P}]`)), r = n.findIndex((e) => Array.from(e.querySelectorAll(`[${F}]`)).includes(t));
2997
3006
  return r === -1 ? null : {
2998
3007
  row: r,
2999
- col: Array.from(n[r].querySelectorAll(`[${P}]`)).indexOf(t)
3008
+ col: Array.from(n[r].querySelectorAll(`[${F}]`)).indexOf(t)
3000
3009
  };
3001
3010
  }, ii = (e) => {
3002
3011
  var t;
3003
- let n = e.querySelector(`[${R}]`);
3012
+ let n = e.querySelector(`[${z}]`);
3004
3013
  return n ? ((t = n.textContent) == null ? "" : t).trim().length === 0 : !0;
3005
3014
  }, ai = (e, t) => {
3006
- let n = e.querySelectorAll(`[${N}]`)[t];
3015
+ let n = e.querySelectorAll(`[${P}]`)[t];
3007
3016
  if (!n) return !0;
3008
- let r = n.querySelectorAll(`[${P}]`);
3017
+ let r = n.querySelectorAll(`[${F}]`);
3009
3018
  return Array.from(r).every((e) => ii(e));
3010
3019
  }, oi = (e, t) => {
3011
- let n = e.querySelectorAll(`[${N}]`);
3020
+ let n = e.querySelectorAll(`[${P}]`);
3012
3021
  return Array.from(n).every((e) => {
3013
- let n = e.querySelector(`[${I}="${t}"]`);
3022
+ let n = e.querySelector(`[${L}="${t}"]`);
3014
3023
  return !n || ii(n);
3015
3024
  });
3016
3025
  }, si = (e) => {
@@ -3032,40 +3041,40 @@ var Ir = (e) => {
3032
3041
  let n = [...e];
3033
3042
  return n.splice(t, 1), n.length > 0 ? n : void 0;
3034
3043
  }, ui = (e, t, n, r, i) => {
3035
- let a = n == null ? z(e) : n, o = r === void 0 ? V(a) : Math.round(r / 2 * 100) / 100;
3044
+ let a = n == null ? B(e) : n, o = r === void 0 ? H(a) : Math.round(r / 2 * 100) / 100;
3036
3045
  i.addColumn(e, t, a, o);
3037
3046
  let s = [...a];
3038
3047
  return s.splice(t, 0, o), s;
3039
- }, V = (e) => Math.round(e.reduce((e, t) => e + t, 0) / e.length / 2 * 100) / 100, di = (e) => e.length === 0 ? 0 : Math.round(e.reduce((e, t) => e + t, 0) / e.length * 100) / 100, fi = (e, t, n) => {
3048
+ }, H = (e) => Math.round(e.reduce((e, t) => e + t, 0) / e.length / 2 * 100) / 100, di = (e) => e.length === 0 ? 0 : Math.round(e.reduce((e, t) => e + t, 0) / e.length * 100) / 100, fi = (e, t, n) => {
3040
3049
  var r;
3041
3050
  if (!e) return [];
3042
- let i = e.querySelectorAll(`[${N}]`)[n];
3051
+ let i = e.querySelectorAll(`[${P}]`)[n];
3043
3052
  return i ? (r = t == null ? void 0 : t.getBlockIdsFromCells(i.querySelectorAll("[data-blok-table-cell]"))) == null ? [] : r : [];
3044
3053
  }, pi = (e, t, n) => {
3045
3054
  var r;
3046
3055
  if (!e) return [];
3047
- let i = e.querySelectorAll(`[${N}]`), a = [];
3056
+ let i = e.querySelectorAll(`[${P}]`), a = [];
3048
3057
  return i.forEach((e) => {
3049
- let t = e.querySelector(`[${I}="${n}"]`);
3058
+ let t = e.querySelector(`[${L}="${n}"]`);
3050
3059
  t && a.push(t);
3051
3060
  }), (r = t == null ? void 0 : t.getBlockIdsFromCells(a)) == null ? [] : r;
3052
- }, H = (e, t) => {
3053
- e.querySelectorAll(`[${P}]`).forEach((e) => {
3061
+ }, U = (e, t) => {
3062
+ e.querySelectorAll(`[${F}]`).forEach((e) => {
3054
3063
  t == null || t.ensureCellHasBlock(e);
3055
3064
  });
3056
3065
  }, mi = (e, t, n, r) => {
3057
- let i = e.querySelectorAll(`[${N}]`);
3066
+ let i = e.querySelectorAll(`[${P}]`);
3058
3067
  t.forEach((e, t) => {
3059
3068
  let a = i[t];
3060
3069
  a && e.forEach((e, t) => {
3061
3070
  var i;
3062
- let o = a.querySelector(`[${I}="${t}"]`);
3071
+ let o = a.querySelector(`[${L}="${t}"]`);
3063
3072
  if (!o) return;
3064
- let s = o.querySelector(`[${R}]`);
3073
+ let s = o.querySelector(`[${z}]`);
3065
3074
  if (!s) return;
3066
3075
  let c = s.querySelectorAll("[data-blok-id]").length > 0;
3067
- if (!(!L(e) && c)) {
3068
- if (!L(e)) {
3076
+ if (!(!R(e) && c)) {
3077
+ if (!R(e)) {
3069
3078
  let t = document.createElement("div");
3070
3079
  t.className = "leading-[1.5]", t.innerHTML = e, s.replaceChildren(t);
3071
3080
  return;
@@ -3075,7 +3084,7 @@ var Ir = (e) => {
3075
3084
  let e = n.blocks.getBlockIndex(t);
3076
3085
  if (e === void 0) continue;
3077
3086
  let i = n.blocks.getBlockByIndex(e);
3078
- if (i && i.parentId === r) {
3087
+ if (i && !(i.parentId !== null && i.parentId !== void 0 && i.parentId !== r)) {
3079
3088
  if (i.holder.closest(`[${k.nestedBlocks}]`)) {
3080
3089
  s.appendChild(i.holder.cloneNode(!0));
3081
3090
  continue;
@@ -3113,7 +3122,7 @@ var Ir = (e) => {
3113
3122
  };
3114
3123
  }, gi = (e, t) => {
3115
3124
  let n = (n) => {
3116
- let r = n.target.closest(`[${P}]`);
3125
+ let r = n.target.closest(`[${F}]`);
3117
3126
  if (!r) return;
3118
3127
  let i = ri(e, r);
3119
3128
  i && (t == null || t.handleKeyDown(n, i));
@@ -3123,35 +3132,35 @@ var Ir = (e) => {
3123
3132
  };
3124
3133
  }, _i = ["overflow-x-auto", "overflow-y-hidden"], vi = (e) => {
3125
3134
  e == null || e.classList.add(..._i);
3126
- }, U = (e, t) => {
3135
+ }, W = (e, t) => {
3127
3136
  if (!e) return;
3128
- let n = e.querySelectorAll(`[${N}]`);
3137
+ let n = e.querySelectorAll(`[${P}]`);
3129
3138
  n.forEach((e) => {
3130
3139
  e.removeAttribute("data-blok-table-heading");
3131
3140
  }), t && n.length > 0 && n[0].setAttribute("data-blok-table-heading", "");
3132
3141
  }, yi = (e, t) => {
3133
- let n = e.querySelectorAll(`[${N}]`);
3142
+ let n = e.querySelectorAll(`[${P}]`);
3134
3143
  t.forEach((e, t) => {
3135
3144
  t >= n.length || e.forEach((e, r) => {
3136
- let i = n[t].querySelector(`[${I}="${r}"]`);
3137
- i && (L(e) && e.color ? i.style.backgroundColor = e.color : i.style.backgroundColor = "", L(e) && e.textColor ? i.style.color = e.textColor : i.style.color = "");
3145
+ let i = n[t].querySelector(`[${L}="${r}"]`);
3146
+ i && (R(e) && e.color ? i.style.backgroundColor = e.color : i.style.backgroundColor = "", R(e) && e.textColor ? i.style.color = e.textColor : i.style.color = "");
3138
3147
  });
3139
3148
  });
3140
3149
  }, bi = (e, t) => {
3141
- let n = e.querySelectorAll(`[${N}]`);
3150
+ let n = e.querySelectorAll(`[${P}]`);
3142
3151
  t.forEach((e, t) => {
3143
3152
  t >= n.length || e.forEach((e, r) => {
3144
- let i = n[t].querySelector(`[${I}="${r}"]`);
3153
+ let i = n[t].querySelector(`[${L}="${r}"]`);
3145
3154
  if (!i) return;
3146
- let a = i.querySelector(`[${R}]`);
3147
- a && (L(e) && e.placement && e.placement !== "top-left" ? a.setAttribute("data-blok-cell-placement", e.placement) : a.removeAttribute("data-blok-cell-placement"));
3155
+ let a = i.querySelector(`[${z}]`);
3156
+ a && (R(e) && e.placement && e.placement !== "top-left" ? a.setAttribute("data-blok-cell-placement", e.placement) : a.removeAttribute("data-blok-cell-placement"));
3148
3157
  });
3149
3158
  });
3150
- }, W = (e, t) => {
3151
- e && (e.querySelectorAll(`[${P}]`).forEach((e) => {
3159
+ }, G = (e, t) => {
3160
+ e && (e.querySelectorAll(`[${F}]`).forEach((e) => {
3152
3161
  e.removeAttribute("data-blok-table-heading-col");
3153
- }), t && e.querySelectorAll(`[${N}]`).forEach((e) => {
3154
- let t = e.querySelector(`[${P}]`);
3162
+ }), t && e.querySelectorAll(`[${P}]`).forEach((e) => {
3163
+ let t = e.querySelector(`[${F}]`);
3155
3164
  t && t.setAttribute("data-blok-table-heading-col", "");
3156
3165
  }));
3157
3166
  }, xi = (e) => !!(/^#[0-9a-f]{3,4}$/i.test(e) || /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(e) || /^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*(,\s*[\d.]+\s*)?\)$/i.test(e) || /^hsla?\(\s*[\d.]+\s*,\s*[\d.]+%\s*,\s*[\d.]+%\s*(,\s*[\d.]+\s*)?\)$/i.test(e) || e === "transparent"), Si = class {
@@ -3681,7 +3690,7 @@ var Ir = (e) => {
3681
3690
  return !e || !Array.isArray(e) ? [] : e.map((e) => (e == null ? [] : e).map((e) => this.normalizeCell(e)));
3682
3691
  }
3683
3692
  normalizeCell(e) {
3684
- if (L(e)) {
3693
+ if (R(e)) {
3685
3694
  let t = { blocks: [...e.blocks] };
3686
3695
  return e.color !== void 0 && xi(e.color) && (t.color = e.color), e.textColor !== void 0 && xi(e.textColor) && (t.textColor = e.textColor), e.placement !== void 0 && (t.placement = e.placement), e.colspan !== void 0 && e.colspan > 1 && (t.colspan = e.colspan), e.rowspan !== void 0 && e.rowspan > 1 && (t.rowspan = e.rowspan), e.mergedInto !== void 0 && (t.mergedInto = [...e.mergedInto]), t;
3687
3696
  }
@@ -3792,7 +3801,7 @@ var Ir = (e) => {
3792
3801
  }
3793
3802
  });
3794
3803
  }
3795
- }, Di = (e, t, n) => (n.grid.addRow(e, t), H(e, n.cellBlocks), {
3804
+ }, Di = (e, t, n) => (n.grid.addRow(e, t), U(e, n.cellBlocks), {
3796
3805
  pendingHighlight: {
3797
3806
  type: "row",
3798
3807
  index: t
@@ -3803,7 +3812,7 @@ var Ir = (e) => {
3803
3812
  withHeadingColumn: n.data.withHeadingColumn
3804
3813
  }), Oi = (e, t, n) => {
3805
3814
  let r = ui(e, t, n.data.colWidths, n.data.initialColWidth, n.grid);
3806
- return H(e, n.cellBlocks), {
3815
+ return U(e, n.cellBlocks), {
3807
3816
  pendingHighlight: {
3808
3817
  type: "col",
3809
3818
  index: t
@@ -3847,7 +3856,7 @@ var Ir = (e) => {
3847
3856
  var r, i;
3848
3857
  (r = n.cellBlocks) == null || r.deleteBlocks((i = n.blocksToDelete) == null ? [] : i), n.grid.deleteColumn(e, t);
3849
3858
  let a = li(n.data.colWidths, t);
3850
- return a ? B(e, a) : si(e), {
3859
+ return a ? V(e, a) : si(e), {
3851
3860
  pendingHighlight: {
3852
3861
  type: "col",
3853
3862
  index: t < n.grid.getColumnCount(e) ? t : t - 1
@@ -3894,8 +3903,8 @@ var Ir = (e) => {
3894
3903
  let n = e[e.length - 1], r = t.offsetWidth || parseFloat(t.style.width) || 0;
3895
3904
  return [...e, n + r];
3896
3905
  }, [0]);
3897
- let n = e.querySelector(`[${N}]`);
3898
- return n ? Array.from(n.querySelectorAll(`[${P}]`)).reduce((e, t) => {
3906
+ let n = e.querySelector(`[${P}]`);
3907
+ return n ? Array.from(n.querySelectorAll(`[${F}]`)).reduce((e, t) => {
3899
3908
  let n = e[e.length - 1];
3900
3909
  return [...e, n + t.offsetWidth];
3901
3910
  }, [0]) : [0];
@@ -3939,7 +3948,7 @@ var Ir = (e) => {
3939
3948
  this.grid.style.userSelect = "none", document.body.style.cursor = "grabbing", (e = this.onDragStateChange) == null || e.call(this, !0, this.dragType), this.highlightSourceCells(), this.createDropIndicator(), this.createGhost();
3940
3949
  }
3941
3950
  highlightSourceCells() {
3942
- let e = this.grid.querySelectorAll(`[${N}]`);
3951
+ let e = this.grid.querySelectorAll(`[${P}]`);
3943
3952
  if (this.dragType === "row") {
3944
3953
  this.highlightRowCells(e);
3945
3954
  return;
@@ -3950,7 +3959,7 @@ var Ir = (e) => {
3950
3959
  let t = e[this.dragFromIndex];
3951
3960
  if (!t) return;
3952
3961
  let n = this.getDragSourceBg();
3953
- t.querySelectorAll(`[${P}]`).forEach((e) => {
3962
+ t.querySelectorAll(`[${F}]`).forEach((e) => {
3954
3963
  let t = e;
3955
3964
  t.style.backgroundColor = n, t.style.opacity = "0.7", this.dragOverlayCells.push(t);
3956
3965
  });
@@ -3958,7 +3967,7 @@ var Ir = (e) => {
3958
3967
  highlightColumnCells(e) {
3959
3968
  let t = this.getDragSourceBg();
3960
3969
  e.forEach((e) => {
3961
- let n = e.querySelector(`[${I}="${this.dragFromIndex}"]`);
3970
+ let n = e.querySelector(`[${L}="${this.dragFromIndex}"]`);
3962
3971
  n && (n.style.backgroundColor = t, n.style.opacity = "0.7", this.dragOverlayCells.push(n));
3963
3972
  });
3964
3973
  }
@@ -3975,7 +3984,7 @@ var Ir = (e) => {
3975
3984
  let e = this.dropIndicator.style;
3976
3985
  if (e.position = "absolute", e.backgroundColor = "#3b82f6", e.borderRadius = "1.5px", e.zIndex = "5", e.pointerEvents = "none", this.dropIndicator.setAttribute("contenteditable", "false"), this.dragType === "row") e.height = "3px", e.left = "-1px", e.right = "0", e.transition = "top 100ms ease";
3977
3986
  else {
3978
- let t = this.grid.querySelectorAll(`[${N}]`), n = t[t.length - 1], r = n ? n.offsetTop + n.offsetHeight : 0;
3987
+ let t = this.grid.querySelectorAll(`[${P}]`), n = t[t.length - 1], r = n ? n.offsetTop + n.offsetHeight : 0;
3979
3988
  e.width = "3px", e.top = "-1px", e.height = `${r + 1}px`, e.transition = "left 100ms ease";
3980
3989
  }
3981
3990
  this.grid.appendChild(this.dropIndicator);
@@ -4037,22 +4046,22 @@ var Ir = (e) => {
4037
4046
  }
4038
4047
  getRowSourceRect() {
4039
4048
  var e;
4040
- let t = this.grid.querySelectorAll(`[${N}]`)[this.dragFromIndex];
4049
+ let t = this.grid.querySelectorAll(`[${P}]`)[this.dragFromIndex];
4041
4050
  return (e = t == null ? void 0 : t.getBoundingClientRect()) == null ? null : e;
4042
4051
  }
4043
4052
  getColSourceRect() {
4044
- let e = this.grid.querySelectorAll(`[${N}]`), t = e[0], n = e[e.length - 1];
4053
+ let e = this.grid.querySelectorAll(`[${P}]`), t = e[0], n = e[e.length - 1];
4045
4054
  if (!t || !n) return null;
4046
- let r = t.querySelector(`[${I}="${this.dragFromIndex}"]`), i = n.querySelector(`[${I}="${this.dragFromIndex}"]`);
4055
+ let r = t.querySelector(`[${L}="${this.dragFromIndex}"]`), i = n.querySelector(`[${L}="${this.dragFromIndex}"]`);
4047
4056
  if (!r || !i) return null;
4048
4057
  let a = r.getBoundingClientRect(), o = i.getBoundingClientRect();
4049
4058
  return new DOMRect(a.left, a.top, a.width, o.bottom - a.top);
4050
4059
  }
4051
4060
  buildRowGhost() {
4052
- let e = this.grid.querySelectorAll(`[${N}]`)[this.dragFromIndex];
4061
+ let e = this.grid.querySelectorAll(`[${P}]`)[this.dragFromIndex];
4053
4062
  if (!e || !this.ghostEl) return;
4054
4063
  let t = this.ghostEl.style;
4055
- t.display = "flex", t.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${P}]`).forEach((e) => {
4064
+ t.display = "flex", t.height = `${e.offsetHeight}px`, e.querySelectorAll(`[${F}]`).forEach((e) => {
4056
4065
  var t;
4057
4066
  let n = e, r = n.cloneNode(!0);
4058
4067
  r.style.width = `${n.offsetWidth}px`, r.style.flexShrink = "0", r.removeAttribute("contenteditable"), (t = this.ghostEl) == null || t.appendChild(r);
@@ -4060,10 +4069,10 @@ var Ir = (e) => {
4060
4069
  }
4061
4070
  buildColumnGhost() {
4062
4071
  if (!this.ghostEl) return;
4063
- let e = this.grid.querySelectorAll(`[${N}]`), t = this.ghostEl.style;
4072
+ let e = this.grid.querySelectorAll(`[${P}]`), t = this.ghostEl.style;
4064
4073
  t.display = "flex", t.flexDirection = "column", e.forEach((e) => {
4065
4074
  var t;
4066
- let n = e.querySelector(`[${I}="${this.dragFromIndex}"]`);
4075
+ let n = e.querySelector(`[${L}="${this.dragFromIndex}"]`);
4067
4076
  if (!n) return;
4068
4077
  let r = n.cloneNode(!0);
4069
4078
  r.style.width = `${n.offsetWidth}px`, r.style.height = `${n.offsetHeight}px`, r.removeAttribute("contenteditable"), (t = this.ghostEl) == null || t.appendChild(r);
@@ -4075,7 +4084,7 @@ var Ir = (e) => {
4075
4084
  this.dragType === "row" && (t.top = `${e.clientY - this.ghostOffsetY}px`), this.dragType === "col" && (t.left = `${e.clientX - this.ghostOffsetX}px`);
4076
4085
  }
4077
4086
  getRowDropIndex(e) {
4078
- let t = Array.from(this.grid.querySelectorAll(`[${N}]`)), n = t.map((e) => e.offsetTop);
4087
+ let t = Array.from(this.grid.querySelectorAll(`[${P}]`)), n = t.map((e) => e.offsetTop);
4079
4088
  if (t.length > 0) {
4080
4089
  let e = t[t.length - 1];
4081
4090
  n.push(e.offsetTop + e.offsetHeight);
@@ -4084,7 +4093,7 @@ var Ir = (e) => {
4084
4093
  return r.indexOf(i);
4085
4094
  }
4086
4095
  getRowDropTopPx(e) {
4087
- let t = this.grid.querySelectorAll(`[${N}]`);
4096
+ let t = this.grid.querySelectorAll(`[${P}]`);
4088
4097
  if (e < t.length) return t[e].offsetTop;
4089
4098
  if (t.length > 0) {
4090
4099
  let e = t[t.length - 1];
@@ -4329,7 +4338,7 @@ var Ir = (e) => {
4329
4338
  }
4330
4339
  handleUnlockGrip(e) {
4331
4340
  document.removeEventListener("pointerdown", this.boundUnlockGrip), this.lockedGrip && (this.applyIdleClasses(this.lockedGrip), this.lockedGrip = null);
4332
- let t = e.target instanceof HTMLElement ? e.target : null, n = t == null ? void 0 : t.closest(`[${P}]`);
4341
+ let t = e.target instanceof HTMLElement ? e.target : null, n = t == null ? void 0 : t.closest(`[${F}]`);
4333
4342
  if (n) {
4334
4343
  let e = this.getCellPosition(n);
4335
4344
  e && (this.clearHideTimeout(), this.showColGrip(e.col), this.showRowGrip(e.row), this.isInsideTable = !0);
@@ -4385,7 +4394,7 @@ var Ir = (e) => {
4385
4394
  }), n;
4386
4395
  }
4387
4396
  positionGrips() {
4388
- let e = this.grid.querySelectorAll(`[${N}]`);
4397
+ let e = this.grid.querySelectorAll(`[${P}]`);
4389
4398
  if (!e[0]) return;
4390
4399
  let t = Ii(this.grid), n = this.overlay && this.scrollContainer ? this.scrollContainer.scrollLeft : 0, r = this.overlay && this.scrollContainer ? this.scrollContainer.clientWidth : Infinity;
4391
4400
  this.colGrips.forEach((e, i) => {
@@ -4394,7 +4403,7 @@ var Ir = (e) => {
4394
4403
  o.top = `${-1 / 2}px`, o.left = `${a}px`, this.overlay && (o.visibility = a < 0 || a > r ? "hidden" : "");
4395
4404
  }), this.rowGrips.forEach((t, n) => {
4396
4405
  if (n >= e.length) return;
4397
- let r = e[n], i = this.grid.querySelectorAll(`[${F}="${n}"]`), a = Array.from(i).reduce((e, t) => {
4406
+ let r = e[n], i = this.grid.querySelectorAll(`[${I}="${n}"]`), a = Array.from(i).reduce((e, t) => {
4398
4407
  let n = t, r = e === null ? 0 : e.rowSpan || 1;
4399
4408
  return (n.rowSpan || 1) > r ? n : e;
4400
4409
  }, null);
@@ -4412,7 +4421,7 @@ var Ir = (e) => {
4412
4421
  var e;
4413
4422
  (e = this.rowResizeObserver) == null || e.disconnect(), this.rowResizeObserver = new ResizeObserver(() => {
4414
4423
  this.positionGrips();
4415
- }), this.grid.querySelectorAll(`[${N}]`).forEach((e) => {
4424
+ }), this.grid.querySelectorAll(`[${P}]`).forEach((e) => {
4416
4425
  var t;
4417
4426
  (t = this.rowResizeObserver) == null || t.observe(e);
4418
4427
  });
@@ -4422,7 +4431,7 @@ var Ir = (e) => {
4422
4431
  }
4423
4432
  handleMouseOver(e) {
4424
4433
  if (this.isGripInteractionLocked()) return;
4425
- let t = e.target.closest(`[${P}]`);
4434
+ let t = e.target.closest(`[${F}]`);
4426
4435
  if (!t) return;
4427
4436
  this.clearHideTimeout();
4428
4437
  let n = this.getCellPosition(t);
@@ -4432,7 +4441,7 @@ var Ir = (e) => {
4432
4441
  this.isGripInteractionLocked() || this.scheduleHideAll();
4433
4442
  }
4434
4443
  getCellPosition(e) {
4435
- let t = e.getAttribute(F), n = e.getAttribute(I);
4444
+ let t = e.getAttribute(I), n = e.getAttribute(L);
4436
4445
  if (t === null || n === null) return null;
4437
4446
  let r = parseInt(t, 10), i = parseInt(n, 10);
4438
4447
  return isNaN(r) || isNaN(i) ? null : {
@@ -4736,9 +4745,9 @@ var Ir = (e) => {
4736
4745
  e.forEach((e, i) => {
4737
4746
  e.forEach((e, a) => {
4738
4747
  if (typeof e == "string" || e.mergedInto) return;
4739
- let o = t.querySelector(`[${F}="${i}"][${I}="${a}"]`);
4748
+ let o = t.querySelector(`[${I}="${i}"][${L}="${a}"]`);
4740
4749
  if (!o) return;
4741
- let s = o.querySelector(`[${R}]`);
4750
+ let s = o.querySelector(`[${z}]`);
4742
4751
  s && e.blocks.forEach((e) => {
4743
4752
  let t = n.get(e);
4744
4753
  t && !r.has(e) && (s.appendChild(t), r.add(e));
@@ -4834,7 +4843,7 @@ var Ir = (e) => {
4834
4843
  var c;
4835
4844
  this.grid.fillGrid(s, (c = this.initialContent) == null ? [] : c);
4836
4845
  }
4837
- if (this.model.colWidths && B(s, this.model.colWidths), this.gridElement = s, this.model.colWidths || !this.readOnly) {
4846
+ if (this.model.colWidths && V(s, this.model.colWidths), this.gridElement = s, this.model.colWidths || !this.readOnly) {
4838
4847
  let e = document.createElement("div");
4839
4848
  e.setAttribute("data-blok-table-scroll", "");
4840
4849
  let t = this.model.colWidths ? _i : [];
@@ -4844,7 +4853,7 @@ var Ir = (e) => {
4844
4853
  let e = document.createElement("div");
4845
4854
  e.setAttribute("data-blok-table-grip-overlay", ""), e.style.position = "absolute", e.style.inset = "0", e.style.pointerEvents = "none", e.style.zIndex = "3", i.appendChild(e), this.gripOverlay = e;
4846
4855
  }
4847
- return this.element = i, this.model.withHeadings && U(this.gridElement, this.model.withHeadings), this.model.withHeadingColumn && W(this.gridElement, this.model.withHeadingColumn), this.readOnly || (this.initCellBlocks(s), this.keyboardNavCleanup = gi(s, this.cellBlocks)), i;
4856
+ return this.element = i, this.model.withHeadings && W(this.gridElement, this.model.withHeadings), this.model.withHeadingColumn && G(this.gridElement, this.model.withHeadingColumn), this.readOnly || (this.initCellBlocks(s), this.keyboardNavCleanup = gi(s, this.cellBlocks)), i;
4848
4857
  }
4849
4858
  rendered() {
4850
4859
  if (!this.element || this.initialContent === null) return;
@@ -4860,14 +4869,14 @@ var Ir = (e) => {
4860
4869
  }
4861
4870
  if (this.runTransactedStructuralOp(() => {
4862
4871
  var n, r;
4863
- let i = (n = (r = this.cellBlocks) == null ? void 0 : r.initializeCells(t)) == null ? t : n, a = this.isNewTable && i.length === 0 ? Array.from(e.querySelectorAll(`[${N}]`), (e) => {
4864
- let t = e.querySelectorAll(`[${P}]`).length;
4872
+ let i = (n = (r = this.cellBlocks) == null ? void 0 : r.initializeCells(t)) == null ? t : n, a = this.isNewTable && i.length === 0 ? Array.from(e.querySelectorAll(`[${P}]`), (e) => {
4873
+ let t = e.querySelectorAll(`[${F}]`).length;
4865
4874
  return Array.from({ length: t }, () => ({ blocks: [] }));
4866
4875
  }) : i;
4867
- this.model.replaceAll(A(A({}, this.model.snapshot()), {}, { content: a })), this.isNewTable && H(e, this.cellBlocks), this.removeGhostChildren();
4876
+ this.model.replaceAll(A(A({}, this.model.snapshot()), {}, { content: a })), this.isNewTable && U(e, this.cellBlocks), this.removeGhostChildren();
4868
4877
  }, !0), this.model.initialColWidth === void 0) {
4869
4878
  var r;
4870
- let t = (r = this.model.colWidths) == null ? z(e) : r;
4879
+ let t = (r = this.model.colWidths) == null ? B(e) : r;
4871
4880
  this.model.setInitialColWidth(t.length > 0 ? di(t) : void 0);
4872
4881
  }
4873
4882
  this.initSubsystems(e);
@@ -4905,7 +4914,7 @@ var Ir = (e) => {
4905
4914
  save(e) {
4906
4915
  let t = this.model.snapshot();
4907
4916
  return t.content = t.content.map((e) => e.map((e) => {
4908
- if (!L(e)) return e;
4917
+ if (!R(e)) return e;
4909
4918
  let t = e.blocks.filter((e) => {
4910
4919
  var t, n;
4911
4920
  let r = (t = (n = this.api.blocks).getById) == null ? void 0 : t.call(n, e);
@@ -4943,11 +4952,11 @@ var Ir = (e) => {
4943
4952
  let i = (e = (t = (n = this.cellBlocks) == null ? void 0 : n.initializeCells((r = this.initialContent) == null ? [] : r)) == null ? this.initialContent : t) == null ? [] : e;
4944
4953
  if (o === this.setDataGeneration) {
4945
4954
  if (this.api.blocks.isSyncingFromYjs && i.length === 0 && f) {
4946
- let e = Array.from(f.querySelectorAll(`[${N}]`), (e) => {
4947
- let t = e.querySelectorAll(`[${P}]`).length;
4955
+ let e = Array.from(f.querySelectorAll(`[${P}]`), (e) => {
4956
+ let t = e.querySelectorAll(`[${F}]`).length;
4948
4957
  return Array.from({ length: t }, () => ({ blocks: [] }));
4949
4958
  });
4950
- this.model.replaceAll(A(A({}, this.model.snapshot()), {}, { content: e })), H(f, this.cellBlocks);
4959
+ this.model.replaceAll(A(A({}, this.model.snapshot()), {}, { content: e })), U(f, this.cellBlocks);
4951
4960
  } else this.model.replaceAll(A(A({}, this.model.snapshot()), {}, { content: i }));
4952
4961
  this.initialContent = null;
4953
4962
  }
@@ -5038,20 +5047,20 @@ var Ir = (e) => {
5038
5047
  }),
5039
5048
  getNewColumnWidth: () => {
5040
5049
  var t;
5041
- let n = (t = this.model.colWidths) == null ? z(e) : t;
5042
- return this.model.initialColWidth === void 0 ? V(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5050
+ let n = (t = this.model.colWidths) == null ? B(e) : t;
5051
+ return this.model.initialColWidth === void 0 ? H(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5043
5052
  },
5044
5053
  onAddRow: () => {
5045
5054
  this.runTransactedStructuralOp(() => {
5046
5055
  var t, n;
5047
- this.grid.addRow(e), this.model.addRow(), H(e, this.cellBlocks), U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (t = this.addControls) == null || t.syncRowButtonWidth(), (n = this.rowColControls) == null || n.refresh();
5056
+ this.grid.addRow(e), this.model.addRow(), U(e, this.cellBlocks), W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (t = this.addControls) == null || t.syncRowButtonWidth(), (n = this.rowColControls) == null || n.refresh();
5048
5057
  });
5049
5058
  },
5050
5059
  onAddColumn: () => {
5051
5060
  this.runTransactedStructuralOp(() => {
5052
5061
  var t, n, r;
5053
- let i = (t = this.model.colWidths) == null ? z(e) : t, a = this.model.initialColWidth === void 0 ? V(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5054
- this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths([...i, a]), H(e, this.cellBlocks), W(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth), (r = this.addControls) == null || r.syncRowButtonWidth();
5062
+ let i = (t = this.model.colWidths) == null ? B(e) : t, a = this.model.initialColWidth === void 0 ? H(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5063
+ this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths([...i, a]), U(e, this.cellBlocks), G(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth), (r = this.addControls) == null || r.syncRowButtonWidth();
5055
5064
  });
5056
5065
  },
5057
5066
  onDragStart: () => {
@@ -5060,7 +5069,7 @@ var Ir = (e) => {
5060
5069
  },
5061
5070
  onDragAddRow: () => {
5062
5071
  this.runTransactedStructuralOp(() => {
5063
- this.grid.addRow(e), this.model.addRow(), H(e, this.cellBlocks), U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn);
5072
+ this.grid.addRow(e), this.model.addRow(), U(e, this.cellBlocks), W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn);
5064
5073
  });
5065
5074
  },
5066
5075
  onDragRemoveRow: () => {
@@ -5076,8 +5085,8 @@ var Ir = (e) => {
5076
5085
  onDragAddCol: () => {
5077
5086
  this.runTransactedStructuralOp(() => {
5078
5087
  var t;
5079
- let r = (t = this.model.colWidths) == null ? z(e) : t, i = this.model.initialColWidth === void 0 ? V(r) : Math.round(this.model.initialColWidth / 2 * 100) / 100, a = [...r, i];
5080
- this.grid.addColumn(e, void 0, r, i), this.model.addColumn(void 0, i), this.model.setColWidths(a), B(e, a), H(e, this.cellBlocks), W(this.gridElement, this.model.withHeadingColumn), this.initResize(e), n.addedCols++, this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth);
5088
+ let r = (t = this.model.colWidths) == null ? B(e) : t, i = this.model.initialColWidth === void 0 ? H(r) : Math.round(this.model.initialColWidth / 2 * 100) / 100, a = [...r, i];
5089
+ this.grid.addColumn(e, void 0, r, i), this.model.addColumn(void 0, i), this.model.setColWidths(a), V(e, a), U(e, this.cellBlocks), G(this.gridElement, this.model.withHeadingColumn), this.initResize(e), n.addedCols++, this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth);
5081
5090
  });
5082
5091
  },
5083
5092
  onDragRemoveCol: () => {
@@ -5088,7 +5097,7 @@ var Ir = (e) => {
5088
5097
  let { blocksToDelete: i } = this.model.deleteColumn(r - 1);
5089
5098
  (t = this.cellBlocks) == null || t.deleteBlocks(i), this.grid.deleteColumn(e, r - 1);
5090
5099
  let a = this.model.colWidths;
5091
- a && B(e, a), this.initResize(e), n.addedCols--;
5100
+ a && V(e, a), this.initResize(e), n.addedCols--;
5092
5101
  });
5093
5102
  },
5094
5103
  onDragEnd: () => {
@@ -5104,14 +5113,14 @@ var Ir = (e) => {
5104
5113
  gridEl: e,
5105
5114
  onAddRow: () => {
5106
5115
  this.runStructuralOp(() => {
5107
- this.grid.addRow(e), this.model.addRow(), H(e, this.cellBlocks), U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn);
5116
+ this.grid.addRow(e), this.model.addRow(), U(e, this.cellBlocks), W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn);
5108
5117
  });
5109
5118
  },
5110
5119
  onAddColumn: () => {
5111
5120
  this.runStructuralOp(() => {
5112
5121
  var t;
5113
- let n = (t = this.model.colWidths) == null ? z(e) : t, r = this.model.initialColWidth === void 0 ? V(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100, i = [...n, r];
5114
- this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths(i), B(e, i), vi(this.ensureScrollContainer()), H(e, this.cellBlocks), W(this.gridElement, this.model.withHeadingColumn);
5122
+ let n = (t = this.model.colWidths) == null ? B(e) : t, r = this.model.initialColWidth === void 0 ? H(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100, i = [...n, r];
5123
+ this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths(i), V(e, i), vi(this.ensureScrollContainer()), U(e, this.cellBlocks), G(this.gridElement, this.model.withHeadingColumn);
5115
5124
  });
5116
5125
  },
5117
5126
  onRemoveLastRow: () => {
@@ -5131,7 +5140,7 @@ var Ir = (e) => {
5131
5140
  let { blocksToDelete: r } = this.model.deleteColumn(n - 1);
5132
5141
  (t = this.cellBlocks) == null || t.deleteBlocks(r), this.grid.deleteColumn(e, n - 1);
5133
5142
  let i = this.model.colWidths;
5134
- i && B(e, i);
5143
+ i && V(e, i);
5135
5144
  });
5136
5145
  },
5137
5146
  onDragStart: () => {
@@ -5151,9 +5160,9 @@ var Ir = (e) => {
5151
5160
  onClickAdd: () => {
5152
5161
  this.runTransactedStructuralOp(() => {
5153
5162
  var t, n, r;
5154
- this.grid.addRow(e), this.model.addRow(), H(e, this.cellBlocks), U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn);
5155
- let i = (t = this.model.colWidths) == null ? z(e) : t, a = this.model.initialColWidth === void 0 ? V(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100, o = [...i, a];
5156
- this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths(o), B(e, o), H(e, this.cellBlocks), W(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), (r = this.addControls) == null || r.syncRowButtonWidth();
5163
+ this.grid.addRow(e), this.model.addRow(), U(e, this.cellBlocks), W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn);
5164
+ let i = (t = this.model.colWidths) == null ? B(e) : t, a = this.model.initialColWidth === void 0 ? H(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100, o = [...i, a];
5165
+ this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths(o), V(e, o), U(e, this.cellBlocks), G(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), (r = this.addControls) == null || r.syncRowButtonWidth();
5157
5166
  });
5158
5167
  }
5159
5168
  }));
@@ -5220,7 +5229,7 @@ var Ir = (e) => {
5220
5229
  blocksToDelete: o
5221
5230
  });
5222
5231
  if (n !== this.setDataGeneration || this.gridElement !== e) return;
5223
- if (this.model.setColWidths(s.colWidths), this.model.setWithHeadings(s.withHeadings), this.model.setWithHeadingColumn(s.withHeadingColumn), this.pendingHighlight = s.pendingHighlight, U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (r = this.addControls) == null || r.syncRowButtonWidth(), !(t.type === "toggle-heading" || t.type === "toggle-heading-column")) {
5232
+ if (this.model.setColWidths(s.colWidths), this.model.setWithHeadings(s.withHeadings), this.model.setWithHeadingColumn(s.withHeadingColumn), this.pendingHighlight = s.pendingHighlight, W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (r = this.addControls) == null || r.syncRowButtonWidth(), !(t.type === "toggle-heading" || t.type === "toggle-heading-column")) {
5224
5233
  var c;
5225
5234
  (c = this.rowColControls) == null || c.refresh();
5226
5235
  }
@@ -5266,7 +5275,7 @@ var Ir = (e) => {
5266
5275
  initResize(e) {
5267
5276
  var t, n;
5268
5277
  (t = this.resize) == null || t.destroy();
5269
- let r = this.model.colWidths === void 0, i = (n = this.model.colWidths) == null ? z(e) : n;
5278
+ let r = this.model.colWidths === void 0, i = (n = this.model.colWidths) == null ? B(e) : n;
5270
5279
  r || vi(this.ensureScrollContainer()), this.resize = new Ei(e, i, (e) => {
5271
5280
  var t, n, r;
5272
5281
  this.model.setColWidths(e), vi(this.ensureScrollContainer()), (t = this.rowColControls) == null || t.positionGrips(), (n = this.addControls) == null || n.syncRowButtonWidth(), (r = this.scrollHaze) == null || r.update();
@@ -5319,7 +5328,7 @@ var Ir = (e) => {
5319
5328
  let e = ri(n, r);
5320
5329
  if (!e) continue;
5321
5330
  this.model.setCellPlacement(e.row, e.col, t === "top-left" ? void 0 : t);
5322
- let i = r.querySelector(`[${R}]`);
5331
+ let i = r.querySelector(`[${z}]`);
5323
5332
  i && (t === "top-left" ? i.removeAttribute("data-blok-cell-placement") : i.setAttribute("data-blok-cell-placement", t));
5324
5333
  }
5325
5334
  });
@@ -5327,7 +5336,7 @@ var Ir = (e) => {
5327
5336
  collectCellBlockData(e) {
5328
5337
  return this.gridElement ? e.map((e) => {
5329
5338
  var t, n, r;
5330
- let i = parseInt((t = e.getAttribute("data-blok-table-cell-row")) == null ? "0" : t, 10), a = parseInt((n = e.getAttribute("data-blok-table-cell-col")) == null ? "0" : n, 10), o = e.querySelector(`[${R}]`), s = [];
5339
+ let i = parseInt((t = e.getAttribute("data-blok-table-cell-row")) == null ? "0" : t, 10), a = parseInt((n = e.getAttribute("data-blok-table-cell-col")) == null ? "0" : n, 10), o = e.querySelector(`[${z}]`), s = [];
5331
5340
  if (!o) return {
5332
5341
  row: i,
5333
5342
  col: a,
@@ -5443,7 +5452,7 @@ var Ir = (e) => {
5443
5452
  if (!s || o !== null && new DOMParser().parseFromString(i, "text/html").querySelectorAll("table").length > 1) return;
5444
5453
  let c = document.activeElement;
5445
5454
  if (!c) return;
5446
- let l = c.closest(`[${P}]`);
5455
+ let l = c.closest(`[${F}]`);
5447
5456
  if (!l || !t.contains(l) || !l.closest("[data-blok-table-row]")) return;
5448
5457
  if (s.rows === 1 && s.cols === 1) {
5449
5458
  e.preventDefault(), e.stopPropagation(), this.insertSingleCellPayloadInline(s.cells[0][0]);
@@ -5471,11 +5480,11 @@ var Ir = (e) => {
5471
5480
  this.runTransactedStructuralOp(() => {
5472
5481
  var i, a;
5473
5482
  this.expandGridForPaste(e, n + t.rows, r + t.cols);
5474
- let o = e.querySelectorAll(`[${N}]`);
5483
+ let o = e.querySelectorAll(`[${P}]`);
5475
5484
  Array.from({ length: t.rows }, (e, t) => t).forEach((e) => {
5476
5485
  let i = o[n + e];
5477
5486
  if (!i) return;
5478
- let a = i.querySelectorAll(`[${P}]`);
5487
+ let a = i.querySelectorAll(`[${F}]`);
5479
5488
  Array.from({ length: t.cols }, (e, t) => t).forEach((i) => {
5480
5489
  let o = a[r + i];
5481
5490
  if (o) {
@@ -5490,7 +5499,7 @@ var Ir = (e) => {
5490
5499
  });
5491
5500
  }), this.initResize(e), (i = this.addControls) == null || i.syncRowButtonWidth(), (a = this.rowColControls) == null || a.refresh();
5492
5501
  });
5493
- let i = e.querySelectorAll(`[${N}]`)[n + t.rows - 1], a = i == null ? void 0 : i.querySelectorAll(`[${P}]`)[r + t.cols - 1];
5502
+ let i = e.querySelectorAll(`[${P}]`)[n + t.rows - 1], a = i == null ? void 0 : i.querySelectorAll(`[${F}]`)[r + t.cols - 1];
5494
5503
  if (!a || !this.cellBlocks || !this.api.caret) return;
5495
5504
  let o = this.cellBlocks.getBlockIdsFromCells([a]), s = o[o.length - 1];
5496
5505
  s !== void 0 && this.api.caret.setToBlock(s, "end");
@@ -5498,11 +5507,11 @@ var Ir = (e) => {
5498
5507
  expandGridForPaste(e, t, n) {
5499
5508
  let r = this.grid.getRowCount(e), i = this.grid.getColumnCount(e);
5500
5509
  Array.from({ length: Math.max(0, t - r) }).forEach(() => {
5501
- this.grid.addRow(e), this.model.addRow(), H(e, this.cellBlocks), U(this.gridElement, this.model.withHeadings), W(this.gridElement, this.model.withHeadingColumn);
5510
+ this.grid.addRow(e), this.model.addRow(), U(e, this.cellBlocks), W(this.gridElement, this.model.withHeadings), G(this.gridElement, this.model.withHeadingColumn);
5502
5511
  }), Array.from({ length: Math.max(0, n - i) }).forEach(() => {
5503
5512
  var t;
5504
- let n = (t = this.model.colWidths) == null ? z(e) : t, r = this.model.initialColWidth === void 0 ? V(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5505
- this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths([...n, r]), H(e, this.cellBlocks), W(this.gridElement, this.model.withHeadingColumn);
5513
+ let n = (t = this.model.colWidths) == null ? B(e) : t, r = this.model.initialColWidth === void 0 ? H(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
5514
+ this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths([...n, r]), U(e, this.cellBlocks), G(this.gridElement, this.model.withHeadingColumn);
5506
5515
  });
5507
5516
  }
5508
5517
  pasteCellPayload(e, t) {
@@ -5510,7 +5519,7 @@ var Ir = (e) => {
5510
5519
  let t = this.cellBlocks.getBlockIdsFromCells([e]);
5511
5520
  this.cellBlocks.deleteBlocks(t);
5512
5521
  }
5513
- let n = e.querySelector(`[${R}]`);
5522
+ let n = e.querySelector(`[${z}]`);
5514
5523
  if (n) {
5515
5524
  if (t.blocks.length === 0) {
5516
5525
  var r;
@@ -5558,7 +5567,9 @@ var Ir = (e) => {
5558
5567
  }, Ta = class e {
5559
5568
  constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
5560
5569
  var a;
5561
- this._element = null, this._contentElement = null, this._arrowElement = null, this._bodyPlaceholderElement = null, this._childContainerElement = null, this.handleBlockChanged = (e) => {
5570
+ this._element = null, this._contentElement = null, this._arrowElement = null, this._bodyPlaceholderElement = null, this._childContainerElement = null, this.handleChildContainerInput = () => {
5571
+ zt(this._element, this._childContainerElement);
5572
+ }, this.handleBlockChanged = (e) => {
5562
5573
  this.isBlockChangedPayload(e) && (e.event.type === "block-removed" || e.event.type === "block-added") && this.updateBodyPlaceholderVisibility();
5563
5574
  }, this.api = n, this.readOnly = r, this._settings = t || {}, this._data = this.normalizeData(e), this._isOpen = (a = this._data.isOpen) == null ? !0 : a, i && (this.blockId = i.id), r || this.api.events.on("block changed", this.handleBlockChanged);
5564
5575
  }
@@ -5593,7 +5604,7 @@ var Ir = (e) => {
5593
5604
  expand: this.api.i18n.t($e)
5594
5605
  }
5595
5606
  });
5596
- return this._element = e.wrapper, this._contentElement = e.contentElement, this._arrowElement = e.arrowElement, this._bodyPlaceholderElement = e.bodyPlaceholderElement, this._childContainerElement = e.childContainerElement, this._element;
5607
+ return this._element = e.wrapper, this._contentElement = e.contentElement, this._arrowElement = e.arrowElement, this._bodyPlaceholderElement = e.bodyPlaceholderElement, this._childContainerElement = e.childContainerElement, this._childContainerElement.addEventListener("input", this.handleChildContainerInput), this._element;
5597
5608
  }
5598
5609
  rendered() {
5599
5610
  this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility();
@@ -5662,7 +5673,7 @@ var Ir = (e) => {
5662
5673
  this.blockId !== void 0 && Ht(this.api, this.blockId, this._isOpen, this._childContainerElement, this._arrowElement);
5663
5674
  }
5664
5675
  updateBodyPlaceholderVisibility() {
5665
- this.blockId !== void 0 && Ut(this._bodyPlaceholderElement, this.api, this.blockId, this._isOpen, this.readOnly);
5676
+ this.blockId !== void 0 && (Ut(this._bodyPlaceholderElement, this.api, this.blockId, this._isOpen, this.readOnly), zt(this._element, this._childContainerElement));
5666
5677
  }
5667
5678
  handleBodyPlaceholderClick() {
5668
5679
  var e;
@@ -5757,27 +5768,24 @@ var Ir = (e) => {
5757
5768
  static get isReadOnlySupported() {
5758
5769
  return !0;
5759
5770
  }
5760
- }, Ea = "callout", Da = "tools.callout.color", Oa = "tools.callout.editIcon", ka = "tools.callout.addEmoji", Aa = "tools.callout.removeEmoji", ja = "tools.callout.filterEmojis", Ma = "tools.callout.calloutEmojiCategory", Na = "tools.callout.noEmojisFound", Pa = "tools.callout.pickRandom", Fa = "tools.callout.skinTone", Ia = "tools.callout.emojiCategoryPeople", La = "tools.callout.emojiCategoryNature", Ra = "tools.callout.emojiCategoryFood", za = "tools.callout.emojiCategoryActivity", Ba = "tools.callout.emojiCategoryTravel", Va = "tools.callout.emojiCategoryObjects", Ha = "tools.callout.emojiCategorySymbols", Ua = "tools.callout.emojiCategoryFlags", Wa = "💡", Ga = "rounded-xl pl-8 pr-4 py-[5px] my-1 flex items-start gap-2 relative", Ka = "text-[1.5rem] leading-[1] cursor-pointer bg-transparent border-0 px-0 py-[7px] h-[38px] flex-shrink-0 select-none", qa = "flex-1 min-w-0", Ja = "absolute left-0 top-0 h-full cursor-grab select-none";
5771
+ }, Ea = "callout", Da = "tools.callout.color", Oa = "tools.callout.editIcon", ka = "tools.callout.addEmoji", Aa = "tools.callout.removeEmoji", ja = "tools.callout.filterEmojis", Ma = "tools.callout.calloutEmojiCategory", Na = "tools.callout.noEmojisFound", Pa = "tools.callout.pickRandom", Fa = "tools.callout.skinTone", Ia = "tools.callout.emojiCategoryPeople", La = "tools.callout.emojiCategoryNature", Ra = "tools.callout.emojiCategoryFood", za = "tools.callout.emojiCategoryActivity", Ba = "tools.callout.emojiCategoryTravel", Va = "tools.callout.emojiCategoryObjects", Ha = "tools.callout.emojiCategorySymbols", Ua = "tools.callout.emojiCategoryFlags", Wa = "💡", Ga = "rounded-xl pl-8 pr-4 py-[5px] my-1 flex items-start gap-2 relative", Ka = "text-[1.5rem] leading-[1] cursor-pointer bg-transparent border-0 px-0 py-[7px] h-[38px] flex-shrink-0 select-none", qa = "flex-1 min-w-0";
5761
5772
  //#endregion
5762
5773
  //#region src/tools/callout/dom-builder.ts
5763
- function Ya(e) {
5774
+ function Ja(e) {
5764
5775
  let { emoji: t, readOnly: n, addEmojiLabel: r } = e, i = document.createElement("div");
5765
5776
  i.className = Ga;
5766
5777
  let a = document.createElement("button");
5767
5778
  a.type = "button", a.className = Ka, a.textContent = t || "", a.setAttribute("aria-label", t === "" ? r : t), a.setAttribute("tabindex", "0"), a.setAttribute("data-blok-testid", "callout-emoji-btn"), n && (a.disabled = !0);
5768
5779
  let o = document.createElement("div");
5769
- o.className = qa, o.setAttribute(O.toggleChildren, ""), o.setAttribute(k.nestedBlocks, ""), o.setAttribute("data-blok-child-toolbar", ""), o.setAttribute("data-blok-mutation-free", "true"), i.appendChild(a), i.appendChild(o);
5770
- let s = document.createElement("span");
5771
- return s.className = Ja, s.style.width = "32px", s.setAttribute("data-callout-drag-zone", ""), i.prepend(s), {
5780
+ return o.className = qa, o.setAttribute(O.toggleChildren, ""), o.setAttribute(k.nestedBlocks, ""), o.setAttribute("data-blok-child-toolbar", ""), o.setAttribute("data-blok-mutation-free", "true"), i.appendChild(a), i.appendChild(o), {
5772
5781
  wrapper: i,
5773
5782
  emojiButton: a,
5774
- childContainer: o,
5775
- dragZone: s
5783
+ childContainer: o
5776
5784
  };
5777
5785
  }
5778
5786
  //#endregion
5779
5787
  //#region src/tools/callout/block-operations.ts
5780
- function Xa(e) {
5788
+ function Ya(e) {
5781
5789
  return {
5782
5790
  emoji: e.emoji,
5783
5791
  textColor: e.textColor,
@@ -5786,7 +5794,7 @@ function Xa(e) {
5786
5794
  }
5787
5795
  //#endregion
5788
5796
  //#region src/tools/callout/callout-keyboard.ts
5789
- async function Za(e) {
5797
+ async function Xa(e) {
5790
5798
  if (e.calloutBlockId === void 0) return;
5791
5799
  let t = e.api.blocks.getChildren(e.calloutBlockId);
5792
5800
  if (e.event.preventDefault(), t.length <= 1) {
@@ -5800,7 +5808,7 @@ async function Za(e) {
5800
5808
  }
5801
5809
  //#endregion
5802
5810
  //#region src/tools/callout/emoji-picker/emoji-data.ts
5803
- var Qa = [
5811
+ var Za = [
5804
5812
  "💡",
5805
5813
  "👉",
5806
5814
  "☝️",
@@ -5821,8 +5829,8 @@ var Qa = [
5821
5829
  "📢",
5822
5830
  "🛠️",
5823
5831
  "⚙️"
5824
- ], $a = { data: null };
5825
- function eo(e, t) {
5832
+ ], Qa = { data: null };
5833
+ function $a(e, t) {
5826
5834
  let n = [];
5827
5835
  for (let r of e.emojis) {
5828
5836
  let i = t[r];
@@ -5839,12 +5847,12 @@ function eo(e, t) {
5839
5847
  }
5840
5848
  return n;
5841
5849
  }
5842
- async function to() {
5843
- if ($a.data !== null) return $a.data;
5844
- let e = await import("./native-D0cfLXsM.mjs"), t = "default" in e && e.default !== void 0 ? e.default : e, n = t.categories.flatMap((e) => eo(e, t.emojis));
5845
- return $a.data = n, n;
5850
+ async function eo() {
5851
+ if (Qa.data !== null) return Qa.data;
5852
+ let e = await import("./native-D0cfLXsM.mjs"), t = "default" in e && e.default !== void 0 ? e.default : e, n = t.categories.flatMap((e) => $a(e, t.emojis));
5853
+ return Qa.data = n, n;
5846
5854
  }
5847
- function no(e, t, n) {
5855
+ function to(e, t, n) {
5848
5856
  let r = t.toLowerCase();
5849
5857
  return e.filter((e) => {
5850
5858
  if (e.name.toLowerCase().includes(r) || e.keywords.some((e) => e.includes(r))) return !0;
@@ -5852,7 +5860,7 @@ function no(e, t, n) {
5852
5860
  return t === void 0 ? !1 : t.n.toLowerCase().includes(r) || t.k !== void 0 && t.k.some((e) => e.toLowerCase().includes(r));
5853
5861
  });
5854
5862
  }
5855
- function ro(e) {
5863
+ function no(e) {
5856
5864
  let t = /* @__PURE__ */ new Map();
5857
5865
  for (let r of e) {
5858
5866
  var n;
@@ -5863,7 +5871,7 @@ function ro(e) {
5863
5871
  }
5864
5872
  //#endregion
5865
5873
  //#region src/tools/callout/emoji-picker/emoji-locale.ts
5866
- var io = /* @__PURE__ */ new Map(), ao = {
5874
+ var ro = /* @__PURE__ */ new Map(), io = {
5867
5875
  am: () => import("./am-Bbd7cTHS.mjs"),
5868
5876
  ar: () => import("./ar-Bo71sCQE.mjs"),
5869
5877
  az: () => import("./az-BnNrO_xK.mjs"),
@@ -5930,22 +5938,22 @@ var io = /* @__PURE__ */ new Map(), ao = {
5930
5938
  vi: () => import("./vi--gW42cZG.mjs"),
5931
5939
  zh: () => import("./zh-DgQ6P8Lu.mjs")
5932
5940
  };
5933
- async function oo(e) {
5941
+ async function ao(e) {
5934
5942
  if (e === "en") return null;
5935
- let t = io.get(e);
5943
+ let t = ro.get(e);
5936
5944
  if (t !== void 0) return t;
5937
- let n = ao[e];
5945
+ let n = io[e];
5938
5946
  if (n === void 0) return null;
5939
5947
  try {
5940
5948
  let t = (await n()).default;
5941
- return io.set(e, t), t;
5949
+ return ro.set(e, t), t;
5942
5950
  } catch (e) {
5943
5951
  return null;
5944
5952
  }
5945
5953
  }
5946
5954
  //#endregion
5947
5955
  //#region src/tools/callout/emoji-picker/index.ts
5948
- var so = {
5956
+ var oo = {
5949
5957
  callout: Ma,
5950
5958
  people: Ia,
5951
5959
  nature: La,
@@ -5955,7 +5963,7 @@ var so = {
5955
5963
  objects: Va,
5956
5964
  symbols: Ha,
5957
5965
  flags: Ua
5958
- }, co = [
5966
+ }, so = [
5959
5967
  ["callout", be],
5960
5968
  ["people", at],
5961
5969
  ["nature", _],
@@ -5965,17 +5973,17 @@ var so = {
5965
5973
  ["objects", y],
5966
5974
  ["symbols", d],
5967
5975
  ["flags", pe]
5968
- ], lo = [
5976
+ ], co = [
5969
5977
  "✋",
5970
5978
  "✋🏻",
5971
5979
  "✋🏼",
5972
5980
  "✋🏽",
5973
5981
  "✋🏾",
5974
5982
  "✋🏿"
5975
- ], uo = "blok-emoji-skin-tone";
5976
- function fo() {
5983
+ ], lo = "blok-emoji-skin-tone";
5984
+ function uo() {
5977
5985
  try {
5978
- let e = localStorage.getItem(uo);
5986
+ let e = localStorage.getItem(lo);
5979
5987
  if (e === null) return 0;
5980
5988
  let t = parseInt(e, 10);
5981
5989
  return t >= 0 && t <= 5 ? t : 0;
@@ -5983,12 +5991,12 @@ function fo() {
5983
5991
  return 0;
5984
5992
  }
5985
5993
  }
5986
- function po(e) {
5994
+ function fo(e) {
5987
5995
  try {
5988
- localStorage.setItem(uo, String(e));
5996
+ localStorage.setItem(lo, String(e));
5989
5997
  } catch (e) {}
5990
5998
  }
5991
- var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><rect x=\"1.5\" y=\"1.5\" width=\"11\" height=\"11\" rx=\"2\" stroke=\"currentColor\" stroke-width=\"1.2\"/><circle cx=\"4.5\" cy=\"4.5\" r=\".9\" fill=\"currentColor\"/><circle cx=\"7\" cy=\"7\" r=\".9\" fill=\"currentColor\"/><circle cx=\"9.5\" cy=\"9.5\" r=\".9\" fill=\"currentColor\"/></svg>", ho = class {
5999
+ var po = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><rect x=\"1.5\" y=\"1.5\" width=\"11\" height=\"11\" rx=\"2\" stroke=\"currentColor\" stroke-width=\"1.2\"/><circle cx=\"4.5\" cy=\"4.5\" r=\".9\" fill=\"currentColor\"/><circle cx=\"7\" cy=\"7\" r=\".9\" fill=\"currentColor\"/><circle cx=\"9.5\" cy=\"9.5\" r=\".9\" fill=\"currentColor\"/></svg>", mo = class {
5992
6000
  constructor(e) {
5993
6001
  this._localeData = null, this._open = !1, this._allEmojis = [], this._skinTone = 0, this._showingEmptyState = !1, this._anchorEl = null, this._backdrop = null, this._savedOverflow = "", this._navButtons = /* @__PURE__ */ new Map(), this._sectionEls = /* @__PURE__ */ new Map(), this._activeNavId = "", this._navRafId = 0, this._skinToneButtons = [], this.onSelect = e.onSelect, this.onRemove = e.onRemove, this.i18n = e.i18n, this._locale = e.locale, this._element = this.buildElement();
5994
6002
  let t = this._element.querySelector("[data-emoji-picker-body]"), n = this._element.querySelector("[data-emoji-picker-nav]"), r = this._element.querySelector("input[type=\"text\"]");
@@ -6006,13 +6014,13 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6006
6014
  async open(e) {
6007
6015
  var t = this;
6008
6016
  t._anchorEl = e, t._open = !0, t._filterInput.value = "", t._element.setAttribute("data-theme", t.resolveTheme());
6009
- let n = fo();
6017
+ let n = uo();
6010
6018
  if (n !== t._skinTone) {
6011
- t._skinTone = n, t._skinToneToggle.textContent = lo[n];
6019
+ t._skinTone = n, t._skinToneToggle.textContent = co[n];
6012
6020
  for (let [e, r] of t._skinToneButtons.entries()) t.applySkinToneActiveStyle(r, e === n);
6013
6021
  }
6014
- if (t._allEmojis.length === 0 && (t._allEmojis = await to()), t._locale !== "en" && t._localeData === null) {
6015
- let e = await oo(t._locale);
6022
+ if (t._allEmojis.length === 0 && (t._allEmojis = await eo()), t._locale !== "en" && t._localeData === null) {
6023
+ let e = await ao(t._locale);
6016
6024
  e !== null && (t._localeData = e);
6017
6025
  }
6018
6026
  t.renderEmojiGrid(t._allEmojis), t.showBackdrop(), t._element.style.animation = "none", t._element.hidden = !1, t.position(e), t._element.offsetHeight, t._element.style.animation = "", t._filterInput.focus();
@@ -6050,14 +6058,14 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6050
6058
  "text-[14px] leading-none cursor-pointer select-none",
6051
6059
  "hover:bg-neutral-100 theme-dark:hover:bg-neutral-800",
6052
6060
  "active:scale-90 transition-all duration-100"
6053
- ].join(" "), o.textContent = lo[this._skinTone], o.addEventListener("click", () => this.toggleSkinTonePopover()), this._skinToneToggle = o, a.appendChild(o), this._skinTonePopover = this.buildSkinTonePopover(), a.appendChild(this._skinTonePopover);
6061
+ ].join(" "), o.textContent = co[this._skinTone], o.addEventListener("click", () => this.toggleSkinTonePopover()), this._skinToneToggle = o, a.appendChild(o), this._skinTonePopover = this.buildSkinTonePopover(), a.appendChild(this._skinTonePopover);
6054
6062
  let s = document.createElement("button");
6055
6063
  s.type = "button", s.setAttribute("data-emoji-picker-random", ""), s.setAttribute("aria-label", this.i18n.t(Pa)), s.className = [
6056
6064
  "flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg",
6057
6065
  "text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600",
6058
6066
  "theme-dark:hover:bg-neutral-800 theme-dark:hover:text-neutral-300",
6059
6067
  "transition-colors duration-100 cursor-pointer"
6060
- ].join(" "), s.innerHTML = mo, s.addEventListener("click", () => this.pickRandom()), T(s, this.i18n.t(Pa), { placement: "bottom" });
6068
+ ].join(" "), s.innerHTML = po, s.addEventListener("click", () => this.pickRandom()), T(s, this.i18n.t(Pa), { placement: "bottom" });
6061
6069
  let c = document.createElement("button");
6062
6070
  c.type = "button", c.setAttribute("data-emoji-picker-remove", ""), c.setAttribute("aria-label", this.i18n.t(Aa)), c.className = [
6063
6071
  "flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg",
@@ -6093,7 +6101,7 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6093
6101
  "bg-white border border-neutral-200/70 shadow-lg",
6094
6102
  "theme-dark:bg-neutral-800 theme-dark:border-neutral-700/50"
6095
6103
  ].join(" "), e.hidden = !0, this._skinToneButtons = [];
6096
- for (let [t, n] of lo.entries()) {
6104
+ for (let [t, n] of co.entries()) {
6097
6105
  let r = document.createElement("button");
6098
6106
  r.type = "button", r.textContent = n, r.setAttribute("aria-label", `${this.i18n.t(Fa)} ${t + 1}`), r.className = [
6099
6107
  "w-[32px] h-[32px] flex items-center justify-center rounded-lg",
@@ -6127,7 +6135,7 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6127
6135
  e ? this._skinToneToggle.classList.add(...t) : this._skinToneToggle.classList.remove(...t);
6128
6136
  }
6129
6137
  setSkinTone(e) {
6130
- this._skinTone = e, po(e), this._skinToneToggle.textContent = lo[e];
6138
+ this._skinTone = e, fo(e), this._skinToneToggle.textContent = co[e];
6131
6139
  for (let [t, n] of this._skinToneButtons.entries()) this.applySkinToneActiveStyle(n, t === e);
6132
6140
  let t = Array.from(this._body.querySelectorAll("[data-emoji-native]"));
6133
6141
  for (let e of t) {
@@ -6144,7 +6152,7 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6144
6152
  }
6145
6153
  buildCategoryNav(e) {
6146
6154
  this._nav.innerHTML = "", this._navButtons.clear(), this._activeNavId = "";
6147
- for (let [t, n] of co) {
6155
+ for (let [t, n] of so) {
6148
6156
  if (!e.has(t)) continue;
6149
6157
  let r = this.translateCategory(t), i = document.createElement("button");
6150
6158
  i.type = "button", i.innerHTML = n, i.title = r, i.setAttribute("aria-label", r), i.setAttribute("data-emoji-nav", t), i.className = [
@@ -6184,11 +6192,11 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6184
6192
  return;
6185
6193
  }
6186
6194
  this._nav.hidden = !0;
6187
- let t = no(this._allEmojis, e, this._localeData);
6195
+ let t = to(this._allEmojis, e, this._localeData);
6188
6196
  if (t.length === 0) this._showingEmptyState || this.renderEmptyState();
6189
6197
  else {
6190
6198
  this._body.innerHTML = "", this._sectionEls.clear(), this._showingEmptyState = !1;
6191
- let e = ro(t);
6199
+ let e = no(t);
6192
6200
  for (let [t, n] of e) {
6193
6201
  let e = this.buildSection(this.translateCategory(t), n);
6194
6202
  e.setAttribute("data-emoji-section", t), this._sectionEls.set(t, e), this._body.appendChild(e);
@@ -6197,13 +6205,13 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6197
6205
  }
6198
6206
  renderEmojiGrid(e) {
6199
6207
  this._body.innerHTML = "", this._sectionEls.clear(), this._showingEmptyState = !1;
6200
- let t = /* @__PURE__ */ new Set(), n = Qa.map((t) => e.find((e) => e.native === t)).filter((e) => e !== void 0);
6208
+ let t = /* @__PURE__ */ new Set(), n = Za.map((t) => e.find((e) => e.native === t)).filter((e) => e !== void 0);
6201
6209
  if (n.length > 0) {
6202
6210
  t.add("callout");
6203
6211
  let e = this.buildSection(this.translateCategory("callout"), n);
6204
6212
  e.setAttribute("data-emoji-section", "callout"), this._sectionEls.set("callout", e), this._body.appendChild(e);
6205
6213
  }
6206
- let r = new Set(Qa), i = ro(e.filter((e) => !r.has(e.native)));
6214
+ let r = new Set(Za), i = no(e.filter((e) => !r.has(e.native)));
6207
6215
  for (let [e, n] of i) {
6208
6216
  t.add(e);
6209
6217
  let r = this.buildSection(this.translateCategory(e), n);
@@ -6225,7 +6233,7 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6225
6233
  n.className = "text-[13px] font-medium", n.textContent = this.i18n.t(Na), e.appendChild(t), e.appendChild(n), this._body.appendChild(e);
6226
6234
  }
6227
6235
  translateCategory(e) {
6228
- let t = so[e];
6236
+ let t = oo[e];
6229
6237
  return t === void 0 ? e : this.i18n.t(t);
6230
6238
  }
6231
6239
  buildSection(e, t) {
@@ -6280,10 +6288,10 @@ var mo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
6280
6288
  };
6281
6289
  //#endregion
6282
6290
  //#region src/tools/callout/index.ts
6283
- function go(e) {
6291
+ function ho(e) {
6284
6292
  return e.isEmojiVisible === !1 ? "" : typeof e.emoji == "string" && e.emoji.length > 0 ? e.emoji : Wa;
6285
6293
  }
6286
- var _o = {
6294
+ var go = {
6287
6295
  general: null,
6288
6296
  note: "blue",
6289
6297
  important: "purple",
@@ -6291,9 +6299,9 @@ var _o = {
6291
6299
  additional: "yellow",
6292
6300
  recommendation: "green",
6293
6301
  caution: "red"
6294
- }, vo = class {
6302
+ }, _o = class {
6295
6303
  constructor({ data: e, api: t, readOnly: n, block: r }) {
6296
- this._dom = null, this._emojiPicker = null, this._colorPicker = null, this._dragZone = null, this.api = t, this.readOnly = n, this._data = this.normalizeData(e), r && (this.blockId = r.id);
6304
+ this._dom = null, this._emojiPicker = null, this._colorPicker = null, this.api = t, this.readOnly = n, this._data = this.normalizeData(e), r && (this.blockId = r.id);
6297
6305
  }
6298
6306
  normalizeData(e) {
6299
6307
  let t = e;
@@ -6304,21 +6312,21 @@ var _o = {
6304
6312
  };
6305
6313
  }
6306
6314
  normalizeLegacyData(e) {
6307
- let t = typeof e.variant == "string" ? e.variant : "general", n = t in _o ? _o[t] : null;
6315
+ let t = typeof e.variant == "string" ? e.variant : "general", n = t in go ? go[t] : null;
6308
6316
  return {
6309
- emoji: go(e),
6317
+ emoji: ho(e),
6310
6318
  textColor: null,
6311
6319
  backgroundColor: n == null ? null : n
6312
6320
  };
6313
6321
  }
6314
6322
  render() {
6315
6323
  if (this._dom) return this._dom.wrapper;
6316
- let e = Ya({
6324
+ let e = Ja({
6317
6325
  emoji: this._data.emoji,
6318
6326
  readOnly: this.readOnly,
6319
6327
  addEmojiLabel: this.api.i18n.t(ka)
6320
6328
  });
6321
- return this._dom = e, this._dragZone = e.dragZone, this.applyColors(), this.readOnly || (e.emojiButton.addEventListener("click", () => this.openEmojiPicker()), e.emojiButton.addEventListener("keydown", (e) => {
6329
+ return this._dom = e, this.applyColors(), this.readOnly || (e.emojiButton.addEventListener("click", () => this.openEmojiPicker()), e.emojiButton.addEventListener("keydown", (e) => {
6322
6330
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.openEmojiPicker());
6323
6331
  }), e.childContainer.addEventListener("keydown", (e) => {
6324
6332
  e.key === "Backspace" && this.handleChildBackspace(e);
@@ -6327,7 +6335,7 @@ var _o = {
6327
6335
  rendered() {
6328
6336
  if (this.blockId === void 0 || this._dom === null) return;
6329
6337
  let e = this.api.blocks.getChildren(this.blockId);
6330
- if (zt(this._dom.childContainer, e), e.length === 0) {
6338
+ if (Rt(this._dom.childContainer, e), e.length === 0) {
6331
6339
  let e = this.api.blocks.getBlockIndex(this.blockId);
6332
6340
  if (e !== void 0) {
6333
6341
  let t = this.api.blocks.insertInsideParent(this.blockId, e + 1);
@@ -6336,7 +6344,7 @@ var _o = {
6336
6344
  }
6337
6345
  }
6338
6346
  save() {
6339
- return Xa({
6347
+ return Ya({
6340
6348
  emoji: this._data.emoji,
6341
6349
  textColor: this._data.textColor,
6342
6350
  backgroundColor: this._data.backgroundColor
@@ -6395,9 +6403,6 @@ var _o = {
6395
6403
  setReadOnly(e) {
6396
6404
  this.readOnly = e, this._dom && (this._dom.emojiButton.disabled = e);
6397
6405
  }
6398
- get dragZone() {
6399
- return this._dragZone;
6400
- }
6401
6406
  syncPickerActiveColors() {
6402
6407
  if (this._colorPicker === null) return;
6403
6408
  let e = this._data.textColor, t = this._data.backgroundColor;
@@ -6418,7 +6423,7 @@ var _o = {
6418
6423
  let n = t[0], r = e.target;
6419
6424
  if (!n.holder.contains(r)) return;
6420
6425
  let i = window.getSelection(), a = i !== null && i.rangeCount > 0 && i.getRangeAt(0).startOffset === 0 && i.getRangeAt(0).collapsed;
6421
- n.holder.textContent !== "" || !a || Za({
6426
+ n.holder.textContent !== "" || !a || Xa({
6422
6427
  api: this.api,
6423
6428
  calloutBlockId: this.blockId,
6424
6429
  firstChildBlockId: n.id,
@@ -6426,7 +6431,7 @@ var _o = {
6426
6431
  });
6427
6432
  }
6428
6433
  openEmojiPicker() {
6429
- this._dom !== null && (this._emojiPicker === null && (this._emojiPicker = new ho({
6434
+ this._dom !== null && (this._emojiPicker === null && (this._emojiPicker = new mo({
6430
6435
  onSelect: (e) => this.setEmoji(e),
6431
6436
  onRemove: () => this.setEmoji(""),
6432
6437
  i18n: this.api.i18n,
@@ -6480,39 +6485,39 @@ var _o = {
6480
6485
  static get isReadOnlySupported() {
6481
6486
  return !0;
6482
6487
  }
6483
- }, yo = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
6484
- function bo(e, t, n) {
6488
+ }, vo = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
6489
+ function yo(e, t, n) {
6485
6490
  let r = n[0];
6486
6491
  if (t != null && e >= t) throw Error(e + " >= " + t);
6487
6492
  if (e.slice(-1) === r || t && t.slice(-1) === r) throw Error("trailing zero");
6488
6493
  if (t) {
6489
6494
  let i = 0;
6490
6495
  for (; (e[i] || r) === t[i];) i++;
6491
- if (i > 0) return t.slice(0, i) + bo(e.slice(i), t.slice(i), n);
6496
+ if (i > 0) return t.slice(0, i) + yo(e.slice(i), t.slice(i), n);
6492
6497
  }
6493
6498
  let i = e ? n.indexOf(e[0]) : 0, a = t == null ? n.length : n.indexOf(t[0]);
6494
- return a - i > 1 ? n[Math.round(.5 * (i + a))] : t && t.length > 1 ? t.slice(0, 1) : n[i] + bo(e.slice(1), null, n);
6499
+ return a - i > 1 ? n[Math.round(.5 * (i + a))] : t && t.length > 1 ? t.slice(0, 1) : n[i] + yo(e.slice(1), null, n);
6495
6500
  }
6496
- function xo(e) {
6497
- if (e.length !== So(e[0])) throw Error("invalid integer part of order key: " + e);
6501
+ function bo(e) {
6502
+ if (e.length !== xo(e[0])) throw Error("invalid integer part of order key: " + e);
6498
6503
  }
6499
- function So(e) {
6504
+ function xo(e) {
6500
6505
  if (e >= "a" && e <= "z") return e.charCodeAt(0) - 97 + 2;
6501
6506
  if (e >= "A" && e <= "Z") return 90 - e.charCodeAt(0) + 2;
6502
6507
  throw Error("invalid order key head: " + e);
6503
6508
  }
6504
- function Co(e) {
6505
- let t = So(e[0]);
6509
+ function So(e) {
6510
+ let t = xo(e[0]);
6506
6511
  if (t > e.length) throw Error("invalid order key: " + e);
6507
6512
  return e.slice(0, t);
6508
6513
  }
6509
- function wo(e, t) {
6514
+ function Co(e, t) {
6510
6515
  if (e === "A" + t[0].repeat(26)) throw Error("invalid order key: " + e);
6511
- let n = Co(e);
6516
+ let n = So(e);
6512
6517
  if (e.slice(n.length).slice(-1) === t[0]) throw Error("invalid order key: " + e);
6513
6518
  }
6514
- function To(e, t) {
6515
- xo(e);
6519
+ function wo(e, t) {
6520
+ bo(e);
6516
6521
  let [n, ...r] = e.split(""), i = !0;
6517
6522
  for (let e = r.length - 1; i && e >= 0; e--) {
6518
6523
  let n = t.indexOf(r[e]) + 1;
@@ -6525,8 +6530,8 @@ function To(e, t) {
6525
6530
  return e > "a" ? r.push(t[0]) : r.pop(), e + r.join("");
6526
6531
  } else return n + r.join("");
6527
6532
  }
6528
- function Eo(e, t) {
6529
- xo(e);
6533
+ function To(e, t) {
6534
+ bo(e);
6530
6535
  let [n, ...r] = e.split(""), i = !0;
6531
6536
  for (let e = r.length - 1; i && e >= 0; e--) {
6532
6537
  let n = t.indexOf(r[e]) - 1;
@@ -6539,30 +6544,30 @@ function Eo(e, t) {
6539
6544
  return e < "Z" ? r.push(t.slice(-1)) : r.pop(), e + r.join("");
6540
6545
  } else return n + r.join("");
6541
6546
  }
6542
- function Do(e, t, n = yo) {
6543
- if (e != null && wo(e, n), t != null && wo(t, n), e != null && t != null && e >= t) throw Error(e + " >= " + t);
6547
+ function Eo(e, t, n = vo) {
6548
+ if (e != null && Co(e, n), t != null && Co(t, n), e != null && t != null && e >= t) throw Error(e + " >= " + t);
6544
6549
  if (e == null) {
6545
6550
  if (t == null) return "a" + n[0];
6546
- let e = Co(t), r = t.slice(e.length);
6547
- if (e === "A" + n[0].repeat(26)) return e + bo("", r, n);
6551
+ let e = So(t), r = t.slice(e.length);
6552
+ if (e === "A" + n[0].repeat(26)) return e + yo("", r, n);
6548
6553
  if (e < t) return e;
6549
- let i = Eo(e, n);
6554
+ let i = To(e, n);
6550
6555
  if (i == null) throw Error("cannot decrement any more");
6551
6556
  return i;
6552
6557
  }
6553
6558
  if (t == null) {
6554
- let t = Co(e), r = e.slice(t.length), i = To(t, n);
6555
- return i == null ? t + bo(r, null, n) : i;
6559
+ let t = So(e), r = e.slice(t.length), i = wo(t, n);
6560
+ return i == null ? t + yo(r, null, n) : i;
6556
6561
  }
6557
- let r = Co(e), i = e.slice(r.length), a = Co(t), o = t.slice(a.length);
6558
- if (r === a) return r + bo(i, o, n);
6559
- let s = To(r, n);
6562
+ let r = So(e), i = e.slice(r.length), a = So(t), o = t.slice(a.length);
6563
+ if (r === a) return r + yo(i, o, n);
6564
+ let s = wo(r, n);
6560
6565
  if (s == null) throw Error("cannot increment any more");
6561
- return s < t ? s : r + bo(i, null, n);
6566
+ return s < t ? s : r + yo(i, null, n);
6562
6567
  }
6563
6568
  //#endregion
6564
6569
  //#region src/tools/database/database-model.ts
6565
- var Oo = class e {
6570
+ var Do = class e {
6566
6571
  constructor(t) {
6567
6572
  if (this.rows = [], (t == null ? void 0 : t.schema) !== void 0 && t.schema.length > 0 ? this.schema = t.schema.map((e) => A({}, e)) : this.schema = e.createDefaultSchema(), (t == null ? void 0 : t.views) !== void 0 && t.views.length > 0) this.views = t.views.map((e) => A(A({}, e), {}, {
6568
6573
  sorts: [...e.sorts],
@@ -6586,7 +6591,7 @@ var Oo = class e {
6586
6591
  id: w(),
6587
6592
  name: e,
6588
6593
  type: t,
6589
- position: Do(r, null)
6594
+ position: Eo(r, null)
6590
6595
  }, n === void 0 ? {} : { config: n });
6591
6596
  return this.schema.push(i), i;
6592
6597
  }
@@ -6610,7 +6615,7 @@ var Oo = class e {
6610
6615
  let t = this.getOrderedRows(), n = t.length > 0 ? t[t.length - 1].position : null;
6611
6616
  return {
6612
6617
  id: w(),
6613
- position: Do(n, null),
6618
+ position: Eo(n, null),
6614
6619
  properties: e == null ? {} : e
6615
6620
  };
6616
6621
  }
@@ -6639,7 +6644,7 @@ var Oo = class e {
6639
6644
  id: w(),
6640
6645
  name: e,
6641
6646
  type: t,
6642
- position: Do(s, null),
6647
+ position: Eo(s, null),
6643
6648
  groupBy: n.groupBy,
6644
6649
  sorts: (r = n.sorts) == null ? [] : r,
6645
6650
  filters: (i = n.filters) == null ? [] : i,
@@ -6668,7 +6673,7 @@ var Oo = class e {
6668
6673
  return e == null ? "" : typeof e == "string" ? e : typeof e == "boolean" || typeof e == "number" ? String(e) : "";
6669
6674
  }
6670
6675
  static positionBetween(e, t) {
6671
- return Do(e, t);
6676
+ return Eo(e, t);
6672
6677
  }
6673
6678
  static createDefaultSchema() {
6674
6679
  return [{
@@ -6715,7 +6720,7 @@ var Oo = class e {
6715
6720
  visibleProperties: []
6716
6721
  };
6717
6722
  }
6718
- }, ko = class {
6723
+ }, Oo = class {
6719
6724
  constructor({ readOnly: e, i18n: t, options: n, getRows: r, titlePropertyId: i, onTitleEdit: a }) {
6720
6725
  this.readOnly = e, this.i18n = t, this.options = n, this.getRows = r, this.titlePropertyId = i, this.onTitleEdit = a;
6721
6726
  }
@@ -6836,7 +6841,7 @@ var Oo = class e {
6836
6841
  n.textContent = String(t);
6837
6842
  }
6838
6843
  }
6839
- }, Ao = class {
6844
+ }, ko = class {
6840
6845
  constructor({ readOnly: e, i18n: t, rows: n, titlePropertyId: r, schema: i, visiblePropertyIds: a, options: o, getRows: s }) {
6841
6846
  this.readOnly = e, this.i18n = t, this.rows = n, this.titlePropertyId = r, this.schema = i, this.visiblePropertyIds = a, this.groupOptions = o, this.getGroupRows = s;
6842
6847
  }
@@ -6940,7 +6945,7 @@ var Oo = class e {
6940
6945
  let t = document.createElement("button");
6941
6946
  return t.setAttribute("data-blok-database-add-row", ""), t.setAttribute("aria-label", this.i18n.t("tools.database.addRow")), t.textContent = "+ " + this.i18n.t("tools.database.newRow"), e !== void 0 && t.setAttribute("data-option-id", e), t;
6942
6947
  }
6943
- }, jo = 500, Mo = class {
6948
+ }, Ao = 500, jo = class {
6944
6949
  constructor(e, t) {
6945
6950
  this.pendingTimers = /* @__PURE__ */ new Map(), this.pendingUpdates = /* @__PURE__ */ new Map(), this.pendingPropertyTimers = /* @__PURE__ */ new Map(), this.pendingPropertyUpdates = /* @__PURE__ */ new Map(), this.adapter = e, this.onError = t;
6946
6951
  }
@@ -6967,7 +6972,7 @@ var Oo = class e {
6967
6972
  let r = this.pendingUpdates.get(t);
6968
6973
  this.pendingUpdates.set(t, r === void 0 ? e : A(A(A({}, r), e), {}, { properties: A(A({}, r.properties), e.properties) })), this.pendingTimers.set(t, setTimeout(() => {
6969
6974
  this.flushRow(t);
6970
- }, jo));
6975
+ }, Ao));
6971
6976
  }
6972
6977
  async syncMoveRow(e) {
6973
6978
  var t = this;
@@ -6987,7 +6992,7 @@ var Oo = class e {
6987
6992
  let { propertyId: t } = e, n = this.pendingPropertyTimers.get(t);
6988
6993
  n !== void 0 && clearTimeout(n), this.pendingPropertyUpdates.set(t, e), this.pendingPropertyTimers.set(t, setTimeout(() => {
6989
6994
  this.flushProperty(t);
6990
- }, jo));
6995
+ }, Ao));
6991
6996
  }
6992
6997
  async syncDeleteProperty(e) {
6993
6998
  await this.safeCall((t) => t.deleteProperty(e));
@@ -7025,7 +7030,7 @@ var Oo = class e {
7025
7030
  let n = this.pendingPropertyUpdates.get(e);
7026
7031
  this.pendingPropertyUpdates.delete(e), n !== void 0 && this.safeCall((e) => e.updateProperty(n));
7027
7032
  }
7028
- }, No = 10, Po = class {
7033
+ }, Mo = 10, No = class {
7029
7034
  constructor(e) {
7030
7035
  this.isDragging = !1, this.rowId = "", this.startX = 0, this.startY = 0, this.ghostEl = null, this.sourceCard = null, this.sourceCardHeight = 0, this.ghostOffsetX = 0, this.ghostOffsetY = 0, this.gapTarget = null, this.gapContainer = null, this.wrapper = e.wrapper, this.onDrop = e.onDrop, this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundPointerCancel = this.handlePointerCancel.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this);
7031
7036
  }
@@ -7041,7 +7046,7 @@ var Oo = class e {
7041
7046
  }
7042
7047
  handlePointerMove(e) {
7043
7048
  let t = Math.abs(e.clientX - this.startX), n = Math.abs(e.clientY - this.startY);
7044
- !this.isDragging && (t > No || n > No) && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e));
7049
+ !this.isDragging && (t > Mo || n > Mo) && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e));
7045
7050
  }
7046
7051
  handlePointerUp(e) {
7047
7052
  this.isDragging && this.commitDrop(e), this.cleanup();
@@ -7128,7 +7133,7 @@ var Oo = class e {
7128
7133
  afterRowId: c
7129
7134
  });
7130
7135
  }
7131
- }, Fo = 10, Io = class {
7136
+ }, Po = 10, Fo = class {
7132
7137
  constructor(e) {
7133
7138
  this.isDragging = !1, this.optionId = "", this.startX = 0, this.startY = 0, this.ghostEl = null, this.sourceColumn = null, this.sourceColumnWidth = 0, this.ghostOffsetX = 0, this.gapTarget = null, this.gapContainer = null, this.wrapper = e.wrapper, this.onDrop = e.onDrop, this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundPointerCancel = this.handlePointerCancel.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this);
7134
7139
  }
@@ -7144,7 +7149,7 @@ var Oo = class e {
7144
7149
  }
7145
7150
  handlePointerMove(e) {
7146
7151
  let t = Math.abs(e.clientX - this.startX);
7147
- !this.isDragging && t > Fo && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e.clientX));
7152
+ !this.isDragging && t > Po && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e.clientX));
7148
7153
  }
7149
7154
  handlePointerUp(e) {
7150
7155
  this.isDragging && this.commitDrop(e), this.cleanup();
@@ -7216,7 +7221,7 @@ var Oo = class e {
7216
7221
  afterOptionId: r
7217
7222
  });
7218
7223
  }
7219
- }, Lo = class {
7224
+ }, Io = class {
7220
7225
  constructor(e) {
7221
7226
  this.options = e, this.i18n = e.i18n;
7222
7227
  }
@@ -7278,7 +7283,7 @@ var Oo = class e {
7278
7283
  }));
7279
7284
  }
7280
7285
  destroy() {}
7281
- }, Ro = 10, zo = class {
7286
+ }, Lo = 10, Ro = class {
7282
7287
  constructor(e) {
7283
7288
  this.isDragging = !1, this.rowId = "", this.startY = 0, this.ghostEl = null, this.sourceRow = null, this.sourceRowHeight = 0, this.ghostOffsetY = 0, this.gapTarget = null, this.wrapper = e.wrapper, this.onDrop = e.onDrop, this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundPointerCancel = this.handlePointerCancel.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this);
7284
7289
  }
@@ -7294,7 +7299,7 @@ var Oo = class e {
7294
7299
  }
7295
7300
  handlePointerMove(e) {
7296
7301
  let t = Math.abs(e.clientY - this.startY);
7297
- !this.isDragging && t > Ro && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e));
7302
+ !this.isDragging && t > Lo && (this.isDragging = !0, this.startActiveDrag(e)), this.isDragging && (this.updateGhostPosition(e), this.updateDropIndicator(e));
7298
7303
  }
7299
7304
  handlePointerUp(e) {
7300
7305
  this.isDragging && this.commitDrop(e), this.cleanup();
@@ -7356,7 +7361,7 @@ var Oo = class e {
7356
7361
  resolveAfterRowId(e, t, n) {
7357
7362
  return e ? n > 0 ? t[n - 1].getAttribute("data-row-id") : null : t.length > 0 ? t[t.length - 1].getAttribute("data-row-id") : null;
7358
7363
  }
7359
- }, Bo = [
7364
+ }, zo = [
7360
7365
  {
7361
7366
  type: "text",
7362
7367
  icon: re,
@@ -7392,7 +7397,7 @@ var Oo = class e {
7392
7397
  icon: Se,
7393
7398
  label: "URL"
7394
7399
  }
7395
- ], Vo = class {
7400
+ ], Bo = class {
7396
7401
  constructor(e) {
7397
7402
  this.popoverEl = null, this.boundOutsideClick = null, this.onSelect = e.onSelect;
7398
7403
  }
@@ -7404,7 +7409,7 @@ var Oo = class e {
7404
7409
  t.style.top = `${n.bottom + 4}px`, t.style.left = `${n.left}px`;
7405
7410
  let r = document.createElement("div");
7406
7411
  r.setAttribute("data-blok-database-property-type-heading", ""), r.textContent = "Property type", t.appendChild(r);
7407
- for (let e of Bo) {
7412
+ for (let e of zo) {
7408
7413
  let n = document.createElement("div");
7409
7414
  n.setAttribute("data-blok-database-property-type-option", e.type);
7410
7415
  let r = document.createElement("div");
@@ -7425,7 +7430,7 @@ var Oo = class e {
7425
7430
  destroy() {
7426
7431
  this.close();
7427
7432
  }
7428
- }, Ho = class {
7433
+ }, Vo = class {
7429
7434
  constructor(e) {
7430
7435
  this.drawer = null, this.currentRowId = null, this.currentRow = null, this.blokInstance = null, this.escapeHandler = null, this.outsideClickHandler = null, this.propertyTypePopover = null, this.wrapper = e.wrapper, this.readOnly = e.readOnly, this.i18n = e.i18n, this.toolsConfig = e.toolsConfig, this.titlePropertyId = e.titlePropertyId, this.descriptionPropertyId = e.descriptionPropertyId, this.schema = e.schema, this.onTitleChange = e.onTitleChange, this.onDescriptionChange = e.onDescriptionChange, this.onClose = e.onClose, this.onAddProperty = e.onAddProperty;
7431
7436
  }
@@ -7519,7 +7524,7 @@ var Oo = class e {
7519
7524
  if (!this.readOnly) {
7520
7525
  let e = document.createElement("button");
7521
7526
  e.setAttribute("data-blok-database-drawer-add-prop", ""), e.textContent = "+ Add a property", e.addEventListener("click", () => {
7522
- this.propertyTypePopover === null && (this.propertyTypePopover = new Vo({ onSelect: (e) => {
7527
+ this.propertyTypePopover === null && (this.propertyTypePopover = new Bo({ onSelect: (e) => {
7523
7528
  var t, n;
7524
7529
  (t = this.onAddProperty) == null || t.call(this, e), (n = this.propertyTypePopover) == null || n.close();
7525
7530
  } })), this.propertyTypePopover.open(e);
@@ -7600,7 +7605,7 @@ var Oo = class e {
7600
7605
  }));
7601
7606
  }).catch(() => {});
7602
7607
  }
7603
- }, Uo = class {
7608
+ }, Ho = class {
7604
7609
  constructor(e) {
7605
7610
  this.boundKeydown = null, this.wrapper = e.wrapper, this.onEscape = e.onEscape;
7606
7611
  }
@@ -7612,7 +7617,7 @@ var Oo = class e {
7612
7617
  destroy() {
7613
7618
  this.boundKeydown && (this.wrapper.removeEventListener("keydown", this.boundKeydown), this.boundKeydown = null);
7614
7619
  }
7615
- }, Wo = [{
7620
+ }, Uo = [{
7616
7621
  type: "board",
7617
7622
  icon: s,
7618
7623
  label: "Board",
@@ -7622,7 +7627,7 @@ var Oo = class e {
7622
7627
  icon: it,
7623
7628
  label: "List",
7624
7629
  description: "A simple linear view"
7625
- }], Go = class {
7630
+ }], Wo = class {
7626
7631
  constructor(e) {
7627
7632
  this.popover = null, this.onSelect = e.onSelect, this.onClose = e.onClose;
7628
7633
  }
@@ -7633,7 +7638,7 @@ var Oo = class e {
7633
7638
  items: [{
7634
7639
  type: D.Html,
7635
7640
  element: t
7636
- }, ...Wo.map((e) => {
7641
+ }, ...Uo.map((e) => {
7637
7642
  let t = this.createViewItem(e);
7638
7643
  return {
7639
7644
  type: D.Html,
@@ -7678,10 +7683,10 @@ var Oo = class e {
7678
7683
  destroy() {
7679
7684
  this.close();
7680
7685
  }
7681
- }, Ko = 10, qo = {
7686
+ }, Go = 10, Ko = {
7682
7687
  board: s,
7683
7688
  list: it
7684
- }, Jo = class {
7689
+ }, qo = class {
7685
7690
  constructor(e) {
7686
7691
  var t;
7687
7692
  this.element = null, this.barEl = null, this.addBtnEl = null, this.viewPopover = null, this.contextPopover = null, this.overflowDropdownEl = null, this.boundOverflowClose = null, this.moreBtnEl = null, this.isDragging = !1, this.dragViewId = "", this.dragStartX = 0, this.ghostEl = null, this.options = e, this.views = e.views, this.onReorder = e.onReorder, this.readOnly = (t = e.readOnly) == null ? !1 : t, this.boundDragMove = this.handleDragMove.bind(this), this.boundDragUp = this.handleDragUp.bind(this), this.boundDragCancel = this.cleanupDrag.bind(this), this.boundDragKeyDown = (e) => {
@@ -7732,7 +7737,7 @@ var Oo = class e {
7732
7737
  let n = document.createElement("div");
7733
7738
  n.setAttribute("data-blok-database-tab", ""), n.setAttribute("data-view-id", e.id), e.id === this.options.activeViewId && n.setAttribute("data-active", "");
7734
7739
  let r = document.createElement("span");
7735
- r.innerHTML = (t = qo[e.type]) == null ? "" : t, n.appendChild(r);
7740
+ r.innerHTML = (t = Ko[e.type]) == null ? "" : t, n.appendChild(r);
7736
7741
  let i = document.createElement("span");
7737
7742
  return i.setAttribute("data-blok-database-tab-name", ""), i.textContent = e.name, n.appendChild(i), n;
7738
7743
  }
@@ -7801,7 +7806,7 @@ var Oo = class e {
7801
7806
  }
7802
7807
  openViewPopover(e) {
7803
7808
  var t;
7804
- this.viewPopover !== null && this.viewPopover.destroy(), e.setAttribute("data-popover-open", ""), (t = this.barEl) == null || t.setAttribute("data-popover-open", ""), this.viewPopover = new Go({
7809
+ this.viewPopover !== null && this.viewPopover.destroy(), e.setAttribute("data-popover-open", ""), (t = this.barEl) == null || t.setAttribute("data-popover-open", ""), this.viewPopover = new Wo({
7805
7810
  onSelect: (e) => {
7806
7811
  this.options.onAddView(e);
7807
7812
  },
@@ -7839,7 +7844,7 @@ var Oo = class e {
7839
7844
  let t = document.createElement("div");
7840
7845
  t.setAttribute("data-blok-database-tab-overflow-item", ""), t.setAttribute("data-view-id", e.id), e.id === this.options.activeViewId && t.setAttribute("data-active", "");
7841
7846
  let r = document.createElement("span");
7842
- r.innerHTML = (a = qo[e.type]) == null ? "" : a, t.appendChild(r);
7847
+ r.innerHTML = (a = Ko[e.type]) == null ? "" : a, t.appendChild(r);
7843
7848
  let i = document.createElement("span");
7844
7849
  i.textContent = e.name, t.appendChild(i), t.addEventListener("click", () => {
7845
7850
  e.id !== this.options.activeViewId && this.options.onTabClick(e.id), this.closeOverflowDropdown();
@@ -7860,7 +7865,7 @@ var Oo = class e {
7860
7865
  }
7861
7866
  handleDragMove(e) {
7862
7867
  let t = Math.abs(e.clientX - this.dragStartX);
7863
- if (!(!this.isDragging && t < Ko)) {
7868
+ if (!(!this.isDragging && t < Go)) {
7864
7869
  if (!this.isDragging) {
7865
7870
  var n, r;
7866
7871
  this.isDragging = !0, (n = this.element) == null || n.setAttribute("data-dragging", "");
@@ -7883,7 +7888,7 @@ var Oo = class e {
7883
7888
  let a = Array.from((t = (n = this.element) == null ? void 0 : n.querySelectorAll("[data-blok-database-tab]")) == null ? [] : t).filter((e) => e.getAttribute("data-view-id") !== this.dragViewId), o = a.findIndex((t) => {
7884
7889
  let n = t.getBoundingClientRect();
7885
7890
  return e.clientX < (n.left + n.right) / 2;
7886
- }), s = o >= 0 ? a[o].getAttribute("data-view-id") : null, c = o > 0 ? a[o - 1].getAttribute("data-view-id") : o === -1 && a.length > 0 ? a[a.length - 1].getAttribute("data-view-id") : null, l = [...this.views].sort((e, t) => e.position < t.position ? -1 : 1), u = s === null ? null : l.find((e) => e.id === s), d = c === null ? null : l.find((e) => e.id === c), f = Do((r = d == null ? void 0 : d.position) == null ? null : r, (i = u == null ? void 0 : u.position) == null ? null : i);
7891
+ }), s = o >= 0 ? a[o].getAttribute("data-view-id") : null, c = o > 0 ? a[o - 1].getAttribute("data-view-id") : o === -1 && a.length > 0 ? a[a.length - 1].getAttribute("data-view-id") : null, l = [...this.views].sort((e, t) => e.position < t.position ? -1 : 1), u = s === null ? null : l.find((e) => e.id === s), d = c === null ? null : l.find((e) => e.id === c), f = Eo((r = d == null ? void 0 : d.position) == null ? null : r, (i = u == null ? void 0 : u.position) == null ? null : i);
7887
7892
  this.cleanupDrag(), this.onReorder(this.dragViewId, f);
7888
7893
  }
7889
7894
  cleanupDrag() {
@@ -7904,10 +7909,10 @@ var Oo = class e {
7904
7909
  getAddBtnEl() {
7905
7910
  return this.addBtnEl;
7906
7911
  }
7907
- }, Yo = class {
7912
+ }, Jo = class {
7908
7913
  constructor({ data: e, config: t, api: n, block: r, readOnly: i }) {
7909
7914
  var a, o;
7910
- this.element = null, this.titleElement = null, this.titleRowElement = null, this.boardContainer = null, this.tabBar = null, this.cardDrag = null, this.columnDrag = null, this.columnControls = null, this.listRowDrag = null, this.cardDrawer = null, this.keyboard = null, this.cardMenuPopover = null, this.api = n, this.block = r, this.readOnly = i, this.config = t == null ? {} : t, this.title = (a = e == null ? void 0 : e.title) == null ? "" : a, this.model = new Oo(e);
7915
+ this.element = null, this.titleElement = null, this.titleRowElement = null, this.boardContainer = null, this.tabBar = null, this.cardDrag = null, this.columnDrag = null, this.columnControls = null, this.listRowDrag = null, this.cardDrawer = null, this.keyboard = null, this.cardMenuPopover = null, this.api = n, this.block = r, this.readOnly = i, this.config = t == null ? {} : t, this.title = (a = e == null ? void 0 : e.title) == null ? "" : a, this.model = new Do(e);
7911
7916
  let s = this.model.getViews();
7912
7917
  this.activeViewId = (o = e == null ? void 0 : e.activeViewId) == null ? s.length > 0 ? s[0].id : "" : o, this.activateView(this.activeViewId);
7913
7918
  }
@@ -7955,7 +7960,7 @@ var Oo = class e {
7955
7960
  }
7956
7961
  createTitleElement() {
7957
7962
  let e = document.createElement("div");
7958
- return e.setAttribute("data-blok-database-title", ""), e.textContent = this.title, e.style.fontSize = "1.5rem", e.style.fontWeight = "600", e.style.lineHeight = "1.3", e.style.color = "var(--blok-text-primary)", e.style.outline = "none", e.style.cursor = "text", e.style.wordBreak = "break-word", e.className = Tt.join(" "), M(e, "New database"), this.readOnly || (e.setAttribute("contenteditable", "true"), e.addEventListener("keydown", (t) => {
7963
+ return e.setAttribute("data-blok-database-title", ""), e.textContent = this.title, e.style.fontSize = "1.5rem", e.style.fontWeight = "600", e.style.lineHeight = "1.3", e.style.color = "var(--blok-text-primary)", e.style.outline = "none", e.style.cursor = "text", e.style.wordBreak = "break-word", e.className = M.join(" "), N(e, "New database"), this.readOnly || (e.setAttribute("contenteditable", "true"), e.addEventListener("keydown", (t) => {
7959
7964
  (t.key === "Enter" || t.key === "Tab") && (t.preventDefault(), e.blur());
7960
7965
  })), e;
7961
7966
  }
@@ -8021,7 +8026,7 @@ var Oo = class e {
8021
8026
  n !== void 0 && (n.call("updatePosition", { position: t }), n.dispatchChange()), this.syncRowsFromBlocks();
8022
8027
  }
8023
8028
  activateView(e) {
8024
- this.model.getView(e) !== void 0 && (this.activeViewId = e, this.sync = new Mo(this.config.adapter, (e) => {
8029
+ this.model.getView(e) !== void 0 && (this.activeViewId = e, this.sync = new jo(this.config.adapter, (e) => {
8025
8030
  this.api.notifier.show({
8026
8031
  message: String(e),
8027
8032
  style: "error"
@@ -8100,7 +8105,7 @@ var Oo = class e {
8100
8105
  }), !this.readOnly && n !== null && e !== null && !e.contains(n) && e.appendChild(n), e instanceof HTMLElement && (e.style.display = t.length >= 2 ? "" : "none"));
8101
8106
  }
8102
8107
  createTabBar() {
8103
- return new Jo({
8108
+ return new qo({
8104
8109
  views: this.model.getViews(),
8105
8110
  activeViewId: this.activeViewId,
8106
8111
  onTabClick: (e) => this.switchView(e),
@@ -8119,7 +8124,7 @@ var Oo = class e {
8119
8124
  }
8120
8125
  renderBoardView(e, t) {
8121
8126
  let n = t === void 0 ? [] : this.model.getSelectOptions(t), r = t === void 0 ? /* @__PURE__ */ new Map() : this.model.getRowsGroupedBy(t);
8122
- return this.view = new ko({
8127
+ return this.view = new Oo({
8123
8128
  readOnly: this.readOnly,
8124
8129
  i18n: this.api.i18n,
8125
8130
  options: n,
@@ -8142,7 +8147,7 @@ var Oo = class e {
8142
8147
  let r = this.model.getSchema();
8143
8148
  if (t !== void 0) {
8144
8149
  let i = this.model.getSelectOptions(t), a = this.model.getRowsGroupedBy(t);
8145
- this.view = new Ao({
8150
+ this.view = new ko({
8146
8151
  readOnly: this.readOnly,
8147
8152
  i18n: this.api.i18n,
8148
8153
  rows: [],
@@ -8155,7 +8160,7 @@ var Oo = class e {
8155
8160
  return (t = a.get(e)) == null ? [] : t;
8156
8161
  }
8157
8162
  });
8158
- } else this.view = new Ao({
8163
+ } else this.view = new ko({
8159
8164
  readOnly: this.readOnly,
8160
8165
  i18n: this.api.i18n,
8161
8166
  rows: this.model.getOrderedRows(),
@@ -8273,7 +8278,7 @@ var Oo = class e {
8273
8278
  let o = a.config.options, s = o.length > 0 ? o[o.length - 1].position : null, c = {
8274
8279
  id: w(),
8275
8280
  label: this.api.i18n.t("tools.database.columnTitlePlaceholder"),
8276
- position: Oo.positionBetween(s, null)
8281
+ position: Do.positionBetween(s, null)
8277
8282
  };
8278
8283
  this.model.updateProperty(i, { config: { options: [...o, c] } }), (t = (n = this.view).appendGroup) == null || t.call(n, e, c), this.sync.syncUpdateProperty({
8279
8284
  propertyId: i,
@@ -8284,16 +8289,16 @@ var Oo = class e {
8284
8289
  var t;
8285
8290
  if (this.element === null) return;
8286
8291
  let n = this.model.getView(this.activeViewId), r = (n == null ? void 0 : n.type) === "list", i = this.model.getSchema().find((e) => e.type === "title"), a = (t = i == null ? void 0 : i.id) == null ? "" : t, o = this.model.getSchema().find((e) => e.type === "richText"), s = o == null ? void 0 : o.id;
8287
- r ? this.listRowDrag = new zo({
8292
+ r ? this.listRowDrag = new Ro({
8288
8293
  wrapper: e,
8289
8294
  onDrop: (e) => this.handleListRowDrop(e)
8290
- }) : (this.cardDrag = new Po({
8295
+ }) : (this.cardDrag = new No({
8291
8296
  wrapper: e,
8292
8297
  onDrop: (e) => this.handleRowDrop(e)
8293
- }), this.columnDrag = new Io({
8298
+ }), this.columnDrag = new Fo({
8294
8299
  wrapper: e,
8295
8300
  onDrop: (e) => this.handleGroupDrop(e)
8296
- }), this.columnControls = new Lo({
8301
+ }), this.columnControls = new Io({
8297
8302
  i18n: this.api.i18n,
8298
8303
  onRename: (e, t) => this.handleOptionRename(e, t),
8299
8304
  onDelete: (t) => this.handleOptionDelete(t, e),
@@ -8311,7 +8316,7 @@ var Oo = class e {
8311
8316
  changes: { config: { options: a } }
8312
8317
  });
8313
8318
  }
8314
- }), this.makeColumnHeadersEditable(e)), this.cardDrawer === null && (this.cardDrawer = new Ho({
8319
+ }), this.makeColumnHeadersEditable(e)), this.cardDrawer === null && (this.cardDrawer = new Vo({
8315
8320
  wrapper: this.element,
8316
8321
  readOnly: this.readOnly,
8317
8322
  i18n: this.api.i18n,
@@ -8345,7 +8350,7 @@ var Oo = class e {
8345
8350
  position: n.position
8346
8351
  }), (t = this.cardDrawer) == null || t.refreshSchema(this.model.getSchema());
8347
8352
  }
8348
- })), this.keyboard = new Uo({
8353
+ })), this.keyboard = new Ho({
8349
8354
  wrapper: e,
8350
8355
  onEscape: () => {
8351
8356
  var e;
@@ -8392,7 +8397,7 @@ var Oo = class e {
8392
8397
  }
8393
8398
  handleListRowDrop(e) {
8394
8399
  var t, n;
8395
- let { rowId: r, beforeRowId: i, afterRowId: a } = e, o = i === null ? void 0 : this.model.getRow(i), s = a === null ? void 0 : this.model.getRow(a), c = Oo.positionBetween((t = s == null ? void 0 : s.position) == null ? null : t, (n = o == null ? void 0 : o.position) == null ? null : n);
8400
+ let { rowId: r, beforeRowId: i, afterRowId: a } = e, o = i === null ? void 0 : this.model.getRow(i), s = a === null ? void 0 : this.model.getRow(a), c = Do.positionBetween((t = s == null ? void 0 : s.position) == null ? null : t, (n = o == null ? void 0 : o.position) == null ? null : n);
8396
8401
  this.moveRowBlock(r, c), this.rerenderView(), this.sync.syncMoveRow({
8397
8402
  rowId: r,
8398
8403
  position: c
@@ -8402,7 +8407,7 @@ var Oo = class e {
8402
8407
  var t, n;
8403
8408
  let { rowId: r, toOptionId: i, beforeRowId: a, afterRowId: o } = e, s = this.model.getView(this.activeViewId), c = s == null ? void 0 : s.groupBy;
8404
8409
  if (c === void 0) return;
8405
- let l = a === null ? void 0 : this.model.getRow(a), u = o === null ? void 0 : this.model.getRow(o), d = Oo.positionBetween((t = u == null ? void 0 : u.position) == null ? null : t, (n = l == null ? void 0 : l.position) == null ? null : n);
8410
+ let l = a === null ? void 0 : this.model.getRow(a), u = o === null ? void 0 : this.model.getRow(o), d = Do.positionBetween((t = u == null ? void 0 : u.position) == null ? null : t, (n = l == null ? void 0 : l.position) == null ? null : n);
8406
8411
  this.updateRowBlock(r, { [c]: i }), this.moveRowBlock(r, d), this.rerenderView(), this.sync.syncUpdateRow({
8407
8412
  rowId: r,
8408
8413
  properties: { [c]: i }
@@ -8419,7 +8424,7 @@ var Oo = class e {
8419
8424
  if ((c == null ? void 0 : c.config) === void 0) return;
8420
8425
  let l = [...c.config.options], u = l.findIndex((e) => e.id === r);
8421
8426
  if (u === -1) return;
8422
- let d = i === null ? void 0 : l.find((e) => e.id === i), f = a === null ? void 0 : l.find((e) => e.id === a), p = Oo.positionBetween((t = f == null ? void 0 : f.position) == null ? null : t, (n = d == null ? void 0 : d.position) == null ? null : n);
8427
+ let d = i === null ? void 0 : l.find((e) => e.id === i), f = a === null ? void 0 : l.find((e) => e.id === a), p = Do.positionBetween((t = f == null ? void 0 : f.position) == null ? null : t, (n = d == null ? void 0 : d.position) == null ? null : n);
8423
8428
  l[u] = A(A({}, l[u]), {}, { position: p }), this.model.updateProperty(s, { config: { options: l } }), this.moveColumnInDom(r, i), this.sync.syncUpdateProperty({
8424
8429
  propertyId: s,
8425
8430
  changes: { config: { options: l } }
@@ -8478,7 +8483,7 @@ var Oo = class e {
8478
8483
  let m = p.querySelector("[data-blok-database-board]");
8479
8484
  m !== null && (m.scrollLeft = f), this.attachViewListeners(p), this.initSubsystems(p);
8480
8485
  }
8481
- }, Xo = class {
8486
+ }, Yo = class {
8482
8487
  constructor({ data: e }) {
8483
8488
  var t, n;
8484
8489
  this._data = {
@@ -8515,7 +8520,7 @@ var Oo = class e {
8515
8520
  return !0;
8516
8521
  }
8517
8522
  setReadOnly(e) {}
8518
- }, Zo = class {
8523
+ }, Xo = class {
8519
8524
  constructor(e) {
8520
8525
  this.element = null;
8521
8526
  }
@@ -8568,7 +8573,7 @@ var Oo = class e {
8568
8573
  static get sanitize() {
8569
8574
  return {};
8570
8575
  }
8571
- }, Qo = "tools.quote.placeholder", $o = [
8576
+ }, Zo = "tools.quote.placeholder", Qo = [
8572
8577
  "border-l-[3px]",
8573
8578
  "border-current",
8574
8579
  "pl-[0.9em]",
@@ -8578,7 +8583,7 @@ var Oo = class e {
8578
8583
  "outline-hidden",
8579
8584
  "mt-[0.3em]",
8580
8585
  "mb-[0.3em]"
8581
- ], es = "text-[1.2em]", ts = class {
8586
+ ], $o = "text-[1.2em]", es = class {
8582
8587
  constructor({ data: e, api: t, readOnly: n }) {
8583
8588
  var r, i;
8584
8589
  this.placeholderCleanup = null, this._element = null, this.api = t, this.readOnly = n, this._data = {
@@ -8591,13 +8596,13 @@ var Oo = class e {
8591
8596
  }
8592
8597
  drawView() {
8593
8598
  let e = document.createElement("blockquote");
8594
- return e.className = j(this.api.styles.block, $o, Dt, this._data.size === "large" ? es : ""), e.setAttribute(k.tool, "quote"), e.contentEditable = "false", this._data.text ? e.innerHTML = this._data.text : this.readOnly && (e.innerHTML = "<br>"), this.readOnly || (e.contentEditable = "true", e.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = M(e, this.api.i18n.t(Qo), "data-blok-placeholder-active")), e;
8599
+ return e.className = j(this.api.styles.block, Qo, Et, this._data.size === "large" ? $o : ""), e.setAttribute(k.tool, "quote"), e.contentEditable = "false", this._data.text ? e.innerHTML = this._data.text : this.readOnly && (e.innerHTML = "<br>"), this.readOnly || (e.contentEditable = "true", e.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = N(e, this.api.i18n.t(Zo), "data-blok-placeholder-active")), e;
8595
8600
  }
8596
8601
  render() {
8597
8602
  return this._element || (this._element = this.drawView()), this._element;
8598
8603
  }
8599
8604
  setReadOnly(e) {
8600
- this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), kt(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = M(this._element, this.api.i18n.t(Qo), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
8605
+ this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), Ot(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = N(this._element, this.api.i18n.t(Zo), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
8601
8606
  }
8602
8607
  save(e) {
8603
8608
  return {
@@ -8637,7 +8642,7 @@ var Oo = class e {
8637
8642
  }];
8638
8643
  }
8639
8644
  setSize(e) {
8640
- this._data.size = e, this._element && (this._element.className = j(this.api.styles.block, $o, Dt, e === "large" ? es : ""));
8645
+ this._data.size = e, this._element && (this._element.className = j(this.api.styles.block, Qo, Et, e === "large" ? $o : ""));
8641
8646
  }
8642
8647
  onPaste(e) {
8643
8648
  let t = e.detail;
@@ -8685,7 +8690,7 @@ var Oo = class e {
8685
8690
  static get pasteConfig() {
8686
8691
  return { tags: ["BLOCKQUOTE"] };
8687
8692
  }
8688
- }, ns = "tools.code.language", rs = "tools.code.copied", is = "tools.code.copyCode", as = "tools.code.searchLanguage", os = "plain text", ss = [
8693
+ }, ts = "tools.code.language", ns = "tools.code.copied", rs = "tools.code.copyCode", is = "tools.code.searchLanguage", as = "plain text", os = [
8689
8694
  {
8690
8695
  id: "plain text",
8691
8696
  name: "Plain Text"
@@ -8810,12 +8815,12 @@ var Oo = class e {
8810
8815
  id: "lua",
8811
8816
  name: "Lua"
8812
8817
  }
8813
- ], cs = "group/code flex flex-col rounded-xl border border-border-secondary bg-bg-secondary overflow-hidden my-2", ls = "flex items-center gap-1 px-3 py-1.5 text-xs text-gray-text", us = "inline-flex items-center px-1.5 py-0.5 rounded cursor-pointer bg-transparent border-0 text-xs text-gray-text font-medium transition-colors can-hover:hover:bg-item-hover-bg select-none", ds = "flex items-center gap-1 opacity-0 group-hover/code:opacity-100 transition-opacity", fs = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", ps = "p-1.5 rounded-lg cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", ms = "block px-4 py-3 font-mono text-sm leading-relaxed outline-hidden whitespace-pre-wrap overflow-x-auto min-h-[1.5em]", hs = "text-xs text-gray-text font-medium select-none", gs = new Set(["latex", "mermaid"]), _s = "tools.code.codeTab", vs = "tools.code.previewTab", ys = "px-4 py-3 overflow-x-auto min-h-[1.5em] flex justify-center", bs = "tools.code.sideBySide", xs = "flex items-center rounded-lg border border-border-secondary p-0.5 gap-0.5", Ss = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors flex items-center justify-center", Cs = "p-1 rounded cursor-pointer bg-item-hover-bg border-0 text-primary transition-colors flex items-center justify-center", ws = "p-[6px] rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors flex items-center justify-center", Ts = "p-[6px] rounded cursor-pointer bg-item-hover-bg border-0 text-primary transition-colors flex items-center justify-center", Es = "flex flex-col overflow-hidden", Ds = "flex flex-row overflow-hidden", Os = "flex-1 min-w-0 overflow-hidden", ks = "one-light", As = "vitesse-dark", js = ".dark", Ms = new Set(ss.map((e) => e.id).filter((e) => e !== os)), Ns = "flex overflow-hidden", Ps = "select-none text-right pl-4 pr-3 py-3 font-mono text-sm leading-relaxed text-gray-text/40 shrink-0", Fs = "leading-relaxed";
8818
+ ], ss = "group/code flex flex-col rounded-xl border border-border-secondary bg-bg-secondary overflow-hidden my-2", cs = "flex items-center gap-1 px-3 py-1.5 text-xs text-gray-text", ls = "inline-flex items-center px-1.5 py-0.5 rounded cursor-pointer bg-transparent border-0 text-xs text-gray-text font-medium transition-colors can-hover:hover:bg-item-hover-bg select-none", us = "flex items-center gap-1 opacity-0 group-hover/code:opacity-100 transition-opacity", ds = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", fs = "p-1.5 rounded-lg cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", ps = "block px-4 py-3 font-mono text-sm leading-relaxed outline-hidden whitespace-pre-wrap overflow-x-auto min-h-[1.5em]", ms = "text-xs text-gray-text font-medium select-none", hs = new Set(["latex", "mermaid"]), gs = "tools.code.codeTab", _s = "tools.code.previewTab", vs = "px-4 py-3 overflow-x-auto min-h-[1.5em] flex justify-center", ys = "tools.code.sideBySide", bs = "flex items-center rounded-lg border border-border-secondary p-0.5 gap-0.5", xs = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors flex items-center justify-center", Ss = "p-1 rounded cursor-pointer bg-item-hover-bg border-0 text-primary transition-colors flex items-center justify-center", Cs = "p-[6px] rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors flex items-center justify-center", ws = "p-[6px] rounded cursor-pointer bg-item-hover-bg border-0 text-primary transition-colors flex items-center justify-center", Ts = "flex flex-col overflow-hidden", Es = "flex flex-row overflow-hidden", Ds = "flex-1 min-w-0 overflow-hidden", Os = "one-light", ks = "vitesse-dark", As = ".dark", js = new Set(os.map((e) => e.id).filter((e) => e !== as)), Ms = "flex overflow-hidden", Ns = "select-none text-right pl-4 pr-3 py-3 font-mono text-sm leading-relaxed text-gray-text/40 shrink-0", Ps = "leading-relaxed";
8814
8819
  //#endregion
8815
8820
  //#region src/tools/code/dom-builder.ts
8816
- function Is(e) {
8821
+ function Fs(e) {
8817
8822
  let t = document.createElement("div");
8818
- t.className = xs, t.setAttribute("role", "group"), t.setAttribute("data-blok-testid", "code-view-mode");
8823
+ t.className = bs, t.setAttribute("role", "group"), t.setAttribute("data-blok-testid", "code-view-mode");
8819
8824
  let n = [
8820
8825
  {
8821
8826
  mode: "code",
@@ -8835,61 +8840,61 @@ function Is(e) {
8835
8840
  ];
8836
8841
  for (let { mode: e, icon: r, label: i } of n) {
8837
8842
  let n = document.createElement("button"), a = e === "preview";
8838
- n.type = "button", n.className = a ? ws : Ss, n.innerHTML = r, n.setAttribute("aria-label", i), n.setAttribute("aria-pressed", "false"), n.setAttribute("data-blok-testid", `code-mode-${e}`), n.setAttribute("data-mode", e), t.appendChild(n);
8843
+ n.type = "button", n.className = a ? Cs : xs, n.innerHTML = r, n.setAttribute("aria-label", i), n.setAttribute("aria-pressed", "false"), n.setAttribute("data-blok-testid", `code-mode-${e}`), n.setAttribute("data-mode", e), t.appendChild(n);
8839
8844
  }
8840
8845
  let i = document.createElement("div");
8841
- i.className = ys, i.setAttribute("data-blok-testid", "code-preview");
8846
+ i.className = vs, i.setAttribute("data-blok-testid", "code-preview");
8842
8847
  let a = document.createElement("div");
8843
- return a.className = Es, a.setAttribute("data-blok-testid", "code-split-container"), {
8848
+ return a.className = Ts, a.setAttribute("data-blok-testid", "code-split-container"), {
8844
8849
  viewModeContainer: t,
8845
8850
  previewElement: i,
8846
8851
  splitContainer: a
8847
8852
  };
8848
8853
  }
8849
- function Ls(e, t) {
8854
+ function Is(e, t) {
8850
8855
  let n = Array.from(e.querySelectorAll("[data-mode]"));
8851
8856
  for (let e of n) {
8852
8857
  let n = e.getAttribute("data-mode") === t, r = e.getAttribute("data-mode") === "preview";
8853
- e.setAttribute("aria-pressed", String(n)), r ? e.className = n ? Ts : ws : e.className = n ? Cs : Ss;
8858
+ e.setAttribute("aria-pressed", String(n)), r ? e.className = n ? ws : Cs : e.className = n ? Ss : xs;
8854
8859
  }
8855
8860
  }
8856
- function Rs(e) {
8861
+ function Ls(e) {
8857
8862
  var t, n, r;
8858
8863
  let { code: i, languageName: a, readOnly: o, copyLabel: s, previewable: c, viewModeLabels: l } = e, u = document.createElement("div");
8859
- u.className = cs;
8864
+ u.className = ss;
8860
8865
  let d = document.createElement("div");
8861
- d.className = ls;
8866
+ d.className = cs;
8862
8867
  let f = document.createElement("button");
8863
- f.type = "button", f.className = us, f.setAttribute("aria-haspopup", "listbox"), f.setAttribute("data-blok-testid", "code-language-btn");
8868
+ f.type = "button", f.className = ls, f.setAttribute("aria-haspopup", "listbox"), f.setAttribute("data-blok-testid", "code-language-btn");
8864
8869
  let p = document.createElement("span");
8865
8870
  p.textContent = a, f.appendChild(p);
8866
8871
  let m = document.createElement("span");
8867
8872
  m.className = "inline-flex items-center ml-0.5 -mr-0.5", m.innerHTML = te, f.appendChild(m);
8868
8873
  let h = document.createElement("div");
8869
8874
  h.className = "flex-1";
8870
- let g = !o && l ? Is(l) : null, _ = (t = g == null ? void 0 : g.viewModeContainer) == null ? null : t, v = (n = g == null ? void 0 : g.previewElement) == null ? null : n, y = (r = g == null ? void 0 : g.splitContainer) == null ? null : r;
8875
+ let g = !o && l ? Fs(l) : null, _ = (t = g == null ? void 0 : g.viewModeContainer) == null ? null : t, v = (n = g == null ? void 0 : g.previewElement) == null ? null : n, y = (r = g == null ? void 0 : g.splitContainer) == null ? null : r;
8871
8876
  _ && (_.hidden = !c);
8872
8877
  let b = document.createElement("button");
8873
- b.type = "button", b.className = c ? ps : fs, b.innerHTML = ee, b.setAttribute("aria-label", s), b.setAttribute("data-blok-testid", "code-copy-btn");
8878
+ b.type = "button", b.className = c ? fs : ds, b.innerHTML = ee, b.setAttribute("aria-label", s), b.setAttribute("data-blok-testid", "code-copy-btn");
8874
8879
  let x = document.createElement("code");
8875
- x.className = ms, x.setAttribute("data-blok-testid", "code-content"), i && (x.textContent = i), o || (x.setAttribute("contenteditable", "plaintext-only"), x.setAttribute("spellcheck", "false"));
8880
+ x.className = ps, x.setAttribute("data-blok-testid", "code-content"), i && (x.textContent = i), o || (x.setAttribute("contenteditable", "plaintext-only"), x.setAttribute("spellcheck", "false"));
8876
8881
  let S = document.createElement("div");
8877
- S.className = Ps, S.setAttribute("aria-hidden", "true"), S.setAttribute("data-blok-testid", "code-gutter");
8882
+ S.className = Ns, S.setAttribute("aria-hidden", "true"), S.setAttribute("data-blok-testid", "code-gutter");
8878
8883
  let ne = i ? i.split("\n").length : 1;
8879
8884
  Array.from({ length: ne }, (e, t) => {
8880
8885
  let n = document.createElement("div");
8881
- n.className = Fs, n.textContent = String(t + 1), S.appendChild(n);
8886
+ n.className = Ps, n.textContent = String(t + 1), S.appendChild(n);
8882
8887
  }), d.appendChild(f), d.appendChild(h);
8883
8888
  let re = document.createElement("div");
8884
- re.className = ds, _ && re.appendChild(_), re.appendChild(b), d.appendChild(re);
8889
+ re.className = us, _ && re.appendChild(_), re.appendChild(b), d.appendChild(re);
8885
8890
  let ie = document.createElement("pre");
8886
8891
  ie.appendChild(x);
8887
8892
  let C = document.createElement("div");
8888
- if (C.className = Ns, C.appendChild(S), C.appendChild(ie), u.appendChild(d), y && v) {
8893
+ if (C.className = Ms, C.appendChild(S), C.appendChild(ie), u.appendChild(d), y && v) {
8889
8894
  let e = document.createElement("div");
8890
- e.className = Os, e.appendChild(C);
8895
+ e.className = Ds, e.appendChild(C);
8891
8896
  let t = document.createElement("div");
8892
- t.className = Os, t.appendChild(v), y.appendChild(e), y.appendChild(t), u.appendChild(y);
8897
+ t.className = Ds, t.appendChild(v), y.appendChild(e), y.appendChild(t), u.appendChild(y);
8893
8898
  } else u.appendChild(C);
8894
8899
  return {
8895
8900
  wrapper: u,
@@ -8905,10 +8910,10 @@ function Rs(e) {
8905
8910
  }
8906
8911
  //#endregion
8907
8912
  //#region src/tools/code/code-keyboard.ts
8908
- function zs(e, t, n) {
8909
- return e.key === "Enter" && e.shiftKey ? (n(), !0) : e.key === "Enter" ? (Bs(t), !0) : e.key === "Tab" && !e.shiftKey ? (Vs(), !0) : e.key === "Tab" && e.shiftKey ? (Us(t), !0) : !1;
8913
+ function Rs(e, t, n) {
8914
+ return e.key === "Enter" && e.shiftKey ? (n(), !0) : e.key === "Enter" ? (zs(t), !0) : e.key === "Tab" && !e.shiftKey ? (Bs(), !0) : e.key === "Tab" && e.shiftKey ? (Hs(t), !0) : !1;
8910
8915
  }
8911
- function Bs(e) {
8916
+ function zs(e) {
8912
8917
  var t;
8913
8918
  let n = window.getSelection();
8914
8919
  if (!n || n.rangeCount === 0) return;
@@ -8916,9 +8921,9 @@ function Bs(e) {
8916
8921
  i.selectNodeContents(e), i.setEnd(r.startContainer, r.startOffset);
8917
8922
  let a = i.toString().length, o = (t = e.textContent) == null ? "" : t, s = o.substring(0, a), c = o.substring(a);
8918
8923
  for (; e.firstChild;) e.removeChild(e.firstChild);
8919
- e.appendChild(document.createTextNode(s + "\n" + c)), Ws(e, a + 1);
8924
+ e.appendChild(document.createTextNode(s + "\n" + c)), Us(e, a + 1);
8920
8925
  }
8921
- function Vs() {
8926
+ function Bs() {
8922
8927
  let e = window.getSelection();
8923
8928
  if (!e || e.rangeCount === 0) return;
8924
8929
  let t = e.getRangeAt(0);
@@ -8926,23 +8931,23 @@ function Vs() {
8926
8931
  let n = document.createTextNode(" ");
8927
8932
  t.insertNode(n), t.setStartAfter(n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
8928
8933
  }
8929
- function Hs(e) {
8934
+ function Vs(e) {
8930
8935
  let t = Math.min(2, e.length), n = e.substring(0, t).match(/^ */);
8931
8936
  return n ? n[0].length : 0;
8932
8937
  }
8933
- function Us(e) {
8938
+ function Hs(e) {
8934
8939
  var t;
8935
8940
  let n = window.getSelection();
8936
8941
  if (!n || n.rangeCount === 0) return;
8937
8942
  let r = n.getRangeAt(0), i = (t = e.textContent) == null ? "" : t, a = r.cloneRange();
8938
8943
  a.selectNodeContents(e), a.setEnd(r.startContainer, r.startOffset);
8939
- let o = a.toString().length, s = i.lastIndexOf("\n", o - 1) + 1, c = Hs(i.substring(s));
8944
+ let o = a.toString().length, s = i.lastIndexOf("\n", o - 1) + 1, c = Vs(i.substring(s));
8940
8945
  if (c === 0) return;
8941
8946
  let l = i.substring(0, s) + i.substring(s + c);
8942
8947
  for (; e.firstChild;) e.removeChild(e.firstChild);
8943
- e.appendChild(document.createTextNode(l)), Ws(e, Math.max(s, o - c));
8948
+ e.appendChild(document.createTextNode(l)), Us(e, Math.max(s, o - c));
8944
8949
  }
8945
- function Ws(e, t) {
8950
+ function Us(e, t) {
8946
8951
  let n = window.getSelection();
8947
8952
  if (!n) return;
8948
8953
  let r = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), i = (e) => {
@@ -8961,23 +8966,23 @@ function Ws(e, t) {
8961
8966
  }
8962
8967
  //#endregion
8963
8968
  //#region src/tools/code/katex-loader.ts
8964
- var Gs = {
8969
+ var Ws = {
8965
8970
  katexPromise: null,
8966
8971
  cssInjected: !1
8967
8972
  };
8968
- function Ks() {
8969
- if (Gs.cssInjected) return;
8970
- Gs.cssInjected = !0;
8973
+ function Gs() {
8974
+ if (Ws.cssInjected) return;
8975
+ Ws.cssInjected = !0;
8971
8976
  let e = document.createElement("link");
8972
8977
  e.rel = "stylesheet", e.setAttribute("data-katex-css", ""), e.href = "https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css", document.head.appendChild(e);
8973
8978
  }
8974
- async function qs() {
8975
- return Gs.katexPromise || (Gs.katexPromise = import("./katex-B8jUB5Cv.mjs").then((e) => e.n).then((e) => e.default)), Gs.katexPromise;
8979
+ async function Ks() {
8980
+ return Ws.katexPromise || (Ws.katexPromise = import("./katex-B8jUB5Cv.mjs").then((e) => e.n).then((e) => e.default)), Ws.katexPromise;
8976
8981
  }
8977
- async function Js(e) {
8978
- Ks();
8982
+ async function qs(e) {
8983
+ Gs();
8979
8984
  try {
8980
- return (await qs()).renderToString(e, {
8985
+ return (await Ks()).renderToString(e, {
8981
8986
  throwOnError: !1,
8982
8987
  displayMode: !0
8983
8988
  });
@@ -8987,21 +8992,21 @@ async function Js(e) {
8987
8992
  }
8988
8993
  //#endregion
8989
8994
  //#region src/tools/code/mermaid-loader.ts
8990
- var Ys = {
8995
+ var Js = {
8991
8996
  mermaidPromise: null,
8992
8997
  initialized: !1
8993
8998
  };
8994
- async function Xs() {
8995
- Ys.mermaidPromise || (Ys.mermaidPromise = import("./mermaid.core-C40gcVfv.mjs").then((e) => e.default));
8996
- let e = await Ys.mermaidPromise;
8997
- return Ys.initialized || (Ys.initialized = !0, e.initialize({
8999
+ async function Ys() {
9000
+ Js.mermaidPromise || (Js.mermaidPromise = import("./mermaid.core-C40gcVfv.mjs").then((e) => e.default));
9001
+ let e = await Js.mermaidPromise;
9002
+ return Js.initialized || (Js.initialized = !0, e.initialize({
8998
9003
  startOnLoad: !1,
8999
9004
  securityLevel: "strict"
9000
9005
  })), e;
9001
9006
  }
9002
- async function Zs(e) {
9007
+ async function Xs(e) {
9003
9008
  try {
9004
- let t = await Xs();
9009
+ let t = await Ys();
9005
9010
  if (await t.parse(e, { suppressErrors: !0 }) === !1) return "<span class=\"text-red-500 text-sm\">Invalid Mermaid syntax</span>";
9006
9011
  let n = `mermaid-${crypto.randomUUID()}`;
9007
9012
  return (await t.render(n, e)).svg;
@@ -9011,7 +9016,7 @@ async function Zs(e) {
9011
9016
  }
9012
9017
  //#endregion
9013
9018
  //#region src/tools/code/shiki-loader.ts
9014
- var Qs = {
9019
+ var Zs = {
9015
9020
  javascript: () => import("./javascript-DilE9EuZ.mjs"),
9016
9021
  typescript: () => import("./typescript-DhtGMhWX.mjs").then((e) => e.n),
9017
9022
  python: () => import("./python-DYiHKGPV.mjs"),
@@ -9042,29 +9047,29 @@ var Qs = {
9042
9047
  lua: () => import("./lua-COOfzihE.mjs"),
9043
9048
  latex: () => import("./latex-DY1HNB4U.mjs"),
9044
9049
  mermaid: () => import("./mermaid-BKA834jS.mjs")
9045
- }, $s = {
9050
+ }, Qs = {
9046
9051
  highlighterPromise: null,
9047
9052
  highlighter: null
9048
9053
  };
9049
- function ec(e) {
9050
- return Ms.has(e);
9054
+ function $s(e) {
9055
+ return js.has(e);
9051
9056
  }
9052
- async function tc() {
9053
- return $s.highlighterPromise || ($s.highlighterPromise = (async () => {
9054
- let { createHighlighterCore: e } = await import("./core-C942GvJO.mjs"), { createJavaScriptRegexEngine: t } = await import("./engine-javascript-Dd6ViPCH.mjs"), n = await e({
9057
+ async function ec() {
9058
+ return Qs.highlighterPromise || (Qs.highlighterPromise = (async () => {
9059
+ let { createHighlighterCore: e } = await import("./core-B7mxBIHA.mjs"), { createJavaScriptRegexEngine: t } = await import("./engine-javascript-Bmmg8uL9.mjs"), n = await e({
9055
9060
  themes: [import("./one-light-Di_o5Kb7.mjs"), import("./vitesse-dark-B5oAIYZ5.mjs")],
9056
9061
  langs: [],
9057
9062
  engine: t()
9058
9063
  });
9059
- return $s.highlighter = n, n;
9060
- })()), $s.highlighterPromise;
9064
+ return Qs.highlighter = n, n;
9065
+ })()), Qs.highlighterPromise;
9061
9066
  }
9062
- async function nc(e, t) {
9067
+ async function tc(e, t) {
9063
9068
  if (e.getLoadedLanguages().includes(t)) return;
9064
- let n = Qs[t];
9069
+ let n = Zs[t];
9065
9070
  n && await e.loadLanguage(await n());
9066
9071
  }
9067
- function rc(e) {
9072
+ function nc(e) {
9068
9073
  return {
9069
9074
  tokens: e.tokens.map((t) => t.map((t) => {
9070
9075
  var n;
@@ -9077,52 +9082,52 @@ function rc(e) {
9077
9082
  fg: e.fg
9078
9083
  };
9079
9084
  }
9080
- async function ic(e, t) {
9081
- if (!ec(t)) return null;
9085
+ async function rc(e, t) {
9086
+ if (!$s(t)) return null;
9082
9087
  try {
9083
- let n = await tc();
9084
- await nc(n, t);
9088
+ let n = await ec();
9089
+ await tc(n, t);
9085
9090
  let r = n.codeToTokens(e, {
9086
9091
  lang: t,
9087
- theme: ks
9092
+ theme: Os
9088
9093
  }), i = n.codeToTokens(e, {
9089
9094
  lang: t,
9090
- theme: As
9095
+ theme: ks
9091
9096
  });
9092
9097
  return {
9093
- light: rc(r),
9094
- dark: rc(i)
9098
+ light: nc(r),
9099
+ dark: nc(i)
9095
9100
  };
9096
9101
  } catch (e) {
9097
- return $s.highlighterPromise = null, $s.highlighter = null, null;
9102
+ return Qs.highlighterPromise = null, Qs.highlighter = null, null;
9098
9103
  }
9099
9104
  }
9100
9105
  //#endregion
9101
9106
  //#region src/tools/code/highlight-applier.ts
9102
- var ac = {
9107
+ var ic = {
9103
9108
  stylesheet: null,
9104
9109
  knownRules: /* @__PURE__ */ new Set()
9105
9110
  };
9106
- function oc() {
9111
+ function ac() {
9107
9112
  return typeof CSS < "u" && "highlights" in CSS;
9108
9113
  }
9109
- function sc() {
9114
+ function oc() {
9110
9115
  return CSS.highlights;
9111
9116
  }
9112
- function cc() {
9113
- return ac.stylesheet || (ac.stylesheet = new CSSStyleSheet(), document.adoptedStyleSheets = [...document.adoptedStyleSheets, ac.stylesheet]), ac.stylesheet;
9117
+ function sc() {
9118
+ return ic.stylesheet || (ic.stylesheet = new CSSStyleSheet(), document.adoptedStyleSheets = [...document.adoptedStyleSheets, ic.stylesheet]), ic.stylesheet;
9114
9119
  }
9115
- function lc(e) {
9120
+ function cc(e) {
9116
9121
  let t = e.replace("#", "").toLowerCase();
9117
9122
  return t.length > 6 ? t.substring(0, 6) : t;
9118
9123
  }
9119
- function uc(e, t, n, r) {
9124
+ function lc(e, t, n, r) {
9120
9125
  let i = `${r == null ? "" : r}::${t}`;
9121
- if (ac.knownRules.has(i)) return;
9126
+ if (ic.knownRules.has(i)) return;
9122
9127
  let a = r ? `${r} ::highlight(${t}) { color: ${n}; }` : `::highlight(${t}) { color: ${n}; }`;
9123
- e.insertRule(a, e.cssRules.length), ac.knownRules.add(i);
9128
+ e.insertRule(a, e.cssRules.length), ic.knownRules.add(i);
9124
9129
  }
9125
- function dc(e, t) {
9130
+ function uc(e, t) {
9126
9131
  let n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), r = (i, a) => {
9127
9132
  var o, s;
9128
9133
  if (!i) {
@@ -9143,7 +9148,7 @@ function dc(e, t) {
9143
9148
  };
9144
9149
  return r(n.nextNode(), 0);
9145
9150
  }
9146
- function fc(e) {
9151
+ function dc(e) {
9147
9152
  return e.split("\n").reduce((e, t) => ({
9148
9153
  offsets: [...e.offsets, e.pos],
9149
9154
  pos: e.pos + t.length + 1
@@ -9152,30 +9157,30 @@ function fc(e) {
9152
9157
  pos: 0
9153
9158
  }).offsets;
9154
9159
  }
9155
- function pc(e, t, n, r, i, a, o, s, c) {
9160
+ function fc(e, t, n, r, i, a, o, s, c) {
9156
9161
  if (!r.content.trim()) return;
9157
9162
  let l = n + r.offset, u = l + r.content.length;
9158
9163
  if (u > t.length) return;
9159
- let d = dc(e, l), f = dc(e, u);
9164
+ let d = uc(e, l), f = uc(e, u);
9160
9165
  if (!(!d || !f)) try {
9161
9166
  let e = new Range();
9162
9167
  e.setStart(d.node, d.offset), e.setEnd(f.node, f.offset);
9163
- let t = `blok-${i}-${lc(r.color)}`, n = sc();
9164
- uc(s, t, r.color, a);
9168
+ let t = `blok-${i}-${cc(r.color)}`, n = oc();
9169
+ lc(s, t, r.color, a);
9165
9170
  let l = n.get(t), u = l == null ? new Highlight() : l;
9166
9171
  l || (u.priority = o, n.set(t, u)), u.add(e), c.push([t, e]);
9167
9172
  } catch (e) {}
9168
9173
  }
9169
- function mc(e, t, n, r, i, a, o, s, c) {
9174
+ function pc(e, t, n, r, i, a, o, s, c) {
9170
9175
  for (let [l, u] of r.tokens.entries()) {
9171
9176
  let r = n[l];
9172
- if (r !== void 0) for (let n of u) pc(e, t, r, n, i, a, o, s, c);
9177
+ if (r !== void 0) for (let n of u) fc(e, t, r, n, i, a, o, s, c);
9173
9178
  }
9174
9179
  }
9175
- function hc(e, t) {
9180
+ function mc(e, t) {
9176
9181
  var n;
9177
- if (!oc()) return () => {};
9178
- let r = cc(), i = [], a = (n = e.textContent) == null ? "" : n, o = fc(a), s = [[
9182
+ if (!ac()) return () => {};
9183
+ let r = sc(), i = [], a = (n = e.textContent) == null ? "" : n, o = dc(a), s = [[
9179
9184
  "l",
9180
9185
  t.light,
9181
9186
  void 0,
@@ -9183,13 +9188,13 @@ function hc(e, t) {
9183
9188
  ], [
9184
9189
  "d",
9185
9190
  t.dark,
9186
- js,
9191
+ As,
9187
9192
  1
9188
9193
  ]];
9189
- for (let [t, n, c, l] of s) mc(e, a, o, n, t, c, l, r, i);
9190
- return () => gc(i, sc());
9194
+ for (let [t, n, c, l] of s) pc(e, a, o, n, t, c, l, r, i);
9195
+ return () => hc(i, oc());
9191
9196
  }
9192
- function gc(e, t) {
9197
+ function hc(e, t) {
9193
9198
  for (let [n, r] of e) {
9194
9199
  let e = t.get(n);
9195
9200
  e && (e.delete(r), e.size === 0 && t.delete(n));
@@ -9197,7 +9202,7 @@ function gc(e, t) {
9197
9202
  }
9198
9203
  //#endregion
9199
9204
  //#region src/tools/code/language-detector.ts
9200
- var _c = [
9205
+ var gc = [
9201
9206
  "javascript",
9202
9207
  "typescript",
9203
9208
  "python",
@@ -9213,8 +9218,8 @@ var _c = [
9213
9218
  "yaml",
9214
9219
  "markdown",
9215
9220
  "php"
9216
- ], vc = 20, yc = .75, bc = 2;
9217
- function xc(e, t) {
9221
+ ], _c = 20, vc = .75, yc = 2;
9222
+ function bc(e, t) {
9218
9223
  let n = e.flat(), r = n.reduce((e, t) => e + t.content.length, 0);
9219
9224
  if (r === 0) return 1;
9220
9225
  let { fgChars: i, nonFgColors: a } = n.reduce((e, n) => ({
@@ -9224,16 +9229,16 @@ function xc(e, t) {
9224
9229
  fgChars: 0,
9225
9230
  nonFgColors: /* @__PURE__ */ new Set()
9226
9231
  });
9227
- return a.size < bc ? 1 : i / r;
9232
+ return a.size < yc ? 1 : i / r;
9228
9233
  }
9229
- async function Sc(e) {
9230
- if (e.length < vc) return null;
9231
- let t = (await Promise.all(_c.map(async (t) => ({
9234
+ async function xc(e) {
9235
+ if (e.length < _c) return null;
9236
+ let t = (await Promise.all(gc.map(async (t) => ({
9232
9237
  lang: t,
9233
- tokens: await ic(e, t)
9238
+ tokens: await rc(e, t)
9234
9239
  })))).reduce((e, { lang: t, tokens: n }) => {
9235
9240
  if (!n) return e;
9236
- let r = xc(n.light.tokens, n.light.fg);
9241
+ let r = bc(n.light.tokens, n.light.fg);
9237
9242
  return r < e.score ? {
9238
9243
  lang: t,
9239
9244
  score: r
@@ -9242,35 +9247,35 @@ async function Sc(e) {
9242
9247
  lang: null,
9243
9248
  score: Infinity
9244
9249
  });
9245
- return t.lang === null || t.score >= yc ? null : t.lang;
9250
+ return t.lang === null || t.score >= vc ? null : t.lang;
9246
9251
  }
9247
9252
  //#endregion
9248
9253
  //#region src/tools/code/index.ts
9249
- var Cc = 1500, wc = class {
9254
+ var Sc = 1500, Cc = class {
9250
9255
  constructor({ data: e, api: t, readOnly: n }) {
9251
9256
  var r, i, a;
9252
9257
  this._dom = null, this._lineNumbers = !0, this._picker = null, this._viewMode = "preview", this._previewContainer = null, this._disposeHighlights = null, this._highlightRafId = null, this._detectedLanguage = null, this._detectionTimeoutId = null, this.api = t, this.readOnly = n, this._data = {
9253
9258
  code: (r = e == null ? void 0 : e.code) == null ? "" : r,
9254
- language: (i = e == null ? void 0 : e.language) == null ? os : i,
9259
+ language: (i = e == null ? void 0 : e.language) == null ? as : i,
9255
9260
  lineNumbers: e == null ? void 0 : e.lineNumbers
9256
9261
  }, this._lineNumbers = (a = e == null ? void 0 : e.lineNumbers) == null ? !0 : a;
9257
9262
  }
9258
9263
  render() {
9259
- let e = gs.has(this._data.language), t = Rs({
9264
+ let e = hs.has(this._data.language), t = Ls({
9260
9265
  code: this._data.code,
9261
9266
  languageName: this.getLanguageName(this._data.language),
9262
9267
  readOnly: this.readOnly,
9263
- copyLabel: this.api.i18n.t(is),
9268
+ copyLabel: this.api.i18n.t(rs),
9264
9269
  previewable: this.readOnly ? !1 : e,
9265
9270
  viewModeLabels: this.readOnly ? void 0 : {
9266
- code: this.api.i18n.t(_s),
9267
- preview: this.api.i18n.t(vs),
9268
- split: this.api.i18n.t(bs)
9271
+ code: this.api.i18n.t(gs),
9272
+ preview: this.api.i18n.t(_s),
9273
+ split: this.api.i18n.t(ys)
9269
9274
  }
9270
9275
  });
9271
9276
  if (this._dom = t, t.gutterElement.hidden = !this._lineNumbers, this.readOnly && e) {
9272
9277
  let e = document.createElement("div");
9273
- e.className = ys, e.setAttribute("data-blok-testid", "code-preview"), t.wrapper.appendChild(e), t.preElement.hidden = !0, t.gutterElement.hidden = !0, this._previewContainer = e, this.renderPreview();
9278
+ e.className = vs, e.setAttribute("data-blok-testid", "code-preview"), t.wrapper.appendChild(e), t.preElement.hidden = !0, t.gutterElement.hidden = !0, this._previewContainer = e, this.renderPreview();
9274
9279
  }
9275
9280
  if (!this.readOnly && e && t.previewElement && (this._viewMode = "preview", this._previewContainer = t.previewElement, this.applyViewMode(), this.renderPreview()), !this.readOnly && t.viewModeContainer) {
9276
9281
  let e = Array.from(t.viewModeContainer.querySelectorAll("[data-mode]"));
@@ -9283,10 +9288,10 @@ var Cc = 1500, wc = class {
9283
9288
  }
9284
9289
  }
9285
9290
  return this.readOnly || (t.codeElement.addEventListener("keydown", (e) => {
9286
- zs(e, t.codeElement, () => this.exitBlock()) && (e.preventDefault(), this.syncTrailingBr(), this.updateGutter(), this.scheduleHighlight(), this.scheduleDetection());
9291
+ Rs(e, t.codeElement, () => this.exitBlock()) && (e.preventDefault(), this.syncTrailingBr(), this.updateGutter(), this.scheduleHighlight(), this.scheduleDetection());
9287
9292
  }), t.codeElement.addEventListener("input", () => {
9288
9293
  this.syncTrailingBr(), this.updateGutter(), this.scheduleHighlight(), this.scheduleDetection();
9289
- })), t.copyButton.addEventListener("click", () => this.copyCode()), T(t.copyButton, this.api.i18n.t(is), { placement: "bottom" }), this.readOnly || (this._picker = this.buildLanguagePicker(t.languageButton, t.wrapper), t.languageButton.addEventListener("click", () => {
9294
+ })), t.copyButton.addEventListener("click", () => this.copyCode()), T(t.copyButton, this.api.i18n.t(rs), { placement: "bottom" }), this.readOnly || (this._picker = this.buildLanguagePicker(t.languageButton, t.wrapper), t.languageButton.addEventListener("click", () => {
9290
9295
  var e;
9291
9296
  if ((e = this._picker) != null && e.isShown) this._picker.hide();
9292
9297
  else {
@@ -9308,17 +9313,17 @@ var Cc = 1500, wc = class {
9308
9313
  applyViewMode() {
9309
9314
  var e, t;
9310
9315
  if (!((e = this._dom) != null && e.previewElement) || !this._dom.viewModeContainer || !this._dom.splitContainer) return;
9311
- Ls(this._dom.viewModeContainer, this._viewMode);
9316
+ Is(this._dom.viewModeContainer, this._viewMode);
9312
9317
  let n = (t = this._dom.preElement.parentElement) == null ? void 0 : t.parentElement;
9313
9318
  switch (this._viewMode) {
9314
9319
  case "code":
9315
- this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !0, n && (n.hidden = !1), this._dom.splitContainer.className = Es;
9320
+ this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !0, n && (n.hidden = !1), this._dom.splitContainer.className = Ts;
9316
9321
  break;
9317
9322
  case "preview":
9318
- this._dom.preElement.hidden = !0, this._dom.gutterElement.hidden = !0, this._dom.previewElement.hidden = !1, n && (n.hidden = !0), this._dom.splitContainer.className = Es;
9323
+ this._dom.preElement.hidden = !0, this._dom.gutterElement.hidden = !0, this._dom.previewElement.hidden = !1, n && (n.hidden = !0), this._dom.splitContainer.className = Ts;
9319
9324
  break;
9320
9325
  case "split":
9321
- this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !1, n && (n.hidden = !1), this._dom.splitContainer.className = Ds;
9326
+ this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !1, n && (n.hidden = !1), this._dom.splitContainer.className = Es;
9322
9327
  break;
9323
9328
  }
9324
9329
  }
@@ -9327,7 +9332,7 @@ var Cc = 1500, wc = class {
9327
9332
  let r = e._previewContainer;
9328
9333
  if (!r) return;
9329
9334
  let i = (t = (n = e._dom) == null ? void 0 : n.codeElement.textContent) == null ? e._data.code : t;
9330
- r.innerHTML = e._data.language === "mermaid" ? await Zs(i) : await Js(i);
9335
+ r.innerHTML = e._data.language === "mermaid" ? await Xs(i) : await qs(i);
9331
9336
  }
9332
9337
  setReadOnly(e) {
9333
9338
  this.readOnly = e, this._dom && (e ? (this._dom.codeElement.setAttribute("contenteditable", "false"), this._dom.codeElement.removeAttribute("spellcheck")) : (this._dom.codeElement.setAttribute("contenteditable", "plaintext-only"), this._dom.codeElement.setAttribute("spellcheck", "false")));
@@ -9349,7 +9354,7 @@ var Cc = 1500, wc = class {
9349
9354
  renderSettings() {
9350
9355
  let e = this._data.language, t = this._detectedLanguage, n = t !== null && t !== e, r = [];
9351
9356
  if (n) {
9352
- let e = ss.find((e) => e.id === t);
9357
+ let e = os.find((e) => e.id === t);
9353
9358
  e && (r.push({
9354
9359
  title: e.name,
9355
9360
  secondaryLabel: "auto",
@@ -9359,14 +9364,14 @@ var Cc = 1500, wc = class {
9359
9364
  isActive: () => this._data.language === e.id
9360
9365
  }), r.push({ type: D.Separator }));
9361
9366
  }
9362
- return r.push(...ss.map((t) => ({
9367
+ return r.push(...os.map((t) => ({
9363
9368
  title: t.name,
9364
9369
  trailingIcon: t.id === e ? We : void 0,
9365
9370
  onActivate: () => this.setLanguage(t.id),
9366
9371
  closeOnActivate: !0
9367
9372
  }))), [{
9368
9373
  icon: h,
9369
- title: this.api.i18n.t(ns),
9374
+ title: this.api.i18n.t(ts),
9370
9375
  name: "code-language",
9371
9376
  children: { items: r }
9372
9377
  }];
@@ -9387,7 +9392,7 @@ var Cc = 1500, wc = class {
9387
9392
  }
9388
9393
  setLanguage(e) {
9389
9394
  this._data.language = e;
9390
- let t = gs.has(e);
9395
+ let t = hs.has(e);
9391
9396
  if (this._dom) {
9392
9397
  let n = this._dom.languageButton.querySelector("span");
9393
9398
  n && (n.textContent = this.getLanguageName(e)), this._dom.viewModeContainer && (this._dom.viewModeContainer.hidden = !t), t && this._dom.previewElement && (this._previewContainer = this._dom.previewElement, this._viewMode = "preview", this.applyViewMode(), this.renderPreview()), t || (this._previewContainer = null, this._viewMode = "code", this.applyViewMode()), this._picker && this._picker.destroy(), this._picker = this.buildLanguagePicker(this._dom.languageButton, this._dom.wrapper);
@@ -9397,7 +9402,7 @@ var Cc = 1500, wc = class {
9397
9402
  buildLanguagePickerItems() {
9398
9403
  let e = this._data.language, t = this._detectedLanguage, n = t !== null && t !== e, r = [];
9399
9404
  if (n) {
9400
- let e = ss.find((e) => e.id === t);
9405
+ let e = os.find((e) => e.id === t);
9401
9406
  e && (r.push({
9402
9407
  title: e.name,
9403
9408
  name: e.id,
@@ -9408,7 +9413,7 @@ var Cc = 1500, wc = class {
9408
9413
  onActivate: () => this.setLanguage(e.id)
9409
9414
  }), r.push({ type: D.Separator }));
9410
9415
  }
9411
- return r.push(...ss.map((t) => ({
9416
+ return r.push(...os.map((t) => ({
9412
9417
  title: t.name,
9413
9418
  name: t.id,
9414
9419
  trailingIcon: t.id === e ? We : void 0,
@@ -9424,11 +9429,11 @@ var Cc = 1500, wc = class {
9424
9429
  leftAlignElement: t,
9425
9430
  searchable: !0,
9426
9431
  width: "200px",
9427
- messages: { search: this.api.i18n.t(as) }
9432
+ messages: { search: this.api.i18n.t(is) }
9428
9433
  });
9429
9434
  }
9430
9435
  getLanguageName(e) {
9431
- let t = ss.find((t) => t.id === e);
9436
+ let t = os.find((t) => t.id === e);
9432
9437
  return t ? t.name : e;
9433
9438
  }
9434
9439
  copyCode() {
@@ -9437,9 +9442,9 @@ var Cc = 1500, wc = class {
9437
9442
  navigator.clipboard.writeText(n).then(() => {
9438
9443
  if (!this._dom) return;
9439
9444
  let e = this._dom.copyButton, t = e.innerHTML;
9440
- e.innerHTML = `<span class="${hs}">${this.api.i18n.t(rs)}</span>`, setTimeout(() => {
9445
+ e.innerHTML = `<span class="${ms}">${this.api.i18n.t(ns)}</span>`, setTimeout(() => {
9441
9446
  e.innerHTML = t;
9442
- }, Cc);
9447
+ }, Sc);
9443
9448
  }).catch(() => {});
9444
9449
  }
9445
9450
  updateGutter() {
@@ -9448,7 +9453,7 @@ var Cc = 1500, wc = class {
9448
9453
  let t = (e = this._dom.codeElement.textContent) == null ? "" : e, n = t ? t.split("\n").length : 1, r = this._dom.gutterElement;
9449
9454
  r.children.length !== n && (r.innerHTML = "", Array.from({ length: n }, (e, t) => {
9450
9455
  let n = document.createElement("div");
9451
- n.className = Fs, n.textContent = String(t + 1), r.appendChild(n);
9456
+ n.className = Ps, n.textContent = String(t + 1), r.appendChild(n);
9452
9457
  }));
9453
9458
  }
9454
9459
  syncTrailingBr() {
@@ -9465,14 +9470,14 @@ var Cc = 1500, wc = class {
9465
9470
  scheduleDetection() {
9466
9471
  this._detectionTimeoutId !== null && clearTimeout(this._detectionTimeoutId), this._detectionTimeoutId = setTimeout(() => {
9467
9472
  var e, t;
9468
- this._detectionTimeoutId = null, Sc((e = (t = this._dom) == null ? void 0 : t.codeElement.textContent) == null ? "" : e).then((e) => {
9473
+ this._detectionTimeoutId = null, xc((e = (t = this._dom) == null ? void 0 : t.codeElement.textContent) == null ? "" : e).then((e) => {
9469
9474
  e !== this._detectedLanguage && (this._detectedLanguage = e, this._dom && (this._picker && this._picker.destroy(), this._picker = this.buildLanguagePicker(this._dom.languageButton, this._dom.wrapper)));
9470
9475
  });
9471
9476
  }, 600);
9472
9477
  }
9473
9478
  async highlightCode() {
9474
9479
  var e = this, t, n, r;
9475
- if (!oc() || !ec(e._data.language)) {
9480
+ if (!ac() || !$s(e._data.language)) {
9476
9481
  var i;
9477
9482
  (i = e._disposeHighlights) == null || i.call(e), e._disposeHighlights = null;
9478
9483
  return;
@@ -9483,8 +9488,8 @@ var Cc = 1500, wc = class {
9483
9488
  (o = e._disposeHighlights) == null || o.call(e), e._disposeHighlights = null;
9484
9489
  return;
9485
9490
  }
9486
- let s = await ic(a, e._data.language);
9487
- !s || !e._dom || ((r = e._disposeHighlights) == null || r.call(e), e._disposeHighlights = hc(e._dom.codeElement, s));
9491
+ let s = await rc(a, e._data.language);
9492
+ !s || !e._dom || ((r = e._disposeHighlights) == null || r.call(e), e._disposeHighlights = mc(e._dom.codeElement, s));
9488
9493
  }
9489
9494
  exitBlock() {
9490
9495
  let e = this.api.blocks.getCurrentBlockIndex();
@@ -9532,10 +9537,10 @@ var Cc = 1500, wc = class {
9532
9537
  patterns: { code: /^```/ }
9533
9538
  };
9534
9539
  }
9535
- }, G = (e) => {
9540
+ }, wc = (e) => {
9536
9541
  let t = e.tagName;
9537
9542
  return t === "B" || t === "STRONG";
9538
- }, Tc = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && G(e)), Ec = (e) => e.textContent.length === 0, K = (e) => e ? e.nodeType === Node.ELEMENT_NODE && G(e) ? q(e) : K(e.parentNode) : null, q = (e) => {
9543
+ }, Tc = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && wc(e)), Ec = (e) => e.textContent.length === 0, K = (e) => e ? e.nodeType === Node.ELEMENT_NODE && wc(e) ? q(e) : K(e.parentNode) : null, q = (e) => {
9539
9544
  if (e.tagName === "STRONG") return e;
9540
9545
  let t = document.createElement("strong");
9541
9546
  for (e.hasAttributes() && Array.from(e.attributes).forEach((e) => {
@@ -10129,7 +10134,7 @@ var Pc = (e, t) => {
10129
10134
  n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
10130
10135
  }
10131
10136
  isRangeBold(e, t) {
10132
- return Lc(e, G, t);
10137
+ return Lc(e, wc, t);
10133
10138
  }
10134
10139
  removeNestedBold(e) {
10135
10140
  e.querySelectorAll("b,strong").forEach((e) => {
@@ -10146,11 +10151,11 @@ var Pc = (e, t) => {
10146
10151
  t.removeChild(e);
10147
10152
  }
10148
10153
  findBoldElementFromRangeOrSelection(e, t) {
10149
- return e ? K(e.startContainer) || K(e.commonAncestorContainer) || (e.startContainer.nodeType === Node.ELEMENT_NODE && G(e.startContainer) ? e.startContainer : null) : t ? K(t.focusNode) : null;
10154
+ return e ? K(e.startContainer) || K(e.commonAncestorContainer) || (e.startContainer.nodeType === Node.ELEMENT_NODE && wc(e.startContainer) ? e.startContainer : null) : t ? K(t.focusNode) : null;
10150
10155
  }
10151
10156
  mergeAdjacentBold(t) {
10152
- let n = q(t), r = n.previousSibling, i = r && r.nodeType === Node.ELEMENT_NODE && G(r) ? e.mergeStrongNodes(r, n) : n, a = i.nextSibling;
10153
- return a && a.nodeType === Node.ELEMENT_NODE && G(a) ? e.mergeStrongNodes(i, a) : i;
10157
+ let n = q(t), r = n.previousSibling, i = r && r.nodeType === Node.ELEMENT_NODE && wc(r) ? e.mergeStrongNodes(r, n) : n, a = i.nextSibling;
10158
+ return a && a.nodeType === Node.ELEMENT_NODE && wc(a) ? e.mergeStrongNodes(i, a) : i;
10154
10159
  }
10155
10160
  toggleCollapsedSelection() {
10156
10161
  let t = window.getSelection();
@@ -10249,7 +10254,7 @@ var Pc = (e, t) => {
10249
10254
  return t.innerHTML = e, t.content;
10250
10255
  }
10251
10256
  collectBoldAncestors(e) {
10252
- return Q(e, G);
10257
+ return Q(e, wc);
10253
10258
  }
10254
10259
  };
10255
10260
  $ = Bc, $.isInline = !0, $.title = "Bold", $.titleKey = "bold", $.markerSequence = 0, $.isProcessingMutation = !1, $.instances = /* @__PURE__ */ new Set(), $.guardKeydownListenerRegistered = !1, $.shortcut = "CMD+B";
@@ -11362,4 +11367,4 @@ var cl = {
11362
11367
  inlineCode: {}
11363
11368
  };
11364
11369
  //#endregion
11365
- export { ba as _, tl as a, Pt as b, Uc as c, ts as d, Zo as f, Ta as g, vo as h, il as i, Bc as l, Yo as m, ll as n, Qc as o, Xo as p, sl as r, qc as s, cl as t, wc as u, _r as v, Zt as y };
11370
+ export { ba as _, tl as a, Nt as b, Uc as c, es as d, Xo as f, Ta as g, _o as h, il as i, Bc as l, Jo as m, ll as n, Qc as o, Yo as p, sl as r, qc as s, cl as t, Cc as u, _r as v, Zt as y };