@epam/statgpt-conversation-list 0.3.2 → 0.3.4
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 +1 -1
- package/index.mjs +834 -812
- package/package.json +4 -4
package/index.mjs
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import { jsxs as y, jsx as
|
|
2
|
-
import
|
|
3
|
-
import x, { useState as
|
|
4
|
-
import { cloneDeep as
|
|
1
|
+
import { jsxs as y, jsx as h, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import B from "classnames";
|
|
3
|
+
import x, { useState as O, useMemo as J, useEffect as ee, useCallback as L, useRef as ze } from "react";
|
|
4
|
+
import { cloneDeep as _e, uniqBy as $e, omit as He } from "lodash";
|
|
5
5
|
import { Popup as ae, PopUpSize as le, Button as Q, Loader as we, InputWithIcon as Ne, Input as Ye, PopUpState as z, Dropdown as Re, HighlightText as Qe, IconButton as Ge } from "@epam/statgpt-ui-components";
|
|
6
6
|
import { IconCheck as je, IconCopy as We, IconDotsVertical as Ve, IconCaretRightFilled as Xe, IconX as Ke, IconSearch as Ze } from "@tabler/icons-react";
|
|
7
7
|
import Je from "jszip";
|
|
8
|
-
import { getConversationAttachments as qe, SHARE_CONVERSATION_ROUTE as ve, getClearedConversationName as
|
|
8
|
+
import { getConversationAttachments as qe, SHARE_CONVERSATION_ROUTE as ve, getClearedConversationName as me, ONBOARDING_MODEL_POSTFIX as et, cleanConversationNames as K } from "@epam/statgpt-shared-toolkit";
|
|
9
9
|
import { InvitationType as tt, getSharedConversationsRequest as re, ShareTarget as se } from "@epam/statgpt-dial-toolkit";
|
|
10
|
-
var U = /* @__PURE__ */ ((
|
|
11
|
-
const ue = (
|
|
12
|
-
const
|
|
10
|
+
var U = /* @__PURE__ */ ((n) => (n.DELETE = "delete", n.EXPORT = "export", n.SHARE = "share", n.RENAME = "rename", n))(U || {}), F = /* @__PURE__ */ ((n) => (n.SHARED = "shared", n.TODAY = "today", n.YESTERDAY = "yesterday", n.WEEK = "week", n.EARLIER = "earlier", n))(F || {});
|
|
11
|
+
const ue = (n, r) => n?.resources?.filter((s) => s?.parentPath === r)?.map((s) => {
|
|
12
|
+
const a = `${s?.bucket}/${r}`, d = s?.url?.split("/")?.slice(1)?.join("/");
|
|
13
13
|
return {
|
|
14
|
-
...
|
|
15
|
-
folderId:
|
|
16
|
-
id:
|
|
14
|
+
...s,
|
|
15
|
+
folderId: a,
|
|
16
|
+
id: d,
|
|
17
17
|
isShared: !0
|
|
18
18
|
};
|
|
19
|
-
}) || [], nt = (
|
|
20
|
-
[F.SHARED]:
|
|
19
|
+
}) || [], nt = (n) => ({
|
|
20
|
+
[F.SHARED]: n
|
|
21
21
|
}), ot = {
|
|
22
22
|
[F.TODAY]: [],
|
|
23
23
|
[F.YESTERDAY]: [],
|
|
24
24
|
[F.WEEK]: [],
|
|
25
25
|
[F.EARLIER]: []
|
|
26
|
-
}, Me = (
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
}, Me = (n, r) => n.toDateString() === r.toDateString(), rt = (n, r) => {
|
|
27
|
+
const s = new Date(
|
|
28
|
+
n.getFullYear(),
|
|
29
|
+
n.getMonth(),
|
|
30
|
+
n.getDate() - 1
|
|
31
31
|
);
|
|
32
|
-
return Me(
|
|
33
|
-
}, st = (
|
|
34
|
-
const
|
|
35
|
-
return Math.floor(
|
|
36
|
-
}, Ce = (
|
|
37
|
-
const
|
|
38
|
-
for (const
|
|
39
|
-
if (
|
|
40
|
-
const
|
|
41
|
-
let
|
|
42
|
-
Me(
|
|
43
|
-
(
|
|
44
|
-
) ||
|
|
32
|
+
return Me(r, s);
|
|
33
|
+
}, st = (n, r) => {
|
|
34
|
+
const s = n.getTime() - r.getTime();
|
|
35
|
+
return Math.floor(s / (1e3 * 60 * 60 * 24));
|
|
36
|
+
}, Ce = (n) => n.updatedAt || Number(n.id?.split("-").pop()), it = (n) => {
|
|
37
|
+
const r = /* @__PURE__ */ new Date(), s = _e(ot);
|
|
38
|
+
for (const a of n)
|
|
39
|
+
if (a.updatedAt) {
|
|
40
|
+
const d = new Date(a.updatedAt);
|
|
41
|
+
let c;
|
|
42
|
+
Me(r, d) ? c = s[F.TODAY] : rt(r, d) ? c = s[F.YESTERDAY] : st(r, d) <= 7 ? c = s[F.WEEK] : c = s[F.EARLIER], c?.some(
|
|
43
|
+
(m) => m.id === a.id
|
|
44
|
+
) || c.push(a);
|
|
45
45
|
}
|
|
46
|
-
return
|
|
47
|
-
}, ye = (
|
|
48
|
-
(
|
|
49
|
-
), at = (
|
|
50
|
-
onCloseModal:
|
|
51
|
-
disableModalDividers:
|
|
52
|
-
deleteConversation:
|
|
53
|
-
isSmallButton:
|
|
54
|
-
titles:
|
|
55
|
-
locale:
|
|
46
|
+
return s;
|
|
47
|
+
}, ye = (n) => n?.sort(
|
|
48
|
+
(r, s) => (Ce(s) || 0) - (Ce(r) || 0)
|
|
49
|
+
), at = (n, r) => n === F.SHARED ? r?.shared || "Shared" : n === F.TODAY ? r?.today || "Today" : n === F.YESTERDAY ? r?.yesterday || "Yesterday" : n === F.WEEK ? r?.lastWeek || "Last week" : r?.earlier || "Earlier", lt = ({
|
|
50
|
+
onCloseModal: n,
|
|
51
|
+
disableModalDividers: r,
|
|
52
|
+
deleteConversation: s,
|
|
53
|
+
isSmallButton: a,
|
|
54
|
+
titles: d,
|
|
55
|
+
locale: c
|
|
56
56
|
}) => /* @__PURE__ */ y(
|
|
57
57
|
ae,
|
|
58
58
|
{
|
|
59
|
-
heading:
|
|
59
|
+
heading: d?.deleteTitle ?? "Delete conversation",
|
|
60
60
|
portalId: "delete-conversation",
|
|
61
61
|
containerClassName: "delete-conversation-popup",
|
|
62
62
|
size: le.SM,
|
|
63
|
-
dividers: !
|
|
64
|
-
onClose:
|
|
65
|
-
closeButtonTitle:
|
|
63
|
+
dividers: !r,
|
|
64
|
+
onClose: n,
|
|
65
|
+
closeButtonTitle: d?.close ?? "Cancel",
|
|
66
66
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
67
|
+
/* @__PURE__ */ h("div", { className: "py-4 px-6 sm:px-0", lang: c, children: d?.deleteMessage ?? "Are you sure you want to delete this conversation? This action cannot be undone." }),
|
|
68
68
|
/* @__PURE__ */ y("div", { className: "flex justify-end gap-x-2 py-3 px-6 delete-conversation-popup-footer", children: [
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ h(
|
|
70
70
|
Q,
|
|
71
71
|
{
|
|
72
72
|
buttonClassName: "cancel-button",
|
|
73
|
-
title:
|
|
74
|
-
isSmallButton:
|
|
75
|
-
onClick: (
|
|
76
|
-
|
|
73
|
+
title: d?.cancel ?? "Cancel",
|
|
74
|
+
isSmallButton: a,
|
|
75
|
+
onClick: (m) => {
|
|
76
|
+
m.stopPropagation(), n();
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
),
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ h(
|
|
81
81
|
Q,
|
|
82
82
|
{
|
|
83
83
|
buttonClassName: "text-button-primary text-button-primary-error",
|
|
84
|
-
title:
|
|
85
|
-
isSmallButton:
|
|
86
|
-
onClick: (
|
|
87
|
-
|
|
84
|
+
title: d?.delete ?? "Delete",
|
|
85
|
+
isSmallButton: a,
|
|
86
|
+
onClick: (m) => {
|
|
87
|
+
m.stopPropagation(), s();
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
)
|
|
91
91
|
] })
|
|
92
92
|
]
|
|
93
93
|
}
|
|
94
|
-
), ct = (
|
|
95
|
-
const
|
|
96
|
-
qe(
|
|
97
|
-
).map((
|
|
98
|
-
...
|
|
94
|
+
), ct = (n) => {
|
|
95
|
+
const r = pt(
|
|
96
|
+
qe(n)
|
|
97
|
+
).map((s) => ({
|
|
98
|
+
...s,
|
|
99
99
|
relativePath: "",
|
|
100
100
|
contentLength: 0
|
|
101
101
|
}));
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
(
|
|
102
|
+
return $e(
|
|
103
|
+
r,
|
|
104
|
+
(s) => te(s.relativePath, s.name)
|
|
105
105
|
);
|
|
106
|
-
}, dt = (
|
|
107
|
-
const
|
|
106
|
+
}, dt = (n) => n.endsWith("/"), ut = (n) => {
|
|
107
|
+
const r = n.toLowerCase();
|
|
108
108
|
return [
|
|
109
109
|
"data:",
|
|
110
110
|
"//",
|
|
@@ -115,86 +115,86 @@ const ue = (o, s) => o?.resources?.filter((r) => r?.parentPath === s)?.map((r) =
|
|
|
115
115
|
"mailto:",
|
|
116
116
|
"telnet://",
|
|
117
117
|
"api/files"
|
|
118
|
-
].some((
|
|
119
|
-
}, ht = (
|
|
120
|
-
const
|
|
121
|
-
...
|
|
122
|
-
),
|
|
118
|
+
].some((s) => r.startsWith(s));
|
|
119
|
+
}, ht = (n) => {
|
|
120
|
+
const r = te(
|
|
121
|
+
...n.split("/").map((a) => decodeURIComponent(a))
|
|
122
|
+
), s = r.lastIndexOf("/");
|
|
123
123
|
return {
|
|
124
|
-
absolutePath:
|
|
125
|
-
name:
|
|
124
|
+
absolutePath: r.slice(0, s),
|
|
125
|
+
name: r.slice(s + 1)
|
|
126
126
|
};
|
|
127
|
-
},
|
|
128
|
-
if (!
|
|
127
|
+
}, pt = (n) => n ? n.map((r) => {
|
|
128
|
+
if (!r.url || ut(r.url) || dt(r.url))
|
|
129
129
|
return null;
|
|
130
|
-
const { absolutePath:
|
|
130
|
+
const { absolutePath: s, name: a } = ht(r.url);
|
|
131
131
|
return {
|
|
132
|
-
id:
|
|
133
|
-
name:
|
|
134
|
-
contentType:
|
|
135
|
-
folderId:
|
|
136
|
-
absolutePath:
|
|
132
|
+
id: r.url,
|
|
133
|
+
name: a,
|
|
134
|
+
contentType: r.type,
|
|
135
|
+
folderId: s,
|
|
136
|
+
absolutePath: s
|
|
137
137
|
};
|
|
138
138
|
}).filter(Boolean) : [];
|
|
139
|
-
async function
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
const e = encodeURI(te(
|
|
143
|
-
|
|
139
|
+
async function mt(n, r) {
|
|
140
|
+
const s = ct(n), a = new Je();
|
|
141
|
+
s.forEach((f) => {
|
|
142
|
+
const e = encodeURI(te(f.absolutePath, f.name)), o = r(`${e}`.replace("files/", "")), t = ft(f.folderId), i = te("res", t, f.name);
|
|
143
|
+
a.file(i, o);
|
|
144
144
|
});
|
|
145
|
-
const
|
|
145
|
+
const d = {
|
|
146
146
|
version: 5,
|
|
147
|
-
history: [
|
|
147
|
+
history: [n].map(gt) || [],
|
|
148
148
|
folders: []
|
|
149
|
-
},
|
|
150
|
-
return
|
|
149
|
+
}, c = JSON.stringify(d, null, 2);
|
|
150
|
+
return a.file("conversations/conversations_history.json", c), await a.generateAsync({ type: "base64" });
|
|
151
151
|
}
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
return
|
|
155
|
-
}, gt = (
|
|
156
|
-
function Ct(
|
|
157
|
-
const
|
|
158
|
-
|
|
152
|
+
const ft = (n) => {
|
|
153
|
+
const r = n.split("/");
|
|
154
|
+
return r.length > 2 ? te(...r.slice(2)) : void 0;
|
|
155
|
+
}, gt = (n) => He(n, ["publicationInfo"]), te = (...n) => n.filter(Boolean).join("/");
|
|
156
|
+
function Ct(n, r) {
|
|
157
|
+
const s = document.createElement("a");
|
|
158
|
+
s.download = r, s.href = n, s.style.display = "none", document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(n);
|
|
159
159
|
}
|
|
160
|
-
var Et = Object.defineProperty, ie = Object.getOwnPropertySymbols,
|
|
161
|
-
for (var
|
|
162
|
-
|
|
160
|
+
var Et = Object.defineProperty, ie = Object.getOwnPropertySymbols, be = Object.prototype.hasOwnProperty, Ie = Object.prototype.propertyIsEnumerable, Ee = (n, r, s) => r in n ? Et(n, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[r] = s, he = (n, r) => {
|
|
161
|
+
for (var s in r || (r = {}))
|
|
162
|
+
be.call(r, s) && Ee(n, s, r[s]);
|
|
163
163
|
if (ie)
|
|
164
|
-
for (var
|
|
165
|
-
Ie.call(
|
|
166
|
-
return
|
|
167
|
-
},
|
|
168
|
-
var
|
|
169
|
-
for (var
|
|
170
|
-
|
|
171
|
-
if (
|
|
172
|
-
for (var
|
|
173
|
-
|
|
174
|
-
return
|
|
164
|
+
for (var s of ie(r))
|
|
165
|
+
Ie.call(r, s) && Ee(n, s, r[s]);
|
|
166
|
+
return n;
|
|
167
|
+
}, pe = (n, r) => {
|
|
168
|
+
var s = {};
|
|
169
|
+
for (var a in n)
|
|
170
|
+
be.call(n, a) && r.indexOf(a) < 0 && (s[a] = n[a]);
|
|
171
|
+
if (n != null && ie)
|
|
172
|
+
for (var a of ie(n))
|
|
173
|
+
r.indexOf(a) < 0 && Ie.call(n, a) && (s[a] = n[a]);
|
|
174
|
+
return s;
|
|
175
175
|
};
|
|
176
176
|
var X;
|
|
177
|
-
((
|
|
178
|
-
const
|
|
177
|
+
((n) => {
|
|
178
|
+
const r = class w {
|
|
179
179
|
/*-- Constructor (low level) and fields --*/
|
|
180
180
|
// Creates a new QR Code with the given version number,
|
|
181
181
|
// error correction level, data codeword bytes, and mask number.
|
|
182
182
|
// This is a low-level API that most users should not use directly.
|
|
183
183
|
// A mid-level API is the encodeSegments() function.
|
|
184
|
-
constructor(e,
|
|
185
|
-
if (this.version = e, this.errorCorrectionLevel =
|
|
184
|
+
constructor(e, o, t, i) {
|
|
185
|
+
if (this.version = e, this.errorCorrectionLevel = o, this.modules = [], this.isFunction = [], e < w.MIN_VERSION || e > w.MAX_VERSION)
|
|
186
186
|
throw new RangeError("Version value out of range");
|
|
187
187
|
if (i < -1 || i > 7)
|
|
188
188
|
throw new RangeError("Mask value out of range");
|
|
189
189
|
this.size = e * 4 + 17;
|
|
190
|
-
let
|
|
190
|
+
let l = [];
|
|
191
191
|
for (let u = 0; u < this.size; u++)
|
|
192
|
-
|
|
192
|
+
l.push(!1);
|
|
193
193
|
for (let u = 0; u < this.size; u++)
|
|
194
|
-
this.modules.push(
|
|
194
|
+
this.modules.push(l.slice()), this.isFunction.push(l.slice());
|
|
195
195
|
this.drawFunctionPatterns();
|
|
196
|
-
const
|
|
197
|
-
if (this.drawCodewords(
|
|
196
|
+
const p = this.addEccAndInterleave(t);
|
|
197
|
+
if (this.drawCodewords(p), i == -1) {
|
|
198
198
|
let u = 1e9;
|
|
199
199
|
for (let E = 0; E < 8; E++) {
|
|
200
200
|
this.applyMask(E), this.drawFormatBits(E);
|
|
@@ -202,7 +202,7 @@ var X;
|
|
|
202
202
|
g < u && (i = E, u = g), this.applyMask(E);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
d(0 <= i && i <= 7), this.mask = i, this.applyMask(i), this.drawFormatBits(i), this.isFunction = [];
|
|
206
206
|
}
|
|
207
207
|
/*-- Static factory functions (high level) --*/
|
|
208
208
|
// Returns a QR Code representing the given Unicode text string at the given error correction level.
|
|
@@ -210,17 +210,17 @@ var X;
|
|
|
210
210
|
// Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
|
|
211
211
|
// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
|
|
212
212
|
// ecl argument if it can be done without increasing the version.
|
|
213
|
-
static encodeText(e,
|
|
214
|
-
const t =
|
|
215
|
-
return w.encodeSegments(t,
|
|
213
|
+
static encodeText(e, o) {
|
|
214
|
+
const t = n.QrSegment.makeSegments(e);
|
|
215
|
+
return w.encodeSegments(t, o);
|
|
216
216
|
}
|
|
217
217
|
// Returns a QR Code representing the given binary data at the given error correction level.
|
|
218
218
|
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
|
219
219
|
// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
|
220
220
|
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
|
221
|
-
static encodeBinary(e,
|
|
222
|
-
const t =
|
|
223
|
-
return w.encodeSegments([t],
|
|
221
|
+
static encodeBinary(e, o) {
|
|
222
|
+
const t = n.QrSegment.makeBytes(e);
|
|
223
|
+
return w.encodeSegments([t], o);
|
|
224
224
|
}
|
|
225
225
|
/*-- Static factory functions (mid level) --*/
|
|
226
226
|
// Returns a QR Code representing the given segments with the given encoding parameters.
|
|
@@ -232,12 +232,12 @@ var X;
|
|
|
232
232
|
// This function allows the user to create a custom sequence of segments that switches
|
|
233
233
|
// between modes (such as alphanumeric and byte) to encode text in less space.
|
|
234
234
|
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
|
235
|
-
static encodeSegments(e,
|
|
236
|
-
if (!(w.MIN_VERSION <= t && t <= i && i <= w.MAX_VERSION) ||
|
|
235
|
+
static encodeSegments(e, o, t = 1, i = 40, l = -1, p = !0) {
|
|
236
|
+
if (!(w.MIN_VERSION <= t && t <= i && i <= w.MAX_VERSION) || l < -1 || l > 7)
|
|
237
237
|
throw new RangeError("Invalid value");
|
|
238
238
|
let u, E;
|
|
239
239
|
for (u = t; ; u++) {
|
|
240
|
-
const C = w.getNumDataCodewords(u,
|
|
240
|
+
const C = w.getNumDataCodewords(u, o) * 8, R = m.getTotalBits(e, u);
|
|
241
241
|
if (R <= C) {
|
|
242
242
|
E = R;
|
|
243
243
|
break;
|
|
@@ -246,29 +246,29 @@ var X;
|
|
|
246
246
|
throw new RangeError("Data too long");
|
|
247
247
|
}
|
|
248
248
|
for (const C of [w.Ecc.MEDIUM, w.Ecc.QUARTILE, w.Ecc.HIGH])
|
|
249
|
-
|
|
249
|
+
p && E <= w.getNumDataCodewords(u, C) * 8 && (o = C);
|
|
250
250
|
let g = [];
|
|
251
251
|
for (const C of e) {
|
|
252
|
-
|
|
252
|
+
s(C.mode.modeBits, 4, g), s(C.numChars, C.mode.numCharCountBits(u), g);
|
|
253
253
|
for (const R of C.getData())
|
|
254
254
|
g.push(R);
|
|
255
255
|
}
|
|
256
|
-
|
|
257
|
-
const v = w.getNumDataCodewords(u,
|
|
258
|
-
|
|
256
|
+
d(g.length == E);
|
|
257
|
+
const v = w.getNumDataCodewords(u, o) * 8;
|
|
258
|
+
d(g.length <= v), s(0, Math.min(4, v - g.length), g), s(0, (8 - g.length % 8) % 8, g), d(g.length % 8 == 0);
|
|
259
259
|
for (let C = 236; g.length < v; C ^= 253)
|
|
260
|
-
|
|
260
|
+
s(C, 8, g);
|
|
261
261
|
let N = [];
|
|
262
262
|
for (; N.length * 8 < g.length; )
|
|
263
263
|
N.push(0);
|
|
264
|
-
return g.forEach((C, R) => N[R >>> 3] |= C << 7 - (R & 7)), new w(u,
|
|
264
|
+
return g.forEach((C, R) => N[R >>> 3] |= C << 7 - (R & 7)), new w(u, o, N, l);
|
|
265
265
|
}
|
|
266
266
|
/*-- Accessor methods --*/
|
|
267
267
|
// Returns the color of the module (pixel) at the given coordinates, which is false
|
|
268
268
|
// for light or true for dark. The top left corner has the coordinates (x=0, y=0).
|
|
269
269
|
// If the given coordinates are out of bounds, then false (light) is returned.
|
|
270
|
-
getModule(e,
|
|
271
|
-
return 0 <= e && e < this.size && 0 <=
|
|
270
|
+
getModule(e, o) {
|
|
271
|
+
return 0 <= e && e < this.size && 0 <= o && o < this.size && this.modules[o][e];
|
|
272
272
|
}
|
|
273
273
|
// Modified to expose modules for easy access
|
|
274
274
|
getModules() {
|
|
@@ -280,30 +280,30 @@ var X;
|
|
|
280
280
|
for (let t = 0; t < this.size; t++)
|
|
281
281
|
this.setFunctionModule(6, t, t % 2 == 0), this.setFunctionModule(t, 6, t % 2 == 0);
|
|
282
282
|
this.drawFinderPattern(3, 3), this.drawFinderPattern(this.size - 4, 3), this.drawFinderPattern(3, this.size - 4);
|
|
283
|
-
const e = this.getAlignmentPatternPositions(),
|
|
284
|
-
for (let t = 0; t <
|
|
285
|
-
for (let i = 0; i <
|
|
286
|
-
t == 0 && i == 0 || t == 0 && i ==
|
|
283
|
+
const e = this.getAlignmentPatternPositions(), o = e.length;
|
|
284
|
+
for (let t = 0; t < o; t++)
|
|
285
|
+
for (let i = 0; i < o; i++)
|
|
286
|
+
t == 0 && i == 0 || t == 0 && i == o - 1 || t == o - 1 && i == 0 || this.drawAlignmentPattern(e[t], e[i]);
|
|
287
287
|
this.drawFormatBits(0), this.drawVersion();
|
|
288
288
|
}
|
|
289
289
|
// Draws two copies of the format bits (with its own error correction code)
|
|
290
290
|
// based on the given mask and this object's error correction level field.
|
|
291
291
|
drawFormatBits(e) {
|
|
292
|
-
const
|
|
293
|
-
let t =
|
|
294
|
-
for (let
|
|
292
|
+
const o = this.errorCorrectionLevel.formatBits << 3 | e;
|
|
293
|
+
let t = o;
|
|
294
|
+
for (let l = 0; l < 10; l++)
|
|
295
295
|
t = t << 1 ^ (t >>> 9) * 1335;
|
|
296
|
-
const i = (
|
|
297
|
-
|
|
298
|
-
for (let
|
|
299
|
-
this.setFunctionModule(8,
|
|
300
|
-
this.setFunctionModule(8, 7,
|
|
301
|
-
for (let
|
|
302
|
-
this.setFunctionModule(14 -
|
|
303
|
-
for (let
|
|
304
|
-
this.setFunctionModule(this.size - 1 -
|
|
305
|
-
for (let
|
|
306
|
-
this.setFunctionModule(8, this.size - 15 +
|
|
296
|
+
const i = (o << 10 | t) ^ 21522;
|
|
297
|
+
d(i >>> 15 == 0);
|
|
298
|
+
for (let l = 0; l <= 5; l++)
|
|
299
|
+
this.setFunctionModule(8, l, a(i, l));
|
|
300
|
+
this.setFunctionModule(8, 7, a(i, 6)), this.setFunctionModule(8, 8, a(i, 7)), this.setFunctionModule(7, 8, a(i, 8));
|
|
301
|
+
for (let l = 9; l < 15; l++)
|
|
302
|
+
this.setFunctionModule(14 - l, 8, a(i, l));
|
|
303
|
+
for (let l = 0; l < 8; l++)
|
|
304
|
+
this.setFunctionModule(this.size - 1 - l, 8, a(i, l));
|
|
305
|
+
for (let l = 8; l < 15; l++)
|
|
306
|
+
this.setFunctionModule(8, this.size - 15 + l, a(i, l));
|
|
307
307
|
this.setFunctionModule(8, this.size - 8, !0);
|
|
308
308
|
}
|
|
309
309
|
// Draws two copies of the version bits (with its own error correction code),
|
|
@@ -314,46 +314,46 @@ var X;
|
|
|
314
314
|
let e = this.version;
|
|
315
315
|
for (let t = 0; t < 12; t++)
|
|
316
316
|
e = e << 1 ^ (e >>> 11) * 7973;
|
|
317
|
-
const
|
|
318
|
-
|
|
317
|
+
const o = this.version << 12 | e;
|
|
318
|
+
d(o >>> 18 == 0);
|
|
319
319
|
for (let t = 0; t < 18; t++) {
|
|
320
|
-
const i =
|
|
321
|
-
this.setFunctionModule(
|
|
320
|
+
const i = a(o, t), l = this.size - 11 + t % 3, p = Math.floor(t / 3);
|
|
321
|
+
this.setFunctionModule(l, p, i), this.setFunctionModule(p, l, i);
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
// Draws a 9*9 finder pattern including the border separator,
|
|
325
325
|
// with the center module at (x, y). Modules can be out of bounds.
|
|
326
|
-
drawFinderPattern(e,
|
|
326
|
+
drawFinderPattern(e, o) {
|
|
327
327
|
for (let t = -4; t <= 4; t++)
|
|
328
328
|
for (let i = -4; i <= 4; i++) {
|
|
329
|
-
const
|
|
330
|
-
0 <=
|
|
329
|
+
const l = Math.max(Math.abs(i), Math.abs(t)), p = e + i, u = o + t;
|
|
330
|
+
0 <= p && p < this.size && 0 <= u && u < this.size && this.setFunctionModule(p, u, l != 2 && l != 4);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
// Draws a 5*5 alignment pattern, with the center module
|
|
334
334
|
// at (x, y). All modules must be in bounds.
|
|
335
|
-
drawAlignmentPattern(e,
|
|
335
|
+
drawAlignmentPattern(e, o) {
|
|
336
336
|
for (let t = -2; t <= 2; t++)
|
|
337
337
|
for (let i = -2; i <= 2; i++)
|
|
338
|
-
this.setFunctionModule(e + i,
|
|
338
|
+
this.setFunctionModule(e + i, o + t, Math.max(Math.abs(i), Math.abs(t)) != 1);
|
|
339
339
|
}
|
|
340
340
|
// Sets the color of a module and marks it as a function module.
|
|
341
341
|
// Only used by the constructor. Coordinates must be in bounds.
|
|
342
|
-
setFunctionModule(e,
|
|
343
|
-
this.modules[
|
|
342
|
+
setFunctionModule(e, o, t) {
|
|
343
|
+
this.modules[o][e] = t, this.isFunction[o][e] = !0;
|
|
344
344
|
}
|
|
345
345
|
/*-- Private helper methods for constructor: Codewords and masking --*/
|
|
346
346
|
// Returns a new byte string representing the given data with the appropriate error correction
|
|
347
347
|
// codewords appended to it, based on this object's version and error correction level.
|
|
348
348
|
addEccAndInterleave(e) {
|
|
349
|
-
const
|
|
350
|
-
if (e.length != w.getNumDataCodewords(
|
|
349
|
+
const o = this.version, t = this.errorCorrectionLevel;
|
|
350
|
+
if (e.length != w.getNumDataCodewords(o, t))
|
|
351
351
|
throw new RangeError("Invalid argument");
|
|
352
|
-
const i = w.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][
|
|
352
|
+
const i = w.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][o], l = w.ECC_CODEWORDS_PER_BLOCK[t.ordinal][o], p = Math.floor(w.getNumRawDataModules(o) / 8), u = i - p % i, E = Math.floor(p / i);
|
|
353
353
|
let g = [];
|
|
354
|
-
const v = w.reedSolomonComputeDivisor(
|
|
354
|
+
const v = w.reedSolomonComputeDivisor(l);
|
|
355
355
|
for (let C = 0, R = 0; C < i; C++) {
|
|
356
|
-
let S = e.slice(R, R + E -
|
|
356
|
+
let S = e.slice(R, R + E - l + (C < u ? 0 : 1));
|
|
357
357
|
R += S.length;
|
|
358
358
|
const D = w.reedSolomonComputeRemainder(S, v);
|
|
359
359
|
C < u && S.push(0), g.push(S.concat(D));
|
|
@@ -361,25 +361,25 @@ var X;
|
|
|
361
361
|
let N = [];
|
|
362
362
|
for (let C = 0; C < g[0].length; C++)
|
|
363
363
|
g.forEach((R, S) => {
|
|
364
|
-
(C != E -
|
|
364
|
+
(C != E - l || S >= u) && N.push(R[C]);
|
|
365
365
|
});
|
|
366
|
-
return
|
|
366
|
+
return d(N.length == p), N;
|
|
367
367
|
}
|
|
368
368
|
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
|
369
369
|
// data area of this QR Code. Function modules need to be marked off before this is called.
|
|
370
370
|
drawCodewords(e) {
|
|
371
371
|
if (e.length != Math.floor(w.getNumRawDataModules(this.version) / 8))
|
|
372
372
|
throw new RangeError("Invalid argument");
|
|
373
|
-
let
|
|
373
|
+
let o = 0;
|
|
374
374
|
for (let t = this.size - 1; t >= 1; t -= 2) {
|
|
375
375
|
t == 6 && (t = 5);
|
|
376
376
|
for (let i = 0; i < this.size; i++)
|
|
377
|
-
for (let
|
|
378
|
-
const
|
|
379
|
-
!this.isFunction[E][
|
|
377
|
+
for (let l = 0; l < 2; l++) {
|
|
378
|
+
const p = t - l, E = (t + 1 & 2) == 0 ? this.size - 1 - i : i;
|
|
379
|
+
!this.isFunction[E][p] && o < e.length * 8 && (this.modules[E][p] = a(e[o >>> 3], 7 - (o & 7)), o++);
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
|
|
382
|
+
d(o == e.length * 8);
|
|
383
383
|
}
|
|
384
384
|
// XORs the codeword modules in this QR Code with the given mask pattern.
|
|
385
385
|
// The function modules must be marked and the codeword bits must be drawn
|
|
@@ -389,66 +389,66 @@ var X;
|
|
|
389
389
|
applyMask(e) {
|
|
390
390
|
if (e < 0 || e > 7)
|
|
391
391
|
throw new RangeError("Mask value out of range");
|
|
392
|
-
for (let
|
|
392
|
+
for (let o = 0; o < this.size; o++)
|
|
393
393
|
for (let t = 0; t < this.size; t++) {
|
|
394
394
|
let i;
|
|
395
395
|
switch (e) {
|
|
396
396
|
case 0:
|
|
397
|
-
i = (t +
|
|
397
|
+
i = (t + o) % 2 == 0;
|
|
398
398
|
break;
|
|
399
399
|
case 1:
|
|
400
|
-
i =
|
|
400
|
+
i = o % 2 == 0;
|
|
401
401
|
break;
|
|
402
402
|
case 2:
|
|
403
403
|
i = t % 3 == 0;
|
|
404
404
|
break;
|
|
405
405
|
case 3:
|
|
406
|
-
i = (t +
|
|
406
|
+
i = (t + o) % 3 == 0;
|
|
407
407
|
break;
|
|
408
408
|
case 4:
|
|
409
|
-
i = (Math.floor(t / 3) + Math.floor(
|
|
409
|
+
i = (Math.floor(t / 3) + Math.floor(o / 2)) % 2 == 0;
|
|
410
410
|
break;
|
|
411
411
|
case 5:
|
|
412
|
-
i = t *
|
|
412
|
+
i = t * o % 2 + t * o % 3 == 0;
|
|
413
413
|
break;
|
|
414
414
|
case 6:
|
|
415
|
-
i = (t *
|
|
415
|
+
i = (t * o % 2 + t * o % 3) % 2 == 0;
|
|
416
416
|
break;
|
|
417
417
|
case 7:
|
|
418
|
-
i = ((t +
|
|
418
|
+
i = ((t + o) % 2 + t * o % 3) % 2 == 0;
|
|
419
419
|
break;
|
|
420
420
|
default:
|
|
421
421
|
throw new Error("Unreachable");
|
|
422
422
|
}
|
|
423
|
-
!this.isFunction[
|
|
423
|
+
!this.isFunction[o][t] && i && (this.modules[o][t] = !this.modules[o][t]);
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
|
427
427
|
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
|
|
428
428
|
getPenaltyScore() {
|
|
429
429
|
let e = 0;
|
|
430
|
-
for (let
|
|
431
|
-
let
|
|
430
|
+
for (let l = 0; l < this.size; l++) {
|
|
431
|
+
let p = !1, u = 0, E = [0, 0, 0, 0, 0, 0, 0];
|
|
432
432
|
for (let g = 0; g < this.size; g++)
|
|
433
|
-
this.modules[
|
|
434
|
-
e += this.finderPenaltyTerminateAndCount(
|
|
433
|
+
this.modules[l][g] == p ? (u++, u == 5 ? e += w.PENALTY_N1 : u > 5 && e++) : (this.finderPenaltyAddHistory(u, E), p || (e += this.finderPenaltyCountPatterns(E) * w.PENALTY_N3), p = this.modules[l][g], u = 1);
|
|
434
|
+
e += this.finderPenaltyTerminateAndCount(p, u, E) * w.PENALTY_N3;
|
|
435
435
|
}
|
|
436
|
-
for (let
|
|
437
|
-
let
|
|
436
|
+
for (let l = 0; l < this.size; l++) {
|
|
437
|
+
let p = !1, u = 0, E = [0, 0, 0, 0, 0, 0, 0];
|
|
438
438
|
for (let g = 0; g < this.size; g++)
|
|
439
|
-
this.modules[g][
|
|
440
|
-
e += this.finderPenaltyTerminateAndCount(
|
|
439
|
+
this.modules[g][l] == p ? (u++, u == 5 ? e += w.PENALTY_N1 : u > 5 && e++) : (this.finderPenaltyAddHistory(u, E), p || (e += this.finderPenaltyCountPatterns(E) * w.PENALTY_N3), p = this.modules[g][l], u = 1);
|
|
440
|
+
e += this.finderPenaltyTerminateAndCount(p, u, E) * w.PENALTY_N3;
|
|
441
441
|
}
|
|
442
|
-
for (let
|
|
443
|
-
for (let
|
|
444
|
-
const u = this.modules[
|
|
445
|
-
u == this.modules[
|
|
442
|
+
for (let l = 0; l < this.size - 1; l++)
|
|
443
|
+
for (let p = 0; p < this.size - 1; p++) {
|
|
444
|
+
const u = this.modules[l][p];
|
|
445
|
+
u == this.modules[l][p + 1] && u == this.modules[l + 1][p] && u == this.modules[l + 1][p + 1] && (e += w.PENALTY_N2);
|
|
446
446
|
}
|
|
447
|
-
let
|
|
448
|
-
for (const
|
|
449
|
-
|
|
450
|
-
const t = this.size * this.size, i = Math.ceil(Math.abs(
|
|
451
|
-
return
|
|
447
|
+
let o = 0;
|
|
448
|
+
for (const l of this.modules)
|
|
449
|
+
o = l.reduce((p, u) => p + (u ? 1 : 0), o);
|
|
450
|
+
const t = this.size * this.size, i = Math.ceil(Math.abs(o * 20 - t * 10) / t) - 1;
|
|
451
|
+
return d(0 <= i && i <= 9), e += i * w.PENALTY_N4, d(0 <= e && e <= 2568888), e;
|
|
452
452
|
}
|
|
453
453
|
/*-- Private helper functions --*/
|
|
454
454
|
// Returns an ascending list of positions of alignment patterns for this version number.
|
|
@@ -458,9 +458,9 @@ var X;
|
|
|
458
458
|
if (this.version == 1)
|
|
459
459
|
return [];
|
|
460
460
|
{
|
|
461
|
-
const e = Math.floor(this.version / 7) + 2,
|
|
461
|
+
const e = Math.floor(this.version / 7) + 2, o = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (e * 2 - 2)) * 2;
|
|
462
462
|
let t = [6];
|
|
463
|
-
for (let i = this.size - 7; t.length < e; i -=
|
|
463
|
+
for (let i = this.size - 7; t.length < e; i -= o)
|
|
464
464
|
t.splice(1, 0, i);
|
|
465
465
|
return t;
|
|
466
466
|
}
|
|
@@ -471,73 +471,73 @@ var X;
|
|
|
471
471
|
static getNumRawDataModules(e) {
|
|
472
472
|
if (e < w.MIN_VERSION || e > w.MAX_VERSION)
|
|
473
473
|
throw new RangeError("Version number out of range");
|
|
474
|
-
let
|
|
474
|
+
let o = (16 * e + 128) * e + 64;
|
|
475
475
|
if (e >= 2) {
|
|
476
476
|
const t = Math.floor(e / 7) + 2;
|
|
477
|
-
|
|
477
|
+
o -= (25 * t - 10) * t - 55, e >= 7 && (o -= 36);
|
|
478
478
|
}
|
|
479
|
-
return
|
|
479
|
+
return d(208 <= o && o <= 29648), o;
|
|
480
480
|
}
|
|
481
481
|
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
|
|
482
482
|
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
|
483
483
|
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
|
484
|
-
static getNumDataCodewords(e,
|
|
485
|
-
return Math.floor(w.getNumRawDataModules(e) / 8) - w.ECC_CODEWORDS_PER_BLOCK[
|
|
484
|
+
static getNumDataCodewords(e, o) {
|
|
485
|
+
return Math.floor(w.getNumRawDataModules(e) / 8) - w.ECC_CODEWORDS_PER_BLOCK[o.ordinal][e] * w.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][e];
|
|
486
486
|
}
|
|
487
487
|
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
|
|
488
488
|
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
|
|
489
489
|
static reedSolomonComputeDivisor(e) {
|
|
490
490
|
if (e < 1 || e > 255)
|
|
491
491
|
throw new RangeError("Degree out of range");
|
|
492
|
-
let
|
|
492
|
+
let o = [];
|
|
493
493
|
for (let i = 0; i < e - 1; i++)
|
|
494
|
-
|
|
495
|
-
|
|
494
|
+
o.push(0);
|
|
495
|
+
o.push(1);
|
|
496
496
|
let t = 1;
|
|
497
497
|
for (let i = 0; i < e; i++) {
|
|
498
|
-
for (let
|
|
499
|
-
|
|
498
|
+
for (let l = 0; l < o.length; l++)
|
|
499
|
+
o[l] = w.reedSolomonMultiply(o[l], t), l + 1 < o.length && (o[l] ^= o[l + 1]);
|
|
500
500
|
t = w.reedSolomonMultiply(t, 2);
|
|
501
501
|
}
|
|
502
|
-
return
|
|
502
|
+
return o;
|
|
503
503
|
}
|
|
504
504
|
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
|
|
505
|
-
static reedSolomonComputeRemainder(e,
|
|
506
|
-
let t =
|
|
505
|
+
static reedSolomonComputeRemainder(e, o) {
|
|
506
|
+
let t = o.map((i) => 0);
|
|
507
507
|
for (const i of e) {
|
|
508
|
-
const
|
|
509
|
-
t.push(0),
|
|
508
|
+
const l = i ^ t.shift();
|
|
509
|
+
t.push(0), o.forEach((p, u) => t[u] ^= w.reedSolomonMultiply(p, l));
|
|
510
510
|
}
|
|
511
511
|
return t;
|
|
512
512
|
}
|
|
513
513
|
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
|
|
514
514
|
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
|
|
515
|
-
static reedSolomonMultiply(e,
|
|
516
|
-
if (e >>> 8 ||
|
|
515
|
+
static reedSolomonMultiply(e, o) {
|
|
516
|
+
if (e >>> 8 || o >>> 8)
|
|
517
517
|
throw new RangeError("Byte out of range");
|
|
518
518
|
let t = 0;
|
|
519
519
|
for (let i = 7; i >= 0; i--)
|
|
520
|
-
t = t << 1 ^ (t >>> 7) * 285, t ^= (
|
|
521
|
-
return
|
|
520
|
+
t = t << 1 ^ (t >>> 7) * 285, t ^= (o >>> i & 1) * e;
|
|
521
|
+
return d(t >>> 8 == 0), t;
|
|
522
522
|
}
|
|
523
523
|
// Can only be called immediately after a light run is added, and
|
|
524
524
|
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
|
|
525
525
|
finderPenaltyCountPatterns(e) {
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
const t =
|
|
529
|
-
return (t && e[0] >=
|
|
526
|
+
const o = e[1];
|
|
527
|
+
d(o <= this.size * 3);
|
|
528
|
+
const t = o > 0 && e[2] == o && e[3] == o * 3 && e[4] == o && e[5] == o;
|
|
529
|
+
return (t && e[0] >= o * 4 && e[6] >= o ? 1 : 0) + (t && e[6] >= o * 4 && e[0] >= o ? 1 : 0);
|
|
530
530
|
}
|
|
531
531
|
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
|
|
532
|
-
finderPenaltyTerminateAndCount(e,
|
|
533
|
-
return e && (this.finderPenaltyAddHistory(
|
|
532
|
+
finderPenaltyTerminateAndCount(e, o, t) {
|
|
533
|
+
return e && (this.finderPenaltyAddHistory(o, t), o = 0), o += this.size, this.finderPenaltyAddHistory(o, t), this.finderPenaltyCountPatterns(t);
|
|
534
534
|
}
|
|
535
535
|
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
|
|
536
|
-
finderPenaltyAddHistory(e,
|
|
537
|
-
|
|
536
|
+
finderPenaltyAddHistory(e, o) {
|
|
537
|
+
o[0] == 0 && (e += this.size), o.pop(), o.unshift(e);
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
|
-
|
|
540
|
+
r.MIN_VERSION = 1, r.MAX_VERSION = 40, r.PENALTY_N1 = 3, r.PENALTY_N2 = 3, r.PENALTY_N3 = 40, r.PENALTY_N4 = 10, r.ECC_CODEWORDS_PER_BLOCK = [
|
|
541
541
|
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
|
542
542
|
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
|
543
543
|
[-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
|
|
@@ -548,7 +548,7 @@ var X;
|
|
|
548
548
|
// Quartile
|
|
549
549
|
[-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
|
|
550
550
|
// High
|
|
551
|
-
],
|
|
551
|
+
], r.NUM_ERROR_CORRECTION_BLOCKS = [
|
|
552
552
|
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
|
553
553
|
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
|
554
554
|
[-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
|
|
@@ -559,27 +559,27 @@ var X;
|
|
|
559
559
|
// Quartile
|
|
560
560
|
[-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
|
|
561
561
|
// High
|
|
562
|
-
],
|
|
563
|
-
function
|
|
564
|
-
if (e < 0 || e > 31 ||
|
|
562
|
+
], n.QrCode = r;
|
|
563
|
+
function s(f, e, o) {
|
|
564
|
+
if (e < 0 || e > 31 || f >>> e)
|
|
565
565
|
throw new RangeError("Value out of range");
|
|
566
566
|
for (let t = e - 1; t >= 0; t--)
|
|
567
|
-
|
|
567
|
+
o.push(f >>> t & 1);
|
|
568
568
|
}
|
|
569
|
-
function
|
|
570
|
-
return (
|
|
569
|
+
function a(f, e) {
|
|
570
|
+
return (f >>> e & 1) != 0;
|
|
571
571
|
}
|
|
572
|
-
function
|
|
573
|
-
if (!
|
|
572
|
+
function d(f) {
|
|
573
|
+
if (!f)
|
|
574
574
|
throw new Error("Assertion error");
|
|
575
575
|
}
|
|
576
|
-
const
|
|
576
|
+
const c = class I {
|
|
577
577
|
/*-- Constructor (low level) and fields --*/
|
|
578
578
|
// Creates a new QR Code segment with the given attributes and data.
|
|
579
579
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
|
580
580
|
// but the constraint isn't checked. The given bit buffer is cloned and stored.
|
|
581
|
-
constructor(e,
|
|
582
|
-
if (this.mode = e, this.numChars =
|
|
581
|
+
constructor(e, o, t) {
|
|
582
|
+
if (this.mode = e, this.numChars = o, this.bitData = t, o < 0)
|
|
583
583
|
throw new RangeError("Invalid argument");
|
|
584
584
|
this.bitData = t.slice();
|
|
585
585
|
}
|
|
@@ -588,21 +588,21 @@ var X;
|
|
|
588
588
|
// byte mode. All input byte arrays are acceptable. Any text string
|
|
589
589
|
// can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
|
590
590
|
static makeBytes(e) {
|
|
591
|
-
let
|
|
591
|
+
let o = [];
|
|
592
592
|
for (const t of e)
|
|
593
|
-
|
|
594
|
-
return new I(I.Mode.BYTE, e.length,
|
|
593
|
+
s(t, 8, o);
|
|
594
|
+
return new I(I.Mode.BYTE, e.length, o);
|
|
595
595
|
}
|
|
596
596
|
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
597
597
|
static makeNumeric(e) {
|
|
598
598
|
if (!I.isNumeric(e))
|
|
599
599
|
throw new RangeError("String contains non-numeric characters");
|
|
600
|
-
let
|
|
600
|
+
let o = [];
|
|
601
601
|
for (let t = 0; t < e.length; ) {
|
|
602
602
|
const i = Math.min(e.length - t, 3);
|
|
603
|
-
|
|
603
|
+
s(parseInt(e.substring(t, t + i), 10), i * 3 + 1, o), t += i;
|
|
604
604
|
}
|
|
605
|
-
return new I(I.Mode.NUMERIC, e.length,
|
|
605
|
+
return new I(I.Mode.NUMERIC, e.length, o);
|
|
606
606
|
}
|
|
607
607
|
// Returns a segment representing the given text string encoded in alphanumeric mode.
|
|
608
608
|
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
|
@@ -610,12 +610,12 @@ var X;
|
|
|
610
610
|
static makeAlphanumeric(e) {
|
|
611
611
|
if (!I.isAlphanumeric(e))
|
|
612
612
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
613
|
-
let
|
|
613
|
+
let o = [], t;
|
|
614
614
|
for (t = 0; t + 2 <= e.length; t += 2) {
|
|
615
615
|
let i = I.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)) * 45;
|
|
616
|
-
i += I.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t + 1)),
|
|
616
|
+
i += I.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t + 1)), s(i, 11, o);
|
|
617
617
|
}
|
|
618
|
-
return t < e.length &&
|
|
618
|
+
return t < e.length && s(I.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)), 6, o), new I(I.Mode.ALPHANUMERIC, e.length, o);
|
|
619
619
|
}
|
|
620
620
|
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
|
621
621
|
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
|
@@ -625,18 +625,18 @@ var X;
|
|
|
625
625
|
// Returns a segment representing an Extended Channel Interpretation
|
|
626
626
|
// (ECI) designator with the given assignment value.
|
|
627
627
|
static makeEci(e) {
|
|
628
|
-
let
|
|
628
|
+
let o = [];
|
|
629
629
|
if (e < 0)
|
|
630
630
|
throw new RangeError("ECI assignment value out of range");
|
|
631
631
|
if (e < 128)
|
|
632
|
-
|
|
632
|
+
s(e, 8, o);
|
|
633
633
|
else if (e < 16384)
|
|
634
|
-
|
|
634
|
+
s(2, 2, o), s(e, 14, o);
|
|
635
635
|
else if (e < 1e6)
|
|
636
|
-
|
|
636
|
+
s(6, 3, o), s(e, 21, o);
|
|
637
637
|
else
|
|
638
638
|
throw new RangeError("ECI assignment value out of range");
|
|
639
|
-
return new I(I.Mode.ECI, 0,
|
|
639
|
+
return new I(I.Mode.ECI, 0, o);
|
|
640
640
|
}
|
|
641
641
|
// Tests whether the given string can be encoded as a segment in numeric mode.
|
|
642
642
|
// A string is encodable iff each character is in the range 0 to 9.
|
|
@@ -656,57 +656,57 @@ var X;
|
|
|
656
656
|
}
|
|
657
657
|
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at
|
|
658
658
|
// the given version. The result is infinity if a segment has too many characters to fit its length field.
|
|
659
|
-
static getTotalBits(e,
|
|
659
|
+
static getTotalBits(e, o) {
|
|
660
660
|
let t = 0;
|
|
661
661
|
for (const i of e) {
|
|
662
|
-
const
|
|
663
|
-
if (i.numChars >= 1 <<
|
|
662
|
+
const l = i.mode.numCharCountBits(o);
|
|
663
|
+
if (i.numChars >= 1 << l)
|
|
664
664
|
return 1 / 0;
|
|
665
|
-
t += 4 +
|
|
665
|
+
t += 4 + l + i.bitData.length;
|
|
666
666
|
}
|
|
667
667
|
return t;
|
|
668
668
|
}
|
|
669
669
|
// Returns a new array of bytes representing the given string encoded in UTF-8.
|
|
670
670
|
static toUtf8ByteArray(e) {
|
|
671
671
|
e = encodeURI(e);
|
|
672
|
-
let
|
|
672
|
+
let o = [];
|
|
673
673
|
for (let t = 0; t < e.length; t++)
|
|
674
|
-
e.charAt(t) != "%" ?
|
|
675
|
-
return
|
|
674
|
+
e.charAt(t) != "%" ? o.push(e.charCodeAt(t)) : (o.push(parseInt(e.substring(t + 1, t + 3), 16)), t += 2);
|
|
675
|
+
return o;
|
|
676
676
|
}
|
|
677
677
|
};
|
|
678
|
-
|
|
679
|
-
let
|
|
680
|
-
|
|
678
|
+
c.NUMERIC_REGEX = /^[0-9]*$/, c.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/, c.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
679
|
+
let m = c;
|
|
680
|
+
n.QrSegment = c;
|
|
681
681
|
})(X || (X = {}));
|
|
682
|
-
((
|
|
683
|
-
((
|
|
684
|
-
const
|
|
682
|
+
((n) => {
|
|
683
|
+
((r) => {
|
|
684
|
+
const s = class {
|
|
685
685
|
// The QR Code can tolerate about 30% erroneous codewords
|
|
686
686
|
/*-- Constructor and fields --*/
|
|
687
|
-
constructor(
|
|
688
|
-
this.ordinal =
|
|
687
|
+
constructor(d, c) {
|
|
688
|
+
this.ordinal = d, this.formatBits = c;
|
|
689
689
|
}
|
|
690
690
|
};
|
|
691
|
-
|
|
692
|
-
})(
|
|
691
|
+
s.LOW = new s(0, 1), s.MEDIUM = new s(1, 0), s.QUARTILE = new s(2, 3), s.HIGH = new s(3, 2), r.Ecc = s;
|
|
692
|
+
})(n.QrCode || (n.QrCode = {}));
|
|
693
693
|
})(X || (X = {}));
|
|
694
|
-
((
|
|
695
|
-
((
|
|
696
|
-
const
|
|
694
|
+
((n) => {
|
|
695
|
+
((r) => {
|
|
696
|
+
const s = class {
|
|
697
697
|
/*-- Constructor and fields --*/
|
|
698
|
-
constructor(
|
|
699
|
-
this.modeBits =
|
|
698
|
+
constructor(d, c) {
|
|
699
|
+
this.modeBits = d, this.numBitsCharCount = c;
|
|
700
700
|
}
|
|
701
701
|
/*-- Method --*/
|
|
702
702
|
// (Package-private) Returns the bit width of the character count field for a segment in
|
|
703
703
|
// this mode in a QR Code at the given version number. The result is in the range [0, 16].
|
|
704
|
-
numCharCountBits(
|
|
705
|
-
return this.numBitsCharCount[Math.floor((
|
|
704
|
+
numCharCountBits(d) {
|
|
705
|
+
return this.numBitsCharCount[Math.floor((d + 7) / 17)];
|
|
706
706
|
}
|
|
707
707
|
};
|
|
708
|
-
|
|
709
|
-
})(
|
|
708
|
+
s.NUMERIC = new s(1, [10, 12, 14]), s.ALPHANUMERIC = new s(2, [9, 11, 13]), s.BYTE = new s(4, [8, 16, 16]), s.KANJI = new s(8, [8, 10, 12]), s.ECI = new s(7, [0, 0, 0]), r.Mode = s;
|
|
709
|
+
})(n.QrSegment || (n.QrSegment = {}));
|
|
710
710
|
})(X || (X = {}));
|
|
711
711
|
var Z = X;
|
|
712
712
|
var wt = {
|
|
@@ -714,93 +714,93 @@ var wt = {
|
|
|
714
714
|
M: Z.QrCode.Ecc.MEDIUM,
|
|
715
715
|
Q: Z.QrCode.Ecc.QUARTILE,
|
|
716
716
|
H: Z.QrCode.Ecc.HIGH
|
|
717
|
-
},
|
|
718
|
-
function
|
|
719
|
-
const
|
|
720
|
-
return
|
|
721
|
-
let
|
|
722
|
-
|
|
723
|
-
if (!
|
|
724
|
-
|
|
725
|
-
`M${
|
|
726
|
-
),
|
|
717
|
+
}, Ae = 128, Se = "L", xe = "#FFFFFF", Pe = "#000000", De = !1, Te = 1, Nt = 4, Rt = 0, vt = 0.1;
|
|
718
|
+
function Oe(n, r = 0) {
|
|
719
|
+
const s = [];
|
|
720
|
+
return n.forEach(function(a, d) {
|
|
721
|
+
let c = null;
|
|
722
|
+
a.forEach(function(m, f) {
|
|
723
|
+
if (!m && c !== null) {
|
|
724
|
+
s.push(
|
|
725
|
+
`M${c + r} ${d + r}h${f - c}v1H${c + r}z`
|
|
726
|
+
), c = null;
|
|
727
727
|
return;
|
|
728
728
|
}
|
|
729
|
-
if (
|
|
730
|
-
if (!
|
|
729
|
+
if (f === a.length - 1) {
|
|
730
|
+
if (!m)
|
|
731
731
|
return;
|
|
732
|
-
|
|
733
|
-
`M${
|
|
732
|
+
c === null ? s.push(`M${f + r},${d + r} h1v1H${f + r}z`) : s.push(
|
|
733
|
+
`M${c + r},${d + r} h${f + 1 - c}v1H${c + r}z`
|
|
734
734
|
);
|
|
735
735
|
return;
|
|
736
736
|
}
|
|
737
|
-
|
|
737
|
+
m && c === null && (c = f);
|
|
738
738
|
});
|
|
739
|
-
}),
|
|
739
|
+
}), s.join("");
|
|
740
740
|
}
|
|
741
|
-
function Le(
|
|
742
|
-
return
|
|
741
|
+
function Le(n, r) {
|
|
742
|
+
return n.slice().map((s, a) => a < r.y || a >= r.y + r.h ? s : s.map((d, c) => c < r.x || c >= r.x + r.w ? d : !1));
|
|
743
743
|
}
|
|
744
|
-
function Mt(
|
|
745
|
-
if (
|
|
744
|
+
function Mt(n, r, s, a) {
|
|
745
|
+
if (a == null)
|
|
746
746
|
return null;
|
|
747
|
-
const
|
|
748
|
-
let
|
|
749
|
-
if (
|
|
750
|
-
let u = Math.floor(
|
|
751
|
-
|
|
747
|
+
const d = n.length + s * 2, c = Math.floor(r * vt), m = d / r, f = (a.width || c) * m, e = (a.height || c) * m, o = a.x == null ? n.length / 2 - f / 2 : a.x * m, t = a.y == null ? n.length / 2 - e / 2 : a.y * m, i = a.opacity == null ? 1 : a.opacity;
|
|
748
|
+
let l = null;
|
|
749
|
+
if (a.excavate) {
|
|
750
|
+
let u = Math.floor(o), E = Math.floor(t), g = Math.ceil(f + o - u), v = Math.ceil(e + t - E);
|
|
751
|
+
l = { x: u, y: E, w: g, h: v };
|
|
752
752
|
}
|
|
753
|
-
const
|
|
754
|
-
return { x:
|
|
753
|
+
const p = a.crossOrigin;
|
|
754
|
+
return { x: o, y: t, h: e, w: f, excavation: l, opacity: i, crossOrigin: p };
|
|
755
755
|
}
|
|
756
|
-
function yt(
|
|
757
|
-
return
|
|
756
|
+
function yt(n, r) {
|
|
757
|
+
return r != null ? Math.max(Math.floor(r), 0) : n ? Nt : Rt;
|
|
758
758
|
}
|
|
759
|
-
function
|
|
760
|
-
value:
|
|
761
|
-
level:
|
|
762
|
-
minVersion:
|
|
763
|
-
includeMargin:
|
|
764
|
-
marginSize:
|
|
765
|
-
imageSettings:
|
|
766
|
-
size:
|
|
767
|
-
boostLevel:
|
|
759
|
+
function ke({
|
|
760
|
+
value: n,
|
|
761
|
+
level: r,
|
|
762
|
+
minVersion: s,
|
|
763
|
+
includeMargin: a,
|
|
764
|
+
marginSize: d,
|
|
765
|
+
imageSettings: c,
|
|
766
|
+
size: m,
|
|
767
|
+
boostLevel: f
|
|
768
768
|
}) {
|
|
769
769
|
let e = x.useMemo(() => {
|
|
770
|
-
const u = (Array.isArray(
|
|
770
|
+
const u = (Array.isArray(n) ? n : [n]).reduce((E, g) => (E.push(...Z.QrSegment.makeSegments(g)), E), []);
|
|
771
771
|
return Z.QrCode.encodeSegments(
|
|
772
772
|
u,
|
|
773
|
-
wt[
|
|
774
|
-
|
|
773
|
+
wt[r],
|
|
774
|
+
s,
|
|
775
775
|
void 0,
|
|
776
776
|
void 0,
|
|
777
|
-
|
|
777
|
+
f
|
|
778
778
|
);
|
|
779
|
-
}, [
|
|
780
|
-
const { cells:
|
|
781
|
-
let
|
|
782
|
-
const u = yt(
|
|
783
|
-
|
|
784
|
-
|
|
779
|
+
}, [n, r, s, f]);
|
|
780
|
+
const { cells: o, margin: t, numCells: i, calculatedImageSettings: l } = x.useMemo(() => {
|
|
781
|
+
let p = e.getModules();
|
|
782
|
+
const u = yt(a, d), E = p.length + u * 2, g = Mt(
|
|
783
|
+
p,
|
|
784
|
+
m,
|
|
785
785
|
u,
|
|
786
|
-
|
|
786
|
+
c
|
|
787
787
|
);
|
|
788
788
|
return {
|
|
789
|
-
cells:
|
|
789
|
+
cells: p,
|
|
790
790
|
margin: u,
|
|
791
791
|
numCells: E,
|
|
792
792
|
calculatedImageSettings: g
|
|
793
793
|
};
|
|
794
|
-
}, [e,
|
|
794
|
+
}, [e, m, c, a, d]);
|
|
795
795
|
return {
|
|
796
796
|
qrcode: e,
|
|
797
797
|
margin: t,
|
|
798
|
-
cells:
|
|
798
|
+
cells: o,
|
|
799
799
|
numCells: i,
|
|
800
|
-
calculatedImageSettings:
|
|
800
|
+
calculatedImageSettings: l
|
|
801
801
|
};
|
|
802
802
|
}
|
|
803
|
-
var
|
|
803
|
+
var bt = (function() {
|
|
804
804
|
try {
|
|
805
805
|
new Path2D().addPath(new Path2D());
|
|
806
806
|
} catch {
|
|
@@ -808,19 +808,19 @@ var At = (function() {
|
|
|
808
808
|
}
|
|
809
809
|
return !0;
|
|
810
810
|
})(), It = x.forwardRef(
|
|
811
|
-
function(
|
|
812
|
-
const
|
|
813
|
-
value:
|
|
814
|
-
size:
|
|
815
|
-
level:
|
|
816
|
-
bgColor:
|
|
811
|
+
function(r, s) {
|
|
812
|
+
const a = r, {
|
|
813
|
+
value: d,
|
|
814
|
+
size: c = Ae,
|
|
815
|
+
level: m = Se,
|
|
816
|
+
bgColor: f = xe,
|
|
817
817
|
fgColor: e = Pe,
|
|
818
|
-
includeMargin:
|
|
819
|
-
minVersion: t =
|
|
818
|
+
includeMargin: o = De,
|
|
819
|
+
minVersion: t = Te,
|
|
820
820
|
boostLevel: i,
|
|
821
|
-
marginSize:
|
|
822
|
-
imageSettings:
|
|
823
|
-
} =
|
|
821
|
+
marginSize: l,
|
|
822
|
+
imageSettings: p
|
|
823
|
+
} = a, E = pe(a, [
|
|
824
824
|
"value",
|
|
825
825
|
"size",
|
|
826
826
|
"level",
|
|
@@ -831,51 +831,51 @@ var At = (function() {
|
|
|
831
831
|
"boostLevel",
|
|
832
832
|
"marginSize",
|
|
833
833
|
"imageSettings"
|
|
834
|
-
]), { style: g } = E, v =
|
|
835
|
-
(
|
|
836
|
-
C.current =
|
|
834
|
+
]), { style: g } = E, v = pe(E, ["style"]), N = p?.src, C = x.useRef(null), R = x.useRef(null), S = x.useCallback(
|
|
835
|
+
(_) => {
|
|
836
|
+
C.current = _, typeof s == "function" ? s(_) : s && (s.current = _);
|
|
837
837
|
},
|
|
838
|
-
[
|
|
839
|
-
), [D,
|
|
840
|
-
value:
|
|
841
|
-
level:
|
|
838
|
+
[s]
|
|
839
|
+
), [D, b] = x.useState(!1), { margin: T, cells: $, numCells: H, calculatedImageSettings: P } = ke({
|
|
840
|
+
value: d,
|
|
841
|
+
level: m,
|
|
842
842
|
minVersion: t,
|
|
843
843
|
boostLevel: i,
|
|
844
|
-
includeMargin:
|
|
845
|
-
marginSize:
|
|
846
|
-
imageSettings:
|
|
847
|
-
size:
|
|
844
|
+
includeMargin: o,
|
|
845
|
+
marginSize: l,
|
|
846
|
+
imageSettings: p,
|
|
847
|
+
size: c
|
|
848
848
|
});
|
|
849
849
|
x.useEffect(() => {
|
|
850
850
|
if (C.current != null) {
|
|
851
|
-
const
|
|
851
|
+
const _ = C.current, M = _.getContext("2d");
|
|
852
852
|
if (!M)
|
|
853
853
|
return;
|
|
854
|
-
let
|
|
855
|
-
const
|
|
856
|
-
W && P.excavation != null && (
|
|
857
|
-
|
|
854
|
+
let A = $;
|
|
855
|
+
const k = R.current, W = P != null && k !== null && k.complete && k.naturalHeight !== 0 && k.naturalWidth !== 0;
|
|
856
|
+
W && P.excavation != null && (A = Le(
|
|
857
|
+
$,
|
|
858
858
|
P.excavation
|
|
859
859
|
));
|
|
860
860
|
const ne = window.devicePixelRatio || 1;
|
|
861
|
-
|
|
862
|
-
const oe =
|
|
863
|
-
M.scale(oe, oe), M.fillStyle =
|
|
861
|
+
_.height = _.width = c * ne;
|
|
862
|
+
const oe = c / H * ne;
|
|
863
|
+
M.scale(oe, oe), M.fillStyle = f, M.fillRect(0, 0, H, H), M.fillStyle = e, bt ? M.fill(new Path2D(Oe(A, T))) : $.forEach(function(V, G) {
|
|
864
864
|
V.forEach(function(ce, de) {
|
|
865
|
-
ce && M.fillRect(de +
|
|
865
|
+
ce && M.fillRect(de + T, G + T, 1, 1);
|
|
866
866
|
});
|
|
867
867
|
}), P && (M.globalAlpha = P.opacity), W && M.drawImage(
|
|
868
|
-
|
|
869
|
-
P.x +
|
|
870
|
-
P.y +
|
|
868
|
+
k,
|
|
869
|
+
P.x + T,
|
|
870
|
+
P.y + T,
|
|
871
871
|
P.w,
|
|
872
872
|
P.h
|
|
873
873
|
);
|
|
874
874
|
}
|
|
875
875
|
}), x.useEffect(() => {
|
|
876
|
-
|
|
876
|
+
b(!1);
|
|
877
877
|
}, [N]);
|
|
878
|
-
const Y = he({ height:
|
|
878
|
+
const Y = he({ height: c, width: c }, g);
|
|
879
879
|
let j = null;
|
|
880
880
|
return N != null && (j = /* @__PURE__ */ x.createElement(
|
|
881
881
|
"img",
|
|
@@ -884,7 +884,7 @@ var At = (function() {
|
|
|
884
884
|
key: N,
|
|
885
885
|
style: { display: "none" },
|
|
886
886
|
onLoad: () => {
|
|
887
|
-
|
|
887
|
+
b(!0);
|
|
888
888
|
},
|
|
889
889
|
ref: R,
|
|
890
890
|
crossOrigin: P?.crossOrigin
|
|
@@ -893,8 +893,8 @@ var At = (function() {
|
|
|
893
893
|
"canvas",
|
|
894
894
|
he({
|
|
895
895
|
style: Y,
|
|
896
|
-
height:
|
|
897
|
-
width:
|
|
896
|
+
height: c,
|
|
897
|
+
width: c,
|
|
898
898
|
ref: S,
|
|
899
899
|
role: "img"
|
|
900
900
|
}, v)
|
|
@@ -902,21 +902,21 @@ var At = (function() {
|
|
|
902
902
|
}
|
|
903
903
|
);
|
|
904
904
|
It.displayName = "QRCodeCanvas";
|
|
905
|
-
var
|
|
906
|
-
function(
|
|
907
|
-
const
|
|
908
|
-
value:
|
|
909
|
-
size:
|
|
910
|
-
level:
|
|
911
|
-
bgColor:
|
|
905
|
+
var Be = x.forwardRef(
|
|
906
|
+
function(r, s) {
|
|
907
|
+
const a = r, {
|
|
908
|
+
value: d,
|
|
909
|
+
size: c = Ae,
|
|
910
|
+
level: m = Se,
|
|
911
|
+
bgColor: f = xe,
|
|
912
912
|
fgColor: e = Pe,
|
|
913
|
-
includeMargin:
|
|
914
|
-
minVersion: t =
|
|
913
|
+
includeMargin: o = De,
|
|
914
|
+
minVersion: t = Te,
|
|
915
915
|
boostLevel: i,
|
|
916
|
-
title:
|
|
917
|
-
marginSize:
|
|
916
|
+
title: l,
|
|
917
|
+
marginSize: p,
|
|
918
918
|
imageSettings: u
|
|
919
|
-
} =
|
|
919
|
+
} = a, E = pe(a, [
|
|
920
920
|
"value",
|
|
921
921
|
"size",
|
|
922
922
|
"level",
|
|
@@ -928,15 +928,15 @@ var ke = x.forwardRef(
|
|
|
928
928
|
"title",
|
|
929
929
|
"marginSize",
|
|
930
930
|
"imageSettings"
|
|
931
|
-
]), { margin: g, cells: v, numCells: N, calculatedImageSettings: C } =
|
|
932
|
-
value:
|
|
933
|
-
level:
|
|
931
|
+
]), { margin: g, cells: v, numCells: N, calculatedImageSettings: C } = ke({
|
|
932
|
+
value: d,
|
|
933
|
+
level: m,
|
|
934
934
|
minVersion: t,
|
|
935
935
|
boostLevel: i,
|
|
936
|
-
includeMargin:
|
|
937
|
-
marginSize:
|
|
936
|
+
includeMargin: o,
|
|
937
|
+
marginSize: p,
|
|
938
938
|
imageSettings: u,
|
|
939
|
-
size:
|
|
939
|
+
size: c
|
|
940
940
|
});
|
|
941
941
|
let R = v, S = null;
|
|
942
942
|
u != null && C != null && (C.excavation != null && (R = Le(
|
|
@@ -955,21 +955,21 @@ var ke = x.forwardRef(
|
|
|
955
955
|
crossOrigin: C.crossOrigin
|
|
956
956
|
}
|
|
957
957
|
));
|
|
958
|
-
const D =
|
|
958
|
+
const D = Oe(R, g);
|
|
959
959
|
return /* @__PURE__ */ x.createElement(
|
|
960
960
|
"svg",
|
|
961
961
|
he({
|
|
962
|
-
height:
|
|
963
|
-
width:
|
|
962
|
+
height: c,
|
|
963
|
+
width: c,
|
|
964
964
|
viewBox: `0 0 ${N} ${N}`,
|
|
965
|
-
ref:
|
|
965
|
+
ref: s,
|
|
966
966
|
role: "img"
|
|
967
967
|
}, E),
|
|
968
|
-
!!
|
|
968
|
+
!!l && /* @__PURE__ */ x.createElement("title", null, l),
|
|
969
969
|
/* @__PURE__ */ x.createElement(
|
|
970
970
|
"path",
|
|
971
971
|
{
|
|
972
|
-
fill:
|
|
972
|
+
fill: f,
|
|
973
973
|
d: `M0,0 h${N}v${N}H0z`,
|
|
974
974
|
shapeRendering: "crispEdges"
|
|
975
975
|
}
|
|
@@ -979,40 +979,40 @@ var ke = x.forwardRef(
|
|
|
979
979
|
);
|
|
980
980
|
}
|
|
981
981
|
);
|
|
982
|
-
|
|
983
|
-
const
|
|
982
|
+
Be.displayName = "QRCodeSVG";
|
|
983
|
+
const At = (n, r) => ({
|
|
984
984
|
invitationType: tt.LINK,
|
|
985
985
|
resources: [
|
|
986
986
|
{
|
|
987
|
-
url: `conversations/${encodeURI(
|
|
987
|
+
url: `conversations/${encodeURI(n)}`
|
|
988
988
|
},
|
|
989
|
-
...
|
|
989
|
+
...r
|
|
990
990
|
]
|
|
991
|
-
}), St = (
|
|
992
|
-
const
|
|
993
|
-
return `/${ve}/${
|
|
994
|
-
}, xt = (
|
|
995
|
-
const
|
|
996
|
-
return
|
|
997
|
-
}), Pt = (
|
|
998
|
-
(
|
|
999
|
-
)?.flatMap((
|
|
1000
|
-
url:
|
|
1001
|
-
})) || [])?.filter((
|
|
1002
|
-
conversation:
|
|
1003
|
-
locale:
|
|
1004
|
-
onCloseModal:
|
|
1005
|
-
modalDividers:
|
|
1006
|
-
getConversation:
|
|
1007
|
-
generateConversationLink:
|
|
1008
|
-
chatExpiration:
|
|
1009
|
-
chatExpirationDays:
|
|
991
|
+
}), St = (n) => {
|
|
992
|
+
const r = n?.invitationLink?.split("/").at(-1) || "";
|
|
993
|
+
return `/${ve}/${r}`;
|
|
994
|
+
}, xt = (n, r) => r?.find((s) => {
|
|
995
|
+
const a = n?.id?.split("/")?.pop(), d = s?.url?.split("/")?.pop() || "";
|
|
996
|
+
return d === a || decodeURI(d) === a;
|
|
997
|
+
}), Pt = (n) => n?.messages?.filter(
|
|
998
|
+
(s) => !!s?.custom_content?.attachments
|
|
999
|
+
)?.flatMap((s) => s?.custom_content?.attachments?.map((a) => ({
|
|
1000
|
+
url: a?.url || ""
|
|
1001
|
+
})) || [])?.filter((s) => !!s?.url) || [], Dt = ({
|
|
1002
|
+
conversation: n,
|
|
1003
|
+
locale: r,
|
|
1004
|
+
onCloseModal: s,
|
|
1005
|
+
modalDividers: a,
|
|
1006
|
+
getConversation: d,
|
|
1007
|
+
generateConversationLink: c,
|
|
1008
|
+
chatExpiration: m,
|
|
1009
|
+
chatExpirationDays: f,
|
|
1010
1010
|
close: e,
|
|
1011
|
-
chatWarning:
|
|
1011
|
+
chatWarning: o,
|
|
1012
1012
|
shareLink: t,
|
|
1013
1013
|
shareCopyLink: i,
|
|
1014
|
-
shareCopiedLink:
|
|
1015
|
-
shareDescription:
|
|
1014
|
+
shareCopiedLink: l,
|
|
1015
|
+
shareDescription: p,
|
|
1016
1016
|
shareRemoveAccessToUsers: u,
|
|
1017
1017
|
chatName: E,
|
|
1018
1018
|
getSharedConversations: g,
|
|
@@ -1022,26 +1022,26 @@ const bt = (o, s) => ({
|
|
|
1022
1022
|
clientSharedPage: R,
|
|
1023
1023
|
clientSharedProp: S
|
|
1024
1024
|
}) => {
|
|
1025
|
-
const [D,
|
|
1025
|
+
const [D, b] = O(null), [T, $] = O(), [H, P] = O(!1), [Y, j] = O(!1), [_, M] = O(), A = J(() => {
|
|
1026
1026
|
const V = N || window.location.origin;
|
|
1027
1027
|
if (N && N !== window.location.origin && R && S) {
|
|
1028
1028
|
const G = D?.split(`/${ve}/`)?.[1];
|
|
1029
1029
|
return `${V}/${R}?${S}=${G}`;
|
|
1030
1030
|
}
|
|
1031
|
-
return `${V}/${
|
|
1032
|
-
}, [N, D,
|
|
1031
|
+
return `${V}/${r}${D}`;
|
|
1032
|
+
}, [N, D, r, R, S]);
|
|
1033
1033
|
ee(() => {
|
|
1034
1034
|
(async () => {
|
|
1035
1035
|
try {
|
|
1036
|
-
const G = decodeURI(
|
|
1036
|
+
const G = decodeURI(n ? n?.id : `${C?.[0]}/${r}/${C?.[1]}`), ce = `${decodeURI(G)}`, de = await d?.(ce), Ue = At(
|
|
1037
1037
|
G,
|
|
1038
1038
|
Pt(de)
|
|
1039
|
-
),
|
|
1039
|
+
), fe = await c?.(Ue), ge = await g?.(
|
|
1040
1040
|
re(se.OTHERS)
|
|
1041
1041
|
);
|
|
1042
|
-
|
|
1042
|
+
fe && ge && (P(!0), b(St(fe)), $(
|
|
1043
1043
|
xt(
|
|
1044
|
-
|
|
1044
|
+
n,
|
|
1045
1045
|
ge?.resources
|
|
1046
1046
|
)
|
|
1047
1047
|
));
|
|
@@ -1050,154 +1050,154 @@ const bt = (o, s) => ({
|
|
|
1050
1050
|
}
|
|
1051
1051
|
})();
|
|
1052
1052
|
}, [
|
|
1053
|
-
|
|
1054
|
-
d,
|
|
1053
|
+
n,
|
|
1055
1054
|
c,
|
|
1055
|
+
d,
|
|
1056
1056
|
g,
|
|
1057
1057
|
C,
|
|
1058
|
-
|
|
1058
|
+
r
|
|
1059
1059
|
]);
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1062
|
-
}, [
|
|
1063
|
-
j(!0), navigator.clipboard.writeText(
|
|
1064
|
-
}, [
|
|
1060
|
+
const k = L(() => {
|
|
1061
|
+
s(), b(null), P(!1), j(!1);
|
|
1062
|
+
}, [s]), W = L(() => {
|
|
1063
|
+
j(!0), navigator.clipboard.writeText(A || "");
|
|
1064
|
+
}, [A]), ne = async () => {
|
|
1065
1065
|
try {
|
|
1066
|
-
M(!0),
|
|
1066
|
+
M(!0), T && await v?.({ resources: [T] });
|
|
1067
1067
|
} catch (V) {
|
|
1068
1068
|
M(!1), console.error("Error revoking shared conversation", V);
|
|
1069
1069
|
}
|
|
1070
|
-
}, oe =
|
|
1070
|
+
}, oe = L(() => /* @__PURE__ */ h(
|
|
1071
1071
|
Q,
|
|
1072
1072
|
{
|
|
1073
1073
|
buttonClassName: Y ? "text-button-secondary" : "text-button-primary",
|
|
1074
|
-
iconBefore: Y ? /* @__PURE__ */
|
|
1075
|
-
title: Y ?
|
|
1074
|
+
iconBefore: Y ? /* @__PURE__ */ h(je, { width: 20, height: 20 }) : /* @__PURE__ */ h(We, { width: 20, height: 20 }),
|
|
1075
|
+
title: Y ? l ?? "Copied" : i ?? "Copy link",
|
|
1076
1076
|
disabled: Y,
|
|
1077
1077
|
onClick: W
|
|
1078
1078
|
}
|
|
1079
|
-
), [Y, W,
|
|
1079
|
+
), [Y, W, l, i]);
|
|
1080
1080
|
return /* @__PURE__ */ y(
|
|
1081
1081
|
ae,
|
|
1082
1082
|
{
|
|
1083
1083
|
heading: t ?? "Share link",
|
|
1084
1084
|
portalId: "share",
|
|
1085
1085
|
size: le.SM,
|
|
1086
|
-
dividers:
|
|
1087
|
-
onClose:
|
|
1086
|
+
dividers: a,
|
|
1087
|
+
onClose: k,
|
|
1088
1088
|
closeButtonTitle: e ?? "Close",
|
|
1089
1089
|
children: [
|
|
1090
1090
|
H ? /* @__PURE__ */ y("div", { className: "share flex flex-col gap-y-4 px-6 pb-6 overflow-auto sm:p-0", children: [
|
|
1091
|
-
|
|
1092
|
-
/* @__PURE__ */
|
|
1093
|
-
/* @__PURE__ */
|
|
1091
|
+
n?.name ? /* @__PURE__ */ y("div", { className: "flex share-info w-full", children: [
|
|
1092
|
+
/* @__PURE__ */ h("p", { className: "share-info-title text-neutrals-800 mr-1 body-1", children: E ?? "Chat name:" }),
|
|
1093
|
+
/* @__PURE__ */ h(
|
|
1094
1094
|
"h3",
|
|
1095
1095
|
{
|
|
1096
1096
|
className: "flex-1 min-w-0 truncate",
|
|
1097
|
-
title:
|
|
1098
|
-
children:
|
|
1097
|
+
title: n?.name,
|
|
1098
|
+
children: n?.name
|
|
1099
1099
|
}
|
|
1100
1100
|
)
|
|
1101
1101
|
] }) : null,
|
|
1102
1102
|
/* @__PURE__ */ y("div", { className: "flex share-info", children: [
|
|
1103
|
-
/* @__PURE__ */
|
|
1103
|
+
/* @__PURE__ */ h("p", { className: "share-info-title text-neutrals-800 mr-1 body-1", children: m ?? "Link expiration date:" }),
|
|
1104
1104
|
/* @__PURE__ */ y("h3", { children: [
|
|
1105
1105
|
"3 ",
|
|
1106
|
-
|
|
1106
|
+
f ?? "days"
|
|
1107
1107
|
] })
|
|
1108
1108
|
] }),
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
|
|
1109
|
+
/* @__PURE__ */ h(
|
|
1110
|
+
Be,
|
|
1111
1111
|
{
|
|
1112
1112
|
className: "self-center border border-neutrals-600 p-2 rounded min-h-[200px]",
|
|
1113
|
-
value:
|
|
1113
|
+
value: A,
|
|
1114
1114
|
size: 200
|
|
1115
1115
|
}
|
|
1116
1116
|
),
|
|
1117
|
-
/* @__PURE__ */
|
|
1118
|
-
/* @__PURE__ */
|
|
1117
|
+
/* @__PURE__ */ h("p", { className: "body-2 text-neutrals-1000", children: p ?? "Your name, special instructions, and any messages you add after sharing remain confidential." }),
|
|
1118
|
+
/* @__PURE__ */ h(
|
|
1119
1119
|
Ne,
|
|
1120
1120
|
{
|
|
1121
1121
|
containerClasses: "share-input-container",
|
|
1122
1122
|
cssClass: "share-input",
|
|
1123
1123
|
readonly: !0,
|
|
1124
|
-
placeholder:
|
|
1125
|
-
value:
|
|
1124
|
+
placeholder: A,
|
|
1125
|
+
value: A,
|
|
1126
1126
|
inputId: "conversationLink",
|
|
1127
1127
|
iconAfterInput: oe()
|
|
1128
1128
|
}
|
|
1129
1129
|
)
|
|
1130
|
-
] }) : /* @__PURE__ */
|
|
1131
|
-
H ?
|
|
1130
|
+
] }) : /* @__PURE__ */ h("div", { className: "flex justify-center items-center py-6 px-6", children: /* @__PURE__ */ h(we, {}) }),
|
|
1131
|
+
H ? n && T ? /* @__PURE__ */ h("div", { className: "remove-access", children: /* @__PURE__ */ h(
|
|
1132
1132
|
Q,
|
|
1133
1133
|
{
|
|
1134
1134
|
title: u ?? "Remove access to all users",
|
|
1135
1135
|
buttonClassName: "remove-access-button py-3 px-4",
|
|
1136
1136
|
isSmallButton: !0,
|
|
1137
|
-
disabled:
|
|
1137
|
+
disabled: _,
|
|
1138
1138
|
onClick: ne
|
|
1139
1139
|
}
|
|
1140
|
-
) }) : /* @__PURE__ */
|
|
1140
|
+
) }) : /* @__PURE__ */ h("p", { className: "body-2 text-neutrals-800 share-footer", children: o ?? "This chat has not been shared with anyone yet." }) : /* @__PURE__ */ h("div", {})
|
|
1141
1141
|
]
|
|
1142
1142
|
}
|
|
1143
1143
|
);
|
|
1144
|
-
},
|
|
1145
|
-
conversation:
|
|
1146
|
-
onCloseModal:
|
|
1147
|
-
renameConversation:
|
|
1148
|
-
locale:
|
|
1149
|
-
disableModalDividers:
|
|
1150
|
-
titles:
|
|
1151
|
-
isSmallButton:
|
|
1144
|
+
}, Tt = ({
|
|
1145
|
+
conversation: n,
|
|
1146
|
+
onCloseModal: r,
|
|
1147
|
+
renameConversation: s,
|
|
1148
|
+
locale: a,
|
|
1149
|
+
disableModalDividers: d,
|
|
1150
|
+
titles: c,
|
|
1151
|
+
isSmallButton: m
|
|
1152
1152
|
}) => {
|
|
1153
|
-
const [
|
|
1153
|
+
const [f, e] = O(n?.name || ""), o = (i) => {
|
|
1154
1154
|
e(i);
|
|
1155
1155
|
}, t = () => {
|
|
1156
|
-
const i = `${
|
|
1157
|
-
|
|
1158
|
-
`conversations/${
|
|
1156
|
+
const i = `${n?.folderId}/${encodeURIComponent(me(f))}-${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
1157
|
+
s(
|
|
1158
|
+
`conversations/${n.id}`,
|
|
1159
1159
|
`conversations/${i}`
|
|
1160
1160
|
);
|
|
1161
1161
|
};
|
|
1162
1162
|
return /* @__PURE__ */ y(
|
|
1163
1163
|
ae,
|
|
1164
1164
|
{
|
|
1165
|
-
heading:
|
|
1165
|
+
heading: c?.renameTitle ?? "Rename conversation",
|
|
1166
1166
|
portalId: "rename-conversation",
|
|
1167
1167
|
containerClassName: "rename-conversation-popup",
|
|
1168
1168
|
size: le.SM,
|
|
1169
|
-
dividers: !
|
|
1170
|
-
onClose:
|
|
1171
|
-
closeButtonTitle:
|
|
1169
|
+
dividers: !d,
|
|
1170
|
+
onClose: r,
|
|
1171
|
+
closeButtonTitle: c?.close ?? "Cancel",
|
|
1172
1172
|
children: [
|
|
1173
|
-
/* @__PURE__ */
|
|
1173
|
+
/* @__PURE__ */ h("div", { className: "py-4 px-6 sm:px-0", lang: a, children: /* @__PURE__ */ h(
|
|
1174
1174
|
Ye,
|
|
1175
1175
|
{
|
|
1176
1176
|
inputId: "rename",
|
|
1177
|
-
value:
|
|
1178
|
-
onChange:
|
|
1177
|
+
value: f,
|
|
1178
|
+
onChange: o,
|
|
1179
1179
|
cssClass: "w-full"
|
|
1180
1180
|
}
|
|
1181
1181
|
) }),
|
|
1182
1182
|
/* @__PURE__ */ y("div", { className: "flex justify-end gap-x-2 py-3 px-6 delete-conversation-popup-footer", children: [
|
|
1183
|
-
/* @__PURE__ */
|
|
1183
|
+
/* @__PURE__ */ h(
|
|
1184
1184
|
Q,
|
|
1185
1185
|
{
|
|
1186
1186
|
buttonClassName: "cancel-button",
|
|
1187
|
-
title:
|
|
1188
|
-
isSmallButton:
|
|
1187
|
+
title: c?.cancel ?? "Cancel",
|
|
1188
|
+
isSmallButton: m,
|
|
1189
1189
|
onClick: (i) => {
|
|
1190
|
-
i.stopPropagation(),
|
|
1190
|
+
i.stopPropagation(), r();
|
|
1191
1191
|
}
|
|
1192
1192
|
}
|
|
1193
1193
|
),
|
|
1194
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ h(
|
|
1195
1195
|
Q,
|
|
1196
1196
|
{
|
|
1197
1197
|
buttonClassName: "text-button-primary text-button-primary",
|
|
1198
|
-
title:
|
|
1199
|
-
isSmallButton:
|
|
1200
|
-
disabled: !
|
|
1198
|
+
title: c?.save ?? "Rename",
|
|
1199
|
+
isSmallButton: m,
|
|
1200
|
+
disabled: !f,
|
|
1201
1201
|
onClick: (i) => {
|
|
1202
1202
|
i.stopPropagation(), t();
|
|
1203
1203
|
}
|
|
@@ -1207,127 +1207,127 @@ const bt = (o, s) => ({
|
|
|
1207
1207
|
]
|
|
1208
1208
|
}
|
|
1209
1209
|
);
|
|
1210
|
-
},
|
|
1211
|
-
conversation:
|
|
1212
|
-
conversationStyles:
|
|
1213
|
-
shareConversationProps:
|
|
1214
|
-
onConversationDelete:
|
|
1215
|
-
getConversation:
|
|
1216
|
-
getFileBlob:
|
|
1217
|
-
renameConversation:
|
|
1218
|
-
triggerButton:
|
|
1210
|
+
}, Ot = ({
|
|
1211
|
+
conversation: n,
|
|
1212
|
+
conversationStyles: r,
|
|
1213
|
+
shareConversationProps: s,
|
|
1214
|
+
onConversationDelete: a,
|
|
1215
|
+
getConversation: d,
|
|
1216
|
+
getFileBlob: c,
|
|
1217
|
+
renameConversation: m,
|
|
1218
|
+
triggerButton: f,
|
|
1219
1219
|
locale: e,
|
|
1220
|
-
isDisabled:
|
|
1220
|
+
isDisabled: o
|
|
1221
1221
|
}) => {
|
|
1222
1222
|
const t = J(() => {
|
|
1223
|
-
const
|
|
1223
|
+
const b = [
|
|
1224
1224
|
{
|
|
1225
1225
|
key: U.DELETE,
|
|
1226
|
-
title:
|
|
1227
|
-
icon:
|
|
1226
|
+
title: r?.titles?.delete ?? "Delete",
|
|
1227
|
+
icon: r.actionsIcons?.[U.DELETE]
|
|
1228
1228
|
}
|
|
1229
1229
|
];
|
|
1230
|
-
return
|
|
1231
|
-
...
|
|
1230
|
+
return n?.model?.id?.endsWith(et) ? b : [
|
|
1231
|
+
...n.isShared ? [] : [
|
|
1232
1232
|
{
|
|
1233
1233
|
key: U.SHARE,
|
|
1234
|
-
title:
|
|
1235
|
-
icon:
|
|
1234
|
+
title: r?.titles?.share ?? "Share",
|
|
1235
|
+
icon: r.actionsIcons?.[U.SHARE]
|
|
1236
1236
|
},
|
|
1237
1237
|
{
|
|
1238
1238
|
key: U.RENAME,
|
|
1239
|
-
title:
|
|
1240
|
-
icon:
|
|
1239
|
+
title: r?.titles?.rename ?? "Rename",
|
|
1240
|
+
icon: r.actionsIcons?.[U.RENAME]
|
|
1241
1241
|
}
|
|
1242
1242
|
],
|
|
1243
1243
|
{
|
|
1244
1244
|
key: U.EXPORT,
|
|
1245
|
-
title:
|
|
1246
|
-
icon:
|
|
1245
|
+
title: r?.titles?.export ?? "Export",
|
|
1246
|
+
icon: r.actionsIcons?.[U.EXPORT]
|
|
1247
1247
|
},
|
|
1248
|
-
...
|
|
1248
|
+
...b
|
|
1249
1249
|
];
|
|
1250
1250
|
}, [
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
]), [i,
|
|
1256
|
-
|
|
1257
|
-
}, [
|
|
1251
|
+
n.isShared,
|
|
1252
|
+
n?.model?.id,
|
|
1253
|
+
r.titles,
|
|
1254
|
+
r.actionsIcons
|
|
1255
|
+
]), [i, l] = O(z.Closed), [p, u] = O(z.Closed), [E, g] = O(z.Closed), v = L(() => {
|
|
1256
|
+
l(z.Closed);
|
|
1257
|
+
}, [l]), N = L(() => {
|
|
1258
1258
|
u(z.Closed);
|
|
1259
|
-
}, [u]), C =
|
|
1259
|
+
}, [u]), C = L(() => {
|
|
1260
1260
|
g(z.Closed);
|
|
1261
|
-
}, [g]), R =
|
|
1262
|
-
|
|
1263
|
-
}, [
|
|
1264
|
-
(
|
|
1265
|
-
|
|
1261
|
+
}, [g]), R = L(() => {
|
|
1262
|
+
a(n), v();
|
|
1263
|
+
}, [n, a, v]), S = L(
|
|
1264
|
+
(b, T) => {
|
|
1265
|
+
m(b, T), C();
|
|
1266
1266
|
},
|
|
1267
|
-
[
|
|
1267
|
+
[m, C]
|
|
1268
1268
|
);
|
|
1269
1269
|
return /* @__PURE__ */ y(q, { children: [
|
|
1270
|
-
/* @__PURE__ */
|
|
1270
|
+
/* @__PURE__ */ h(
|
|
1271
1271
|
Re,
|
|
1272
1272
|
{
|
|
1273
1273
|
containerClassName: "ml-3 group-hover:visible invisible",
|
|
1274
|
-
triggerButton:
|
|
1274
|
+
triggerButton: f ?? /* @__PURE__ */ h(Lt, { disabled: o }),
|
|
1275
1275
|
options: t,
|
|
1276
1276
|
openedClassName: "action-menu-opened",
|
|
1277
|
-
onOptionSelect: (
|
|
1278
|
-
|
|
1279
|
-
|
|
1277
|
+
onOptionSelect: (b) => {
|
|
1278
|
+
b === U.DELETE && l(z.Opened), b === U.SHARE && u(z.Opened), b === U.RENAME && g(z.Opened), b === U.EXPORT && d(decodeURI(n.id)).then((T) => {
|
|
1279
|
+
mt(T, c).then(($) => {
|
|
1280
1280
|
Ct(
|
|
1281
|
-
`data:application/zip;base64,${
|
|
1281
|
+
`data:application/zip;base64,${$}`,
|
|
1282
1282
|
`chat_with_attachments_${(/* @__PURE__ */ new Date()).toLocaleDateString()}.dial`
|
|
1283
1283
|
);
|
|
1284
1284
|
});
|
|
1285
1285
|
});
|
|
1286
1286
|
},
|
|
1287
|
-
disabled:
|
|
1287
|
+
disabled: o
|
|
1288
1288
|
}
|
|
1289
1289
|
),
|
|
1290
|
-
i === z.Opened && /* @__PURE__ */
|
|
1290
|
+
i === z.Opened && /* @__PURE__ */ h(
|
|
1291
1291
|
lt,
|
|
1292
1292
|
{
|
|
1293
|
-
titles:
|
|
1293
|
+
titles: r.titles,
|
|
1294
1294
|
locale: e,
|
|
1295
|
-
disableModalDividers:
|
|
1296
|
-
isSmallButton:
|
|
1295
|
+
disableModalDividers: r.disableModalDividers,
|
|
1296
|
+
isSmallButton: r.isSmallModalButton,
|
|
1297
1297
|
deleteConversation: R,
|
|
1298
1298
|
onCloseModal: v
|
|
1299
1299
|
}
|
|
1300
1300
|
),
|
|
1301
|
-
|
|
1301
|
+
p === z.Opened && /* @__PURE__ */ h(
|
|
1302
1302
|
Dt,
|
|
1303
1303
|
{
|
|
1304
|
-
conversation:
|
|
1304
|
+
conversation: n,
|
|
1305
1305
|
locale: e,
|
|
1306
1306
|
onCloseModal: N,
|
|
1307
|
-
...
|
|
1307
|
+
...s
|
|
1308
1308
|
}
|
|
1309
1309
|
),
|
|
1310
|
-
E === z.Opened && /* @__PURE__ */
|
|
1311
|
-
|
|
1310
|
+
E === z.Opened && /* @__PURE__ */ h(
|
|
1311
|
+
Tt,
|
|
1312
1312
|
{
|
|
1313
|
-
conversation:
|
|
1313
|
+
conversation: n,
|
|
1314
1314
|
locale: e,
|
|
1315
|
-
titles:
|
|
1315
|
+
titles: r.titles,
|
|
1316
1316
|
renameConversation: S,
|
|
1317
1317
|
onCloseModal: C,
|
|
1318
|
-
disableModalDividers:
|
|
1319
|
-
isSmallButton:
|
|
1318
|
+
disableModalDividers: r.disableModalDividers,
|
|
1319
|
+
isSmallButton: r.isSmallModalButton
|
|
1320
1320
|
}
|
|
1321
1321
|
)
|
|
1322
1322
|
] });
|
|
1323
|
-
}, Lt = ({ disabled:
|
|
1323
|
+
}, Lt = ({ disabled: n }) => /* @__PURE__ */ h(
|
|
1324
1324
|
"div",
|
|
1325
1325
|
{
|
|
1326
|
-
className:
|
|
1326
|
+
className: B(
|
|
1327
1327
|
"flex items-center justify-center w-[24px]",
|
|
1328
|
-
|
|
1328
|
+
n ? "cursor-not-allowed" : "cursor-pointer"
|
|
1329
1329
|
),
|
|
1330
|
-
children: /* @__PURE__ */
|
|
1330
|
+
children: /* @__PURE__ */ h(
|
|
1331
1331
|
Ve,
|
|
1332
1332
|
{
|
|
1333
1333
|
width: 20,
|
|
@@ -1338,92 +1338,92 @@ const bt = (o, s) => ({
|
|
|
1338
1338
|
)
|
|
1339
1339
|
}
|
|
1340
1340
|
), Fe = ({
|
|
1341
|
-
conversation:
|
|
1342
|
-
selectedConversationId:
|
|
1343
|
-
searchQuery:
|
|
1344
|
-
onConversationClick:
|
|
1345
|
-
actions:
|
|
1346
|
-
locale:
|
|
1347
|
-
isDisabled:
|
|
1348
|
-
conversationStyles:
|
|
1341
|
+
conversation: n,
|
|
1342
|
+
selectedConversationId: r,
|
|
1343
|
+
searchQuery: s,
|
|
1344
|
+
onConversationClick: a,
|
|
1345
|
+
actions: d,
|
|
1346
|
+
locale: c,
|
|
1347
|
+
isDisabled: m,
|
|
1348
|
+
conversationStyles: f,
|
|
1349
1349
|
shareConversationProps: e
|
|
1350
1350
|
}) => {
|
|
1351
|
-
const
|
|
1351
|
+
const o = ze(null), t = me(n?.name);
|
|
1352
1352
|
return ee(() => {
|
|
1353
|
-
if (
|
|
1354
|
-
const i =
|
|
1353
|
+
if (n?.id === r && o?.current) {
|
|
1354
|
+
const i = o.current.parentElement?.parentElement?.parentElement;
|
|
1355
1355
|
if (i) {
|
|
1356
|
-
const
|
|
1356
|
+
const l = o.current.getBoundingClientRect(), p = i.getBoundingClientRect(), u = l.height, E = p.height, v = l.top - p.top + i.scrollTop - (E / 2 - u / 2);
|
|
1357
1357
|
i.scrollTo({
|
|
1358
1358
|
top: v,
|
|
1359
1359
|
behavior: "smooth"
|
|
1360
1360
|
});
|
|
1361
1361
|
}
|
|
1362
1362
|
}
|
|
1363
|
-
}, [
|
|
1363
|
+
}, [n, r]), /* @__PURE__ */ y(
|
|
1364
1364
|
"div",
|
|
1365
1365
|
{
|
|
1366
|
-
ref:
|
|
1367
|
-
className:
|
|
1366
|
+
ref: o,
|
|
1367
|
+
className: B(
|
|
1368
1368
|
"flex justify-between items-center py-2 px-3 border-transparent relative group border",
|
|
1369
1369
|
"conversation-item",
|
|
1370
|
-
|
|
1371
|
-
|
|
1370
|
+
r === n?.id && "bg-hues-100 conversation-item-active",
|
|
1371
|
+
m ? "cursor-not-allowed" : "cursor-pointer hover:border-hues-600"
|
|
1372
1372
|
),
|
|
1373
|
-
onClick: () => !
|
|
1374
|
-
title:
|
|
1373
|
+
onClick: () => !m && a(n.folderId, n?.id),
|
|
1374
|
+
title: m ? f?.titles?.noActionsAllowed : t,
|
|
1375
1375
|
children: [
|
|
1376
1376
|
/* @__PURE__ */ y("div", { className: "flex flex-1 min-w-0 items-center", children: [
|
|
1377
|
-
|
|
1378
|
-
/* @__PURE__ */
|
|
1377
|
+
f.conversationItemIcon ? f.conversationItemIcon : null,
|
|
1378
|
+
/* @__PURE__ */ h(
|
|
1379
1379
|
"h3",
|
|
1380
1380
|
{
|
|
1381
|
-
className:
|
|
1381
|
+
className: B(
|
|
1382
1382
|
"truncate font-semibold text-neutrals-1000 sm:body-2",
|
|
1383
1383
|
"conversation-item-text",
|
|
1384
|
-
|
|
1384
|
+
r === n?.id ? "conversation-item-text-active" : ""
|
|
1385
1385
|
),
|
|
1386
|
-
title:
|
|
1387
|
-
children:
|
|
1386
|
+
title: m ? f?.titles?.noActionsAllowed : t,
|
|
1387
|
+
children: s?.length ? /* @__PURE__ */ h(
|
|
1388
1388
|
Qe,
|
|
1389
1389
|
{
|
|
1390
1390
|
text: t,
|
|
1391
|
-
highlightText:
|
|
1391
|
+
highlightText: s
|
|
1392
1392
|
}
|
|
1393
1393
|
) : t
|
|
1394
1394
|
}
|
|
1395
1395
|
)
|
|
1396
1396
|
] }),
|
|
1397
|
-
/* @__PURE__ */
|
|
1398
|
-
|
|
1397
|
+
/* @__PURE__ */ h(
|
|
1398
|
+
Ot,
|
|
1399
1399
|
{
|
|
1400
|
-
locale:
|
|
1401
|
-
conversationStyles:
|
|
1402
|
-
conversation:
|
|
1403
|
-
onConversationDelete:
|
|
1404
|
-
getConversation:
|
|
1405
|
-
getFileBlob:
|
|
1406
|
-
renameConversation:
|
|
1400
|
+
locale: c,
|
|
1401
|
+
conversationStyles: f,
|
|
1402
|
+
conversation: n,
|
|
1403
|
+
onConversationDelete: d.deleteConversation,
|
|
1404
|
+
getConversation: d.getConversation,
|
|
1405
|
+
getFileBlob: d.getFileBlob,
|
|
1406
|
+
renameConversation: d.renameConversation,
|
|
1407
1407
|
shareConversationProps: e,
|
|
1408
|
-
isDisabled:
|
|
1408
|
+
isDisabled: m
|
|
1409
1409
|
}
|
|
1410
1410
|
)
|
|
1411
1411
|
]
|
|
1412
1412
|
}
|
|
1413
1413
|
);
|
|
1414
|
-
},
|
|
1415
|
-
handleConversationClick:
|
|
1416
|
-
actions:
|
|
1417
|
-
selectedConversationId:
|
|
1418
|
-
groupLabel:
|
|
1419
|
-
conversationStyles:
|
|
1420
|
-
groupedConversations:
|
|
1421
|
-
shareConversationProps:
|
|
1422
|
-
locale:
|
|
1414
|
+
}, kt = ({
|
|
1415
|
+
handleConversationClick: n,
|
|
1416
|
+
actions: r,
|
|
1417
|
+
selectedConversationId: s,
|
|
1418
|
+
groupLabel: a,
|
|
1419
|
+
conversationStyles: d,
|
|
1420
|
+
groupedConversations: c,
|
|
1421
|
+
shareConversationProps: m,
|
|
1422
|
+
locale: f,
|
|
1423
1423
|
isDisabled: e
|
|
1424
1424
|
}) => {
|
|
1425
|
-
const [
|
|
1426
|
-
t((
|
|
1425
|
+
const [o, t] = O(!1), i = L(() => {
|
|
1426
|
+
t((l) => !l);
|
|
1427
1427
|
}, [t]);
|
|
1428
1428
|
return /* @__PURE__ */ y("div", { children: [
|
|
1429
1429
|
/* @__PURE__ */ y(
|
|
@@ -1432,158 +1432,158 @@ const bt = (o, s) => ({
|
|
|
1432
1432
|
className: "inline-flex gap-1 items-center text-neutrals-700 mb-3 cursor-pointer conversation-group-items-title",
|
|
1433
1433
|
onClick: i,
|
|
1434
1434
|
children: [
|
|
1435
|
-
/* @__PURE__ */
|
|
1435
|
+
/* @__PURE__ */ h(
|
|
1436
1436
|
Xe,
|
|
1437
1437
|
{
|
|
1438
|
-
className:
|
|
1438
|
+
className: B(
|
|
1439
1439
|
"w-3 h-3 conversation-group-items-arrow",
|
|
1440
|
-
|
|
1440
|
+
o ? "rotate-[90deg]" : "rotate-0"
|
|
1441
1441
|
)
|
|
1442
1442
|
}
|
|
1443
1443
|
),
|
|
1444
|
-
/* @__PURE__ */
|
|
1444
|
+
/* @__PURE__ */ h("span", { className: "body-3 conversation-group-items-title-text", children: at(a, d?.titles) })
|
|
1445
1445
|
]
|
|
1446
1446
|
}
|
|
1447
1447
|
),
|
|
1448
|
-
!
|
|
1448
|
+
!o && /* @__PURE__ */ h(
|
|
1449
1449
|
"div",
|
|
1450
1450
|
{
|
|
1451
|
-
className:
|
|
1451
|
+
className: B(
|
|
1452
1452
|
"flex flex-col gap-y-3",
|
|
1453
1453
|
"conversation-group-items"
|
|
1454
1454
|
),
|
|
1455
|
-
children: ye(
|
|
1456
|
-
(
|
|
1455
|
+
children: ye(c).map(
|
|
1456
|
+
(l) => /* @__PURE__ */ h(
|
|
1457
1457
|
Fe,
|
|
1458
1458
|
{
|
|
1459
|
-
locale:
|
|
1459
|
+
locale: f,
|
|
1460
1460
|
isDisabled: e,
|
|
1461
|
-
conversationStyles:
|
|
1462
|
-
conversation:
|
|
1463
|
-
selectedConversationId:
|
|
1464
|
-
onConversationClick:
|
|
1465
|
-
actions:
|
|
1466
|
-
shareConversationProps:
|
|
1461
|
+
conversationStyles: d,
|
|
1462
|
+
conversation: l,
|
|
1463
|
+
selectedConversationId: s,
|
|
1464
|
+
onConversationClick: n,
|
|
1465
|
+
actions: r,
|
|
1466
|
+
shareConversationProps: m
|
|
1467
1467
|
},
|
|
1468
|
-
|
|
1468
|
+
l.id || l.name
|
|
1469
1469
|
)
|
|
1470
1470
|
)
|
|
1471
1471
|
}
|
|
1472
1472
|
)
|
|
1473
|
-
] },
|
|
1474
|
-
},
|
|
1475
|
-
searchQuery:
|
|
1476
|
-
isExpandedSearch:
|
|
1477
|
-
titles:
|
|
1478
|
-
searchIcon:
|
|
1479
|
-
onSearchConversations:
|
|
1480
|
-
toggleSearchField:
|
|
1481
|
-
}) => /* @__PURE__ */
|
|
1473
|
+
] }, a);
|
|
1474
|
+
}, Bt = ({
|
|
1475
|
+
searchQuery: n,
|
|
1476
|
+
isExpandedSearch: r,
|
|
1477
|
+
titles: s,
|
|
1478
|
+
searchIcon: a,
|
|
1479
|
+
onSearchConversations: d,
|
|
1480
|
+
toggleSearchField: c
|
|
1481
|
+
}) => /* @__PURE__ */ h(q, { children: r ? /* @__PURE__ */ h(
|
|
1482
1482
|
Ne,
|
|
1483
1483
|
{
|
|
1484
1484
|
inputId: "conversations-search",
|
|
1485
|
-
placeholder:
|
|
1485
|
+
placeholder: s?.searchPlaceholder ?? "Search",
|
|
1486
1486
|
containerClasses: "conversation-list-search-input h-[40px] bg-transparent px-4 py-2 rounded-full border-neutrals-400 shadow-none",
|
|
1487
1487
|
cssClass: "h-auto",
|
|
1488
|
-
value:
|
|
1489
|
-
iconAfterInput: /* @__PURE__ */
|
|
1488
|
+
value: n,
|
|
1489
|
+
iconAfterInput: /* @__PURE__ */ h(
|
|
1490
1490
|
Ge,
|
|
1491
1491
|
{
|
|
1492
1492
|
buttonClassName: "text-button-tertiary items-center p-0 ml-4 border-0 w-5 h-5",
|
|
1493
|
-
onClick:
|
|
1494
|
-
icon: /* @__PURE__ */
|
|
1493
|
+
onClick: c,
|
|
1494
|
+
icon: /* @__PURE__ */ h(Ke, {})
|
|
1495
1495
|
}
|
|
1496
1496
|
),
|
|
1497
|
-
onChange:
|
|
1497
|
+
onChange: d
|
|
1498
1498
|
}
|
|
1499
|
-
) : /* @__PURE__ */
|
|
1499
|
+
) : /* @__PURE__ */ h(
|
|
1500
1500
|
Q,
|
|
1501
1501
|
{
|
|
1502
1502
|
buttonClassName: "text-button-tertiary p-0 search-button",
|
|
1503
|
-
iconBefore:
|
|
1504
|
-
onClick:
|
|
1503
|
+
iconBefore: a || /* @__PURE__ */ h(Ze, { className: "w-5 h-5" }),
|
|
1504
|
+
onClick: c
|
|
1505
1505
|
}
|
|
1506
1506
|
) }), Ft = ({
|
|
1507
|
-
conversations:
|
|
1508
|
-
selectedConversationId:
|
|
1509
|
-
searchQuery:
|
|
1510
|
-
conversationStyles:
|
|
1511
|
-
handleConversationClick:
|
|
1512
|
-
actions:
|
|
1513
|
-
locale:
|
|
1514
|
-
shareConversationProps:
|
|
1507
|
+
conversations: n,
|
|
1508
|
+
selectedConversationId: r,
|
|
1509
|
+
searchQuery: s,
|
|
1510
|
+
conversationStyles: a,
|
|
1511
|
+
handleConversationClick: d,
|
|
1512
|
+
actions: c,
|
|
1513
|
+
locale: m,
|
|
1514
|
+
shareConversationProps: f,
|
|
1515
1515
|
isDisabled: e
|
|
1516
1516
|
}) => {
|
|
1517
|
-
const [
|
|
1517
|
+
const [o, t] = O([]);
|
|
1518
1518
|
return ee(() => {
|
|
1519
1519
|
t(
|
|
1520
1520
|
ye(
|
|
1521
|
-
|
|
1522
|
-
(i) =>
|
|
1523
|
-
|
|
1521
|
+
n?.filter(
|
|
1522
|
+
(i) => me(i?.name)?.includes(
|
|
1523
|
+
s || ""
|
|
1524
1524
|
)
|
|
1525
1525
|
)
|
|
1526
1526
|
)
|
|
1527
1527
|
);
|
|
1528
|
-
}, [
|
|
1528
|
+
}, [n, s]), /* @__PURE__ */ h(q, { children: o?.length ? o.map((i) => /* @__PURE__ */ h(
|
|
1529
1529
|
Fe,
|
|
1530
1530
|
{
|
|
1531
|
-
locale:
|
|
1532
|
-
conversationStyles:
|
|
1531
|
+
locale: m,
|
|
1532
|
+
conversationStyles: a,
|
|
1533
1533
|
conversation: i,
|
|
1534
|
-
searchQuery:
|
|
1535
|
-
selectedConversationId:
|
|
1536
|
-
onConversationClick:
|
|
1537
|
-
actions:
|
|
1538
|
-
shareConversationProps:
|
|
1534
|
+
searchQuery: s,
|
|
1535
|
+
selectedConversationId: r,
|
|
1536
|
+
onConversationClick: d,
|
|
1537
|
+
actions: c,
|
|
1538
|
+
shareConversationProps: f,
|
|
1539
1539
|
isDisabled: e
|
|
1540
1540
|
},
|
|
1541
1541
|
i.id
|
|
1542
|
-
)) : /* @__PURE__ */
|
|
1543
|
-
}, Ut = ({ titles:
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1542
|
+
)) : /* @__PURE__ */ h("h3", { className: "text-neutrals-800", children: a?.titles?.noConversation ?? "No conversations yet" }) });
|
|
1543
|
+
}, Ut = ({ titles: n }) => /* @__PURE__ */ y("div", { className: "p-8 text-center flex flex-col", children: [
|
|
1544
|
+
/* @__PURE__ */ h("p", { className: "text-neutrals-800", children: n?.noConversation ?? "No conversations yet" }),
|
|
1545
|
+
/* @__PURE__ */ h("p", { className: "text-sm text-neutrals-800 mt-2", children: n?.clickNewChat ?? 'Click "New Chat" to start a conversation' })
|
|
1546
1546
|
] }), Zt = ({
|
|
1547
|
-
handleConversationClick:
|
|
1548
|
-
selectedConversationId:
|
|
1549
|
-
actions:
|
|
1550
|
-
children:
|
|
1551
|
-
isCollapsed:
|
|
1552
|
-
isStreaming:
|
|
1553
|
-
conversationStyles:
|
|
1554
|
-
conversations:
|
|
1547
|
+
handleConversationClick: n,
|
|
1548
|
+
selectedConversationId: r,
|
|
1549
|
+
actions: s,
|
|
1550
|
+
children: a,
|
|
1551
|
+
isCollapsed: d,
|
|
1552
|
+
isStreaming: c,
|
|
1553
|
+
conversationStyles: m,
|
|
1554
|
+
conversations: f,
|
|
1555
1555
|
locale: e,
|
|
1556
|
-
sharedConversations:
|
|
1556
|
+
sharedConversations: o,
|
|
1557
1557
|
setConversations: t,
|
|
1558
1558
|
setSharedConversations: i,
|
|
1559
|
-
shareConversationProps:
|
|
1560
|
-
handleSelectedConversationRemove:
|
|
1559
|
+
shareConversationProps: l,
|
|
1560
|
+
handleSelectedConversationRemove: p
|
|
1561
1561
|
}) => {
|
|
1562
|
-
const [u, E] =
|
|
1562
|
+
const [u, E] = O({}), [g, v] = O(!0), [N, C] = O(""), [R, S] = O(!1), {
|
|
1563
1563
|
getConversations: D,
|
|
1564
|
-
getSharedConversations:
|
|
1565
|
-
deleteConversation:
|
|
1566
|
-
renameConversation:
|
|
1567
|
-
} =
|
|
1564
|
+
getSharedConversations: b,
|
|
1565
|
+
deleteConversation: T,
|
|
1566
|
+
renameConversation: $
|
|
1567
|
+
} = s, H = J(() => !!N?.length, [N]);
|
|
1568
1568
|
ee(() => {
|
|
1569
1569
|
E({
|
|
1570
|
-
...nt(
|
|
1571
|
-
...it(
|
|
1570
|
+
...nt(o),
|
|
1571
|
+
...it(f)
|
|
1572
1572
|
});
|
|
1573
|
-
}, [
|
|
1573
|
+
}, [f, o]), ee(() => {
|
|
1574
1574
|
async function M() {
|
|
1575
1575
|
try {
|
|
1576
1576
|
v(!0);
|
|
1577
|
-
const
|
|
1577
|
+
const A = await D(e), k = await b(
|
|
1578
1578
|
re(se.ME)
|
|
1579
1579
|
);
|
|
1580
|
-
t(K(
|
|
1580
|
+
t(K(A)), i(
|
|
1581
1581
|
K(
|
|
1582
|
-
ue(
|
|
1582
|
+
ue(k, e)
|
|
1583
1583
|
)
|
|
1584
1584
|
);
|
|
1585
|
-
} catch (
|
|
1586
|
-
console.error("Error loading conversation",
|
|
1585
|
+
} catch (A) {
|
|
1586
|
+
console.error("Error loading conversation", A);
|
|
1587
1587
|
} finally {
|
|
1588
1588
|
v(!1);
|
|
1589
1589
|
}
|
|
@@ -1593,49 +1593,49 @@ const bt = (o, s) => ({
|
|
|
1593
1593
|
D,
|
|
1594
1594
|
t,
|
|
1595
1595
|
e,
|
|
1596
|
-
|
|
1596
|
+
b,
|
|
1597
1597
|
i
|
|
1598
1598
|
]);
|
|
1599
|
-
const P =
|
|
1599
|
+
const P = L(
|
|
1600
1600
|
async (M) => {
|
|
1601
1601
|
try {
|
|
1602
|
-
await
|
|
1603
|
-
const
|
|
1602
|
+
await T(M);
|
|
1603
|
+
const A = await D(e), k = await b(
|
|
1604
1604
|
re(se.ME)
|
|
1605
1605
|
);
|
|
1606
|
-
t(K(
|
|
1606
|
+
t(K(A)), i(
|
|
1607
1607
|
K(
|
|
1608
|
-
ue(
|
|
1608
|
+
ue(k, e)
|
|
1609
1609
|
)
|
|
1610
|
-
),
|
|
1611
|
-
} catch (
|
|
1612
|
-
console.error("Error deleting conversation",
|
|
1610
|
+
), r === M?.id && p();
|
|
1611
|
+
} catch (A) {
|
|
1612
|
+
console.error("Error deleting conversation", A);
|
|
1613
1613
|
}
|
|
1614
1614
|
},
|
|
1615
1615
|
[
|
|
1616
|
-
|
|
1616
|
+
T,
|
|
1617
1617
|
D,
|
|
1618
1618
|
e,
|
|
1619
|
-
|
|
1619
|
+
b,
|
|
1620
1620
|
t,
|
|
1621
1621
|
i,
|
|
1622
|
-
|
|
1623
|
-
|
|
1622
|
+
r,
|
|
1623
|
+
p
|
|
1624
1624
|
]
|
|
1625
|
-
), Y =
|
|
1626
|
-
async (M,
|
|
1625
|
+
), Y = L(
|
|
1626
|
+
async (M, A) => {
|
|
1627
1627
|
try {
|
|
1628
|
-
v(!0), await
|
|
1629
|
-
const
|
|
1628
|
+
v(!0), await $(M, A);
|
|
1629
|
+
const k = await D(e), W = await b(
|
|
1630
1630
|
re(se.ME)
|
|
1631
1631
|
);
|
|
1632
|
-
t(K(
|
|
1632
|
+
t(K(k)), i(
|
|
1633
1633
|
K(
|
|
1634
1634
|
ue(W, e)
|
|
1635
1635
|
)
|
|
1636
1636
|
);
|
|
1637
|
-
} catch (
|
|
1638
|
-
console.error("Error renaming conversation",
|
|
1637
|
+
} catch (k) {
|
|
1638
|
+
console.error("Error renaming conversation", k);
|
|
1639
1639
|
} finally {
|
|
1640
1640
|
v(!1);
|
|
1641
1641
|
}
|
|
@@ -1643,130 +1643,130 @@ const bt = (o, s) => ({
|
|
|
1643
1643
|
[
|
|
1644
1644
|
D,
|
|
1645
1645
|
e,
|
|
1646
|
-
|
|
1646
|
+
b,
|
|
1647
1647
|
t,
|
|
1648
1648
|
i,
|
|
1649
|
-
|
|
1649
|
+
$
|
|
1650
1650
|
]
|
|
1651
|
-
), j =
|
|
1651
|
+
), j = L(
|
|
1652
1652
|
(M) => {
|
|
1653
1653
|
C(M);
|
|
1654
1654
|
},
|
|
1655
1655
|
[C]
|
|
1656
|
-
),
|
|
1656
|
+
), _ = L(() => {
|
|
1657
1657
|
S((M) => !M), C("");
|
|
1658
1658
|
}, [S]);
|
|
1659
|
-
return g ? /* @__PURE__ */
|
|
1660
|
-
!
|
|
1659
|
+
return g ? /* @__PURE__ */ h(we, {}) : /* @__PURE__ */ y(q, { children: [
|
|
1660
|
+
!d && /* @__PURE__ */ y(
|
|
1661
1661
|
"div",
|
|
1662
1662
|
{
|
|
1663
|
-
className:
|
|
1663
|
+
className: B(
|
|
1664
1664
|
"flex justify-between items-center",
|
|
1665
1665
|
R ? " pt-4 pb-0 sm:pt-10" : " pt-6 pb-2 sm:pt-10"
|
|
1666
1666
|
),
|
|
1667
1667
|
children: [
|
|
1668
|
-
!R && /* @__PURE__ */
|
|
1669
|
-
/* @__PURE__ */
|
|
1670
|
-
|
|
1668
|
+
!R && /* @__PURE__ */ h("h3", { className: "text-neutrals-700 sm:body-2", children: m?.titles?.allChats ?? "All Chats" }),
|
|
1669
|
+
/* @__PURE__ */ h(
|
|
1670
|
+
Bt,
|
|
1671
1671
|
{
|
|
1672
1672
|
searchQuery: N,
|
|
1673
|
-
searchIcon:
|
|
1674
|
-
titles:
|
|
1673
|
+
searchIcon: m.searchIcon,
|
|
1674
|
+
titles: m.titles,
|
|
1675
1675
|
isExpandedSearch: R,
|
|
1676
1676
|
onSearchConversations: j,
|
|
1677
|
-
toggleSearchField:
|
|
1677
|
+
toggleSearchField: _
|
|
1678
1678
|
}
|
|
1679
1679
|
)
|
|
1680
1680
|
]
|
|
1681
1681
|
}
|
|
1682
1682
|
),
|
|
1683
|
-
/* @__PURE__ */
|
|
1683
|
+
/* @__PURE__ */ h(
|
|
1684
1684
|
"div",
|
|
1685
1685
|
{
|
|
1686
|
-
className:
|
|
1686
|
+
className: B(
|
|
1687
1687
|
"scroll-hidden-container flex flex-col mt-4 flex-1 min-h-0 pr-2",
|
|
1688
1688
|
H ? "gap-y-1" : "gap-y-6"
|
|
1689
1689
|
),
|
|
1690
|
-
children:
|
|
1690
|
+
children: d ? null : /* @__PURE__ */ h(q, { children: f?.length === 0 && o?.length === 0 ? /* @__PURE__ */ h(Ut, { titles: m.titles }) : H ? /* @__PURE__ */ h(
|
|
1691
1691
|
Ft,
|
|
1692
1692
|
{
|
|
1693
1693
|
locale: e,
|
|
1694
|
-
conversationStyles:
|
|
1695
|
-
conversations: [...
|
|
1694
|
+
conversationStyles: m,
|
|
1695
|
+
conversations: [...o, ...f],
|
|
1696
1696
|
searchQuery: N,
|
|
1697
|
-
selectedConversationId:
|
|
1698
|
-
handleConversationClick:
|
|
1699
|
-
shareConversationProps:
|
|
1700
|
-
isDisabled:
|
|
1697
|
+
selectedConversationId: r,
|
|
1698
|
+
handleConversationClick: n,
|
|
1699
|
+
shareConversationProps: l,
|
|
1700
|
+
isDisabled: c,
|
|
1701
1701
|
actions: {
|
|
1702
|
-
...
|
|
1702
|
+
...s,
|
|
1703
1703
|
deleteConversation: P
|
|
1704
1704
|
}
|
|
1705
1705
|
}
|
|
1706
1706
|
) : Object.entries(u).map(
|
|
1707
|
-
([M,
|
|
1708
|
-
|
|
1707
|
+
([M, A]) => A?.length > 0 && /* @__PURE__ */ h(
|
|
1708
|
+
kt,
|
|
1709
1709
|
{
|
|
1710
1710
|
locale: e,
|
|
1711
|
-
isDisabled:
|
|
1711
|
+
isDisabled: c,
|
|
1712
1712
|
groupLabel: M,
|
|
1713
|
-
conversationStyles:
|
|
1714
|
-
groupedConversations:
|
|
1715
|
-
handleConversationClick:
|
|
1713
|
+
conversationStyles: m,
|
|
1714
|
+
groupedConversations: A,
|
|
1715
|
+
handleConversationClick: n,
|
|
1716
1716
|
actions: {
|
|
1717
|
-
...
|
|
1717
|
+
...s,
|
|
1718
1718
|
deleteConversation: P,
|
|
1719
1719
|
renameConversation: Y
|
|
1720
1720
|
},
|
|
1721
|
-
shareConversationProps:
|
|
1722
|
-
selectedConversationId:
|
|
1721
|
+
shareConversationProps: l,
|
|
1722
|
+
selectedConversationId: r
|
|
1723
1723
|
},
|
|
1724
1724
|
M
|
|
1725
1725
|
)
|
|
1726
1726
|
) })
|
|
1727
1727
|
}
|
|
1728
1728
|
),
|
|
1729
|
-
|
|
1729
|
+
a
|
|
1730
1730
|
] });
|
|
1731
1731
|
}, zt = ({
|
|
1732
|
-
onCloseModal:
|
|
1733
|
-
disableModalDividers:
|
|
1734
|
-
signOut:
|
|
1735
|
-
isSmallButton:
|
|
1736
|
-
locale:
|
|
1737
|
-
titles:
|
|
1732
|
+
onCloseModal: n,
|
|
1733
|
+
disableModalDividers: r,
|
|
1734
|
+
signOut: s,
|
|
1735
|
+
isSmallButton: a,
|
|
1736
|
+
locale: d,
|
|
1737
|
+
titles: c
|
|
1738
1738
|
}) => /* @__PURE__ */ y(
|
|
1739
1739
|
ae,
|
|
1740
1740
|
{
|
|
1741
|
-
heading:
|
|
1741
|
+
heading: c?.popupTitle || "Log out?",
|
|
1742
1742
|
portalId: "sign-out",
|
|
1743
1743
|
containerClassName: "sign-out-popup",
|
|
1744
1744
|
size: le.SM,
|
|
1745
|
-
dividers: !
|
|
1746
|
-
onClose:
|
|
1745
|
+
dividers: !r,
|
|
1746
|
+
onClose: n,
|
|
1747
1747
|
closeButtonTitle: "Cancel",
|
|
1748
1748
|
children: [
|
|
1749
|
-
/* @__PURE__ */
|
|
1749
|
+
/* @__PURE__ */ h("div", { className: "py-4 px-6 sm:px-0", lang: d, children: c?.popupText }),
|
|
1750
1750
|
/* @__PURE__ */ y("div", { className: "flex justify-end gap-x-2 py-3 px-6 delete-conversation-popup-footer", children: [
|
|
1751
|
-
/* @__PURE__ */
|
|
1751
|
+
/* @__PURE__ */ h(
|
|
1752
1752
|
Q,
|
|
1753
1753
|
{
|
|
1754
1754
|
buttonClassName: "cancel-button",
|
|
1755
|
-
title:
|
|
1756
|
-
isSmallButton:
|
|
1757
|
-
onClick: (
|
|
1758
|
-
|
|
1755
|
+
title: c?.popupCancel || "Cancel",
|
|
1756
|
+
isSmallButton: a,
|
|
1757
|
+
onClick: (m) => {
|
|
1758
|
+
m.stopPropagation(), n();
|
|
1759
1759
|
}
|
|
1760
1760
|
}
|
|
1761
1761
|
),
|
|
1762
|
-
/* @__PURE__ */
|
|
1762
|
+
/* @__PURE__ */ h(
|
|
1763
1763
|
Q,
|
|
1764
1764
|
{
|
|
1765
1765
|
buttonClassName: "text-button-primary",
|
|
1766
|
-
title:
|
|
1767
|
-
isSmallButton:
|
|
1768
|
-
onClick: (
|
|
1769
|
-
|
|
1766
|
+
title: c?.popupApply || "Sign Out",
|
|
1767
|
+
isSmallButton: a,
|
|
1768
|
+
onClick: (m) => {
|
|
1769
|
+
m.stopPropagation(), s?.();
|
|
1770
1770
|
}
|
|
1771
1771
|
}
|
|
1772
1772
|
)
|
|
@@ -1774,83 +1774,104 @@ const bt = (o, s) => ({
|
|
|
1774
1774
|
]
|
|
1775
1775
|
}
|
|
1776
1776
|
), Jt = ({
|
|
1777
|
-
userInfo:
|
|
1778
|
-
signOutAction:
|
|
1779
|
-
|
|
1780
|
-
|
|
1777
|
+
userInfo: n,
|
|
1778
|
+
signOutAction: r,
|
|
1779
|
+
contactSupportUrl: s,
|
|
1780
|
+
styles: a,
|
|
1781
|
+
locale: d,
|
|
1781
1782
|
titles: c
|
|
1782
1783
|
}) => {
|
|
1783
|
-
const
|
|
1784
|
-
() =>
|
|
1785
|
-
[
|
|
1786
|
-
), [
|
|
1787
|
-
|
|
1788
|
-
}, []),
|
|
1789
|
-
|
|
1790
|
-
}, []),
|
|
1791
|
-
|
|
1784
|
+
const m = (v) => v?.split(" ")?.map((N, C) => C < 2 ? N[0].toUpperCase() : "")?.join("") ?? "", f = J(
|
|
1785
|
+
() => n?.name ? m(n?.name) : n?.email?.[0].toUpperCase() ?? "",
|
|
1786
|
+
[n]
|
|
1787
|
+
), [e, o] = O(!1), t = n?.name?.split(" "), i = t ? `${t?.[0] ?? ""} ${t?.[1]?.[0] ? t?.[1]?.[0] + "." : ""}` : n?.email ?? "", l = L(() => {
|
|
1788
|
+
o(!0);
|
|
1789
|
+
}, []), p = L(() => {
|
|
1790
|
+
o(!1);
|
|
1791
|
+
}, []), u = L(() => {
|
|
1792
|
+
window.open(s || "#", "_blank", "noopener,noreferrer");
|
|
1793
|
+
}, [s]), E = J(() => /* @__PURE__ */ y("div", { className: "flex items-center gap-2", children: [
|
|
1794
|
+
/* @__PURE__ */ h(
|
|
1792
1795
|
"div",
|
|
1793
1796
|
{
|
|
1794
|
-
className:
|
|
1797
|
+
className: B(
|
|
1795
1798
|
"cursor-pointer flex items-center justify-center size-11 rounded-[100px] p-[10px] sm:h-[32px] sm:w-[32px] flex-shrink-0",
|
|
1796
|
-
|
|
1799
|
+
a?.initialStyles
|
|
1797
1800
|
),
|
|
1798
1801
|
children: f
|
|
1799
1802
|
}
|
|
1800
1803
|
),
|
|
1801
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ h(
|
|
1802
1805
|
"p",
|
|
1803
1806
|
{
|
|
1804
|
-
className:
|
|
1807
|
+
className: B(
|
|
1805
1808
|
"h3 cursor-pointer overflow-hidden text-ellipsis",
|
|
1806
|
-
|
|
1809
|
+
a?.userNameStyles
|
|
1807
1810
|
),
|
|
1808
|
-
children: (
|
|
1811
|
+
children: (a?.showShortName ? i : n?.name) ?? n?.email ?? ""
|
|
1809
1812
|
}
|
|
1810
1813
|
)
|
|
1811
|
-
] }), [f,
|
|
1812
|
-
|
|
1814
|
+
] }), [f, i, a, n]), g = J(() => /* @__PURE__ */ y("div", { className: B("py-1", a?.dropDownStyles), children: [
|
|
1815
|
+
a?.settingsIcon && /* @__PURE__ */ y(
|
|
1813
1816
|
"button",
|
|
1814
1817
|
{
|
|
1815
|
-
className:
|
|
1816
|
-
"p-2 items-center flex gap-1 text-primary fill-primary
|
|
1817
|
-
|
|
1818
|
+
className: B(
|
|
1819
|
+
"p-2 items-center flex gap-1 text-primary fill-primary",
|
|
1820
|
+
a?.dropdownButtonTypographyStyles || "body-1",
|
|
1821
|
+
a?.dropdownButtonStyles
|
|
1818
1822
|
),
|
|
1819
1823
|
title: c?.settings,
|
|
1820
1824
|
children: [
|
|
1821
|
-
|
|
1822
|
-
c?.settings || "Settings"
|
|
1825
|
+
/* @__PURE__ */ h("span", { className: "shrink-0", children: a?.settingsIcon }),
|
|
1826
|
+
/* @__PURE__ */ h("span", { className: "min-w-0 break-words", children: c?.settings || "Settings" })
|
|
1827
|
+
]
|
|
1828
|
+
}
|
|
1829
|
+
),
|
|
1830
|
+
a?.contactSupportIcon && /* @__PURE__ */ y(
|
|
1831
|
+
"button",
|
|
1832
|
+
{
|
|
1833
|
+
className: B(
|
|
1834
|
+
"p-2 items-center flex gap-1 text-primary fill-primary",
|
|
1835
|
+
a?.dropdownButtonTypographyStyles || "body-1",
|
|
1836
|
+
a?.dropdownButtonStyles
|
|
1837
|
+
),
|
|
1838
|
+
title: c?.contactSupport,
|
|
1839
|
+
onClick: u,
|
|
1840
|
+
children: [
|
|
1841
|
+
/* @__PURE__ */ h("span", { className: "shrink-0", children: a?.contactSupportIcon }),
|
|
1842
|
+
/* @__PURE__ */ h("span", { className: "min-w-0 break-words", children: c?.contactSupport || "Contact support" })
|
|
1823
1843
|
]
|
|
1824
1844
|
}
|
|
1825
1845
|
),
|
|
1826
|
-
/* @__PURE__ */
|
|
1846
|
+
/* @__PURE__ */ h(
|
|
1827
1847
|
"div",
|
|
1828
1848
|
{
|
|
1829
|
-
className:
|
|
1849
|
+
className: B(
|
|
1830
1850
|
"h-0 border-t border-neutrals-600 my-2",
|
|
1831
|
-
|
|
1851
|
+
a?.showSeparator ? "block" : "hidden"
|
|
1832
1852
|
)
|
|
1833
1853
|
}
|
|
1834
1854
|
),
|
|
1835
1855
|
/* @__PURE__ */ y(
|
|
1836
1856
|
"button",
|
|
1837
1857
|
{
|
|
1838
|
-
className:
|
|
1839
|
-
"p-2 items-center flex gap-1 text-primary fill-primary
|
|
1840
|
-
|
|
1858
|
+
className: B(
|
|
1859
|
+
"p-2 items-center flex gap-1 text-primary fill-primary",
|
|
1860
|
+
a?.dropdownButtonTypographyStyles || "body-1",
|
|
1861
|
+
a?.dropdownButtonStyles
|
|
1841
1862
|
),
|
|
1842
1863
|
title: c?.signOut,
|
|
1843
|
-
onClick:
|
|
1864
|
+
onClick: l,
|
|
1844
1865
|
children: [
|
|
1845
|
-
|
|
1846
|
-
c?.signOut || "Sign out",
|
|
1847
|
-
|
|
1866
|
+
/* @__PURE__ */ h("span", { className: "shrink-0", children: a?.signOutIcon }),
|
|
1867
|
+
/* @__PURE__ */ h("span", { className: "min-w-0 break-words", children: c?.signOut || "Sign out" }),
|
|
1868
|
+
e && /* @__PURE__ */ h(
|
|
1848
1869
|
zt,
|
|
1849
1870
|
{
|
|
1850
|
-
onCloseModal:
|
|
1851
|
-
signOut: () =>
|
|
1852
|
-
locale:
|
|
1853
|
-
disableModalDividers:
|
|
1871
|
+
onCloseModal: p,
|
|
1872
|
+
signOut: () => r?.(),
|
|
1873
|
+
locale: d,
|
|
1874
|
+
disableModalDividers: a?.disableModalDividers,
|
|
1854
1875
|
titles: c
|
|
1855
1876
|
}
|
|
1856
1877
|
)
|
|
@@ -1858,30 +1879,31 @@ const bt = (o, s) => ({
|
|
|
1858
1879
|
}
|
|
1859
1880
|
)
|
|
1860
1881
|
] }), [
|
|
1861
|
-
r,
|
|
1862
|
-
c,
|
|
1863
|
-
i,
|
|
1864
|
-
p,
|
|
1865
1882
|
a,
|
|
1883
|
+
c,
|
|
1866
1884
|
l,
|
|
1867
|
-
|
|
1885
|
+
u,
|
|
1886
|
+
e,
|
|
1887
|
+
p,
|
|
1888
|
+
d,
|
|
1889
|
+
r
|
|
1868
1890
|
]);
|
|
1869
|
-
if (
|
|
1870
|
-
return /* @__PURE__ */
|
|
1891
|
+
if (n)
|
|
1892
|
+
return /* @__PURE__ */ h(
|
|
1871
1893
|
Re,
|
|
1872
1894
|
{
|
|
1873
|
-
containerClassName:
|
|
1895
|
+
containerClassName: B(
|
|
1874
1896
|
"transition-opacity group-hover:opacity-100 shrink w-full",
|
|
1875
|
-
|
|
1897
|
+
a?.dropdownContainerClassName
|
|
1876
1898
|
),
|
|
1877
|
-
triggerButton:
|
|
1878
|
-
content:
|
|
1899
|
+
triggerButton: E,
|
|
1900
|
+
content: g,
|
|
1879
1901
|
openedClassName: "action-menu-opened"
|
|
1880
1902
|
}
|
|
1881
1903
|
);
|
|
1882
1904
|
};
|
|
1883
1905
|
export {
|
|
1884
|
-
|
|
1906
|
+
Ot as ActionMenu,
|
|
1885
1907
|
U as ActionMenuItem,
|
|
1886
1908
|
Zt as ConversationList,
|
|
1887
1909
|
Jt as User,
|