@nubisco/ui 5.30.0 → 5.31.0

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.
@@ -2,17 +2,17 @@ import { prefersReducedMotion as e } from "./composables/useReducedMotion.compos
2
2
  import { TOUR_STEP_ATTRIBUTE as t } from "./utils/tourTarget.helper.mjs";
3
3
  import { NB_COMMAND_PALETTE_KEY as n, createCommandPaletteState as r } from "./composables/useCommandPalette.composable.mjs";
4
4
  import { t as i } from "./_plugin-vue_export-helper-O4QQSku4.js";
5
- import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, defineComponent as u, nextTick as d, normalizeClass as f, normalizeStyle as p, onMounted as m, openBlock as h, ref as g, renderList as ee, renderSlot as te, toDisplayString as _, useTemplateRef as ne, vModelText as re, withDirectives as ie, withModifiers as ae } from "vue";
5
+ import { Fragment as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, defineComponent as u, nextTick as d, normalizeClass as f, normalizeStyle as p, onMounted as m, openBlock as h, ref as g, renderList as ee, renderSlot as te, toDisplayString as ne, useTemplateRef as re, vModelText as ie, withDirectives as ae, withModifiers as oe } from "vue";
6
6
  //#region \0rolldown/runtime.js
7
- var v = Object.defineProperty, y = (e, t) => {
7
+ var _ = Object.defineProperty, v = (e, t) => {
8
8
  let n = {};
9
- for (var r in e) v(n, r, {
9
+ for (var r in e) _(n, r, {
10
10
  get: e[r],
11
11
  enumerable: !0
12
12
  });
13
- return t || v(n, Symbol.toStringTag, { value: "Module" }), n;
14
- }, b = /* @__PURE__ */ y({ default: () => x });
15
- function x(e) {
13
+ return t || _(n, Symbol.toStringTag, { value: "Module" }), n;
14
+ }, y = /* @__PURE__ */ v({ default: () => b });
15
+ function b(e) {
16
16
  e.directive("nb-context-menu", {
17
17
  mounted(e, t) {
18
18
  let n = (e) => {
@@ -40,10 +40,10 @@ function x(e) {
40
40
  }
41
41
  //#endregion
42
42
  //#region src/directives/ToolTip.content.ts
43
- var S = /* @__PURE__ */ y({
44
- devWarn: () => N,
45
- renderTooltipContent: () => P
46
- }), C = new Set([
43
+ var x = /* @__PURE__ */ v({
44
+ devWarn: () => j,
45
+ renderTooltipContent: () => N
46
+ }), S = new Set([
47
47
  "span",
48
48
  "div",
49
49
  "p",
@@ -60,17 +60,17 @@ var S = /* @__PURE__ */ y({
60
60
  "ul",
61
61
  "ol",
62
62
  "li"
63
- ]), w = new Set(["br"]), oe = new Set([
63
+ ]), C = new Set(["br"]), w = new Set([
64
64
  "class",
65
65
  "style",
66
66
  "dir",
67
67
  "lang"
68
- ]), se = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"), T = new Set(/* @__PURE__ */ "color.background-color.font-family.font-size.font-style.font-variant.font-weight.letter-spacing.line-height.text-align.text-decoration.text-transform.white-space.word-break.overflow-wrap.opacity.display.flex-direction.align-items.justify-content.gap.margin.margin-top.margin-right.margin-bottom.margin-left.padding.padding-top.padding-right.padding-bottom.padding-left.max-width.min-width.border-radius".split(".")), E = /url\(|image-set\(|expression\(|javascript:|@import|\\/i, D = /^[A-Za-z_-][A-Za-z0-9_-]*$/, ce = (e) => e.split(";").map((e) => {
68
+ ]), se = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"), ce = new Set(/* @__PURE__ */ "color.background-color.font-family.font-size.font-style.font-variant.font-weight.letter-spacing.line-height.text-align.text-decoration.text-transform.white-space.word-break.overflow-wrap.opacity.display.flex-direction.align-items.justify-content.gap.margin.margin-top.margin-right.margin-bottom.margin-left.padding.padding-top.padding-right.padding-bottom.padding-left.max-width.min-width.border-radius".split(".")), T = /url\(|image-set\(|expression\(|javascript:|@import|\\/i, le = /^[A-Za-z_-][A-Za-z0-9_-]*$/, E = (e) => e.split(";").map((e) => {
69
69
  let t = e.indexOf(":");
70
70
  if (t < 0) return "";
71
71
  let n = e.slice(0, t).trim().toLowerCase(), r = e.slice(t + 1).trim();
72
- return !n || !r ? "" : T.has(n) ? E.test(r) ? (N(`style-value:${n}`, `The value of "${n}" was dropped: tooltip content may not load a resource or call a CSS function that does.`), "") : `${n}: ${r}` : (N(`style:${n}`, `"${n}" is not an allowed tooltip content style property and was dropped.`), "");
73
- }).filter(Boolean).join("; "), O = (e) => e.split(/\s+/).filter((e) => e ? D.test(e) ? !0 : (N(`class:${e}`, `"${e}" is not a valid class token for tooltip content and was dropped.`), !1) : !1).join(" "), k = (e, t) => e === "style" ? ce(t) : e === "class" ? O(t) : t, A = new Set([
72
+ return !n || !r ? "" : ce.has(n) ? T.test(r) ? (j(`style-value:${n}`, `The value of "${n}" was dropped: tooltip content may not load a resource or call a CSS function that does.`), "") : `${n}: ${r}` : (j(`style:${n}`, `"${n}" is not an allowed tooltip content style property and was dropped.`), "");
73
+ }).filter(Boolean).join("; "), D = (e) => e.split(/\s+/).filter((e) => e ? le.test(e) ? !0 : (j(`class:${e}`, `"${e}" is not a valid class token for tooltip content and was dropped.`), !1) : !1).join(" "), ue = (e, t) => e === "style" ? E(t) : e === "class" ? D(t) : t, O = new Set([
74
74
  "b",
75
75
  "strong",
76
76
  "em",
@@ -82,47 +82,47 @@ var S = /* @__PURE__ */ y({
82
82
  "kbd",
83
83
  "br",
84
84
  "p"
85
- ]), le = {
85
+ ]), k = {
86
86
  "<": "&lt;",
87
87
  ">": "&gt;",
88
88
  "\"": "&quot;",
89
89
  "'": "&#039;"
90
- }, ue = (e) => e.replace(/&(?!(?:[a-zA-Z][a-zA-Z0-9]{1,10}|#\d{1,7}|#[xX][0-9a-fA-F]{1,6});)/g, "&amp;").replace(/[<>"']/g, (e) => le[e]), j = (e) => e.split(/(<[^<>]*>)/g).map((e) => {
90
+ }, A = (e) => e.replace(/&(?!(?:[a-zA-Z][a-zA-Z0-9]{1,10}|#\d{1,7}|#[xX][0-9a-fA-F]{1,6});)/g, "&amp;").replace(/[<>"']/g, (e) => k[e]), de = (e) => e.split(/(<[^<>]*>)/g).map((e) => {
91
91
  if (e.startsWith("<") && e.endsWith(">")) {
92
92
  let t = /^<\s*(\/?)\s*([a-zA-Z][a-zA-Z0-9]*)\s*\/?\s*>$/.exec(e), n = t?.[2]?.toLowerCase();
93
- return n && A.has(n) ? `<${t[1]}${n}>` : (n && N(`string-tag:${n}`, `<${n}> is not allowed in a tooltip string and was shown as text. Use the structured content form for anything richer.`), ue(e));
93
+ return n && O.has(n) ? `<${t[1]}${n}>` : (n && j(`string-tag:${n}`, `<${n}> is not allowed in a tooltip string and was shown as text. Use the structured content form for anything richer.`), A(e));
94
94
  }
95
- return ue(e).replace(/\n/g, "<br>");
96
- }).join(""), M = /* @__PURE__ */ new Set(), N = (e, t) => {
97
- typeof process < "u" && process.env.NODE_ENV === "production" || M.has(e) || (M.add(e), console.warn(`[nb-tooltip] ${t}`));
98
- }, de = (e) => {
99
- if (Array.isArray(e)) return e.map((e) => de(e)).join("");
95
+ return A(e).replace(/\n/g, "<br>");
96
+ }).join(""), fe = /* @__PURE__ */ new Set(), j = (e, t) => {
97
+ typeof process < "u" && process.env.NODE_ENV === "production" || fe.has(e) || (fe.add(e), console.warn(`[nb-tooltip] ${t}`));
98
+ }, M = (e) => {
99
+ if (Array.isArray(e)) return e.map((e) => M(e)).join("");
100
100
  if (!e || typeof e != "object" || !e.component) return "";
101
- let { component: t, props: n = {}, children: r, content: i } = e, a = r === void 0 ? i : r, o = Array.isArray(a) ? de(a) : a === void 0 ? "" : j(String(a)), s = String(t).toLowerCase();
102
- if (!C.has(s)) return N(`tag:${s}`, `<${s}> is not allowed in tooltip content and was dropped. Allowed tags: ${[...C].join(", ")}.`), o;
103
- let c = Object.entries(n).filter(([e]) => oe.has(e) ? !0 : (N(`prop:${e}`, `"${e}" is not an allowed tooltip content prop and was dropped. Allowed props: ${[...oe].join(", ")}.`), !1)).map(([e, t]) => [e, k(e, String(t))]).filter(([, e]) => e !== "").map(([e, t]) => `${e}="${se(t)}"`).join(" "), l = `<${s}${c ? ` ${c}` : ""}>`;
104
- return w.has(s) ? l : `${l}${o}</${s}>`;
105
- }, P = (e) => e ? typeof e == "string" ? j(e) : Array.isArray(e) ? de(e) : "" : "", F = /* @__PURE__ */ y({
106
- default: () => ct,
107
- dismissAllTooltips: () => bt
108
- }), I = (e) => e.status ?? e.flavor ?? "default", L = (e) => e.chipClass ?? e.classExtra, R = /* @__PURE__ */ new Set(), fe = 0, pe = () => `nb-tooltip-${++fe}`, me = 900, he = 4e3, ge = 500, z = 0, B = (e, t) => {
101
+ let { component: t, props: n = {}, children: r, content: i } = e, a = r === void 0 ? i : r, o = Array.isArray(a) ? M(a) : a === void 0 ? "" : de(String(a)), s = String(t).toLowerCase();
102
+ if (!S.has(s)) return j(`tag:${s}`, `<${s}> is not allowed in tooltip content and was dropped. Allowed tags: ${[...S].join(", ")}.`), o;
103
+ let c = Object.entries(n).filter(([e]) => w.has(e) ? !0 : (j(`prop:${e}`, `"${e}" is not an allowed tooltip content prop and was dropped. Allowed props: ${[...w].join(", ")}.`), !1)).map(([e, t]) => [e, ue(e, String(t))]).filter(([, e]) => e !== "").map(([e, t]) => `${e}="${se(t)}"`).join(" "), l = `<${s}${c ? ` ${c}` : ""}>`;
104
+ return C.has(s) ? l : `${l}${o}</${s}>`;
105
+ }, N = (e) => e ? typeof e == "string" ? de(e) : Array.isArray(e) ? M(e) : "" : "", pe = /* @__PURE__ */ v({
106
+ default: () => st,
107
+ dismissAllTooltips: () => yt
108
+ }), me = (e) => e.status ?? e.flavor ?? "default", P = (e) => e.chipClass ?? e.classExtra, F = /* @__PURE__ */ new Set(), he = 0, ge = () => `nb-tooltip-${++he}`, _e = 900, ve = 4e3, ye = 500, I = 0, L = (e, t) => {
109
109
  if (!e) return !1;
110
110
  let n = Date.now() - e;
111
111
  return n >= 0 && n < t;
112
- }, _e = !1, ve = () => {
113
- if (_e || typeof document > "u") return;
114
- _e = !0;
112
+ }, be = !1, xe = () => {
113
+ if (be || typeof document > "u") return;
114
+ be = !0;
115
115
  let e = (e) => {
116
- if (R.size === 0) return;
116
+ if (F.size === 0) return;
117
117
  let t = e?.target;
118
- t instanceof Element && t.closest(".nb-tooltip") || yt("dismiss");
118
+ t instanceof Element && t.closest(".nb-tooltip") || vt("dismiss");
119
119
  };
120
120
  document.addEventListener("pointerdown", () => {
121
- z = Date.now();
121
+ I = Date.now();
122
122
  }, !0), document.addEventListener("dragstart", () => e(), !0), document.addEventListener("keydown", (t) => {
123
123
  t.key === "Escape" && e();
124
124
  }, !0), document.addEventListener("pointerdown", e, !0), window.addEventListener("blur", e), document.addEventListener("mouseleave", e);
125
- }, ye = 200, V = 1e3, be = 2, xe = (e) => {
125
+ }, R = 200, Se = 1e3, Ce = 2, we = (e) => {
126
126
  let t = e.tooltipElement;
127
127
  if (!t) return !1;
128
128
  if (t.__hovered__) return !0;
@@ -131,38 +131,38 @@ var S = /* @__PURE__ */ y({
131
131
  } catch {
132
132
  return !1;
133
133
  }
134
- }, Se = (e) => {
134
+ }, Te = (e) => {
135
135
  if (!e.isConnected) return !1;
136
- if (xe(e) || e.__trigger__ === "focus" && e.contains(document.activeElement) || e.__trigger__ === "touch" && B(e.__lastTouchAt__, he)) return !0;
136
+ if (we(e) || e.__trigger__ === "focus" && e.contains(document.activeElement) || e.__trigger__ === "touch" && L(e.__lastTouchAt__, ve)) return !0;
137
137
  try {
138
138
  return e.matches(":hover");
139
139
  } catch {
140
140
  return !0;
141
141
  }
142
- }, H = (e) => {
142
+ }, Ee = (e) => {
143
143
  clearTimeout(e.__watchdogTimer__), e.__watchdogTimer__ = void 0, e.__watchdogMisses__ = 0;
144
- }, Ce = (e) => {
145
- H(e);
144
+ }, z = (e) => {
145
+ Ee(e);
146
146
  let t = () => {
147
147
  if (!e.__chips__?.size) {
148
- H(e);
148
+ Ee(e);
149
149
  return;
150
150
  }
151
- if (Se(e)) e.__watchdogMisses__ = 0;
151
+ if (Te(e)) e.__watchdogMisses__ = 0;
152
152
  else {
153
153
  if (e.__watchdogMisses__ = (e.__watchdogMisses__ ?? 0) + 1, !e.isConnected) {
154
- Z(e, !0, "program");
154
+ Q(e, !0, "program");
155
155
  return;
156
156
  }
157
- if (e.__watchdogMisses__ >= be) {
158
- pt(e, "dismiss");
157
+ if (e.__watchdogMisses__ >= Ce) {
158
+ ft(e, "dismiss");
159
159
  return;
160
160
  }
161
161
  }
162
- e.__watchdogTimer__ = setTimeout(t, V);
162
+ e.__watchdogTimer__ = setTimeout(t, Se);
163
163
  };
164
- e.__watchdogTimer__ = setTimeout(t, V);
165
- }, U = /* @__PURE__ */ new Set(), W = null, G = (e) => `${Math.round(e.top)}:${Math.round(e.left)}:${Math.round(e.width)}:${Math.round(e.height)}`, we = (e) => {
164
+ e.__watchdogTimer__ = setTimeout(t, Se);
165
+ }, B = /* @__PURE__ */ new Set(), V = null, H = (e) => `${Math.round(e.top)}:${Math.round(e.left)}:${Math.round(e.width)}:${Math.round(e.height)}`, De = (e) => {
166
166
  if (typeof getComputedStyle != "function") return !1;
167
167
  let t;
168
168
  try {
@@ -172,110 +172,110 @@ var S = /* @__PURE__ */ y({
172
172
  }
173
173
  let n = `${t.overflow} ${t.overflowX} ${t.overflowY}`;
174
174
  return /hidden|scroll|auto|clip|overlay/.test(n);
175
- }, Te = (e) => {
175
+ }, Oe = (e) => {
176
176
  let t = [], n = e.parentElement;
177
- for (; n && n !== document.body && n !== document.documentElement;) we(n) && t.push(n), n = n.parentElement;
177
+ for (; n && n !== document.body && n !== document.documentElement;) De(n) && t.push(n), n = n.parentElement;
178
178
  return t;
179
- }, K = (e) => !(e.width === 0 && e.height === 0 && e.top === 0 && e.left === 0), Ee = (e, t) => {
179
+ }, U = (e) => !(e.width === 0 && e.height === 0 && e.top === 0 && e.left === 0), ke = (e, t) => {
180
180
  if (!e.isConnected) return !1;
181
- if (!K(t)) return !0;
181
+ if (!U(t)) return !0;
182
182
  if (t.width === 0 || t.height === 0 || !(t.bottom > 0 && t.right > 0 && t.top < window.innerHeight && t.left < window.innerWidth)) return !1;
183
183
  for (let n of e.__clippers__ ?? []) {
184
184
  if (!n.isConnected) continue;
185
185
  let e = n.getBoundingClientRect();
186
- if (K(e) && (t.bottom <= e.top || t.top >= e.bottom || t.right <= e.left || t.left >= e.right)) return !1;
186
+ if (U(e) && (t.bottom <= e.top || t.top >= e.bottom || t.right <= e.left || t.left >= e.right)) return !1;
187
187
  }
188
188
  return !0;
189
- }, De = (e) => {
189
+ }, Ae = (e) => {
190
190
  let t = e.tooltipElement;
191
191
  if (!t || !e.__chips__?.size) {
192
- U.delete(e);
192
+ B.delete(e);
193
193
  return;
194
194
  }
195
195
  let n = e.getBoundingClientRect();
196
- if (!Ee(e, n)) {
197
- e.__offscreenReported__ || (e.__offscreenReported__ = !0, pt(e, "dismiss"));
196
+ if (!ke(e, n)) {
197
+ e.__offscreenReported__ || (e.__offscreenReported__ = !0, ft(e, "dismiss"));
198
198
  return;
199
199
  }
200
- e.__offscreenReported__ = !1, e.__lastRect__ = G(n), e.__side__ !== "cursor" && Q(e, t, e.__requestedSide__ ?? e.__side__);
200
+ e.__offscreenReported__ = !1, e.__lastRect__ = H(n), e.__side__ !== "cursor" && $(e, t, e.__requestedSide__ ?? e.__side__);
201
+ }, W = () => {
202
+ K();
203
+ for (let e of Array.from(B)) Ae(e);
204
+ }, je = 100, G = 320, Me = 0, Ne = 0, K = () => {
205
+ Ne = Date.now() + G;
201
206
  }, q = () => {
202
- Ae();
203
- for (let e of Array.from(U)) De(e);
204
- }, Oe = 100, J = 320, Y = 0, ke = 0, Ae = () => {
205
- ke = Date.now() + J;
206
- }, je = () => {
207
- if (U.size === 0) {
208
- W = null;
207
+ if (B.size === 0) {
208
+ V = null;
209
209
  return;
210
210
  }
211
211
  let e = Date.now();
212
- if (e >= ke && e - Y < Oe) {
213
- W = requestAnimationFrame(je);
212
+ if (e >= Ne && e - Me < je) {
213
+ V = requestAnimationFrame(q);
214
214
  return;
215
215
  }
216
- Y = e;
217
- for (let e of Array.from(U)) {
216
+ Me = e;
217
+ for (let e of Array.from(B)) {
218
218
  if (!e.tooltipElement) {
219
- U.delete(e);
219
+ B.delete(e);
220
220
  continue;
221
221
  }
222
- G(e.getBoundingClientRect()) !== e.__lastRect__ && (Ae(), De(e));
222
+ H(e.getBoundingClientRect()) !== e.__lastRect__ && (K(), Ae(e));
223
223
  }
224
- W = requestAnimationFrame(je);
225
- }, Me = !1, Ne = (e) => {
226
- U.add(e), e.__lastRect__ = void 0, e.__clippers__ = Te(e), !(typeof window > "u") && (Me || (Me = !0, document.addEventListener("scroll", q, {
224
+ V = requestAnimationFrame(q);
225
+ }, J = !1, Pe = (e) => {
226
+ B.add(e), e.__lastRect__ = void 0, e.__clippers__ = Oe(e), !(typeof window > "u") && (J || (J = !0, document.addEventListener("scroll", W, {
227
227
  capture: !0,
228
228
  passive: !0
229
- }), window.addEventListener("resize", q, { passive: !0 })), W === null && typeof requestAnimationFrame == "function" && (W = requestAnimationFrame(je)));
230
- }, Pe = (e) => {
231
- U.delete(e), e.__lastRect__ = void 0, e.__clippers__ = void 0, !(U.size > 0 || typeof window > "u") && (Me && (Me = !1, document.removeEventListener("scroll", q, { capture: !0 }), window.removeEventListener("resize", q)), W !== null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(W), W = null));
229
+ }), window.addEventListener("resize", W, { passive: !0 })), V === null && typeof requestAnimationFrame == "function" && (V = requestAnimationFrame(q)));
230
+ }, Y = (e) => {
231
+ B.delete(e), e.__lastRect__ = void 0, e.__clippers__ = void 0, !(B.size > 0 || typeof window > "u") && (J && (J = !1, document.removeEventListener("scroll", W, { capture: !0 }), window.removeEventListener("resize", W)), V !== null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(V), V = null));
232
232
  }, Fe = (t, n, r) => {
233
233
  if (t.__chips__?.delete(n), clearTimeout(n.__removeTimer__), n.__removeTimer__ = void 0, r || e()) {
234
234
  n.remove();
235
235
  return;
236
236
  }
237
- n.style.animation = `tooltipDisappear ${ye}ms ease-in-out forwards`, n.__removeTimer__ = setTimeout(() => {
237
+ n.style.animation = `tooltipDisappear ${R}ms ease-in-out forwards`, n.__removeTimer__ = setTimeout(() => {
238
238
  n.__removeTimer__ = void 0, n.remove();
239
- }, ye);
239
+ }, R);
240
240
  }, Ie = (e, t) => {
241
- if (Pe(e), e.__trigger__ = void 0, e.__side__ = void 0, e.__chips__) for (let n of Array.from(e.__chips__)) Fe(e, n, t);
242
- e.tooltipElement = void 0, e.__lastContent__ = void 0, H(e);
243
- }, Le = "a[href], button, input, select, textarea, summary, [tabindex]", Re = "data-nb-tooltip-anchor", ze = (e, t) => {
241
+ if (Y(e), e.__trigger__ = void 0, e.__side__ = void 0, e.__chips__) for (let n of Array.from(e.__chips__)) Fe(e, n, t);
242
+ e.tooltipElement = void 0, e.__lastContent__ = void 0, Ee(e);
243
+ }, Le = "a[href], button, input, select, textarea, summary, [tabindex]", Re = "data-nb-tooltip-anchor", X = (e, t) => {
244
244
  let n = t.target;
245
245
  if (!(n instanceof Element) || n === e) return !0;
246
246
  let r = n.closest(`[${Re}]`);
247
247
  return r === null || r === e;
248
- }, Be = "button, a[href], [role=\"button\"], [role=\"tab\"], [role=\"menuitem\"], input, select, textarea, label", Ve = (e) => {
249
- let t = e.closest(Be);
248
+ }, ze = "button, a[href], [role=\"button\"], [role=\"tab\"], [role=\"menuitem\"], input, select, textarea, label", Be = (e) => {
249
+ let t = e.closest(ze);
250
250
  return !t || t.disabled === !0 ? !1 : t.getAttribute("aria-disabled") !== "true";
251
- }, X = (e) => {
251
+ }, Z = (e) => {
252
252
  if (!e) return "";
253
253
  if (typeof e == "string") return e.replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&#039;/g, "'").replace(/\s+/g, " ").trim();
254
- if (Array.isArray(e)) return e.map((e) => X(e)).filter(Boolean).join(" ");
254
+ if (Array.isArray(e)) return e.map((e) => Z(e)).filter(Boolean).join(" ");
255
255
  if (typeof e == "object") {
256
256
  let t = e;
257
- return X(t.children ?? t.content);
257
+ return Z(t.children ?? t.content);
258
258
  }
259
259
  return "";
260
- }, He = (e) => [
261
- X(e.header),
262
- X(e.body),
263
- X(e.tip)
264
- ].filter(Boolean).join(". "), Ue = (e) => {
260
+ }, Ve = (e) => [
261
+ Z(e.header),
262
+ Z(e.body),
263
+ Z(e.tip)
264
+ ].filter(Boolean).join(". "), He = (e) => {
265
265
  if (e.hasAttribute("aria-labelledby") || e.hasAttribute("aria-label") && !e.__ownsAriaLabel__ || e.hasAttribute("title") || (e.textContent ?? "").trim().length > 0) return !0;
266
266
  let t = e.querySelector("img[alt]");
267
267
  return !!t && (t.getAttribute("alt") ?? "").trim().length > 0;
268
- }, We = (e, t) => {
268
+ }, Ue = (e, t) => {
269
269
  let n = t.aria ?? "auto";
270
- return n === "auto" ? Ue(e) ? "description" : "label" : n;
271
- }, Ge = (e, t) => {
272
- if (!t || We(e, t) !== "label") {
270
+ return n === "auto" ? He(e) ? "description" : "label" : n;
271
+ }, We = (e, t) => {
272
+ if (!t || Ue(e, t) !== "label") {
273
273
  e.__ownsAriaLabel__ &&= (e.removeAttribute("aria-label"), !1), e.__ownsRole__ &&= (e.removeAttribute("role"), !1);
274
274
  return;
275
275
  }
276
- let n = He(t);
276
+ let n = Ve(t);
277
277
  n && (e.setAttribute("aria-label", n), e.__ownsAriaLabel__ = !0, !e.__ownsRole__ && !e.hasAttribute("role") && !e.matches(Le) && (e.setAttribute("role", "img"), e.__ownsRole__ = !0));
278
- }, Ke = (e, t) => {
278
+ }, Ge = (e, t) => {
279
279
  let n = !!t?.focusable;
280
280
  if (n && !e.__ownsTabIndex__) {
281
281
  if (e.matches(Le) || e.hasAttribute("tabindex")) return;
@@ -283,118 +283,118 @@ var S = /* @__PURE__ */ y({
283
283
  return;
284
284
  }
285
285
  !n && e.__ownsTabIndex__ && (e.removeAttribute("tabindex"), e.__ownsTabIndex__ = !1);
286
- }, qe = (e, t) => {
286
+ }, Ke = (e, t) => {
287
287
  e.__prevDescribedBy__ = e.getAttribute("aria-describedby");
288
288
  let n = [e.__prevDescribedBy__, t].filter(Boolean).join(" ");
289
289
  e.setAttribute("aria-describedby", n);
290
- }, Je = (e) => {
290
+ }, qe = (e) => {
291
291
  e.__prevDescribedBy__ !== void 0 && (e.__prevDescribedBy__ ? e.setAttribute("aria-describedby", e.__prevDescribedBy__) : e.removeAttribute("aria-describedby"), e.__prevDescribedBy__ = void 0);
292
- }, Ye = "nb-tooltip-description", Xe = (e) => !!e && !!(e.body || e.header || e.tip), Ze = (e, t) => {
292
+ }, Je = "nb-tooltip-description", Ye = (e) => !!e && !!(e.body || e.header || e.tip), Xe = (e, t) => {
293
293
  if (typeof document > "u") return;
294
- let n = t && Xe(t) && We(e, t) === "description" ? He(t) : "";
294
+ let n = t && Ye(t) && Ue(e, t) === "description" ? Ve(t) : "";
295
295
  if (!n) {
296
- Qe(e);
296
+ Ze(e);
297
297
  return;
298
298
  }
299
299
  let r = e.__descNode__;
300
- r || (r = document.createElement("span"), r.className = Ye, r.id = pe(), r.setAttribute("role", "tooltip"), document.body.appendChild(r), e.__descNode__ = r, qe(e, r.id)), e.__descText__ !== n && (r.textContent = n, e.__descText__ = n);
301
- }, Qe = (e) => {
302
- e.__descNode__ && (Je(e), e.__descNode__.remove(), e.__descNode__ = void 0, e.__descText__ = void 0);
303
- }, $e = (e, t) => {
304
- if (Xe(t)) {
300
+ r || (r = document.createElement("span"), r.className = Je, r.id = ge(), r.setAttribute("role", "tooltip"), document.body.appendChild(r), e.__descNode__ = r, Ke(e, r.id)), e.__descText__ !== n && (r.textContent = n, e.__descText__ = n);
301
+ }, Ze = (e) => {
302
+ e.__descNode__ && (qe(e), e.__descNode__.remove(), e.__descNode__ = void 0, e.__descText__ = void 0);
303
+ }, Qe = (e, t) => {
304
+ if (Ye(t)) {
305
305
  e.__prevTitle__ === void 0 && e.hasAttribute("title") && (e.__prevTitle__ = e.getAttribute("title") ?? "", e.removeAttribute("title"));
306
306
  return;
307
307
  }
308
- et(e);
309
- }, et = (e) => {
308
+ $e(e);
309
+ }, $e = (e) => {
310
310
  e.__prevTitle__ !== void 0 && (e.hasAttribute("title") || e.setAttribute("title", e.__prevTitle__), e.__prevTitle__ = void 0);
311
- }, tt = (e, t) => {
312
- $e(e, t), Ge(e, t), Ze(e, t);
313
- }, nt = (e) => e.disabled === !0 ? !0 : !!e.closest?.("fieldset[disabled]") && !e.closest?.("fieldset[disabled] > legend:first-of-type"), rt = (e, t, n) => t >= e.left && t <= e.right && n >= e.top && n <= e.bottom, it = (e) => {
311
+ }, et = (e, t) => {
312
+ Qe(e, t), We(e, t), Xe(e, t);
313
+ }, tt = (e) => e.disabled === !0 ? !0 : !!e.closest?.("fieldset[disabled]") && !e.closest?.("fieldset[disabled] > legend:first-of-type"), nt = (e, t, n) => t >= e.left && t <= e.right && n >= e.top && n <= e.bottom, rt = (e) => {
314
314
  let t = e.__proxyHost__;
315
315
  t && (e.__proxyMove__ && t.removeEventListener("mousemove", e.__proxyMove__), e.__proxyLeave__ && t.removeEventListener("mouseleave", e.__proxyLeave__), e.__proxyHost__ = void 0, e.__proxyMove__ = void 0, e.__proxyLeave__ = void 0, e.__proxyInside__ = !1);
316
- }, at = (e) => {
317
- let t = e.__tooltipBinding__ && nt(e) ? e.parentElement : null;
318
- e.__proxyHost__ !== t && (it(e), t && (e.__proxyMove__ = ((t) => {
316
+ }, it = (e) => {
317
+ let t = e.__tooltipBinding__ && tt(e) ? e.parentElement : null;
318
+ e.__proxyHost__ !== t && (rt(e), t && (e.__proxyMove__ = ((t) => {
319
319
  let n = t;
320
320
  if (n.buttons) return;
321
321
  let r = e.getBoundingClientRect();
322
- if (K(r) ? rt(r, n.clientX, n.clientY) : t.target === e || e.contains(t.target)) {
323
- e.__mouseX__ = n.clientX, e.__mouseY__ = n.clientY, e.__proxyInside__ ? e.__tooltipBinding__?.followCursor && Q(e, e.tooltipElement, e.__requestedSide__) : (e.__proxyInside__ = !0, e.__showTooltip__?.("pointer"));
322
+ if (U(r) ? nt(r, n.clientX, n.clientY) : t.target === e || e.contains(t.target)) {
323
+ e.__mouseX__ = n.clientX, e.__mouseY__ = n.clientY, e.__proxyInside__ ? e.__tooltipBinding__?.followCursor && $(e, e.tooltipElement, e.__requestedSide__) : (e.__proxyInside__ = !0, e.__showTooltip__?.("pointer"));
324
324
  return;
325
325
  }
326
326
  e.__proxyInside__ && (e.__proxyInside__ = !1, e.__hideTooltip__?.(void 0, "pointer"));
327
327
  }), e.__proxyLeave__ = (() => {
328
328
  e.__proxyInside__ && (e.__proxyInside__ = !1, e.__hideTooltip__?.(void 0, "pointer"));
329
329
  }), t.addEventListener("mousemove", e.__proxyMove__), t.addEventListener("mouseleave", e.__proxyLeave__), e.__proxyHost__ = t));
330
- }, ot = (e) => {
331
- e.onOpenChange || N("controlled-no-handler", "a tooltip was given `open` but no `onOpenChange`, so nothing the user does (hover, blur, Escape) can change it. Either handle `onOpenChange` or drop `open` and let the directive own visibility.");
332
- }, st = (e, t) => {
330
+ }, at = (e) => {
331
+ e.onOpenChange || j("controlled-no-handler", "a tooltip was given `open` but no `onOpenChange`, so nothing the user does (hover, blur, Escape) can change it. Either handle `onOpenChange` or drop `open` and let the directive own visibility.");
332
+ }, ot = (e, t) => {
333
333
  if (!t) return;
334
334
  let n = t.open === void 0 ? e.__openState__ === void 0 && t.defaultOpen ? !0 : void 0 : t.open;
335
335
  n !== void 0 && n !== (e.__openState__ === !0 || !!e.__showTimer__) && (n ? e.__showTooltip__?.("program") : e.__hideTooltip__?.(0, "program"));
336
- }, ct = (e) => {
337
- ve();
336
+ }, st = (e) => {
337
+ xe();
338
338
  let t = e.config.globalProperties.$router;
339
339
  t && t.beforeEach(() => {
340
- R.forEach((e) => e?.__hideTooltip__?.(0, "program")), R.clear();
340
+ F.forEach((e) => e?.__hideTooltip__?.(0, "program")), F.clear();
341
341
  }), e.directive("nb-tooltip", {
342
342
  mounted(e, t) {
343
343
  e.__showTooltip__ = (t = "pointer") => {
344
344
  let n = e.__tooltipBinding__;
345
345
  if (n) {
346
346
  if (n.open !== void 0 && t !== "program") {
347
- ot(n), n.onOpenChange?.(!0, t);
347
+ at(n), n.onOpenChange?.(!0, t);
348
348
  return;
349
349
  }
350
- clearTimeout(e.__hideTimer__), e.__hideTimer__ = void 0, ft(e, n, t);
350
+ clearTimeout(e.__hideTimer__), e.__hideTimer__ = void 0, dt(e, n, t);
351
351
  }
352
352
  }, e.__hideTooltip__ = (t = e.__tooltipBinding__?.hideDelay ?? 150, n = "dismiss") => {
353
353
  let r = e.__tooltipBinding__;
354
354
  if (r?.open !== void 0 && n !== "program") {
355
- ot(r), r.onOpenChange?.(!1, n);
355
+ at(r), r.onOpenChange?.(!1, n);
356
356
  return;
357
357
  }
358
358
  if (clearTimeout(e.__hideTimer__), t <= 0) {
359
- e.__hideTimer__ = void 0, Z(e, !0, n);
359
+ e.__hideTimer__ = void 0, Q(e, !0, n);
360
360
  return;
361
361
  }
362
362
  e.__hideTimer__ = setTimeout(() => {
363
- e.__hideTimer__ = void 0, Z(e, t <= 0, n);
363
+ e.__hideTimer__ = void 0, Q(e, t <= 0, n);
364
364
  }, t);
365
365
  }, e.__mouseMove__ = (t) => {
366
- e.__mouseX__ = t.clientX, e.__mouseY__ = t.clientY, e.__tooltipBinding__?.followCursor && Q(e, e.tooltipElement, e.__tooltipBinding__?.position);
366
+ e.__mouseX__ = t.clientX, e.__mouseY__ = t.clientY, e.__tooltipBinding__?.followCursor && $(e, e.tooltipElement, e.__tooltipBinding__?.position);
367
367
  }, e.__tooltipBinding__ = t.value, e.__showHandler__ = (t) => {
368
- if (B(e.__lastTouchAt__, me)) return;
368
+ if (L(e.__lastTouchAt__, _e)) return;
369
369
  let n = t;
370
370
  n.buttons || (typeof n.clientX == "number" && (n.clientX || n.clientY) && (e.__mouseX__ = n.clientX, e.__mouseY__ = n.clientY), e.__showTooltip__?.("pointer"));
371
371
  }, e.__hideHandler__ = () => e.__hideTooltip__?.(void 0, "pointer"), e.__focusHandler__ = (t) => {
372
- B(z, ge) || ze(e, t) && e.__showTooltip__?.("focus");
372
+ L(I, ye) || X(e, t) && e.__showTooltip__?.("focus");
373
373
  }, e.__blurHandler__ = () => e.__hideTooltip__?.(void 0, "focus"), e.__touchHandler__ = (t) => {
374
- e.__tooltipBinding__?.touch !== !1 && ze(e, t) && (e.__lastTouchAt__ = Date.now(), !Ve(e) && (e.__showTooltip__?.("touch"), e.__hideTooltip__?.(he, "touch")));
375
- }, Ke(e, t.value), tt(e, t.value), e.setAttribute(Re, ""), e.addEventListener("mouseenter", e.__showHandler__), e.addEventListener("mouseleave", e.__hideHandler__), e.addEventListener("mousemove", e.__mouseMove__), e.addEventListener("focusin", e.__focusHandler__), e.addEventListener("focusout", e.__blurHandler__), e.addEventListener("touchstart", e.__touchHandler__, { passive: !0 }), at(e), st(e, t.value);
374
+ e.__tooltipBinding__?.touch !== !1 && X(e, t) && (e.__lastTouchAt__ = Date.now(), !Be(e) && (e.__showTooltip__?.("touch"), e.__hideTooltip__?.(ve, "touch")));
375
+ }, Ge(e, t.value), et(e, t.value), e.setAttribute(Re, ""), e.addEventListener("mouseenter", e.__showHandler__), e.addEventListener("mouseleave", e.__hideHandler__), e.addEventListener("mousemove", e.__mouseMove__), e.addEventListener("focusin", e.__focusHandler__), e.addEventListener("focusout", e.__blurHandler__), e.addEventListener("touchstart", e.__touchHandler__, { passive: !0 }), it(e), ot(e, t.value);
376
376
  },
377
377
  updated(e, t) {
378
378
  let n = e.__tooltipBinding__;
379
379
  if (e.__tooltipBinding__ = t.value, !t.value) {
380
- tt(e, void 0), Ke(e, void 0), Z(e, !0);
380
+ et(e, void 0), Ge(e, void 0), Q(e, !0);
381
381
  return;
382
382
  }
383
- if (n !== t.value && (tt(e, t.value), Ke(e, t.value)), at(e), st(e, t.value), !e.tooltipElement || n === t.value) return;
384
- let r = dt(t.value);
385
- r !== e.__lastContent__ && (e.__lastContent__ = r, mt(e, t.value));
383
+ if (n !== t.value && (et(e, t.value), Ge(e, t.value)), it(e), ot(e, t.value), !e.tooltipElement || n === t.value) return;
384
+ let r = ut(t.value);
385
+ r !== e.__lastContent__ && (e.__lastContent__ = r, pt(e, t.value));
386
386
  },
387
387
  unmounted(e) {
388
- clearTimeout(e.__showTimer__), e.__showTimer__ = void 0, clearTimeout(e.__hideTimer__), e.__hideTimer__ = void 0, Z(e, !0), R.delete(e), e.__showHandler__ && e.removeEventListener("mouseenter", e.__showHandler__), e.__hideHandler__ && e.removeEventListener("mouseleave", e.__hideHandler__), e.__focusHandler__ && e.removeEventListener("focusin", e.__focusHandler__), e.__blurHandler__ && e.removeEventListener("focusout", e.__blurHandler__), e.__touchHandler__ && e.removeEventListener("touchstart", e.__touchHandler__), Qe(e), et(e), e.__ownsAriaLabel__ &&= (e.removeAttribute("aria-label"), !1), e.__ownsTabIndex__ &&= (e.removeAttribute("tabindex"), !1), e.__ownsRole__ &&= (e.removeAttribute("role"), !1), e.removeAttribute(Re), it(e), e.__mouseMove__ && e.removeEventListener("mousemove", e.__mouseMove__), Pe(e);
388
+ clearTimeout(e.__showTimer__), e.__showTimer__ = void 0, clearTimeout(e.__hideTimer__), e.__hideTimer__ = void 0, Q(e, !0), F.delete(e), e.__showHandler__ && e.removeEventListener("mouseenter", e.__showHandler__), e.__hideHandler__ && e.removeEventListener("mouseleave", e.__hideHandler__), e.__focusHandler__ && e.removeEventListener("focusin", e.__focusHandler__), e.__blurHandler__ && e.removeEventListener("focusout", e.__blurHandler__), e.__touchHandler__ && e.removeEventListener("touchstart", e.__touchHandler__), Ze(e), $e(e), e.__ownsAriaLabel__ &&= (e.removeAttribute("aria-label"), !1), e.__ownsTabIndex__ &&= (e.removeAttribute("tabindex"), !1), e.__ownsRole__ &&= (e.removeAttribute("role"), !1), e.removeAttribute(Re), rt(e), e.__mouseMove__ && e.removeEventListener("mousemove", e.__mouseMove__), Y(e);
389
389
  }
390
390
  });
391
- }, lt = ({ header: e = "", body: t = "", tip: n = "" }) => `<div class="nb-tooltip-content"><div class="nb-tooltip-header">${P(e)}</div><div class="nb-tooltip-body">${P(t)}</div><div class="nb-tooltip-tip">${P(n)}</div></div>`, ut = (e, t, n) => [
391
+ }, ct = ({ header: e = "", body: t = "", tip: n = "" }) => `<div class="nb-tooltip-content"><div class="nb-tooltip-header">${N(e)}</div><div class="nb-tooltip-body">${N(t)}</div><div class="nb-tooltip-tip">${N(n)}</div></div>`, lt = (e, t, n) => [
392
392
  "nb-tooltip",
393
393
  `nb-tooltip-${e}`,
394
394
  t ? `nb-tooltip-flavor-${t}` : "",
395
395
  n || ""
396
- ].filter(Boolean).join(" "), dt = (e) => `${e.position ?? ""}|${I(e)}|${L(e) ?? ""}|${lt(e)}`, ft = (t, n, r = "pointer") => {
397
- let { header: i, body: a, tip: o, delay: s = 400, animationTime: c = 300, position: l, overflowOnly: u } = n, d = I(n), f = L(n);
396
+ ].filter(Boolean).join(" "), ut = (e) => `${e.position ?? ""}|${me(e)}|${P(e) ?? ""}|${ct(e)}`, dt = (t, n, r = "pointer") => {
397
+ let { header: i, body: a, tip: o, delay: s = 400, animationTime: c = 300, position: l, overflowOnly: u } = n, d = me(n), f = P(n);
398
398
  if (clearTimeout(t.__showTimer__), t.__showTimer__ = void 0, Ie(t, !0), u) {
399
399
  let e = t.getBoundingClientRect();
400
400
  if (!(Math.round(e.width) < Math.round(t.scrollWidth))) return;
@@ -404,9 +404,9 @@ var S = /* @__PURE__ */ y({
404
404
  t.__showTimer__ = setTimeout(() => {
405
405
  if (t.__showTimer__ = void 0, !t.isConnected) return;
406
406
  let e = r === "pointer" ? l ?? "cursor" : l && l !== "cursor" ? l : "top";
407
- for (let e of Array.from(U)) e !== t && pt(e, "superseded");
407
+ for (let e of Array.from(B)) e !== t && ft(e, "superseded");
408
408
  let s = document.createElement("span");
409
- s.className = ut(e, d, f), s.innerHTML = lt({
409
+ s.className = lt(e, d, f), s.innerHTML = ct({
410
410
  header: i,
411
411
  body: a,
412
412
  tip: o
@@ -414,29 +414,29 @@ var S = /* @__PURE__ */ y({
414
414
  s.__hovered__ = !0, clearTimeout(t.__hideTimer__), t.__hideTimer__ = void 0, t.__watchdogMisses__ = 0;
415
415
  }), s.addEventListener("mouseleave", () => {
416
416
  s.__hovered__ = !1, t.__hideTooltip__?.();
417
- }), m ? s.style.opacity = "1" : (s.style.transition = `opacity ${c}ms ease-in-out`, s.style.animation = `tooltipAppear ${c}ms ease-in-out forwards`), s.setAttribute("aria-hidden", "true"), t.__trigger__ = r, t.tooltipElement = s, (t.__chips__ ??= /* @__PURE__ */ new Set()).add(s), t.__lastContent__ = dt(n), R.add(t), document.body.appendChild(s), t.__requestedSide__ = e, t.__side__ = e, Q(t, s, e), Ne(t), Ce(t);
417
+ }), m ? s.style.opacity = "1" : (s.style.transition = `opacity ${c}ms ease-in-out`, s.style.animation = `tooltipAppear ${c}ms ease-in-out forwards`), s.setAttribute("aria-hidden", "true"), t.__trigger__ = r, t.tooltipElement = s, (t.__chips__ ??= /* @__PURE__ */ new Set()).add(s), t.__lastContent__ = ut(n), F.add(t), document.body.appendChild(s), t.__requestedSide__ = e, t.__side__ = e, $(t, s, e), Pe(t), z(t);
418
418
  let u = t.__openState__ === !0;
419
419
  t.__openState__ = !0, u || n.onOpenChange?.(!0, r);
420
420
  }, p);
421
- }, pt = (e, t, n = !0) => {
421
+ }, ft = (e, t, n = !0) => {
422
422
  if (e.__hideTooltip__) {
423
423
  e.__hideTooltip__(n ? 0 : void 0, t);
424
424
  return;
425
425
  }
426
- Z(e, n, t);
427
- }, Z = (e, t = !1, n = "dismiss") => {
426
+ Q(e, n, t);
427
+ }, Q = (e, t = !1, n = "dismiss") => {
428
428
  clearTimeout(e.__showTimer__), e.__showTimer__ = void 0;
429
429
  let r = e.__openState__ === !0;
430
- Ie(e, t), R.delete(e), e.__requestedSide__ = void 0, r && (e.__openState__ = !1, e.__tooltipBinding__?.onOpenChange?.(!1, n));
431
- }, mt = (e, t) => {
432
- let { header: n, body: r, tip: i, position: a } = t, o = I(t), s = L(t), c = e.__requestedSide__ ?? e.__side__ ?? a, l = e.tooltipElement;
433
- l && (l.innerHTML = lt({
430
+ Ie(e, t), F.delete(e), e.__requestedSide__ = void 0, r && (e.__openState__ = !1, e.__tooltipBinding__?.onOpenChange?.(!1, n));
431
+ }, pt = (e, t) => {
432
+ let { header: n, body: r, tip: i, position: a } = t, o = me(t), s = P(t), c = e.__requestedSide__ ?? e.__side__ ?? a, l = e.tooltipElement;
433
+ l && (l.innerHTML = ct({
434
434
  header: n,
435
435
  body: r,
436
436
  tip: i
437
- }), l.className = ut(e.__side__ ?? c ?? "cursor", o, s), Q(e, l, c));
437
+ }), l.className = lt(e.__side__ ?? c ?? "cursor", o, s), $(e, l, c));
438
438
  };
439
- function ht(e, t, n, r, i, a, o) {
439
+ function mt(e, t, n, r, i, a, o) {
440
440
  switch (e) {
441
441
  case "top": return {
442
442
  top: t.top - (r + i * 2),
@@ -455,16 +455,16 @@ function ht(e, t, n, r, i, a, o) {
455
455
  left: t.right + i
456
456
  };
457
457
  default: return {
458
- top: o + gt,
459
- left: a + gt
458
+ top: o + ht,
459
+ left: a + ht
460
460
  };
461
461
  }
462
462
  }
463
- var gt = 14;
464
- function _t(e, t, n, r, i) {
463
+ var ht = 14;
464
+ function gt(e, t, n, r, i) {
465
465
  return t >= i && e >= i && t + n <= window.innerWidth - i && e + r <= window.innerHeight - i;
466
466
  }
467
- var vt = {
467
+ var _t = {
468
468
  top: [
469
469
  "bottom",
470
470
  "right",
@@ -486,12 +486,12 @@ var vt = {
486
486
  "bottom"
487
487
  ],
488
488
  cursor: []
489
- }, Q = (e, t, n) => {
489
+ }, $ = (e, t, n) => {
490
490
  if (!t) return;
491
- let r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = i.width || 0, o = i.height || 0, s = e.__mouseX__ ?? 0, c = e.__mouseY__ ?? 0, l = n ?? "cursor", u = (e) => ht(e, r, a, o, 4, s, c), d = u(l), f = l;
492
- if (a > 0 && o > 0 && !_t(d.top, d.left, a, o, 16)) for (let e of vt[l]) {
491
+ let r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = i.width || 0, o = i.height || 0, s = e.__mouseX__ ?? 0, c = e.__mouseY__ ?? 0, l = n ?? "cursor", u = (e) => mt(e, r, a, o, 4, s, c), d = u(l), f = l;
492
+ if (a > 0 && o > 0 && !gt(d.top, d.left, a, o, 16)) for (let e of _t[l]) {
493
493
  let t = u(e);
494
- if (_t(t.top, t.left, a, o, 16)) {
494
+ if (gt(t.top, t.left, a, o, 16)) {
495
495
  d = t, f = e;
496
496
  break;
497
497
  }
@@ -522,24 +522,24 @@ var vt = {
522
522
  }
523
523
  t.style.top = `${p}px`, t.style.left = `${m}px`;
524
524
  };
525
- function yt(e) {
526
- for (let t of Array.from(R)) t.__hideTooltip__?.(0, e);
525
+ function vt(e) {
526
+ for (let t of Array.from(F)) t.__hideTooltip__?.(0, e);
527
527
  let t = /* @__PURE__ */ new Set();
528
- for (let e of Array.from(R)) for (let n of e.__chips__ ?? []) t.add(n);
528
+ for (let e of Array.from(F)) for (let n of e.__chips__ ?? []) t.add(n);
529
529
  document.querySelectorAll("span.nb-tooltip").forEach((e) => {
530
530
  t.has(e) || e.remove();
531
531
  });
532
532
  }
533
- function bt() {
534
- for (let e of Array.from(R)) e.__hideTooltip__?.(0, "program");
535
- R.clear();
536
- for (let e of Array.from(U)) Pe(e);
533
+ function yt() {
534
+ for (let e of Array.from(F)) e.__hideTooltip__?.(0, "program");
535
+ F.clear();
536
+ for (let e of Array.from(B)) Y(e);
537
537
  document.querySelectorAll("span.nb-tooltip").forEach((e) => e.remove());
538
538
  }
539
539
  //#endregion
540
540
  //#region src/directives/TourStep.directive.ts
541
- var xt = /* @__PURE__ */ y({ default: () => Ct });
542
- function St(e, n) {
541
+ var bt = /* @__PURE__ */ v({ default: () => St });
542
+ function xt(e, n) {
543
543
  let r = n.value;
544
544
  if (r == null || r === "") {
545
545
  e.removeAttribute(t);
@@ -547,41 +547,41 @@ function St(e, n) {
547
547
  }
548
548
  e.setAttribute(t, String(r));
549
549
  }
550
- var Ct = (e) => {
550
+ var St = (e) => {
551
551
  e.directive("nb-tour-step", {
552
- mounted: St,
553
- updated: St,
552
+ mounted: xt,
553
+ updated: xt,
554
554
  unmounted(e) {
555
555
  e.removeAttribute(t);
556
556
  }
557
557
  });
558
- }, wt = /* @__PURE__ */ Object.assign({
559
- "./ContextMenu.directive.ts": b,
560
- "./ToolTip.content.ts": S,
561
- "./ToolTip.directive.ts": F,
562
- "./TourStep.directive.ts": xt
563
- }), Tt = { install(e) {
564
- Object.values(wt).forEach((t) => {
558
+ }, Ct = /* @__PURE__ */ Object.assign({
559
+ "./ContextMenu.directive.ts": y,
560
+ "./ToolTip.content.ts": x,
561
+ "./ToolTip.directive.ts": pe,
562
+ "./TourStep.directive.ts": bt
563
+ }), wt = { install(e) {
564
+ Object.values(Ct).forEach((t) => {
565
565
  typeof t.default == "function" && t.default(e);
566
566
  });
567
- } }, Et = { install(e) {
567
+ } }, Tt = { install(e) {
568
568
  let t = r();
569
569
  e.provide(n, t);
570
- } }, Dt = {
570
+ } }, Et = {
571
571
  key: 0,
572
572
  class: "nb-spreadsheet__toolbar"
573
- }, Ot = {
573
+ }, Dt = {
574
574
  key: 0,
575
575
  class: "nb-spreadsheet__corner",
576
576
  style: {
577
577
  gridRow: 1,
578
578
  gridColumn: 1
579
579
  }
580
- }, kt = ["onClick"], At = { class: "nb-spreadsheet__header-label" }, jt = {
580
+ }, Ot = ["onClick"], kt = { class: "nb-spreadsheet__header-label" }, At = {
581
581
  key: 0,
582
582
  class: "nb-spreadsheet__sort",
583
583
  "aria-hidden": "true"
584
- }, Mt = ["onMousedown"], Nt = [
584
+ }, jt = ["onMousedown"], Mt = [
585
585
  "title",
586
586
  "data-cell",
587
587
  "data-row",
@@ -589,7 +589,7 @@ var Ct = (e) => {
589
589
  "onMousedown",
590
590
  "onMouseenter",
591
591
  "onDblclick"
592
- ], Pt = ["inputmode"], Ft = 44, It = 32, $ = 28, Lt = /* @__PURE__ */ u({
592
+ ], Nt = ["inputmode"], Pt = 36, Ft = 32, It = /* @__PURE__ */ u({
593
593
  __name: "Spreadsheet",
594
594
  props: {
595
595
  columns: {},
@@ -608,6 +608,7 @@ var Ct = (e) => {
608
608
  type: Boolean,
609
609
  default: !0
610
610
  },
611
+ gutterWidth: { default: 44 },
611
612
  windowRows: { default: 80 },
612
613
  locale: { default: "pt-PT" }
613
614
  },
@@ -619,7 +620,7 @@ var Ct = (e) => {
619
620
  "row-reorder"
620
621
  ],
621
622
  setup(e, { expose: t, emit: n }) {
622
- let r = e, i = n, u = ne("scrollerRef"), v = ne("editorRef"), y = g({}), b = g(null), x = g(null), S = g(null), C = g(!1), w = g(null), oe = g(0), se = g([]), T = g([]), E = o(() => {
623
+ let r = e, i = n, u = re("scrollerRef"), _ = re("editorRef"), v = g({}), y = g(null), b = g(null), x = g(null), S = g(!1), C = g(null), w = g(0), se = g(0), ce = "", T = g([]), le = g([]), E = o(() => {
623
624
  let e = r.columns.filter((e) => e.pinned === "left"), t = r.columns.filter((e) => e.pinned === "right"), n = r.columns.filter((e) => !e.pinned);
624
625
  return [
625
626
  ...e,
@@ -628,17 +629,17 @@ var Ct = (e) => {
628
629
  ];
629
630
  });
630
631
  function D(e) {
631
- return y.value[e.id] ?? e.width ?? 120;
632
+ return v.value[e.id] ?? e.width ?? 120;
632
633
  }
633
- let ce = o(() => ({ gridTemplateColumns: (r.showGutter ? `${Ft}px ` : "") + E.value.map((e) => `${D(e)}px`).join(" ") })), O = o(() => {
634
+ let ue = o(() => ({ gridTemplateColumns: (r.showGutter ? `${r.gutterWidth}px ` : "") + E.value.map((e) => `${D(e)}px`).join(" ") })), O = o(() => {
634
635
  let e = r.rows.filter((e) => !e.pinned);
635
- if (!b.value) return e;
636
- let t = r.columns.find((e) => e.id === b.value.columnId);
636
+ if (!y.value) return e;
637
+ let t = r.columns.find((e) => e.id === y.value.columnId);
637
638
  if (!t) return e;
638
- let n = b.value.direction === "asc" ? 1 : -1, i = (e, t) => e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "number" && typeof t == "number" ? (e - t) * n : String(e).localeCompare(String(t)) * n;
639
+ let n = y.value.direction === "asc" ? 1 : -1, i = (e, t) => e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "number" && typeof t == "number" ? (e - t) * n : String(e).localeCompare(String(t)) * n;
639
640
  return [...e].sort((e, n) => i(e.values[t.id], n.values[t.id]));
640
- }), k = o(() => r.rows.filter((e) => e.pinned === "top")), A = o(() => r.rows.filter((e) => e.pinned === "bottom")), le = o(() => {
641
- let e = Math.max(1, Math.ceil((u.value?.clientHeight ?? 600) / $)), t = Math.max(10, Math.floor(r.windowRows / 4)), n = Math.floor(oe.value / $) - k.value.length - t, i = Math.max(0, n), a = Math.min(O.value.length, i + e + t * 2), o = k.value.map((e, t) => ({
641
+ }), k = o(() => r.rows.filter((e) => e.pinned === "top")), A = o(() => r.rows.filter((e) => e.pinned === "bottom")), de = o(() => {
642
+ let e = Math.max(1, Math.ceil((u.value?.clientHeight ?? 600) / Ft)), t = Math.max(10, Math.floor(r.windowRows / 4)), n = Math.floor(w.value / Ft) - k.value.length - t, i = Math.max(0, n), a = Math.min(O.value.length, i + e + t * 2), o = k.value.map((e, t) => ({
642
643
  ...e,
643
644
  __virtualIndex: t,
644
645
  gutterLabel: ""
@@ -656,7 +657,7 @@ var Ct = (e) => {
656
657
  ...c
657
658
  ];
658
659
  });
659
- function ue(e, t) {
660
+ function fe(e, t) {
660
661
  if (t == null || t === "") return "";
661
662
  if (e.type === "number") {
662
663
  let e = typeof t == "number" ? t : Number(t);
@@ -692,19 +693,19 @@ var Ct = (e) => {
692
693
  function N(e, t) {
693
694
  return r.cellAttrs ? r.cellAttrs(e.id, t.id, e, t) ?? {} : {};
694
695
  }
695
- function de(e, t) {
696
+ function pe(e, t) {
696
697
  let n = N(e, t);
697
698
  if (n.display !== void 0) return n.display;
698
699
  let r = M(e.id, t.id);
699
- return t.format ? t.format(r, e) : ue(t, r);
700
+ return t.format ? t.format(r, e) : fe(t, r);
700
701
  }
701
- function P(e, t) {
702
- let n = N(e, t), r = x.value?.rowId === e.id && x.value?.columnId === t.id, i = ge(e.id, t.id);
702
+ function me(e, t) {
703
+ let n = N(e, t), r = b.value?.rowId === e.id && b.value?.columnId === t.id, i = xe(e.id, t.id);
703
704
  return {
704
705
  [`nb-spreadsheet__cell--${t.align ?? (t.type === "number" || t.type === "date" ? "right" : "left")}`]: !0,
705
706
  "nb-spreadsheet__cell--focused": r,
706
707
  "nb-spreadsheet__cell--selected": i,
707
- "nb-spreadsheet__cell--readonly": F(e, t),
708
+ "nb-spreadsheet__cell--readonly": P(e, t),
708
709
  "nb-spreadsheet__cell--computed": !!n.computed || !!e.computed,
709
710
  "nb-spreadsheet__cell--pinned-top": e.pinned === "top",
710
711
  "nb-spreadsheet__cell--pinned-bottom": e.pinned === "bottom",
@@ -712,31 +713,31 @@ var Ct = (e) => {
712
713
  [e.className ?? ""]: !!e.className
713
714
  };
714
715
  }
715
- function F(e, t) {
716
+ function P(e, t) {
716
717
  if (e.computed || t.readOnly) return !0;
717
718
  let n = N(e, t);
718
719
  return !!n.readOnly || !!n.computed;
719
720
  }
720
- function I(e, t) {
721
+ function F(e, t) {
721
722
  return N(e, t).tooltip ?? "";
722
723
  }
723
- function L(e) {
724
+ function he(e) {
724
725
  return {
725
726
  "nb-spreadsheet__header--sortable": !!e.sortable,
726
727
  "nb-spreadsheet__header--pinned-left": e.pinned === "left",
727
728
  "nb-spreadsheet__header--pinned-right": e.pinned === "right"
728
729
  };
729
730
  }
730
- function R(e) {
731
+ function ge(e) {
731
732
  if (e.pinned !== "left") return 0;
732
- let t = r.showGutter ? Ft : 0;
733
+ let t = r.showGutter ? r.gutterWidth : 0;
733
734
  for (let n of E.value) {
734
735
  if (n.id === e.id) break;
735
736
  n.pinned === "left" && (t += D(n));
736
737
  }
737
738
  return t;
738
739
  }
739
- function fe(e) {
740
+ function _e(e) {
740
741
  if (e.pinned !== "right") return 0;
741
742
  let t = 0, n = [...E.value].reverse();
742
743
  for (let r of n) {
@@ -745,218 +746,313 @@ var Ct = (e) => {
745
746
  }
746
747
  return t;
747
748
  }
748
- function pe(e, t) {
749
+ function ve(e, t) {
749
750
  let n = (r.showGutter ? 2 : 1) + t, i = {};
750
- return e.pinned === "left" ? (i.position = "sticky", i.left = `${R(e)}px`, i.zIndex = "3") : e.pinned === "right" && (i.position = "sticky", i.right = `${fe(e)}px`, i.zIndex = "3"), {
751
+ return e.pinned === "left" ? (i.position = "sticky", i.left = `${ge(e)}px`, i.zIndex = "3") : e.pinned === "right" && (i.position = "sticky", i.right = `${_e(e)}px`, i.zIndex = "3"), {
751
752
  gridRow: 1,
752
753
  gridColumn: n,
753
754
  ...i
754
755
  };
755
756
  }
756
- function me(e, t, n, i) {
757
- let a = (r.showGutter ? 2 : 1) + i, o = n + 2, s = {};
758
- return t.pinned === "left" ? (s.position = "sticky", s.left = `${R(t)}px`, s.zIndex = "2") : t.pinned === "right" && (s.position = "sticky", s.right = `${fe(t)}px`, s.zIndex = "2"), (e.pinned === "top" || e.pinned === "bottom") && (s.position = "sticky", s.zIndex = String(Math.max(Number(s.zIndex ?? 0), 2)), e.pinned === "top" && (s.top = `${It}px`), e.pinned === "bottom" && (s.bottom = "0")), {
759
- gridRow: o,
760
- gridColumn: a,
761
- ...s
757
+ function ye(e, t, n) {
758
+ let i = (r.showGutter ? 2 : 1) + n, a = e.__virtualIndex + 2, o = {};
759
+ return t.pinned === "left" ? (o.position = "sticky", o.left = `${ge(t)}px`, o.zIndex = "2") : t.pinned === "right" && (o.position = "sticky", o.right = `${_e(t)}px`, o.zIndex = "2"), (e.pinned === "top" || e.pinned === "bottom") && (o.position = "sticky", o.zIndex = String(Math.max(Number(o.zIndex ?? 0), 2)), Object.assign(o, I(e))), {
760
+ gridRow: a,
761
+ gridColumn: i,
762
+ ...o
762
763
  };
763
764
  }
764
- function he(e, t) {
765
- let n = {
765
+ function I(e) {
766
+ if (e.pinned === "top") {
767
+ let t = k.value.findIndex((t) => t.id === e.id);
768
+ return { top: `calc(var(--nbss-header-height) + var(--nbss-row-height) * ${Math.max(0, t)})` };
769
+ }
770
+ if (e.pinned === "bottom") {
771
+ let t = A.value, n = t.findIndex((t) => t.id === e.id);
772
+ return { bottom: `calc(var(--nbss-row-height) * ${Math.max(0, t.length - 1 - n)})` };
773
+ }
774
+ return {};
775
+ }
776
+ function L(e) {
777
+ return e.label === void 0 ? e.gutterLabel === void 0 ? String(e.__virtualIndex - k.value.length + 1) : e.gutterLabel : e.label;
778
+ }
779
+ function be(e) {
780
+ let t = {
766
781
  position: "sticky",
767
782
  left: "0",
768
783
  zIndex: "2"
769
784
  };
770
- return t.pinned === "top" && (n.top = `${It}px`, n.zIndex = "4"), t.pinned === "bottom" && (n.bottom = "0", n.zIndex = "4"), {
771
- gridRow: e + 2,
785
+ return e.pinned && (Object.assign(t, I(e)), t.zIndex = "4"), {
786
+ gridRow: e.__virtualIndex + 2,
772
787
  gridColumn: 1,
773
- ...n
788
+ ...t
774
789
  };
775
790
  }
776
- function ge(e, t) {
777
- if (!S.value) return !1;
791
+ function xe(e, t) {
792
+ if (!x.value) return !1;
778
793
  let n = [
779
794
  ...k.value,
780
795
  ...O.value,
781
796
  ...A.value
782
- ].map((e) => e.id), r = E.value.map((e) => e.id), i = n.indexOf(S.value.startRowId), a = n.indexOf(S.value.endRowId), o = r.indexOf(S.value.startColumnId), s = r.indexOf(S.value.endColumnId), c = n.indexOf(e), l = r.indexOf(t);
797
+ ].map((e) => e.id), r = E.value.map((e) => e.id), i = n.indexOf(x.value.startRowId), a = n.indexOf(x.value.endRowId), o = r.indexOf(x.value.startColumnId), s = r.indexOf(x.value.endColumnId), c = n.indexOf(e), l = r.indexOf(t);
783
798
  return c >= Math.min(i, a) && c <= Math.max(i, a) && l >= Math.min(o, s) && l <= Math.max(o, s);
784
799
  }
785
- function z(e, t, n = !1) {
786
- x.value = {
800
+ function R(e, t, n = !1) {
801
+ b.value = {
787
802
  rowId: e,
788
803
  columnId: t
789
- }, n && S.value ? S.value = {
790
- ...S.value,
804
+ }, n && x.value ? x.value = {
805
+ ...x.value,
791
806
  endRowId: e,
792
807
  endColumnId: t
793
- } : S.value = {
808
+ } : x.value = {
794
809
  startRowId: e,
795
810
  startColumnId: t,
796
811
  endRowId: e,
797
812
  endColumnId: t
798
- }, i("focus", x.value), i("selection", S.value);
813
+ }, i("focus", b.value), i("selection", x.value);
799
814
  }
800
- function B(e, t, n) {
801
- w.value && G(!0), C.value = !0, z(t.id, n.id, e.shiftKey), u.value?.focus(), e.preventDefault(), document.addEventListener("mouseup", ve, { once: !0 });
815
+ function Se(e) {
816
+ ce = e.pointerType;
802
817
  }
803
- function _e(e, t) {
804
- !C.value || !S.value || (S.value = {
805
- ...S.value,
818
+ function Ce(e, t, n) {
819
+ let r = ce === "touch" && !e.shiftKey && b.value?.rowId === t.id && b.value?.columnId === n.id;
820
+ if (ce = "", C.value && q(), S.value = !0, R(t.id, n.id, e.shiftKey), z(), e.preventDefault(), document.addEventListener("mouseup", Te, { once: !0 }), r && !P(t, n)) {
821
+ let e = M(t.id, n.id);
822
+ G(t, n, e == null ? "" : String(e), "edit");
823
+ }
824
+ }
825
+ function we(e, t) {
826
+ !S.value || !x.value || (x.value = {
827
+ ...x.value,
806
828
  endRowId: e.id,
807
829
  endColumnId: t.id
808
- }, i("selection", S.value));
830
+ }, i("selection", x.value));
831
+ }
832
+ function Te() {
833
+ S.value = !1;
809
834
  }
810
- function ve() {
811
- C.value = !1;
835
+ function Ee(e, t) {
836
+ if (P(e, t)) return;
837
+ let n = M(e.id, t.id);
838
+ G(e, t, n == null ? "" : String(n), "edit");
812
839
  }
813
- function ye(e, t) {
814
- F(e, t) || H(e, t, "");
840
+ function z() {
841
+ u.value?.focus({ preventScroll: !0 });
815
842
  }
816
- function V(e, t, n = !1) {
817
- if (!x.value) {
818
- let e = E.value[0], t = le.value[0];
819
- e && t && z(t.id, e.id);
843
+ function B(e, t, n = !1) {
844
+ if (!b.value) {
845
+ let e = E.value[0], t = de.value[0];
846
+ e && t && R(t.id, e.id);
820
847
  return;
821
848
  }
822
849
  let r = [
823
850
  ...k.value,
824
851
  ...O.value,
825
852
  ...A.value
826
- ], i = r.findIndex((e) => e.id === x.value.rowId), a = E.value.findIndex((e) => e.id === x.value.columnId), o = Math.max(0, Math.min(r.length - 1, i + e)), s = Math.max(0, Math.min(E.value.length - 1, a + t));
827
- z(r[o].id, E.value[s].id, n), be(r[o].id);
853
+ ], i = r.findIndex((e) => e.id === b.value.rowId), a = E.value.findIndex((e) => e.id === b.value.columnId), o = Math.max(0, Math.min(r.length - 1, i + e)), s = Math.max(0, Math.min(E.value.length - 1, a + t)), c = r[o].id, l = E.value[s].id;
854
+ R(c, l, n), U(c, l);
828
855
  }
829
- function be(e) {
830
- let t = O.value.findIndex((t) => t.id === e);
831
- if (t < 0 || !u.value) return;
832
- let n = t * $, r = u.value;
833
- n < r.scrollTop ? r.scrollTop = n : n + $ > r.scrollTop + r.clientHeight - It && (r.scrollTop = n - r.clientHeight + It + $);
856
+ function V(e) {
857
+ return e.replace(/["\\]/g, "\\$&");
834
858
  }
835
- function xe() {
836
- oe.value = u.value?.scrollTop ?? 0;
859
+ function H(e) {
860
+ let t = u.value?.querySelector(e);
861
+ return t ? t.offsetHeight : 0;
837
862
  }
838
- function Se(e) {
839
- if (!w.value) {
840
- if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "z") {
841
- e.preventDefault(), e.shiftKey ? ke() : Y();
842
- return;
863
+ function De(e) {
864
+ let t = 0;
865
+ for (let n of e) t += H(`[data-row="${V(n.id)}"]`);
866
+ return t;
867
+ }
868
+ function Oe(e) {
869
+ let t = e === "left" && r.showGutter ? r.gutterWidth : 0;
870
+ for (let n of E.value) n.pinned === e && (t += D(n));
871
+ return t;
872
+ }
873
+ function U(e, t) {
874
+ let n = u.value;
875
+ if (!n) return;
876
+ let i = O.value.findIndex((t) => t.id === e);
877
+ if (i >= 0) {
878
+ let e = H(".nb-spreadsheet__header") || Pt, t = H(".nb-spreadsheet__cell") || Ft, r = e + (k.value.length + i) * t, a = e + De(k.value), o = De(A.value);
879
+ r - a < n.scrollTop ? n.scrollTop = r - a : r + t > n.scrollTop + n.clientHeight - o && (n.scrollTop = r + t - n.clientHeight + o);
880
+ }
881
+ let a = t ? E.value.find((e) => e.id === t) : void 0;
882
+ if (a && !a.pinned) {
883
+ let e = r.showGutter ? r.gutterWidth : 0;
884
+ for (let t of E.value) {
885
+ if (t.id === a.id) break;
886
+ e += D(t);
843
887
  }
844
- switch (e.key) {
845
- case "ArrowDown":
846
- e.preventDefault(), V(1, 0, e.shiftKey);
847
- break;
848
- case "ArrowUp":
849
- e.preventDefault(), V(-1, 0, e.shiftKey);
850
- break;
851
- case "ArrowLeft":
852
- e.preventDefault(), V(0, -1, e.shiftKey);
853
- break;
854
- case "ArrowRight":
855
- e.preventDefault(), V(0, 1, e.shiftKey);
856
- break;
857
- case "Tab":
858
- e.preventDefault(), V(0, e.shiftKey ? -1 : 1);
859
- break;
860
- case "Enter":
861
- if (e.preventDefault(), x.value) {
862
- let e = r.rows.find((e) => e.id === x.value.rowId), t = r.columns.find((e) => e.id === x.value.columnId);
863
- e && t && !F(e, t) && H(e, t, "");
864
- }
865
- break;
866
- case "Escape":
867
- S.value = null, i("selection", null);
868
- break;
869
- case "Delete":
870
- case "Backspace":
871
- e.preventDefault(), Te();
872
- break;
873
- case "F2":
874
- if (e.preventDefault(), x.value) {
875
- let e = r.rows.find((e) => e.id === x.value.rowId), t = r.columns.find((e) => e.id === x.value.columnId);
876
- if (e && t && !F(e, t)) {
877
- let n = M(e.id, t.id);
878
- H(e, t, n == null ? "" : String(n));
879
- }
880
- }
881
- break;
882
- default: if (x.value && !e.metaKey && !e.ctrlKey && !e.altKey && e.key.length === 1) {
883
- let t = r.rows.find((e) => e.id === x.value.rowId), n = r.columns.find((e) => e.id === x.value.columnId);
884
- t && n && !F(t, n) && (e.preventDefault(), H(t, n, e.key));
888
+ let t = D(a), i = Oe("left"), o = Oe("right");
889
+ e - i < n.scrollLeft ? n.scrollLeft = e - i : e + t > n.scrollLeft + n.clientWidth - o && (n.scrollLeft = e + t - n.clientWidth + o);
890
+ }
891
+ ke();
892
+ }
893
+ function ke() {
894
+ w.value = u.value?.scrollTop ?? 0, se.value = u.value?.scrollLeft ?? 0;
895
+ }
896
+ function Ae() {
897
+ if (!b.value) return null;
898
+ let e = r.rows.find((e) => e.id === b.value.rowId), t = r.columns.find((e) => e.id === b.value.columnId);
899
+ return e && t ? {
900
+ r: e,
901
+ c: t
902
+ } : null;
903
+ }
904
+ function W(e) {
905
+ return !e.metaKey && !e.ctrlKey && !e.altKey && e.key.length === 1;
906
+ }
907
+ function je(e) {
908
+ if (C.value) {
909
+ e.target !== _.value && (W(e) ? (e.preventDefault(), C.value.draft += e.key) : K(e));
910
+ return;
911
+ }
912
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "z") {
913
+ e.preventDefault(), e.shiftKey ? Be() : ze();
914
+ return;
915
+ }
916
+ switch (e.key) {
917
+ case "ArrowDown":
918
+ e.preventDefault(), B(1, 0, e.shiftKey);
919
+ break;
920
+ case "ArrowUp":
921
+ e.preventDefault(), B(-1, 0, e.shiftKey);
922
+ break;
923
+ case "ArrowLeft":
924
+ e.preventDefault(), B(0, -1, e.shiftKey);
925
+ break;
926
+ case "ArrowRight":
927
+ e.preventDefault(), B(0, 1, e.shiftKey);
928
+ break;
929
+ case "Tab":
930
+ e.preventDefault(), B(0, e.shiftKey ? -1 : 1);
931
+ break;
932
+ case "Enter":
933
+ e.preventDefault(), B(e.shiftKey ? -1 : 1, 0);
934
+ break;
935
+ case "Escape":
936
+ x.value = null, i("selection", null);
937
+ break;
938
+ case "Delete":
939
+ case "Backspace":
940
+ e.preventDefault(), Pe();
941
+ break;
942
+ case "F2": {
943
+ e.preventDefault();
944
+ let t = Ae();
945
+ if (t && !P(t.r, t.c)) {
946
+ let e = M(t.r.id, t.c.id);
947
+ G(t.r, t.c, e == null ? "" : String(e), "edit");
885
948
  }
949
+ break;
950
+ }
951
+ default: {
952
+ if (!W(e)) break;
953
+ let t = Ae();
954
+ t && !P(t.r, t.c) && (e.preventDefault(), G(t.r, t.c, e.key, "enter"));
886
955
  }
887
956
  }
888
957
  }
889
- function H(e, t, n) {
890
- w.value = {
958
+ function G(e, t, n, r) {
959
+ U(e.id, t.id), C.value = {
891
960
  rowId: e.id,
892
961
  columnId: t.id,
893
- draft: n
962
+ draft: n,
963
+ mode: r
894
964
  }, d(() => {
895
- v.value?.focus(), v.value?.select();
965
+ let e = _.value;
966
+ if (e) if (e.focus({ preventScroll: !0 }), r === "enter") {
967
+ let t = e.value.length;
968
+ e.setSelectionRange(t, t);
969
+ } else e.select();
896
970
  });
897
971
  }
898
- let Ce = o(() => {
899
- if (w.value) return r.columns.find((e) => e.id === w.value.columnId)?.type === "number" ? "decimal" : "text";
900
- }), U = o(() => {
901
- if (!w.value) return { display: "none" };
902
- let e = u.value?.querySelector(`[data-cell="${w.value.rowId}::${w.value.columnId}"]`);
903
- if (!e) return { display: "none" };
904
- let t = e.getBoundingClientRect(), n = u.value.getBoundingClientRect();
972
+ let Me = o(() => {
973
+ if (C.value) return r.columns.find((e) => e.id === C.value.columnId)?.type === "number" ? "decimal" : "text";
974
+ }), Ne = o(() => {
975
+ if (!C.value) return { display: "none" };
976
+ let e = u.value, t = e?.querySelector(`[data-cell="${V(`${C.value.rowId}::${C.value.columnId}`)}"]`);
977
+ if (!e || !t) return { display: "none" };
978
+ let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
905
979
  return {
906
- top: `${t.top - n.top}px`,
907
- left: `${t.left - n.left}px`,
908
- width: `${t.width}px`,
909
- height: `${t.height}px`
980
+ top: `${n.top - r.top - e.clientTop + w.value}px`,
981
+ left: `${n.left - r.left - e.clientLeft + se.value}px`,
982
+ width: `${n.width}px`,
983
+ height: `${n.height}px`
910
984
  };
911
985
  });
912
- function W(e) {
913
- e.key === "Enter" ? (e.preventDefault(), G(!1), V(1, 0)) : e.key === "Tab" ? (e.preventDefault(), G(!1), V(0, e.shiftKey ? -1 : 1)) : e.key === "Escape" && (e.preventDefault(), w.value = null, u.value?.focus());
914
- }
915
- function G(e) {
916
- if (!w.value) return;
917
- let { rowId: t, columnId: n, draft: a } = w.value, o = r.columns.find((e) => e.id === n);
918
- if (!o) {
919
- w.value = null;
920
- return;
986
+ function K(e) {
987
+ let t = C.value?.mode, n = null;
988
+ switch (e.key) {
989
+ case "Enter":
990
+ n = [e.shiftKey ? -1 : 1, 0];
991
+ break;
992
+ case "Tab":
993
+ n = [0, e.shiftKey ? -1 : 1];
994
+ break;
995
+ case "ArrowDown":
996
+ n = [1, 0];
997
+ break;
998
+ case "ArrowUp":
999
+ n = [-1, 0];
1000
+ break;
1001
+ case "ArrowLeft":
1002
+ t === "enter" && (n = [0, -1]);
1003
+ break;
1004
+ case "ArrowRight":
1005
+ t === "enter" && (n = [0, 1]);
1006
+ break;
1007
+ case "Escape":
1008
+ e.preventDefault(), C.value = null, z();
1009
+ return;
921
1010
  }
1011
+ n && (e.preventDefault(), q(), B(n[0], n[1]));
1012
+ }
1013
+ function q(e = !0) {
1014
+ if (!C.value) return;
1015
+ let { rowId: t, columnId: n, draft: a } = C.value;
1016
+ C.value = null;
1017
+ let o = r.columns.find((e) => e.id === n);
1018
+ if (!o) return;
922
1019
  let s;
923
1020
  try {
924
1021
  s = o.parse ? o.parse(a) : j(o, a);
925
1022
  } catch {
926
- w.value = null;
1023
+ e && z();
927
1024
  return;
928
1025
  }
929
1026
  let c = M(t, n);
930
- if (c === s) {
931
- w.value = null;
932
- return;
1027
+ if (c !== s) {
1028
+ let e = {
1029
+ rowId: t,
1030
+ columnId: n,
1031
+ before: c,
1032
+ after: s
1033
+ };
1034
+ X([e]), i("commit", e), i("change", [e]);
933
1035
  }
934
- let l = {
935
- rowId: t,
936
- columnId: n,
937
- before: c,
938
- after: s
939
- };
940
- J([l]), i("commit", l), i("change", [l]), w.value = null, u.value?.focus();
1036
+ e && z();
941
1037
  }
942
- function we() {
943
- if (!S.value) return [];
1038
+ function J() {
1039
+ if (!x.value) return [];
944
1040
  let e = [
945
1041
  ...k.value,
946
1042
  ...O.value,
947
1043
  ...A.value
948
- ].map((e) => e.id), t = E.value.map((e) => e.id), n = e.indexOf(S.value.startRowId), r = e.indexOf(S.value.endRowId), i = t.indexOf(S.value.startColumnId), a = t.indexOf(S.value.endColumnId), o = [];
1044
+ ].map((e) => e.id), t = E.value.map((e) => e.id), n = e.indexOf(x.value.startRowId), r = e.indexOf(x.value.endRowId), i = t.indexOf(x.value.startColumnId), a = t.indexOf(x.value.endColumnId), o = [];
949
1045
  for (let s = Math.min(n, r); s <= Math.max(n, r); s++) for (let n = Math.min(i, a); n <= Math.max(i, a); n++) o.push({
950
1046
  rowId: e[s],
951
1047
  columnId: t[n]
952
1048
  });
953
1049
  return o;
954
1050
  }
955
- function Te() {
956
- let e = we(), t = [];
1051
+ function Pe() {
1052
+ let e = J(), t = [];
957
1053
  for (let { rowId: n, columnId: i } of e) {
958
1054
  let e = r.rows.find((e) => e.id === n), a = r.columns.find((e) => e.id === i);
959
- if (!e || !a || F(e, a)) continue;
1055
+ if (!e || !a || P(e, a)) continue;
960
1056
  let o = M(n, i);
961
1057
  o == null || o === "" || t.push({
962
1058
  rowId: n,
@@ -966,18 +1062,18 @@ var Ct = (e) => {
966
1062
  });
967
1063
  }
968
1064
  if (t.length !== 0) {
969
- J(t);
1065
+ X(t);
970
1066
  for (let e of t) i("commit", e);
971
1067
  i("change", t);
972
1068
  }
973
1069
  }
974
- function K(e) {
975
- if (we().length === 0) return;
1070
+ function Y(e) {
1071
+ if (J().length === 0) return;
976
1072
  let t = [
977
1073
  ...k.value,
978
1074
  ...O.value,
979
1075
  ...A.value
980
- ].map((e) => e.id), n = E.value.map((e) => e.id), r = Math.min(t.indexOf(S.value.startRowId), t.indexOf(S.value.endRowId)), i = Math.max(t.indexOf(S.value.startRowId), t.indexOf(S.value.endRowId)), a = Math.min(n.indexOf(S.value.startColumnId), n.indexOf(S.value.endColumnId)), o = Math.max(n.indexOf(S.value.startColumnId), n.indexOf(S.value.endColumnId)), s = [];
1076
+ ].map((e) => e.id), n = E.value.map((e) => e.id), r = Math.min(t.indexOf(x.value.startRowId), t.indexOf(x.value.endRowId)), i = Math.max(t.indexOf(x.value.startRowId), t.indexOf(x.value.endRowId)), a = Math.min(n.indexOf(x.value.startColumnId), n.indexOf(x.value.endColumnId)), o = Math.max(n.indexOf(x.value.startColumnId), n.indexOf(x.value.endColumnId)), s = [];
981
1077
  for (let e = r; e <= i; e++) {
982
1078
  let r = [];
983
1079
  for (let i = a; i <= o; i++) {
@@ -988,11 +1084,11 @@ var Ct = (e) => {
988
1084
  }
989
1085
  e.preventDefault(), e.clipboardData?.setData("text/plain", s.join("\n"));
990
1086
  }
991
- function Ee(e) {
992
- K(e), Te();
1087
+ function Fe(e) {
1088
+ Y(e), Pe();
993
1089
  }
994
- function De(e) {
995
- if (!x.value) return;
1090
+ function Ie(e) {
1091
+ if (!b.value) return;
996
1092
  let t = e.clipboardData?.getData("text/plain") ?? "";
997
1093
  if (!t) return;
998
1094
  e.preventDefault();
@@ -1000,13 +1096,13 @@ var Ct = (e) => {
1000
1096
  ...k.value,
1001
1097
  ...O.value,
1002
1098
  ...A.value
1003
- ].map((e) => e.id), o = E.value.map((e) => e.id), s = a.indexOf(x.value.rowId), c = o.indexOf(x.value.columnId), l = [];
1099
+ ].map((e) => e.id), o = E.value.map((e) => e.id), s = a.indexOf(b.value.rowId), c = o.indexOf(b.value.columnId), l = [];
1004
1100
  if (n.forEach((e, t) => {
1005
1101
  e.forEach((e, n) => {
1006
1102
  let i = a[s + t], u = o[c + n];
1007
1103
  if (!i || !u) return;
1008
1104
  let d = r.rows.find((e) => e.id === i), f = r.columns.find((e) => e.id === u);
1009
- if (!d || !f || F(d, f)) return;
1105
+ if (!d || !f || P(d, f)) return;
1010
1106
  let p;
1011
1107
  try {
1012
1108
  p = f.parse ? f.parse(e) : j(f, e);
@@ -1022,16 +1118,16 @@ var Ct = (e) => {
1022
1118
  });
1023
1119
  });
1024
1120
  }), l.length !== 0) {
1025
- J(l);
1121
+ X(l);
1026
1122
  for (let e of l) i("commit", e);
1027
1123
  i("change", l);
1028
1124
  }
1029
1125
  }
1030
- function q(e, t) {
1126
+ function Le(e, t) {
1031
1127
  let n = e.clientX, r = D(t), i = t.minWidth ?? 60, a = (e) => {
1032
1128
  let a = Math.max(i, r + (e.clientX - n));
1033
- y.value = {
1034
- ...y.value,
1129
+ v.value = {
1130
+ ...v.value,
1035
1131
  [t.id]: a
1036
1132
  };
1037
1133
  }, o = () => {
@@ -1039,20 +1135,20 @@ var Ct = (e) => {
1039
1135
  };
1040
1136
  window.addEventListener("mousemove", a), window.addEventListener("mouseup", o);
1041
1137
  }
1042
- function Oe(e) {
1043
- e.sortable && (b.value?.columnId === e.id ? b.value = b.value.direction === "asc" ? {
1138
+ function Re(e) {
1139
+ e.sortable && (y.value?.columnId === e.id ? y.value = y.value.direction === "asc" ? {
1044
1140
  columnId: e.id,
1045
1141
  direction: "desc"
1046
- } : null : b.value = {
1142
+ } : null : y.value = {
1047
1143
  columnId: e.id,
1048
1144
  direction: "asc"
1049
1145
  });
1050
1146
  }
1051
- function J(e) {
1052
- se.value.push(e), T.value = [];
1147
+ function X(e) {
1148
+ T.value.push(e), le.value = [];
1053
1149
  }
1054
- function Y() {
1055
- let e = se.value.pop();
1150
+ function ze() {
1151
+ let e = T.value.pop();
1056
1152
  if (!e) return;
1057
1153
  let t = e.map((e) => ({
1058
1154
  ...e,
@@ -1060,90 +1156,92 @@ var Ct = (e) => {
1060
1156
  after: e.before
1061
1157
  }));
1062
1158
  for (let e of t) i("commit", e);
1063
- i("change", t), T.value.push(e);
1159
+ i("change", t), le.value.push(e);
1064
1160
  }
1065
- function ke() {
1066
- let e = T.value.pop();
1161
+ function Be() {
1162
+ let e = le.value.pop();
1067
1163
  if (e) {
1068
1164
  for (let t of e) i("commit", t);
1069
- i("change", e), se.value.push(e);
1165
+ i("change", e), T.value.push(e);
1070
1166
  }
1071
1167
  }
1072
1168
  return m(() => {
1073
- u.value?.focus();
1169
+ z();
1074
1170
  }), t({
1075
- focus: (e, t) => z(e, t),
1076
- undo: Y,
1077
- redo: ke,
1078
- getSelection: () => S.value
1079
- }), (t, n) => (h(), c("div", { class: f(["nb-spreadsheet", { "nb-spreadsheet--editing": !!w.value }]) }, [t.$slots.toolbar ? (h(), c("div", Dt, [te(t.$slots, "toolbar", {}, void 0, !0)])) : s("", !0), l("div", {
1171
+ focus: (e, t) => R(e, t),
1172
+ undo: ze,
1173
+ redo: Be,
1174
+ getSelection: () => x.value
1175
+ }), (t, n) => (h(), c("div", { class: f(["nb-spreadsheet", { "nb-spreadsheet--editing": !!C.value }]) }, [t.$slots.toolbar ? (h(), c("div", Et, [te(t.$slots, "toolbar", {}, void 0, !0)])) : s("", !0), l("div", {
1080
1176
  ref_key: "scrollerRef",
1081
1177
  ref: u,
1082
1178
  class: "nb-spreadsheet__scroller",
1083
1179
  tabindex: "0",
1084
- onKeydown: Se,
1085
- onCopy: K,
1086
- onCut: Ee,
1087
- onPaste: De,
1088
- onScroll: xe
1180
+ onKeydown: je,
1181
+ onCopy: Y,
1182
+ onCut: Fe,
1183
+ onPaste: Ie,
1184
+ onScroll: ke
1089
1185
  }, [l("div", {
1090
1186
  class: "nb-spreadsheet__grid",
1091
- style: p(ce.value)
1187
+ style: p(ue.value)
1092
1188
  }, [
1093
- e.showGutter ? (h(), c("div", Ot)) : s("", !0),
1189
+ e.showGutter ? (h(), c("div", Dt)) : s("", !0),
1094
1190
  (h(!0), c(a, null, ee(E.value, (t, n) => (h(), c("div", {
1095
1191
  key: `h-${t.id}`,
1096
- class: f(["nb-spreadsheet__header", L(t)]),
1097
- style: p(pe(t, n)),
1098
- onClick: (e) => Oe(t)
1192
+ class: f(["nb-spreadsheet__header", he(t)]),
1193
+ style: p(ve(t, n)),
1194
+ onClick: (e) => Re(t)
1099
1195
  }, [
1100
- l("span", At, _(t.label), 1),
1101
- b.value && b.value.columnId === t.id ? (h(), c("span", jt, _(b.value.direction === "asc" ? "▲" : "▼"), 1)) : s("", !0),
1196
+ l("span", kt, ne(t.label), 1),
1197
+ y.value && y.value.columnId === t.id ? (h(), c("span", At, ne(y.value.direction === "asc" ? "▲" : "▼"), 1)) : s("", !0),
1102
1198
  e.resizable ? (h(), c("span", {
1103
1199
  key: 1,
1104
1200
  class: "nb-spreadsheet__resize-handle",
1105
- onMousedown: ae((e) => q(e, t), ["stop"])
1106
- }, null, 40, Mt)) : s("", !0)
1107
- ], 14, kt))), 128)),
1108
- (h(!0), c(a, null, ee(le.value, (t, n) => (h(), c(a, { key: `r-${t.id}` }, [e.showGutter ? (h(), c("div", {
1201
+ onMousedown: oe((e) => Le(e, t), ["stop"])
1202
+ }, null, 40, jt)) : s("", !0)
1203
+ ], 14, Ot))), 128)),
1204
+ (h(!0), c(a, null, ee(de.value, (t) => (h(), c(a, { key: `r-${t.id}` }, [e.showGutter ? (h(), c("div", {
1109
1205
  key: 0,
1110
1206
  class: f(["nb-spreadsheet__gutter", {
1111
1207
  "nb-spreadsheet__gutter--pinned-top": t.pinned === "top",
1112
1208
  "nb-spreadsheet__gutter--pinned-bottom": t.pinned === "bottom"
1113
1209
  }]),
1114
- style: p(he(n, t))
1115
- }, _(t.gutterLabel ?? n + 1), 7)) : s("", !0), (h(!0), c(a, null, ee(E.value, (e, r) => (h(), c("div", {
1210
+ style: p(be(t))
1211
+ }, ne(L(t)), 7)) : s("", !0), (h(!0), c(a, null, ee(E.value, (e, r) => (h(), c("div", {
1116
1212
  key: `c-${t.id}-${e.id}`,
1117
- class: f(["nb-spreadsheet__cell", P(t, e)]),
1118
- style: p(me(t, e, n, r)),
1119
- title: I(t, e),
1213
+ class: f(["nb-spreadsheet__cell", me(t, e)]),
1214
+ style: p(ye(t, e, r)),
1215
+ title: F(t, e),
1120
1216
  "data-cell": `${t.id}::${e.id}`,
1121
1217
  "data-row": t.id,
1122
1218
  "data-col": e.id,
1123
- onMousedown: (n) => B(n, t, e),
1124
- onMouseenter: (n) => _e(t, e),
1125
- onDblclick: (n) => ye(t, e)
1126
- }, [l("span", null, _(de(t, e)), 1)], 46, Nt))), 128))], 64))), 128))
1127
- ], 4), w.value ? ie((h(), c("input", {
1219
+ onPointerdown: n[0] ||= (e) => Se(e),
1220
+ onMousedown: (n) => Ce(n, t, e),
1221
+ onMouseenter: (n) => we(t, e),
1222
+ onDblclick: (n) => Ee(t, e)
1223
+ }, [l("span", null, ne(pe(t, e)), 1)], 46, Mt))), 128))], 64))), 128))
1224
+ ], 4), C.value ? ae((h(), c("input", {
1128
1225
  key: 0,
1129
1226
  ref_key: "editorRef",
1130
- ref: v,
1131
- "onUpdate:modelValue": n[0] ||= (e) => w.value.draft = e,
1227
+ ref: _,
1228
+ "onUpdate:modelValue": n[1] ||= (e) => C.value.draft = e,
1132
1229
  class: "nb-spreadsheet__editor",
1133
- style: p(U.value),
1134
- inputmode: Ce.value,
1135
- onBlur: n[1] ||= (e) => G(!0),
1136
- onKeydown: ae(W, ["stop"])
1137
- }, null, 44, Pt)), [[re, w.value.draft]]) : s("", !0)], 544)], 2));
1230
+ style: p(Ne.value),
1231
+ inputmode: Me.value,
1232
+ enterkeyhint: "next",
1233
+ onBlur: n[2] ||= (e) => q(!1),
1234
+ onKeydown: oe(K, ["stop"])
1235
+ }, null, 44, Nt)), [[ie, C.value.draft]]) : s("", !0)], 544)], 2));
1138
1236
  }
1139
- }), Rt = /* @__PURE__ */ y({ default: () => zt }), zt = /* @__PURE__ */ i(Lt, [["__scopeId", "data-v-df859a7e"]]), Bt = /* @__PURE__ */ Object.assign({ "./components/labs/Spreadsheet.vue": Rt }), Vt = { install(e) {
1140
- Object.keys(Bt).forEach((t) => {
1141
- let n = `Nb${t.replace(/(.+\/)(\w+)(\.vue)$/, "$2")}`, r = Bt[t];
1237
+ }), Lt = /* @__PURE__ */ v({ default: () => Rt }), Rt = /* @__PURE__ */ i(It, [["__scopeId", "data-v-d04d6e9c"]]), zt = /* @__PURE__ */ Object.assign({ "./components/labs/Spreadsheet.vue": Lt }), Bt = { install(e) {
1238
+ Object.keys(zt).forEach((t) => {
1239
+ let n = `Nb${t.replace(/(.+\/)(\w+)(\.vue)$/, "$2")}`, r = zt[t];
1142
1240
  e.component(n, r.default);
1143
1241
  });
1144
- } }, Ht = { install(e, t = {}) {
1242
+ } }, Vt = { install(e, t = {}) {
1145
1243
  if (t.components) for (let [n, r] of Object.entries(t.components)) e.component(n, r);
1146
- e.use(Tt), e.use(Et);
1244
+ e.use(wt), e.use(Tt);
1147
1245
  } };
1148
1246
  //#endregion
1149
- export { Ct as a, Et as i, Vt as n, bt as o, zt as r, ct as s, Ht as t };
1247
+ export { St as a, Tt as i, Bt as n, yt as o, Rt as r, st as s, Vt as t };