@aintela/chat 0.4.9 → 0.4.10

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,80 +1,79 @@
1
1
  var x = Object.defineProperty;
2
- var $ = (n, t, e) => t in n ? x(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var d = (n, t) => x(n, "name", { value: t, configurable: !0 });
4
- var E = (n, t, e) => $(n, typeof t != "symbol" ? t + "" : t, e);
5
- const F = /* @__PURE__ */ d((n, t, e) => {
6
- let s = "URL", o = null, i = null, r = null;
7
- if (n[0] == "#") {
8
- const a = n.indexOf("-"), l = n.slice(1, a);
9
- switch (r = n.slice(a + 1), l.toLowerCase()) {
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) => {
6
+ let s = "URL", n = null, i = null, r = null;
7
+ if (o[0] == "#") {
8
+ const a = o.indexOf("-"), l = o.slice(1, a);
9
+ switch (r = o.slice(a + 1), l.toLowerCase()) {
10
10
  case "opendashboard":
11
11
  s = "OpenDashboard";
12
12
  break;
13
13
  case "ask":
14
- s = "Question", o = e;
14
+ s = "Question", n = e;
15
15
  break;
16
16
  }
17
- } else
18
- n.indexOf("http") > -1 ? (s = "URL", i = n) : (n = n.replaceAll("exported/", `exported/${t}/`), s = "Export");
19
- return { action: s, url: i, question: o, parameter: r };
20
- }, "extractLinkAction"), D = /* @__PURE__ */ d((n, t) => Array.from(
21
- { length: Math.ceil(n.length / t) },
22
- (e, s) => n.slice(s * t, s * t + t)
23
- ), "chunkArray"), z = /* @__PURE__ */ d((n) => {
24
- n = n.replaceAll("\\n", `
17
+ } else D.test(o) ? (s = "URL", i = o) : o[0] === "/" ? (s = "Navigate", i = o) : (o = o.replaceAll("exported/", `exported/${t}/`), s = "Export");
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)
22
+ ), "chunkArray"), B = /* @__PURE__ */ d((o) => {
23
+ o = o.replaceAll("\\n", `
25
24
  `);
26
- const t = 90, e = n.split(" "), s = [];
27
- let o = !1;
25
+ const t = 90, e = o.split(" "), s = [];
26
+ let n = !1;
28
27
  for (const i of e)
29
28
  if (i.length > t) {
30
- o = !0;
31
- const r = [...i], l = D(r, t).map((c) => c.join("")).join(`
29
+ n = !0;
30
+ const r = [...i], l = I(r, t).map((c) => c.join("")).join(`
32
31
  `);
33
32
  s.push(l);
34
33
  } else
35
34
  s.push(i);
36
- return o ? s.join(" ") : n;
35
+ return n ? s.join(" ") : o;
37
36
  }, "splitBigLinesWithSpaces");
38
- function I(n) {
39
- let t = parseFloat(n);
37
+ function N(o) {
38
+ let t = parseFloat(o);
40
39
  if (!isNaN(t))
41
- return n = n.replaceAll(/[,\.]/g, ""), parseInt(n);
40
+ return o = o.replaceAll(/[,\.]/g, ""), parseInt(o);
42
41
  var e = "";
43
- for (const o of n)
44
- o.match(/[0-9]/) && (e += o);
45
- const s = e.length / n.length;
42
+ for (const n of o)
43
+ n.match(/[0-9]/) && (e += n);
44
+ const s = e.length / o.length;
46
45
  return t = parseInt(e), !isNaN(t) && s > 0.5 ? t : NaN;
47
46
  }
48
- d(I, "parseRawNumber");
49
- const N = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i, W = /^[0-9a-f]{32}/i;
50
- function B(n) {
51
- if (!n || typeof n != "string")
47
+ d(N, "parseRawNumber");
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
+ function P(o) {
50
+ if (!o || typeof o != "string")
52
51
  return !1;
53
- const t = q(n);
54
- return t === null ? !1 : n.startsWith(t);
52
+ const t = M(o);
53
+ return t === null ? !1 : o.startsWith(t);
55
54
  }
56
- d(B, "startsWithInteractionId");
57
- function q(n) {
58
- if (!n || typeof n != "string")
55
+ d(P, "startsWithInteractionId");
56
+ function M(o) {
57
+ if (!o || typeof o != "string")
59
58
  return null;
60
- const t = n.match(N);
59
+ const t = o.match(W);
61
60
  if (t)
62
61
  return t[0];
63
- const e = n.match(W);
62
+ const e = o.match(q);
64
63
  return e ? e[0] : null;
65
64
  }
66
- d(q, "extractInteractionId");
67
- function P(n) {
68
- if (n.length == 0)
69
- return n;
70
- const t = n.replaceAll("_", " ").replaceAll("-", " ");
65
+ d(M, "extractInteractionId");
66
+ function V(o) {
67
+ if (o.length == 0)
68
+ return o;
69
+ const t = o.replaceAll("_", " ").replaceAll("-", " ");
71
70
  return t[0].toUpperCase() + t.slice(1);
72
71
  }
73
- d(P, "prettiffyPythonFunctionName");
74
- function V(n) {
75
- return !n || typeof n != "string" ? !1 : !!(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n) || /^[0-9a-f]{32}$/i.test(n));
72
+ d(V, "prettiffyPythonFunctionName");
73
+ function U(o) {
74
+ return !o || typeof o != "string" ? !1 : !!(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(o) || /^[0-9a-f]{32}$/i.test(o));
76
75
  }
77
- d(V, "isValidInteractionId");
76
+ d(U, "isValidInteractionId");
78
77
  const L = /* @__PURE__ */ new Set(), v = class v {
79
78
  constructor(t = {}) {
80
79
  this.options = {
@@ -173,8 +172,8 @@ const L = /* @__PURE__ */ new Set(), v = class v {
173
172
  * Make a specific table sortable
174
173
  */
175
174
  makeTableSortable(t, e) {
176
- let s = t.querySelector("thead"), o = null, i = [];
177
- if (s && (o = s.querySelector("tr"), o && (i = o.querySelectorAll("th"))), i.length === 0) {
175
+ let s = t.querySelector("thead"), n = null, i = [];
176
+ if (s && (n = s.querySelector("tr"), n && (i = n.querySelectorAll("th"))), i.length === 0) {
178
177
  console.warn("Table has no sortable columns, skipping");
179
178
  return;
180
179
  }
@@ -195,8 +194,8 @@ const L = /* @__PURE__ */ new Set(), v = class v {
195
194
  replaceExponentialValues(t) {
196
195
  const e = t.querySelector("tbody");
197
196
  if (!e) return;
198
- e.querySelectorAll("tr").forEach((o) => {
199
- o.querySelectorAll("td, th").forEach((r) => {
197
+ e.querySelectorAll("tr").forEach((n) => {
198
+ n.querySelectorAll("td, th").forEach((r) => {
200
199
  const l = r.textContent.trim().match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
201
200
  if (l) {
202
201
  const c = parseFloat(l[1].replace(/,/g, "")), u = parseInt(l[2]), p = c * Math.pow(10, u), h = this.formatNumber(p);
@@ -222,24 +221,24 @@ const L = /* @__PURE__ */ new Set(), v = class v {
222
221
  */
223
222
  convertRowToHeader(t, e, s) {
224
223
  try {
225
- const o = t.cloneNode(!0);
226
- return o.querySelectorAll("td").forEach((r) => {
224
+ const n = t.cloneNode(!0);
225
+ return n.querySelectorAll("td").forEach((r) => {
227
226
  const a = document.createElement("th");
228
227
  Array.from(r.attributes).forEach((l) => {
229
228
  a.setAttribute(l.name, l.value);
230
229
  }), a.innerHTML = r.innerHTML, a.style.cssText = r.style.cssText, r.parentNode.replaceChild(a, r);
231
- }), s && s.contains(t) ? s.removeChild(t) : t.parentNode && t.parentNode.removeChild(t), e.appendChild(o), o;
232
- } catch (o) {
233
- return console.error("Error converting row to header:", o), null;
230
+ }), s && s.contains(t) ? s.removeChild(t) : t.parentNode && t.parentNode.removeChild(t), e.appendChild(n), n;
231
+ } catch (n) {
232
+ return console.error("Error converting row to header:", n), null;
234
233
  }
235
234
  }
236
235
  /**
237
236
  * Make a specific header sortable
238
237
  */
239
- makeHeaderSortable(t, e, s, o) {
240
- 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, o), this.options.enableReordering && this.addDragAndDrop(t, e, s, o);
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);
241
240
  const i = /* @__PURE__ */ d((l) => {
242
- l.preventDefault(), this.sortTable(e, s, o);
241
+ l.preventDefault(), this.sortTable(e, s, n);
243
242
  }, "clickListener"), r = /* @__PURE__ */ d((l) => {
244
243
  t.classList.contains(this.options.activeSortClass) || (t.style.background = this.options.theme.palette.surface.hover);
245
244
  }, "mouseEnterListener"), a = /* @__PURE__ */ d((l) => {
@@ -264,12 +263,12 @@ const L = /* @__PURE__ */ new Set(), v = class v {
264
263
  * Sort table by column
265
264
  */
266
265
  sortTable(t, e, s) {
267
- const o = t.querySelector("tbody");
268
- if (!o) {
266
+ const n = t.querySelector("tbody");
267
+ if (!n) {
269
268
  console.warn("Table has no tbody element");
270
269
  return;
271
270
  }
272
- const i = Array.from(o.querySelectorAll("tr"));
271
+ const i = Array.from(n.querySelectorAll("tr"));
273
272
  if (i.length === 0) {
274
273
  console.warn("Table has no data rows");
275
274
  return;
@@ -281,14 +280,14 @@ const L = /* @__PURE__ */ new Set(), v = class v {
281
280
  this.restoreOriginalOrder(t, i);
282
281
  return;
283
282
  }
284
- this.sortRows(i, s, a).forEach((c) => o.appendChild(c));
283
+ this.sortRows(i, s, a).forEach((c) => n.appendChild(c));
285
284
  }
286
285
  /**
287
286
  * Sort rows based on column data
288
287
  */
289
288
  sortRows(t, e, s) {
290
- return t.sort((o, i) => {
291
- const r = o.cells[e], a = i.cells[e];
289
+ return t.sort((n, i) => {
290
+ const r = n.cells[e], a = i.cells[e];
292
291
  if (!r || !a) return 0;
293
292
  const l = this.extractValue(r), c = this.extractValue(a);
294
293
  if (this.options.customSorters[e])
@@ -301,7 +300,7 @@ const L = /* @__PURE__ */ new Set(), v = class v {
301
300
  * Extract sortable value from cell
302
301
  */
303
302
  extractValue(t) {
304
- let e = t.textContent.trim(), s = I(e);
303
+ let e = t.textContent.trim(), s = N(e);
305
304
  if (!isNaN(s))
306
305
  return console.log(s), s;
307
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))
@@ -331,17 +330,17 @@ const L = /* @__PURE__ */ new Set(), v = class v {
331
330
  /**
332
331
  * Update visual indicators for sort state
333
332
  */
334
- updateSortIndicators(t, e, s, o) {
333
+ updateSortIndicators(t, e, s, n) {
335
334
  const i = t.querySelectorAll("thead tr th");
336
335
  if (i.forEach((r, a) => {
337
336
  r.classList.remove(this.options.activeSortClass, this.options.ascendingClass, this.options.descendingClass);
338
337
  const l = r.querySelector(".material-icons");
339
338
  l && (l.textContent = this.options.unsortedIcon, l.style.opacity = "0.6");
340
- }), o !== "none") {
339
+ }), n !== "none") {
341
340
  const r = i[s];
342
341
  r.classList.add(this.options.activeSortClass);
343
342
  const a = r.querySelector(".material-icons");
344
- a && (o === "asc" ? (r.classList.add(this.options.ascendingClass), a.textContent = this.options.ascendingIcon) : (r.classList.add(this.options.descendingClass), a.textContent = this.options.descendingIcon), a.style.opacity = "1");
343
+ a && (n === "asc" ? (r.classList.add(this.options.ascendingClass), a.textContent = this.options.ascendingIcon) : (r.classList.add(this.options.descendingClass), a.textContent = this.options.descendingIcon), a.style.opacity = "1");
345
344
  }
346
345
  }
347
346
  /**
@@ -349,12 +348,12 @@ const L = /* @__PURE__ */ new Set(), v = class v {
349
348
  */
350
349
  restoreOriginalOrder(t, e) {
351
350
  const s = t.querySelector("tbody");
352
- e.forEach((o) => s.appendChild(o));
351
+ e.forEach((n) => s.appendChild(n));
353
352
  }
354
353
  /**
355
354
  * Add resizing functionality to a header
356
355
  */
357
- addResizing(t, e, s, o) {
356
+ addResizing(t, e, s, n) {
358
357
  if (t.classList.add(this.options.resizableClass), t.style.position = "relative", t.querySelector(".resize-handle"))
359
358
  return;
360
359
  const i = document.createElement("div");
@@ -390,7 +389,7 @@ const L = /* @__PURE__ */ new Set(), v = class v {
390
389
  /**
391
390
  * Add drag and drop functionality to a header
392
391
  */
393
- addDragAndDrop(t, e, s, o) {
392
+ addDragAndDrop(t, e, s, n) {
394
393
  if (t.querySelector(".drag-handle"))
395
394
  return;
396
395
  t.classList.add(this.options.draggableClass), t.draggable = !0;
@@ -427,8 +426,8 @@ const L = /* @__PURE__ */ new Set(), v = class v {
427
426
  * Create a custom drag image for better UX
428
427
  */
429
428
  createCustomDragImage(t, e, s) {
430
- const o = document.createElement("div");
431
- o.style.cssText = `
429
+ const n = document.createElement("div");
430
+ n.style.cssText = `
432
431
  position: absolute;
433
432
  top: -1000px;
434
433
  left: -1000px;
@@ -452,22 +451,22 @@ const L = /* @__PURE__ */ new Set(), v = class v {
452
451
  align-items: center;
453
452
  `;
454
453
  const i = s;
455
- o.innerHTML = `
454
+ n.innerHTML = `
456
455
  <div style="display: flex; align-items: center; gap: 5px; align-content: center;color:white;">
457
456
  <span style="overflow: hidden; text-overflow: ellipsis">${i}</span>
458
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>
459
458
  </div>
460
- `, document.body.appendChild(o), t.dataTransfer.setDragImage(o, 50, 12), setTimeout(() => {
461
- document.body.contains(o) && document.body.removeChild(o);
459
+ `, document.body.appendChild(n), t.dataTransfer.setDragImage(n, 50, 12), setTimeout(() => {
460
+ document.body.contains(n) && document.body.removeChild(n);
462
461
  }, 100);
463
462
  }
464
463
  /**
465
464
  * Highlight an entire column during drag operations
466
465
  */
467
466
  highlightColumn(t, e, s) {
468
- const o = t.querySelector("thead tr"), i = t.querySelector("tbody");
469
- if (!o || !i) return;
470
- const r = o.children[e];
467
+ const n = t.querySelector("thead tr"), i = t.querySelector("tbody");
468
+ if (!n || !i) return;
469
+ const r = n.children[e];
471
470
  if (r)
472
471
  if (s) {
473
472
  r.classList.add(this.options.dragOverClass);
@@ -491,9 +490,9 @@ const L = /* @__PURE__ */ new Set(), v = class v {
491
490
  clearAllColumnHighlights(t) {
492
491
  const e = t.querySelector("thead tr"), s = t.querySelector("tbody");
493
492
  if (!e || !s) return;
494
- const o = e.children;
495
- for (let r = 0; r < o.length; r++)
496
- o[r].classList.remove(this.options.dragOverClass);
493
+ const n = e.children;
494
+ for (let r = 0; r < n.length; r++)
495
+ n[r].classList.remove(this.options.dragOverClass);
497
496
  const i = s.children;
498
497
  for (let r = 0; r < i.length; r++) {
499
498
  const a = i[r].children;
@@ -504,25 +503,25 @@ const L = /* @__PURE__ */ new Set(), v = class v {
504
503
  /**
505
504
  * Reorder columns in a table
506
505
  */
507
- reorderColumns(t, e, s, o) {
506
+ reorderColumns(t, e, s, n) {
508
507
  const i = t.querySelector("thead tr"), r = t.querySelector("tbody");
509
508
  if (!i || !r) return;
510
509
  const a = Array.from(i.children), l = Array.from(r.children);
511
- if (s < 0 || s >= a.length || o < 0 || o >= a.length) {
510
+ if (s < 0 || s >= a.length || n < 0 || n >= a.length) {
512
511
  console.warn("Invalid column indices for reordering");
513
512
  return;
514
513
  }
515
- if (s === o)
514
+ if (s === n)
516
515
  return;
517
- const c = a[s], u = a[o];
518
- s < o ? i.insertBefore(c, u.nextSibling) : i.insertBefore(c, u), l.forEach((h, f) => {
519
- const g = Array.from(h.children), m = g[s], y = g[o];
520
- s < o ? h.insertBefore(m, y.nextSibling) : h.insertBefore(m, y);
516
+ const c = a[s], u = a[n];
517
+ s < n ? i.insertBefore(c, u.nextSibling) : i.insertBefore(c, u), l.forEach((h, f) => {
518
+ const g = Array.from(h.children), m = g[s], y = g[n];
519
+ s < n ? h.insertBefore(m, y.nextSibling) : h.insertBefore(m, y);
521
520
  });
522
521
  const p = this.originalColumnOrder.get(e);
523
522
  if (p) {
524
523
  const h = [...p], f = h[s];
525
- h.splice(s, 1), h.splice(o, 0, f), this.originalColumnOrder.set(e, h);
524
+ h.splice(s, 1), h.splice(n, 0, f), this.originalColumnOrder.set(e, h);
526
525
  }
527
526
  this.applyTableStyles(t), this.refreshDragAndDropListeners(t, e);
528
527
  }
@@ -546,13 +545,13 @@ const L = /* @__PURE__ */ new Set(), v = class v {
546
545
  updateTableWidth(t) {
547
546
  const e = t.querySelectorAll("th");
548
547
  let s = 0;
549
- e.forEach((o) => {
550
- const i = o.style.width;
548
+ e.forEach((n) => {
549
+ const i = n.style.width;
551
550
  if (i) {
552
551
  const r = parseInt(i.replace("px", ""));
553
552
  s += r;
554
553
  } else {
555
- const r = o.textContent.replace(/[📊🔍]/g, "").trim();
554
+ const r = n.textContent.replace(/[📊🔍]/g, "").trim();
556
555
  s += r.length;
557
556
  }
558
557
  }), t.style.width = `${s}px`;
@@ -562,11 +561,11 @@ const L = /* @__PURE__ */ new Set(), v = class v {
562
561
  */
563
562
  calculateTableWidth(t) {
564
563
  var p;
565
- const e = t.getAttribute("data-original-width"), s = e ? parseFloat(e) : 0, o = t.querySelectorAll("th");
564
+ const e = t.getAttribute("data-original-width"), s = e ? parseFloat(e) : 0, n = t.querySelectorAll("th");
566
565
  let i = 0;
567
566
  t.parentElement.clientWidth;
568
567
  const r = [];
569
- o.forEach((h) => {
568
+ n.forEach((h) => {
570
569
  let g = h.textContent.replace(/[📊🔍]/g, "").trim().length * this.charWidth + 15;
571
570
  r.push(g), i += g;
572
571
  });
@@ -577,7 +576,7 @@ const L = /* @__PURE__ */ new Set(), v = class v {
577
576
  const b = g.textContent.length * this.charWidth + 15;
578
577
  b > r[m] && m < r.length && (r[m] = b);
579
578
  });
580
- c = r.reduce((h, f) => h += f, 0), o.forEach((h, f) => {
579
+ c = r.reduce((h, f) => h += f, 0), n.forEach((h, f) => {
581
580
  if (c > l) {
582
581
  const g = r[f] / c;
583
582
  h.style.width = `${l * g}px`;
@@ -740,15 +739,15 @@ const L = /* @__PURE__ */ new Set(), v = class v {
740
739
  */
741
740
  destroy() {
742
741
  this.tables.forEach((e) => {
743
- e.querySelectorAll(`.${this.options.sortableClass}`).forEach((o) => {
744
- o.classList.remove(
742
+ e.querySelectorAll(`.${this.options.sortableClass}`).forEach((n) => {
743
+ n.classList.remove(
745
744
  this.options.sortableClass,
746
745
  this.options.activeSortClass,
747
746
  this.options.ascendingClass,
748
747
  this.options.descendingClass
749
- ), o.style.cursor = "", o.style.background = "";
750
- const i = o.cloneNode(!0);
751
- o.parentNode.replaceChild(i, o);
748
+ ), n.style.cursor = "", n.style.background = "";
749
+ const i = n.cloneNode(!0);
750
+ n.parentNode.replaceChild(i, n);
752
751
  });
753
752
  });
754
753
  const t = document.getElementById("sortable-table-styles");
@@ -765,45 +764,45 @@ d(v, "SortableTable"), /** Fallback advance width, in px, for one character of t
765
764
  E(v, "DEFAULT_CHAR_WIDTH", 8);
766
765
  let C = v;
767
766
  typeof window < "u" && (window.SortableTable = C);
768
- const T = /* @__PURE__ */ new Set(["/", "@", "#"]), M = /* @__PURE__ */ d((n) => n === "/" ? "slash" : n === "@" ? "at" : "hash", "triggerTypeFor"), S = /[ \t\r\n\f\v]/, O = /\[[^\]\n]+\]/g, A = /* @__PURE__ */ d((n, 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, t, e) => {
769
768
  let s = 0;
770
- const o = /* @__PURE__ */ d((i) => {
771
- const r = i === 0 ? t : n[i - 1];
769
+ const n = /* @__PURE__ */ d((i) => {
770
+ const r = i === 0 ? t : o[i - 1];
772
771
  return r === void 0 || S.test(r);
773
772
  }, "boundaryBefore");
774
- for (; s < n.length; ) {
775
- const i = n[s];
776
- if (o(s) && T.has(i)) {
773
+ for (; s < o.length; ) {
774
+ const i = o[s];
775
+ if (n(s) && T.has(i)) {
777
776
  let r = s + 1;
778
- for (; r < n.length && !S.test(n[r]); ) r += 1;
779
- e.push({ type: M(i), text: n.slice(s, r) }), s = r;
777
+ for (; r < o.length && !S.test(o[r]); ) r += 1;
778
+ e.push({ type: O(i), text: o.slice(s, r) }), s = r;
780
779
  } else {
781
780
  let r = s + 1;
782
- for (; r < n.length; ) {
783
- const a = n[r];
784
- if (T.has(a) && S.test(n[r - 1])) break;
781
+ for (; r < o.length; ) {
782
+ const a = o[r];
783
+ if (T.has(a) && S.test(o[r - 1])) break;
785
784
  r += 1;
786
785
  }
787
- e.push({ type: "plain", text: n.slice(s, r) }), s = r;
786
+ e.push({ type: "plain", text: o.slice(s, r) }), s = r;
788
787
  }
789
788
  }
790
- }, "tokenizeSegment"), U = /* @__PURE__ */ d((n) => {
791
- if (!n) return [];
792
- const t = [], e = new RegExp(O.source, "g");
789
+ }, "tokenizeSegment"), X = /* @__PURE__ */ d((o) => {
790
+ if (!o) return [];
791
+ const t = [], e = new RegExp(R.source, "g");
793
792
  let s = 0;
794
- for (let o = e.exec(n); o; o = e.exec(n))
795
- o.index > s && A(n.slice(s, o.index), s === 0 ? void 0 : n[s - 1], t), t.push({ type: "placeholder", text: o[0] }), s = o.index + o[0].length;
796
- return s < n.length && A(n.slice(s), s === 0 ? void 0 : n[s - 1], t), t;
797
- }, "tokenizeForHighlight"), X = /* @__PURE__ */ d((n, t) => {
798
- const e = t.filter((o) => o.trim().length > 0).sort((o, i) => i.length - o.length);
799
- if (e.length === 0) return n;
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;
800
799
  const s = [];
801
- for (const o of n) {
802
- if (o.type !== "plain") {
803
- s.push(o);
800
+ for (const n of o) {
801
+ if (n.type !== "plain") {
802
+ s.push(n);
804
803
  continue;
805
804
  }
806
- let i = o.text;
805
+ let i = n.text;
807
806
  for (; i.length > 0; ) {
808
807
  let r = -1, a = 0;
809
808
  for (const l of e) {
@@ -819,100 +818,100 @@ const T = /* @__PURE__ */ new Set(["/", "@", "#"]), M = /* @__PURE__ */ d((n) =>
819
818
  }
820
819
  return s;
821
820
  }, "chipLocations");
822
- function G(n, t, e = t, s = 600) {
823
- const o = n.value;
821
+ function j(o, t, e = t, s = 600) {
822
+ const n = o.value;
824
823
  let i = !1;
825
824
  const r = /* @__PURE__ */ d(() => {
826
- i || (i = !0, document.removeEventListener("selectionchange", l), n.removeEventListener("keydown", r), n.removeEventListener("input", r), n.removeEventListener("pointerdown", r), window.clearTimeout(c), window.clearInterval(u));
825
+ i || (i = !0, document.removeEventListener("selectionchange", l), o.removeEventListener("keydown", r), o.removeEventListener("input", r), o.removeEventListener("pointerdown", r), window.clearTimeout(c), window.clearInterval(u));
827
826
  }, "stop"), a = /* @__PURE__ */ d(() => {
828
- if (n.value !== o) {
827
+ if (o.value !== n) {
829
828
  r();
830
829
  return;
831
830
  }
832
- n.selectionStart === t && n.selectionEnd === e || n.setSelectionRange(t, e);
831
+ o.selectionStart === t && o.selectionEnd === e || o.setSelectionRange(t, e);
833
832
  }, "apply"), l = /* @__PURE__ */ d(() => {
834
- document.activeElement === n && a();
833
+ document.activeElement === o && a();
835
834
  }, "onSelectionChange");
836
835
  a();
837
836
  const c = window.setTimeout(r, s), u = window.setInterval(a, 50);
838
- return document.addEventListener("selectionchange", l), n.addEventListener("keydown", r), n.addEventListener("input", r), n.addEventListener("pointerdown", r), r;
837
+ return document.addEventListener("selectionchange", l), o.addEventListener("keydown", r), o.addEventListener("input", r), o.addEventListener("pointerdown", r), r;
839
838
  }
840
- d(G, "placeCaret");
841
- function j() {
839
+ d(j, "placeCaret");
840
+ function K() {
842
841
  if (typeof document > "u") return;
843
- const n = /* @__PURE__ */ d((s) => {
842
+ const o = /* @__PURE__ */ d((s) => {
844
843
  s.stopPropagation(), s.preventDefault(), t();
845
844
  }, "onClick"), t = /* @__PURE__ */ d(() => {
846
- document.removeEventListener("click", n, !0), window.clearTimeout(e);
845
+ document.removeEventListener("click", o, !0), window.clearTimeout(e);
847
846
  }, "cleanup"), e = window.setTimeout(t, 500);
848
- document.addEventListener("click", n, !0);
847
+ document.addEventListener("click", o, !0);
849
848
  }
850
- d(j, "swallowNextClick");
849
+ d(K, "swallowNextClick");
851
850
  const H = 2;
852
- function K(n, t) {
851
+ function Z(o, t) {
853
852
  let e = 0;
854
853
  for (let s = t - 1; s >= 0; s -= 1) {
855
- const o = n[s];
856
- if (o === "/" || o === "@" || o === "#")
857
- return !(s === 0 || /\s/.test(n[s - 1])) || o !== "@" && e > 0 ? null : {
858
- trigger: o,
859
- query: n.slice(s + 1, t),
854
+ const n = o[s];
855
+ if (n === "/" || n === "@" || n === "#")
856
+ return !(s === 0 || /\s/.test(o[s - 1])) || n !== "@" && e > 0 ? null : {
857
+ trigger: n,
858
+ query: o.slice(s + 1, t),
860
859
  startIdx: s,
861
860
  endIdx: t
862
861
  };
863
- if (o === " ") return null;
864
- if (o === " " || o === " ") {
862
+ if (n === " ") return null;
863
+ if (n === " " || n === " ") {
865
864
  if (e += 1, e > H) return null;
866
865
  continue;
867
866
  }
868
- if (/\s/.test(o)) return null;
867
+ if (/\s/.test(n)) return null;
869
868
  }
870
869
  return null;
871
870
  }
872
- d(K, "detectTrigger");
873
- const R = /\[[^\]\n]+\]/g;
874
- function w(n, t = 0) {
875
- const e = new RegExp(R.source, "g");
871
+ d(Z, "detectTrigger");
872
+ const _ = /\[[^\]\n]+\]/g;
873
+ function w(o, t = 0) {
874
+ const e = new RegExp(_.source, "g");
876
875
  e.lastIndex = t;
877
- const s = e.exec(n);
876
+ const s = e.exec(o);
878
877
  if (!s) return null;
879
- const o = s[0].slice(1, -1), i = o[0], r = i === "@" || i === "#" || i === "/";
878
+ const n = s[0].slice(1, -1), i = n[0], r = i === "@" || i === "#" || i === "/";
880
879
  return {
881
880
  trigger: r ? i : null,
882
- label: (r ? o.slice(1) : o).trim(),
881
+ label: (r ? n.slice(1) : n).trim(),
883
882
  startIdx: s.index,
884
883
  endIdx: s.index + s[0].length
885
884
  };
886
885
  }
887
886
  d(w, "findPlaceholder");
888
- function Z(n, t) {
887
+ function J(o, t) {
889
888
  for (let e = 0; ; ) {
890
- const s = w(n, e);
889
+ const s = w(o, e);
891
890
  if (!s || s.startIdx > t) return null;
892
891
  if (t <= s.endIdx) return s;
893
892
  e = s.endIdx;
894
893
  }
895
894
  }
896
- d(Z, "placeholderAt");
897
- function k(n, t) {
895
+ d(J, "placeholderAt");
896
+ function k(o, t) {
898
897
  if (t.trigger) {
899
- const e = n.slice(0, t.startIdx) + t.trigger + n.slice(t.endIdx), s = t.startIdx + 1;
898
+ const e = o.slice(0, t.startIdx) + t.trigger + o.slice(t.endIdx), s = t.startIdx + 1;
900
899
  return { next: e, selectionStart: s, selectionEnd: s, reopenTrigger: !0 };
901
900
  }
902
- return { next: n, selectionStart: t.startIdx, selectionEnd: t.endIdx, reopenTrigger: !1 };
901
+ return { next: o, selectionStart: t.startIdx, selectionEnd: t.endIdx, reopenTrigger: !1 };
903
902
  }
904
903
  d(k, "activatePlaceholder");
905
- function J(n, t) {
906
- const e = w(n, t) ?? w(n, 0);
907
- return e ? k(n, e) : null;
904
+ function Y(o, t) {
905
+ const e = w(o, t) ?? w(o, 0);
906
+ return e ? k(o, e) : null;
908
907
  }
909
- d(J, "advanceToPlaceholder");
910
- function Y(n, t, e) {
911
- const s = n.slice(0, t.startIdx), o = n.slice(t.endIdx), i = w(e);
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);
912
911
  if (i) {
913
912
  const c = k(e, i);
914
913
  return {
915
- next: `${s}${c.next}${o}`,
914
+ next: `${s}${c.next}${n}`,
916
915
  selectionStart: s.length + c.selectionStart,
917
916
  selectionEnd: s.length + c.selectionEnd,
918
917
  reopenTrigger: c.reopenTrigger
@@ -921,50 +920,50 @@ function Y(n, t, e) {
921
920
  const r = e[e.length - 1];
922
921
  if (r === "@" || r === "#" || r === "/") {
923
922
  const c = s.length + e.length;
924
- return { next: `${s}${e}${o}`, selectionStart: c, selectionEnd: c, reopenTrigger: !0 };
923
+ return { next: `${s}${e}${n}`, selectionStart: c, selectionEnd: c, reopenTrigger: !0 };
925
924
  }
926
925
  const a = `${e} `, l = s.length + a.length;
927
- return { next: `${s}${a}${o}`, selectionStart: l, selectionEnd: l, reopenTrigger: !1 };
926
+ return { next: `${s}${a}${n}`, selectionStart: l, selectionEnd: l, reopenTrigger: !1 };
928
927
  }
929
- d(Y, "applyTriggerInsertion");
930
- async function Q(n, { onAtQuery: t, onAtPersonQuery: e }, { personConfidence: s = 0, locationConfidence: o = 0, personFirstThreshold: i = 0.5, vertical: r = "air", hotelConfidence: a = 0 } = {}) {
928
+ d(Q, "applyTriggerInsertion");
929
+ async function tt(o, { onAtQuery: t, onAtPersonQuery: e }, { personConfidence: s = 0, locationConfidence: n = 0, personFirstThreshold: i = 0.5, vertical: r = "air", hotelConfidence: a = 0 } = {}) {
931
930
  const [l, c] = await Promise.all([
932
- t ? t(n, { vertical: r, hotelConfidence: a }).catch(() => []) : Promise.resolve([]),
933
- e ? e(n).catch(() => []) : Promise.resolve([])
931
+ t ? t(o, { vertical: r, hotelConfidence: a }).catch(() => []) : Promise.resolve([]),
932
+ e ? e(o).catch(() => []) : Promise.resolve([])
934
933
  ]);
935
934
  if (t && e) {
936
935
  const u = c.map((f) => ({ ...f, group: "person" })), p = l.map((f) => ({ ...f, group: "location" }));
937
- return s >= i && s >= o ? [...u, ...p] : [...p, ...u];
936
+ return s >= i && s >= n ? [...u, ...p] : [...p, ...u];
938
937
  }
939
938
  return [...c, ...l];
940
939
  }
941
- d(Q, "fetchAtMentions");
942
- function tt(n, t) {
943
- var s, o;
944
- const e = (s = n[t]) == null ? void 0 : s.group;
945
- return e !== void 0 && (t === 0 || ((o = n[t - 1]) == null ? void 0 : o.group) !== e);
940
+ d(tt, "fetchAtMentions");
941
+ function et(o, t) {
942
+ var s, n;
943
+ const e = (s = o[t]) == null ? void 0 : s.group;
944
+ return e !== void 0 && (t === 0 || ((n = o[t - 1]) == null ? void 0 : n.group) !== e);
946
945
  }
947
- d(tt, "isSectionStart");
946
+ d(et, "isSectionStart");
948
947
  export {
949
948
  C as S,
950
949
  k as a,
951
- J as b,
952
- Y as c,
953
- X as d,
954
- D as e,
955
- K as f,
956
- q as g,
950
+ Y as b,
951
+ Q as c,
952
+ G as d,
953
+ I as e,
954
+ Z as f,
955
+ M as g,
957
956
  F as h,
958
- Q as i,
957
+ tt as i,
959
958
  w as j,
960
- tt as k,
961
- V as l,
962
- Z as m,
963
- P as n,
964
- B as o,
965
- G as p,
966
- j as q,
967
- z as s,
968
- U as t
959
+ et as k,
960
+ U as l,
961
+ J as m,
962
+ V as n,
963
+ P as o,
964
+ j as p,
965
+ K as q,
966
+ B as s,
967
+ X as t
969
968
  };
970
- //# sourceMappingURL=atMentions-BlzXxKB9.js.map
969
+ //# sourceMappingURL=atMentions-DbE21rGt.js.map