@aintela/chat 0.2.18 → 0.2.22
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/{auth-CcTgInbY.js → auth-DbmLacBc.js} +2 -2
- package/dist/{auth-CcTgInbY.js.map → auth-DbmLacBc.js.map} +1 -1
- package/dist/components.js +5868 -5530
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +5 -4
- package/dist/{httpArtifactService-BAR60Gu1.js → httpArtifactService-Dh9LGQ9a.js} +2 -2
- package/dist/{httpArtifactService-BAR60Gu1.js.map → httpArtifactService-Dh9LGQ9a.js.map} +1 -1
- package/dist/index.js +126 -122
- package/dist/{sortable-table-DgQHxWIh.js → promptHighlight-BHSQkdFs.js} +330 -282
- package/dist/promptHighlight-BHSQkdFs.js.map +1 -0
- package/dist/services.js +1 -1
- package/dist/src/components/AiChat/AiChatContext.d.ts +14 -2
- package/dist/src/components/AiChat/AiChatTypes.d.ts +28 -0
- package/dist/src/components/AiChat/ChatPane/AskUserSheet.d.ts +2 -1
- package/dist/src/components/AiChat/ChatPane/GuestIcon.d.ts +19 -0
- package/dist/src/components/AiChat/ChatPane/parts/AskAuthPart.d.ts +8 -0
- package/dist/src/components/AiChat/ChatPane/parts/types.d.ts +6 -1
- package/dist/src/components/index.d.ts +1 -1
- package/dist/src/components/v2/PromptDateMarkers.d.ts +15 -0
- package/dist/src/components/v2/PromptV2.d.ts +18 -0
- package/dist/src/components/v2/index.d.ts +2 -0
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/usePromptAssist.d.ts +58 -0
- package/dist/src/services/httpPromptAssistService.d.ts +58 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/promptHighlight.d.ts +16 -0
- package/dist/useContainerWidth-DsNHNR-z.js +187 -0
- package/dist/useContainerWidth-DsNHNR-z.js.map +1 -0
- package/dist/utils.js +34 -32
- package/package.json +1 -1
- package/dist/sortable-table-DgQHxWIh.js.map +0 -1
- package/dist/useContainerWidth-Df2PmSoC.js +0 -52
- package/dist/useContainerWidth-Df2PmSoC.js.map +0 -1
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
var
|
|
2
|
-
var h = (
|
|
3
|
-
const
|
|
4
|
-
if (
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var h = (i, t) => L(i, "name", { value: t, configurable: !0 });
|
|
3
|
+
const D = /* @__PURE__ */ h((i) => {
|
|
4
|
+
if (i[0] == "#")
|
|
5
5
|
return null;
|
|
6
|
-
const t =
|
|
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
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
16
|
-
switch (
|
|
10
|
+
const r = e.split("?")[0];
|
|
11
|
+
return r.startsWith("#") ? r : r.split("#")[0];
|
|
12
|
+
}, "parseAndValidateArtifactUrl"), M = /* @__PURE__ */ h((i, t, e) => {
|
|
13
|
+
let r = "URL", n = null, o = null, s = null;
|
|
14
|
+
if (i[0] == "#") {
|
|
15
|
+
const a = i.indexOf("-"), l = i.slice(1, a);
|
|
16
|
+
switch (s = i.slice(a + 1), l.toLowerCase()) {
|
|
17
17
|
case "opendashboard":
|
|
18
|
-
|
|
18
|
+
r = "OpenDashboard";
|
|
19
19
|
break;
|
|
20
20
|
case "ask":
|
|
21
|
-
|
|
21
|
+
r = "Question", n = e;
|
|
22
22
|
break;
|
|
23
23
|
}
|
|
24
24
|
} else
|
|
25
|
-
|
|
26
|
-
return { action:
|
|
27
|
-
}, "extractLinkAction"),
|
|
28
|
-
{ length: Math.ceil(
|
|
29
|
-
(e,
|
|
30
|
-
), "chunkArray"),
|
|
31
|
-
|
|
25
|
+
i.indexOf("http") > -1 ? (r = "URL", o = i) : (i = i.replaceAll("exported/", `exported/${t}/`), r = "Export");
|
|
26
|
+
return { action: r, url: o, question: n, parameter: s };
|
|
27
|
+
}, "extractLinkAction"), T = /* @__PURE__ */ h((i, t) => Array.from(
|
|
28
|
+
{ length: Math.ceil(i.length / t) },
|
|
29
|
+
(e, r) => i.slice(r * t, r * t + t)
|
|
30
|
+
), "chunkArray"), O = /* @__PURE__ */ h((i) => {
|
|
31
|
+
i = i.replaceAll("\\n", `
|
|
32
32
|
`);
|
|
33
|
-
const t = 90, e =
|
|
34
|
-
let
|
|
35
|
-
for (const
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
const
|
|
33
|
+
const t = 90, e = i.split(" "), r = [];
|
|
34
|
+
let n = !1;
|
|
35
|
+
for (const o of e)
|
|
36
|
+
if (o.length > t) {
|
|
37
|
+
n = !0;
|
|
38
|
+
const s = [...o], l = T(s, t).map((c) => c.join("")).join(`
|
|
39
39
|
`);
|
|
40
|
-
|
|
40
|
+
r.push(l);
|
|
41
41
|
} else
|
|
42
|
-
|
|
43
|
-
return
|
|
42
|
+
r.push(o);
|
|
43
|
+
return n ? r.join(" ") : i;
|
|
44
44
|
}, "splitBigLinesWithSpaces");
|
|
45
|
-
function
|
|
46
|
-
let t = parseFloat(
|
|
45
|
+
function k(i) {
|
|
46
|
+
let t = parseFloat(i);
|
|
47
47
|
if (!isNaN(t))
|
|
48
|
-
return
|
|
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 n of i)
|
|
51
|
+
n.match(/[0-9]/) && (e += n);
|
|
52
|
+
const r = e.length / i.length;
|
|
53
|
+
return t = parseInt(e), !isNaN(t) && r > 0.5 ? t : NaN;
|
|
54
54
|
}
|
|
55
|
-
h(
|
|
56
|
-
function
|
|
57
|
-
if (!
|
|
55
|
+
h(k, "parseRawNumber");
|
|
56
|
+
function H(i) {
|
|
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
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
let
|
|
66
|
-
if (!isNaN(
|
|
67
|
-
return
|
|
68
|
-
var
|
|
69
|
-
for (const
|
|
70
|
-
if (
|
|
71
|
-
let l =
|
|
72
|
-
l == "." ? l = "" : l == "," && (l = "."),
|
|
59
|
+
let r = "", n = "";
|
|
60
|
+
if (i.match(t)) {
|
|
61
|
+
i.indexOf("%") > -1 && (n = " %");
|
|
62
|
+
const a = i.match(e);
|
|
63
|
+
a && (r = a[0] + " ");
|
|
64
|
+
}
|
|
65
|
+
let o = parseFloat(i);
|
|
66
|
+
if (!isNaN(o))
|
|
67
|
+
return i = i.replaceAll(".", "").replaceAll(",", "."), { prefix: r, suffix: n, number: parseFloat(i) };
|
|
68
|
+
var s = "";
|
|
69
|
+
for (const a of i)
|
|
70
|
+
if (a.match(/[0-9.,]/)) {
|
|
71
|
+
let l = a;
|
|
72
|
+
l == "." ? l = "" : l == "," && (l = "."), s += l;
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return o = parseFloat(s), isNaN(o) ? { prefix: void 0, suffix: void 0, number: void 0 } : { prefix: r, suffix: n, number: o };
|
|
75
75
|
}
|
|
76
|
-
h(
|
|
77
|
-
const
|
|
78
|
-
function
|
|
79
|
-
if (!
|
|
76
|
+
h(H, "parseKnownNumbers");
|
|
77
|
+
const A = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i, E = /^[0-9a-f]{32}/i;
|
|
78
|
+
function F(i) {
|
|
79
|
+
if (!i || typeof i != "string")
|
|
80
80
|
return !1;
|
|
81
|
-
const t =
|
|
82
|
-
return t === null ? !1 :
|
|
81
|
+
const t = N(i);
|
|
82
|
+
return t === null ? !1 : i.startsWith(t);
|
|
83
83
|
}
|
|
84
|
-
h(
|
|
85
|
-
function
|
|
86
|
-
if (!
|
|
84
|
+
h(F, "startsWithInteractionId");
|
|
85
|
+
function N(i) {
|
|
86
|
+
if (!i || typeof i != "string")
|
|
87
87
|
return null;
|
|
88
|
-
const t =
|
|
88
|
+
const t = i.match(A);
|
|
89
89
|
if (t)
|
|
90
90
|
return t[0];
|
|
91
|
-
const e =
|
|
91
|
+
const e = i.match(E);
|
|
92
92
|
return e ? e[0] : null;
|
|
93
93
|
}
|
|
94
|
-
h(
|
|
95
|
-
function
|
|
96
|
-
const
|
|
97
|
-
return
|
|
94
|
+
h(N, "extractInteractionId");
|
|
95
|
+
function R(i) {
|
|
96
|
+
const r = i.replaceAll("_", " ").replaceAll("-", " ").replaceAll("user:", "").replace(/\.[^/.]+$/, ""), n = $(r).trim();
|
|
97
|
+
return n.length > 1 ? n[0].toUpperCase() + n.slice(1) : n;
|
|
98
98
|
}
|
|
99
|
-
h(
|
|
100
|
-
function
|
|
101
|
-
if (
|
|
102
|
-
return
|
|
103
|
-
const t =
|
|
99
|
+
h(R, "prettiffyFileName");
|
|
100
|
+
function z(i) {
|
|
101
|
+
if (i.length == 0)
|
|
102
|
+
return i;
|
|
103
|
+
const t = i.replaceAll("_", " ").replaceAll("-", " ");
|
|
104
104
|
return t[0].toUpperCase() + t.slice(1);
|
|
105
105
|
}
|
|
106
|
-
h(
|
|
107
|
-
function
|
|
108
|
-
const t =
|
|
106
|
+
h(z, "prettiffyPythonFunctionName");
|
|
107
|
+
function $(i) {
|
|
108
|
+
const t = i.match(A);
|
|
109
109
|
if (t)
|
|
110
|
-
return
|
|
111
|
-
const e =
|
|
112
|
-
return e ?
|
|
110
|
+
return i.replace(t[0], "");
|
|
111
|
+
const e = i.match(E);
|
|
112
|
+
return e ? i.replace(e[0], "") : i;
|
|
113
113
|
}
|
|
114
|
-
h(
|
|
115
|
-
function
|
|
116
|
-
return !
|
|
114
|
+
h($, "extractNameFromStringWithInteractionId");
|
|
115
|
+
function _(i) {
|
|
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
|
-
h(
|
|
119
|
-
const
|
|
118
|
+
h(_, "isValidInteractionId");
|
|
119
|
+
const S = /* @__PURE__ */ new Set(), C = class C {
|
|
120
120
|
constructor(t = {}) {
|
|
121
121
|
this.options = {
|
|
122
122
|
// CSS class for sortable headers
|
|
@@ -199,8 +199,8 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
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 r = (t || document).querySelectorAll("table");
|
|
203
|
+
this.tables = Array.from(r);
|
|
204
204
|
}
|
|
205
205
|
/**
|
|
206
206
|
* Make all found tables sortable
|
|
@@ -214,20 +214,20 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
214
214
|
* Make a specific table sortable
|
|
215
215
|
*/
|
|
216
216
|
makeTableSortable(t, e) {
|
|
217
|
-
let
|
|
218
|
-
if (
|
|
217
|
+
let r = t.querySelector("thead"), n = null, o = [];
|
|
218
|
+
if (r && (n = r.querySelector("tr"), n && (o = n.querySelectorAll("th"))), o.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 s = !t.hasAttribute("data-sortable-arrived");
|
|
223
|
+
t.classList.add("sortable-table"), s && (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(
|
|
229
|
-
this.options.excludeColumns.includes(l) || this.makeHeaderSortable(
|
|
230
|
-
}), this.replaceExponentialValues(t),
|
|
228
|
+
}), t.hasAttribute("data-original-width") || t.setAttribute("data-original-width", t.getBoundingClientRect().width), this.applyTableStyles(t), this.originalColumnOrder.set(e, Array.from(o).map((a, l) => l)), o.forEach((a, l) => {
|
|
229
|
+
this.options.excludeColumns.includes(l) || this.makeHeaderSortable(a, t, e, l);
|
|
230
|
+
}), this.replaceExponentialValues(t), S.add(t);
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
233
233
|
* Replace exponential values in table cells with full numbers
|
|
@@ -236,12 +236,12 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
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((n) => {
|
|
240
|
+
n.querySelectorAll("td, th").forEach((s) => {
|
|
241
|
+
const l = s.textContent.trim().match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
|
|
242
242
|
if (l) {
|
|
243
243
|
const c = parseFloat(l[1].replace(/,/g, "")), u = parseInt(l[2]), p = c * Math.pow(10, u), d = this.formatNumber(p);
|
|
244
|
-
|
|
244
|
+
s.textContent = d;
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
});
|
|
@@ -261,32 +261,32 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
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, r) {
|
|
265
265
|
try {
|
|
266
|
-
const
|
|
267
|
-
return
|
|
268
|
-
const
|
|
269
|
-
Array.from(
|
|
270
|
-
|
|
271
|
-
}),
|
|
272
|
-
}),
|
|
273
|
-
} catch (
|
|
274
|
-
return console.error("Error converting row to header:",
|
|
266
|
+
const n = t.cloneNode(!0);
|
|
267
|
+
return n.querySelectorAll("td").forEach((s) => {
|
|
268
|
+
const a = document.createElement("th");
|
|
269
|
+
Array.from(s.attributes).forEach((l) => {
|
|
270
|
+
a.setAttribute(l.name, l.value);
|
|
271
|
+
}), a.innerHTML = s.innerHTML, a.style.cssText = s.style.cssText, s.parentNode.replaceChild(a, s);
|
|
272
|
+
}), r && r.contains(t) ? r.removeChild(t) : t.parentNode && t.parentNode.removeChild(t), e.appendChild(n), n;
|
|
273
|
+
} catch (n) {
|
|
274
|
+
return console.error("Error converting row to header:", n), 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, r, n) {
|
|
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, r, n), this.options.enableReordering && this.addDragAndDrop(t, e, r, n);
|
|
282
|
+
const o = /* @__PURE__ */ h((l) => {
|
|
283
|
+
l.preventDefault(), this.sortTable(e, r, n);
|
|
284
|
+
}, "clickListener"), s = /* @__PURE__ */ h((l) => {
|
|
285
285
|
t.classList.contains(this.options.activeSortClass) || (t.style.background = this.options.theme.palette.surface.hover);
|
|
286
|
-
}, "mouseEnterListener"),
|
|
286
|
+
}, "mouseEnterListener"), a = /* @__PURE__ */ h((l) => {
|
|
287
287
|
t.classList.contains(this.options.activeSortClass) || (t.style.background = "");
|
|
288
288
|
}, "mouseLeaveListener");
|
|
289
|
-
t.removeEventListener("click",
|
|
289
|
+
t.removeEventListener("click", o), t.addEventListener("click", o), t.removeEventListener("mouseenter", s), t.addEventListener("mouseenter", s), t.removeEventListener("mouseleave", a), t.addEventListener("mouseleave", a);
|
|
290
290
|
}
|
|
291
291
|
/**
|
|
292
292
|
* Add sort icon to header
|
|
@@ -304,55 +304,55 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
304
304
|
/**
|
|
305
305
|
* Sort table by column
|
|
306
306
|
*/
|
|
307
|
-
sortTable(t, e,
|
|
308
|
-
const
|
|
309
|
-
if (!
|
|
307
|
+
sortTable(t, e, r) {
|
|
308
|
+
const n = t.querySelector("tbody");
|
|
309
|
+
if (!n) {
|
|
310
310
|
console.warn("Table has no tbody element");
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
|
-
const
|
|
314
|
-
if (
|
|
313
|
+
const o = Array.from(n.querySelectorAll("tr"));
|
|
314
|
+
if (o.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(${
|
|
320
|
-
let
|
|
321
|
-
if (this.options.sortOnFirstClick ?
|
|
322
|
-
this.restoreOriginalOrder(t,
|
|
318
|
+
const s = this.sortStates.get(e);
|
|
319
|
+
t.querySelector(`thead tr th:nth-child(${r + 1})`);
|
|
320
|
+
let a;
|
|
321
|
+
if (this.options.sortOnFirstClick ? a = s.currentColumn === r && s.direction === "asc" ? "desc" : "asc" : s.currentColumn !== r ? a = "asc" : a = s.direction === "none" ? "asc" : s.direction === "asc" ? "desc" : "none", s.currentColumn = r, s.direction = a, this.sortStates.set(e, s), this.updateSortIndicators(t, e, r, a), a === "none") {
|
|
322
|
+
this.restoreOriginalOrder(t, o);
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
this.sortRows(
|
|
325
|
+
this.sortRows(o, r, a).forEach((c) => n.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, r) {
|
|
331
|
+
return t.sort((n, o) => {
|
|
332
|
+
const s = n.cells[e], a = o.cells[e];
|
|
333
|
+
if (!s || !a) return 0;
|
|
334
|
+
const l = this.extractValue(s), 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, r);
|
|
337
337
|
const u = this.compareValues(l, c);
|
|
338
|
-
return
|
|
338
|
+
return r === "asc" ? u : -u;
|
|
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(), r = k(e);
|
|
346
|
+
if (!isNaN(r))
|
|
347
|
+
return console.log(r), r;
|
|
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 u = parseFloat(
|
|
350
|
+
const o = e.match(/^([\d,]+\.?\d*)\s*%$/);
|
|
351
|
+
if (o)
|
|
352
|
+
return parseFloat(o[1].replace(/,/g, ""));
|
|
353
|
+
const s = e.match(/^([\d,]+\.?\d*)[eE][+-]?(\d+)$/);
|
|
354
|
+
if (s) {
|
|
355
|
+
const u = parseFloat(s[1].replace(/,/g, "")), p = parseInt(s[2]);
|
|
356
356
|
return u * Math.pow(10, p);
|
|
357
357
|
}
|
|
358
358
|
if (e.match(/^[\d,]+\.?\d*[KMB]?$/))
|
|
@@ -372,34 +372,34 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
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, r, n) {
|
|
376
|
+
const o = t.querySelectorAll("thead tr th");
|
|
377
|
+
if (o.forEach((s, a) => {
|
|
378
|
+
s.classList.remove(this.options.activeSortClass, this.options.ascendingClass, this.options.descendingClass);
|
|
379
|
+
const l = s.querySelector(".material-icons");
|
|
380
380
|
l && (l.textContent = this.options.unsortedIcon, l.style.opacity = "0.6");
|
|
381
|
-
}),
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
|
|
381
|
+
}), n !== "none") {
|
|
382
|
+
const s = o[r];
|
|
383
|
+
s.classList.add(this.options.activeSortClass);
|
|
384
|
+
const a = s.querySelector(".material-icons");
|
|
385
|
+
a && (n === "asc" ? (s.classList.add(this.options.ascendingClass), a.textContent = this.options.ascendingIcon) : (s.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 r = t.querySelector("tbody");
|
|
393
|
+
e.forEach((n) => r.appendChild(n));
|
|
394
394
|
}
|
|
395
395
|
/**
|
|
396
396
|
* Add resizing functionality to a header
|
|
397
397
|
*/
|
|
398
|
-
addResizing(t, e,
|
|
398
|
+
addResizing(t, e, r, n) {
|
|
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 o = document.createElement("div");
|
|
402
|
+
o.className = "resize-handle", o.style.cssText = `
|
|
403
403
|
position: absolute;
|
|
404
404
|
top: 0;
|
|
405
405
|
right: 0;
|
|
@@ -408,14 +408,14 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
408
408
|
background: transparent;
|
|
409
409
|
cursor: col-resize;
|
|
410
410
|
z-index: 10;
|
|
411
|
-
`, t.appendChild(
|
|
412
|
-
let
|
|
413
|
-
|
|
414
|
-
p.preventDefault(), p.stopPropagation(), p.stopImmediatePropagation(),
|
|
411
|
+
`, t.appendChild(o);
|
|
412
|
+
let s = !1, a = 0, l = 0;
|
|
413
|
+
o.addEventListener("mousedown", (p) => {
|
|
414
|
+
p.preventDefault(), p.stopPropagation(), p.stopImmediatePropagation(), s = !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";
|
|
415
415
|
});
|
|
416
416
|
const c = /* @__PURE__ */ h((p) => {
|
|
417
|
-
if (!
|
|
418
|
-
const d = l + (p.clientX -
|
|
417
|
+
if (!s) return;
|
|
418
|
+
const d = l + (p.clientX - a);
|
|
419
419
|
if (d > 30) {
|
|
420
420
|
t.style.width = d + "px";
|
|
421
421
|
const m = Array.from(t.parentNode.children).indexOf(t), f = e.querySelector("tbody");
|
|
@@ -425,41 +425,41 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
425
425
|
}), this.updateTableWidth(e);
|
|
426
426
|
}
|
|
427
427
|
}, "handleResize"), u = /* @__PURE__ */ h(() => {
|
|
428
|
-
|
|
428
|
+
s = !1, t.style.borderRight = "", t.style.background = "", document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", u), 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, r, n) {
|
|
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 o = e.querySelector("thead tr");
|
|
439
|
+
t.addEventListener("dragstart", (s) => {
|
|
440
440
|
this.isDragging = !0;
|
|
441
|
-
const
|
|
442
|
-
this.dragSource = { table: e, tableIndex:
|
|
441
|
+
const a = Array.from(o.children).indexOf(t);
|
|
442
|
+
this.dragSource = { table: e, tableIndex: r, columnIndex: a }, s.dataTransfer.effectAllowed = "move", s.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(s, t, l);
|
|
445
|
+
}), t.addEventListener("dragend", (s) => {
|
|
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
|
|
452
|
-
this.dragSource.columnIndex !==
|
|
447
|
+
}), t.addEventListener("dragover", (s) => {
|
|
448
|
+
s.preventDefault(), s.dataTransfer.dropEffect = "move";
|
|
449
|
+
}), t.addEventListener("dragenter", (s) => {
|
|
450
|
+
if (s.preventDefault(), this.dragSource && this.dragSource.tableIndex === r) {
|
|
451
|
+
const a = Array.from(o.children).indexOf(t);
|
|
452
|
+
this.dragSource.columnIndex !== a && this.highlightColumn(e, a, !0);
|
|
453
453
|
}
|
|
454
|
-
}), t.addEventListener("dragleave", (
|
|
455
|
-
if (!t.contains(
|
|
456
|
-
const
|
|
457
|
-
this.highlightColumn(e,
|
|
454
|
+
}), t.addEventListener("dragleave", (s) => {
|
|
455
|
+
if (!t.contains(s.relatedTarget)) {
|
|
456
|
+
const a = Array.from(o.children).indexOf(t);
|
|
457
|
+
this.highlightColumn(e, a, !1);
|
|
458
458
|
}
|
|
459
|
-
}), t.addEventListener("drop", (
|
|
460
|
-
if (
|
|
461
|
-
const
|
|
462
|
-
this.dragSource.columnIndex !==
|
|
459
|
+
}), t.addEventListener("drop", (s) => {
|
|
460
|
+
if (s.preventDefault(), this.dragSource && this.dragSource.tableIndex === r) {
|
|
461
|
+
const a = Array.from(o.children).indexOf(t);
|
|
462
|
+
this.dragSource.columnIndex !== a && this.reorderColumns(e, r, this.dragSource.columnIndex, a);
|
|
463
463
|
}
|
|
464
464
|
this.clearAllColumnHighlights(e);
|
|
465
465
|
});
|
|
@@ -467,9 +467,9 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
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, r) {
|
|
471
|
+
const n = document.createElement("div");
|
|
472
|
+
n.style.cssText = `
|
|
473
473
|
position: absolute;
|
|
474
474
|
top: -1000px;
|
|
475
475
|
left: -1000px;
|
|
@@ -492,36 +492,36 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
492
492
|
display: flex;
|
|
493
493
|
align-items: center;
|
|
494
494
|
`;
|
|
495
|
-
const
|
|
496
|
-
|
|
495
|
+
const o = r;
|
|
496
|
+
n.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">${o}</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(n), t.dataTransfer.setDragImage(n, 50, 12), setTimeout(() => {
|
|
502
|
+
document.body.contains(n) && document.body.removeChild(n);
|
|
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
|
|
516
|
-
for (let l = 0; l <
|
|
517
|
-
const c =
|
|
508
|
+
highlightColumn(t, e, r) {
|
|
509
|
+
const n = t.querySelector("thead tr"), o = t.querySelector("tbody");
|
|
510
|
+
if (!n || !o) return;
|
|
511
|
+
const s = n.children[e];
|
|
512
|
+
if (s)
|
|
513
|
+
if (r) {
|
|
514
|
+
s.classList.add(this.options.dragOverClass);
|
|
515
|
+
const a = o.children;
|
|
516
|
+
for (let l = 0; l < a.length; l++) {
|
|
517
|
+
const c = a[l].children[e];
|
|
518
518
|
c && c.classList.add(this.options.dragOverClass);
|
|
519
519
|
}
|
|
520
520
|
} else {
|
|
521
|
-
|
|
522
|
-
const
|
|
523
|
-
for (let l = 0; l <
|
|
524
|
-
const c =
|
|
521
|
+
s.classList.remove(this.options.dragOverClass);
|
|
522
|
+
const a = o.children;
|
|
523
|
+
for (let l = 0; l < a.length; l++) {
|
|
524
|
+
const c = a[l].children[e];
|
|
525
525
|
c && c.classList.remove(this.options.dragOverClass);
|
|
526
526
|
}
|
|
527
527
|
}
|
|
@@ -530,40 +530,40 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
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
|
|
541
|
-
for (let l = 0; l <
|
|
542
|
-
|
|
533
|
+
const e = t.querySelector("thead tr"), r = t.querySelector("tbody");
|
|
534
|
+
if (!e || !r) return;
|
|
535
|
+
const n = e.children;
|
|
536
|
+
for (let s = 0; s < n.length; s++)
|
|
537
|
+
n[s].classList.remove(this.options.dragOverClass);
|
|
538
|
+
const o = r.children;
|
|
539
|
+
for (let s = 0; s < o.length; s++) {
|
|
540
|
+
const a = o[s].children;
|
|
541
|
+
for (let l = 0; l < a.length; l++)
|
|
542
|
+
a[l].classList.remove(this.options.dragOverClass);
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
545
|
/**
|
|
546
546
|
* Reorder columns in a table
|
|
547
547
|
*/
|
|
548
|
-
reorderColumns(t, e,
|
|
549
|
-
const
|
|
550
|
-
if (!
|
|
551
|
-
const
|
|
552
|
-
if (
|
|
548
|
+
reorderColumns(t, e, r, n) {
|
|
549
|
+
const o = t.querySelector("thead tr"), s = t.querySelector("tbody");
|
|
550
|
+
if (!o || !s) return;
|
|
551
|
+
const a = Array.from(o.children), l = Array.from(s.children);
|
|
552
|
+
if (r < 0 || r >= a.length || n < 0 || n >= a.length) {
|
|
553
553
|
console.warn("Invalid column indices for reordering");
|
|
554
554
|
return;
|
|
555
555
|
}
|
|
556
|
-
if (
|
|
556
|
+
if (r === n)
|
|
557
557
|
return;
|
|
558
|
-
const c =
|
|
559
|
-
|
|
560
|
-
const f = Array.from(d.children), g = f[
|
|
561
|
-
|
|
558
|
+
const c = a[r], u = a[n];
|
|
559
|
+
r < n ? o.insertBefore(c, u.nextSibling) : o.insertBefore(c, u), l.forEach((d, m) => {
|
|
560
|
+
const f = Array.from(d.children), g = f[r], y = f[n];
|
|
561
|
+
r < n ? d.insertBefore(g, y.nextSibling) : d.insertBefore(g, y);
|
|
562
562
|
});
|
|
563
563
|
const p = this.originalColumnOrder.get(e);
|
|
564
564
|
if (p) {
|
|
565
|
-
const d = [...p], m = d[
|
|
566
|
-
d.splice(
|
|
565
|
+
const d = [...p], m = d[r];
|
|
566
|
+
d.splice(r, 1), d.splice(n, 0, m), this.originalColumnOrder.set(e, d);
|
|
567
567
|
}
|
|
568
568
|
this.applyTableStyles(t), this.refreshDragAndDropListeners(t, e);
|
|
569
569
|
}
|
|
@@ -571,13 +571,13 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
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
|
|
580
|
-
|
|
574
|
+
const r = t.querySelector("thead tr");
|
|
575
|
+
if (!r) return;
|
|
576
|
+
Array.from(r.children).forEach((o, s) => {
|
|
577
|
+
if (o.classList.contains(this.options.draggableClass)) {
|
|
578
|
+
o.style.opacity = "", o.style.background = "", o.style.borderRight = "";
|
|
579
|
+
const a = o.cloneNode(!0);
|
|
580
|
+
o.parentNode.replaceChild(a, o), this.makeHeaderSortable(a, t, e, s);
|
|
581
581
|
}
|
|
582
582
|
});
|
|
583
583
|
}
|
|
@@ -586,47 +586,47 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
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 r = 0;
|
|
590
|
+
e.forEach((n) => {
|
|
591
|
+
const o = n.style.width;
|
|
592
|
+
if (o) {
|
|
593
|
+
const s = parseInt(o.replace("px", ""));
|
|
594
|
+
r += s;
|
|
595
595
|
} else {
|
|
596
|
-
const
|
|
597
|
-
|
|
596
|
+
const s = n.textContent.replace(/[📊🔍]/g, "").trim();
|
|
597
|
+
r += s.length;
|
|
598
598
|
}
|
|
599
|
-
}), t.style.width = `${
|
|
599
|
+
}), t.style.width = `${r}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 p;
|
|
606
|
-
const e = t.getAttribute("data-original-width"),
|
|
607
|
-
let
|
|
606
|
+
const e = t.getAttribute("data-original-width"), r = e ? parseFloat(e) : 0, n = t.querySelectorAll("th");
|
|
607
|
+
let o = 0;
|
|
608
608
|
t.parentElement.clientWidth;
|
|
609
|
-
const
|
|
610
|
-
|
|
609
|
+
const s = [];
|
|
610
|
+
n.forEach((d) => {
|
|
611
611
|
let f = d.textContent.replace(/[📊🔍]/g, "").trim().length * this.charWidth + 15;
|
|
612
|
-
|
|
612
|
+
s.push(f), o += f;
|
|
613
613
|
});
|
|
614
|
-
const
|
|
614
|
+
const a = t.querySelectorAll("tr"), l = ((p = t.parentElement) == null ? void 0 : p.getBoundingClientRect().width) ?? o;
|
|
615
615
|
var c = 0;
|
|
616
|
-
for (const d of
|
|
616
|
+
for (const d of a)
|
|
617
617
|
d.querySelectorAll("td").forEach((f, g) => {
|
|
618
618
|
const b = f.textContent.length * this.charWidth + 15;
|
|
619
|
-
b >
|
|
619
|
+
b > s[g] && g < s.length && (s[g] = b);
|
|
620
620
|
});
|
|
621
|
-
c =
|
|
621
|
+
c = s.reduce((d, m) => d += m, 0), n.forEach((d, m) => {
|
|
622
622
|
if (c > l) {
|
|
623
|
-
const f =
|
|
623
|
+
const f = s[m] / c;
|
|
624
624
|
d.style.width = `${l * f}px`;
|
|
625
625
|
} else
|
|
626
|
-
d.style.width = `${
|
|
626
|
+
d.style.width = `${s[m]}px`;
|
|
627
627
|
});
|
|
628
628
|
let u = 0;
|
|
629
|
-
return c > l ? u = "100%" : u = `${Math.max(c,
|
|
629
|
+
return c > l ? u = "100%" : u = `${Math.max(c, r)}px`, u;
|
|
630
630
|
}
|
|
631
631
|
/**
|
|
632
632
|
* Apply inline styles to ensure text clipping and horizontal scroll work
|
|
@@ -635,9 +635,9 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
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, r) {
|
|
639
|
+
const o = document.createElement("canvas").getContext("2d");
|
|
640
|
+
return o.fontFamily = e, o.fontMono = r, o.measureText("A ").width;
|
|
641
641
|
}
|
|
642
642
|
/**
|
|
643
643
|
* Add CSS styles for sortable tables
|
|
@@ -779,19 +779,19 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
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((n) => {
|
|
783
|
+
n.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
|
+
), n.style.cursor = "", n.style.background = "";
|
|
789
|
+
const o = n.cloneNode(!0);
|
|
790
|
+
n.parentNode.replaceChild(o, n);
|
|
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(), S.clear();
|
|
795
795
|
}
|
|
796
796
|
/**
|
|
797
797
|
* Refresh the library (useful after DOM changes)
|
|
@@ -800,20 +800,68 @@ const C = /* @__PURE__ */ new Set(), w = class w {
|
|
|
800
800
|
this.destroy(), this.init();
|
|
801
801
|
}
|
|
802
802
|
};
|
|
803
|
-
h(
|
|
804
|
-
let
|
|
805
|
-
typeof window < "u" && (window.SortableTable =
|
|
803
|
+
h(C, "SortableTable");
|
|
804
|
+
let w = C;
|
|
805
|
+
typeof window < "u" && (window.SortableTable = w);
|
|
806
|
+
const x = /* @__PURE__ */ new Set(["/", "@", "#"]), W = /* @__PURE__ */ h((i) => i === "/" ? "slash" : i === "@" ? "at" : "hash", "triggerTypeFor"), v = /[ \t\r\n\f\v]/, B = /* @__PURE__ */ h((i) => {
|
|
807
|
+
if (!i) return [];
|
|
808
|
+
const t = [];
|
|
809
|
+
let e = 0;
|
|
810
|
+
for (; e < i.length; ) {
|
|
811
|
+
const r = i[e];
|
|
812
|
+
if ((e === 0 || v.test(i[e - 1])) && x.has(r)) {
|
|
813
|
+
let o = e + 1;
|
|
814
|
+
for (; o < i.length && !v.test(i[o]); ) o += 1;
|
|
815
|
+
t.push({ type: W(r), text: i.slice(e, o) }), e = o;
|
|
816
|
+
} else {
|
|
817
|
+
let o = e + 1;
|
|
818
|
+
for (; o < i.length; ) {
|
|
819
|
+
const s = i[o], a = v.test(i[o - 1]);
|
|
820
|
+
if (x.has(s) && a) break;
|
|
821
|
+
o += 1;
|
|
822
|
+
}
|
|
823
|
+
t.push({ type: "plain", text: i.slice(e, o) }), e = o;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
return t;
|
|
827
|
+
}, "tokenizeForHighlight"), I = /* @__PURE__ */ h((i, t) => {
|
|
828
|
+
const e = t.filter((n) => n.trim().length > 0).sort((n, o) => o.length - n.length);
|
|
829
|
+
if (e.length === 0) return i;
|
|
830
|
+
const r = [];
|
|
831
|
+
for (const n of i) {
|
|
832
|
+
if (n.type !== "plain") {
|
|
833
|
+
r.push(n);
|
|
834
|
+
continue;
|
|
835
|
+
}
|
|
836
|
+
let o = n.text;
|
|
837
|
+
for (; o.length > 0; ) {
|
|
838
|
+
let s = -1, a = 0;
|
|
839
|
+
for (const l of e) {
|
|
840
|
+
const c = o.indexOf(l);
|
|
841
|
+
c >= 0 && (s === -1 || c < s) && (s = c, a = l.length);
|
|
842
|
+
}
|
|
843
|
+
if (s === -1) {
|
|
844
|
+
r.push({ type: "plain", text: o });
|
|
845
|
+
break;
|
|
846
|
+
}
|
|
847
|
+
s > 0 && r.push({ type: "plain", text: o.slice(0, s) }), r.push({ type: "at", text: o.slice(s, s + a) }), o = o.slice(s + a);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return r;
|
|
851
|
+
}, "chipLocations");
|
|
806
852
|
export {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
853
|
+
w as S,
|
|
854
|
+
T as a,
|
|
855
|
+
M as b,
|
|
856
|
+
I as c,
|
|
857
|
+
H as d,
|
|
858
|
+
N as e,
|
|
859
|
+
R as f,
|
|
860
|
+
z as g,
|
|
861
|
+
F as h,
|
|
862
|
+
_ as i,
|
|
863
|
+
D as p,
|
|
864
|
+
O as s,
|
|
865
|
+
B as t
|
|
818
866
|
};
|
|
819
|
-
//# sourceMappingURL=
|
|
867
|
+
//# sourceMappingURL=promptHighlight-BHSQkdFs.js.map
|