@ethora/chat-component 26.9.5 → 26.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/{ChatProfileModal-Pr4--RdW.js → ChatProfileModal-DKuxJsdM.js} +526 -519
- package/dist/{FilePreviewModal-CYHlKzRc.js → FilePreviewModal-BcaSoO3-.js} +89 -89
- package/dist/{ManageDataModal-BE1eGlYh.js → ManageDataModal-Dw4dCQll.js} +2 -2
- package/dist/{MarkdownBody-G0_J0NL6.js → MarkdownBody-xtKDMR0h.js} +1 -1
- package/dist/MessageSearchModal-BVKU6H3v.js +389 -0
- package/dist/PublicChatsModal-CscOnVaQ.js +202 -0
- package/dist/{SideDrawer-BG2m7Bcm.js → SideDrawer-WneDrrWG.js} +27 -27
- package/dist/{UserProfileModal-B2Hp5bAF.js → UserProfileModal-CMHFq1I9.js} +3 -3
- package/dist/{UserSettingsModal-D871FDAT.js → UserSettingsModal-BoZXZ0oR.js} +2 -2
- package/dist/{VideoCallOverlay-Br0ji0nZ.js → VideoCallOverlay-CQNi7wp5.js} +1 -1
- package/dist/{VisibilityModal-DdFBV1_g.js → VisibilityModal-BPsNiMzJ.js} +2 -2
- package/dist/assets/icons.d.ts +9 -0
- package/dist/components/InputComponents/Search.d.ts +4 -0
- package/dist/components/MainComponents/ArchivedMessageCard.d.ts +11 -0
- package/dist/components/MainComponents/computeAnchoredScrollTop.d.ts +9 -0
- package/dist/components/MainComponents/useJumpToMessage.d.ts +63 -0
- package/dist/components/MainComponents/useStickToBottom.d.ts +27 -0
- package/dist/components/Modals/MessageSearchModal/MessageHitResults.d.ts +22 -0
- package/dist/components/Modals/MessageSearchModal/MessageSearchModal.d.ts +6 -0
- package/dist/components/Modals/MessageSearchModal/resolveSender.d.ts +33 -0
- package/dist/components/Modals/MessageSearchModal/searchFilters.d.ts +34 -0
- package/dist/components/Modals/MessageSearchModal/snippet.d.ts +14 -0
- package/dist/components/Modals/MessageSearchModal/useMessageSearch.d.ts +22 -0
- package/dist/components/Modals/PublicChatsModal/PublicChatsModal.d.ts +13 -0
- package/dist/components/styled/RoomListComponents/index.d.ts +3 -0
- package/dist/context/ToastContext.d.ts +7 -0
- package/dist/firebase-messaging-sw.js +21 -3
- package/dist/{handleCopyClick-DPjxMoJn.js → handleCopyClick-B70vLjJD.js} +1 -1
- package/dist/helpers/constants/MODAL_TYPES.d.ts +2 -0
- package/dist/helpers/nanoToMs.d.ts +1 -1
- package/dist/helpers/openRoomAtMessage.d.ts +17 -0
- package/dist/hooks/useMessageSearchShortcut.d.ts +14 -0
- package/dist/hooks/useRoomState.d.ts +1 -0
- package/dist/{main-BRIZ98KV.js → main-rJpE4hh-.js} +12318 -11108
- package/dist/main.css +1 -1
- package/dist/main.js +6 -6
- package/dist/networking/api-requests/messageSearch.api.d.ts +56 -0
- package/dist/networking/api-requests/publicChats.api.d.ts +23 -0
- package/dist/networking/api-requests/xmppToken.api.d.ts +1 -0
- package/dist/networking/xmppClient.d.ts +2 -0
- package/dist/roomStore/chatSettingsSlice.d.ts +1 -1
- package/dist/roomStore/roomsSlice.d.ts +38 -1
- package/dist/styles/classNames.d.ts +2 -0
- package/dist/types/models/config.model.d.ts +11 -0
- package/dist/utils/notificationUtils.d.ts +12 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/public/firebase-messaging-sw.js +21 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import te, { useState as
|
|
3
|
-
import { p as le, b as pe,
|
|
1
|
+
import { jsx as l, jsxs as H } from "react/jsx-runtime";
|
|
2
|
+
import te, { useState as N, useRef as z, useEffect as O, useMemo as $, useCallback as P } from "react";
|
|
3
|
+
import { p as le, b as pe, aS as we, ae as ve, x as X, B as V, aT as xe, aU as be, ay as ye, aV as Ee, aW as Le, aX as ue, aY as ne, a as Ce, aO as Me, u as Q, a5 as Re, aZ as re, as as ke, ao as J, a_ as Pe, a$ as Se, b0 as Te, b1 as Ae, b2 as Ie, b3 as Xe, b4 as Ye, b5 as ze, b6 as Oe, az as De, b7 as Fe, b8 as Be, ax as He, b9 as Ne, w as Ue } from "./main-rJpE4hh-.js";
|
|
4
4
|
function oe(t, i) {
|
|
5
5
|
let o;
|
|
6
6
|
return (...E) => {
|
|
@@ -11,18 +11,18 @@ function _e({ debounce: t, scroll: i, polyfill: o, offsetSize: E } = { debounce:
|
|
|
11
11
|
const L = o || (typeof window > "u" ? class {
|
|
12
12
|
} : window.ResizeObserver);
|
|
13
13
|
if (!L) throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");
|
|
14
|
-
const [u, C] =
|
|
14
|
+
const [u, C] = N({ left: 0, top: 0, width: 0, height: 0, bottom: 0, right: 0, x: 0, y: 0 }), n = z({ element: null, scrollContainers: null, resizeObserver: null, lastBounds: u, orientationHandler: null }), M = t ? typeof t == "number" ? t : t.scroll : null, p = t ? typeof t == "number" ? t : t.resize : null, T = z(!1);
|
|
15
15
|
O(() => (T.current = !0, () => {
|
|
16
16
|
T.current = !1;
|
|
17
17
|
}));
|
|
18
18
|
const [b, x, m] = $(() => {
|
|
19
19
|
const r = () => {
|
|
20
20
|
if (!n.current.element) return;
|
|
21
|
-
const { left: g, top: w, width: v, height:
|
|
21
|
+
const { left: g, top: w, width: v, height: B, bottom: S, right: R, x: f, y: h } = n.current.element.getBoundingClientRect(), A = { left: g, top: w, width: v, height: B, bottom: S, right: R, x: f, y: h };
|
|
22
22
|
n.current.element instanceof HTMLElement && E && (A.height = n.current.element.offsetHeight, A.width = n.current.element.offsetWidth), Object.freeze(A), T.current && !We(n.current.lastBounds, A) && C(n.current.lastBounds = A);
|
|
23
23
|
};
|
|
24
|
-
return [r, p ? oe(r, p) : r,
|
|
25
|
-
}, [C, E,
|
|
24
|
+
return [r, p ? oe(r, p) : r, M ? oe(r, M) : r];
|
|
25
|
+
}, [C, E, M, p]);
|
|
26
26
|
function y() {
|
|
27
27
|
n.current.scrollContainers && (n.current.scrollContainers.forEach((r) => r.removeEventListener("scroll", m, !0)), n.current.scrollContainers = null), n.current.resizeObserver && (n.current.resizeObserver.disconnect(), n.current.resizeObserver = null), n.current.orientationHandler && ("orientation" in screen && "removeEventListener" in screen.orientation ? screen.orientation.removeEventListener("change", n.current.orientationHandler) : "onorientationchange" in window && window.removeEventListener("orientationchange", n.current.orientationHandler));
|
|
28
28
|
}
|
|
@@ -109,8 +109,8 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
109
109
|
a {
|
|
110
110
|
color: var(--ethora-color-primary-text, var(--ethora-color-primary, #0052cd));
|
|
111
111
|
}
|
|
112
|
-
`,
|
|
113
|
-
const i = le(), { config: o } = pe(), [E, L] = _e(), u = z(null), C = z(null), n = z(null), [
|
|
112
|
+
`, qe = ({ pdfUrl: t }) => {
|
|
113
|
+
const i = le(), { config: o } = pe(), [E, L] = _e(), u = z(null), C = z(null), n = z(null), [M, p] = N("loading"), [T, b] = N(0), [x, m] = N(1), y = Math.max(320, Math.floor(L.width || 0));
|
|
114
114
|
O(() => {
|
|
115
115
|
let r = !1, g;
|
|
116
116
|
return p("loading"), m(1), b(0), (async () => {
|
|
@@ -140,21 +140,21 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
140
140
|
};
|
|
141
141
|
}, [t, o?.pdfPreview?.workerSrc]), O(() => {
|
|
142
142
|
const r = C.current, g = u.current;
|
|
143
|
-
if (
|
|
143
|
+
if (M !== "ready" || !r || !g || y <= 0) return;
|
|
144
144
|
let w = !1;
|
|
145
145
|
return (async () => {
|
|
146
146
|
try {
|
|
147
147
|
const v = await r.getPage(x);
|
|
148
148
|
if (w) return;
|
|
149
|
-
const
|
|
150
|
-
g.width = Math.max(1, Math.floor(
|
|
149
|
+
const B = v.getViewport({ scale: 1 }), S = B.width ? y / B.width : 1, R = v.getViewport({ scale: S });
|
|
150
|
+
g.width = Math.max(1, Math.floor(R.width)), g.height = Math.max(1, Math.floor(R.height));
|
|
151
151
|
const f = g.getContext("2d");
|
|
152
152
|
if (!f) {
|
|
153
153
|
p("error");
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
n.current?.cancel();
|
|
157
|
-
const h = v.render({ canvasContext: f, viewport:
|
|
157
|
+
const h = v.render({ canvasContext: f, viewport: R });
|
|
158
158
|
n.current = h, await h.promise, v.cleanup();
|
|
159
159
|
} catch (v) {
|
|
160
160
|
w || console.warn("[Ethora] PDF page render failed:", v);
|
|
@@ -162,20 +162,20 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
162
162
|
})(), () => {
|
|
163
163
|
w = !0, n.current?.cancel(), n.current = null;
|
|
164
164
|
};
|
|
165
|
-
}, [
|
|
166
|
-
const Y =
|
|
165
|
+
}, [M, x, y]);
|
|
166
|
+
const Y = P(
|
|
167
167
|
() => m((r) => Math.max(1, r - 1)),
|
|
168
168
|
[]
|
|
169
|
-
), F =
|
|
169
|
+
), F = P(
|
|
170
170
|
() => m((r) => Math.min(T || 1, r + 1)),
|
|
171
171
|
[T]
|
|
172
172
|
);
|
|
173
|
-
return
|
|
173
|
+
return M === "error" ? /* @__PURE__ */ l(ie, { children: /* @__PURE__ */ H(Ge, { children: [
|
|
174
174
|
/* @__PURE__ */ l("span", { children: i("modal.filePreview.pdfUnavailable") }),
|
|
175
175
|
/* @__PURE__ */ l("a", { href: t, target: "_blank", rel: "noopener noreferrer", children: i("modal.filePreview.openExternally") })
|
|
176
|
-
] }) }) : /* @__PURE__ */
|
|
177
|
-
/* @__PURE__ */ l(Ze, { ref: E, children:
|
|
178
|
-
T > 1 && /* @__PURE__ */
|
|
176
|
+
] }) }) : /* @__PURE__ */ H(ie, { children: [
|
|
177
|
+
/* @__PURE__ */ l(Ze, { ref: E, children: M === "loading" ? /* @__PURE__ */ l(ve, { color: o?.colors?.primary }) : /* @__PURE__ */ l("canvas", { ref: u }) }),
|
|
178
|
+
T > 1 && /* @__PURE__ */ H(Ke, { children: [
|
|
179
179
|
/* @__PURE__ */ l(
|
|
180
180
|
ae,
|
|
181
181
|
{
|
|
@@ -185,7 +185,7 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
185
185
|
"aria-label": i("modal.filePreview.previousPage")
|
|
186
186
|
}
|
|
187
187
|
),
|
|
188
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ H("span", { children: [
|
|
189
189
|
x,
|
|
190
190
|
" / ",
|
|
191
191
|
T
|
|
@@ -201,7 +201,7 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
201
201
|
)
|
|
202
202
|
] })
|
|
203
203
|
] });
|
|
204
|
-
}, I = 1, ee = 6,
|
|
204
|
+
}, I = 1, ee = 6, Qe = 2.5, Je = 50, et = 300, se = 24, tt = 16e-4, G = (t, i, o) => Math.min(o, Math.max(i, t)), nt = X.div`
|
|
205
205
|
position: relative;
|
|
206
206
|
/* An explicit height, not flex growth alone: the parent lays its children
|
|
207
207
|
out in a row and centres them, so the viewport would otherwise be sized
|
|
@@ -235,37 +235,37 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
235
235
|
${ye}
|
|
236
236
|
`, fe = te.forwardRef(
|
|
237
237
|
({ src: t, alt: i, onSwipeLeft: o, onSwipeRight: E, onError: L, onScaleChange: u }, C) => {
|
|
238
|
-
const n = z(null),
|
|
238
|
+
const n = z(null), M = z(null), [p, T] = N(I), [b, x] = N({ x: 0, y: 0 }), [m, y] = N(!1), [Y, F] = N(!1), r = z({ scale: I, offset: { x: 0, y: 0 } });
|
|
239
239
|
r.current = { scale: p, offset: b };
|
|
240
240
|
const g = z(null), w = z(null), v = z(
|
|
241
241
|
null
|
|
242
|
-
),
|
|
243
|
-
const e = n.current, c =
|
|
242
|
+
), B = P((a) => {
|
|
243
|
+
const e = n.current, c = M.current;
|
|
244
244
|
if (!e) return { x: 0, y: 0 };
|
|
245
|
-
const s = e.clientWidth, d = e.clientHeight,
|
|
245
|
+
const s = e.clientWidth, d = e.clientHeight, k = c?.naturalWidth || 0, D = c?.naturalHeight || 0;
|
|
246
246
|
let j = s, Z = d;
|
|
247
|
-
if (
|
|
248
|
-
const K = Math.min(s /
|
|
249
|
-
j =
|
|
247
|
+
if (k > 0 && D > 0 && s > 0 && d > 0) {
|
|
248
|
+
const K = Math.min(s / k, d / D);
|
|
249
|
+
j = k * K, Z = D * K;
|
|
250
250
|
}
|
|
251
251
|
return {
|
|
252
252
|
x: Math.max(0, (j * a - s) / 2),
|
|
253
253
|
y: Math.max(0, (Z * a - d) / 2)
|
|
254
254
|
};
|
|
255
|
-
}, []), S =
|
|
255
|
+
}, []), S = P(
|
|
256
256
|
(a, e, c) => {
|
|
257
|
-
const s = G(a, I, ee), d =
|
|
257
|
+
const s = G(a, I, ee), d = B(s);
|
|
258
258
|
y(c), T(s), x({
|
|
259
259
|
x: G(e.x, -d.x, d.x),
|
|
260
260
|
y: G(e.y, -d.y, d.y)
|
|
261
261
|
});
|
|
262
262
|
},
|
|
263
|
-
[
|
|
264
|
-
),
|
|
263
|
+
[B]
|
|
264
|
+
), R = P(
|
|
265
265
|
(a, e, c, s) => {
|
|
266
|
-
const d = r.current,
|
|
266
|
+
const d = r.current, k = G(a, I, ee), D = k / d.scale;
|
|
267
267
|
S(
|
|
268
|
-
|
|
268
|
+
k,
|
|
269
269
|
{
|
|
270
270
|
x: e - (e - d.offset.x) * D,
|
|
271
271
|
y: c - (c - d.offset.y) * D
|
|
@@ -274,13 +274,13 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
274
274
|
);
|
|
275
275
|
},
|
|
276
276
|
[S]
|
|
277
|
-
), f =
|
|
277
|
+
), f = P(() => {
|
|
278
278
|
S(I, { x: 0, y: 0 }, !0);
|
|
279
|
-
}, [S]), h =
|
|
279
|
+
}, [S]), h = P(
|
|
280
280
|
(a) => {
|
|
281
|
-
|
|
281
|
+
R(r.current.scale * a, 0, 0, !0);
|
|
282
282
|
},
|
|
283
|
-
[
|
|
283
|
+
[R]
|
|
284
284
|
);
|
|
285
285
|
te.useImperativeHandle(
|
|
286
286
|
C,
|
|
@@ -299,12 +299,12 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
299
299
|
if (!a) return;
|
|
300
300
|
const e = (c) => {
|
|
301
301
|
c.preventDefault();
|
|
302
|
-
const s = a.getBoundingClientRect(), d = c.clientX - s.left - s.width / 2,
|
|
303
|
-
|
|
302
|
+
const s = a.getBoundingClientRect(), d = c.clientX - s.left - s.width / 2, k = c.clientY - s.top - s.height / 2, D = Math.exp(-c.deltaY * tt);
|
|
303
|
+
R(r.current.scale * D, d, k, !1);
|
|
304
304
|
};
|
|
305
305
|
return a.addEventListener("wheel", e, { passive: !1 }), () => a.removeEventListener("wheel", e);
|
|
306
|
-
}, [
|
|
307
|
-
const A =
|
|
306
|
+
}, [R]);
|
|
307
|
+
const A = P(
|
|
308
308
|
(a, e) => {
|
|
309
309
|
const c = n.current;
|
|
310
310
|
if (!c) return;
|
|
@@ -313,15 +313,15 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
315
|
const s = c.getBoundingClientRect();
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
R(
|
|
317
|
+
Qe,
|
|
318
318
|
a - s.left - s.width / 2,
|
|
319
319
|
e - s.top - s.height / 2,
|
|
320
320
|
!0
|
|
321
321
|
);
|
|
322
322
|
},
|
|
323
|
-
[f,
|
|
324
|
-
), _ =
|
|
323
|
+
[f, R]
|
|
324
|
+
), _ = P((a) => {
|
|
325
325
|
a.button === 0 && (r.current.scale <= I || (a.preventDefault(), g.current = { x: a.clientX, y: a.clientY }, F(!0)));
|
|
326
326
|
}, []);
|
|
327
327
|
O(() => {
|
|
@@ -345,7 +345,7 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
345
345
|
window.removeEventListener("mousemove", a), window.removeEventListener("mouseup", e);
|
|
346
346
|
};
|
|
347
347
|
}, [Y, S]);
|
|
348
|
-
const
|
|
348
|
+
const q = P((a) => {
|
|
349
349
|
if (a.touches.length === 2) {
|
|
350
350
|
const [c, s] = [a.touches[0], a.touches[1]];
|
|
351
351
|
w.current = {
|
|
@@ -374,19 +374,19 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
374
374
|
panning: r.current.scale > I,
|
|
375
375
|
moved: !1
|
|
376
376
|
});
|
|
377
|
-
}, []), W =
|
|
377
|
+
}, []), W = P(
|
|
378
378
|
(a) => {
|
|
379
379
|
const e = w.current;
|
|
380
380
|
if (!e) return;
|
|
381
381
|
if (a.touches.length === 2 && e.pinchDistance > 0) {
|
|
382
|
-
const [s, d] = [a.touches[0], a.touches[1]],
|
|
382
|
+
const [s, d] = [a.touches[0], a.touches[1]], k = Math.hypot(
|
|
383
383
|
s.clientX - d.clientX,
|
|
384
384
|
s.clientY - d.clientY
|
|
385
385
|
), D = n.current;
|
|
386
|
-
if (!D ||
|
|
386
|
+
if (!D || k <= 0) return;
|
|
387
387
|
const j = D.getBoundingClientRect(), Z = (s.clientX + d.clientX) / 2 - j.left - j.width / 2, K = (s.clientY + d.clientY) / 2 - j.top - j.height / 2;
|
|
388
|
-
e.moved = !0,
|
|
389
|
-
e.pinchScale *
|
|
388
|
+
e.moved = !0, R(
|
|
389
|
+
e.pinchScale * k / e.pinchDistance,
|
|
390
390
|
Z,
|
|
391
391
|
K,
|
|
392
392
|
!1
|
|
@@ -409,14 +409,14 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
409
409
|
e.lastX = c.clientX, e.lastY = c.clientY;
|
|
410
410
|
}
|
|
411
411
|
},
|
|
412
|
-
[S,
|
|
413
|
-
), U =
|
|
412
|
+
[S, R]
|
|
413
|
+
), U = P(
|
|
414
414
|
(a) => {
|
|
415
415
|
const e = w.current;
|
|
416
416
|
if (!e || a.touches.length > 0) return;
|
|
417
417
|
if (w.current = null, !e.moved && e.pinchDistance === 0) {
|
|
418
|
-
const d = Date.now(),
|
|
419
|
-
if (
|
|
418
|
+
const d = Date.now(), k = v.current;
|
|
419
|
+
if (k && d - k.time < et && Math.abs(k.x - e.startX) < se && Math.abs(k.y - e.startY) < se) {
|
|
420
420
|
v.current = null, A(e.startX, e.startY);
|
|
421
421
|
return;
|
|
422
422
|
}
|
|
@@ -432,7 +432,7 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
432
432
|
Math.abs(c) < Je || Math.abs(c) <= Math.abs(s) || (c < 0 ? o?.() : E?.());
|
|
433
433
|
},
|
|
434
434
|
[o, E, A]
|
|
435
|
-
), me =
|
|
435
|
+
), me = P(
|
|
436
436
|
(a) => {
|
|
437
437
|
A(a.clientX, a.clientY);
|
|
438
438
|
},
|
|
@@ -448,14 +448,14 @@ const Ve = ["x", "y", "top", "bottom", "left", "right", "width", "height"], We =
|
|
|
448
448
|
"data-testid": "image-lightbox-viewport",
|
|
449
449
|
onMouseDown: _,
|
|
450
450
|
onDoubleClick: me,
|
|
451
|
-
onTouchStart:
|
|
451
|
+
onTouchStart: q,
|
|
452
452
|
onTouchMove: W,
|
|
453
453
|
onTouchEnd: U,
|
|
454
454
|
onTouchCancel: U,
|
|
455
455
|
children: /* @__PURE__ */ l(
|
|
456
456
|
rt,
|
|
457
457
|
{
|
|
458
|
-
ref:
|
|
458
|
+
ref: M,
|
|
459
459
|
"data-testid": "image-lightbox-image",
|
|
460
460
|
src: t,
|
|
461
461
|
alt: i,
|
|
@@ -536,19 +536,19 @@ const ot = (t) => {
|
|
|
536
536
|
`, gt = ({
|
|
537
537
|
handleCloseModal: t
|
|
538
538
|
}) => {
|
|
539
|
-
const i = Ce(), o = le(), E =
|
|
539
|
+
const i = Ce(), o = le(), E = Me(), { activeFile: L } = Q(
|
|
540
540
|
(f) => f.chatSettingStore
|
|
541
541
|
), u = $(
|
|
542
542
|
() => L ?? { fileName: "", fileURL: "", mimetype: "" },
|
|
543
543
|
[L]
|
|
544
|
-
), C =
|
|
544
|
+
), C = Q(
|
|
545
545
|
(f) => f.chatSettingStore.user?.fileToken || ""
|
|
546
|
-
), n =
|
|
547
|
-
(f) =>
|
|
548
|
-
),
|
|
546
|
+
), n = Q(
|
|
547
|
+
(f) => Re(f)?.messages
|
|
548
|
+
), M = z(null), [p, T] = N(I), b = ue(u?.mimetype, u?.fileName), x = $(() => ot(n), [n]), m = $(
|
|
549
549
|
() => b === "image" ? it(x, u) : -1,
|
|
550
550
|
[x, u, b]
|
|
551
|
-
), y = m >= 0 && x.length > 1, Y = y && m > 0, F = y && m < x.length - 1, r =
|
|
551
|
+
), y = m >= 0 && x.length > 1, Y = y && m > 0, F = y && m < x.length - 1, r = P(
|
|
552
552
|
(f) => {
|
|
553
553
|
const h = x[f];
|
|
554
554
|
h && i(
|
|
@@ -560,9 +560,9 @@ const ot = (t) => {
|
|
|
560
560
|
);
|
|
561
561
|
},
|
|
562
562
|
[i, x]
|
|
563
|
-
), g =
|
|
563
|
+
), g = P(() => {
|
|
564
564
|
Y && r(m - 1);
|
|
565
|
-
}, [r, Y, m]), w =
|
|
565
|
+
}, [r, Y, m]), w = P(() => {
|
|
566
566
|
F && r(m + 1);
|
|
567
567
|
}, [r, F, m]);
|
|
568
568
|
O(() => {
|
|
@@ -575,29 +575,29 @@ const ot = (t) => {
|
|
|
575
575
|
return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
|
|
576
576
|
}, [y, g, w]);
|
|
577
577
|
const v = () => {
|
|
578
|
-
fetch(
|
|
578
|
+
fetch(He(u.fileURL), {
|
|
579
579
|
method: "GET",
|
|
580
580
|
headers: {}
|
|
581
581
|
}).then((f) => {
|
|
582
|
-
const _ = !!
|
|
583
|
-
f.arrayBuffer().then(function(
|
|
582
|
+
const _ = !!Ne(u.fileName) ? u.fileName : `MEDIA-ETHORA.${b === "image" ? "png" : b === "video" ? "mp4" : "bin"}`;
|
|
583
|
+
f.arrayBuffer().then(function(q) {
|
|
584
584
|
if (typeof window > "u")
|
|
585
585
|
return;
|
|
586
|
-
const W = window.URL.createObjectURL(new Blob([
|
|
586
|
+
const W = window.URL.createObjectURL(new Blob([q])), U = document.createElement("a");
|
|
587
587
|
U.href = W, U.setAttribute("download", _), document.body.appendChild(U), U.click(), U.remove(), window.URL.revokeObjectURL(W);
|
|
588
588
|
});
|
|
589
589
|
}).catch((f) => {
|
|
590
590
|
Ue.log(f);
|
|
591
591
|
});
|
|
592
|
-
},
|
|
592
|
+
}, B = () => {
|
|
593
593
|
i(re(void 0)), t?.();
|
|
594
|
-
}, S = u?.fileName || o("modal.filePreview.imageAlt"),
|
|
594
|
+
}, S = u?.fileName || o("modal.filePreview.imageAlt"), R = $(() => {
|
|
595
595
|
switch (b) {
|
|
596
596
|
case "image":
|
|
597
597
|
return /* @__PURE__ */ l(
|
|
598
598
|
fe,
|
|
599
599
|
{
|
|
600
|
-
ref:
|
|
600
|
+
ref: M,
|
|
601
601
|
src: J(u.fileURL, C) || ce,
|
|
602
602
|
alt: S,
|
|
603
603
|
onScaleChange: T,
|
|
@@ -610,7 +610,7 @@ const ot = (t) => {
|
|
|
610
610
|
);
|
|
611
611
|
case "video":
|
|
612
612
|
return /* @__PURE__ */ l(
|
|
613
|
-
|
|
613
|
+
Pe,
|
|
614
614
|
{
|
|
615
615
|
src: J(u.fileURL, C),
|
|
616
616
|
controls: !0,
|
|
@@ -618,9 +618,9 @@ const ot = (t) => {
|
|
|
618
618
|
}
|
|
619
619
|
);
|
|
620
620
|
case "pdf":
|
|
621
|
-
return /* @__PURE__ */ l(
|
|
621
|
+
return /* @__PURE__ */ l(qe, { pdfUrl: J(u.fileURL, C) });
|
|
622
622
|
default:
|
|
623
|
-
return /* @__PURE__ */
|
|
623
|
+
return /* @__PURE__ */ H(
|
|
624
624
|
"div",
|
|
625
625
|
{
|
|
626
626
|
style: {
|
|
@@ -630,7 +630,7 @@ const ot = (t) => {
|
|
|
630
630
|
alignItems: "center"
|
|
631
631
|
},
|
|
632
632
|
children: [
|
|
633
|
-
/* @__PURE__ */ l(
|
|
633
|
+
/* @__PURE__ */ l(ke, { style: { minWidth: "100px", minHeight: "100px" } }),
|
|
634
634
|
/* @__PURE__ */ l(
|
|
635
635
|
"div",
|
|
636
636
|
{
|
|
@@ -649,7 +649,7 @@ const ot = (t) => {
|
|
|
649
649
|
);
|
|
650
650
|
}
|
|
651
651
|
}, [u, C, S, b, w, g, o]);
|
|
652
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ H(
|
|
653
653
|
Ae,
|
|
654
654
|
{
|
|
655
655
|
"aria-label": o("modal.filePreview.title"),
|
|
@@ -658,18 +658,18 @@ const ot = (t) => {
|
|
|
658
658
|
/* @__PURE__ */ l(
|
|
659
659
|
Ie,
|
|
660
660
|
{
|
|
661
|
-
handleCloseModal:
|
|
661
|
+
handleCloseModal: B,
|
|
662
662
|
headerTitle: o("modal.filePreview.title"),
|
|
663
|
-
rightMenu: /* @__PURE__ */
|
|
663
|
+
rightMenu: /* @__PURE__ */ H(lt, { children: [
|
|
664
664
|
y && /* @__PURE__ */ l(dt, { "data-testid": "lightbox-position", "aria-live": "polite", children: o("modal.filePreview.position", {
|
|
665
665
|
current: m + 1,
|
|
666
666
|
total: x.length
|
|
667
667
|
}) }),
|
|
668
|
-
b === "image" && /* @__PURE__ */
|
|
668
|
+
b === "image" && /* @__PURE__ */ H(ut, { children: [
|
|
669
669
|
/* @__PURE__ */ l(
|
|
670
670
|
V,
|
|
671
671
|
{
|
|
672
|
-
onClick: () =>
|
|
672
|
+
onClick: () => M.current?.zoomOut(),
|
|
673
673
|
disabled: p <= I,
|
|
674
674
|
"aria-label": o("modal.filePreview.zoomOut"),
|
|
675
675
|
children: /* @__PURE__ */ l(Xe, {})
|
|
@@ -678,7 +678,7 @@ const ot = (t) => {
|
|
|
678
678
|
/* @__PURE__ */ l(
|
|
679
679
|
V,
|
|
680
680
|
{
|
|
681
|
-
onClick: () =>
|
|
681
|
+
onClick: () => M.current?.zoomIn(),
|
|
682
682
|
disabled: p >= ee,
|
|
683
683
|
"aria-label": o("modal.filePreview.zoomIn"),
|
|
684
684
|
children: /* @__PURE__ */ l(Ye, {})
|
|
@@ -687,7 +687,7 @@ const ot = (t) => {
|
|
|
687
687
|
/* @__PURE__ */ l(
|
|
688
688
|
V,
|
|
689
689
|
{
|
|
690
|
-
onClick: () =>
|
|
690
|
+
onClick: () => M.current?.reset(),
|
|
691
691
|
disabled: p <= I,
|
|
692
692
|
"aria-label": o("modal.filePreview.resetZoom"),
|
|
693
693
|
children: /* @__PURE__ */ l(ze, {})
|
|
@@ -711,7 +711,7 @@ const ot = (t) => {
|
|
|
711
711
|
padding: "16px",
|
|
712
712
|
width: "90%"
|
|
713
713
|
},
|
|
714
|
-
children: /* @__PURE__ */
|
|
714
|
+
children: /* @__PURE__ */ H(at, { children: [
|
|
715
715
|
y && /* @__PURE__ */ l(
|
|
716
716
|
st,
|
|
717
717
|
{
|
|
@@ -721,14 +721,14 @@ const ot = (t) => {
|
|
|
721
721
|
children: /* @__PURE__ */ l(Fe, {})
|
|
722
722
|
}
|
|
723
723
|
),
|
|
724
|
-
|
|
724
|
+
R,
|
|
725
725
|
y && /* @__PURE__ */ l(
|
|
726
726
|
ct,
|
|
727
727
|
{
|
|
728
728
|
onClick: w,
|
|
729
729
|
disabled: !F,
|
|
730
730
|
"aria-label": o("modal.filePreview.nextImage"),
|
|
731
|
-
children: /* @__PURE__ */ l(
|
|
731
|
+
children: /* @__PURE__ */ l(Be, {})
|
|
732
732
|
}
|
|
733
733
|
)
|
|
734
734
|
] })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as o, Fragment as T, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { useState as m, useCallback as M } from "react";
|
|
3
|
-
import { ay as B, x as t, az as I, aA as w, B as j, u as z, p as E, J as F, aB as R, L as U, w as x, aC as A, aD as $, aE as O, aF as H } from "./main-
|
|
4
|
-
import { S as J, D as f, a as u, b as D, e as v, f as b } from "./SideDrawer-
|
|
3
|
+
import { ay as B, x as t, az as I, aA as w, B as j, u as z, p as E, J as F, aB as R, L as U, w as x, aC as A, aD as $, aE as O, aF as H } from "./main-rJpE4hh-.js";
|
|
4
|
+
import { S as J, D as f, a as u, b as D, e as v, f as b } from "./SideDrawer-WneDrrWG.js";
|
|
5
5
|
t(I)`
|
|
6
6
|
display: flex;
|
|
7
7
|
box-sizing: border-box;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as fs, jsx as ie, Fragment as hs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { o as ei } from "./main-
|
|
3
|
+
import { o as ei } from "./main-rJpE4hh-.js";
|
|
4
4
|
function zr(e) {
|
|
5
5
|
const t = [], n = String(e || "");
|
|
6
6
|
let r = n.indexOf(","), u = 0, i = !1;
|