@epam/statgpt-conversation-list 0.2.0-rc.0 → 0.2.0-rc.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.
- package/index.js +3 -3
- package/index.mjs +575 -568
- package/models/conversation-list.d.ts +2 -1
- package/package.json +4 -4
package/index.mjs
CHANGED
|
@@ -1,70 +1,186 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as B, jsx as g, Fragment as v } from "react/jsx-runtime";
|
|
2
2
|
import J from "classnames";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
var
|
|
3
|
+
import O, { useState as F, useMemo as he, useEffect as ee, useCallback as _, useRef as ze } from "react";
|
|
4
|
+
import { cloneDeep as ke, omit as _e, uniqBy as $e } from "lodash";
|
|
5
|
+
import { Popup as fe, PopUpSize as me, Button as X, Loader as Ce, InputWithIcon as Re, Input as He, PopUpState as Y, Dropdown as Ye, HighlightText as Qe, IconButton as Ge } from "@epam/statgpt-ui-components";
|
|
6
|
+
import { IconCheck as je, IconCopy as Ve, IconDotsVertical as Xe, IconCaretRightFilled as We, IconX as Ke, IconSearch as Ze } from "@tabler/icons-react";
|
|
7
|
+
import Je from "jszip";
|
|
8
|
+
import { InvitationType as qe, getSharedConversationsRequest as le, ShareTarget as ie } from "@epam/statgpt-dial-toolkit";
|
|
9
|
+
import { SHARE_CONVERSATION_ROUTE as we, getClearedConversationName as pe, ONBOARDING_MODEL_POSTFIX as ve, cleanConversationNames as K } from "@epam/statgpt-shared-toolkit";
|
|
10
|
+
var k = /* @__PURE__ */ ((t) => (t.DELETE = "delete", t.EXPORT = "export", t.SHARE = "share", t.RENAME = "rename", t))(k || {}), U = /* @__PURE__ */ ((t) => (t.SHARED = "shared", t.TODAY = "today", t.YESTERDAY = "yesterday", t.WEEK = "week", t.EARLIER = "earlier", t))(U || {});
|
|
11
11
|
const ce = (t, r) => {
|
|
12
|
-
var l,
|
|
13
|
-
return ((
|
|
12
|
+
var l, c;
|
|
13
|
+
return ((c = (l = t == null ? void 0 : t.resources) == null ? void 0 : l.filter((s) => (s == null ? void 0 : s.parentPath) === r)) == null ? void 0 : c.map((s) => {
|
|
14
14
|
var h, e, n;
|
|
15
|
-
const
|
|
15
|
+
const a = `${s == null ? void 0 : s.bucket}/${r}`, p = (n = (e = (h = s == null ? void 0 : s.url) == null ? void 0 : h.split("/")) == null ? void 0 : e.slice(1)) == null ? void 0 : n.join("/");
|
|
16
16
|
return {
|
|
17
17
|
...s,
|
|
18
|
-
folderId:
|
|
19
|
-
id:
|
|
18
|
+
folderId: a,
|
|
19
|
+
id: p,
|
|
20
20
|
isShared: !0
|
|
21
21
|
};
|
|
22
22
|
})) || [];
|
|
23
|
-
},
|
|
23
|
+
}, et = (t) => ({
|
|
24
24
|
[U.SHARED]: t
|
|
25
|
-
}),
|
|
25
|
+
}), tt = {
|
|
26
26
|
[U.TODAY]: [],
|
|
27
27
|
[U.YESTERDAY]: [],
|
|
28
28
|
[U.WEEK]: [],
|
|
29
29
|
[U.EARLIER]: []
|
|
30
|
-
},
|
|
30
|
+
}, Me = (t, r) => t.toDateString() === r.toDateString(), nt = (t, r) => {
|
|
31
31
|
const l = new Date(
|
|
32
32
|
t.getFullYear(),
|
|
33
33
|
t.getMonth(),
|
|
34
34
|
t.getDate() - 1
|
|
35
35
|
);
|
|
36
|
-
return
|
|
37
|
-
},
|
|
36
|
+
return Me(r, l);
|
|
37
|
+
}, rt = (t, r) => {
|
|
38
38
|
const l = t.getTime() - r.getTime();
|
|
39
39
|
return Math.floor(l / (1e3 * 60 * 60 * 24));
|
|
40
|
-
},
|
|
41
|
-
const r = /* @__PURE__ */ new Date(), l =
|
|
42
|
-
for (const
|
|
43
|
-
if (
|
|
44
|
-
const s = new Date(
|
|
45
|
-
let
|
|
46
|
-
|
|
47
|
-
(
|
|
48
|
-
) ||
|
|
40
|
+
}, ot = (t) => {
|
|
41
|
+
const r = /* @__PURE__ */ new Date(), l = ke(tt);
|
|
42
|
+
for (const c of t)
|
|
43
|
+
if (c.updatedAt) {
|
|
44
|
+
const s = new Date(c.updatedAt);
|
|
45
|
+
let a;
|
|
46
|
+
Me(r, s) ? a = l[U.TODAY] : nt(r, s) ? a = l[U.YESTERDAY] : rt(r, s) <= 7 ? a = l[U.WEEK] : a = l[U.EARLIER], a != null && a.some(
|
|
47
|
+
(p) => p.id === c.id
|
|
48
|
+
) || a.push(c);
|
|
49
49
|
}
|
|
50
50
|
return l;
|
|
51
|
-
},
|
|
51
|
+
}, Ne = (t) => t == null ? void 0 : t.sort(
|
|
52
52
|
(r, l) => ((l == null ? void 0 : l.updatedAt) || 0) - ((r == null ? void 0 : r.updatedAt) || 0)
|
|
53
|
-
),
|
|
54
|
-
|
|
53
|
+
), lt = (t, r) => t === U.SHARED ? (r == null ? void 0 : r.shared) || "Shared" : t === U.TODAY ? (r == null ? void 0 : r.today) || "Today" : t === U.YESTERDAY ? (r == null ? void 0 : r.yesterday) || "Yesterday" : t === U.WEEK ? (r == null ? void 0 : r.lastWeek) || "Last week" : (r == null ? void 0 : r.earlier) || "Earlier", it = ({
|
|
54
|
+
onCloseModal: t,
|
|
55
|
+
disableModalDividers: r,
|
|
56
|
+
deleteConversation: l,
|
|
57
|
+
isSmallButton: c,
|
|
58
|
+
titles: s,
|
|
59
|
+
locale: a
|
|
60
|
+
}) => /* @__PURE__ */ B(
|
|
61
|
+
fe,
|
|
62
|
+
{
|
|
63
|
+
heading: (s == null ? void 0 : s.deleteTitle) ?? "Delete conversation",
|
|
64
|
+
portalId: "delete-conversation",
|
|
65
|
+
containerClassName: "delete-conversation-popup",
|
|
66
|
+
size: me.SM,
|
|
67
|
+
dividers: !r,
|
|
68
|
+
onClose: t,
|
|
69
|
+
closeButtonTitle: (s == null ? void 0 : s.close) ?? "Cancel",
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ g("div", { className: "py-4 px-6 sm:px-0", lang: a, children: (s == null ? void 0 : s.deleteMessage) ?? "Are you sure you want to delete this conversation? This action cannot be undone." }),
|
|
72
|
+
/* @__PURE__ */ B("div", { className: "flex justify-end gap-x-2 py-3 px-6 delete-conversation-popup-footer", children: [
|
|
73
|
+
/* @__PURE__ */ g(
|
|
74
|
+
X,
|
|
75
|
+
{
|
|
76
|
+
buttonClassName: "cancel-button",
|
|
77
|
+
title: (s == null ? void 0 : s.cancel) ?? "Cancel",
|
|
78
|
+
isSmallButton: c,
|
|
79
|
+
onClick: (p) => {
|
|
80
|
+
p.stopPropagation(), t();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ g(
|
|
85
|
+
X,
|
|
86
|
+
{
|
|
87
|
+
buttonClassName: "text-button-primary text-button-primary-error",
|
|
88
|
+
title: (s == null ? void 0 : s.delete) ?? "Delete",
|
|
89
|
+
isSmallButton: c,
|
|
90
|
+
onClick: (p) => {
|
|
91
|
+
p.stopPropagation(), l();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
] })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
), st = (t) => {
|
|
99
|
+
const r = t.messages.flatMap((c) => {
|
|
100
|
+
var p, h, e;
|
|
101
|
+
const s = ((p = c.custom_content) == null ? void 0 : p.attachments) || [], a = ((e = (h = c.custom_content) == null ? void 0 : h.stages) == null ? void 0 : e.flatMap(
|
|
102
|
+
({ attachments: n }) => n ?? []
|
|
103
|
+
)) || [];
|
|
104
|
+
return [...s, ...a];
|
|
105
|
+
}) || [], l = dt(r).map(
|
|
106
|
+
(c) => ({
|
|
107
|
+
...c,
|
|
108
|
+
relativePath: "",
|
|
109
|
+
contentLength: 0
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
return $e(
|
|
113
|
+
l,
|
|
114
|
+
(c) => te(c.relativePath, c.name)
|
|
115
|
+
);
|
|
116
|
+
}, at = (t) => t.endsWith("/"), ct = (t) => {
|
|
117
|
+
const r = t.toLowerCase();
|
|
118
|
+
return [
|
|
119
|
+
"data:",
|
|
120
|
+
"//",
|
|
121
|
+
"http://",
|
|
122
|
+
"https://",
|
|
123
|
+
"file://",
|
|
124
|
+
"ftp://",
|
|
125
|
+
"mailto:",
|
|
126
|
+
"telnet://",
|
|
127
|
+
"api/files"
|
|
128
|
+
].some((l) => r.startsWith(l));
|
|
129
|
+
}, ut = (t) => {
|
|
130
|
+
const r = te(
|
|
131
|
+
...t.split("/").map((c) => decodeURIComponent(c))
|
|
132
|
+
), l = r.lastIndexOf("/");
|
|
133
|
+
return {
|
|
134
|
+
absolutePath: r.slice(0, l),
|
|
135
|
+
name: r.slice(l + 1)
|
|
136
|
+
};
|
|
137
|
+
}, dt = (t) => t ? t.map((r) => {
|
|
138
|
+
if (!r.url || ct(r.url) || at(r.url))
|
|
139
|
+
return null;
|
|
140
|
+
const { absolutePath: l, name: c } = ut(r.url);
|
|
141
|
+
return {
|
|
142
|
+
id: r.url,
|
|
143
|
+
name: c,
|
|
144
|
+
contentType: r.type,
|
|
145
|
+
folderId: l,
|
|
146
|
+
absolutePath: l
|
|
147
|
+
};
|
|
148
|
+
}).filter(Boolean) : [];
|
|
149
|
+
async function ht(t, r) {
|
|
150
|
+
const l = st(t), c = new Je();
|
|
151
|
+
l.forEach((h) => {
|
|
152
|
+
const e = encodeURI(te(h.absolutePath, h.name)), n = r(`${e}`.replace("files/", "")), o = ft(h.folderId), i = te("res", o, h.name);
|
|
153
|
+
c.file(i, n);
|
|
154
|
+
});
|
|
155
|
+
const s = {
|
|
156
|
+
version: 5,
|
|
157
|
+
history: [t].map(mt) || [],
|
|
158
|
+
folders: []
|
|
159
|
+
}, a = JSON.stringify(s, null, 2);
|
|
160
|
+
return c.file("conversations/conversations_history.json", a), await c.generateAsync({ type: "base64" });
|
|
161
|
+
}
|
|
162
|
+
const ft = (t) => {
|
|
163
|
+
const r = t.split("/");
|
|
164
|
+
return r.length > 2 ? te(...r.slice(2)) : void 0;
|
|
165
|
+
}, mt = (t) => _e(t, ["publicationInfo"]), te = (...t) => t.filter(Boolean).join("/");
|
|
166
|
+
function pt(t, r) {
|
|
167
|
+
const l = document.createElement("a");
|
|
168
|
+
l.download = r, l.href = t, l.style.display = "none", document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(t);
|
|
169
|
+
}
|
|
170
|
+
var gt = Object.defineProperty, se = Object.getOwnPropertySymbols, Ie = Object.prototype.hasOwnProperty, Ae = Object.prototype.propertyIsEnumerable, Ee = (t, r, l) => r in t ? gt(t, r, { enumerable: !0, configurable: !0, writable: !0, value: l }) : t[r] = l, ue = (t, r) => {
|
|
55
171
|
for (var l in r || (r = {}))
|
|
56
|
-
|
|
172
|
+
Ie.call(r, l) && Ee(t, l, r[l]);
|
|
57
173
|
if (se)
|
|
58
174
|
for (var l of se(r))
|
|
59
|
-
|
|
175
|
+
Ae.call(r, l) && Ee(t, l, r[l]);
|
|
60
176
|
return t;
|
|
61
177
|
}, de = (t, r) => {
|
|
62
178
|
var l = {};
|
|
63
|
-
for (var
|
|
64
|
-
|
|
179
|
+
for (var c in t)
|
|
180
|
+
Ie.call(t, c) && r.indexOf(c) < 0 && (l[c] = t[c]);
|
|
65
181
|
if (t != null && se)
|
|
66
|
-
for (var
|
|
67
|
-
r.indexOf(
|
|
182
|
+
for (var c of se(t))
|
|
183
|
+
r.indexOf(c) < 0 && Ae.call(t, c) && (l[c] = t[c]);
|
|
68
184
|
return l;
|
|
69
185
|
};
|
|
70
186
|
/**
|
|
@@ -74,14 +190,14 @@ var lt = Object.defineProperty, se = Object.getOwnPropertySymbols, Ne = Object.p
|
|
|
74
190
|
*/
|
|
75
191
|
var W;
|
|
76
192
|
((t) => {
|
|
77
|
-
const r = class
|
|
193
|
+
const r = class R {
|
|
78
194
|
/*-- Constructor (low level) and fields --*/
|
|
79
195
|
// Creates a new QR Code with the given version number,
|
|
80
196
|
// error correction level, data codeword bytes, and mask number.
|
|
81
197
|
// This is a low-level API that most users should not use directly.
|
|
82
198
|
// A mid-level API is the encodeSegments() function.
|
|
83
199
|
constructor(e, n, o, i) {
|
|
84
|
-
if (this.version = e, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], e <
|
|
200
|
+
if (this.version = e, this.errorCorrectionLevel = n, this.modules = [], this.isFunction = [], e < R.MIN_VERSION || e > R.MAX_VERSION)
|
|
85
201
|
throw new RangeError("Version value out of range");
|
|
86
202
|
if (i < -1 || i > 7)
|
|
87
203
|
throw new RangeError("Mask value out of range");
|
|
@@ -97,8 +213,8 @@ var W;
|
|
|
97
213
|
let d = 1e9;
|
|
98
214
|
for (let C = 0; C < 8; C++) {
|
|
99
215
|
this.applyMask(C), this.drawFormatBits(C);
|
|
100
|
-
const
|
|
101
|
-
|
|
216
|
+
const m = this.getPenaltyScore();
|
|
217
|
+
m < d && (i = C, d = m), this.applyMask(C);
|
|
102
218
|
}
|
|
103
219
|
}
|
|
104
220
|
s(0 <= i && i <= 7), this.mask = i, this.applyMask(i), this.drawFormatBits(i), this.isFunction = [];
|
|
@@ -111,7 +227,7 @@ var W;
|
|
|
111
227
|
// ecl argument if it can be done without increasing the version.
|
|
112
228
|
static encodeText(e, n) {
|
|
113
229
|
const o = t.QrSegment.makeSegments(e);
|
|
114
|
-
return
|
|
230
|
+
return R.encodeSegments(o, n);
|
|
115
231
|
}
|
|
116
232
|
// Returns a QR Code representing the given binary data at the given error correction level.
|
|
117
233
|
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
|
@@ -119,7 +235,7 @@ var W;
|
|
|
119
235
|
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
|
120
236
|
static encodeBinary(e, n) {
|
|
121
237
|
const o = t.QrSegment.makeBytes(e);
|
|
122
|
-
return
|
|
238
|
+
return R.encodeSegments([o], n);
|
|
123
239
|
}
|
|
124
240
|
/*-- Static factory functions (mid level) --*/
|
|
125
241
|
// Returns a QR Code representing the given segments with the given encoding parameters.
|
|
@@ -132,35 +248,35 @@ var W;
|
|
|
132
248
|
// between modes (such as alphanumeric and byte) to encode text in less space.
|
|
133
249
|
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
|
134
250
|
static encodeSegments(e, n, o = 1, i = 40, u = -1, f = !0) {
|
|
135
|
-
if (!(
|
|
251
|
+
if (!(R.MIN_VERSION <= o && o <= i && i <= R.MAX_VERSION) || u < -1 || u > 7)
|
|
136
252
|
throw new RangeError("Invalid value");
|
|
137
253
|
let d, C;
|
|
138
254
|
for (d = o; ; d++) {
|
|
139
|
-
const
|
|
140
|
-
if (N <=
|
|
255
|
+
const E = R.getNumDataCodewords(d, n) * 8, N = p.getTotalBits(e, d);
|
|
256
|
+
if (N <= E) {
|
|
141
257
|
C = N;
|
|
142
258
|
break;
|
|
143
259
|
}
|
|
144
260
|
if (d >= i)
|
|
145
261
|
throw new RangeError("Data too long");
|
|
146
262
|
}
|
|
147
|
-
for (const
|
|
148
|
-
f && C <=
|
|
149
|
-
let
|
|
150
|
-
for (const
|
|
151
|
-
l(
|
|
152
|
-
for (const N of
|
|
153
|
-
|
|
263
|
+
for (const E of [R.Ecc.MEDIUM, R.Ecc.QUARTILE, R.Ecc.HIGH])
|
|
264
|
+
f && C <= R.getNumDataCodewords(d, E) * 8 && (n = E);
|
|
265
|
+
let m = [];
|
|
266
|
+
for (const E of e) {
|
|
267
|
+
l(E.mode.modeBits, 4, m), l(E.numChars, E.mode.numCharCountBits(d), m);
|
|
268
|
+
for (const N of E.getData())
|
|
269
|
+
m.push(N);
|
|
154
270
|
}
|
|
155
|
-
s(
|
|
156
|
-
const
|
|
157
|
-
s(
|
|
158
|
-
for (let
|
|
159
|
-
l(
|
|
160
|
-
let
|
|
161
|
-
for (;
|
|
162
|
-
|
|
163
|
-
return
|
|
271
|
+
s(m.length == C);
|
|
272
|
+
const I = R.getNumDataCodewords(d, n) * 8;
|
|
273
|
+
s(m.length <= I), l(0, Math.min(4, I - m.length), m), l(0, (8 - m.length % 8) % 8, m), s(m.length % 8 == 0);
|
|
274
|
+
for (let E = 236; m.length < I; E ^= 253)
|
|
275
|
+
l(E, 8, m);
|
|
276
|
+
let w = [];
|
|
277
|
+
for (; w.length * 8 < m.length; )
|
|
278
|
+
w.push(0);
|
|
279
|
+
return m.forEach((E, N) => w[N >>> 3] |= E << 7 - (N & 7)), new R(d, n, w, u);
|
|
164
280
|
}
|
|
165
281
|
/*-- Accessor methods --*/
|
|
166
282
|
// Returns the color of the module (pixel) at the given coordinates, which is false
|
|
@@ -195,14 +311,14 @@ var W;
|
|
|
195
311
|
const i = (n << 10 | o) ^ 21522;
|
|
196
312
|
s(i >>> 15 == 0);
|
|
197
313
|
for (let u = 0; u <= 5; u++)
|
|
198
|
-
this.setFunctionModule(8, u,
|
|
199
|
-
this.setFunctionModule(8, 7,
|
|
314
|
+
this.setFunctionModule(8, u, c(i, u));
|
|
315
|
+
this.setFunctionModule(8, 7, c(i, 6)), this.setFunctionModule(8, 8, c(i, 7)), this.setFunctionModule(7, 8, c(i, 8));
|
|
200
316
|
for (let u = 9; u < 15; u++)
|
|
201
|
-
this.setFunctionModule(14 - u, 8,
|
|
317
|
+
this.setFunctionModule(14 - u, 8, c(i, u));
|
|
202
318
|
for (let u = 0; u < 8; u++)
|
|
203
|
-
this.setFunctionModule(this.size - 1 - u, 8,
|
|
319
|
+
this.setFunctionModule(this.size - 1 - u, 8, c(i, u));
|
|
204
320
|
for (let u = 8; u < 15; u++)
|
|
205
|
-
this.setFunctionModule(8, this.size - 15 + u,
|
|
321
|
+
this.setFunctionModule(8, this.size - 15 + u, c(i, u));
|
|
206
322
|
this.setFunctionModule(8, this.size - 8, !0);
|
|
207
323
|
}
|
|
208
324
|
// Draws two copies of the version bits (with its own error correction code),
|
|
@@ -216,7 +332,7 @@ var W;
|
|
|
216
332
|
const n = this.version << 12 | e;
|
|
217
333
|
s(n >>> 18 == 0);
|
|
218
334
|
for (let o = 0; o < 18; o++) {
|
|
219
|
-
const i =
|
|
335
|
+
const i = c(n, o), u = this.size - 11 + o % 3, f = Math.floor(o / 3);
|
|
220
336
|
this.setFunctionModule(u, f, i), this.setFunctionModule(f, u, i);
|
|
221
337
|
}
|
|
222
338
|
}
|
|
@@ -246,28 +362,28 @@ var W;
|
|
|
246
362
|
// codewords appended to it, based on this object's version and error correction level.
|
|
247
363
|
addEccAndInterleave(e) {
|
|
248
364
|
const n = this.version, o = this.errorCorrectionLevel;
|
|
249
|
-
if (e.length !=
|
|
365
|
+
if (e.length != R.getNumDataCodewords(n, o))
|
|
250
366
|
throw new RangeError("Invalid argument");
|
|
251
|
-
const i =
|
|
252
|
-
let
|
|
253
|
-
const
|
|
254
|
-
for (let
|
|
255
|
-
let b = e.slice(N, N + C - u + (
|
|
367
|
+
const i = R.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][n], u = R.ECC_CODEWORDS_PER_BLOCK[o.ordinal][n], f = Math.floor(R.getNumRawDataModules(n) / 8), d = i - f % i, C = Math.floor(f / i);
|
|
368
|
+
let m = [];
|
|
369
|
+
const I = R.reedSolomonComputeDivisor(u);
|
|
370
|
+
for (let E = 0, N = 0; E < i; E++) {
|
|
371
|
+
let b = e.slice(N, N + C - u + (E < d ? 0 : 1));
|
|
256
372
|
N += b.length;
|
|
257
|
-
const P =
|
|
258
|
-
|
|
373
|
+
const P = R.reedSolomonComputeRemainder(b, I);
|
|
374
|
+
E < d && b.push(0), m.push(b.concat(P));
|
|
259
375
|
}
|
|
260
|
-
let
|
|
261
|
-
for (let
|
|
262
|
-
|
|
263
|
-
(
|
|
376
|
+
let w = [];
|
|
377
|
+
for (let E = 0; E < m[0].length; E++)
|
|
378
|
+
m.forEach((N, b) => {
|
|
379
|
+
(E != C - u || b >= d) && w.push(N[E]);
|
|
264
380
|
});
|
|
265
|
-
return s(
|
|
381
|
+
return s(w.length == f), w;
|
|
266
382
|
}
|
|
267
383
|
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
|
268
384
|
// data area of this QR Code. Function modules need to be marked off before this is called.
|
|
269
385
|
drawCodewords(e) {
|
|
270
|
-
if (e.length != Math.floor(
|
|
386
|
+
if (e.length != Math.floor(R.getNumRawDataModules(this.version) / 8))
|
|
271
387
|
throw new RangeError("Invalid argument");
|
|
272
388
|
let n = 0;
|
|
273
389
|
for (let o = this.size - 1; o >= 1; o -= 2) {
|
|
@@ -275,7 +391,7 @@ var W;
|
|
|
275
391
|
for (let i = 0; i < this.size; i++)
|
|
276
392
|
for (let u = 0; u < 2; u++) {
|
|
277
393
|
const f = o - u, C = (o + 1 & 2) == 0 ? this.size - 1 - i : i;
|
|
278
|
-
!this.isFunction[C][f] && n < e.length * 8 && (this.modules[C][f] =
|
|
394
|
+
!this.isFunction[C][f] && n < e.length * 8 && (this.modules[C][f] = c(e[n >>> 3], 7 - (n & 7)), n++);
|
|
279
395
|
}
|
|
280
396
|
}
|
|
281
397
|
s(n == e.length * 8);
|
|
@@ -328,26 +444,26 @@ var W;
|
|
|
328
444
|
let e = 0;
|
|
329
445
|
for (let u = 0; u < this.size; u++) {
|
|
330
446
|
let f = !1, d = 0, C = [0, 0, 0, 0, 0, 0, 0];
|
|
331
|
-
for (let
|
|
332
|
-
this.modules[u][
|
|
333
|
-
e += this.finderPenaltyTerminateAndCount(f, d, C) *
|
|
447
|
+
for (let m = 0; m < this.size; m++)
|
|
448
|
+
this.modules[u][m] == f ? (d++, d == 5 ? e += R.PENALTY_N1 : d > 5 && e++) : (this.finderPenaltyAddHistory(d, C), f || (e += this.finderPenaltyCountPatterns(C) * R.PENALTY_N3), f = this.modules[u][m], d = 1);
|
|
449
|
+
e += this.finderPenaltyTerminateAndCount(f, d, C) * R.PENALTY_N3;
|
|
334
450
|
}
|
|
335
451
|
for (let u = 0; u < this.size; u++) {
|
|
336
452
|
let f = !1, d = 0, C = [0, 0, 0, 0, 0, 0, 0];
|
|
337
|
-
for (let
|
|
338
|
-
this.modules[
|
|
339
|
-
e += this.finderPenaltyTerminateAndCount(f, d, C) *
|
|
453
|
+
for (let m = 0; m < this.size; m++)
|
|
454
|
+
this.modules[m][u] == f ? (d++, d == 5 ? e += R.PENALTY_N1 : d > 5 && e++) : (this.finderPenaltyAddHistory(d, C), f || (e += this.finderPenaltyCountPatterns(C) * R.PENALTY_N3), f = this.modules[m][u], d = 1);
|
|
455
|
+
e += this.finderPenaltyTerminateAndCount(f, d, C) * R.PENALTY_N3;
|
|
340
456
|
}
|
|
341
457
|
for (let u = 0; u < this.size - 1; u++)
|
|
342
458
|
for (let f = 0; f < this.size - 1; f++) {
|
|
343
459
|
const d = this.modules[u][f];
|
|
344
|
-
d == this.modules[u][f + 1] && d == this.modules[u + 1][f] && d == this.modules[u + 1][f + 1] && (e +=
|
|
460
|
+
d == this.modules[u][f + 1] && d == this.modules[u + 1][f] && d == this.modules[u + 1][f + 1] && (e += R.PENALTY_N2);
|
|
345
461
|
}
|
|
346
462
|
let n = 0;
|
|
347
463
|
for (const u of this.modules)
|
|
348
464
|
n = u.reduce((f, d) => f + (d ? 1 : 0), n);
|
|
349
465
|
const o = this.size * this.size, i = Math.ceil(Math.abs(n * 20 - o * 10) / o) - 1;
|
|
350
|
-
return s(0 <= i && i <= 9), e += i *
|
|
466
|
+
return s(0 <= i && i <= 9), e += i * R.PENALTY_N4, s(0 <= e && e <= 2568888), e;
|
|
351
467
|
}
|
|
352
468
|
/*-- Private helper functions --*/
|
|
353
469
|
// Returns an ascending list of positions of alignment patterns for this version number.
|
|
@@ -368,7 +484,7 @@ var W;
|
|
|
368
484
|
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
|
|
369
485
|
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
|
|
370
486
|
static getNumRawDataModules(e) {
|
|
371
|
-
if (e <
|
|
487
|
+
if (e < R.MIN_VERSION || e > R.MAX_VERSION)
|
|
372
488
|
throw new RangeError("Version number out of range");
|
|
373
489
|
let n = (16 * e + 128) * e + 64;
|
|
374
490
|
if (e >= 2) {
|
|
@@ -381,7 +497,7 @@ var W;
|
|
|
381
497
|
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
|
382
498
|
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
|
383
499
|
static getNumDataCodewords(e, n) {
|
|
384
|
-
return Math.floor(
|
|
500
|
+
return Math.floor(R.getNumRawDataModules(e) / 8) - R.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e] * R.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e];
|
|
385
501
|
}
|
|
386
502
|
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
|
|
387
503
|
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
|
|
@@ -395,8 +511,8 @@ var W;
|
|
|
395
511
|
let o = 1;
|
|
396
512
|
for (let i = 0; i < e; i++) {
|
|
397
513
|
for (let u = 0; u < n.length; u++)
|
|
398
|
-
n[u] =
|
|
399
|
-
o =
|
|
514
|
+
n[u] = R.reedSolomonMultiply(n[u], o), u + 1 < n.length && (n[u] ^= n[u + 1]);
|
|
515
|
+
o = R.reedSolomonMultiply(o, 2);
|
|
400
516
|
}
|
|
401
517
|
return n;
|
|
402
518
|
}
|
|
@@ -405,7 +521,7 @@ var W;
|
|
|
405
521
|
let o = n.map((i) => 0);
|
|
406
522
|
for (const i of e) {
|
|
407
523
|
const u = i ^ o.shift();
|
|
408
|
-
o.push(0), n.forEach((f, d) => o[d] ^=
|
|
524
|
+
o.push(0), n.forEach((f, d) => o[d] ^= R.reedSolomonMultiply(f, u));
|
|
409
525
|
}
|
|
410
526
|
return o;
|
|
411
527
|
}
|
|
@@ -465,14 +581,14 @@ var W;
|
|
|
465
581
|
for (let o = e - 1; o >= 0; o--)
|
|
466
582
|
n.push(h >>> o & 1);
|
|
467
583
|
}
|
|
468
|
-
function
|
|
584
|
+
function c(h, e) {
|
|
469
585
|
return (h >>> e & 1) != 0;
|
|
470
586
|
}
|
|
471
587
|
function s(h) {
|
|
472
588
|
if (!h)
|
|
473
589
|
throw new Error("Assertion error");
|
|
474
590
|
}
|
|
475
|
-
const
|
|
591
|
+
const a = class y {
|
|
476
592
|
/*-- Constructor (low level) and fields --*/
|
|
477
593
|
// Creates a new QR Code segment with the given attributes and data.
|
|
478
594
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
|
@@ -574,17 +690,17 @@ var W;
|
|
|
574
690
|
return n;
|
|
575
691
|
}
|
|
576
692
|
};
|
|
577
|
-
|
|
578
|
-
let
|
|
579
|
-
t.QrSegment =
|
|
693
|
+
a.NUMERIC_REGEX = /^[0-9]*$/, a.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, a.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
694
|
+
let p = a;
|
|
695
|
+
t.QrSegment = a;
|
|
580
696
|
})(W || (W = {}));
|
|
581
697
|
((t) => {
|
|
582
698
|
((r) => {
|
|
583
699
|
const l = class {
|
|
584
700
|
// The QR Code can tolerate about 30% erroneous codewords
|
|
585
701
|
/*-- Constructor and fields --*/
|
|
586
|
-
constructor(s,
|
|
587
|
-
this.ordinal = s, this.formatBits =
|
|
702
|
+
constructor(s, a) {
|
|
703
|
+
this.ordinal = s, this.formatBits = a;
|
|
588
704
|
}
|
|
589
705
|
};
|
|
590
706
|
l.LOW = new l(0, 1), l.MEDIUM = new l(1, 0), l.QUARTILE = new l(2, 3), l.HIGH = new l(3, 2), r.Ecc = l;
|
|
@@ -594,8 +710,8 @@ var W;
|
|
|
594
710
|
((r) => {
|
|
595
711
|
const l = class {
|
|
596
712
|
/*-- Constructor and fields --*/
|
|
597
|
-
constructor(s,
|
|
598
|
-
this.modeBits = s, this.numBitsCharCount =
|
|
713
|
+
constructor(s, a) {
|
|
714
|
+
this.modeBits = s, this.numBitsCharCount = a;
|
|
599
715
|
}
|
|
600
716
|
/*-- Method --*/
|
|
601
717
|
// (Package-private) Returns the bit width of the character count field for a segment in
|
|
@@ -613,89 +729,89 @@ var Z = W;
|
|
|
613
729
|
* Copyright (c) Paul O'Shannessy
|
|
614
730
|
* SPDX-License-Identifier: ISC
|
|
615
731
|
*/
|
|
616
|
-
var
|
|
732
|
+
var Et = {
|
|
617
733
|
L: Z.QrCode.Ecc.LOW,
|
|
618
734
|
M: Z.QrCode.Ecc.MEDIUM,
|
|
619
735
|
Q: Z.QrCode.Ecc.QUARTILE,
|
|
620
736
|
H: Z.QrCode.Ecc.HIGH
|
|
621
|
-
},
|
|
622
|
-
function
|
|
737
|
+
}, be = 128, ye = "L", Pe = "#FFFFFF", De = "#000000", Te = !1, Oe = 1, Ct = 4, Rt = 0, wt = 0.1;
|
|
738
|
+
function xe(t, r = 0) {
|
|
623
739
|
const l = [];
|
|
624
|
-
return t.forEach(function(
|
|
625
|
-
let
|
|
626
|
-
|
|
627
|
-
if (!
|
|
740
|
+
return t.forEach(function(c, s) {
|
|
741
|
+
let a = null;
|
|
742
|
+
c.forEach(function(p, h) {
|
|
743
|
+
if (!p && a !== null) {
|
|
628
744
|
l.push(
|
|
629
|
-
`M${
|
|
630
|
-
),
|
|
745
|
+
`M${a + r} ${s + r}h${h - a}v1H${a + r}z`
|
|
746
|
+
), a = null;
|
|
631
747
|
return;
|
|
632
748
|
}
|
|
633
|
-
if (h ===
|
|
634
|
-
if (!
|
|
749
|
+
if (h === c.length - 1) {
|
|
750
|
+
if (!p)
|
|
635
751
|
return;
|
|
636
|
-
|
|
637
|
-
`M${
|
|
752
|
+
a === null ? l.push(`M${h + r},${s + r} h1v1H${h + r}z`) : l.push(
|
|
753
|
+
`M${a + r},${s + r} h${h + 1 - a}v1H${a + r}z`
|
|
638
754
|
);
|
|
639
755
|
return;
|
|
640
756
|
}
|
|
641
|
-
|
|
757
|
+
p && a === null && (a = h);
|
|
642
758
|
});
|
|
643
759
|
}), l.join("");
|
|
644
760
|
}
|
|
645
|
-
function
|
|
646
|
-
return t.slice().map((l,
|
|
761
|
+
function Le(t, r) {
|
|
762
|
+
return t.slice().map((l, c) => c < r.y || c >= r.y + r.h ? l : l.map((s, a) => a < r.x || a >= r.x + r.w ? s : !1));
|
|
647
763
|
}
|
|
648
|
-
function
|
|
649
|
-
if (
|
|
764
|
+
function Mt(t, r, l, c) {
|
|
765
|
+
if (c == null)
|
|
650
766
|
return null;
|
|
651
|
-
const s = t.length + l * 2,
|
|
767
|
+
const s = t.length + l * 2, a = Math.floor(r * wt), p = s / r, h = (c.width || a) * p, e = (c.height || a) * p, n = c.x == null ? t.length / 2 - h / 2 : c.x * p, o = c.y == null ? t.length / 2 - e / 2 : c.y * p, i = c.opacity == null ? 1 : c.opacity;
|
|
652
768
|
let u = null;
|
|
653
|
-
if (
|
|
654
|
-
let d = Math.floor(n), C = Math.floor(o),
|
|
655
|
-
u = { x: d, y: C, w:
|
|
769
|
+
if (c.excavate) {
|
|
770
|
+
let d = Math.floor(n), C = Math.floor(o), m = Math.ceil(h + n - d), I = Math.ceil(e + o - C);
|
|
771
|
+
u = { x: d, y: C, w: m, h: I };
|
|
656
772
|
}
|
|
657
|
-
const f =
|
|
773
|
+
const f = c.crossOrigin;
|
|
658
774
|
return { x: n, y: o, h: e, w: h, excavation: u, opacity: i, crossOrigin: f };
|
|
659
775
|
}
|
|
660
|
-
function
|
|
661
|
-
return r != null ? Math.max(Math.floor(r), 0) : t ?
|
|
776
|
+
function Nt(t, r) {
|
|
777
|
+
return r != null ? Math.max(Math.floor(r), 0) : t ? Ct : Rt;
|
|
662
778
|
}
|
|
663
|
-
function
|
|
779
|
+
function Be({
|
|
664
780
|
value: t,
|
|
665
781
|
level: r,
|
|
666
782
|
minVersion: l,
|
|
667
|
-
includeMargin:
|
|
783
|
+
includeMargin: c,
|
|
668
784
|
marginSize: s,
|
|
669
|
-
imageSettings:
|
|
670
|
-
size:
|
|
785
|
+
imageSettings: a,
|
|
786
|
+
size: p,
|
|
671
787
|
boostLevel: h
|
|
672
788
|
}) {
|
|
673
|
-
let e =
|
|
674
|
-
const d = (Array.isArray(t) ? t : [t]).reduce((C,
|
|
789
|
+
let e = O.useMemo(() => {
|
|
790
|
+
const d = (Array.isArray(t) ? t : [t]).reduce((C, m) => (C.push(...Z.QrSegment.makeSegments(m)), C), []);
|
|
675
791
|
return Z.QrCode.encodeSegments(
|
|
676
792
|
d,
|
|
677
|
-
|
|
793
|
+
Et[r],
|
|
678
794
|
l,
|
|
679
795
|
void 0,
|
|
680
796
|
void 0,
|
|
681
797
|
h
|
|
682
798
|
);
|
|
683
799
|
}, [t, r, l, h]);
|
|
684
|
-
const { cells: n, margin: o, numCells: i, calculatedImageSettings: u } =
|
|
800
|
+
const { cells: n, margin: o, numCells: i, calculatedImageSettings: u } = O.useMemo(() => {
|
|
685
801
|
let f = e.getModules();
|
|
686
|
-
const d =
|
|
802
|
+
const d = Nt(c, s), C = f.length + d * 2, m = Mt(
|
|
687
803
|
f,
|
|
688
|
-
|
|
804
|
+
p,
|
|
689
805
|
d,
|
|
690
|
-
|
|
806
|
+
a
|
|
691
807
|
);
|
|
692
808
|
return {
|
|
693
809
|
cells: f,
|
|
694
810
|
margin: d,
|
|
695
811
|
numCells: C,
|
|
696
|
-
calculatedImageSettings:
|
|
812
|
+
calculatedImageSettings: m
|
|
697
813
|
};
|
|
698
|
-
}, [e,
|
|
814
|
+
}, [e, p, a, c, s]);
|
|
699
815
|
return {
|
|
700
816
|
qrcode: e,
|
|
701
817
|
margin: o,
|
|
@@ -704,27 +820,27 @@ function Le({
|
|
|
704
820
|
calculatedImageSettings: u
|
|
705
821
|
};
|
|
706
822
|
}
|
|
707
|
-
var
|
|
823
|
+
var It = (function() {
|
|
708
824
|
try {
|
|
709
825
|
new Path2D().addPath(new Path2D());
|
|
710
826
|
} catch {
|
|
711
827
|
return !1;
|
|
712
828
|
}
|
|
713
829
|
return !0;
|
|
714
|
-
})(),
|
|
830
|
+
})(), At = O.forwardRef(
|
|
715
831
|
function(r, l) {
|
|
716
|
-
const
|
|
832
|
+
const c = r, {
|
|
717
833
|
value: s,
|
|
718
|
-
size:
|
|
719
|
-
level:
|
|
720
|
-
bgColor: h =
|
|
721
|
-
fgColor: e =
|
|
722
|
-
includeMargin: n =
|
|
834
|
+
size: a = be,
|
|
835
|
+
level: p = ye,
|
|
836
|
+
bgColor: h = Pe,
|
|
837
|
+
fgColor: e = De,
|
|
838
|
+
includeMargin: n = Te,
|
|
723
839
|
minVersion: o = Oe,
|
|
724
840
|
boostLevel: i,
|
|
725
841
|
marginSize: u,
|
|
726
842
|
imageSettings: f
|
|
727
|
-
} =
|
|
843
|
+
} = c, C = de(c, [
|
|
728
844
|
"value",
|
|
729
845
|
"size",
|
|
730
846
|
"level",
|
|
@@ -735,57 +851,57 @@ var ht = (function() {
|
|
|
735
851
|
"boostLevel",
|
|
736
852
|
"marginSize",
|
|
737
853
|
"imageSettings"
|
|
738
|
-
]), { style:
|
|
739
|
-
(
|
|
740
|
-
|
|
854
|
+
]), { style: m } = C, I = de(C, ["style"]), w = f == null ? void 0 : f.src, E = O.useRef(null), N = O.useRef(null), b = O.useCallback(
|
|
855
|
+
(S) => {
|
|
856
|
+
E.current = S, typeof l == "function" ? l(S) : l && (l.current = S);
|
|
741
857
|
},
|
|
742
858
|
[l]
|
|
743
|
-
), [P, x] =
|
|
859
|
+
), [P, x] = O.useState(!1), { margin: T, cells: z, numCells: $, calculatedImageSettings: D } = Be({
|
|
744
860
|
value: s,
|
|
745
|
-
level:
|
|
861
|
+
level: p,
|
|
746
862
|
minVersion: o,
|
|
747
863
|
boostLevel: i,
|
|
748
864
|
includeMargin: n,
|
|
749
865
|
marginSize: u,
|
|
750
866
|
imageSettings: f,
|
|
751
|
-
size:
|
|
867
|
+
size: a
|
|
752
868
|
});
|
|
753
|
-
|
|
754
|
-
if (
|
|
755
|
-
const
|
|
869
|
+
O.useEffect(() => {
|
|
870
|
+
if (E.current != null) {
|
|
871
|
+
const S = E.current, M = S.getContext("2d");
|
|
756
872
|
if (!M)
|
|
757
873
|
return;
|
|
758
|
-
let
|
|
874
|
+
let A = z;
|
|
759
875
|
const L = N.current, j = D != null && L !== null && L.complete && L.naturalHeight !== 0 && L.naturalWidth !== 0;
|
|
760
|
-
j && D.excavation != null && (
|
|
761
|
-
|
|
876
|
+
j && D.excavation != null && (A = Le(
|
|
877
|
+
z,
|
|
762
878
|
D.excavation
|
|
763
879
|
));
|
|
764
880
|
const ne = window.devicePixelRatio || 1;
|
|
765
|
-
|
|
766
|
-
const re =
|
|
767
|
-
M.scale(re, re), M.fillStyle = h, M.fillRect(0, 0, $, $), M.fillStyle = e,
|
|
881
|
+
S.height = S.width = a * ne;
|
|
882
|
+
const re = a / $ * ne;
|
|
883
|
+
M.scale(re, re), M.fillStyle = h, M.fillRect(0, 0, $, $), M.fillStyle = e, It ? M.fill(new Path2D(xe(A, T))) : z.forEach(function(V, G) {
|
|
768
884
|
V.forEach(function(q, ae) {
|
|
769
|
-
q && M.fillRect(ae +
|
|
885
|
+
q && M.fillRect(ae + T, G + T, 1, 1);
|
|
770
886
|
});
|
|
771
887
|
}), D && (M.globalAlpha = D.opacity), j && M.drawImage(
|
|
772
888
|
L,
|
|
773
|
-
D.x +
|
|
774
|
-
D.y +
|
|
889
|
+
D.x + T,
|
|
890
|
+
D.y + T,
|
|
775
891
|
D.w,
|
|
776
892
|
D.h
|
|
777
893
|
);
|
|
778
894
|
}
|
|
779
|
-
}),
|
|
895
|
+
}), O.useEffect(() => {
|
|
780
896
|
x(!1);
|
|
781
|
-
}, [
|
|
782
|
-
const H = ue({ height:
|
|
897
|
+
}, [w]);
|
|
898
|
+
const H = ue({ height: a, width: a }, m);
|
|
783
899
|
let Q = null;
|
|
784
|
-
return
|
|
900
|
+
return w != null && (Q = /* @__PURE__ */ O.createElement(
|
|
785
901
|
"img",
|
|
786
902
|
{
|
|
787
|
-
src:
|
|
788
|
-
key:
|
|
903
|
+
src: w,
|
|
904
|
+
key: w,
|
|
789
905
|
style: { display: "none" },
|
|
790
906
|
onLoad: () => {
|
|
791
907
|
x(!0);
|
|
@@ -793,34 +909,34 @@ var ht = (function() {
|
|
|
793
909
|
ref: N,
|
|
794
910
|
crossOrigin: D == null ? void 0 : D.crossOrigin
|
|
795
911
|
}
|
|
796
|
-
)), /* @__PURE__ */
|
|
912
|
+
)), /* @__PURE__ */ O.createElement(O.Fragment, null, /* @__PURE__ */ O.createElement(
|
|
797
913
|
"canvas",
|
|
798
914
|
ue({
|
|
799
915
|
style: H,
|
|
800
|
-
height:
|
|
801
|
-
width:
|
|
916
|
+
height: a,
|
|
917
|
+
width: a,
|
|
802
918
|
ref: b,
|
|
803
919
|
role: "img"
|
|
804
|
-
},
|
|
920
|
+
}, I)
|
|
805
921
|
), Q);
|
|
806
922
|
}
|
|
807
923
|
);
|
|
808
|
-
|
|
809
|
-
var Se =
|
|
924
|
+
At.displayName = "QRCodeCanvas";
|
|
925
|
+
var Se = O.forwardRef(
|
|
810
926
|
function(r, l) {
|
|
811
|
-
const
|
|
927
|
+
const c = r, {
|
|
812
928
|
value: s,
|
|
813
|
-
size:
|
|
814
|
-
level:
|
|
815
|
-
bgColor: h =
|
|
816
|
-
fgColor: e =
|
|
817
|
-
includeMargin: n =
|
|
929
|
+
size: a = be,
|
|
930
|
+
level: p = ye,
|
|
931
|
+
bgColor: h = Pe,
|
|
932
|
+
fgColor: e = De,
|
|
933
|
+
includeMargin: n = Te,
|
|
818
934
|
minVersion: o = Oe,
|
|
819
935
|
boostLevel: i,
|
|
820
936
|
title: u,
|
|
821
937
|
marginSize: f,
|
|
822
938
|
imageSettings: d
|
|
823
|
-
} =
|
|
939
|
+
} = c, C = de(c, [
|
|
824
940
|
"value",
|
|
825
941
|
"size",
|
|
826
942
|
"level",
|
|
@@ -832,96 +948,96 @@ var Se = T.forwardRef(
|
|
|
832
948
|
"title",
|
|
833
949
|
"marginSize",
|
|
834
950
|
"imageSettings"
|
|
835
|
-
]), { margin:
|
|
951
|
+
]), { margin: m, cells: I, numCells: w, calculatedImageSettings: E } = Be({
|
|
836
952
|
value: s,
|
|
837
|
-
level:
|
|
953
|
+
level: p,
|
|
838
954
|
minVersion: o,
|
|
839
955
|
boostLevel: i,
|
|
840
956
|
includeMargin: n,
|
|
841
957
|
marginSize: f,
|
|
842
958
|
imageSettings: d,
|
|
843
|
-
size:
|
|
959
|
+
size: a
|
|
844
960
|
});
|
|
845
|
-
let N =
|
|
846
|
-
d != null &&
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
)), b = /* @__PURE__ */
|
|
961
|
+
let N = I, b = null;
|
|
962
|
+
d != null && E != null && (E.excavation != null && (N = Le(
|
|
963
|
+
I,
|
|
964
|
+
E.excavation
|
|
965
|
+
)), b = /* @__PURE__ */ O.createElement(
|
|
850
966
|
"image",
|
|
851
967
|
{
|
|
852
968
|
href: d.src,
|
|
853
|
-
height:
|
|
854
|
-
width:
|
|
855
|
-
x:
|
|
856
|
-
y:
|
|
969
|
+
height: E.h,
|
|
970
|
+
width: E.w,
|
|
971
|
+
x: E.x + m,
|
|
972
|
+
y: E.y + m,
|
|
857
973
|
preserveAspectRatio: "none",
|
|
858
|
-
opacity:
|
|
859
|
-
crossOrigin:
|
|
974
|
+
opacity: E.opacity,
|
|
975
|
+
crossOrigin: E.crossOrigin
|
|
860
976
|
}
|
|
861
977
|
));
|
|
862
|
-
const P =
|
|
863
|
-
return /* @__PURE__ */
|
|
978
|
+
const P = xe(N, m);
|
|
979
|
+
return /* @__PURE__ */ O.createElement(
|
|
864
980
|
"svg",
|
|
865
981
|
ue({
|
|
866
|
-
height:
|
|
867
|
-
width:
|
|
868
|
-
viewBox: `0 0 ${
|
|
982
|
+
height: a,
|
|
983
|
+
width: a,
|
|
984
|
+
viewBox: `0 0 ${w} ${w}`,
|
|
869
985
|
ref: l,
|
|
870
986
|
role: "img"
|
|
871
987
|
}, C),
|
|
872
|
-
!!u && /* @__PURE__ */
|
|
873
|
-
/* @__PURE__ */
|
|
988
|
+
!!u && /* @__PURE__ */ O.createElement("title", null, u),
|
|
989
|
+
/* @__PURE__ */ O.createElement(
|
|
874
990
|
"path",
|
|
875
991
|
{
|
|
876
992
|
fill: h,
|
|
877
|
-
d: `M0,0 h${
|
|
993
|
+
d: `M0,0 h${w}v${w}H0z`,
|
|
878
994
|
shapeRendering: "crispEdges"
|
|
879
995
|
}
|
|
880
996
|
),
|
|
881
|
-
/* @__PURE__ */
|
|
997
|
+
/* @__PURE__ */ O.createElement("path", { fill: e, d: P, shapeRendering: "crispEdges" }),
|
|
882
998
|
b
|
|
883
999
|
);
|
|
884
1000
|
}
|
|
885
1001
|
);
|
|
886
1002
|
Se.displayName = "QRCodeSVG";
|
|
887
|
-
const
|
|
888
|
-
invitationType:
|
|
1003
|
+
const bt = (t, r) => ({
|
|
1004
|
+
invitationType: qe.LINK,
|
|
889
1005
|
resources: [
|
|
890
1006
|
{
|
|
891
1007
|
url: `conversations/${encodeURI(t)}`
|
|
892
1008
|
},
|
|
893
1009
|
...r
|
|
894
1010
|
]
|
|
895
|
-
}),
|
|
1011
|
+
}), yt = (t) => {
|
|
896
1012
|
var l;
|
|
897
1013
|
const r = ((l = t == null ? void 0 : t.invitationLink) == null ? void 0 : l.split("/").at(-1)) || "";
|
|
898
|
-
return `/${
|
|
899
|
-
},
|
|
900
|
-
var
|
|
901
|
-
const
|
|
902
|
-
return s ===
|
|
903
|
-
}),
|
|
904
|
-
var l,
|
|
1014
|
+
return `/${we}/${r}`;
|
|
1015
|
+
}, Pt = (t, r) => r == null ? void 0 : r.find((l) => {
|
|
1016
|
+
var a, p, h, e;
|
|
1017
|
+
const c = (p = (a = t == null ? void 0 : t.id) == null ? void 0 : a.split("/")) == null ? void 0 : p.pop(), s = ((e = (h = l == null ? void 0 : l.url) == null ? void 0 : h.split("/")) == null ? void 0 : e.pop()) || "";
|
|
1018
|
+
return s === c || decodeURI(s) === c;
|
|
1019
|
+
}), Dt = (t) => {
|
|
1020
|
+
var l, c;
|
|
905
1021
|
const r = (l = t == null ? void 0 : t.messages) == null ? void 0 : l.filter(
|
|
906
1022
|
(s) => {
|
|
907
|
-
var
|
|
908
|
-
return !!((
|
|
1023
|
+
var a;
|
|
1024
|
+
return !!((a = s == null ? void 0 : s.custom_content) != null && a.attachments);
|
|
909
1025
|
}
|
|
910
1026
|
);
|
|
911
|
-
return ((
|
|
912
|
-
var
|
|
913
|
-
return ((
|
|
1027
|
+
return ((c = r == null ? void 0 : r.flatMap((s) => {
|
|
1028
|
+
var a, p;
|
|
1029
|
+
return ((p = (a = s == null ? void 0 : s.custom_content) == null ? void 0 : a.attachments) == null ? void 0 : p.map((h) => ({
|
|
914
1030
|
url: (h == null ? void 0 : h.url) || ""
|
|
915
1031
|
}))) || [];
|
|
916
|
-
})) == null ? void 0 :
|
|
917
|
-
},
|
|
1032
|
+
})) == null ? void 0 : c.filter((s) => !!(s != null && s.url))) || [];
|
|
1033
|
+
}, Tt = ({
|
|
918
1034
|
conversation: t,
|
|
919
1035
|
locale: r,
|
|
920
1036
|
onCloseModal: l,
|
|
921
|
-
modalDividers:
|
|
1037
|
+
modalDividers: c,
|
|
922
1038
|
getConversation: s,
|
|
923
|
-
generateConversationLink:
|
|
924
|
-
chatExpiration:
|
|
1039
|
+
generateConversationLink: a,
|
|
1040
|
+
chatExpiration: p,
|
|
925
1041
|
chatExpirationDays: h,
|
|
926
1042
|
close: e,
|
|
927
1043
|
chatWarning: n,
|
|
@@ -931,33 +1047,33 @@ const Be = "share", mt = "onboarding", pt = (t, r) => ({
|
|
|
931
1047
|
shareDescription: f,
|
|
932
1048
|
shareRemoveAccessToUsers: d,
|
|
933
1049
|
chatName: C,
|
|
934
|
-
getSharedConversations:
|
|
935
|
-
revokeSharedConversations:
|
|
936
|
-
baseUrl:
|
|
937
|
-
id:
|
|
1050
|
+
getSharedConversations: m,
|
|
1051
|
+
revokeSharedConversations: I,
|
|
1052
|
+
baseUrl: w,
|
|
1053
|
+
id: E,
|
|
938
1054
|
clientSharedPage: N,
|
|
939
1055
|
clientSharedProp: b
|
|
940
1056
|
}) => {
|
|
941
|
-
const [P, x] = F(null), [
|
|
1057
|
+
const [P, x] = F(null), [T, z] = F(), [$, D] = F(!1), [H, Q] = F(!1), [S, M] = F(), A = he(() => {
|
|
942
1058
|
var G;
|
|
943
|
-
const V =
|
|
944
|
-
if (
|
|
945
|
-
const q = (G = P == null ? void 0 : P.split(`/${
|
|
1059
|
+
const V = w || window.location.origin;
|
|
1060
|
+
if (w && w !== window.location.origin && N && b) {
|
|
1061
|
+
const q = (G = P == null ? void 0 : P.split(`/${we}/`)) == null ? void 0 : G[1];
|
|
946
1062
|
return `${V}/${N}?${b}=${q}`;
|
|
947
1063
|
}
|
|
948
1064
|
return `${V}/${r}${P}`;
|
|
949
|
-
}, [
|
|
1065
|
+
}, [w, P, r, N, b]);
|
|
950
1066
|
ee(() => {
|
|
951
1067
|
(async () => {
|
|
952
1068
|
try {
|
|
953
|
-
const G = decodeURI(t ? t == null ? void 0 : t.id : `${
|
|
1069
|
+
const G = decodeURI(t ? t == null ? void 0 : t.id : `${E == null ? void 0 : E[0]}/${r}/${E == null ? void 0 : E[1]}`), q = `${decodeURI(G)}`, ae = await (s == null ? void 0 : s(q)), Ue = bt(
|
|
954
1070
|
G,
|
|
955
|
-
|
|
956
|
-
),
|
|
1071
|
+
Dt(ae)
|
|
1072
|
+
), ge = await (a == null ? void 0 : a(Ue)), oe = await (m == null ? void 0 : m(
|
|
957
1073
|
le(ie.OTHERS)
|
|
958
1074
|
));
|
|
959
|
-
|
|
960
|
-
|
|
1075
|
+
ge && oe && (D(!0), x(yt(ge)), z(
|
|
1076
|
+
Pt(
|
|
961
1077
|
t,
|
|
962
1078
|
oe == null ? void 0 : oe.resources
|
|
963
1079
|
)
|
|
@@ -968,46 +1084,46 @@ const Be = "share", mt = "onboarding", pt = (t, r) => ({
|
|
|
968
1084
|
})();
|
|
969
1085
|
}, [
|
|
970
1086
|
t,
|
|
971
|
-
|
|
1087
|
+
a,
|
|
972
1088
|
s,
|
|
973
|
-
|
|
974
|
-
|
|
1089
|
+
m,
|
|
1090
|
+
E,
|
|
975
1091
|
r
|
|
976
1092
|
]);
|
|
977
1093
|
const L = _(() => {
|
|
978
1094
|
l(), x(null), D(!1), Q(!1);
|
|
979
1095
|
}, [l]), j = _(() => {
|
|
980
|
-
Q(!0), navigator.clipboard.writeText(
|
|
981
|
-
}, [
|
|
1096
|
+
Q(!0), navigator.clipboard.writeText(A || "");
|
|
1097
|
+
}, [A]), ne = async () => {
|
|
982
1098
|
try {
|
|
983
|
-
M(!0),
|
|
1099
|
+
M(!0), T && await (I == null ? void 0 : I({ resources: [T] }));
|
|
984
1100
|
} catch (V) {
|
|
985
1101
|
M(!1), console.error("Error revoking shared conversation", V);
|
|
986
1102
|
}
|
|
987
|
-
}, re = _(() => /* @__PURE__ */
|
|
1103
|
+
}, re = _(() => /* @__PURE__ */ g(
|
|
988
1104
|
X,
|
|
989
1105
|
{
|
|
990
1106
|
buttonClassName: H ? "text-button-secondary" : "text-button-primary",
|
|
991
|
-
iconBefore: H ? /* @__PURE__ */
|
|
1107
|
+
iconBefore: H ? /* @__PURE__ */ g(je, { width: 20, height: 20 }) : /* @__PURE__ */ g(Ve, { width: 20, height: 20 }),
|
|
992
1108
|
title: H ? u ?? "Copied" : i ?? "Copy link",
|
|
993
1109
|
disabled: H,
|
|
994
1110
|
onClick: j
|
|
995
1111
|
}
|
|
996
1112
|
), [H, j, u, i]);
|
|
997
|
-
return /* @__PURE__ */
|
|
998
|
-
|
|
1113
|
+
return /* @__PURE__ */ B(
|
|
1114
|
+
fe,
|
|
999
1115
|
{
|
|
1000
1116
|
heading: o ?? "Share link",
|
|
1001
1117
|
portalId: "share",
|
|
1002
|
-
size:
|
|
1003
|
-
dividers:
|
|
1118
|
+
size: me.SM,
|
|
1119
|
+
dividers: c,
|
|
1004
1120
|
onClose: L,
|
|
1005
1121
|
closeButtonTitle: e ?? "Close",
|
|
1006
1122
|
children: [
|
|
1007
|
-
$ ? /* @__PURE__ */
|
|
1008
|
-
t != null && t.name ? /* @__PURE__ */
|
|
1009
|
-
/* @__PURE__ */
|
|
1010
|
-
/* @__PURE__ */
|
|
1123
|
+
$ ? /* @__PURE__ */ B("div", { className: "share flex flex-col gap-y-4 px-6 pb-6 overflow-auto sm:p-0", children: [
|
|
1124
|
+
t != null && t.name ? /* @__PURE__ */ B("div", { className: "flex share-info w-full", children: [
|
|
1125
|
+
/* @__PURE__ */ g("p", { className: "share-info-title text-neutrals-800 mr-1 body-1", children: C ?? "Chat name:" }),
|
|
1126
|
+
/* @__PURE__ */ g(
|
|
1011
1127
|
"h3",
|
|
1012
1128
|
{
|
|
1013
1129
|
className: "flex-1 min-w-0 truncate",
|
|
@@ -1016,196 +1132,79 @@ const Be = "share", mt = "onboarding", pt = (t, r) => ({
|
|
|
1016
1132
|
}
|
|
1017
1133
|
)
|
|
1018
1134
|
] }) : null,
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
-
/* @__PURE__ */
|
|
1135
|
+
/* @__PURE__ */ B("div", { className: "flex share-info", children: [
|
|
1136
|
+
/* @__PURE__ */ g("p", { className: "share-info-title text-neutrals-800 mr-1 body-1", children: p ?? "Link expiration date:" }),
|
|
1137
|
+
/* @__PURE__ */ B("h3", { children: [
|
|
1022
1138
|
"3 ",
|
|
1023
1139
|
h ?? "days"
|
|
1024
1140
|
] })
|
|
1025
1141
|
] }),
|
|
1026
|
-
/* @__PURE__ */
|
|
1142
|
+
/* @__PURE__ */ g(
|
|
1027
1143
|
Se,
|
|
1028
1144
|
{
|
|
1029
1145
|
className: "self-center border border-neutrals-600 p-2 rounded min-h-[200px]",
|
|
1030
|
-
value:
|
|
1146
|
+
value: A,
|
|
1031
1147
|
size: 200
|
|
1032
1148
|
}
|
|
1033
1149
|
),
|
|
1034
|
-
/* @__PURE__ */
|
|
1035
|
-
/* @__PURE__ */
|
|
1036
|
-
|
|
1150
|
+
/* @__PURE__ */ g("p", { className: "body-2 text-neutrals-1000", children: f ?? "Your name, special instructions, and any messages you add after sharing remain confidential." }),
|
|
1151
|
+
/* @__PURE__ */ g(
|
|
1152
|
+
Re,
|
|
1037
1153
|
{
|
|
1038
1154
|
containerClasses: "share-input-container",
|
|
1039
1155
|
cssClass: "share-input",
|
|
1040
1156
|
readonly: !0,
|
|
1041
|
-
placeholder:
|
|
1042
|
-
value:
|
|
1157
|
+
placeholder: A,
|
|
1158
|
+
value: A,
|
|
1043
1159
|
inputId: "conversationLink",
|
|
1044
1160
|
iconAfterInput: re()
|
|
1045
1161
|
}
|
|
1046
1162
|
)
|
|
1047
|
-
] }) : /* @__PURE__ */
|
|
1048
|
-
$ ? t &&
|
|
1163
|
+
] }) : /* @__PURE__ */ g("div", { className: "flex justify-center items-center py-6 px-6", children: /* @__PURE__ */ g(Ce, {}) }),
|
|
1164
|
+
$ ? t && T ? /* @__PURE__ */ g("div", { className: "remove-access", children: /* @__PURE__ */ g(
|
|
1049
1165
|
X,
|
|
1050
1166
|
{
|
|
1051
1167
|
title: d ?? "Remove access to all users",
|
|
1052
1168
|
buttonClassName: "remove-access-button py-3 px-4",
|
|
1053
1169
|
isSmallButton: !0,
|
|
1054
|
-
disabled:
|
|
1170
|
+
disabled: S,
|
|
1055
1171
|
onClick: ne
|
|
1056
1172
|
}
|
|
1057
|
-
) }) : /* @__PURE__ */
|
|
1173
|
+
) }) : /* @__PURE__ */ g("p", { className: "body-2 text-neutrals-800 share-footer", children: n ?? "This chat has not been shared with anyone yet." }) : /* @__PURE__ */ g("div", {})
|
|
1058
1174
|
]
|
|
1059
1175
|
}
|
|
1060
1176
|
);
|
|
1061
|
-
},
|
|
1062
|
-
const r = t.messages.flatMap((a) => {
|
|
1063
|
-
var m, h, e;
|
|
1064
|
-
const s = ((m = a.custom_content) == null ? void 0 : m.attachments) || [], c = ((e = (h = a.custom_content) == null ? void 0 : h.stages) == null ? void 0 : e.flatMap(
|
|
1065
|
-
({ attachments: n }) => n ?? []
|
|
1066
|
-
)) || [];
|
|
1067
|
-
return [...s, ...c];
|
|
1068
|
-
}) || [], l = At(r).map(
|
|
1069
|
-
(a) => ({
|
|
1070
|
-
...a,
|
|
1071
|
-
relativePath: "",
|
|
1072
|
-
contentLength: 0
|
|
1073
|
-
})
|
|
1074
|
-
);
|
|
1075
|
-
return je(
|
|
1076
|
-
l,
|
|
1077
|
-
(a) => te(a.relativePath, a.name)
|
|
1078
|
-
);
|
|
1079
|
-
}, Mt = (t) => t.endsWith("/"), Nt = (t) => {
|
|
1080
|
-
const r = t.toLowerCase();
|
|
1081
|
-
return [
|
|
1082
|
-
"data:",
|
|
1083
|
-
"//",
|
|
1084
|
-
"http://",
|
|
1085
|
-
"https://",
|
|
1086
|
-
"file://",
|
|
1087
|
-
"ftp://",
|
|
1088
|
-
"mailto:",
|
|
1089
|
-
"telnet://",
|
|
1090
|
-
"api/files"
|
|
1091
|
-
].some((l) => r.startsWith(l));
|
|
1092
|
-
}, It = (t) => {
|
|
1093
|
-
const r = te(
|
|
1094
|
-
...t.split("/").map((a) => decodeURIComponent(a))
|
|
1095
|
-
), l = r.lastIndexOf("/");
|
|
1096
|
-
return {
|
|
1097
|
-
absolutePath: r.slice(0, l),
|
|
1098
|
-
name: r.slice(l + 1)
|
|
1099
|
-
};
|
|
1100
|
-
}, At = (t) => t ? t.map((r) => {
|
|
1101
|
-
if (!r.url || Nt(r.url) || Mt(r.url))
|
|
1102
|
-
return null;
|
|
1103
|
-
const { absolutePath: l, name: a } = It(r.url);
|
|
1104
|
-
return {
|
|
1105
|
-
id: r.url,
|
|
1106
|
-
name: a,
|
|
1107
|
-
contentType: r.type,
|
|
1108
|
-
folderId: l,
|
|
1109
|
-
absolutePath: l
|
|
1110
|
-
};
|
|
1111
|
-
}).filter(Boolean) : [];
|
|
1112
|
-
async function bt(t, r) {
|
|
1113
|
-
const l = Rt(t), a = new qe();
|
|
1114
|
-
l.forEach((h) => {
|
|
1115
|
-
const e = encodeURI(te(h.absolutePath, h.name)), n = r(`${e}`.replace("files/", "")), o = yt(h.folderId), i = te("res", o, h.name);
|
|
1116
|
-
a.file(i, n);
|
|
1117
|
-
});
|
|
1118
|
-
const s = {
|
|
1119
|
-
version: 5,
|
|
1120
|
-
history: [t].map(Pt) || [],
|
|
1121
|
-
folders: []
|
|
1122
|
-
}, c = JSON.stringify(s, null, 2);
|
|
1123
|
-
return a.file("conversations/conversations_history.json", c), await a.generateAsync({ type: "base64" });
|
|
1124
|
-
}
|
|
1125
|
-
const yt = (t) => {
|
|
1126
|
-
const r = t.split("/");
|
|
1127
|
-
return r.length > 2 ? te(...r.slice(2)) : void 0;
|
|
1128
|
-
}, Pt = (t) => Ge(t, ["publicationInfo"]), te = (...t) => t.filter(Boolean).join("/");
|
|
1129
|
-
function Dt(t, r) {
|
|
1130
|
-
const l = document.createElement("a");
|
|
1131
|
-
l.download = r, l.href = t, l.style.display = "none", document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(t);
|
|
1132
|
-
}
|
|
1133
|
-
const Ot = ({
|
|
1134
|
-
onCloseModal: t,
|
|
1135
|
-
disableModalDividers: r,
|
|
1136
|
-
deleteConversation: l,
|
|
1137
|
-
isSmallButton: a,
|
|
1138
|
-
titles: s,
|
|
1139
|
-
locale: c
|
|
1140
|
-
}) => /* @__PURE__ */ S(
|
|
1141
|
-
me,
|
|
1142
|
-
{
|
|
1143
|
-
heading: (s == null ? void 0 : s.deleteTitle) ?? "Delete conversation",
|
|
1144
|
-
portalId: "delete-conversation",
|
|
1145
|
-
containerClassName: "delete-conversation-popup",
|
|
1146
|
-
size: pe.SM,
|
|
1147
|
-
dividers: !r,
|
|
1148
|
-
onClose: t,
|
|
1149
|
-
closeButtonTitle: (s == null ? void 0 : s.close) ?? "Cancel",
|
|
1150
|
-
children: [
|
|
1151
|
-
/* @__PURE__ */ E("div", { className: "py-4 px-6 sm:px-0", lang: c, children: (s == null ? void 0 : s.deleteMessage) ?? "Are you sure you want to delete this conversation? This action cannot be undone." }),
|
|
1152
|
-
/* @__PURE__ */ S("div", { className: "flex justify-end gap-x-2 py-3 px-6 delete-conversation-popup-footer", children: [
|
|
1153
|
-
/* @__PURE__ */ E(
|
|
1154
|
-
X,
|
|
1155
|
-
{
|
|
1156
|
-
buttonClassName: "cancel-button",
|
|
1157
|
-
title: (s == null ? void 0 : s.cancel) ?? "Cancel",
|
|
1158
|
-
isSmallButton: a,
|
|
1159
|
-
onClick: (m) => {
|
|
1160
|
-
m.stopPropagation(), t();
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
),
|
|
1164
|
-
/* @__PURE__ */ E(
|
|
1165
|
-
X,
|
|
1166
|
-
{
|
|
1167
|
-
buttonClassName: "text-button-primary text-button-primary-error",
|
|
1168
|
-
title: (s == null ? void 0 : s.delete) ?? "Delete",
|
|
1169
|
-
isSmallButton: a,
|
|
1170
|
-
onClick: (m) => {
|
|
1171
|
-
m.stopPropagation(), l();
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
)
|
|
1175
|
-
] })
|
|
1176
|
-
]
|
|
1177
|
-
}
|
|
1178
|
-
), Tt = ({
|
|
1177
|
+
}, Ot = ({
|
|
1179
1178
|
conversation: t,
|
|
1180
1179
|
onCloseModal: r,
|
|
1181
|
-
|
|
1182
|
-
locale:
|
|
1180
|
+
renameConversation: l,
|
|
1181
|
+
locale: c,
|
|
1183
1182
|
disableModalDividers: s,
|
|
1184
|
-
titles:
|
|
1185
|
-
isSmallButton:
|
|
1183
|
+
titles: a,
|
|
1184
|
+
isSmallButton: p
|
|
1186
1185
|
}) => {
|
|
1187
1186
|
const [h, e] = F((t == null ? void 0 : t.name) || ""), n = (i) => {
|
|
1188
1187
|
e(i);
|
|
1189
1188
|
}, o = () => {
|
|
1190
|
-
const i = `${t == null ? void 0 : t.folderId}/${encodeURIComponent(
|
|
1189
|
+
const i = `${t == null ? void 0 : t.folderId}/${encodeURIComponent(pe(h))}-${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
1191
1190
|
l(
|
|
1192
1191
|
`conversations/${t.id}`,
|
|
1193
1192
|
`conversations/${i}`
|
|
1194
1193
|
);
|
|
1195
1194
|
};
|
|
1196
|
-
return /* @__PURE__ */
|
|
1197
|
-
|
|
1195
|
+
return /* @__PURE__ */ B(
|
|
1196
|
+
fe,
|
|
1198
1197
|
{
|
|
1199
|
-
heading: (
|
|
1198
|
+
heading: (a == null ? void 0 : a.renameTitle) ?? "Rename conversation",
|
|
1200
1199
|
portalId: "rename-conversation",
|
|
1201
1200
|
containerClassName: "rename-conversation-popup",
|
|
1202
|
-
size:
|
|
1201
|
+
size: me.SM,
|
|
1203
1202
|
dividers: !s,
|
|
1204
1203
|
onClose: r,
|
|
1205
|
-
closeButtonTitle: (
|
|
1204
|
+
closeButtonTitle: (a == null ? void 0 : a.close) ?? "Cancel",
|
|
1206
1205
|
children: [
|
|
1207
|
-
/* @__PURE__ */
|
|
1208
|
-
|
|
1206
|
+
/* @__PURE__ */ g("div", { className: "py-4 px-6 sm:px-0", lang: c, children: /* @__PURE__ */ g(
|
|
1207
|
+
He,
|
|
1209
1208
|
{
|
|
1210
1209
|
inputId: "rename",
|
|
1211
1210
|
value: h,
|
|
@@ -1213,24 +1212,24 @@ const Ot = ({
|
|
|
1213
1212
|
cssClass: "w-full"
|
|
1214
1213
|
}
|
|
1215
1214
|
) }),
|
|
1216
|
-
/* @__PURE__ */
|
|
1217
|
-
/* @__PURE__ */
|
|
1215
|
+
/* @__PURE__ */ B("div", { className: "flex justify-end gap-x-2 py-3 px-6 delete-conversation-popup-footer", children: [
|
|
1216
|
+
/* @__PURE__ */ g(
|
|
1218
1217
|
X,
|
|
1219
1218
|
{
|
|
1220
1219
|
buttonClassName: "cancel-button",
|
|
1221
|
-
title: (
|
|
1222
|
-
isSmallButton:
|
|
1220
|
+
title: (a == null ? void 0 : a.cancel) ?? "Cancel",
|
|
1221
|
+
isSmallButton: p,
|
|
1223
1222
|
onClick: (i) => {
|
|
1224
1223
|
i.stopPropagation(), r();
|
|
1225
1224
|
}
|
|
1226
1225
|
}
|
|
1227
1226
|
),
|
|
1228
|
-
/* @__PURE__ */
|
|
1227
|
+
/* @__PURE__ */ g(
|
|
1229
1228
|
X,
|
|
1230
1229
|
{
|
|
1231
1230
|
buttonClassName: "text-button-primary text-button-primary",
|
|
1232
|
-
title: (
|
|
1233
|
-
isSmallButton:
|
|
1231
|
+
title: (a == null ? void 0 : a.save) ?? "Rename",
|
|
1232
|
+
isSmallButton: p,
|
|
1234
1233
|
disabled: !h,
|
|
1235
1234
|
onClick: (i) => {
|
|
1236
1235
|
i.stopPropagation(), o();
|
|
@@ -1245,40 +1244,40 @@ const Ot = ({
|
|
|
1245
1244
|
conversation: t,
|
|
1246
1245
|
conversationStyles: r,
|
|
1247
1246
|
shareConversationProps: l,
|
|
1248
|
-
onConversationDelete:
|
|
1247
|
+
onConversationDelete: c,
|
|
1249
1248
|
getConversation: s,
|
|
1250
|
-
getFileBlob:
|
|
1251
|
-
renameConversation:
|
|
1249
|
+
getFileBlob: a,
|
|
1250
|
+
renameConversation: p,
|
|
1252
1251
|
triggerButton: h,
|
|
1253
1252
|
locale: e
|
|
1254
1253
|
}) => {
|
|
1255
1254
|
var P;
|
|
1256
1255
|
const n = he(() => {
|
|
1257
|
-
var
|
|
1256
|
+
var T, z, $, D, H, Q, S, M, A, L;
|
|
1258
1257
|
const x = [
|
|
1259
1258
|
{
|
|
1260
|
-
key:
|
|
1261
|
-
title: ((
|
|
1262
|
-
icon: (
|
|
1259
|
+
key: k.DELETE,
|
|
1260
|
+
title: ((T = r == null ? void 0 : r.titles) == null ? void 0 : T.delete) ?? "Delete",
|
|
1261
|
+
icon: (z = r.actionsIcons) == null ? void 0 : z[k.DELETE]
|
|
1263
1262
|
}
|
|
1264
1263
|
];
|
|
1265
|
-
return (D = ($ = t == null ? void 0 : t.model) == null ? void 0 : $.id) != null && D.endsWith(
|
|
1264
|
+
return (D = ($ = t == null ? void 0 : t.model) == null ? void 0 : $.id) != null && D.endsWith(ve) ? x : [
|
|
1266
1265
|
...t.isShared ? [] : [
|
|
1267
1266
|
{
|
|
1268
|
-
key:
|
|
1267
|
+
key: k.SHARE,
|
|
1269
1268
|
title: ((H = r == null ? void 0 : r.titles) == null ? void 0 : H.share) ?? "Share",
|
|
1270
|
-
icon: (Q = r.actionsIcons) == null ? void 0 : Q[
|
|
1269
|
+
icon: (Q = r.actionsIcons) == null ? void 0 : Q[k.SHARE]
|
|
1271
1270
|
},
|
|
1272
1271
|
{
|
|
1273
|
-
key:
|
|
1274
|
-
title: ((
|
|
1275
|
-
icon: (M = r.actionsIcons) == null ? void 0 : M[
|
|
1272
|
+
key: k.RENAME,
|
|
1273
|
+
title: ((S = r == null ? void 0 : r.titles) == null ? void 0 : S.rename) ?? "Rename",
|
|
1274
|
+
icon: (M = r.actionsIcons) == null ? void 0 : M[k.RENAME]
|
|
1276
1275
|
}
|
|
1277
1276
|
],
|
|
1278
1277
|
{
|
|
1279
|
-
key:
|
|
1280
|
-
title: ((
|
|
1281
|
-
icon: (L = r.actionsIcons) == null ? void 0 : L[
|
|
1278
|
+
key: k.EXPORT,
|
|
1279
|
+
title: ((A = r == null ? void 0 : r.titles) == null ? void 0 : A.export) ?? "Export",
|
|
1280
|
+
icon: (L = r.actionsIcons) == null ? void 0 : L[k.EXPORT]
|
|
1282
1281
|
},
|
|
1283
1282
|
...x
|
|
1284
1283
|
];
|
|
@@ -1287,33 +1286,33 @@ const Ot = ({
|
|
|
1287
1286
|
(P = t == null ? void 0 : t.model) == null ? void 0 : P.id,
|
|
1288
1287
|
r.titles,
|
|
1289
1288
|
r.actionsIcons
|
|
1290
|
-
]), [o, i] = F(Y.Closed), [u, f] = F(Y.Closed), [d, C] = F(Y.Closed),
|
|
1289
|
+
]), [o, i] = F(Y.Closed), [u, f] = F(Y.Closed), [d, C] = F(Y.Closed), m = _(() => {
|
|
1291
1290
|
i(Y.Closed);
|
|
1292
|
-
}, [i]),
|
|
1291
|
+
}, [i]), I = _(() => {
|
|
1293
1292
|
f(Y.Closed);
|
|
1294
|
-
}, [f]),
|
|
1293
|
+
}, [f]), w = _(() => {
|
|
1295
1294
|
C(Y.Closed);
|
|
1296
|
-
}, [C]),
|
|
1297
|
-
|
|
1298
|
-
}, [t,
|
|
1299
|
-
(x,
|
|
1300
|
-
|
|
1295
|
+
}, [C]), E = _(() => {
|
|
1296
|
+
c(t), m();
|
|
1297
|
+
}, [t, c, m]), N = _(
|
|
1298
|
+
(x, T) => {
|
|
1299
|
+
p(x, T), w();
|
|
1301
1300
|
},
|
|
1302
|
-
[
|
|
1301
|
+
[p, w]
|
|
1303
1302
|
);
|
|
1304
|
-
return /* @__PURE__ */
|
|
1305
|
-
/* @__PURE__ */
|
|
1306
|
-
|
|
1303
|
+
return /* @__PURE__ */ B(v, { children: [
|
|
1304
|
+
/* @__PURE__ */ g(
|
|
1305
|
+
Ye,
|
|
1307
1306
|
{
|
|
1308
|
-
containerClassName: "
|
|
1309
|
-
triggerButton: h ?? /* @__PURE__ */
|
|
1307
|
+
containerClassName: "invisible ml-3 group-hover:visible",
|
|
1308
|
+
triggerButton: h ?? /* @__PURE__ */ g(Lt, {}),
|
|
1310
1309
|
options: n,
|
|
1311
1310
|
openedClassName: "action-menu-opened",
|
|
1312
1311
|
onOptionSelect: (x) => {
|
|
1313
|
-
x ===
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
`data:application/zip;base64,${
|
|
1312
|
+
x === k.DELETE && i(Y.Opened), x === k.SHARE && f(Y.Opened), x === k.RENAME && C(Y.Opened), x === k.EXPORT && s(decodeURI(t.id)).then((T) => {
|
|
1313
|
+
ht(T, a).then((z) => {
|
|
1314
|
+
pt(
|
|
1315
|
+
`data:application/zip;base64,${z}`,
|
|
1317
1316
|
`chat_with_attachments_${(/* @__PURE__ */ new Date()).toLocaleDateString()}.dial`
|
|
1318
1317
|
);
|
|
1319
1318
|
});
|
|
@@ -1321,41 +1320,41 @@ const Ot = ({
|
|
|
1321
1320
|
}
|
|
1322
1321
|
}
|
|
1323
1322
|
),
|
|
1324
|
-
o === Y.Opened && /* @__PURE__ */
|
|
1325
|
-
|
|
1323
|
+
o === Y.Opened && /* @__PURE__ */ g(
|
|
1324
|
+
it,
|
|
1326
1325
|
{
|
|
1327
1326
|
titles: r.titles,
|
|
1328
1327
|
locale: e,
|
|
1329
1328
|
disableModalDividers: r.disableModalDividers,
|
|
1330
1329
|
isSmallButton: r.isSmallModalButton,
|
|
1331
|
-
deleteConversation:
|
|
1332
|
-
onCloseModal:
|
|
1330
|
+
deleteConversation: E,
|
|
1331
|
+
onCloseModal: m
|
|
1333
1332
|
}
|
|
1334
1333
|
),
|
|
1335
|
-
u === Y.Opened && /* @__PURE__ */
|
|
1336
|
-
|
|
1334
|
+
u === Y.Opened && /* @__PURE__ */ g(
|
|
1335
|
+
Tt,
|
|
1337
1336
|
{
|
|
1338
1337
|
conversation: t,
|
|
1339
1338
|
locale: e,
|
|
1340
|
-
onCloseModal:
|
|
1339
|
+
onCloseModal: I,
|
|
1341
1340
|
...l
|
|
1342
1341
|
}
|
|
1343
1342
|
),
|
|
1344
|
-
d === Y.Opened && /* @__PURE__ */
|
|
1345
|
-
|
|
1343
|
+
d === Y.Opened && /* @__PURE__ */ g(
|
|
1344
|
+
Ot,
|
|
1346
1345
|
{
|
|
1347
1346
|
conversation: t,
|
|
1348
1347
|
locale: e,
|
|
1349
1348
|
titles: r.titles,
|
|
1350
|
-
|
|
1351
|
-
onCloseModal:
|
|
1349
|
+
renameConversation: N,
|
|
1350
|
+
onCloseModal: w,
|
|
1352
1351
|
disableModalDividers: r.disableModalDividers,
|
|
1353
1352
|
isSmallButton: r.isSmallModalButton
|
|
1354
1353
|
}
|
|
1355
1354
|
)
|
|
1356
1355
|
] });
|
|
1357
|
-
}, Lt = () => /* @__PURE__ */
|
|
1358
|
-
|
|
1356
|
+
}, Lt = () => /* @__PURE__ */ g("div", { className: "cursor-pointer flex items-center justify-center w-[24px]", children: /* @__PURE__ */ g(
|
|
1357
|
+
Xe,
|
|
1359
1358
|
{
|
|
1360
1359
|
width: 20,
|
|
1361
1360
|
height: 20,
|
|
@@ -1366,20 +1365,26 @@ const Ot = ({
|
|
|
1366
1365
|
conversation: t,
|
|
1367
1366
|
selectedConversationId: r,
|
|
1368
1367
|
searchQuery: l,
|
|
1369
|
-
onConversationClick:
|
|
1368
|
+
onConversationClick: c,
|
|
1370
1369
|
actions: s,
|
|
1371
|
-
locale:
|
|
1372
|
-
conversationStyles:
|
|
1370
|
+
locale: a,
|
|
1371
|
+
conversationStyles: p,
|
|
1373
1372
|
shareConversationProps: h
|
|
1374
1373
|
}) => {
|
|
1375
|
-
const e =
|
|
1374
|
+
const e = ze(null), n = pe(t == null ? void 0 : t.name);
|
|
1376
1375
|
return ee(() => {
|
|
1377
|
-
var o;
|
|
1378
|
-
(t == null ? void 0 : t.id) === r &&
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1376
|
+
var o, i;
|
|
1377
|
+
if ((t == null ? void 0 : t.id) === r && e != null && e.current) {
|
|
1378
|
+
const u = (i = (o = e.current.parentElement) == null ? void 0 : o.parentElement) == null ? void 0 : i.parentElement;
|
|
1379
|
+
if (u) {
|
|
1380
|
+
const f = e.current.getBoundingClientRect(), d = u.getBoundingClientRect(), C = f.height, m = d.height, w = f.top - d.top + u.scrollTop - (m / 2 - C / 2);
|
|
1381
|
+
u.scrollTo({
|
|
1382
|
+
top: w,
|
|
1383
|
+
behavior: "smooth"
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}, [t, r]), /* @__PURE__ */ B(
|
|
1383
1388
|
"div",
|
|
1384
1389
|
{
|
|
1385
1390
|
ref: e,
|
|
@@ -1388,12 +1393,12 @@ const Ot = ({
|
|
|
1388
1393
|
"conversation-item",
|
|
1389
1394
|
r === (t == null ? void 0 : t.id) && "bg-hues-100 conversation-item-active"
|
|
1390
1395
|
),
|
|
1391
|
-
onClick: () =>
|
|
1396
|
+
onClick: () => c(t.folderId, t == null ? void 0 : t.id),
|
|
1392
1397
|
title: n,
|
|
1393
1398
|
children: [
|
|
1394
|
-
/* @__PURE__ */
|
|
1395
|
-
|
|
1396
|
-
/* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ B("div", { className: "flex flex-1 min-w-0 items-center", children: [
|
|
1400
|
+
p.conversationItemIcon ? p.conversationItemIcon : null,
|
|
1401
|
+
/* @__PURE__ */ g(
|
|
1397
1402
|
"h3",
|
|
1398
1403
|
{
|
|
1399
1404
|
className: J(
|
|
@@ -1402,8 +1407,8 @@ const Ot = ({
|
|
|
1402
1407
|
r === (t == null ? void 0 : t.id) ? "conversation-item-text-active" : ""
|
|
1403
1408
|
),
|
|
1404
1409
|
title: n,
|
|
1405
|
-
children: l != null && l.length ? /* @__PURE__ */
|
|
1406
|
-
|
|
1410
|
+
children: l != null && l.length ? /* @__PURE__ */ g(
|
|
1411
|
+
Qe,
|
|
1407
1412
|
{
|
|
1408
1413
|
text: n,
|
|
1409
1414
|
highlightText: l
|
|
@@ -1412,11 +1417,11 @@ const Ot = ({
|
|
|
1412
1417
|
}
|
|
1413
1418
|
)
|
|
1414
1419
|
] }),
|
|
1415
|
-
/* @__PURE__ */
|
|
1420
|
+
/* @__PURE__ */ g(
|
|
1416
1421
|
xt,
|
|
1417
1422
|
{
|
|
1418
|
-
locale:
|
|
1419
|
-
conversationStyles:
|
|
1423
|
+
locale: a,
|
|
1424
|
+
conversationStyles: p,
|
|
1420
1425
|
conversation: t,
|
|
1421
1426
|
onConversationDelete: s.deleteConversation,
|
|
1422
1427
|
getConversation: s.getConversation,
|
|
@@ -1428,28 +1433,28 @@ const Ot = ({
|
|
|
1428
1433
|
]
|
|
1429
1434
|
}
|
|
1430
1435
|
);
|
|
1431
|
-
},
|
|
1436
|
+
}, Bt = ({
|
|
1432
1437
|
handleConversationClick: t,
|
|
1433
1438
|
actions: r,
|
|
1434
1439
|
selectedConversationId: l,
|
|
1435
|
-
groupLabel:
|
|
1440
|
+
groupLabel: c,
|
|
1436
1441
|
conversationStyles: s,
|
|
1437
|
-
groupedConversations:
|
|
1438
|
-
shareConversationProps:
|
|
1442
|
+
groupedConversations: a,
|
|
1443
|
+
shareConversationProps: p,
|
|
1439
1444
|
locale: h
|
|
1440
1445
|
}) => {
|
|
1441
1446
|
const [e, n] = F(!1), o = _(() => {
|
|
1442
1447
|
n((i) => !i);
|
|
1443
1448
|
}, [n]);
|
|
1444
|
-
return /* @__PURE__ */
|
|
1445
|
-
/* @__PURE__ */
|
|
1449
|
+
return /* @__PURE__ */ B("div", { children: [
|
|
1450
|
+
/* @__PURE__ */ B(
|
|
1446
1451
|
"div",
|
|
1447
1452
|
{
|
|
1448
1453
|
className: "inline-flex gap-1 items-center text-neutrals-700 mb-3 cursor-pointer conversation-group-items-title",
|
|
1449
1454
|
onClick: o,
|
|
1450
1455
|
children: [
|
|
1451
|
-
/* @__PURE__ */
|
|
1452
|
-
|
|
1456
|
+
/* @__PURE__ */ g(
|
|
1457
|
+
We,
|
|
1453
1458
|
{
|
|
1454
1459
|
className: J(
|
|
1455
1460
|
"w-3 h-3 conversation-group-items-arrow",
|
|
@@ -1457,19 +1462,19 @@ const Ot = ({
|
|
|
1457
1462
|
)
|
|
1458
1463
|
}
|
|
1459
1464
|
),
|
|
1460
|
-
/* @__PURE__ */
|
|
1465
|
+
/* @__PURE__ */ g("span", { className: "body-3 conversation-group-items-title-text", children: lt(c, s == null ? void 0 : s.titles) })
|
|
1461
1466
|
]
|
|
1462
1467
|
}
|
|
1463
1468
|
),
|
|
1464
|
-
!e && /* @__PURE__ */
|
|
1469
|
+
!e && /* @__PURE__ */ g(
|
|
1465
1470
|
"div",
|
|
1466
1471
|
{
|
|
1467
1472
|
className: J(
|
|
1468
1473
|
"flex flex-col gap-y-3",
|
|
1469
1474
|
"conversation-group-items"
|
|
1470
1475
|
),
|
|
1471
|
-
children:
|
|
1472
|
-
(i) => /* @__PURE__ */
|
|
1476
|
+
children: Ne(a).map(
|
|
1477
|
+
(i) => /* @__PURE__ */ g(
|
|
1473
1478
|
Fe,
|
|
1474
1479
|
{
|
|
1475
1480
|
locale: h,
|
|
@@ -1478,95 +1483,96 @@ const Ot = ({
|
|
|
1478
1483
|
selectedConversationId: l,
|
|
1479
1484
|
onConversationClick: t,
|
|
1480
1485
|
actions: r,
|
|
1481
|
-
shareConversationProps:
|
|
1486
|
+
shareConversationProps: p
|
|
1482
1487
|
},
|
|
1483
1488
|
i.id || i.name
|
|
1484
1489
|
)
|
|
1485
1490
|
)
|
|
1486
1491
|
}
|
|
1487
1492
|
)
|
|
1488
|
-
] },
|
|
1489
|
-
},
|
|
1493
|
+
] }, c);
|
|
1494
|
+
}, St = ({
|
|
1490
1495
|
searchQuery: t,
|
|
1491
1496
|
isExpandedSearch: r,
|
|
1492
1497
|
titles: l,
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1498
|
+
searchIcon: c,
|
|
1499
|
+
onSearchConversations: s,
|
|
1500
|
+
toggleSearchField: a
|
|
1501
|
+
}) => /* @__PURE__ */ g(v, { children: r ? /* @__PURE__ */ g(
|
|
1502
|
+
Re,
|
|
1497
1503
|
{
|
|
1498
1504
|
inputId: "conversations-search",
|
|
1499
1505
|
placeholder: (l == null ? void 0 : l.searchPlaceholder) ?? "Search",
|
|
1500
1506
|
containerClasses: "conversation-list-search-input h-[40px] bg-transparent px-4 py-2 rounded-full border-neutrals-400 shadow-none",
|
|
1501
1507
|
cssClass: "h-auto",
|
|
1502
1508
|
value: t,
|
|
1503
|
-
iconAfterInput: /* @__PURE__ */
|
|
1504
|
-
|
|
1509
|
+
iconAfterInput: /* @__PURE__ */ g(
|
|
1510
|
+
Ge,
|
|
1505
1511
|
{
|
|
1506
1512
|
buttonClassName: "text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5",
|
|
1507
|
-
onClick:
|
|
1508
|
-
icon: /* @__PURE__ */
|
|
1513
|
+
onClick: a,
|
|
1514
|
+
icon: /* @__PURE__ */ g(Ke, {})
|
|
1509
1515
|
}
|
|
1510
1516
|
),
|
|
1511
|
-
onChange:
|
|
1517
|
+
onChange: s
|
|
1512
1518
|
}
|
|
1513
|
-
) : /* @__PURE__ */
|
|
1519
|
+
) : /* @__PURE__ */ g(
|
|
1514
1520
|
X,
|
|
1515
1521
|
{
|
|
1516
1522
|
buttonClassName: "text-button-tertiary p-0 search-button",
|
|
1517
|
-
iconBefore: /* @__PURE__ */
|
|
1518
|
-
onClick:
|
|
1523
|
+
iconBefore: c || /* @__PURE__ */ g(Ze, { className: "w-5 h-5" }),
|
|
1524
|
+
onClick: a
|
|
1519
1525
|
}
|
|
1520
1526
|
) }), Ft = ({
|
|
1521
1527
|
conversations: t,
|
|
1522
1528
|
selectedConversationId: r,
|
|
1523
1529
|
searchQuery: l,
|
|
1524
|
-
conversationStyles:
|
|
1530
|
+
conversationStyles: c,
|
|
1525
1531
|
handleConversationClick: s,
|
|
1526
|
-
actions:
|
|
1527
|
-
locale:
|
|
1532
|
+
actions: a,
|
|
1533
|
+
locale: p,
|
|
1528
1534
|
shareConversationProps: h
|
|
1529
1535
|
}) => {
|
|
1530
1536
|
var o;
|
|
1531
1537
|
const [e, n] = F([]);
|
|
1532
1538
|
return ee(() => {
|
|
1533
1539
|
n(
|
|
1534
|
-
|
|
1540
|
+
Ne(
|
|
1535
1541
|
t == null ? void 0 : t.filter(
|
|
1536
1542
|
(i) => {
|
|
1537
1543
|
var u;
|
|
1538
|
-
return (u =
|
|
1544
|
+
return (u = pe(i == null ? void 0 : i.name)) == null ? void 0 : u.includes(
|
|
1539
1545
|
l || ""
|
|
1540
1546
|
);
|
|
1541
1547
|
}
|
|
1542
1548
|
)
|
|
1543
1549
|
)
|
|
1544
1550
|
);
|
|
1545
|
-
}, [t, l]), /* @__PURE__ */
|
|
1551
|
+
}, [t, l]), /* @__PURE__ */ g(v, { children: e != null && e.length ? e.map((i) => /* @__PURE__ */ g(
|
|
1546
1552
|
Fe,
|
|
1547
1553
|
{
|
|
1548
|
-
locale:
|
|
1549
|
-
conversationStyles:
|
|
1554
|
+
locale: p,
|
|
1555
|
+
conversationStyles: c,
|
|
1550
1556
|
conversation: i,
|
|
1551
1557
|
searchQuery: l,
|
|
1552
1558
|
selectedConversationId: r,
|
|
1553
1559
|
onConversationClick: s,
|
|
1554
|
-
actions:
|
|
1560
|
+
actions: a,
|
|
1555
1561
|
shareConversationProps: h
|
|
1556
1562
|
},
|
|
1557
1563
|
i.id
|
|
1558
|
-
)) : /* @__PURE__ */
|
|
1559
|
-
}, Ut = ({ titles: t }) => /* @__PURE__ */
|
|
1560
|
-
/* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */
|
|
1564
|
+
)) : /* @__PURE__ */ g("h3", { className: "text-neutrals-800", children: ((o = c == null ? void 0 : c.titles) == null ? void 0 : o.noConversation) ?? "No conversations yet" }) });
|
|
1565
|
+
}, Ut = ({ titles: t }) => /* @__PURE__ */ B("div", { className: "p-8 text-center flex flex-col", children: [
|
|
1566
|
+
/* @__PURE__ */ g("p", { className: "text-neutrals-800", children: (t == null ? void 0 : t.noConversation) ?? "No conversations yet" }),
|
|
1567
|
+
/* @__PURE__ */ g("p", { className: "text-sm text-neutrals-800 mt-2", children: (t == null ? void 0 : t.clickNewChat) ?? 'Click "New Chat" to start a conversation' })
|
|
1562
1568
|
] }), Wt = ({
|
|
1563
1569
|
handleConversationClick: t,
|
|
1564
1570
|
selectedConversationId: r,
|
|
1565
1571
|
actions: l,
|
|
1566
|
-
children:
|
|
1572
|
+
children: c,
|
|
1567
1573
|
isCollapsed: s,
|
|
1568
|
-
conversationStyles:
|
|
1569
|
-
conversations:
|
|
1574
|
+
conversationStyles: a,
|
|
1575
|
+
conversations: p,
|
|
1570
1576
|
locale: h,
|
|
1571
1577
|
sharedConversations: e,
|
|
1572
1578
|
setConversations: n,
|
|
@@ -1574,34 +1580,34 @@ const Ot = ({
|
|
|
1574
1580
|
shareConversationProps: i,
|
|
1575
1581
|
handleSelectedConversationRemove: u
|
|
1576
1582
|
}) => {
|
|
1577
|
-
var
|
|
1578
|
-
const [f, d] = F({}), [C,
|
|
1583
|
+
var S;
|
|
1584
|
+
const [f, d] = F({}), [C, m] = F(!0), [I, w] = F(""), [E, N] = F(!1), {
|
|
1579
1585
|
getConversations: b,
|
|
1580
1586
|
getSharedConversations: P,
|
|
1581
1587
|
deleteConversation: x,
|
|
1582
|
-
renameConversation:
|
|
1583
|
-
} = l,
|
|
1588
|
+
renameConversation: T
|
|
1589
|
+
} = l, z = he(() => !!(I != null && I.length), [I]);
|
|
1584
1590
|
ee(() => {
|
|
1585
1591
|
d({
|
|
1586
|
-
...
|
|
1587
|
-
...
|
|
1592
|
+
...et(e),
|
|
1593
|
+
...ot(p)
|
|
1588
1594
|
});
|
|
1589
|
-
}, [
|
|
1595
|
+
}, [p, e]), ee(() => {
|
|
1590
1596
|
async function M() {
|
|
1591
1597
|
try {
|
|
1592
|
-
|
|
1593
|
-
const
|
|
1598
|
+
m(!0);
|
|
1599
|
+
const A = await b(h), L = await P(
|
|
1594
1600
|
le(ie.ME)
|
|
1595
1601
|
);
|
|
1596
|
-
n(K(
|
|
1602
|
+
n(K(A)), o(
|
|
1597
1603
|
K(
|
|
1598
1604
|
ce(L, h)
|
|
1599
1605
|
)
|
|
1600
1606
|
);
|
|
1601
|
-
} catch (
|
|
1602
|
-
console.error("Error loading conversation",
|
|
1607
|
+
} catch (A) {
|
|
1608
|
+
console.error("Error loading conversation", A);
|
|
1603
1609
|
} finally {
|
|
1604
|
-
|
|
1610
|
+
m(!1);
|
|
1605
1611
|
}
|
|
1606
1612
|
}
|
|
1607
1613
|
M();
|
|
@@ -1616,16 +1622,16 @@ const Ot = ({
|
|
|
1616
1622
|
async (M) => {
|
|
1617
1623
|
try {
|
|
1618
1624
|
await x(M);
|
|
1619
|
-
const
|
|
1625
|
+
const A = await b(h), L = await P(
|
|
1620
1626
|
le(ie.ME)
|
|
1621
1627
|
);
|
|
1622
|
-
n(K(
|
|
1628
|
+
n(K(A)), o(
|
|
1623
1629
|
K(
|
|
1624
1630
|
ce(L, h)
|
|
1625
1631
|
)
|
|
1626
1632
|
), r === (M == null ? void 0 : M.id) && u();
|
|
1627
|
-
} catch (
|
|
1628
|
-
console.error("Error deleting conversation",
|
|
1633
|
+
} catch (A) {
|
|
1634
|
+
console.error("Error deleting conversation", A);
|
|
1629
1635
|
}
|
|
1630
1636
|
},
|
|
1631
1637
|
[
|
|
@@ -1639,9 +1645,9 @@ const Ot = ({
|
|
|
1639
1645
|
u
|
|
1640
1646
|
]
|
|
1641
1647
|
), D = _(
|
|
1642
|
-
async (M,
|
|
1648
|
+
async (M, A) => {
|
|
1643
1649
|
try {
|
|
1644
|
-
|
|
1650
|
+
m(!0), await T(M, A);
|
|
1645
1651
|
const L = await b(h), j = await P(
|
|
1646
1652
|
le(ie.ME)
|
|
1647
1653
|
);
|
|
@@ -1653,7 +1659,7 @@ const Ot = ({
|
|
|
1653
1659
|
} catch (L) {
|
|
1654
1660
|
console.error("Error renaming conversation", L);
|
|
1655
1661
|
} finally {
|
|
1656
|
-
|
|
1662
|
+
m(!1);
|
|
1657
1663
|
}
|
|
1658
1664
|
},
|
|
1659
1665
|
[
|
|
@@ -1662,32 +1668,33 @@ const Ot = ({
|
|
|
1662
1668
|
P,
|
|
1663
1669
|
n,
|
|
1664
1670
|
o,
|
|
1665
|
-
|
|
1671
|
+
T
|
|
1666
1672
|
]
|
|
1667
1673
|
), H = _(
|
|
1668
1674
|
(M) => {
|
|
1669
|
-
|
|
1675
|
+
w(M);
|
|
1670
1676
|
},
|
|
1671
|
-
[
|
|
1677
|
+
[w]
|
|
1672
1678
|
), Q = _(() => {
|
|
1673
|
-
N((M) => !M),
|
|
1679
|
+
N((M) => !M), w("");
|
|
1674
1680
|
}, [N]);
|
|
1675
|
-
return C ? /* @__PURE__ */
|
|
1676
|
-
!s && /* @__PURE__ */
|
|
1681
|
+
return C ? /* @__PURE__ */ g(Ce, {}) : /* @__PURE__ */ B(v, { children: [
|
|
1682
|
+
!s && /* @__PURE__ */ B(
|
|
1677
1683
|
"div",
|
|
1678
1684
|
{
|
|
1679
1685
|
className: J(
|
|
1680
1686
|
"flex justify-between items-center",
|
|
1681
|
-
|
|
1687
|
+
E ? " pt-4 pb-0 sm:pt-10" : " pt-6 pb-2 sm:pt-10"
|
|
1682
1688
|
),
|
|
1683
1689
|
children: [
|
|
1684
|
-
!
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
|
|
1690
|
+
!E && /* @__PURE__ */ g("h3", { className: "text-neutrals-700 sm:body-2", children: ((S = a == null ? void 0 : a.titles) == null ? void 0 : S.allChats) ?? "All Chats" }),
|
|
1691
|
+
/* @__PURE__ */ g(
|
|
1692
|
+
St,
|
|
1687
1693
|
{
|
|
1688
|
-
searchQuery:
|
|
1689
|
-
|
|
1690
|
-
|
|
1694
|
+
searchQuery: I,
|
|
1695
|
+
searchIcon: a.searchIcon,
|
|
1696
|
+
titles: a.titles,
|
|
1697
|
+
isExpandedSearch: E,
|
|
1691
1698
|
onSearchConversations: H,
|
|
1692
1699
|
toggleSearchField: Q
|
|
1693
1700
|
}
|
|
@@ -1695,20 +1702,20 @@ const Ot = ({
|
|
|
1695
1702
|
]
|
|
1696
1703
|
}
|
|
1697
1704
|
),
|
|
1698
|
-
/* @__PURE__ */
|
|
1705
|
+
/* @__PURE__ */ g(
|
|
1699
1706
|
"div",
|
|
1700
1707
|
{
|
|
1701
1708
|
className: J(
|
|
1702
1709
|
"overflow-y-auto flex flex-col mt-4 flex-1 min-h-0 pr-2",
|
|
1703
|
-
|
|
1710
|
+
z ? "gap-y-1" : "gap-y-6"
|
|
1704
1711
|
),
|
|
1705
|
-
children: s ? null : /* @__PURE__ */
|
|
1712
|
+
children: s ? null : /* @__PURE__ */ g(v, { children: (p == null ? void 0 : p.length) === 0 && (e == null ? void 0 : e.length) === 0 ? /* @__PURE__ */ g(Ut, { titles: a.titles }) : z ? /* @__PURE__ */ g(
|
|
1706
1713
|
Ft,
|
|
1707
1714
|
{
|
|
1708
1715
|
locale: h,
|
|
1709
|
-
conversationStyles:
|
|
1710
|
-
conversations: [...e, ...
|
|
1711
|
-
searchQuery:
|
|
1716
|
+
conversationStyles: a,
|
|
1717
|
+
conversations: [...e, ...p],
|
|
1718
|
+
searchQuery: I,
|
|
1712
1719
|
selectedConversationId: r,
|
|
1713
1720
|
handleConversationClick: t,
|
|
1714
1721
|
shareConversationProps: i,
|
|
@@ -1718,13 +1725,13 @@ const Ot = ({
|
|
|
1718
1725
|
}
|
|
1719
1726
|
}
|
|
1720
1727
|
) : Object.entries(f).map(
|
|
1721
|
-
([M,
|
|
1722
|
-
|
|
1728
|
+
([M, A]) => (A == null ? void 0 : A.length) > 0 && /* @__PURE__ */ g(
|
|
1729
|
+
Bt,
|
|
1723
1730
|
{
|
|
1724
1731
|
locale: h,
|
|
1725
1732
|
groupLabel: M,
|
|
1726
|
-
conversationStyles:
|
|
1727
|
-
groupedConversations:
|
|
1733
|
+
conversationStyles: a,
|
|
1734
|
+
groupedConversations: A,
|
|
1728
1735
|
handleConversationClick: t,
|
|
1729
1736
|
actions: {
|
|
1730
1737
|
...l,
|
|
@@ -1739,13 +1746,13 @@ const Ot = ({
|
|
|
1739
1746
|
) })
|
|
1740
1747
|
}
|
|
1741
1748
|
),
|
|
1742
|
-
|
|
1749
|
+
c
|
|
1743
1750
|
] });
|
|
1744
1751
|
};
|
|
1745
1752
|
export {
|
|
1746
1753
|
xt as ActionMenu,
|
|
1747
|
-
|
|
1754
|
+
k as ActionMenuItem,
|
|
1748
1755
|
Wt as ConversationList,
|
|
1749
|
-
|
|
1756
|
+
et as getSharedConversationsGroup,
|
|
1750
1757
|
ce as transformSharedConversations
|
|
1751
1758
|
};
|