@aintela/chat 0.4.15 → 0.4.16

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.
@@ -1,8 +1,8 @@
1
1
  var x = Object.defineProperty;
2
- var $ = (o, t, e) => t in o ? x(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var d = (o, t) => x(o, "name", { value: t, configurable: !0 });
4
- var E = (o, t, e) => $(o, typeof t != "symbol" ? t + "" : t, e);
5
- const D = /^[a-z][a-z0-9+.-]*:\/\//i, F = /* @__PURE__ */ d((o, t, e) => {
2
+ var $ = (o, e, t) => e in o ? x(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var d = (o, e) => x(o, "name", { value: e, configurable: !0 });
4
+ var E = (o, e, t) => $(o, typeof e != "symbol" ? e + "" : e, t);
5
+ const N = /^[a-z][a-z0-9+.-]*:\/\//i, F = /* @__PURE__ */ d((o, e, t) => {
6
6
  let s = "URL", n = null, i = null, r = null;
7
7
  if (o[0] == "#") {
8
8
  const a = o.indexOf("-"), l = o.slice(1, a);
@@ -11,63 +11,63 @@ const D = /^[a-z][a-z0-9+.-]*:\/\//i, F = /* @__PURE__ */ d((o, t, e) => {
11
11
  s = "OpenDashboard";
12
12
  break;
13
13
  case "ask":
14
- s = "Question", n = e;
14
+ s = "Question", n = t;
15
15
  break;
16
16
  }
17
- } else D.test(o) ? (s = "URL", i = o) : o[0] === "/" ? (s = "Navigate", i = o) : (o = o.replaceAll("exported/", `exported/${t}/`), s = "Export");
17
+ } else N.test(o) ? (s = "URL", i = o) : o[0] === "/" ? (s = "Navigate", i = o) : (o = o.replaceAll("exported/", `exported/${e}/`), s = "Export");
18
18
  return { action: s, url: i, question: n, parameter: r };
19
- }, "extractLinkAction"), I = /* @__PURE__ */ d((o, t) => Array.from(
20
- { length: Math.ceil(o.length / t) },
21
- (e, s) => o.slice(s * t, s * t + t)
19
+ }, "extractLinkAction"), D = /* @__PURE__ */ d((o, e) => Array.from(
20
+ { length: Math.ceil(o.length / e) },
21
+ (t, s) => o.slice(s * e, s * e + e)
22
22
  ), "chunkArray"), B = /* @__PURE__ */ d((o) => {
23
23
  o = o.replaceAll("\\n", `
24
24
  `);
25
- const t = 90, e = o.split(" "), s = [];
25
+ const e = 90, t = o.split(" "), s = [];
26
26
  let n = !1;
27
- for (const i of e)
28
- if (i.length > t) {
27
+ for (const i of t)
28
+ if (i.length > e) {
29
29
  n = !0;
30
- const r = [...i], l = I(r, t).map((c) => c.join("")).join(`
30
+ const r = [...i], l = D(r, e).map((c) => c.join("")).join(`
31
31
  `);
32
32
  s.push(l);
33
33
  } else
34
34
  s.push(i);
35
35
  return n ? s.join(" ") : o;
36
36
  }, "splitBigLinesWithSpaces");
37
- function N(o) {
38
- let t = parseFloat(o);
39
- if (!isNaN(t))
37
+ function I(o) {
38
+ let e = parseFloat(o);
39
+ if (!isNaN(e))
40
40
  return o = o.replaceAll(/[,\.]/g, ""), parseInt(o);
41
- var e = "";
41
+ var t = "";
42
42
  for (const n of o)
43
- n.match(/[0-9]/) && (e += n);
44
- const s = e.length / o.length;
45
- return t = parseInt(e), !isNaN(t) && s > 0.5 ? t : NaN;
43
+ n.match(/[0-9]/) && (t += n);
44
+ const s = t.length / o.length;
45
+ return e = parseInt(t), !isNaN(e) && s > 0.5 ? e : NaN;
46
46
  }
47
- d(N, "parseRawNumber");
47
+ d(I, "parseRawNumber");
48
48
  const W = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i, q = /^[0-9a-f]{32}/i;
49
49
  function P(o) {
50
50
  if (!o || typeof o != "string")
51
51
  return !1;
52
- const t = M(o);
53
- return t === null ? !1 : o.startsWith(t);
52
+ const e = M(o);
53
+ return e === null ? !1 : o.startsWith(e);
54
54
  }
55
55
  d(P, "startsWithInteractionId");
56
56
  function M(o) {
57
57
  if (!o || typeof o != "string")
58
58
  return null;
59
- const t = o.match(W);
60
- if (t)
61
- return t[0];
62
- const e = o.match(q);
63
- return e ? e[0] : null;
59
+ const e = o.match(W);
60
+ if (e)
61
+ return e[0];
62
+ const t = o.match(q);
63
+ return t ? t[0] : null;
64
64
  }
65
65
  d(M, "extractInteractionId");
66
66
  function V(o) {
67
67
  if (o.length == 0)
68
68
  return o;
69
- const t = o.replaceAll("_", " ").replaceAll("-", " ");
70
- return t[0].toUpperCase() + t.slice(1);
69
+ const e = o.replaceAll("_", " ").replaceAll("-", " ");
70
+ return e[0].toUpperCase() + e.slice(1);
71
71
  }
72
72
  d(V, "prettiffyPythonFunctionName");
73
73
  function U(o) {
@@ -75,7 +75,7 @@ function U(o) {
75
75
  }
76
76
  d(U, "isValidInteractionId");
77
77
  const L = /* @__PURE__ */ new Set(), v = class v {
78
- constructor(t = {}) {
78
+ constructor(e = {}) {
79
79
  this.options = {
80
80
  // CSS class for sortable headers
81
81
  sortableClass: "sortable-header",
@@ -142,59 +142,59 @@ const L = /* @__PURE__ */ new Set(), v = class v {
142
142
  radiusLg: 10
143
143
  }
144
144
  },
145
- ...t
145
+ ...e
146
146
  }, this.tables = [], this.sortStates = /* @__PURE__ */ new Map(), this.originalColumnOrder = /* @__PURE__ */ new Map(), this.isDragging = !1, this.dragSource = null, this.dragTarget = null, this.charWidth = 0;
147
147
  }
148
148
  /**
149
149
  * Initialize the library - scan document for tables and make them sortable
150
150
  * @param {HTMLElement} container - Optional container element to limit search scope
151
151
  */
152
- init(t = null) {
153
- this.charWidth == 0 && (this.charWidth = this.getCharWidth(this.options.theme.typography.fontFamily, this.options.theme.typography.fontMono)), this.scanTables(t), this.makeTablesSortable(), this.addStyles();
152
+ init(e = null) {
153
+ this.charWidth == 0 && (this.charWidth = this.getCharWidth(this.options.theme.typography.fontFamily, this.options.theme.typography.fontMono)), this.scanTables(e), this.makeTablesSortable(), this.addStyles();
154
154
  }
155
155
  /**
156
156
  * Scan for tables in the document or within a specific container
157
157
  * @param {HTMLElement} container - Optional container element to limit search scope
158
158
  */
159
- scanTables(t = null) {
160
- const s = (t || document).querySelectorAll("table");
159
+ scanTables(e = null) {
160
+ const s = (e || document).querySelectorAll("table");
161
161
  this.tables = Array.from(s);
162
162
  }
163
163
  /**
164
164
  * Make all found tables sortable
165
165
  */
166
166
  makeTablesSortable() {
167
- this.tables.forEach((t, e) => {
168
- this.makeTableSortable(t, e);
167
+ this.tables.forEach((e, t) => {
168
+ this.makeTableSortable(e, t);
169
169
  });
170
170
  }
171
171
  /**
172
172
  * Make a specific table sortable
173
173
  */
174
- makeTableSortable(t, e) {
175
- let s = t.querySelector("thead"), n = null, i = [];
174
+ makeTableSortable(e, t) {
175
+ let s = e.querySelector("thead"), n = null, i = [];
176
176
  if (s && (n = s.querySelector("tr"), n && (i = n.querySelectorAll("th"))), i.length === 0) {
177
177
  console.warn("Table has no sortable columns, skipping");
178
178
  return;
179
179
  }
180
- const r = !t.hasAttribute("data-sortable-arrived");
181
- t.classList.add("sortable-table"), r && (t.setAttribute("data-sortable-arrived", "true"), t.classList.add("sortable-table-arriving"), setTimeout(() => {
182
- t.classList.remove("sortable-table-arriving");
183
- }, 400)), this.sortStates.set(e, {
180
+ const r = !e.hasAttribute("data-sortable-arrived");
181
+ e.classList.add("sortable-table"), r && (e.setAttribute("data-sortable-arrived", "true"), e.classList.add("sortable-table-arriving"), setTimeout(() => {
182
+ e.classList.remove("sortable-table-arriving");
183
+ }, 400)), this.sortStates.set(t, {
184
184
  currentColumn: -1,
185
185
  direction: "none"
186
- }), t.hasAttribute("data-original-width") || t.setAttribute("data-original-width", t.getBoundingClientRect().width), this.applyTableStyles(t), this.originalColumnOrder.set(e, Array.from(i).map((a, l) => l)), i.forEach((a, l) => {
187
- this.options.excludeColumns.includes(l) || this.makeHeaderSortable(a, t, e, l);
188
- }), this.replaceExponentialValues(t), L.add(t);
186
+ }), e.hasAttribute("data-original-width") || e.setAttribute("data-original-width", e.getBoundingClientRect().width), this.applyTableStyles(e), this.originalColumnOrder.set(t, Array.from(i).map((a, l) => l)), i.forEach((a, l) => {
187
+ this.options.excludeColumns.includes(l) || this.makeHeaderSortable(a, e, t, l);
188
+ }), this.replaceExponentialValues(e), L.add(e);
189
189
  }
190
190
  /**
191
191
  * Replace exponential values in table cells with full numbers
192
192
  * @param {HTMLElement} table - The table to process
193
193
  */
194
- replaceExponentialValues(t) {
195
- const e = t.querySelector("tbody");
196
- if (!e) return;
197
- e.querySelectorAll("tr").forEach((n) => {
194
+ replaceExponentialValues(e) {
195
+ const t = e.querySelector("tbody");
196
+ if (!t) return;
197
+ t.querySelectorAll("tr").forEach((n) => {
198
198
  n.querySelectorAll("td, th").forEach((r) => {
199
199
  const l = r.textContent.trim().match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
200
200
  if (l) {
@@ -209,8 +209,8 @@ const L = /* @__PURE__ */ new Set(), v = class v {
209
209
  * @param {number} num - The number to format
210
210
  * @returns {string} The formatted number
211
211
  */
212
- formatNumber(t) {
213
- return t === 0 ? "0" : Math.abs(t) >= 1e12 ? (t / 1e12).toFixed(2) + "T" : Math.abs(t) >= 1e9 ? (t / 1e9).toFixed(2) + "B" : Math.abs(t) >= 1e6 ? (t / 1e6).toFixed(2) + "M" : Math.abs(t) >= 1e3 ? (t / 1e3).toFixed(2) + "K" : Math.abs(t) < 0.01 && t !== 0 ? t.toExponential(2) : t.toLocaleString();
212
+ formatNumber(e) {
213
+ return e === 0 ? "0" : Math.abs(e) >= 1e12 ? (e / 1e12).toFixed(2) + "T" : Math.abs(e) >= 1e9 ? (e / 1e9).toFixed(2) + "B" : Math.abs(e) >= 1e6 ? (e / 1e6).toFixed(2) + "M" : Math.abs(e) >= 1e3 ? (e / 1e3).toFixed(2) + "K" : Math.abs(e) < 0.01 && e !== 0 ? e.toExponential(2) : e.toLocaleString();
214
214
  }
215
215
  /**
216
216
  * Convert the first row to a header row
@@ -219,15 +219,15 @@ const L = /* @__PURE__ */ new Set(), v = class v {
219
219
  * @param {HTMLElement} tbody - The tbody element to remove from
220
220
  * @returns {HTMLElement} The converted header row
221
221
  */
222
- convertRowToHeader(t, e, s) {
222
+ convertRowToHeader(e, t, s) {
223
223
  try {
224
- const n = t.cloneNode(!0);
224
+ const n = e.cloneNode(!0);
225
225
  return n.querySelectorAll("td").forEach((r) => {
226
226
  const a = document.createElement("th");
227
227
  Array.from(r.attributes).forEach((l) => {
228
228
  a.setAttribute(l.name, l.value);
229
229
  }), a.innerHTML = r.innerHTML, a.style.cssText = r.style.cssText, r.parentNode.replaceChild(a, r);
230
- }), s && s.contains(t) ? s.removeChild(t) : t.parentNode && t.parentNode.removeChild(t), e.appendChild(n), n;
230
+ }), s && s.contains(e) ? s.removeChild(e) : e.parentNode && e.parentNode.removeChild(e), t.appendChild(n), n;
231
231
  } catch (n) {
232
232
  return console.error("Error converting row to header:", n), null;
233
233
  }
@@ -235,35 +235,35 @@ const L = /* @__PURE__ */ new Set(), v = class v {
235
235
  /**
236
236
  * Make a specific header sortable
237
237
  */
238
- makeHeaderSortable(t, e, s, n) {
239
- t.classList.add(this.options.sortableClass), t.style.cursor = "pointer", (!this.options.preserveExistingIcons || !t.querySelector(".material-icons")) && this.addSortIcon(t), this.options.enableResizing && this.addResizing(t, e, s, n), this.options.enableReordering && this.addDragAndDrop(t, e, s, n);
238
+ makeHeaderSortable(e, t, s, n) {
239
+ e.classList.add(this.options.sortableClass), e.style.cursor = "pointer", (!this.options.preserveExistingIcons || !e.querySelector(".material-icons")) && this.addSortIcon(e), this.options.enableResizing && this.addResizing(e, t, s, n), this.options.enableReordering && this.addDragAndDrop(e, t, s, n);
240
240
  const i = /* @__PURE__ */ d((l) => {
241
- l.preventDefault(), this.sortTable(e, s, n);
241
+ l.preventDefault(), this.sortTable(t, s, n);
242
242
  }, "clickListener"), r = /* @__PURE__ */ d((l) => {
243
- t.classList.contains(this.options.activeSortClass) || (t.style.background = this.options.theme.palette.surface.hover);
243
+ e.classList.contains(this.options.activeSortClass) || (e.style.background = this.options.theme.palette.surface.hover);
244
244
  }, "mouseEnterListener"), a = /* @__PURE__ */ d((l) => {
245
- t.classList.contains(this.options.activeSortClass) || (t.style.background = "");
245
+ e.classList.contains(this.options.activeSortClass) || (e.style.background = "");
246
246
  }, "mouseLeaveListener");
247
- t.removeEventListener("click", i), t.addEventListener("click", i), t.removeEventListener("mouseenter", r), t.addEventListener("mouseenter", r), t.removeEventListener("mouseleave", a), t.addEventListener("mouseleave", a);
247
+ e.removeEventListener("click", i), e.addEventListener("click", i), e.removeEventListener("mouseenter", r), e.addEventListener("mouseenter", r), e.removeEventListener("mouseleave", a), e.addEventListener("mouseleave", a);
248
248
  }
249
249
  /**
250
250
  * Add sort icon to header
251
251
  */
252
- addSortIcon(t) {
253
- if (t.querySelector(".sortable-table-icon"))
252
+ addSortIcon(e) {
253
+ if (e.querySelector(".sortable-table-icon"))
254
254
  return;
255
- const e = document.createElement("i");
256
- e.id = "sortable-table-icon", e.className = "material-icons", e.textContent = this.options.unsortedIcon, e.style.marginRight = "2px", e.style.fontSize = "12px", e.style.verticalAlign = "middle", e.style.opacity = "0", t.querySelector(".material-icons") || (t.insertBefore(e, t.firstChild), requestAnimationFrame(() => {
255
+ const t = document.createElement("i");
256
+ t.id = "sortable-table-icon", t.className = "material-icons", t.textContent = this.options.unsortedIcon, t.style.marginRight = "2px", t.style.fontSize = "12px", t.style.verticalAlign = "middle", t.style.opacity = "0", e.querySelector(".material-icons") || (e.insertBefore(t, e.firstChild), requestAnimationFrame(() => {
257
257
  requestAnimationFrame(() => {
258
- e.style.opacity = "0.6";
258
+ t.style.opacity = "0.6";
259
259
  });
260
260
  }));
261
261
  }
262
262
  /**
263
263
  * Sort table by column
264
264
  */
265
- sortTable(t, e, s) {
266
- const n = t.querySelector("tbody");
265
+ sortTable(e, t, s) {
266
+ const n = e.querySelector("tbody");
267
267
  if (!n) {
268
268
  console.warn("Table has no tbody element");
269
269
  return;
@@ -273,11 +273,11 @@ const L = /* @__PURE__ */ new Set(), v = class v {
273
273
  console.warn("Table has no data rows");
274
274
  return;
275
275
  }
276
- const r = this.sortStates.get(e);
277
- t.querySelector(`thead tr th:nth-child(${s + 1})`);
276
+ const r = this.sortStates.get(t);
277
+ e.querySelector(`thead tr th:nth-child(${s + 1})`);
278
278
  let a;
279
- if (this.options.sortOnFirstClick ? a = r.currentColumn === s && r.direction === "asc" ? "desc" : "asc" : r.currentColumn !== s ? a = "asc" : a = r.direction === "none" ? "asc" : r.direction === "asc" ? "desc" : "none", r.currentColumn = s, r.direction = a, this.sortStates.set(e, r), this.updateSortIndicators(t, e, s, a), a === "none") {
280
- this.restoreOriginalOrder(t, i);
279
+ if (this.options.sortOnFirstClick ? a = r.currentColumn === s && r.direction === "asc" ? "desc" : "asc" : r.currentColumn !== s ? a = "asc" : a = r.direction === "none" ? "asc" : r.direction === "asc" ? "desc" : "none", r.currentColumn = s, r.direction = a, this.sortStates.set(t, r), this.updateSortIndicators(e, t, s, a), a === "none") {
280
+ this.restoreOriginalOrder(e, i);
281
281
  return;
282
282
  }
283
283
  this.sortRows(i, s, a).forEach((c) => n.appendChild(c));
@@ -285,13 +285,13 @@ const L = /* @__PURE__ */ new Set(), v = class v {
285
285
  /**
286
286
  * Sort rows based on column data
287
287
  */
288
- sortRows(t, e, s) {
289
- return t.sort((n, i) => {
290
- const r = n.cells[e], a = i.cells[e];
288
+ sortRows(e, t, s) {
289
+ return e.sort((n, i) => {
290
+ const r = n.cells[t], a = i.cells[t];
291
291
  if (!r || !a) return 0;
292
292
  const l = this.extractValue(r), c = this.extractValue(a);
293
- if (this.options.customSorters[e])
294
- return this.options.customSorters[e](l, c, s);
293
+ if (this.options.customSorters[t])
294
+ return this.options.customSorters[t](l, c, s);
295
295
  const u = this.compareValues(l, c);
296
296
  return s === "asc" ? u : -u;
297
297
  });
@@ -299,39 +299,39 @@ const L = /* @__PURE__ */ new Set(), v = class v {
299
299
  /**
300
300
  * Extract sortable value from cell
301
301
  */
302
- extractValue(t) {
303
- let e = t.textContent.trim(), s = N(e);
302
+ extractValue(e) {
303
+ let t = e.textContent.trim(), s = I(t);
304
304
  if (!isNaN(s))
305
305
  return console.log(s), s;
306
- if (e = e.replace(/arrow_upward|arrow_downward|remove|keyboard_arrow_up|keyboard_arrow_down|unfold_more|expand_more|expand_less|trending_up|trending_down|↗|↘|↑|↓|→|←/g, "").trim(), /^(N\/A|N\/D|ND|N\/A|n\/a|n\/d|nd|N\/A|N\/D|ND|\s*)$/i.test(e))
306
+ if (t = t.replace(/arrow_upward|arrow_downward|remove|keyboard_arrow_up|keyboard_arrow_down|unfold_more|expand_more|expand_less|trending_up|trending_down|↗|↘|↑|↓|→|←/g, "").trim(), /^(N\/A|N\/D|ND|N\/A|n\/a|n\/d|nd|N\/A|N\/D|ND|\s*)$/i.test(t))
307
307
  return -1;
308
- const i = e.match(/^([\d,]+\.?\d*)\s*%$/);
308
+ const i = t.match(/^([\d,]+\.?\d*)\s*%$/);
309
309
  if (i)
310
310
  return parseFloat(i[1].replace(/,/g, ""));
311
- const r = e.match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
311
+ const r = t.match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
312
312
  if (r) {
313
313
  const u = parseFloat(r[1].replace(/,/g, "")), p = parseInt(r[2]);
314
314
  return u * Math.pow(10, p);
315
315
  }
316
- if (e.match(/^[\d,]+\.?\d*[KMB]?$/))
317
- return this.parseNumber(e);
318
- const l = e.match(/^R\$\s*([\d,]+\.?\d*)$/);
316
+ if (t.match(/^[\d,]+\.?\d*[KMB]?$/))
317
+ return this.parseNumber(t);
318
+ const l = t.match(/^R\$\s*([\d,]+\.?\d*)$/);
319
319
  if (l)
320
320
  return this.parseNumber(l[1]);
321
- const c = new Date(e);
322
- return isNaN(c.getTime()) ? e.toLowerCase() : c.getTime();
321
+ const c = new Date(t);
322
+ return isNaN(c.getTime()) ? t.toLowerCase() : c.getTime();
323
323
  }
324
324
  /**
325
325
  * Compare two values for sorting
326
326
  */
327
- compareValues(t, e) {
328
- return t == null && e == null ? 0 : t == null ? -1 : e == null ? 1 : typeof t != typeof e ? String(t).localeCompare(String(e)) : typeof t == "number" ? t - e : t instanceof Date ? t.getTime() - e.getTime() : t.localeCompare(e);
327
+ compareValues(e, t) {
328
+ return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : typeof e != typeof t ? String(e).localeCompare(String(t)) : typeof e == "number" ? e - t : e instanceof Date ? e.getTime() - t.getTime() : e.localeCompare(t);
329
329
  }
330
330
  /**
331
331
  * Update visual indicators for sort state
332
332
  */
333
- updateSortIndicators(t, e, s, n) {
334
- const i = t.querySelectorAll("thead tr th");
333
+ updateSortIndicators(e, t, s, n) {
334
+ const i = e.querySelectorAll("thead tr th");
335
335
  if (i.forEach((r, a) => {
336
336
  r.classList.remove(this.options.activeSortClass, this.options.ascendingClass, this.options.descendingClass);
337
337
  const l = r.querySelector(".material-icons");
@@ -346,15 +346,15 @@ const L = /* @__PURE__ */ new Set(), v = class v {
346
346
  /**
347
347
  * Restore original order (when sort direction is 'none')
348
348
  */
349
- restoreOriginalOrder(t, e) {
350
- const s = t.querySelector("tbody");
351
- e.forEach((n) => s.appendChild(n));
349
+ restoreOriginalOrder(e, t) {
350
+ const s = e.querySelector("tbody");
351
+ t.forEach((n) => s.appendChild(n));
352
352
  }
353
353
  /**
354
354
  * Add resizing functionality to a header
355
355
  */
356
- addResizing(t, e, s, n) {
357
- if (t.classList.add(this.options.resizableClass), t.style.position = "relative", t.querySelector(".resize-handle"))
356
+ addResizing(e, t, s, n) {
357
+ if (e.classList.add(this.options.resizableClass), e.style.position = "relative", e.querySelector(".resize-handle"))
358
358
  return;
359
359
  const i = document.createElement("div");
360
360
  i.className = "resize-handle", i.style.cssText = `
@@ -366,66 +366,66 @@ const L = /* @__PURE__ */ new Set(), v = class v {
366
366
  background: transparent;
367
367
  cursor: col-resize;
368
368
  z-index: 10;
369
- `, t.appendChild(i);
369
+ `, e.appendChild(i);
370
370
  let r = !1, a = 0, l = 0;
371
371
  i.addEventListener("mousedown", (p) => {
372
- p.preventDefault(), p.stopPropagation(), p.stopImmediatePropagation(), r = !0, a = p.clientX, l = t.offsetWidth, t.style.borderRight = "2px solid var(--primary-main, #2196F3)", t.style.background = "var(--background-active, rgba(255, 255, 255, 0.1))", document.addEventListener("mousemove", c), document.addEventListener("mouseup", u), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
372
+ p.preventDefault(), p.stopPropagation(), p.stopImmediatePropagation(), r = !0, a = p.clientX, l = e.offsetWidth, e.style.borderRight = "2px solid var(--primary-main, #2196F3)", e.style.background = "var(--background-active, rgba(255, 255, 255, 0.1))", document.addEventListener("mousemove", c), document.addEventListener("mouseup", u), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
373
373
  });
374
374
  const c = /* @__PURE__ */ d((p) => {
375
375
  if (!r) return;
376
376
  const h = l + (p.clientX - a);
377
377
  if (h > 30) {
378
- t.style.width = h + "px";
379
- const f = Array.from(t.parentNode.children).indexOf(t), g = e.querySelector("tbody");
378
+ e.style.width = h + "px";
379
+ const f = Array.from(e.parentNode.children).indexOf(e), g = t.querySelector("tbody");
380
380
  g && g.querySelectorAll("tr").forEach((y) => {
381
381
  const b = y.children[f];
382
382
  b && (b.style.width = h + "px");
383
- }), this.updateTableWidth(e);
383
+ }), this.updateTableWidth(t);
384
384
  }
385
385
  }, "handleResize"), u = /* @__PURE__ */ d(() => {
386
- r = !1, t.style.borderRight = "", t.style.background = "", document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", u), document.body.style.cursor = "", document.body.style.userSelect = "";
386
+ r = !1, e.style.borderRight = "", e.style.background = "", document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", u), document.body.style.cursor = "", document.body.style.userSelect = "";
387
387
  }, "stopResize");
388
388
  }
389
389
  /**
390
390
  * Add drag and drop functionality to a header
391
391
  */
392
- addDragAndDrop(t, e, s, n) {
393
- if (t.querySelector(".drag-handle"))
392
+ addDragAndDrop(e, t, s, n) {
393
+ if (e.querySelector(".drag-handle"))
394
394
  return;
395
- t.classList.add(this.options.draggableClass), t.draggable = !0;
396
- const i = e.querySelector("thead tr");
397
- t.addEventListener("dragstart", (r) => {
395
+ e.classList.add(this.options.draggableClass), e.draggable = !0;
396
+ const i = t.querySelector("thead tr");
397
+ e.addEventListener("dragstart", (r) => {
398
398
  this.isDragging = !0;
399
- const a = Array.from(i.children).indexOf(t);
400
- this.dragSource = { table: e, tableIndex: s, columnIndex: a }, r.dataTransfer.effectAllowed = "move", r.dataTransfer.setData("text/html", t.outerHTML);
401
- const l = t.outerHTML;
402
- t.style.opacity = "0.5", this.createCustomDragImage(r, t, l);
403
- }), t.addEventListener("dragend", (r) => {
404
- this.isDragging = !1, this.dragSource = null, t.style.opacity = "", this.clearAllColumnHighlights(e);
405
- }), t.addEventListener("dragover", (r) => {
399
+ const a = Array.from(i.children).indexOf(e);
400
+ this.dragSource = { table: t, tableIndex: s, columnIndex: a }, r.dataTransfer.effectAllowed = "move", r.dataTransfer.setData("text/html", e.outerHTML);
401
+ const l = e.outerHTML;
402
+ e.style.opacity = "0.5", this.createCustomDragImage(r, e, l);
403
+ }), e.addEventListener("dragend", (r) => {
404
+ this.isDragging = !1, this.dragSource = null, e.style.opacity = "", this.clearAllColumnHighlights(t);
405
+ }), e.addEventListener("dragover", (r) => {
406
406
  r.preventDefault(), r.dataTransfer.dropEffect = "move";
407
- }), t.addEventListener("dragenter", (r) => {
407
+ }), e.addEventListener("dragenter", (r) => {
408
408
  if (r.preventDefault(), this.dragSource && this.dragSource.tableIndex === s) {
409
- const a = Array.from(i.children).indexOf(t);
410
- this.dragSource.columnIndex !== a && this.highlightColumn(e, a, !0);
409
+ const a = Array.from(i.children).indexOf(e);
410
+ this.dragSource.columnIndex !== a && this.highlightColumn(t, a, !0);
411
411
  }
412
- }), t.addEventListener("dragleave", (r) => {
413
- if (!t.contains(r.relatedTarget)) {
414
- const a = Array.from(i.children).indexOf(t);
415
- this.highlightColumn(e, a, !1);
412
+ }), e.addEventListener("dragleave", (r) => {
413
+ if (!e.contains(r.relatedTarget)) {
414
+ const a = Array.from(i.children).indexOf(e);
415
+ this.highlightColumn(t, a, !1);
416
416
  }
417
- }), t.addEventListener("drop", (r) => {
417
+ }), e.addEventListener("drop", (r) => {
418
418
  if (r.preventDefault(), this.dragSource && this.dragSource.tableIndex === s) {
419
- const a = Array.from(i.children).indexOf(t);
420
- this.dragSource.columnIndex !== a && this.reorderColumns(e, s, this.dragSource.columnIndex, a);
419
+ const a = Array.from(i.children).indexOf(e);
420
+ this.dragSource.columnIndex !== a && this.reorderColumns(t, s, this.dragSource.columnIndex, a);
421
421
  }
422
- this.clearAllColumnHighlights(e);
422
+ this.clearAllColumnHighlights(t);
423
423
  });
424
424
  }
425
425
  /**
426
426
  * Create a custom drag image for better UX
427
427
  */
428
- createCustomDragImage(t, e, s) {
428
+ createCustomDragImage(e, t, s) {
429
429
  const n = document.createElement("div");
430
430
  n.style.cssText = `
431
431
  position: absolute;
@@ -456,30 +456,30 @@ const L = /* @__PURE__ */ new Set(), v = class v {
456
456
  <span style="overflow: hidden; text-overflow: ellipsis">${i}</span>
457
457
  <svg style="fill: grey; font-size: 10px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 20 20" ><defs><path id="a" d="M0 0h24v24H0V0z"/></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" d="M9.01 14H2v2h7.01v3L13 15l-3.99-4v3zm5.98-1v-3H22V8h-7.01V5L11 9l3.99 4z"/></svg>
458
458
  </div>
459
- `, document.body.appendChild(n), t.dataTransfer.setDragImage(n, 50, 12), setTimeout(() => {
459
+ `, document.body.appendChild(n), e.dataTransfer.setDragImage(n, 50, 12), setTimeout(() => {
460
460
  document.body.contains(n) && document.body.removeChild(n);
461
461
  }, 100);
462
462
  }
463
463
  /**
464
464
  * Highlight an entire column during drag operations
465
465
  */
466
- highlightColumn(t, e, s) {
467
- const n = t.querySelector("thead tr"), i = t.querySelector("tbody");
466
+ highlightColumn(e, t, s) {
467
+ const n = e.querySelector("thead tr"), i = e.querySelector("tbody");
468
468
  if (!n || !i) return;
469
- const r = n.children[e];
469
+ const r = n.children[t];
470
470
  if (r)
471
471
  if (s) {
472
472
  r.classList.add(this.options.dragOverClass);
473
473
  const a = i.children;
474
474
  for (let l = 0; l < a.length; l++) {
475
- const c = a[l].children[e];
475
+ const c = a[l].children[t];
476
476
  c && c.classList.add(this.options.dragOverClass);
477
477
  }
478
478
  } else {
479
479
  r.classList.remove(this.options.dragOverClass);
480
480
  const a = i.children;
481
481
  for (let l = 0; l < a.length; l++) {
482
- const c = a[l].children[e];
482
+ const c = a[l].children[t];
483
483
  c && c.classList.remove(this.options.dragOverClass);
484
484
  }
485
485
  }
@@ -487,10 +487,10 @@ const L = /* @__PURE__ */ new Set(), v = class v {
487
487
  /**
488
488
  * Clear all column highlights
489
489
  */
490
- clearAllColumnHighlights(t) {
491
- const e = t.querySelector("thead tr"), s = t.querySelector("tbody");
492
- if (!e || !s) return;
493
- const n = e.children;
490
+ clearAllColumnHighlights(e) {
491
+ const t = e.querySelector("thead tr"), s = e.querySelector("tbody");
492
+ if (!t || !s) return;
493
+ const n = t.children;
494
494
  for (let r = 0; r < n.length; r++)
495
495
  n[r].classList.remove(this.options.dragOverClass);
496
496
  const i = s.children;
@@ -503,8 +503,8 @@ const L = /* @__PURE__ */ new Set(), v = class v {
503
503
  /**
504
504
  * Reorder columns in a table
505
505
  */
506
- reorderColumns(t, e, s, n) {
507
- const i = t.querySelector("thead tr"), r = t.querySelector("tbody");
506
+ reorderColumns(e, t, s, n) {
507
+ const i = e.querySelector("thead tr"), r = e.querySelector("tbody");
508
508
  if (!i || !r) return;
509
509
  const a = Array.from(i.children), l = Array.from(r.children);
510
510
  if (s < 0 || s >= a.length || n < 0 || n >= a.length) {
@@ -518,34 +518,34 @@ const L = /* @__PURE__ */ new Set(), v = class v {
518
518
  const g = Array.from(h.children), m = g[s], y = g[n];
519
519
  s < n ? h.insertBefore(m, y.nextSibling) : h.insertBefore(m, y);
520
520
  });
521
- const p = this.originalColumnOrder.get(e);
521
+ const p = this.originalColumnOrder.get(t);
522
522
  if (p) {
523
523
  const h = [...p], f = h[s];
524
- h.splice(s, 1), h.splice(n, 0, f), this.originalColumnOrder.set(e, h);
524
+ h.splice(s, 1), h.splice(n, 0, f), this.originalColumnOrder.set(t, h);
525
525
  }
526
- this.applyTableStyles(t), this.refreshDragAndDropListeners(t, e);
526
+ this.applyTableStyles(e), this.refreshDragAndDropListeners(e, t);
527
527
  }
528
528
  /**
529
529
  * Refresh drag and drop listeners after column reordering
530
530
  */
531
- refreshDragAndDropListeners(t, e) {
532
- const s = t.querySelector("thead tr");
531
+ refreshDragAndDropListeners(e, t) {
532
+ const s = e.querySelector("thead tr");
533
533
  if (!s) return;
534
534
  Array.from(s.children).forEach((i, r) => {
535
535
  if (i.classList.contains(this.options.draggableClass)) {
536
536
  i.style.opacity = "", i.style.background = "", i.style.borderRight = "";
537
537
  const a = i.cloneNode(!0);
538
- i.parentNode.replaceChild(a, i), this.makeHeaderSortable(a, t, e, r);
538
+ i.parentNode.replaceChild(a, i), this.makeHeaderSortable(a, e, t, r);
539
539
  }
540
540
  });
541
541
  }
542
542
  /**
543
543
  * Update table width based on current column widths
544
544
  */
545
- updateTableWidth(t) {
546
- const e = t.querySelectorAll("th");
545
+ updateTableWidth(e) {
546
+ const t = e.querySelectorAll("th");
547
547
  let s = 0;
548
- e.forEach((n) => {
548
+ t.forEach((n) => {
549
549
  const i = n.style.width;
550
550
  if (i) {
551
551
  const r = parseInt(i.replace("px", ""));
@@ -554,22 +554,22 @@ const L = /* @__PURE__ */ new Set(), v = class v {
554
554
  const r = n.textContent.replace(/[📊🔍]/g, "").trim();
555
555
  s += r.length;
556
556
  }
557
- }), t.style.width = `${s}px`;
557
+ }), e.style.width = `${s}px`;
558
558
  }
559
559
  /**
560
560
  * Calculate intelligent table width based on header text length
561
561
  */
562
- calculateTableWidth(t) {
562
+ calculateTableWidth(e) {
563
563
  var p;
564
- const e = t.getAttribute("data-original-width"), s = e ? parseFloat(e) : 0, n = t.querySelectorAll("th");
564
+ const t = e.getAttribute("data-original-width"), s = t ? parseFloat(t) : 0, n = e.querySelectorAll("th");
565
565
  let i = 0;
566
- t.parentElement.clientWidth;
566
+ e.parentElement.clientWidth;
567
567
  const r = [];
568
568
  n.forEach((h) => {
569
569
  let g = h.textContent.replace(/[📊🔍]/g, "").trim().length * this.charWidth + 15;
570
570
  r.push(g), i += g;
571
571
  });
572
- const a = t.querySelectorAll("tr"), l = ((p = t.parentElement) == null ? void 0 : p.getBoundingClientRect().width) ?? i;
572
+ const a = e.querySelectorAll("tr"), l = ((p = e.parentElement) == null ? void 0 : p.getBoundingClientRect().width) ?? i;
573
573
  var c = 0;
574
574
  for (const h of a)
575
575
  h.querySelectorAll("td").forEach((g, m) => {
@@ -589,15 +589,15 @@ const L = /* @__PURE__ */ new Set(), v = class v {
589
589
  /**
590
590
  * Apply inline styles to ensure text clipping and horizontal scroll work
591
591
  */
592
- applyTableStyles(t) {
593
- const e = this.calculateTableWidth(t);
594
- t.style.width = e, t.style.maxWidth = "100%";
592
+ applyTableStyles(e) {
593
+ const t = this.calculateTableWidth(e);
594
+ e.style.width = t, e.style.maxWidth = "100%";
595
595
  }
596
596
  // Signature matches the single call site — `init()` passes (fontFamily,
597
597
  // fontMono), which used to land on a leading `char` parameter nothing read.
598
- getCharWidth(t, e) {
598
+ getCharWidth(e, t) {
599
599
  const s = document.createElement("canvas").getContext("2d");
600
- return s ? (s.fontFamily = t, s.fontMono = e, s.measureText("A ").width) : v.DEFAULT_CHAR_WIDTH;
600
+ return s ? (s.fontFamily = e, s.fontMono = t, s.measureText("A ").width) : v.DEFAULT_CHAR_WIDTH;
601
601
  }
602
602
  /**
603
603
  * Add CSS styles for sortable tables
@@ -605,8 +605,8 @@ const L = /* @__PURE__ */ new Set(), v = class v {
605
605
  addStyles() {
606
606
  if (document.getElementById("sortable-table-styles"))
607
607
  return;
608
- const t = document.createElement("style");
609
- t.id = "sortable-table-styles", t.textContent = `
608
+ const e = document.createElement("style");
609
+ e.id = "sortable-table-styles", e.textContent = `
610
610
  .${this.options.sortableClass} {
611
611
  position: relative;
612
612
  user-select: none;
@@ -732,14 +732,14 @@ const L = /* @__PURE__ */ new Set(), v = class v {
732
732
  overflow-x: auto !important;
733
733
  overflow-y: auto !important;
734
734
  }
735
- `, document.getElementById("sortable-table-styles") || document.head.appendChild(t);
735
+ `, document.getElementById("sortable-table-styles") || document.head.appendChild(e);
736
736
  }
737
737
  /**
738
738
  * Destroy the sortable functionality
739
739
  */
740
740
  destroy() {
741
- this.tables.forEach((e) => {
742
- e.querySelectorAll(`.${this.options.sortableClass}`).forEach((n) => {
741
+ this.tables.forEach((t) => {
742
+ t.querySelectorAll(`.${this.options.sortableClass}`).forEach((n) => {
743
743
  n.classList.remove(
744
744
  this.options.sortableClass,
745
745
  this.options.activeSortClass,
@@ -750,8 +750,8 @@ const L = /* @__PURE__ */ new Set(), v = class v {
750
750
  n.parentNode.replaceChild(i, n);
751
751
  });
752
752
  });
753
- const t = document.getElementById("sortable-table-styles");
754
- t && t.remove(), this.tables = [], this.sortStates.clear(), L.clear();
753
+ const e = document.getElementById("sortable-table-styles");
754
+ e && e.remove(), this.tables = [], this.sortStates.clear(), L.clear();
755
755
  }
756
756
  /**
757
757
  * Refresh the library (useful after DOM changes)
@@ -764,10 +764,10 @@ d(v, "SortableTable"), /** Fallback advance width, in px, for one character of t
764
764
  E(v, "DEFAULT_CHAR_WIDTH", 8);
765
765
  let C = v;
766
766
  typeof window < "u" && (window.SortableTable = C);
767
- const T = /* @__PURE__ */ new Set(["/", "@", "#"]), O = /* @__PURE__ */ d((o) => o === "/" ? "slash" : o === "@" ? "at" : "hash", "triggerTypeFor"), S = /[ \t\r\n\f\v]/, R = /\[[^\]\n]+\]/g, A = /* @__PURE__ */ d((o, t, e) => {
767
+ const T = /* @__PURE__ */ new Set(["/", "@", "#"]), O = /* @__PURE__ */ d((o) => o === "/" ? "slash" : o === "@" ? "at" : "hash", "triggerTypeFor"), S = /[ \t\r\n\f\v]/, R = /\[[^\]\n]+\]/g, A = /* @__PURE__ */ d((o, e, t) => {
768
768
  let s = 0;
769
769
  const n = /* @__PURE__ */ d((i) => {
770
- const r = i === 0 ? t : o[i - 1];
770
+ const r = i === 0 ? e : o[i - 1];
771
771
  return r === void 0 || S.test(r);
772
772
  }, "boundaryBefore");
773
773
  for (; s < o.length; ) {
@@ -775,7 +775,7 @@ const T = /* @__PURE__ */ new Set(["/", "@", "#"]), O = /* @__PURE__ */ d((o) =>
775
775
  if (n(s) && T.has(i)) {
776
776
  let r = s + 1;
777
777
  for (; r < o.length && !S.test(o[r]); ) r += 1;
778
- e.push({ type: O(i), text: o.slice(s, r) }), s = r;
778
+ t.push({ type: O(i), text: o.slice(s, r) }), s = r;
779
779
  } else {
780
780
  let r = s + 1;
781
781
  for (; r < o.length; ) {
@@ -783,19 +783,19 @@ const T = /* @__PURE__ */ new Set(["/", "@", "#"]), O = /* @__PURE__ */ d((o) =>
783
783
  if (T.has(a) && S.test(o[r - 1])) break;
784
784
  r += 1;
785
785
  }
786
- e.push({ type: "plain", text: o.slice(s, r) }), s = r;
786
+ t.push({ type: "plain", text: o.slice(s, r) }), s = r;
787
787
  }
788
788
  }
789
789
  }, "tokenizeSegment"), X = /* @__PURE__ */ d((o) => {
790
790
  if (!o) return [];
791
- const t = [], e = new RegExp(R.source, "g");
791
+ const e = [], t = new RegExp(R.source, "g");
792
792
  let s = 0;
793
- for (let n = e.exec(o); n; n = e.exec(o))
794
- n.index > s && A(o.slice(s, n.index), s === 0 ? void 0 : o[s - 1], t), t.push({ type: "placeholder", text: n[0] }), s = n.index + n[0].length;
795
- return s < o.length && A(o.slice(s), s === 0 ? void 0 : o[s - 1], t), t;
796
- }, "tokenizeForHighlight"), G = /* @__PURE__ */ d((o, t) => {
797
- const e = t.filter((n) => n.trim().length > 0).sort((n, i) => i.length - n.length);
798
- if (e.length === 0) return o;
793
+ for (let n = t.exec(o); n; n = t.exec(o))
794
+ n.index > s && A(o.slice(s, n.index), s === 0 ? void 0 : o[s - 1], e), e.push({ type: "placeholder", text: n[0] }), s = n.index + n[0].length;
795
+ return s < o.length && A(o.slice(s), s === 0 ? void 0 : o[s - 1], e), e;
796
+ }, "tokenizeForHighlight"), G = /* @__PURE__ */ d((o, e) => {
797
+ const t = e.filter((n) => n.trim().length > 0).sort((n, i) => i.length - n.length);
798
+ if (t.length === 0) return o;
799
799
  const s = [];
800
800
  for (const n of o) {
801
801
  if (n.type !== "plain") {
@@ -805,7 +805,7 @@ const T = /* @__PURE__ */ new Set(["/", "@", "#"]), O = /* @__PURE__ */ d((o) =>
805
805
  let i = n.text;
806
806
  for (; i.length > 0; ) {
807
807
  let r = -1, a = 0;
808
- for (const l of e) {
808
+ for (const l of t) {
809
809
  const c = i.indexOf(l);
810
810
  c >= 0 && (r === -1 || c < r) && (r = c, a = l.length);
811
811
  }
@@ -818,7 +818,7 @@ const T = /* @__PURE__ */ new Set(["/", "@", "#"]), O = /* @__PURE__ */ d((o) =>
818
818
  }
819
819
  return s;
820
820
  }, "chipLocations");
821
- function j(o, t, e = t, s = 600) {
821
+ function j(o, e, t = e, s = 600) {
822
822
  const n = o.value;
823
823
  let i = !1;
824
824
  const r = /* @__PURE__ */ d(() => {
@@ -828,7 +828,7 @@ function j(o, t, e = t, s = 600) {
828
828
  r();
829
829
  return;
830
830
  }
831
- o.selectionStart === t && o.selectionEnd === e || o.setSelectionRange(t, e);
831
+ o.selectionStart === e && o.selectionEnd === t || o.setSelectionRange(e, t);
832
832
  }, "apply"), l = /* @__PURE__ */ d(() => {
833
833
  document.activeElement === o && a();
834
834
  }, "onSelectionChange");
@@ -840,28 +840,28 @@ d(j, "placeCaret");
840
840
  function K() {
841
841
  if (typeof document > "u") return;
842
842
  const o = /* @__PURE__ */ d((s) => {
843
- s.stopPropagation(), s.preventDefault(), t();
844
- }, "onClick"), t = /* @__PURE__ */ d(() => {
845
- document.removeEventListener("click", o, !0), window.clearTimeout(e);
846
- }, "cleanup"), e = window.setTimeout(t, 500);
843
+ s.stopPropagation(), s.preventDefault(), e();
844
+ }, "onClick"), e = /* @__PURE__ */ d(() => {
845
+ document.removeEventListener("click", o, !0), window.clearTimeout(t);
846
+ }, "cleanup"), t = window.setTimeout(e, 500);
847
847
  document.addEventListener("click", o, !0);
848
848
  }
849
849
  d(K, "swallowNextClick");
850
850
  const H = 2;
851
- function Z(o, t) {
852
- let e = 0;
853
- for (let s = t - 1; s >= 0; s -= 1) {
851
+ function Z(o, e) {
852
+ let t = 0;
853
+ for (let s = e - 1; s >= 0; s -= 1) {
854
854
  const n = o[s];
855
855
  if (n === "/" || n === "@" || n === "#")
856
- return !(s === 0 || /\s/.test(o[s - 1])) || n !== "@" && e > 0 ? null : {
856
+ return !(s === 0 || /\s/.test(o[s - 1])) || n !== "@" && t > 0 ? null : {
857
857
  trigger: n,
858
- query: o.slice(s + 1, t),
858
+ query: o.slice(s + 1, e),
859
859
  startIdx: s,
860
- endIdx: t
860
+ endIdx: e
861
861
  };
862
862
  if (n === " ") return null;
863
863
  if (n === " " || n === " ") {
864
- if (e += 1, e > H) return null;
864
+ if (t += 1, t > H) return null;
865
865
  continue;
866
866
  }
867
867
  if (/\s/.test(n)) return null;
@@ -870,10 +870,10 @@ function Z(o, t) {
870
870
  }
871
871
  d(Z, "detectTrigger");
872
872
  const _ = /\[[^\]\n]+\]/g;
873
- function w(o, t = 0) {
874
- const e = new RegExp(_.source, "g");
875
- e.lastIndex = t;
876
- const s = e.exec(o);
873
+ function w(o, e = 0) {
874
+ const t = new RegExp(_.source, "g");
875
+ t.lastIndex = e;
876
+ const s = t.exec(o);
877
877
  if (!s) return null;
878
878
  const n = s[0].slice(1, -1), i = n[0], r = i === "@" || i === "#" || i === "/";
879
879
  return {
@@ -884,32 +884,32 @@ function w(o, t = 0) {
884
884
  };
885
885
  }
886
886
  d(w, "findPlaceholder");
887
- function J(o, t) {
888
- for (let e = 0; ; ) {
889
- const s = w(o, e);
890
- if (!s || s.startIdx > t) return null;
891
- if (t <= s.endIdx) return s;
892
- e = s.endIdx;
887
+ function J(o, e) {
888
+ for (let t = 0; ; ) {
889
+ const s = w(o, t);
890
+ if (!s || s.startIdx > e) return null;
891
+ if (e <= s.endIdx) return s;
892
+ t = s.endIdx;
893
893
  }
894
894
  }
895
895
  d(J, "placeholderAt");
896
- function k(o, t) {
897
- if (t.trigger) {
898
- const e = o.slice(0, t.startIdx) + t.trigger + o.slice(t.endIdx), s = t.startIdx + 1;
899
- return { next: e, selectionStart: s, selectionEnd: s, reopenTrigger: !0 };
896
+ function k(o, e) {
897
+ if (e.trigger) {
898
+ const t = o.slice(0, e.startIdx) + e.trigger + o.slice(e.endIdx), s = e.startIdx + 1;
899
+ return { next: t, selectionStart: s, selectionEnd: s, reopenTrigger: !0 };
900
900
  }
901
- return { next: o, selectionStart: t.startIdx, selectionEnd: t.endIdx, reopenTrigger: !1 };
901
+ return { next: o, selectionStart: e.startIdx, selectionEnd: e.endIdx, reopenTrigger: !1 };
902
902
  }
903
903
  d(k, "activatePlaceholder");
904
- function Y(o, t) {
905
- const e = w(o, t) ?? w(o, 0);
906
- return e ? k(o, e) : null;
904
+ function Y(o, e) {
905
+ const t = w(o, e) ?? w(o, 0);
906
+ return t ? k(o, t) : null;
907
907
  }
908
908
  d(Y, "advanceToPlaceholder");
909
- function Q(o, t, e) {
910
- const s = o.slice(0, t.startIdx), n = o.slice(t.endIdx), i = w(e);
909
+ function Q(o, e, t) {
910
+ const s = o.slice(0, e.startIdx), n = o.slice(e.endIdx), i = w(t);
911
911
  if (i) {
912
- const c = k(e, i);
912
+ const c = k(t, i);
913
913
  return {
914
914
  next: `${s}${c.next}${n}`,
915
915
  selectionStart: s.length + c.selectionStart,
@@ -917,16 +917,16 @@ function Q(o, t, e) {
917
917
  reopenTrigger: c.reopenTrigger
918
918
  };
919
919
  }
920
- const r = e[e.length - 1];
920
+ const r = t[t.length - 1];
921
921
  if (r === "@" || r === "#" || r === "/") {
922
- const c = s.length + e.length;
923
- return { next: `${s}${e}${n}`, selectionStart: c, selectionEnd: c, reopenTrigger: !0 };
922
+ const c = s.length + t.length;
923
+ return { next: `${s}${t}${n}`, selectionStart: c, selectionEnd: c, reopenTrigger: !0 };
924
924
  }
925
- const a = `${e} `, l = s.length + a.length;
925
+ const a = `${t} `, l = s.length + a.length;
926
926
  return { next: `${s}${a}${n}`, selectionStart: l, selectionEnd: l, reopenTrigger: !1 };
927
927
  }
928
928
  d(Q, "applyTriggerInsertion");
929
- async function tt(o, { onAtQuery: t, onAtPersonQuery: e }, {
929
+ async function ee(o, { onAtQuery: e, onAtPersonQuery: t }, {
930
930
  personConfidence: s = 0,
931
931
  locationConfidence: n = 0,
932
932
  personFirstThreshold: i = 0.5,
@@ -935,42 +935,57 @@ async function tt(o, { onAtQuery: t, onAtPersonQuery: e }, {
935
935
  hotelNameConfidence: l = 0
936
936
  } = {}) {
937
937
  const [c, u] = await Promise.all([
938
- t ? t(o, { vertical: r, hotelConfidence: a, hotelNameConfidence: l }).catch(() => []) : Promise.resolve([]),
939
- e ? e(o).catch(() => []) : Promise.resolve([])
938
+ e ? e(o, { vertical: r, hotelConfidence: a, hotelNameConfidence: l }).catch(() => []) : Promise.resolve([]),
939
+ t ? t(o).catch(() => []) : Promise.resolve([])
940
940
  ]), p = u.map((h) => h.kind ? h : { ...h, kind: "person" });
941
- if (t && e) {
941
+ if (e && t) {
942
942
  const h = p.map((m) => ({ ...m, group: "person" })), f = c.map((m) => ({ ...m, group: m.kind === "hotel" ? "hotel" : "location" }));
943
943
  return s >= i && s >= n ? [...h, ...f] : [...f, ...h];
944
944
  }
945
945
  return [...p, ...c];
946
946
  }
947
- d(tt, "fetchAtMentions");
948
- function et(o, t) {
947
+ d(ee, "fetchAtMentions");
948
+ function te(o, e) {
949
949
  var s, n;
950
- const e = (s = o[t]) == null ? void 0 : s.group;
951
- return e !== void 0 && (t === 0 || ((n = o[t - 1]) == null ? void 0 : n.group) !== e);
950
+ const t = (s = o[e]) == null ? void 0 : s.group;
951
+ return t !== void 0 && (e === 0 || ((n = o[e - 1]) == null ? void 0 : n.group) !== t);
952
952
  }
953
- d(et, "isSectionStart");
953
+ d(te, "isSectionStart");
954
+ function se(o) {
955
+ return (o ?? []).map((e) => ({
956
+ id: e.key,
957
+ label: e.label,
958
+ value: e.insert ?? e.label,
959
+ hint: e.hint,
960
+ kind: e.icon,
961
+ section: e.section,
962
+ disabled: e.disabled,
963
+ disabledNote: e.disabled ? "igual à origem" : void 0,
964
+ pred: e
965
+ }));
966
+ }
967
+ d(se, "toPredictionRows");
954
968
  export {
955
969
  C as S,
956
970
  k as a,
957
971
  Y as b,
958
972
  Q as c,
959
973
  G as d,
960
- I as e,
974
+ D as e,
961
975
  Z as f,
962
976
  M as g,
963
977
  F as h,
964
- tt as i,
978
+ ee as i,
965
979
  w as j,
966
- et as k,
980
+ te as k,
967
981
  U as l,
968
982
  J as m,
969
983
  V as n,
970
984
  P as o,
971
985
  j as p,
972
986
  K as q,
987
+ X as r,
973
988
  B as s,
974
- X as t
989
+ se as t
975
990
  };
976
- //# sourceMappingURL=atMentions-uRBrCgLL.js.map
991
+ //# sourceMappingURL=predictionRows-CkZdmdsi.js.map