@epam/statgpt-conversation-list 0.2.0-rc.10 → 0.2.0-rc.12

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