@epam/statgpt-conversation-list 0.5.0-rc.8 → 0.5.0

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