react-smart-image-viewer 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,649 @@
1
+ import { jsxs as R, jsx as o, Fragment as we } from "react/jsx-runtime";
2
+ import { useRef as G, useCallback as a, useEffect as B, useState as z, useMemo as re } from "react";
3
+ function be(e) {
4
+ return typeof e == "string" ? { src: e, alt: "" } : e;
5
+ }
6
+ function xe(e) {
7
+ return (Array.isArray(e) ? e : [e]).map(be);
8
+ }
9
+ function j(e, n, r) {
10
+ return Math.min(Math.max(e, n), r);
11
+ }
12
+ function J(e) {
13
+ if (e.length < 2) return 0;
14
+ const n = e[0].clientX - e[1].clientX, r = e[0].clientY - e[1].clientY;
15
+ return Math.sqrt(n * n + r * r);
16
+ }
17
+ function Q(e) {
18
+ var n, r;
19
+ return e.length < 2 ? { x: ((n = e[0]) == null ? void 0 : n.clientX) ?? 0, y: ((r = e[0]) == null ? void 0 : r.clientY) ?? 0 } : {
20
+ x: (e[0].clientX + e[1].clientX) / 2,
21
+ y: (e[0].clientY + e[1].clientY) / 2
22
+ };
23
+ }
24
+ function ke() {
25
+ if (typeof document > "u")
26
+ return () => {
27
+ };
28
+ const e = document.body.style.overflow, n = document.body.style.paddingRight, r = window.innerWidth - document.documentElement.clientWidth;
29
+ return document.body.style.overflow = "hidden", r > 0 && (document.body.style.paddingRight = `${r}px`), () => {
30
+ document.body.style.overflow = e, document.body.style.paddingRight = n;
31
+ };
32
+ }
33
+ function ee(e) {
34
+ let n = null, r = null;
35
+ return (...f) => {
36
+ r = f, n === null && (n = requestAnimationFrame(() => {
37
+ r && e(...r), n = null;
38
+ }));
39
+ };
40
+ }
41
+ function Ae() {
42
+ return typeof window > "u" ? !1 : "ontouchstart" in window || navigator.maxTouchPoints > 0;
43
+ }
44
+ let Le = 0;
45
+ function te(e = "rsiv") {
46
+ return `${e}-${++Le}`;
47
+ }
48
+ function De() {
49
+ return typeof window > "u";
50
+ }
51
+ const Ye = [
52
+ "button:not([disabled])",
53
+ "[href]",
54
+ "input:not([disabled])",
55
+ "select:not([disabled])",
56
+ "textarea:not([disabled])",
57
+ '[tabindex]:not([tabindex="-1"])'
58
+ ].join(",");
59
+ function Xe(e) {
60
+ const n = G(null), r = G(null), f = a(() => n.current ? Array.from(
61
+ n.current.querySelectorAll(Ye)
62
+ ) : [], []), v = a((t) => {
63
+ if (t.key !== "Tab") return;
64
+ const y = f();
65
+ if (y.length === 0) return;
66
+ const k = y[0], w = y[y.length - 1];
67
+ t.shiftKey ? document.activeElement === k && (t.preventDefault(), w.focus()) : document.activeElement === w && (t.preventDefault(), k.focus());
68
+ }, [f]);
69
+ return B(() => {
70
+ if (!e) return;
71
+ r.current = document.activeElement;
72
+ const t = f();
73
+ return t.length > 0 && requestAnimationFrame(() => {
74
+ t[0].focus();
75
+ }), document.addEventListener("keydown", v), () => {
76
+ document.removeEventListener("keydown", v), r.current instanceof HTMLElement && r.current.focus();
77
+ };
78
+ }, [e, f, v]), n;
79
+ }
80
+ const ne = {
81
+ scale: 1,
82
+ translateX: 0,
83
+ translateY: 0
84
+ };
85
+ function Pe(e) {
86
+ const { minZoom: n, maxZoom: r, zoomStep: f, onZoomChange: v } = e, [t, y] = z(ne), [k, w] = z(!1), b = G(null), P = G(null), c = G({
87
+ isGesturing: !1,
88
+ startDistance: 0,
89
+ startScale: 1,
90
+ lastPosition: null,
91
+ pinchCenter: null
92
+ });
93
+ B(() => {
94
+ v == null || v(t.scale);
95
+ }, [t.scale, v]);
96
+ const m = a((s) => {
97
+ y((u) => {
98
+ const h = { ...u, ...s };
99
+ return h.scale = j(h.scale, n, r), h;
100
+ });
101
+ }, [n, r]), M = a(() => {
102
+ m({ scale: t.scale + f });
103
+ }, [t.scale, f, m]), D = a(() => {
104
+ m({ scale: t.scale - f });
105
+ }, [t.scale, f, m]), Y = a(() => {
106
+ y(ne);
107
+ }, []), E = a((s) => {
108
+ const u = j(s, n, r);
109
+ y({
110
+ scale: u,
111
+ translateX: 0,
112
+ translateY: 0
113
+ });
114
+ }, [n, r]), T = a((s) => {
115
+ s.preventDefault();
116
+ const u = s.deltaY > 0 ? -f * 0.5 : f * 0.5, h = j(t.scale + u, n, r);
117
+ if (b.current) {
118
+ const i = b.current.getBoundingClientRect(), p = s.clientX - i.left - i.width / 2, g = s.clientY - i.top - i.height / 2, l = h / t.scale, d = t.translateX * l - p * (l - 1), S = t.translateY * l - g * (l - 1);
119
+ y({
120
+ scale: h,
121
+ translateX: d,
122
+ translateY: S
123
+ });
124
+ } else
125
+ m({ scale: h });
126
+ }, [t, f, n, r, m]), A = a((s) => {
127
+ if (s.preventDefault(), t.scale > 1)
128
+ Y();
129
+ else {
130
+ const u = Math.min(2, r);
131
+ if (b.current) {
132
+ const h = b.current.getBoundingClientRect(), i = s.clientX - h.left - h.width / 2, p = s.clientY - h.top - h.height / 2;
133
+ y({
134
+ scale: u,
135
+ translateX: -i * (u - 1),
136
+ translateY: -p * (u - 1)
137
+ });
138
+ } else
139
+ m({ scale: u });
140
+ }
141
+ }, [t.scale, r, Y, m]), L = a((s) => {
142
+ if (s.button !== 0 || t.scale <= 1) return;
143
+ s.preventDefault(), w(!0), c.current.lastPosition = { x: s.clientX, y: s.clientY };
144
+ const u = ee((i) => {
145
+ if (!c.current.lastPosition) return;
146
+ const p = i.clientX - c.current.lastPosition.x, g = i.clientY - c.current.lastPosition.y;
147
+ y((l) => ({
148
+ ...l,
149
+ translateX: l.translateX + p,
150
+ translateY: l.translateY + g
151
+ })), c.current.lastPosition = { x: i.clientX, y: i.clientY };
152
+ }), h = () => {
153
+ w(!1), c.current.lastPosition = null, document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", h);
154
+ };
155
+ document.addEventListener("mousemove", u), document.addEventListener("mouseup", h);
156
+ }, [t.scale]), Z = a((s) => {
157
+ s.touches.length === 2 ? (s.preventDefault(), c.current = {
158
+ isGesturing: !0,
159
+ startDistance: J(s.touches),
160
+ startScale: t.scale,
161
+ lastPosition: null,
162
+ pinchCenter: Q(s.touches)
163
+ }) : s.touches.length === 1 && t.scale > 1 && (c.current.lastPosition = {
164
+ x: s.touches[0].clientX,
165
+ y: s.touches[0].clientY
166
+ }, w(!0));
167
+ const u = ee((i) => {
168
+ if (i.touches.length === 2 && c.current.isGesturing) {
169
+ i.preventDefault();
170
+ const g = J(i.touches) / c.current.startDistance * c.current.startScale, l = j(g, n, r), d = Q(i.touches);
171
+ if (c.current.pinchCenter && b.current) {
172
+ const S = b.current.getBoundingClientRect(), x = c.current.pinchCenter.x - S.left - S.width / 2, O = c.current.pinchCenter.y - S.top - S.height / 2, C = l / t.scale;
173
+ y({
174
+ scale: l,
175
+ translateX: t.translateX * C - x * (C - 1) + (d.x - c.current.pinchCenter.x),
176
+ translateY: t.translateY * C - O * (C - 1) + (d.y - c.current.pinchCenter.y)
177
+ });
178
+ } else
179
+ m({ scale: l });
180
+ } else if (i.touches.length === 1 && c.current.lastPosition) {
181
+ const p = i.touches[0], g = p.clientX - c.current.lastPosition.x, l = p.clientY - c.current.lastPosition.y;
182
+ y((d) => ({
183
+ ...d,
184
+ translateX: d.translateX + g,
185
+ translateY: d.translateY + l
186
+ })), c.current.lastPosition = { x: p.clientX, y: p.clientY };
187
+ }
188
+ }), h = (i) => {
189
+ i.touches.length === 0 ? (c.current = {
190
+ isGesturing: !1,
191
+ startDistance: 0,
192
+ startScale: 1,
193
+ lastPosition: null,
194
+ pinchCenter: null
195
+ }, w(!1), document.removeEventListener("touchmove", u), document.removeEventListener("touchend", h)) : i.touches.length === 1 && (c.current.isGesturing = !1, c.current.lastPosition = {
196
+ x: i.touches[0].clientX,
197
+ y: i.touches[0].clientY
198
+ });
199
+ };
200
+ document.addEventListener("touchmove", u, { passive: !1 }), document.addEventListener("touchend", h);
201
+ }, [t, n, r, m]);
202
+ return {
203
+ transform: t,
204
+ isDragging: k,
205
+ zoomIn: M,
206
+ zoomOut: D,
207
+ resetZoom: Y,
208
+ setZoom: E,
209
+ handleWheel: T,
210
+ handleMouseDown: L,
211
+ handleTouchStart: Z,
212
+ handleDoubleClick: A,
213
+ containerRef: b,
214
+ imageRef: P
215
+ };
216
+ }
217
+ const Te = (e) => /* @__PURE__ */ R(
218
+ "svg",
219
+ {
220
+ xmlns: "http://www.w3.org/2000/svg",
221
+ viewBox: "0 0 24 24",
222
+ fill: "none",
223
+ stroke: "currentColor",
224
+ strokeLinecap: "round",
225
+ strokeLinejoin: "round",
226
+ ...e,
227
+ children: [
228
+ /* @__PURE__ */ o("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
229
+ /* @__PURE__ */ o("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
230
+ ]
231
+ }
232
+ ), Se = (e) => /* @__PURE__ */ R(
233
+ "svg",
234
+ {
235
+ xmlns: "http://www.w3.org/2000/svg",
236
+ viewBox: "0 0 24 24",
237
+ fill: "none",
238
+ stroke: "currentColor",
239
+ strokeLinecap: "round",
240
+ strokeLinejoin: "round",
241
+ ...e,
242
+ children: [
243
+ /* @__PURE__ */ o("circle", { cx: "11", cy: "11", r: "8" }),
244
+ /* @__PURE__ */ o("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
245
+ /* @__PURE__ */ o("line", { x1: "11", y1: "8", x2: "11", y2: "14" }),
246
+ /* @__PURE__ */ o("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
247
+ ]
248
+ }
249
+ ), Re = (e) => /* @__PURE__ */ R(
250
+ "svg",
251
+ {
252
+ xmlns: "http://www.w3.org/2000/svg",
253
+ viewBox: "0 0 24 24",
254
+ fill: "none",
255
+ stroke: "currentColor",
256
+ strokeLinecap: "round",
257
+ strokeLinejoin: "round",
258
+ ...e,
259
+ children: [
260
+ /* @__PURE__ */ o("circle", { cx: "11", cy: "11", r: "8" }),
261
+ /* @__PURE__ */ o("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
262
+ /* @__PURE__ */ o("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
263
+ ]
264
+ }
265
+ ), Ee = (e) => /* @__PURE__ */ R(
266
+ "svg",
267
+ {
268
+ xmlns: "http://www.w3.org/2000/svg",
269
+ viewBox: "0 0 24 24",
270
+ fill: "none",
271
+ stroke: "currentColor",
272
+ strokeLinecap: "round",
273
+ strokeLinejoin: "round",
274
+ ...e,
275
+ children: [
276
+ /* @__PURE__ */ o("polyline", { points: "1 4 1 10 7 10" }),
277
+ /* @__PURE__ */ o("path", { d: "M3.51 15a9 9 0 1 0 2.13-9.36L1 10" })
278
+ ]
279
+ }
280
+ ), Ce = (e) => /* @__PURE__ */ o(
281
+ "svg",
282
+ {
283
+ xmlns: "http://www.w3.org/2000/svg",
284
+ viewBox: "0 0 24 24",
285
+ fill: "none",
286
+ stroke: "currentColor",
287
+ strokeLinecap: "round",
288
+ strokeLinejoin: "round",
289
+ ...e,
290
+ children: /* @__PURE__ */ o("polyline", { points: "15 18 9 12 15 6" })
291
+ }
292
+ ), Ie = (e) => /* @__PURE__ */ o(
293
+ "svg",
294
+ {
295
+ xmlns: "http://www.w3.org/2000/svg",
296
+ viewBox: "0 0 24 24",
297
+ fill: "none",
298
+ stroke: "currentColor",
299
+ strokeLinecap: "round",
300
+ strokeLinejoin: "round",
301
+ ...e,
302
+ children: /* @__PURE__ */ o("polyline", { points: "9 18 15 12 9 6" })
303
+ }
304
+ ), Ne = ({
305
+ images: e,
306
+ initialIndex: n = 0,
307
+ isOpen: r,
308
+ defaultOpen: f = !1,
309
+ onClose: v,
310
+ onIndexChange: t,
311
+ zoomStep: y = 0.5,
312
+ minZoom: k = 0.5,
313
+ maxZoom: w = 4,
314
+ showControls: b = !0,
315
+ showNavigation: P = !0,
316
+ showCounter: c = !0,
317
+ closeOnOverlayClick: m = !0,
318
+ closeOnEscape: M = !0,
319
+ enableKeyboardNavigation: D = !0,
320
+ loop: Y = !1,
321
+ className: E = "",
322
+ imageClassName: T = "",
323
+ animationDuration: A = 200,
324
+ ariaLabel: L = "Image viewer",
325
+ renderControls: Z,
326
+ renderNavigation: s
327
+ }) => {
328
+ const u = r !== void 0, [h, i] = z(f), p = u ? r : h, g = re(() => xe(e), [e]), l = g.length > 1, [d, S] = z(n), x = g[d], [O, C] = z(!0), se = G(te("rsiv-viewer")), _ = G(te("rsiv-title")), {
329
+ transform: I,
330
+ isDragging: oe,
331
+ zoomIn: W,
332
+ zoomOut: q,
333
+ resetZoom: N,
334
+ handleWheel: le,
335
+ handleMouseDown: ce,
336
+ handleTouchStart: ie,
337
+ handleDoubleClick: ae,
338
+ containerRef: ue,
339
+ imageRef: de
340
+ } = Pe({
341
+ minZoom: k,
342
+ maxZoom: w,
343
+ zoomStep: y
344
+ }), fe = Xe(p);
345
+ B(() => {
346
+ De() || document.documentElement.style.setProperty(
347
+ "--rsiv-animation-duration",
348
+ `${A}ms`
349
+ );
350
+ }, [A]), B(() => {
351
+ if (p)
352
+ return ke();
353
+ }, [p]), B(() => {
354
+ N(), C(!0);
355
+ }, [d, N]), B(() => {
356
+ n !== d && n >= 0 && n < g.length && S(n);
357
+ }, [n, g.length]);
358
+ const F = a(() => {
359
+ u || i(!1), N(), v == null || v();
360
+ }, [u, v, N]), V = Y || d < g.length - 1, U = Y || d > 0, H = a(() => {
361
+ if (!V) return;
362
+ const X = d < g.length - 1 ? d + 1 : 0;
363
+ S(X), t == null || t(X);
364
+ }, [d, g.length, V, t]), K = a(() => {
365
+ if (!U) return;
366
+ const X = d > 0 ? d - 1 : g.length - 1;
367
+ S(X), t == null || t(X);
368
+ }, [d, g.length, U, t]);
369
+ B(() => {
370
+ if (!p) return;
371
+ const X = ($) => {
372
+ switch ($.key) {
373
+ case "Escape":
374
+ M && ($.preventDefault(), F());
375
+ break;
376
+ case "ArrowLeft":
377
+ D && l && ($.preventDefault(), K());
378
+ break;
379
+ case "ArrowRight":
380
+ D && l && ($.preventDefault(), H());
381
+ break;
382
+ case "+":
383
+ case "=":
384
+ $.preventDefault(), W();
385
+ break;
386
+ case "-":
387
+ $.preventDefault(), q();
388
+ break;
389
+ case "0":
390
+ $.preventDefault(), N();
391
+ break;
392
+ }
393
+ };
394
+ return document.addEventListener("keydown", X), () => document.removeEventListener("keydown", X);
395
+ }, [
396
+ p,
397
+ M,
398
+ D,
399
+ l,
400
+ F,
401
+ H,
402
+ K,
403
+ W,
404
+ q,
405
+ N
406
+ ]);
407
+ const me = a((X) => {
408
+ m && X.target === X.currentTarget && F();
409
+ }, [m, F]), he = a(() => {
410
+ C(!1);
411
+ }, []), ge = a(() => {
412
+ C(!1);
413
+ }, []), pe = {
414
+ transform: `translate(${I.translateX}px, ${I.translateY}px) scale(${I.scale})`,
415
+ transition: oe ? "none" : void 0
416
+ };
417
+ if (!p)
418
+ return null;
419
+ const ve = {
420
+ zoomIn: W,
421
+ zoomOut: q,
422
+ resetZoom: N,
423
+ currentZoom: I.scale,
424
+ minZoom: k,
425
+ maxZoom: w,
426
+ close: F
427
+ }, ye = {
428
+ goToPrevious: K,
429
+ goToNext: H,
430
+ currentIndex: d,
431
+ totalImages: g.length,
432
+ canGoPrevious: U,
433
+ canGoNext: V
434
+ };
435
+ return /* @__PURE__ */ R(
436
+ "div",
437
+ {
438
+ ref: fe,
439
+ className: `rsiv-overlay ${E}`,
440
+ "data-open": p,
441
+ role: "dialog",
442
+ "aria-modal": "true",
443
+ "aria-label": L,
444
+ "aria-labelledby": x != null && x.title ? _.current : void 0,
445
+ id: se.current,
446
+ onClick: me,
447
+ children: [
448
+ /* @__PURE__ */ o(
449
+ "button",
450
+ {
451
+ className: "rsiv-button rsiv-close",
452
+ onClick: F,
453
+ "aria-label": "Close image viewer",
454
+ type: "button",
455
+ children: /* @__PURE__ */ o(Te, { "aria-hidden": !0 })
456
+ }
457
+ ),
458
+ (x == null ? void 0 : x.title) && /* @__PURE__ */ o("div", { className: "rsiv-title", id: _.current, children: x.title }),
459
+ /* @__PURE__ */ R(
460
+ "div",
461
+ {
462
+ ref: ue,
463
+ className: "rsiv-container",
464
+ onWheel: le,
465
+ onTouchStart: ie,
466
+ children: [
467
+ O && /* @__PURE__ */ o("div", { className: "rsiv-loader", "aria-label": "Loading image" }),
468
+ /* @__PURE__ */ o("div", { className: "rsiv-image-wrapper", style: pe, children: x && /* @__PURE__ */ o(
469
+ "img",
470
+ {
471
+ ref: de,
472
+ src: x.src,
473
+ alt: x.alt || "",
474
+ className: `rsiv-image ${T}`,
475
+ "data-loading": O,
476
+ "data-zoomed": I.scale > 1,
477
+ onLoad: he,
478
+ onError: ge,
479
+ onMouseDown: ce,
480
+ onDoubleClick: ae,
481
+ draggable: !1
482
+ }
483
+ ) })
484
+ ]
485
+ }
486
+ ),
487
+ l && P && (s ? s(ye) : /* @__PURE__ */ R(we, { children: [
488
+ /* @__PURE__ */ o(
489
+ "button",
490
+ {
491
+ className: "rsiv-button rsiv-nav rsiv-nav-prev",
492
+ onClick: K,
493
+ disabled: !U,
494
+ "aria-label": "Previous image",
495
+ type: "button",
496
+ children: /* @__PURE__ */ o(Ce, { "aria-hidden": !0 })
497
+ }
498
+ ),
499
+ /* @__PURE__ */ o(
500
+ "button",
501
+ {
502
+ className: "rsiv-button rsiv-nav rsiv-nav-next",
503
+ onClick: H,
504
+ disabled: !V,
505
+ "aria-label": "Next image",
506
+ type: "button",
507
+ children: /* @__PURE__ */ o(Ie, { "aria-hidden": !0 })
508
+ }
509
+ )
510
+ ] })),
511
+ l && c && /* @__PURE__ */ R("div", { className: "rsiv-counter", "aria-live": "polite", children: [
512
+ d + 1,
513
+ " / ",
514
+ g.length
515
+ ] }),
516
+ b && (Z ? Z(ve) : /* @__PURE__ */ R("div", { className: "rsiv-zoom-controls", children: [
517
+ /* @__PURE__ */ o(
518
+ "button",
519
+ {
520
+ className: "rsiv-button",
521
+ onClick: q,
522
+ disabled: I.scale <= k,
523
+ "aria-label": "Zoom out",
524
+ type: "button",
525
+ children: /* @__PURE__ */ o(Re, { "aria-hidden": !0 })
526
+ }
527
+ ),
528
+ /* @__PURE__ */ o(
529
+ "button",
530
+ {
531
+ className: "rsiv-button",
532
+ onClick: N,
533
+ disabled: I.scale === 1,
534
+ "aria-label": "Reset zoom",
535
+ type: "button",
536
+ children: /* @__PURE__ */ o(Ee, { "aria-hidden": !0 })
537
+ }
538
+ ),
539
+ /* @__PURE__ */ o(
540
+ "button",
541
+ {
542
+ className: "rsiv-button",
543
+ onClick: W,
544
+ disabled: I.scale >= w,
545
+ "aria-label": "Zoom in",
546
+ type: "button",
547
+ children: /* @__PURE__ */ o(Se, { "aria-hidden": !0 })
548
+ }
549
+ )
550
+ ] })),
551
+ /* @__PURE__ */ R("div", { className: "rsiv-sr-only", "aria-live": "polite", "aria-atomic": "true", children: [
552
+ l && `Image ${d + 1} of ${g.length}`,
553
+ (x == null ? void 0 : x.alt) && `. ${x.alt}`
554
+ ] })
555
+ ]
556
+ }
557
+ );
558
+ };
559
+ Ne.displayName = "ImageViewer";
560
+ function Ze(e = {}) {
561
+ const {
562
+ defaultOpen: n = !1,
563
+ defaultIndex: r = 0,
564
+ totalImages: f = 1,
565
+ zoomStep: v = 0.5,
566
+ minZoom: t = 0.5,
567
+ maxZoom: y = 4,
568
+ loop: k = !1,
569
+ onOpenChange: w,
570
+ onIndexChange: b
571
+ } = e, [P, c] = z(n), [m, M] = z(r), [D, Y] = z(1), E = a((l) => {
572
+ typeof l == "number" && (M(j(l, 0, f - 1)), b == null || b(l)), c(!0), w == null || w(!0);
573
+ }, [f, w, b]), T = a(() => {
574
+ c(!1), Y(1), w == null || w(!1);
575
+ }, [w]), A = a(() => {
576
+ P ? T() : E();
577
+ }, [P, E, T]), L = a((l) => {
578
+ const d = j(l, 0, f - 1);
579
+ M(d), Y(1), b == null || b(d);
580
+ }, [f, b]), Z = a(() => {
581
+ m < f - 1 ? L(m + 1) : k && L(0);
582
+ }, [m, f, k, L]), s = a(() => {
583
+ m > 0 ? L(m - 1) : k && L(f - 1);
584
+ }, [m, f, k, L]), u = a((l) => {
585
+ Y(j(l, t, y));
586
+ }, [t, y]), h = a(() => {
587
+ u(D + v);
588
+ }, [D, v, u]), i = a(() => {
589
+ u(D - v);
590
+ }, [D, v, u]), p = a(() => {
591
+ Y(1);
592
+ }, []), g = a(() => ({
593
+ isOpen: P,
594
+ onClose: T,
595
+ initialIndex: m,
596
+ onIndexChange: L,
597
+ zoomStep: v,
598
+ minZoom: t,
599
+ maxZoom: y,
600
+ loop: k
601
+ }), [P, T, m, L, v, t, y, k]);
602
+ return re(() => ({
603
+ isOpen: P,
604
+ open: E,
605
+ close: T,
606
+ toggle: A,
607
+ currentIndex: m,
608
+ setCurrentIndex: L,
609
+ goToNext: Z,
610
+ goToPrevious: s,
611
+ zoom: D,
612
+ zoomIn: h,
613
+ zoomOut: i,
614
+ resetZoom: p,
615
+ setZoom: u,
616
+ getViewerProps: g
617
+ }), [
618
+ P,
619
+ E,
620
+ T,
621
+ A,
622
+ m,
623
+ L,
624
+ Z,
625
+ s,
626
+ D,
627
+ h,
628
+ i,
629
+ p,
630
+ u,
631
+ g
632
+ ]);
633
+ }
634
+ export {
635
+ Ce as ChevronLeftIcon,
636
+ Ie as ChevronRightIcon,
637
+ Te as CloseIcon,
638
+ Ne as ImageViewer,
639
+ Ee as ResetIcon,
640
+ Se as ZoomInIcon,
641
+ Re as ZoomOutIcon,
642
+ j as clamp,
643
+ De as isSSR,
644
+ Ae as isTouchDevice,
645
+ be as normalizeImage,
646
+ xe as normalizeImages,
647
+ Ze as useImageViewer
648
+ };
649
+ //# sourceMappingURL=index.js.map