@aintela/chat 0.2.49 → 0.2.51
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.
- package/dist/{atMentions-CJUmkOh9.js → atMentions-BQ-FxbtK.js} +334 -290
- package/dist/atMentions-BQ-FxbtK.js.map +1 -0
- package/dist/{auth-xpQrzSI2.js → auth-DnA-Qvpi.js} +2 -2
- package/dist/{auth-xpQrzSI2.js.map → auth-DnA-Qvpi.js.map} +1 -1
- package/dist/components.js +5666 -5491
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +1 -1
- package/dist/{httpArtifactService-CcYAfh2q.js → httpArtifactService-JtkC1T7n.js} +206 -194
- package/dist/{httpArtifactService-CcYAfh2q.js.map → httpArtifactService-JtkC1T7n.js.map} +1 -1
- package/dist/index.js +149 -143
- package/dist/services.js +1 -1
- package/dist/src/components/AiChat/sessionStateManagerService.d.ts +8 -1
- package/dist/src/components/v2/MentionPickerPanel.d.ts +34 -0
- package/dist/src/components/v2/PromptGhostHint.d.ts +11 -0
- package/dist/src/components/v2/PromptV2.d.ts +10 -14
- package/dist/src/components/v2/TriggerDropdown.d.ts +31 -0
- package/dist/src/components/v2/index.d.ts +7 -0
- package/dist/src/components/v2/useCoarsePointer.d.ts +10 -0
- package/dist/src/services/WebSocketConnection/WebSocketConnectionV2.d.ts +12 -3
- package/dist/src/services/WebSocketConnection/webSocketConnection.d.ts +8 -1
- package/dist/src/services/servers/AgentGatewayService.d.ts +8 -1
- package/dist/src/services/servers/AgentGatewayWSAsync.d.ts +3 -1
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/promptTriggers.d.ts +60 -0
- package/dist/src/utils/promptTriggers.test.d.ts +1 -0
- package/dist/useContainerWidth-B3t1ZTlo.js +309 -0
- package/dist/useContainerWidth-B3t1ZTlo.js.map +1 -0
- package/dist/utils.js +29 -27
- package/package.json +1 -1
- package/dist/atMentions-CJUmkOh9.js.map +0 -1
- package/dist/useContainerWidth-CDv8UQyZ.js +0 -309
- package/dist/useContainerWidth-CDv8UQyZ.js.map +0 -1
|
@@ -1,88 +1,88 @@
|
|
|
1
1
|
var L = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
const
|
|
2
|
+
var d = (i, t) => L(i, "name", { value: t, configurable: !0 });
|
|
3
|
+
const O = /* @__PURE__ */ d((i) => {
|
|
4
4
|
if (i[0] == "#")
|
|
5
5
|
return null;
|
|
6
6
|
const t = i.split("/");
|
|
7
7
|
let e = t[t.length - 1];
|
|
8
8
|
if (e == "" && t.length > 1 && (e = t[t.length - 2]), e == "")
|
|
9
9
|
return null;
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
}, "parseAndValidateArtifactUrl"),
|
|
13
|
-
let
|
|
10
|
+
const s = e.split("?")[0];
|
|
11
|
+
return s.startsWith("#") ? s : s.split("#")[0];
|
|
12
|
+
}, "parseAndValidateArtifactUrl"), F = /* @__PURE__ */ d((i, t, e) => {
|
|
13
|
+
let s = "URL", r = null, n = null, o = null;
|
|
14
14
|
if (i[0] == "#") {
|
|
15
15
|
const a = i.indexOf("-"), l = i.slice(1, a);
|
|
16
|
-
switch (
|
|
16
|
+
switch (o = i.slice(a + 1), l.toLowerCase()) {
|
|
17
17
|
case "opendashboard":
|
|
18
|
-
|
|
18
|
+
s = "OpenDashboard";
|
|
19
19
|
break;
|
|
20
20
|
case "ask":
|
|
21
|
-
|
|
21
|
+
s = "Question", r = e;
|
|
22
22
|
break;
|
|
23
23
|
}
|
|
24
24
|
} else
|
|
25
|
-
i.indexOf("http") > -1 ? (
|
|
26
|
-
return { action:
|
|
27
|
-
}, "extractLinkAction"), T = /* @__PURE__ */
|
|
25
|
+
i.indexOf("http") > -1 ? (s = "URL", n = i) : (i = i.replaceAll("exported/", `exported/${t}/`), s = "Export");
|
|
26
|
+
return { action: s, url: n, question: r, parameter: o };
|
|
27
|
+
}, "extractLinkAction"), T = /* @__PURE__ */ d((i, t) => Array.from(
|
|
28
28
|
{ length: Math.ceil(i.length / t) },
|
|
29
|
-
(e,
|
|
30
|
-
), "chunkArray"),
|
|
29
|
+
(e, s) => i.slice(s * t, s * t + t)
|
|
30
|
+
), "chunkArray"), H = /* @__PURE__ */ d((i) => {
|
|
31
31
|
i = i.replaceAll("\\n", `
|
|
32
32
|
`);
|
|
33
|
-
const t = 90, e = i.split(" "),
|
|
34
|
-
let
|
|
35
|
-
for (const
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
const
|
|
33
|
+
const t = 90, e = i.split(" "), s = [];
|
|
34
|
+
let r = !1;
|
|
35
|
+
for (const n of e)
|
|
36
|
+
if (n.length > t) {
|
|
37
|
+
r = !0;
|
|
38
|
+
const o = [...n], l = T(o, t).map((c) => c.join("")).join(`
|
|
39
39
|
`);
|
|
40
|
-
|
|
40
|
+
s.push(l);
|
|
41
41
|
} else
|
|
42
|
-
|
|
43
|
-
return
|
|
42
|
+
s.push(n);
|
|
43
|
+
return r ? s.join(" ") : i;
|
|
44
44
|
}, "splitBigLinesWithSpaces");
|
|
45
45
|
function k(i) {
|
|
46
46
|
let t = parseFloat(i);
|
|
47
47
|
if (!isNaN(t))
|
|
48
48
|
return i = i.replaceAll(/[,\.]/g, ""), parseInt(i);
|
|
49
49
|
var e = "";
|
|
50
|
-
for (const
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
return t = parseInt(e), !isNaN(t) &&
|
|
50
|
+
for (const r of i)
|
|
51
|
+
r.match(/[0-9]/) && (e += r);
|
|
52
|
+
const s = e.length / i.length;
|
|
53
|
+
return t = parseInt(e), !isNaN(t) && s > 0.5 ? t : NaN;
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
function
|
|
55
|
+
d(k, "parseRawNumber");
|
|
56
|
+
function I(i) {
|
|
57
57
|
if (!i) return { prefix: void 0, suffix: void 0, number: void 0 };
|
|
58
58
|
const t = /[$%(\w?\$)]/gi, e = /[a-z]?\$/gi;
|
|
59
|
-
let
|
|
59
|
+
let s = "", r = "";
|
|
60
60
|
if (i.match(t)) {
|
|
61
|
-
i.indexOf("%") > -1 && (
|
|
61
|
+
i.indexOf("%") > -1 && (r = " %");
|
|
62
62
|
const a = i.match(e);
|
|
63
|
-
a && (
|
|
63
|
+
a && (s = a[0] + " ");
|
|
64
64
|
}
|
|
65
|
-
let
|
|
66
|
-
if (!isNaN(
|
|
67
|
-
return i = i.replaceAll(".", "").replaceAll(",", "."), { prefix:
|
|
68
|
-
var
|
|
65
|
+
let n = parseFloat(i);
|
|
66
|
+
if (!isNaN(n))
|
|
67
|
+
return i = i.replaceAll(".", "").replaceAll(",", "."), { prefix: s, suffix: r, number: parseFloat(i) };
|
|
68
|
+
var o = "";
|
|
69
69
|
for (const a of i)
|
|
70
70
|
if (a.match(/[0-9.,]/)) {
|
|
71
71
|
let l = a;
|
|
72
|
-
l == "." ? l = "" : l == "," && (l = "."),
|
|
72
|
+
l == "." ? l = "" : l == "," && (l = "."), o += l;
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return n = parseFloat(o), isNaN(n) ? { prefix: void 0, suffix: void 0, number: void 0 } : { prefix: s, suffix: r, number: n };
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
d(I, "parseKnownNumbers");
|
|
77
77
|
const E = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i, A = /^[0-9a-f]{32}/i;
|
|
78
|
-
function
|
|
78
|
+
function R(i) {
|
|
79
79
|
if (!i || typeof i != "string")
|
|
80
80
|
return !1;
|
|
81
|
-
const t =
|
|
81
|
+
const t = $(i);
|
|
82
82
|
return t === null ? !1 : i.startsWith(t);
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
function
|
|
84
|
+
d(R, "startsWithInteractionId");
|
|
85
|
+
function $(i) {
|
|
86
86
|
if (!i || typeof i != "string")
|
|
87
87
|
return null;
|
|
88
88
|
const t = i.match(E);
|
|
@@ -91,32 +91,32 @@ function N(i) {
|
|
|
91
91
|
const e = i.match(A);
|
|
92
92
|
return e ? e[0] : null;
|
|
93
93
|
}
|
|
94
|
-
|
|
95
|
-
function
|
|
96
|
-
const
|
|
97
|
-
return
|
|
94
|
+
d($, "extractInteractionId");
|
|
95
|
+
function _(i) {
|
|
96
|
+
const s = i.replaceAll("_", " ").replaceAll("-", " ").replaceAll("user:", "").replace(/\.[^/.]+$/, ""), r = N(s).trim();
|
|
97
|
+
return r.length > 1 ? r[0].toUpperCase() + r.slice(1) : r;
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
d(_, "prettiffyFileName");
|
|
100
100
|
function z(i) {
|
|
101
101
|
if (i.length == 0)
|
|
102
102
|
return i;
|
|
103
103
|
const t = i.replaceAll("_", " ").replaceAll("-", " ");
|
|
104
104
|
return t[0].toUpperCase() + t.slice(1);
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
function
|
|
106
|
+
d(z, "prettiffyPythonFunctionName");
|
|
107
|
+
function N(i) {
|
|
108
108
|
const t = i.match(E);
|
|
109
109
|
if (t)
|
|
110
110
|
return i.replace(t[0], "");
|
|
111
111
|
const e = i.match(A);
|
|
112
112
|
return e ? i.replace(e[0], "") : i;
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
function
|
|
114
|
+
d(N, "extractNameFromStringWithInteractionId");
|
|
115
|
+
function B(i) {
|
|
116
116
|
return !i || typeof i != "string" ? !1 : !!(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(i) || /^[0-9a-f]{32}$/i.test(i));
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
const
|
|
118
|
+
d(B, "isValidInteractionId");
|
|
119
|
+
const C = /* @__PURE__ */ new Set(), S = class S {
|
|
120
120
|
constructor(t = {}) {
|
|
121
121
|
this.options = {
|
|
122
122
|
// CSS class for sortable headers
|
|
@@ -199,8 +199,8 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
199
199
|
* @param {HTMLElement} container - Optional container element to limit search scope
|
|
200
200
|
*/
|
|
201
201
|
scanTables(t = null) {
|
|
202
|
-
const
|
|
203
|
-
this.tables = Array.from(
|
|
202
|
+
const s = (t || document).querySelectorAll("table");
|
|
203
|
+
this.tables = Array.from(s);
|
|
204
204
|
}
|
|
205
205
|
/**
|
|
206
206
|
* Make all found tables sortable
|
|
@@ -214,20 +214,20 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
214
214
|
* Make a specific table sortable
|
|
215
215
|
*/
|
|
216
216
|
makeTableSortable(t, e) {
|
|
217
|
-
let
|
|
218
|
-
if (
|
|
217
|
+
let s = t.querySelector("thead"), r = null, n = [];
|
|
218
|
+
if (s && (r = s.querySelector("tr"), r && (n = r.querySelectorAll("th"))), n.length === 0) {
|
|
219
219
|
console.warn("Table has no sortable columns, skipping");
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
const
|
|
223
|
-
t.classList.add("sortable-table"),
|
|
222
|
+
const o = !t.hasAttribute("data-sortable-arrived");
|
|
223
|
+
t.classList.add("sortable-table"), o && (t.setAttribute("data-sortable-arrived", "true"), t.classList.add("sortable-table-arriving"), setTimeout(() => {
|
|
224
224
|
t.classList.remove("sortable-table-arriving");
|
|
225
225
|
}, 400)), this.sortStates.set(e, {
|
|
226
226
|
currentColumn: -1,
|
|
227
227
|
direction: "none"
|
|
228
|
-
}), t.hasAttribute("data-original-width") || t.setAttribute("data-original-width", t.getBoundingClientRect().width), this.applyTableStyles(t), this.originalColumnOrder.set(e, Array.from(
|
|
228
|
+
}), t.hasAttribute("data-original-width") || t.setAttribute("data-original-width", t.getBoundingClientRect().width), this.applyTableStyles(t), this.originalColumnOrder.set(e, Array.from(n).map((a, l) => l)), n.forEach((a, l) => {
|
|
229
229
|
this.options.excludeColumns.includes(l) || this.makeHeaderSortable(a, t, e, l);
|
|
230
|
-
}), this.replaceExponentialValues(t),
|
|
230
|
+
}), this.replaceExponentialValues(t), C.add(t);
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
233
233
|
* Replace exponential values in table cells with full numbers
|
|
@@ -236,12 +236,12 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
236
236
|
replaceExponentialValues(t) {
|
|
237
237
|
const e = t.querySelector("tbody");
|
|
238
238
|
if (!e) return;
|
|
239
|
-
e.querySelectorAll("tr").forEach((
|
|
240
|
-
|
|
241
|
-
const l =
|
|
239
|
+
e.querySelectorAll("tr").forEach((r) => {
|
|
240
|
+
r.querySelectorAll("td, th").forEach((o) => {
|
|
241
|
+
const l = o.textContent.trim().match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
|
|
242
242
|
if (l) {
|
|
243
|
-
const c = parseFloat(l[1].replace(/,/g, "")), p = parseInt(l[2]), u = c * Math.pow(10, p),
|
|
244
|
-
|
|
243
|
+
const c = parseFloat(l[1].replace(/,/g, "")), p = parseInt(l[2]), u = c * Math.pow(10, p), h = this.formatNumber(u);
|
|
244
|
+
o.textContent = h;
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
});
|
|
@@ -261,32 +261,32 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
261
261
|
* @param {HTMLElement} tbody - The tbody element to remove from
|
|
262
262
|
* @returns {HTMLElement} The converted header row
|
|
263
263
|
*/
|
|
264
|
-
convertRowToHeader(t, e,
|
|
264
|
+
convertRowToHeader(t, e, s) {
|
|
265
265
|
try {
|
|
266
|
-
const
|
|
267
|
-
return
|
|
266
|
+
const r = t.cloneNode(!0);
|
|
267
|
+
return r.querySelectorAll("td").forEach((o) => {
|
|
268
268
|
const a = document.createElement("th");
|
|
269
|
-
Array.from(
|
|
269
|
+
Array.from(o.attributes).forEach((l) => {
|
|
270
270
|
a.setAttribute(l.name, l.value);
|
|
271
|
-
}), a.innerHTML =
|
|
272
|
-
}),
|
|
273
|
-
} catch (
|
|
274
|
-
return console.error("Error converting row to header:",
|
|
271
|
+
}), a.innerHTML = o.innerHTML, a.style.cssText = o.style.cssText, o.parentNode.replaceChild(a, o);
|
|
272
|
+
}), s && s.contains(t) ? s.removeChild(t) : t.parentNode && t.parentNode.removeChild(t), e.appendChild(r), r;
|
|
273
|
+
} catch (r) {
|
|
274
|
+
return console.error("Error converting row to header:", r), null;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* Make a specific header sortable
|
|
279
279
|
*/
|
|
280
|
-
makeHeaderSortable(t, e,
|
|
281
|
-
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,
|
|
282
|
-
const
|
|
283
|
-
l.preventDefault(), this.sortTable(e,
|
|
284
|
-
}, "clickListener"),
|
|
280
|
+
makeHeaderSortable(t, e, s, r) {
|
|
281
|
+
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, r), this.options.enableReordering && this.addDragAndDrop(t, e, s, r);
|
|
282
|
+
const n = /* @__PURE__ */ d((l) => {
|
|
283
|
+
l.preventDefault(), this.sortTable(e, s, r);
|
|
284
|
+
}, "clickListener"), o = /* @__PURE__ */ d((l) => {
|
|
285
285
|
t.classList.contains(this.options.activeSortClass) || (t.style.background = this.options.theme.palette.surface.hover);
|
|
286
|
-
}, "mouseEnterListener"), a = /* @__PURE__ */
|
|
286
|
+
}, "mouseEnterListener"), a = /* @__PURE__ */ d((l) => {
|
|
287
287
|
t.classList.contains(this.options.activeSortClass) || (t.style.background = "");
|
|
288
288
|
}, "mouseLeaveListener");
|
|
289
|
-
t.removeEventListener("click",
|
|
289
|
+
t.removeEventListener("click", n), t.addEventListener("click", n), t.removeEventListener("mouseenter", o), t.addEventListener("mouseenter", o), t.removeEventListener("mouseleave", a), t.addEventListener("mouseleave", a);
|
|
290
290
|
}
|
|
291
291
|
/**
|
|
292
292
|
* Add sort icon to header
|
|
@@ -304,55 +304,55 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
304
304
|
/**
|
|
305
305
|
* Sort table by column
|
|
306
306
|
*/
|
|
307
|
-
sortTable(t, e,
|
|
308
|
-
const
|
|
309
|
-
if (!
|
|
307
|
+
sortTable(t, e, s) {
|
|
308
|
+
const r = t.querySelector("tbody");
|
|
309
|
+
if (!r) {
|
|
310
310
|
console.warn("Table has no tbody element");
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
|
-
const
|
|
314
|
-
if (
|
|
313
|
+
const n = Array.from(r.querySelectorAll("tr"));
|
|
314
|
+
if (n.length === 0) {
|
|
315
315
|
console.warn("Table has no data rows");
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
|
-
const
|
|
319
|
-
t.querySelector(`thead tr th:nth-child(${
|
|
318
|
+
const o = this.sortStates.get(e);
|
|
319
|
+
t.querySelector(`thead tr th:nth-child(${s + 1})`);
|
|
320
320
|
let a;
|
|
321
|
-
if (this.options.sortOnFirstClick ? a =
|
|
322
|
-
this.restoreOriginalOrder(t,
|
|
321
|
+
if (this.options.sortOnFirstClick ? a = o.currentColumn === s && o.direction === "asc" ? "desc" : "asc" : o.currentColumn !== s ? a = "asc" : a = o.direction === "none" ? "asc" : o.direction === "asc" ? "desc" : "none", o.currentColumn = s, o.direction = a, this.sortStates.set(e, o), this.updateSortIndicators(t, e, s, a), a === "none") {
|
|
322
|
+
this.restoreOriginalOrder(t, n);
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
this.sortRows(
|
|
325
|
+
this.sortRows(n, s, a).forEach((c) => r.appendChild(c));
|
|
326
326
|
}
|
|
327
327
|
/**
|
|
328
328
|
* Sort rows based on column data
|
|
329
329
|
*/
|
|
330
|
-
sortRows(t, e,
|
|
331
|
-
return t.sort((
|
|
332
|
-
const
|
|
333
|
-
if (!
|
|
334
|
-
const l = this.extractValue(
|
|
330
|
+
sortRows(t, e, s) {
|
|
331
|
+
return t.sort((r, n) => {
|
|
332
|
+
const o = r.cells[e], a = n.cells[e];
|
|
333
|
+
if (!o || !a) return 0;
|
|
334
|
+
const l = this.extractValue(o), c = this.extractValue(a);
|
|
335
335
|
if (this.options.customSorters[e])
|
|
336
|
-
return this.options.customSorters[e](l, c,
|
|
336
|
+
return this.options.customSorters[e](l, c, s);
|
|
337
337
|
const p = this.compareValues(l, c);
|
|
338
|
-
return
|
|
338
|
+
return s === "asc" ? p : -p;
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
342
342
|
* Extract sortable value from cell
|
|
343
343
|
*/
|
|
344
344
|
extractValue(t) {
|
|
345
|
-
let e = t.textContent.trim(),
|
|
346
|
-
if (!isNaN(
|
|
347
|
-
return console.log(
|
|
345
|
+
let e = t.textContent.trim(), s = k(e);
|
|
346
|
+
if (!isNaN(s))
|
|
347
|
+
return console.log(s), s;
|
|
348
348
|
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))
|
|
349
349
|
return -1;
|
|
350
|
-
const
|
|
351
|
-
if (
|
|
352
|
-
return parseFloat(
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
355
|
-
const p = parseFloat(
|
|
350
|
+
const n = e.match(/^([\d,]+\.?\d*)\s*%$/);
|
|
351
|
+
if (n)
|
|
352
|
+
return parseFloat(n[1].replace(/,/g, ""));
|
|
353
|
+
const o = e.match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
|
|
354
|
+
if (o) {
|
|
355
|
+
const p = parseFloat(o[1].replace(/,/g, "")), u = parseInt(o[2]);
|
|
356
356
|
return p * Math.pow(10, u);
|
|
357
357
|
}
|
|
358
358
|
if (e.match(/^[\d,]+\.?\d*[KMB]?$/))
|
|
@@ -372,34 +372,34 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
372
372
|
/**
|
|
373
373
|
* Update visual indicators for sort state
|
|
374
374
|
*/
|
|
375
|
-
updateSortIndicators(t, e,
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
378
|
-
|
|
379
|
-
const l =
|
|
375
|
+
updateSortIndicators(t, e, s, r) {
|
|
376
|
+
const n = t.querySelectorAll("thead tr th");
|
|
377
|
+
if (n.forEach((o, a) => {
|
|
378
|
+
o.classList.remove(this.options.activeSortClass, this.options.ascendingClass, this.options.descendingClass);
|
|
379
|
+
const l = o.querySelector(".material-icons");
|
|
380
380
|
l && (l.textContent = this.options.unsortedIcon, l.style.opacity = "0.6");
|
|
381
|
-
}),
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
const a =
|
|
385
|
-
a && (
|
|
381
|
+
}), r !== "none") {
|
|
382
|
+
const o = n[s];
|
|
383
|
+
o.classList.add(this.options.activeSortClass);
|
|
384
|
+
const a = o.querySelector(".material-icons");
|
|
385
|
+
a && (r === "asc" ? (o.classList.add(this.options.ascendingClass), a.textContent = this.options.ascendingIcon) : (o.classList.add(this.options.descendingClass), a.textContent = this.options.descendingIcon), a.style.opacity = "1");
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
389
389
|
* Restore original order (when sort direction is 'none')
|
|
390
390
|
*/
|
|
391
391
|
restoreOriginalOrder(t, e) {
|
|
392
|
-
const
|
|
393
|
-
e.forEach((
|
|
392
|
+
const s = t.querySelector("tbody");
|
|
393
|
+
e.forEach((r) => s.appendChild(r));
|
|
394
394
|
}
|
|
395
395
|
/**
|
|
396
396
|
* Add resizing functionality to a header
|
|
397
397
|
*/
|
|
398
|
-
addResizing(t, e,
|
|
398
|
+
addResizing(t, e, s, r) {
|
|
399
399
|
if (t.classList.add(this.options.resizableClass), t.style.position = "relative", t.querySelector(".resize-handle"))
|
|
400
400
|
return;
|
|
401
|
-
const
|
|
402
|
-
|
|
401
|
+
const n = document.createElement("div");
|
|
402
|
+
n.className = "resize-handle", n.style.cssText = `
|
|
403
403
|
position: absolute;
|
|
404
404
|
top: 0;
|
|
405
405
|
right: 0;
|
|
@@ -408,58 +408,58 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
408
408
|
background: transparent;
|
|
409
409
|
cursor: col-resize;
|
|
410
410
|
z-index: 10;
|
|
411
|
-
`, t.appendChild(
|
|
412
|
-
let
|
|
413
|
-
|
|
414
|
-
u.preventDefault(), u.stopPropagation(), u.stopImmediatePropagation(),
|
|
411
|
+
`, t.appendChild(n);
|
|
412
|
+
let o = !1, a = 0, l = 0;
|
|
413
|
+
n.addEventListener("mousedown", (u) => {
|
|
414
|
+
u.preventDefault(), u.stopPropagation(), u.stopImmediatePropagation(), o = !0, a = u.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", p), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
415
415
|
});
|
|
416
|
-
const c = /* @__PURE__ */
|
|
417
|
-
if (!
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
420
|
-
t.style.width =
|
|
421
|
-
const
|
|
416
|
+
const c = /* @__PURE__ */ d((u) => {
|
|
417
|
+
if (!o) return;
|
|
418
|
+
const h = l + (u.clientX - a);
|
|
419
|
+
if (h > 30) {
|
|
420
|
+
t.style.width = h + "px";
|
|
421
|
+
const g = Array.from(t.parentNode.children).indexOf(t), f = e.querySelector("tbody");
|
|
422
422
|
f && f.querySelectorAll("tr").forEach((y) => {
|
|
423
|
-
const b = y.children[
|
|
424
|
-
b && (b.style.width =
|
|
423
|
+
const b = y.children[g];
|
|
424
|
+
b && (b.style.width = h + "px");
|
|
425
425
|
}), this.updateTableWidth(e);
|
|
426
426
|
}
|
|
427
|
-
}, "handleResize"), p = /* @__PURE__ */
|
|
428
|
-
|
|
427
|
+
}, "handleResize"), p = /* @__PURE__ */ d(() => {
|
|
428
|
+
o = !1, t.style.borderRight = "", t.style.background = "", document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", p), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
429
429
|
}, "stopResize");
|
|
430
430
|
}
|
|
431
431
|
/**
|
|
432
432
|
* Add drag and drop functionality to a header
|
|
433
433
|
*/
|
|
434
|
-
addDragAndDrop(t, e,
|
|
434
|
+
addDragAndDrop(t, e, s, r) {
|
|
435
435
|
if (t.querySelector(".drag-handle"))
|
|
436
436
|
return;
|
|
437
437
|
t.classList.add(this.options.draggableClass), t.draggable = !0;
|
|
438
|
-
const
|
|
439
|
-
t.addEventListener("dragstart", (
|
|
438
|
+
const n = e.querySelector("thead tr");
|
|
439
|
+
t.addEventListener("dragstart", (o) => {
|
|
440
440
|
this.isDragging = !0;
|
|
441
|
-
const a = Array.from(
|
|
442
|
-
this.dragSource = { table: e, tableIndex:
|
|
441
|
+
const a = Array.from(n.children).indexOf(t);
|
|
442
|
+
this.dragSource = { table: e, tableIndex: s, columnIndex: a }, o.dataTransfer.effectAllowed = "move", o.dataTransfer.setData("text/html", t.outerHTML);
|
|
443
443
|
const l = t.outerHTML;
|
|
444
|
-
t.style.opacity = "0.5", this.createCustomDragImage(
|
|
445
|
-
}), t.addEventListener("dragend", (
|
|
444
|
+
t.style.opacity = "0.5", this.createCustomDragImage(o, t, l);
|
|
445
|
+
}), t.addEventListener("dragend", (o) => {
|
|
446
446
|
this.isDragging = !1, this.dragSource = null, t.style.opacity = "", this.clearAllColumnHighlights(e);
|
|
447
|
-
}), t.addEventListener("dragover", (
|
|
448
|
-
|
|
449
|
-
}), t.addEventListener("dragenter", (
|
|
450
|
-
if (
|
|
451
|
-
const a = Array.from(
|
|
447
|
+
}), t.addEventListener("dragover", (o) => {
|
|
448
|
+
o.preventDefault(), o.dataTransfer.dropEffect = "move";
|
|
449
|
+
}), t.addEventListener("dragenter", (o) => {
|
|
450
|
+
if (o.preventDefault(), this.dragSource && this.dragSource.tableIndex === s) {
|
|
451
|
+
const a = Array.from(n.children).indexOf(t);
|
|
452
452
|
this.dragSource.columnIndex !== a && this.highlightColumn(e, a, !0);
|
|
453
453
|
}
|
|
454
|
-
}), t.addEventListener("dragleave", (
|
|
455
|
-
if (!t.contains(
|
|
456
|
-
const a = Array.from(
|
|
454
|
+
}), t.addEventListener("dragleave", (o) => {
|
|
455
|
+
if (!t.contains(o.relatedTarget)) {
|
|
456
|
+
const a = Array.from(n.children).indexOf(t);
|
|
457
457
|
this.highlightColumn(e, a, !1);
|
|
458
458
|
}
|
|
459
|
-
}), t.addEventListener("drop", (
|
|
460
|
-
if (
|
|
461
|
-
const a = Array.from(
|
|
462
|
-
this.dragSource.columnIndex !== a && this.reorderColumns(e,
|
|
459
|
+
}), t.addEventListener("drop", (o) => {
|
|
460
|
+
if (o.preventDefault(), this.dragSource && this.dragSource.tableIndex === s) {
|
|
461
|
+
const a = Array.from(n.children).indexOf(t);
|
|
462
|
+
this.dragSource.columnIndex !== a && this.reorderColumns(e, s, this.dragSource.columnIndex, a);
|
|
463
463
|
}
|
|
464
464
|
this.clearAllColumnHighlights(e);
|
|
465
465
|
});
|
|
@@ -467,9 +467,9 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
467
467
|
/**
|
|
468
468
|
* Create a custom drag image for better UX
|
|
469
469
|
*/
|
|
470
|
-
createCustomDragImage(t, e,
|
|
471
|
-
const
|
|
472
|
-
|
|
470
|
+
createCustomDragImage(t, e, s) {
|
|
471
|
+
const r = document.createElement("div");
|
|
472
|
+
r.style.cssText = `
|
|
473
473
|
position: absolute;
|
|
474
474
|
top: -1000px;
|
|
475
475
|
left: -1000px;
|
|
@@ -492,34 +492,34 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
492
492
|
display: flex;
|
|
493
493
|
align-items: center;
|
|
494
494
|
`;
|
|
495
|
-
const
|
|
496
|
-
|
|
495
|
+
const n = s;
|
|
496
|
+
r.innerHTML = `
|
|
497
497
|
<div style="display: flex; align-items: center; gap: 5px; align-content: center;color:white;">
|
|
498
|
-
<span style="overflow: hidden; text-overflow: ellipsis">${
|
|
498
|
+
<span style="overflow: hidden; text-overflow: ellipsis">${n}</span>
|
|
499
499
|
<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>
|
|
500
500
|
</div>
|
|
501
|
-
`, document.body.appendChild(
|
|
502
|
-
document.body.contains(
|
|
501
|
+
`, document.body.appendChild(r), t.dataTransfer.setDragImage(r, 50, 12), setTimeout(() => {
|
|
502
|
+
document.body.contains(r) && document.body.removeChild(r);
|
|
503
503
|
}, 100);
|
|
504
504
|
}
|
|
505
505
|
/**
|
|
506
506
|
* Highlight an entire column during drag operations
|
|
507
507
|
*/
|
|
508
|
-
highlightColumn(t, e,
|
|
509
|
-
const
|
|
510
|
-
if (!
|
|
511
|
-
const
|
|
512
|
-
if (
|
|
513
|
-
if (
|
|
514
|
-
|
|
515
|
-
const a =
|
|
508
|
+
highlightColumn(t, e, s) {
|
|
509
|
+
const r = t.querySelector("thead tr"), n = t.querySelector("tbody");
|
|
510
|
+
if (!r || !n) return;
|
|
511
|
+
const o = r.children[e];
|
|
512
|
+
if (o)
|
|
513
|
+
if (s) {
|
|
514
|
+
o.classList.add(this.options.dragOverClass);
|
|
515
|
+
const a = n.children;
|
|
516
516
|
for (let l = 0; l < a.length; l++) {
|
|
517
517
|
const c = a[l].children[e];
|
|
518
518
|
c && c.classList.add(this.options.dragOverClass);
|
|
519
519
|
}
|
|
520
520
|
} else {
|
|
521
|
-
|
|
522
|
-
const a =
|
|
521
|
+
o.classList.remove(this.options.dragOverClass);
|
|
522
|
+
const a = n.children;
|
|
523
523
|
for (let l = 0; l < a.length; l++) {
|
|
524
524
|
const c = a[l].children[e];
|
|
525
525
|
c && c.classList.remove(this.options.dragOverClass);
|
|
@@ -530,14 +530,14 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
530
530
|
* Clear all column highlights
|
|
531
531
|
*/
|
|
532
532
|
clearAllColumnHighlights(t) {
|
|
533
|
-
const e = t.querySelector("thead tr"),
|
|
534
|
-
if (!e || !
|
|
535
|
-
const
|
|
536
|
-
for (let
|
|
537
|
-
|
|
538
|
-
const
|
|
539
|
-
for (let
|
|
540
|
-
const a = o
|
|
533
|
+
const e = t.querySelector("thead tr"), s = t.querySelector("tbody");
|
|
534
|
+
if (!e || !s) return;
|
|
535
|
+
const r = e.children;
|
|
536
|
+
for (let o = 0; o < r.length; o++)
|
|
537
|
+
r[o].classList.remove(this.options.dragOverClass);
|
|
538
|
+
const n = s.children;
|
|
539
|
+
for (let o = 0; o < n.length; o++) {
|
|
540
|
+
const a = n[o].children;
|
|
541
541
|
for (let l = 0; l < a.length; l++)
|
|
542
542
|
a[l].classList.remove(this.options.dragOverClass);
|
|
543
543
|
}
|
|
@@ -545,25 +545,25 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
545
545
|
/**
|
|
546
546
|
* Reorder columns in a table
|
|
547
547
|
*/
|
|
548
|
-
reorderColumns(t, e,
|
|
549
|
-
const
|
|
550
|
-
if (!
|
|
551
|
-
const a = Array.from(
|
|
552
|
-
if (
|
|
548
|
+
reorderColumns(t, e, s, r) {
|
|
549
|
+
const n = t.querySelector("thead tr"), o = t.querySelector("tbody");
|
|
550
|
+
if (!n || !o) return;
|
|
551
|
+
const a = Array.from(n.children), l = Array.from(o.children);
|
|
552
|
+
if (s < 0 || s >= a.length || r < 0 || r >= a.length) {
|
|
553
553
|
console.warn("Invalid column indices for reordering");
|
|
554
554
|
return;
|
|
555
555
|
}
|
|
556
|
-
if (
|
|
556
|
+
if (s === r)
|
|
557
557
|
return;
|
|
558
|
-
const c = a[
|
|
559
|
-
|
|
560
|
-
const f = Array.from(
|
|
561
|
-
|
|
558
|
+
const c = a[s], p = a[r];
|
|
559
|
+
s < r ? n.insertBefore(c, p.nextSibling) : n.insertBefore(c, p), l.forEach((h, g) => {
|
|
560
|
+
const f = Array.from(h.children), m = f[s], y = f[r];
|
|
561
|
+
s < r ? h.insertBefore(m, y.nextSibling) : h.insertBefore(m, y);
|
|
562
562
|
});
|
|
563
563
|
const u = this.originalColumnOrder.get(e);
|
|
564
564
|
if (u) {
|
|
565
|
-
const
|
|
566
|
-
|
|
565
|
+
const h = [...u], g = h[s];
|
|
566
|
+
h.splice(s, 1), h.splice(r, 0, g), this.originalColumnOrder.set(e, h);
|
|
567
567
|
}
|
|
568
568
|
this.applyTableStyles(t), this.refreshDragAndDropListeners(t, e);
|
|
569
569
|
}
|
|
@@ -571,13 +571,13 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
571
571
|
* Refresh drag and drop listeners after column reordering
|
|
572
572
|
*/
|
|
573
573
|
refreshDragAndDropListeners(t, e) {
|
|
574
|
-
const
|
|
575
|
-
if (!
|
|
576
|
-
Array.from(
|
|
577
|
-
if (
|
|
578
|
-
|
|
579
|
-
const a =
|
|
580
|
-
|
|
574
|
+
const s = t.querySelector("thead tr");
|
|
575
|
+
if (!s) return;
|
|
576
|
+
Array.from(s.children).forEach((n, o) => {
|
|
577
|
+
if (n.classList.contains(this.options.draggableClass)) {
|
|
578
|
+
n.style.opacity = "", n.style.background = "", n.style.borderRight = "";
|
|
579
|
+
const a = n.cloneNode(!0);
|
|
580
|
+
n.parentNode.replaceChild(a, n), this.makeHeaderSortable(a, t, e, o);
|
|
581
581
|
}
|
|
582
582
|
});
|
|
583
583
|
}
|
|
@@ -586,47 +586,47 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
586
586
|
*/
|
|
587
587
|
updateTableWidth(t) {
|
|
588
588
|
const e = t.querySelectorAll("th");
|
|
589
|
-
let
|
|
590
|
-
e.forEach((
|
|
591
|
-
const
|
|
592
|
-
if (
|
|
593
|
-
const
|
|
594
|
-
|
|
589
|
+
let s = 0;
|
|
590
|
+
e.forEach((r) => {
|
|
591
|
+
const n = r.style.width;
|
|
592
|
+
if (n) {
|
|
593
|
+
const o = parseInt(n.replace("px", ""));
|
|
594
|
+
s += o;
|
|
595
595
|
} else {
|
|
596
|
-
const
|
|
597
|
-
|
|
596
|
+
const o = r.textContent.replace(/[📊🔍]/g, "").trim();
|
|
597
|
+
s += o.length;
|
|
598
598
|
}
|
|
599
|
-
}), t.style.width = `${
|
|
599
|
+
}), t.style.width = `${s}px`;
|
|
600
600
|
}
|
|
601
601
|
/**
|
|
602
602
|
* Calculate intelligent table width based on header text length
|
|
603
603
|
*/
|
|
604
604
|
calculateTableWidth(t) {
|
|
605
605
|
var u;
|
|
606
|
-
const e = t.getAttribute("data-original-width"),
|
|
607
|
-
let
|
|
606
|
+
const e = t.getAttribute("data-original-width"), s = e ? parseFloat(e) : 0, r = t.querySelectorAll("th");
|
|
607
|
+
let n = 0;
|
|
608
608
|
t.parentElement.clientWidth;
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
let f =
|
|
612
|
-
|
|
609
|
+
const o = [];
|
|
610
|
+
r.forEach((h) => {
|
|
611
|
+
let f = h.textContent.replace(/[📊🔍]/g, "").trim().length * this.charWidth + 15;
|
|
612
|
+
o.push(f), n += f;
|
|
613
613
|
});
|
|
614
|
-
const a = t.querySelectorAll("tr"), l = ((u = t.parentElement) == null ? void 0 : u.getBoundingClientRect().width) ??
|
|
614
|
+
const a = t.querySelectorAll("tr"), l = ((u = t.parentElement) == null ? void 0 : u.getBoundingClientRect().width) ?? n;
|
|
615
615
|
var c = 0;
|
|
616
|
-
for (const
|
|
617
|
-
|
|
616
|
+
for (const h of a)
|
|
617
|
+
h.querySelectorAll("td").forEach((f, m) => {
|
|
618
618
|
const b = f.textContent.length * this.charWidth + 15;
|
|
619
|
-
b >
|
|
619
|
+
b > o[m] && m < o.length && (o[m] = b);
|
|
620
620
|
});
|
|
621
|
-
c =
|
|
621
|
+
c = o.reduce((h, g) => h += g, 0), r.forEach((h, g) => {
|
|
622
622
|
if (c > l) {
|
|
623
|
-
const f =
|
|
624
|
-
|
|
623
|
+
const f = o[g] / c;
|
|
624
|
+
h.style.width = `${l * f}px`;
|
|
625
625
|
} else
|
|
626
|
-
|
|
626
|
+
h.style.width = `${o[g]}px`;
|
|
627
627
|
});
|
|
628
628
|
let p = 0;
|
|
629
|
-
return c > l ? p = "100%" : p = `${Math.max(c,
|
|
629
|
+
return c > l ? p = "100%" : p = `${Math.max(c, s)}px`, p;
|
|
630
630
|
}
|
|
631
631
|
/**
|
|
632
632
|
* Apply inline styles to ensure text clipping and horizontal scroll work
|
|
@@ -635,9 +635,9 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
635
635
|
const e = this.calculateTableWidth(t);
|
|
636
636
|
t.style.width = e, t.style.maxWidth = "100%";
|
|
637
637
|
}
|
|
638
|
-
getCharWidth(t, e,
|
|
639
|
-
const
|
|
640
|
-
return
|
|
638
|
+
getCharWidth(t, e, s) {
|
|
639
|
+
const n = document.createElement("canvas").getContext("2d");
|
|
640
|
+
return n.fontFamily = e, n.fontMono = s, n.measureText("A ").width;
|
|
641
641
|
}
|
|
642
642
|
/**
|
|
643
643
|
* Add CSS styles for sortable tables
|
|
@@ -779,19 +779,19 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
779
779
|
*/
|
|
780
780
|
destroy() {
|
|
781
781
|
this.tables.forEach((e) => {
|
|
782
|
-
e.querySelectorAll(`.${this.options.sortableClass}`).forEach((
|
|
783
|
-
|
|
782
|
+
e.querySelectorAll(`.${this.options.sortableClass}`).forEach((r) => {
|
|
783
|
+
r.classList.remove(
|
|
784
784
|
this.options.sortableClass,
|
|
785
785
|
this.options.activeSortClass,
|
|
786
786
|
this.options.ascendingClass,
|
|
787
787
|
this.options.descendingClass
|
|
788
|
-
),
|
|
789
|
-
const
|
|
790
|
-
|
|
788
|
+
), r.style.cursor = "", r.style.background = "";
|
|
789
|
+
const n = r.cloneNode(!0);
|
|
790
|
+
r.parentNode.replaceChild(n, r);
|
|
791
791
|
});
|
|
792
792
|
});
|
|
793
793
|
const t = document.getElementById("sortable-table-styles");
|
|
794
|
-
t && t.remove(), this.tables = [], this.sortStates.clear(),
|
|
794
|
+
t && t.remove(), this.tables = [], this.sortStates.clear(), C.clear();
|
|
795
795
|
}
|
|
796
796
|
/**
|
|
797
797
|
* Refresh the library (useful after DOM changes)
|
|
@@ -800,88 +800,132 @@ const S = /* @__PURE__ */ new Set(), C = class C {
|
|
|
800
800
|
this.destroy(), this.init();
|
|
801
801
|
}
|
|
802
802
|
};
|
|
803
|
-
|
|
804
|
-
let w =
|
|
803
|
+
d(S, "SortableTable");
|
|
804
|
+
let w = S;
|
|
805
805
|
typeof window < "u" && (window.SortableTable = w);
|
|
806
|
-
const x = /* @__PURE__ */ new Set(["/", "@", "#"]), W = /* @__PURE__ */
|
|
806
|
+
const x = /* @__PURE__ */ new Set(["/", "@", "#"]), W = /* @__PURE__ */ d((i) => i === "/" ? "slash" : i === "@" ? "at" : "hash", "triggerTypeFor"), v = /[ \t\r\n\f\v]/, V = /* @__PURE__ */ d((i) => {
|
|
807
807
|
if (!i) return [];
|
|
808
808
|
const t = [];
|
|
809
809
|
let e = 0;
|
|
810
810
|
for (; e < i.length; ) {
|
|
811
|
-
const
|
|
812
|
-
if ((e === 0 || v.test(i[e - 1])) && x.has(
|
|
813
|
-
let
|
|
814
|
-
for (;
|
|
815
|
-
t.push({ type: W(
|
|
811
|
+
const s = i[e];
|
|
812
|
+
if ((e === 0 || v.test(i[e - 1])) && x.has(s)) {
|
|
813
|
+
let n = e + 1;
|
|
814
|
+
for (; n < i.length && !v.test(i[n]); ) n += 1;
|
|
815
|
+
t.push({ type: W(s), text: i.slice(e, n) }), e = n;
|
|
816
816
|
} else {
|
|
817
|
-
let
|
|
818
|
-
for (;
|
|
819
|
-
const
|
|
820
|
-
if (x.has(
|
|
821
|
-
|
|
817
|
+
let n = e + 1;
|
|
818
|
+
for (; n < i.length; ) {
|
|
819
|
+
const o = i[n], a = v.test(i[n - 1]);
|
|
820
|
+
if (x.has(o) && a) break;
|
|
821
|
+
n += 1;
|
|
822
822
|
}
|
|
823
|
-
t.push({ type: "plain", text: i.slice(e,
|
|
823
|
+
t.push({ type: "plain", text: i.slice(e, n) }), e = n;
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
return t;
|
|
827
|
-
}, "tokenizeForHighlight"),
|
|
828
|
-
const e = t.filter((
|
|
827
|
+
}, "tokenizeForHighlight"), U = /* @__PURE__ */ d((i, t) => {
|
|
828
|
+
const e = t.filter((r) => r.trim().length > 0).sort((r, n) => n.length - r.length);
|
|
829
829
|
if (e.length === 0) return i;
|
|
830
|
-
const
|
|
831
|
-
for (const
|
|
832
|
-
if (
|
|
833
|
-
|
|
830
|
+
const s = [];
|
|
831
|
+
for (const r of i) {
|
|
832
|
+
if (r.type !== "plain") {
|
|
833
|
+
s.push(r);
|
|
834
834
|
continue;
|
|
835
835
|
}
|
|
836
|
-
let
|
|
837
|
-
for (;
|
|
838
|
-
let
|
|
836
|
+
let n = r.text;
|
|
837
|
+
for (; n.length > 0; ) {
|
|
838
|
+
let o = -1, a = 0;
|
|
839
839
|
for (const l of e) {
|
|
840
|
-
const c =
|
|
841
|
-
c >= 0 && (
|
|
840
|
+
const c = n.indexOf(l);
|
|
841
|
+
c >= 0 && (o === -1 || c < o) && (o = c, a = l.length);
|
|
842
842
|
}
|
|
843
|
-
if (
|
|
844
|
-
|
|
843
|
+
if (o === -1) {
|
|
844
|
+
s.push({ type: "plain", text: n });
|
|
845
845
|
break;
|
|
846
846
|
}
|
|
847
|
-
|
|
847
|
+
o > 0 && s.push({ type: "plain", text: n.slice(0, o) }), s.push({ type: "at", text: n.slice(o, o + a) }), n = n.slice(o + a);
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
|
-
return
|
|
851
|
-
}, "chipLocations");
|
|
852
|
-
|
|
853
|
-
|
|
850
|
+
return s;
|
|
851
|
+
}, "chipLocations"), M = 2;
|
|
852
|
+
function P(i, t) {
|
|
853
|
+
let e = 0;
|
|
854
|
+
for (let s = t - 1; s >= 0; s -= 1) {
|
|
855
|
+
const r = i[s];
|
|
856
|
+
if (r === "/" || r === "@" || r === "#")
|
|
857
|
+
return !(s === 0 || /\s/.test(i[s - 1])) || r !== "@" && e > 0 ? null : {
|
|
858
|
+
trigger: r,
|
|
859
|
+
query: i.slice(s + 1, t),
|
|
860
|
+
startIdx: s,
|
|
861
|
+
endIdx: t
|
|
862
|
+
};
|
|
863
|
+
if (r === " ") return null;
|
|
864
|
+
if (r === " " || r === " ") {
|
|
865
|
+
if (e += 1, e > M) return null;
|
|
866
|
+
continue;
|
|
867
|
+
}
|
|
868
|
+
if (/\s/.test(r)) return null;
|
|
869
|
+
}
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
d(P, "detectTrigger");
|
|
873
|
+
const q = /\[[^\]\n]+\]/;
|
|
874
|
+
function X(i, t, e) {
|
|
875
|
+
const s = i.slice(0, t.startIdx), r = i.slice(t.endIdx), n = q.exec(e);
|
|
876
|
+
if (n) {
|
|
877
|
+
const c = s.length + n.index;
|
|
878
|
+
return {
|
|
879
|
+
next: `${s}${e}${r}`,
|
|
880
|
+
selectionStart: c,
|
|
881
|
+
selectionEnd: c + n[0].length,
|
|
882
|
+
reopenTrigger: !1
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
const o = e[e.length - 1];
|
|
886
|
+
if (o === "@" || o === "#" || o === "/") {
|
|
887
|
+
const c = s.length + e.length;
|
|
888
|
+
return { next: `${s}${e}${r}`, selectionStart: c, selectionEnd: c, reopenTrigger: !0 };
|
|
889
|
+
}
|
|
890
|
+
const a = `${e} `, l = s.length + a.length;
|
|
891
|
+
return { next: `${s}${a}${r}`, selectionStart: l, selectionEnd: l, reopenTrigger: !1 };
|
|
892
|
+
}
|
|
893
|
+
d(X, "applyTriggerInsertion");
|
|
894
|
+
async function G(i, { onAtQuery: t, onAtPersonQuery: e }, { personConfidence: s = 0, locationConfidence: r = 0, personFirstThreshold: n = 0.5 } = {}) {
|
|
895
|
+
const [o, a] = await Promise.all([
|
|
854
896
|
t ? t(i).catch(() => []) : Promise.resolve([]),
|
|
855
897
|
e ? e(i).catch(() => []) : Promise.resolve([])
|
|
856
898
|
]);
|
|
857
899
|
if (t && e) {
|
|
858
|
-
const l = a.map((u) => ({ ...u, group: "person" })), c =
|
|
859
|
-
return
|
|
900
|
+
const l = a.map((u) => ({ ...u, group: "person" })), c = o.map((u) => ({ ...u, group: "location" }));
|
|
901
|
+
return s >= n && s >= r ? [...l, ...c] : [...c, ...l];
|
|
860
902
|
}
|
|
861
|
-
return [...a, ...
|
|
903
|
+
return [...a, ...o];
|
|
862
904
|
}
|
|
863
|
-
|
|
864
|
-
function
|
|
865
|
-
var
|
|
866
|
-
const e = (
|
|
867
|
-
return e !== void 0 && (t === 0 || ((
|
|
905
|
+
d(G, "fetchAtMentions");
|
|
906
|
+
function j(i, t) {
|
|
907
|
+
var s, r;
|
|
908
|
+
const e = (s = i[t]) == null ? void 0 : s.group;
|
|
909
|
+
return e !== void 0 && (t === 0 || ((r = i[t - 1]) == null ? void 0 : r.group) !== e);
|
|
868
910
|
}
|
|
869
|
-
|
|
911
|
+
d(j, "isSectionStart");
|
|
870
912
|
export {
|
|
871
913
|
w as S,
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
914
|
+
X as a,
|
|
915
|
+
T as b,
|
|
916
|
+
U as c,
|
|
917
|
+
P as d,
|
|
918
|
+
$ as e,
|
|
919
|
+
F as f,
|
|
920
|
+
G as g,
|
|
921
|
+
B as h,
|
|
922
|
+
j as i,
|
|
923
|
+
I as j,
|
|
924
|
+
_ as k,
|
|
925
|
+
z as l,
|
|
926
|
+
R as m,
|
|
927
|
+
O as p,
|
|
928
|
+
H as s,
|
|
929
|
+
V as t
|
|
886
930
|
};
|
|
887
|
-
//# sourceMappingURL=atMentions-
|
|
931
|
+
//# sourceMappingURL=atMentions-BQ-FxbtK.js.map
|