@peeekpage/viewer 0.4.0 → 0.4.2

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 CHANGED
@@ -1,34 +1,34 @@
1
- import { jsxs as h, jsx as a, Fragment as ne } from "react/jsx-runtime";
2
- import { useState as y, useRef as H, useEffect as T, useCallback as D, useMemo as tt } from "react";
3
- const nt = /* @__PURE__ */ new Set(["http:", "https:"]);
4
- function V(t) {
1
+ import { jsxs as y, jsx as o, Fragment as qe } from "react/jsx-runtime";
2
+ import { useState as N, useRef as E, useEffect as C, useCallback as L, useMemo as Je } from "react";
3
+ const Qe = /* @__PURE__ */ new Set(["http:", "https:"]);
4
+ function G(t) {
5
5
  if (typeof t != "string") return null;
6
6
  const e = t.trim();
7
7
  if (e === "" || e.includes(" ")) return null;
8
8
  const n = typeof window < "u" ? window.location.href : void 0;
9
- let o;
9
+ let a;
10
10
  try {
11
- o = new URL(e, n);
11
+ a = new URL(e, n);
12
12
  } catch {
13
13
  return null;
14
14
  }
15
- return nt.has(o.protocol) ? o.href : null;
15
+ return Qe.has(a.protocol) ? a.href : null;
16
16
  }
17
- const at = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, ot = /^rgba?\([ \t]*\d{1,3}[ \t]*,[ \t]*\d{1,3}[ \t]*,[ \t]*\d{1,3}[ \t]*(?:,[ \t]*(?:0|1|0?\.\d+)[ \t]*)?\)$/;
18
- function ge(t) {
17
+ const et = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, tt = /^rgba?\([ \t]*\d{1,3}[ \t]*,[ \t]*\d{1,3}[ \t]*,[ \t]*\d{1,3}[ \t]*(?:,[ \t]*(?:0|1|0?\.\d+)[ \t]*)?\)$/;
18
+ function ce(t) {
19
19
  if (typeof t != "string") return null;
20
20
  const e = t.trim();
21
- return at.test(e) || ot.test(e) ? e : null;
21
+ return et.test(e) || tt.test(e) ? e : null;
22
22
  }
23
- const rt = /url\(|image\(|image-set\(|element\(|expression|@|\/\*|;|\{|\}|<|>|\\/i, lt = /^(repeating-)?(linear|radial|conic)-gradient\([a-z0-9#.,%()\/\s-]*\)$/i, it = /^hsla?\([a-z0-9.,%\/\s-]*\)$/i;
24
- function st(t) {
23
+ const nt = /url\(|image\(|image-set\(|element\(|expression|@|\/\*|;|\{|\}|<|>|\\/i, at = /^(repeating-)?(linear|radial|conic)-gradient\([a-z0-9#.,%()\/\s-]*\)$/i, ot = /^hsla?\([a-z0-9.,%\/\s-]*\)$/i;
24
+ function rt(t) {
25
25
  if (typeof t != "string") return null;
26
26
  const e = t.trim();
27
- if (e === "" || rt.test(e)) return null;
28
- const n = ge(e);
29
- return n !== null ? n : it.test(e) || lt.test(e) ? e : null;
27
+ if (e === "" || nt.test(e)) return null;
28
+ const n = ce(e);
29
+ return n !== null ? n : ot.test(e) || at.test(e) ? e : null;
30
30
  }
31
- const ct = ["en", "pt-BR"], Pe = {
31
+ const lt = ["en", "pt-BR"], Te = {
32
32
  prev: "Previous page",
33
33
  next: "Next page",
34
34
  zoom: "Zoom level",
@@ -50,7 +50,7 @@ const ct = ["en", "pt-BR"], Pe = {
50
50
  rotate: "Rotate page",
51
51
  singlePage: "Single page",
52
52
  doublePage: "Two pages"
53
- }, ut = {
53
+ }, it = {
54
54
  prev: "Página anterior",
55
55
  next: "Próxima página",
56
56
  zoom: "Nível de zoom",
@@ -72,95 +72,94 @@ const ct = ["en", "pt-BR"], Pe = {
72
72
  rotate: "Girar página",
73
73
  singlePage: "Página única",
74
74
  doublePage: "Duas páginas"
75
- }, dt = { en: Pe, "pt-BR": ut };
76
- function gt(t) {
77
- return dt[t] ?? Pe;
75
+ }, st = { en: Te, "pt-BR": it };
76
+ function ct(t) {
77
+ return st[t] ?? Te;
78
78
  }
79
- const ft = "#6E79D6";
80
- function P(t, e) {
79
+ const ut = "#6E79D6";
80
+ function I(t, e) {
81
81
  return typeof t == "boolean" ? t : e;
82
82
  }
83
- function q(t, e, n) {
83
+ function J(t, e, n) {
84
84
  return e.includes(t) ? t : n;
85
85
  }
86
- function mt(t) {
86
+ function dt(t) {
87
87
  return {
88
88
  src: typeof t.src == "string" ? t.src : "",
89
- mode: q(t.mode, ["flip", "coverflow"], "flip"),
90
- logo: V(t.logo),
91
- logoLink: V(t.logoLink),
92
- accentColor: ge(t.accentColor) ?? ft,
93
- background: q(t.background, ["color", "image", "transparent"], "color"),
94
- backgroundColor: st(t.backgroundColor),
95
- backgroundImage: V(t.backgroundImage),
96
- layout: q(t.layout, ["single", "double"], "double"),
97
- fillHeight: P(t.fillHeight, !1),
98
- pageShadows: P(t.pageShadows, !0),
99
- rtl: P(t.rtl, !1),
100
- animateInteractions: P(t.animateInteractions, !0),
101
- skin: q(t.skin, ["classic", "minimal", "showcase"], "classic"),
102
- language: q(t.language, ct, "en"),
103
- autoTransition: P(t.autoTransition, !1),
89
+ mode: J(t.mode, ["flip", "coverflow"], "flip"),
90
+ logo: G(t.logo),
91
+ logoLink: G(t.logoLink),
92
+ accentColor: ce(t.accentColor) ?? ut,
93
+ background: J(t.background, ["color", "image", "transparent"], "color"),
94
+ backgroundColor: rt(t.backgroundColor),
95
+ backgroundImage: G(t.backgroundImage),
96
+ layout: J(t.layout, ["single", "double"], "double"),
97
+ fillHeight: I(t.fillHeight, !1),
98
+ pageShadows: I(t.pageShadows, !0),
99
+ rtl: I(t.rtl, !1),
100
+ animateInteractions: I(t.animateInteractions, !0),
101
+ skin: J(t.skin, ["classic", "minimal", "showcase"], "classic"),
102
+ language: J(t.language, lt, "en"),
103
+ autoTransition: I(t.autoTransition, !1),
104
104
  autoTransitionInterval: typeof t.autoTransitionInterval == "number" && t.autoTransitionInterval > 0 ? t.autoTransitionInterval : 5e3,
105
- navigationControls: P(t.navigationControls, !0),
106
- fullscreen: P(t.fullscreen, !0),
107
- arrows: P(t.arrows, !0),
108
- navigationBar: P(t.navigationBar, !0),
109
- pagesOverview: P(t.pagesOverview, !0),
110
- downloadUrl: V(t.downloadUrl),
111
- aboutButton: P(t.aboutButton, !0),
112
- goToPage: P(t.goToPage, !0),
113
- rotateControl: P(t.rotateControl, !0),
114
- layoutToggle: P(t.layoutToggle, !0),
115
- pageCurl: P(t.pageCurl, !0),
116
- loadingImage: V(t.loadingImage),
105
+ navigationControls: I(t.navigationControls, !0),
106
+ fullscreen: I(t.fullscreen, !0),
107
+ arrows: I(t.arrows, !0),
108
+ navigationBar: I(t.navigationBar, !0),
109
+ pagesOverview: I(t.pagesOverview, !0),
110
+ downloadUrl: G(t.downloadUrl),
111
+ aboutButton: I(t.aboutButton, !0),
112
+ goToPage: I(t.goToPage, !0),
113
+ rotateControl: I(t.rotateControl, !0),
114
+ layoutToggle: I(t.layoutToggle, !0),
115
+ loadingImage: G(t.loadingImage),
117
116
  loadingCaption: typeof t.loadingCaption == "string" && t.loadingCaption.length > 0 ? t.loadingCaption : null,
118
- loadingColor: ge(t.loadingColor),
117
+ loadingColor: ce(t.loadingColor),
119
118
  pollInterval: typeof t.pollInterval == "number" && t.pollInterval > 0 ? t.pollInterval : 2e3,
120
119
  className: typeof t.className == "string" ? t.className : ""
121
120
  };
122
121
  }
123
- const fe = 5e3;
124
- function J(t) {
122
+ const ue = 5e3;
123
+ function Q(t) {
125
124
  return typeof t == "string" ? t : "";
126
125
  }
127
- function pt(t) {
126
+ function gt(t) {
128
127
  if (t === null || typeof t != "object" || Array.isArray(t))
129
128
  return { ok: !1, error: "manifest is not an object" };
130
129
  const e = t;
131
130
  if (!Array.isArray(e.pages))
132
131
  return { ok: !1, error: "manifest.pages is missing or not an array" };
133
- if (e.pages.length > fe)
132
+ if (e.pages.length > ue)
134
133
  return { ok: !1, error: "manifest.pages exceeds the maximum" };
135
- const n = e.total_pages, o = typeof n == "number" && Number.isFinite(n) && n >= 0 ? n : e.pages.length;
136
- if (o > fe)
134
+ const n = e.total_pages, a = typeof n == "number" && Number.isFinite(n) && n >= 0 ? n : e.pages.length;
135
+ if (a > ue)
137
136
  return { ok: !1, error: "manifest.total_pages exceeds the maximum" };
138
- const l = [];
139
- for (const g of e.pages) {
140
- if (g === null || typeof g != "object") continue;
141
- const i = V(g.url);
142
- i && l.push(i);
137
+ const i = [];
138
+ for (const f of e.pages) {
139
+ if (f === null || typeof f != "object") continue;
140
+ const s = G(f.url);
141
+ s && i.push(s);
143
142
  }
144
- if (l.length === 0)
143
+ if (i.length === 0)
145
144
  return { ok: !1, error: "manifest has no usable pages" };
146
- const c = e.status === "wip" ? "wip" : "done", p = e.metadata && typeof e.metadata == "object" ? e.metadata : {}, b = {
147
- fileId: J(p.file_id),
148
- filename: J(p.filename),
149
- creationDate: J(p.creation_date),
150
- fileSize: J(p.file_size),
151
- mimeType: J(p.mime_type)
145
+ const u = e.status === "wip" ? "wip" : "done", _ = e.metadata && typeof e.metadata == "object" ? e.metadata : {}, h = {
146
+ fileId: Q(_.file_id),
147
+ filename: Q(_.filename),
148
+ creationDate: Q(_.creation_date),
149
+ fileSize: Q(_.file_size),
150
+ mimeType: Q(_.mime_type)
152
151
  };
153
152
  return {
154
153
  ok: !0,
155
- value: { status: c, totalPages: o, pages: l, metadata: b }
154
+ value: { status: u, totalPages: a, pages: i, metadata: h }
156
155
  };
157
156
  }
158
- function bt(t, e) {
159
- if (!Array.isArray(t) || t.length > fe) return null;
157
+ function ft(t, e) {
158
+ if (!Array.isArray(t) || t.length > ue) return null;
160
159
  const n = [];
161
- for (const l of t) {
162
- const c = V(l);
163
- c && n.push(c);
160
+ for (const i of t) {
161
+ const u = G(i);
162
+ u && n.push(u);
164
163
  }
165
164
  return n.length === 0 ? null : {
166
165
  status: "done",
@@ -175,232 +174,232 @@ function bt(t, e) {
175
174
  }
176
175
  };
177
176
  }
178
- function ht(t, e) {
179
- const [n, o] = y("loading"), [l, c] = y(null), [p, b] = y(null), g = H(null);
180
- return T(() => {
181
- let i = !1;
182
- if (o("loading"), c(null), b(null), !t) return;
183
- const k = () => {
184
- g.current !== null && (clearTimeout(g.current), g.current = null);
185
- }, _ = async () => {
186
- let u;
177
+ function mt(t, e) {
178
+ const [n, a] = N("loading"), [i, u] = N(null), [_, h] = N(null), f = E(null);
179
+ return C(() => {
180
+ let s = !1;
181
+ if (a("loading"), u(null), h(null), !t) return;
182
+ const v = () => {
183
+ f.current !== null && (clearTimeout(f.current), f.current = null);
184
+ }, k = async () => {
185
+ let d;
187
186
  try {
188
- const s = await fetch(t);
189
- if (!s.ok) throw new Error(`HTTP ${s.status}`);
190
- u = await s.json();
191
- } catch (s) {
192
- if (i) return;
193
- b(s instanceof Error ? s.message : "fetch failed"), o("error");
187
+ const l = await fetch(t);
188
+ if (!l.ok) throw new Error(`HTTP ${l.status}`);
189
+ d = await l.json();
190
+ } catch (l) {
191
+ if (s) return;
192
+ h(l instanceof Error ? l.message : "fetch failed"), a("error");
194
193
  return;
195
194
  }
196
- if (i) return;
197
- const d = pt(u);
198
- if (!d.ok) {
199
- b(d.error), o("error");
195
+ if (s) return;
196
+ const c = gt(d);
197
+ if (!c.ok) {
198
+ h(c.error), a("error");
200
199
  return;
201
200
  }
202
- c(d.value), o("ready"), d.value.status === "wip" && (g.current = setTimeout(_, e));
201
+ u(c.value), a("ready"), c.value.status === "wip" && (f.current = setTimeout(k, e));
203
202
  };
204
- return _(), () => {
205
- i = !0, k();
203
+ return k(), () => {
204
+ s = !0, v();
206
205
  };
207
- }, [t, e]), { state: n, manifest: l, error: p };
206
+ }, [t, e]), { state: n, manifest: i, error: _ };
208
207
  }
209
- function _t(t) {
210
- const [e, n] = y(!1);
211
- T(() => {
212
- const l = () => n(document.fullscreenElement != null);
213
- return document.addEventListener("fullscreenchange", l), () => document.removeEventListener("fullscreenchange", l);
208
+ function pt(t) {
209
+ const [e, n] = N(!1);
210
+ C(() => {
211
+ const i = () => n(document.fullscreenElement != null);
212
+ return document.addEventListener("fullscreenchange", i), () => document.removeEventListener("fullscreenchange", i);
214
213
  }, []);
215
- const o = D(async () => {
216
- const l = t.current;
217
- if (l)
214
+ const a = L(async () => {
215
+ const i = t.current;
216
+ if (i)
218
217
  try {
219
- document.fullscreenElement ? await document.exitFullscreen() : await l.requestFullscreen();
218
+ document.fullscreenElement ? await document.exitFullscreen() : await i.requestFullscreen();
220
219
  } catch {
221
220
  }
222
221
  }, [t]);
223
- return { isFullscreen: e, toggle: o };
222
+ return { isFullscreen: e, toggle: a };
224
223
  }
225
- const Te = "(prefers-reduced-motion: reduce)";
226
- function xe() {
227
- const [t, e] = y(() => {
224
+ const ve = "(prefers-reduced-motion: reduce)";
225
+ function Ne() {
226
+ const [t, e] = N(() => {
228
227
  var n;
229
- return ((n = matchMedia == null ? void 0 : matchMedia(Te)) == null ? void 0 : n.matches) ?? !1;
228
+ return ((n = matchMedia == null ? void 0 : matchMedia(ve)) == null ? void 0 : n.matches) ?? !1;
230
229
  });
231
- return T(() => {
232
- const n = typeof matchMedia == "function" ? matchMedia(Te) : void 0;
230
+ return C(() => {
231
+ const n = typeof matchMedia == "function" ? matchMedia(ve) : void 0;
233
232
  if (!(n != null && n.addEventListener)) return;
234
- const o = () => e(n.matches);
235
- return n.addEventListener("change", o), () => n.removeEventListener("change", o);
233
+ const a = () => e(n.matches);
234
+ return n.addEventListener("change", a), () => n.removeEventListener("change", a);
236
235
  }, []), t;
237
236
  }
238
- function Ie({ go: t, jump: e, total: n, rtl: o }) {
239
- return { onKeyDown: D(
240
- (c) => {
241
- switch (c.key) {
237
+ function Ce({ go: t, jump: e, total: n, rtl: a }) {
238
+ return { onKeyDown: L(
239
+ (u) => {
240
+ switch (u.key) {
242
241
  case "ArrowRight":
243
- t(o ? -1 : 1);
242
+ t(a ? -1 : 1);
244
243
  break;
245
244
  case "ArrowLeft":
246
- t(o ? 1 : -1);
245
+ t(a ? 1 : -1);
247
246
  break;
248
247
  case "Home":
249
- c.preventDefault(), n > 0 && e(0);
248
+ u.preventDefault(), n > 0 && e(0);
250
249
  break;
251
250
  case "End":
252
- c.preventDefault(), n > 0 && e(n - 1);
251
+ u.preventDefault(), n > 0 && e(n - 1);
253
252
  break;
254
253
  case " ":
255
254
  case "Spacebar":
256
- c.preventDefault(), t(c.shiftKey ? -1 : 1);
255
+ u.preventDefault(), t(u.shiftKey ? -1 : 1);
257
256
  break;
258
257
  case "PageDown":
259
- c.preventDefault(), t(1);
258
+ u.preventDefault(), t(1);
260
259
  break;
261
260
  case "PageUp":
262
- c.preventDefault(), t(-1);
261
+ u.preventDefault(), t(-1);
263
262
  break;
264
263
  }
265
264
  },
266
- [t, e, n, o]
265
+ [t, e, n, a]
267
266
  ) };
268
267
  }
269
- function ze(t, e) {
268
+ function Pe(t, e) {
270
269
  if (e <= 0) return null;
271
270
  const n = t.trim();
272
271
  if (!/^\d+$/.test(n)) return null;
273
- const o = Number(n);
274
- return Number.isFinite(o) ? Math.max(1, Math.min(e, o)) - 1 : null;
272
+ const a = Number(n);
273
+ return Number.isFinite(a) ? Math.max(1, Math.min(e, a)) - 1 : null;
275
274
  }
276
- const kt = 640;
277
- function yt(t, e) {
278
- const [n, o] = y("auto"), [l, c] = y(null);
279
- T(() => {
280
- const i = t.current;
281
- if (!i || (i.clientWidth > 0 && c(i.clientWidth), typeof ResizeObserver > "u")) return;
282
- const k = new ResizeObserver((_) => {
283
- var d;
284
- const u = (d = _[0]) == null ? void 0 : d.contentRect.width;
285
- typeof u == "number" && u > 0 && c(u);
275
+ const bt = 640;
276
+ function ht(t, e) {
277
+ const [n, a] = N("auto"), [i, u] = N(null);
278
+ C(() => {
279
+ const s = t.current;
280
+ if (!s || (s.clientWidth > 0 && u(s.clientWidth), typeof ResizeObserver > "u")) return;
281
+ const v = new ResizeObserver((k) => {
282
+ var c;
283
+ const d = (c = k[0]) == null ? void 0 : c.contentRect.width;
284
+ typeof d == "number" && d > 0 && u(d);
286
285
  });
287
- return k.observe(i), () => k.disconnect();
286
+ return v.observe(s), () => v.disconnect();
288
287
  }, [t]);
289
- const p = l != null && l < kt ? "single" : e, b = n === "auto" ? p : n, g = D(() => {
290
- o(b === "single" ? "double" : "single");
291
- }, [b]);
292
- return { layout: b, toggle: g };
288
+ const _ = i != null && i < bt ? "single" : e, h = n === "auto" ? _ : n, f = L(() => {
289
+ a(h === "single" ? "double" : "single");
290
+ }, [h]);
291
+ return { layout: h, toggle: f };
293
292
  }
294
- function me(t, e) {
293
+ function ge(t, e) {
295
294
  return t <= 0 ? 0 : e === "single" ? t : 1 + Math.ceil((t - 1) / 2);
296
295
  }
297
- function vt(t, e) {
296
+ function _t(t, e) {
298
297
  return e === "single" ? t : t <= 0 ? 0 : Math.floor((t - 1) / 2) + 1;
299
298
  }
300
- function re(t, e, n) {
299
+ function oe(t, e, n) {
301
300
  if (e <= 0) return { left: -1, right: -1 };
302
301
  if (n === "single")
303
302
  return { left: -1, right: t >= 0 && t < e ? t : -1 };
304
303
  if (t <= 0)
305
304
  return { left: -1, right: 0 };
306
- const o = 2 * t - 1, l = 2 * t;
307
- return { left: o < e ? o : -1, right: l < e ? l : -1 };
308
- }
309
- function Ae(t, e, n) {
310
- const { left: o, right: l } = re(t, e, n), c = [];
311
- return o >= 0 && c.push(o), l >= 0 && c.push(l), c;
305
+ const a = 2 * t - 1, i = 2 * t;
306
+ return { left: a < e ? a : -1, right: i < e ? i : -1 };
312
307
  }
313
308
  function de(t, e, n) {
314
- const o = me(e, n) - 1;
315
- return t < 0 ? 0 : t > o ? o : t;
309
+ const { left: a, right: i } = oe(t, e, n), u = [];
310
+ return a >= 0 && u.push(a), i >= 0 && u.push(i), u;
311
+ }
312
+ function ne(t, e, n) {
313
+ const a = ge(e, n) - 1;
314
+ return t < 0 ? 0 : t > a ? a : t;
316
315
  }
317
- function wt(t) {
316
+ function kt(t) {
318
317
  const {
319
318
  strings: e,
320
319
  label: n,
321
- progress: o,
322
- zoom: l,
323
- minZoom: c,
324
- maxZoom: p,
325
- total: b,
326
- currentPage: g,
327
- layout: i,
328
- thumbsOpen: k,
329
- isFullscreen: _,
330
- downloadUrl: u,
331
- show: d,
332
- onZoomIn: s,
333
- onZoomOut: O,
334
- onZoomSet: z,
335
- onJump: F,
320
+ progress: a,
321
+ zoom: i,
322
+ minZoom: u,
323
+ maxZoom: _,
324
+ total: h,
325
+ currentPage: f,
326
+ layout: s,
327
+ thumbsOpen: v,
328
+ isFullscreen: k,
329
+ downloadUrl: d,
330
+ show: c,
331
+ onZoomIn: l,
332
+ onZoomOut: D,
333
+ onZoomSet: O,
334
+ onJump: A,
336
335
  onRotate: R,
337
- onToggleLayout: I,
338
- onToggleThumbs: $,
339
- onToggleFullscreen: X,
340
- onAbout: W
341
- } = t, [S, A] = y(String(g));
342
- T(() => A(String(g)), [g]);
343
- const G = () => {
344
- const C = ze(S, b);
345
- if (C === null) {
346
- A(String(g));
336
+ onToggleLayout: x,
337
+ onToggleThumbs: M,
338
+ onToggleFullscreen: Z,
339
+ onAbout: j
340
+ } = t, [F, $] = N(String(f));
341
+ C(() => $(String(f)), [f]);
342
+ const B = () => {
343
+ const P = Pe(F, h);
344
+ if (P === null) {
345
+ $(String(f));
347
346
  return;
348
347
  }
349
- F(C), A(String(C + 1));
348
+ A(P), $(String(P + 1));
350
349
  };
351
- return /* @__PURE__ */ h("div", { className: "peeek__toolbar", children: [
352
- /* @__PURE__ */ a("span", { className: "peeek__label", children: n }),
353
- d.bar && /* @__PURE__ */ a("div", { className: "peeek__scrubber", "aria-hidden": !0, children: /* @__PURE__ */ a("div", { className: "peeek__scrubber-fill", style: { width: `${o}%` } }) }),
354
- d.goto && /* @__PURE__ */ a(
350
+ return /* @__PURE__ */ y("div", { className: "peeek__toolbar", children: [
351
+ /* @__PURE__ */ o("span", { className: "peeek__label", children: n }),
352
+ c.bar && /* @__PURE__ */ o("div", { className: "peeek__scrubber", "aria-hidden": !0, children: /* @__PURE__ */ o("div", { className: "peeek__scrubber-fill", style: { width: `${a}%` } }) }),
353
+ c.goto && /* @__PURE__ */ o(
355
354
  "input",
356
355
  {
357
356
  className: "peeek__goto",
358
357
  type: "text",
359
358
  inputMode: "numeric",
360
359
  "aria-label": e.goToPage,
361
- value: S,
362
- onChange: (C) => A(C.target.value),
363
- onBlur: G,
364
- onKeyDown: (C) => {
365
- C.key === "Enter" && (C.preventDefault(), G());
360
+ value: F,
361
+ onChange: (P) => $(P.target.value),
362
+ onBlur: B,
363
+ onKeyDown: (P) => {
364
+ P.key === "Enter" && (P.preventDefault(), B());
366
365
  }
367
366
  }
368
367
  ),
369
- /* @__PURE__ */ a(
368
+ /* @__PURE__ */ o(
370
369
  "button",
371
370
  {
372
371
  type: "button",
373
372
  className: "peeek__btn",
374
373
  "aria-label": e.zoomOut,
375
- disabled: l <= c,
376
- onClick: O,
374
+ disabled: i <= u,
375
+ onClick: D,
377
376
  children: "−"
378
377
  }
379
378
  ),
380
- /* @__PURE__ */ a(
379
+ /* @__PURE__ */ o(
381
380
  "input",
382
381
  {
383
382
  type: "range",
384
383
  "aria-label": e.zoom,
385
- min: c,
386
- max: p,
384
+ min: u,
385
+ max: _,
387
386
  step: 0.25,
388
- value: l,
389
- onChange: (C) => z(Number(C.target.value))
387
+ value: i,
388
+ onChange: (P) => O(Number(P.target.value))
390
389
  }
391
390
  ),
392
- /* @__PURE__ */ a(
391
+ /* @__PURE__ */ o(
393
392
  "button",
394
393
  {
395
394
  type: "button",
396
395
  className: "peeek__btn",
397
396
  "aria-label": e.zoomIn,
398
- disabled: l >= p,
399
- onClick: s,
397
+ disabled: i >= _,
398
+ onClick: l,
400
399
  children: "+"
401
400
  }
402
401
  ),
403
- d.rotate && /* @__PURE__ */ a(
402
+ c.rotate && /* @__PURE__ */ o(
404
403
  "button",
405
404
  {
406
405
  type: "button",
@@ -410,33 +409,33 @@ function wt(t) {
410
409
  children: "⟳"
411
410
  }
412
411
  ),
413
- d.layoutToggle && /* @__PURE__ */ a(
412
+ c.layoutToggle && /* @__PURE__ */ o(
414
413
  "button",
415
414
  {
416
415
  type: "button",
417
416
  className: "peeek__btn",
418
- "aria-label": i === "single" ? e.doublePage : e.singlePage,
419
- "aria-pressed": i === "double",
420
- onClick: I,
421
- children: i === "single" ? "▭" : "▥"
417
+ "aria-label": s === "single" ? e.doublePage : e.singlePage,
418
+ "aria-pressed": s === "double",
419
+ onClick: x,
420
+ children: s === "single" ? "▭" : "▥"
422
421
  }
423
422
  ),
424
- d.thumbnails && /* @__PURE__ */ a(
423
+ c.thumbnails && /* @__PURE__ */ o(
425
424
  "button",
426
425
  {
427
426
  type: "button",
428
- className: `peeek__btn${k ? " peeek__btn--active" : ""}`,
427
+ className: `peeek__btn${v ? " peeek__btn--active" : ""}`,
429
428
  "aria-label": e.thumbnails,
430
- "aria-pressed": k,
431
- onClick: $,
429
+ "aria-pressed": v,
430
+ onClick: M,
432
431
  children: "▦"
433
432
  }
434
433
  ),
435
- u && /* @__PURE__ */ a(
434
+ d && /* @__PURE__ */ o(
436
435
  "a",
437
436
  {
438
437
  className: "peeek__btn",
439
- href: u,
438
+ href: d,
440
439
  "aria-label": e.download,
441
440
  target: "_blank",
442
441
  rel: "noopener noreferrer",
@@ -444,405 +443,384 @@ function wt(t) {
444
443
  children: "↓"
445
444
  }
446
445
  ),
447
- d.fullscreen && /* @__PURE__ */ a(
446
+ c.fullscreen && /* @__PURE__ */ o(
448
447
  "button",
449
448
  {
450
449
  type: "button",
451
- className: `peeek__btn${_ ? " peeek__btn--active" : ""}`,
450
+ className: `peeek__btn${k ? " peeek__btn--active" : ""}`,
452
451
  "aria-label": e.fullscreen,
453
- "aria-pressed": _,
454
- onClick: X,
452
+ "aria-pressed": k,
453
+ onClick: Z,
455
454
  children: "⛶"
456
455
  }
457
456
  ),
458
- d.about && /* @__PURE__ */ a(
457
+ c.about && /* @__PURE__ */ o(
459
458
  "button",
460
459
  {
461
460
  type: "button",
462
461
  className: "peeek__btn",
463
462
  "aria-label": e.about,
464
- onClick: W,
463
+ onClick: j,
465
464
  children: "?"
466
465
  }
467
466
  )
468
467
  ] });
469
468
  }
470
- function Tt({ pages: t, layout: e, rtl: n, activePages: o, onJump: l }) {
471
- const c = t.length, p = new Set(o), b = me(c, e);
472
- return /* @__PURE__ */ a("div", { className: "peeek__thumbs", role: "group", "aria-label": "Pages", children: Array.from({ length: b }, (g, i) => {
473
- const k = Ae(i, c, e), _ = k.length === 2;
474
- return /* @__PURE__ */ h("div", { className: "peeek__thumb-group", children: [
475
- k.map((u, d) => {
476
- let s = "";
477
- return _ && (s = (n ? d === 1 : d === 0) ? " peeek__thumb--flat-right" : " peeek__thumb--flat-left"), /* @__PURE__ */ a(
469
+ function yt({ pages: t, layout: e, rtl: n, activePages: a, onJump: i }) {
470
+ const u = t.length, _ = new Set(a), h = ge(u, e);
471
+ return /* @__PURE__ */ o("div", { className: "peeek__thumbs", role: "group", "aria-label": "Pages", children: Array.from({ length: h }, (f, s) => {
472
+ const v = de(s, u, e), k = v.length === 2;
473
+ return /* @__PURE__ */ y("div", { className: "peeek__thumb-group", children: [
474
+ v.map((d, c) => {
475
+ let l = "";
476
+ return k && (l = (n ? c === 1 : c === 0) ? " peeek__thumb--flat-right" : " peeek__thumb--flat-left"), /* @__PURE__ */ o(
478
477
  "button",
479
478
  {
480
479
  type: "button",
481
- "aria-label": `Go to page ${u + 1}`,
482
- "aria-current": p.has(u),
483
- className: `peeek__thumb${p.has(u) ? " peeek__thumb--active" : ""}${s}`,
484
- onClick: () => l(u),
485
- children: /* @__PURE__ */ a("img", { src: t[u], alt: "", loading: "lazy", referrerPolicy: "no-referrer" })
480
+ "aria-label": `Go to page ${d + 1}`,
481
+ "aria-current": _.has(d),
482
+ className: `peeek__thumb${_.has(d) ? " peeek__thumb--active" : ""}${l}`,
483
+ onClick: () => i(d),
484
+ children: /* @__PURE__ */ o("img", { src: t[d], alt: "", loading: "lazy", referrerPolicy: "no-referrer" })
486
485
  },
487
- u
486
+ d
488
487
  );
489
488
  }),
490
- /* @__PURE__ */ a("span", { className: "peeek__thumb-badge", "aria-hidden": !0, children: k.map((u) => u + 1).join("-") })
491
- ] }, i);
489
+ /* @__PURE__ */ o("span", { className: "peeek__thumb-badge", "aria-hidden": !0, children: v.map((d) => d + 1).join("-") })
490
+ ] }, s);
492
491
  }) });
493
492
  }
494
- const Ce = 20, Ct = 88, Nt = 150;
495
- function ae({ corner: t, pointer: e, instant: n, onActivate: o }) {
496
- const l = H(null), [c, p] = y(0);
497
- T(() => {
498
- if (!e) {
499
- p(0);
500
- return;
501
- }
502
- const g = l.current;
503
- if (!g) return;
504
- const i = g.getBoundingClientRect(), k = t === "tr" || t === "br" ? i.right : i.left, _ = t === "tr" || t === "tl" ? i.top : i.bottom, u = Math.hypot(e.x - k, e.y - _);
505
- p(Math.max(0, Math.min(1, 1 - u / Nt)));
506
- }, [e, t]);
507
- const b = Ce + c * (Ct - Ce);
508
- return /* @__PURE__ */ a(
509
- "button",
510
- {
511
- ref: l,
512
- type: "button",
513
- className: `peeek__curl peeek__curl--${t}`,
514
- "aria-hidden": !0,
515
- tabIndex: -1,
516
- onClick: o,
517
- style: {
518
- "--peeek-curl": `${b}px`,
519
- transition: n ? "none" : void 0
520
- }
521
- }
522
- );
523
- }
524
- const Q = 1, oe = 2, Ne = 0.25;
525
- function Pt(t) {
493
+ const ee = 1, ae = 2, we = 0.25;
494
+ function vt(t) {
526
495
  const {
527
496
  pages: e,
528
497
  strings: n,
529
- layout: o,
530
- rtl: l,
531
- pageShadows: c,
532
- animateInteractions: p,
533
- autoTransition: b,
534
- autoTransitionInterval: g,
535
- show: i,
536
- downloadUrl: k,
537
- isFullscreen: _,
538
- onToggleFullscreen: u,
539
- onAbout: d
540
- } = t, s = e.length, z = xe() || !p, [F, R] = y(0), [I, $] = y(1), [X, W] = y(!1), [S, A] = y({ x: 0, y: 0 }), [G, C] = y(!1), [f, w] = y(0), [M, E] = y(null), B = H(null), le = H(null), { layout: N, toggle: Me } = yt(le, o), ie = me(s, N), [v, pe] = y(null), be = H(null), [he, $e] = y(0.707);
541
- T(() => {
498
+ layout: a,
499
+ rtl: i,
500
+ pageShadows: u,
501
+ animateInteractions: _,
502
+ autoTransition: h,
503
+ autoTransitionInterval: f,
504
+ show: s,
505
+ downloadUrl: v,
506
+ isFullscreen: k,
507
+ onToggleFullscreen: d,
508
+ onAbout: c
509
+ } = t, l = e.length, O = Ne() || !_, [A, R] = N(0), [x, M] = N(1), [Z, j] = N(!1), [F, $] = N({ x: 0, y: 0 }), [B, P] = N(!1), [X, m] = N(0), p = E(null), z = E(null), { layout: b, toggle: K } = ht(z, a), re = ge(l, b), [w, fe] = N(null), me = E(null), [pe, Ie] = N(0.707);
510
+ C(() => {
542
511
  if (!e[0]) return;
543
512
  const r = new globalThis.Image();
544
513
  r.onload = () => {
545
- r.naturalWidth && r.naturalHeight && $e(r.naturalWidth / r.naturalHeight);
514
+ r.naturalWidth && r.naturalHeight && Ie(r.naturalWidth / r.naturalHeight);
546
515
  }, r.src = e[0];
547
516
  }, [e]);
548
- const U = de(F, s, N), _e = U <= 0, ee = U >= ie - 1, L = D(
517
+ const S = ne(A, l, b), xe = S <= 0, le = S >= re - 1, be = E(/* @__PURE__ */ new Set());
518
+ C(() => {
519
+ const r = [S - 1, S + 1, S + 2].map((g) => ne(g, l, b)).flatMap((g) => de(g, l, b)).filter((g) => g >= 0);
520
+ for (const g of r) {
521
+ const T = e[g];
522
+ if (!T || be.current.has(T)) continue;
523
+ be.current.add(T);
524
+ const q = new globalThis.Image();
525
+ q.src = T;
526
+ }
527
+ }, [S, l, b, e]);
528
+ const W = L(
549
529
  (r) => {
550
- v || R((m) => {
551
- const x = de(m + r, s, N);
552
- return x === m ? m : z ? x : (pe({ dir: r, to: x }), m);
530
+ w || R((g) => {
531
+ const T = ne(g + r, l, b);
532
+ return T === g ? g : O ? T : (fe({ dir: r, to: T }), g);
553
533
  });
554
534
  },
555
- [s, N, z, v]
556
- ), Se = D(() => {
557
- pe((r) => (r && R(r.to), null));
535
+ [l, b, O, w]
536
+ ), ze = L(() => {
537
+ fe((r) => (r && R(r.to), null));
558
538
  }, []);
559
- T(() => {
560
- if (!v) return;
561
- const r = be.current;
539
+ C(() => {
540
+ if (!w) return;
541
+ const r = me.current;
562
542
  if (!r) return;
563
543
  r.style.transform = "rotateY(0deg)";
564
- let m = 0;
565
- const x = requestAnimationFrame(() => {
566
- m = requestAnimationFrame(() => {
567
- r.style.transform = `rotateY(${v.dir === 1 ? -180 : 180}deg)`;
544
+ let g = 0;
545
+ const T = requestAnimationFrame(() => {
546
+ g = requestAnimationFrame(() => {
547
+ r.style.transform = `rotateY(${w.dir === 1 ? -180 : 180}deg)`;
568
548
  });
569
549
  });
570
550
  return () => {
571
- cancelAnimationFrame(x), cancelAnimationFrame(m);
551
+ cancelAnimationFrame(T), cancelAnimationFrame(g);
572
552
  };
573
- }, [v]);
574
- const se = D(
553
+ }, [w]);
554
+ const ie = L(
575
555
  (r) => {
576
- R(de(vt(r, N), s, N));
556
+ R(ne(_t(r, b), l, b));
577
557
  },
578
- [s, N]
579
- ), { onKeyDown: Fe } = Ie({ go: L, jump: se, total: s, rtl: l });
580
- T(() => {
581
- if (!b || ee) return;
582
- const r = setTimeout(() => L(1), g);
558
+ [l, b]
559
+ ), { onKeyDown: Se } = Ce({ go: W, jump: ie, total: l, rtl: i });
560
+ C(() => {
561
+ if (!h || le) return;
562
+ const r = setTimeout(() => W(1), f);
583
563
  return () => clearTimeout(r);
584
- }, [b, g, ee, U, L]);
585
- const Ee = () => $((r) => Math.min(oe, r + Ne)), Le = () => $((r) => Math.max(Q, r - Ne)), De = () => {
586
- v || $((r) => r > Q ? Q : oe);
587
- }, Oe = () => w((r) => (r + 90) % 360), Re = f === 90 || f === 270 ? he : 1, ce = D((r, m, x) => {
588
- const ue = le.current;
589
- if (!ue || x <= 1) return { x: 0, y: 0 };
590
- const ve = (x - 1) * ue.clientWidth / 2, we = (x - 1) * ue.clientHeight / 2;
591
- return { x: Math.max(-ve, Math.min(ve, r)), y: Math.max(-we, Math.min(we, m)) };
564
+ }, [h, f, le, S, W]);
565
+ const $e = () => M((r) => Math.min(ae, r + we)), Me = () => M((r) => Math.max(ee, r - we)), Ae = () => {
566
+ w || M((r) => r > ee ? ee : ae);
567
+ }, Fe = () => m((r) => (r + 90) % 360), Ee = X === 90 || X === 270 ? pe : 1, se = L((r, g, T) => {
568
+ const q = z.current;
569
+ if (!q || T <= 1) return { x: 0, y: 0 };
570
+ const ke = (T - 1) * q.clientWidth / 2, ye = (T - 1) * q.clientHeight / 2;
571
+ return { x: Math.max(-ke, Math.min(ke, r)), y: Math.max(-ye, Math.min(ye, g)) };
592
572
  }, []);
593
- T(() => A((r) => ce(r.x, r.y, I)), [I, ce]), T(() => A({ x: 0, y: 0 }), [U]);
594
- const Be = (r) => {
595
- var m, x;
596
- I <= 1 || (B.current = { x: r.clientX, y: r.clientY, px: S.x, py: S.y }, C(!0), (x = (m = r.currentTarget).setPointerCapture) == null || x.call(m, r.pointerId));
597
- }, Ue = (r) => {
598
- const m = B.current;
599
- m && A(ce(m.px + (r.clientX - m.x), m.py + (r.clientY - m.y), I));
600
- }, ke = (r) => {
601
- if (B.current) {
602
- B.current = null, C(!1);
573
+ C(() => $((r) => se(r.x, r.y, x)), [x, se]), C(() => $({ x: 0, y: 0 }), [S]);
574
+ const Le = (r) => {
575
+ var g, T;
576
+ x <= 1 || (p.current = { x: r.clientX, y: r.clientY, px: F.x, py: F.y }, P(!0), (T = (g = r.currentTarget).setPointerCapture) == null || T.call(g, r.pointerId));
577
+ }, De = (r) => {
578
+ const g = p.current;
579
+ g && $(se(g.px + (r.clientX - g.x), g.py + (r.clientY - g.y), x));
580
+ }, he = (r) => {
581
+ if (p.current) {
582
+ p.current = null, P(!1);
603
583
  try {
604
584
  r.currentTarget.releasePointerCapture(r.pointerId);
605
585
  } catch {
606
586
  }
607
587
  }
608
- }, Y = Ae(U, s, N), te = Y[0] ?? 0, Ze = N === "double" && Y.length === 2 ? `${Y[0] + 1} - ${Y[1] + 1} / ${s}` : `${te + 1} / ${s}`, He = ie <= 1 ? 100 : U / (ie - 1) * 100, Xe = n.prev, Ge = n.next, je = v ? v.to : U, j = re(je, s, N), Ve = j.left < 0 && j.right >= 0, Ke = j.left >= 0 && j.right < 0, We = j.left >= 0 && j.right >= 0, Ye = Ve ? "-25%" : Ke ? "25%" : "0%", Z = re(U, s, N), K = v ? re(v.to, s, N) : Z, qe = v ? v.dir === 1 ? Z.right >= 0 ? Z.right : Z.left : Z.left >= 0 ? Z.left : Z.right : te, Je = v ? v.dir === 1 ? K.left >= 0 ? K.left : K.right : K.right >= 0 ? K.right : K.left : te, Qe = v ? v.dir === 1 ? "left" : "right" : null, ye = (r) => r === Qe ? Z[r] : j[r], et = [
609
- ["left", ye("left")],
610
- ["right", ye("right")]
588
+ }, Y = de(S, l, b), te = Y[0] ?? 0, Oe = b === "double" && Y.length === 2 ? `${Y[0] + 1} - ${Y[1] + 1} / ${l}` : `${te + 1} / ${l}`, Re = re <= 1 ? 100 : S / (re - 1) * 100, Be = n.prev, Ue = n.next, Ze = w ? w.to : S, H = oe(Ze, l, b), He = H.left < 0 && H.right >= 0, Ge = H.left >= 0 && H.right < 0, je = H.left >= 0 && H.right >= 0, Ve = He ? "-25%" : Ge ? "25%" : "0%", U = oe(S, l, b), V = w ? oe(w.to, l, b) : U, Xe = w ? w.dir === 1 ? U.right >= 0 ? U.right : U.left : U.left >= 0 ? U.left : U.right : te, Ke = w ? w.dir === 1 ? V.left >= 0 ? V.left : V.right : V.right >= 0 ? V.right : V.left : te, We = w ? w.dir === 1 ? "left" : "right" : null, _e = (r) => r === We ? U[r] : H[r], Ye = [
589
+ ["left", _e("left")],
590
+ ["right", _e("right")]
611
591
  ];
612
- return /* @__PURE__ */ h(ne, { children: [
613
- /* @__PURE__ */ h(
592
+ return /* @__PURE__ */ y(qe, { children: [
593
+ /* @__PURE__ */ y(
614
594
  "div",
615
595
  {
616
- ref: le,
596
+ ref: z,
617
597
  className: "peeek__stage",
618
- "data-layout": N,
598
+ "data-layout": b,
619
599
  tabIndex: 0,
620
- onKeyDown: Fe,
621
- onPointerMove: (r) => E({ x: r.clientX, y: r.clientY }),
622
- onPointerLeave: () => E(null),
623
- style: { "--peeek-aspect": `${he}` },
600
+ onKeyDown: Se,
601
+ style: { "--peeek-aspect": `${pe}` },
624
602
  children: [
625
- i.arrows && /* @__PURE__ */ a(
603
+ s.arrows && /* @__PURE__ */ o(
626
604
  "button",
627
605
  {
628
606
  type: "button",
629
607
  className: "peeek__arrow peeek__arrow--prev",
630
- "aria-label": Xe,
631
- disabled: _e,
632
- onClick: () => L(-1),
608
+ "aria-label": Be,
609
+ disabled: xe,
610
+ onClick: () => W(-1),
633
611
  children: "‹"
634
612
  }
635
613
  ),
636
- /* @__PURE__ */ a(
614
+ /* @__PURE__ */ o(
637
615
  "div",
638
616
  {
639
- className: `peeek__zoom${I > 1 ? " peeek__zoom--pannable" : ""}`,
617
+ className: `peeek__zoom${x > 1 ? " peeek__zoom--pannable" : ""}`,
640
618
  style: {
641
- transform: `translate(${S.x}px, ${S.y}px) scale(${I * Re}) rotate(${f}deg)`,
642
- transition: z || G ? "none" : void 0
619
+ transform: `translate(${F.x}px, ${F.y}px) scale(${x * Ee}) rotate(${X}deg)`,
620
+ transition: O || B ? "none" : void 0
643
621
  },
644
- onDoubleClick: De,
645
- onPointerDown: Be,
646
- onPointerMove: Ue,
647
- onPointerUp: ke,
648
- onPointerCancel: ke,
649
- children: /* @__PURE__ */ h(
622
+ onDoubleClick: Ae,
623
+ onPointerDown: Le,
624
+ onPointerMove: De,
625
+ onPointerUp: he,
626
+ onPointerCancel: he,
627
+ children: /* @__PURE__ */ y(
650
628
  "div",
651
629
  {
652
- className: `peeek__spread${c ? " peeek--shadows" : ""}${We ? " peeek__spread--pair" : ""}`,
653
- style: { transform: `translateX(${Ye})` },
630
+ className: `peeek__spread${u ? " peeek--shadows" : ""}${je ? " peeek__spread--pair" : ""}`,
631
+ style: { transform: `translateX(${Ve})` },
654
632
  children: [
655
- et.map(([r, m]) => {
656
- const x = m >= 0 && i.fullscreen && !_ && !v && I === 1;
657
- return /* @__PURE__ */ a(
633
+ Ye.map(([r, g]) => {
634
+ const T = g >= 0 && s.fullscreen && !k && !w && x === 1;
635
+ return /* @__PURE__ */ o(
658
636
  "div",
659
637
  {
660
- className: `peeek__page peeek__page--${r}${m < 0 ? " peeek__page--empty" : ""}`,
661
- children: m >= 0 && (x ? /* @__PURE__ */ a(
638
+ className: `peeek__page peeek__page--${r}${g < 0 ? " peeek__page--empty" : ""}`,
639
+ children: g >= 0 && (T ? /* @__PURE__ */ o(
662
640
  "button",
663
641
  {
664
642
  type: "button",
665
643
  className: "peeek__page-btn",
666
644
  "aria-label": n.openFullscreen,
667
- onClick: u,
668
- children: /* @__PURE__ */ a("img", { src: e[m], alt: `Page ${m + 1}`, loading: "lazy", referrerPolicy: "no-referrer" })
645
+ onClick: d,
646
+ children: /* @__PURE__ */ o("img", { src: e[g], alt: `Page ${g + 1}`, loading: "lazy", referrerPolicy: "no-referrer" })
669
647
  }
670
- ) : /* @__PURE__ */ a("img", { src: e[m], alt: `Page ${m + 1}`, loading: "lazy", referrerPolicy: "no-referrer" }))
648
+ ) : /* @__PURE__ */ o("img", { src: e[g], alt: `Page ${g + 1}`, loading: "lazy", referrerPolicy: "no-referrer" }))
671
649
  },
672
650
  r
673
651
  );
674
652
  }),
675
- v && /* @__PURE__ */ h(
653
+ w && /* @__PURE__ */ y(
676
654
  "div",
677
655
  {
678
- ref: be,
679
- className: `peeek__leaf peeek__leaf--${v.dir === 1 ? "fwd" : "back"}`,
680
- onTransitionEnd: Se,
656
+ ref: me,
657
+ className: `peeek__leaf peeek__leaf--${w.dir === 1 ? "fwd" : "back"}`,
658
+ onTransitionEnd: ze,
681
659
  children: [
682
- /* @__PURE__ */ a("div", { className: "peeek__leaf-face peeek__leaf-face--front", children: /* @__PURE__ */ a("img", { src: e[qe], alt: "", referrerPolicy: "no-referrer" }) }),
683
- /* @__PURE__ */ a("div", { className: "peeek__leaf-face peeek__leaf-face--back", children: /* @__PURE__ */ a("img", { src: e[Je], alt: "", referrerPolicy: "no-referrer" }) })
660
+ /* @__PURE__ */ o("div", { className: "peeek__leaf-face peeek__leaf-face--front", children: /* @__PURE__ */ o("img", { src: e[Xe], alt: "", referrerPolicy: "no-referrer" }) }),
661
+ /* @__PURE__ */ o("div", { className: "peeek__leaf-face peeek__leaf-face--back", children: /* @__PURE__ */ o("img", { src: e[Ke], alt: "", referrerPolicy: "no-referrer" }) })
684
662
  ]
685
663
  }
686
- ),
687
- i.curl && I === 1 && !v && /* @__PURE__ */ h(ne, { children: [
688
- !ee && /* @__PURE__ */ h(ne, { children: [
689
- /* @__PURE__ */ a(ae, { corner: "tr", pointer: M, instant: z, onActivate: () => L(1) }),
690
- /* @__PURE__ */ a(ae, { corner: "br", pointer: M, instant: z, onActivate: () => L(1) })
691
- ] }),
692
- !_e && /* @__PURE__ */ h(ne, { children: [
693
- /* @__PURE__ */ a(ae, { corner: "tl", pointer: M, instant: z, onActivate: () => L(-1) }),
694
- /* @__PURE__ */ a(ae, { corner: "bl", pointer: M, instant: z, onActivate: () => L(-1) })
695
- ] })
696
- ] })
664
+ )
697
665
  ]
698
666
  }
699
667
  )
700
668
  }
701
669
  ),
702
- i.arrows && /* @__PURE__ */ a(
670
+ s.arrows && /* @__PURE__ */ o(
703
671
  "button",
704
672
  {
705
673
  type: "button",
706
674
  className: "peeek__arrow peeek__arrow--next",
707
- "aria-label": Ge,
708
- disabled: ee,
709
- onClick: () => L(1),
675
+ "aria-label": Ue,
676
+ disabled: le,
677
+ onClick: () => W(1),
710
678
  children: "›"
711
679
  }
712
680
  )
713
681
  ]
714
682
  }
715
683
  ),
716
- i.toolbar && /* @__PURE__ */ a(
717
- wt,
684
+ s.toolbar && /* @__PURE__ */ o(
685
+ kt,
718
686
  {
719
687
  strings: n,
720
- label: Ze,
721
- progress: He,
722
- zoom: I,
723
- minZoom: Q,
724
- maxZoom: oe,
725
- total: s,
688
+ label: Oe,
689
+ progress: Re,
690
+ zoom: x,
691
+ minZoom: ee,
692
+ maxZoom: ae,
693
+ total: l,
726
694
  currentPage: te + 1,
727
- layout: N,
728
- thumbsOpen: X,
729
- isFullscreen: _,
730
- downloadUrl: k,
695
+ layout: b,
696
+ thumbsOpen: Z,
697
+ isFullscreen: k,
698
+ downloadUrl: v,
731
699
  show: {
732
- bar: i.bar,
733
- fullscreen: i.fullscreen,
734
- thumbnails: i.thumbnails && i.overview,
735
- about: i.about,
736
- goto: i.goto,
737
- rotate: i.rotate,
738
- layoutToggle: i.layoutToggle
700
+ bar: s.bar,
701
+ fullscreen: s.fullscreen,
702
+ thumbnails: s.thumbnails && s.overview,
703
+ about: s.about,
704
+ goto: s.goto,
705
+ rotate: s.rotate,
706
+ layoutToggle: s.layoutToggle
739
707
  },
740
- onZoomIn: Ee,
741
- onZoomOut: Le,
742
- onZoomSet: (r) => $(Math.min(oe, Math.max(Q, r))),
743
- onJump: se,
744
- onRotate: Oe,
745
- onToggleLayout: Me,
746
- onToggleThumbs: () => W((r) => !r),
747
- onToggleFullscreen: u,
748
- onAbout: d
708
+ onZoomIn: $e,
709
+ onZoomOut: Me,
710
+ onZoomSet: (r) => M(Math.min(ae, Math.max(ee, r))),
711
+ onJump: ie,
712
+ onRotate: Fe,
713
+ onToggleLayout: K,
714
+ onToggleThumbs: () => j((r) => !r),
715
+ onToggleFullscreen: d,
716
+ onAbout: c
749
717
  }
750
718
  ),
751
- i.overview && X && /* @__PURE__ */ a(Tt, { pages: e, layout: N, rtl: l, activePages: Y, onJump: se })
719
+ s.overview && Z && /* @__PURE__ */ o(yt, { pages: e, layout: b, rtl: i, activePages: Y, onJump: ie })
752
720
  ] });
753
721
  }
754
- function xt(t, e) {
722
+ function wt(t, e) {
755
723
  const n = e.toLowerCase();
756
724
  if (n.includes("pdf")) return "PDF";
757
725
  if (n.includes("wordprocessingml")) return "DOCX";
758
726
  if (n.includes("msword")) return "DOC";
759
- const o = t.toLowerCase().split(".").pop() ?? "";
760
- return o ? o.toUpperCase().slice(0, 4) : "FILE";
727
+ const a = t.toLowerCase().split(".").pop() ?? "";
728
+ return a ? a.toUpperCase().slice(0, 4) : "FILE";
761
729
  }
762
- function It(t, e) {
730
+ function Tt(t, e) {
763
731
  if (t === 0) return { transform: "translateX(0) scale(1)", zIndex: 30, opacity: 1 };
764
- const n = t < 0 ? -1 : 1, o = e ? -1 : 1;
732
+ const n = t < 0 ? -1 : 1, a = e ? -1 : 1;
765
733
  return {
766
- transform: `translateX(${o * n * 62}%) scale(0.82) rotateY(${-o * n * 28}deg)`,
734
+ transform: `translateX(${a * n * 62}%) scale(0.82) rotateY(${-a * n * 28}deg)`,
767
735
  zIndex: 20 - Math.abs(t),
768
736
  opacity: 0.55
769
737
  };
770
738
  }
771
- function zt(t) {
739
+ function Nt(t) {
772
740
  const {
773
741
  pages: e,
774
742
  strings: n,
775
- filename: o,
776
- mimeType: l,
777
- rtl: c,
778
- autoTransition: p,
779
- autoTransitionInterval: b,
780
- downloadUrl: g,
781
- isFullscreen: i,
782
- onToggleFullscreen: k,
783
- onAbout: _,
784
- show: u
785
- } = t, d = e.length, [s, O] = y(0), z = xe(), F = D(
786
- (f) => O((w) => Math.max(0, Math.min(d - 1, w + f))),
787
- [d]
788
- ), R = D(
789
- (f) => O(Math.max(0, Math.min(d - 1, f))),
790
- [d]
791
- ), I = s <= 0, $ = s >= d - 1, X = H([]);
792
- T(() => {
793
- var f, w;
794
- (w = (f = X.current[s]) == null ? void 0 : f.scrollIntoView) == null || w.call(f, { behavior: "smooth", inline: "center", block: "nearest" });
795
- }, [s]), T(() => {
796
- if (!p || z || $) return;
797
- const f = setTimeout(() => F(1), b);
798
- return () => clearTimeout(f);
799
- }, [p, b, z, $, s, F]);
800
- const { onKeyDown: W } = Ie({ go: F, jump: R, total: d, rtl: c }), [S, A] = y(String(s + 1));
801
- T(() => A(String(s + 1)), [s]);
802
- const G = () => {
803
- const f = ze(S, d);
804
- if (f === null) {
805
- A(String(s + 1));
743
+ filename: a,
744
+ mimeType: i,
745
+ rtl: u,
746
+ autoTransition: _,
747
+ autoTransitionInterval: h,
748
+ downloadUrl: f,
749
+ isFullscreen: s,
750
+ onToggleFullscreen: v,
751
+ onAbout: k,
752
+ show: d
753
+ } = t, c = e.length, [l, D] = N(0), O = Ne(), A = L(
754
+ (m) => D((p) => Math.max(0, Math.min(c - 1, p + m))),
755
+ [c]
756
+ ), R = L(
757
+ (m) => D(Math.max(0, Math.min(c - 1, m))),
758
+ [c]
759
+ ), x = l <= 0, M = l >= c - 1, Z = E(/* @__PURE__ */ new Set());
760
+ C(() => {
761
+ for (const m of [l - 2, l - 1, l + 1, l + 2]) {
762
+ const p = m >= 0 && m < c ? e[m] : void 0;
763
+ if (!p || Z.current.has(p)) continue;
764
+ Z.current.add(p);
765
+ const z = new globalThis.Image();
766
+ z.src = p;
767
+ }
768
+ }, [l, c, e]);
769
+ const j = E([]);
770
+ C(() => {
771
+ var m, p;
772
+ (p = (m = j.current[l]) == null ? void 0 : m.scrollIntoView) == null || p.call(m, { behavior: "smooth", inline: "center", block: "nearest" });
773
+ }, [l]), C(() => {
774
+ if (!_ || O || M) return;
775
+ const m = setTimeout(() => A(1), h);
776
+ return () => clearTimeout(m);
777
+ }, [_, h, O, M, l, A]);
778
+ const { onKeyDown: F } = Ce({ go: A, jump: R, total: c, rtl: u }), [$, B] = N(String(l + 1));
779
+ C(() => B(String(l + 1)), [l]);
780
+ const P = () => {
781
+ const m = Pe($, c);
782
+ if (m === null) {
783
+ B(String(l + 1));
806
784
  return;
807
785
  }
808
- R(f);
809
- }, C = xt(o, l);
810
- return /* @__PURE__ */ h("div", { className: "peeek__cf", children: [
811
- /* @__PURE__ */ h("div", { className: "peeek__cf-header", children: [
812
- /* @__PURE__ */ a("span", { className: "peeek__cf-badge", children: C }),
813
- /* @__PURE__ */ h("div", { className: "peeek__cf-meta", children: [
814
- /* @__PURE__ */ a("span", { className: "peeek__cf-name", children: o }),
815
- /* @__PURE__ */ h("span", { className: "peeek__cf-count", children: [
816
- d,
786
+ R(m);
787
+ }, X = wt(a, i);
788
+ return /* @__PURE__ */ y("div", { className: "peeek__cf", children: [
789
+ /* @__PURE__ */ y("div", { className: "peeek__cf-header", children: [
790
+ /* @__PURE__ */ o("span", { className: "peeek__cf-badge", children: X }),
791
+ /* @__PURE__ */ y("div", { className: "peeek__cf-meta", children: [
792
+ /* @__PURE__ */ o("span", { className: "peeek__cf-name", children: a }),
793
+ /* @__PURE__ */ y("span", { className: "peeek__cf-count", children: [
794
+ c,
817
795
  " ",
818
- d === 1 ? n.page : n.pages
796
+ c === 1 ? n.page : n.pages
819
797
  ] })
820
798
  ] }),
821
- /* @__PURE__ */ h("span", { className: "peeek__cf-indicator", children: [
822
- s + 1,
799
+ /* @__PURE__ */ y("span", { className: "peeek__cf-indicator", children: [
800
+ l + 1,
823
801
  " / ",
824
- d
802
+ c
825
803
  ] }),
826
- u.goto && /* @__PURE__ */ a(
804
+ d.goto && /* @__PURE__ */ o(
827
805
  "input",
828
806
  {
829
807
  className: "peeek__goto",
830
808
  type: "text",
831
809
  inputMode: "numeric",
832
810
  "aria-label": n.goToPage,
833
- value: S,
834
- onChange: (f) => A(f.target.value),
835
- onBlur: G,
836
- onKeyDown: (f) => {
837
- f.key === "Enter" && (f.preventDefault(), G());
811
+ value: $,
812
+ onChange: (m) => B(m.target.value),
813
+ onBlur: P,
814
+ onKeyDown: (m) => {
815
+ m.key === "Enter" && (m.preventDefault(), P());
838
816
  }
839
817
  }
840
818
  ),
841
- g && /* @__PURE__ */ a(
819
+ f && /* @__PURE__ */ o(
842
820
  "a",
843
821
  {
844
822
  className: "peeek__btn",
845
- href: g,
823
+ href: f,
846
824
  "aria-label": n.download,
847
825
  target: "_blank",
848
826
  rel: "noopener noreferrer",
@@ -850,107 +828,107 @@ function zt(t) {
850
828
  children: "↓"
851
829
  }
852
830
  ),
853
- u.fullscreen && /* @__PURE__ */ a(
831
+ d.fullscreen && /* @__PURE__ */ o(
854
832
  "button",
855
833
  {
856
834
  type: "button",
857
- className: `peeek__btn${i ? " peeek__btn--active" : ""}`,
835
+ className: `peeek__btn${s ? " peeek__btn--active" : ""}`,
858
836
  "aria-label": n.fullscreen,
859
- "aria-pressed": i,
860
- onClick: k,
837
+ "aria-pressed": s,
838
+ onClick: v,
861
839
  children: "⛶"
862
840
  }
863
841
  ),
864
- u.about && /* @__PURE__ */ a(
842
+ d.about && /* @__PURE__ */ o(
865
843
  "button",
866
844
  {
867
845
  type: "button",
868
846
  className: "peeek__btn",
869
847
  "aria-label": n.about,
870
- onClick: _,
848
+ onClick: k,
871
849
  children: "?"
872
850
  }
873
851
  )
874
852
  ] }),
875
- /* @__PURE__ */ h(
853
+ /* @__PURE__ */ y(
876
854
  "div",
877
855
  {
878
856
  className: "peeek__cf-stage",
879
857
  tabIndex: 0,
880
- onKeyDown: W,
858
+ onKeyDown: F,
881
859
  children: [
882
- u.arrows && /* @__PURE__ */ a(
860
+ d.arrows && /* @__PURE__ */ o(
883
861
  "button",
884
862
  {
885
863
  type: "button",
886
864
  className: "peeek__arrow peeek__arrow--prev",
887
865
  "aria-label": n.prev,
888
- disabled: I,
889
- onClick: () => F(-1),
866
+ disabled: x,
867
+ onClick: () => A(-1),
890
868
  children: "‹"
891
869
  }
892
870
  ),
893
- e.map((f, w) => {
894
- const M = w - s;
895
- if (Math.abs(M) > 1) return null;
896
- const E = M === 0, B = E && u.fullscreen;
897
- return /* @__PURE__ */ a(
871
+ e.map((m, p) => {
872
+ const z = p - l;
873
+ if (Math.abs(z) > 1) return null;
874
+ const b = z === 0, K = b && d.fullscreen;
875
+ return /* @__PURE__ */ o(
898
876
  "button",
899
877
  {
900
878
  type: "button",
901
- className: `peeek__cf-card${E ? " peeek__cf-card--center" : ""}${B ? " peeek__cf-card--zoom" : ""}`,
902
- style: It(M, c),
903
- tabIndex: E ? 0 : -1,
904
- "aria-label": B ? n.openFullscreen : `Go to page ${w + 1}`,
905
- onClick: () => B ? k() : O(w),
906
- children: /* @__PURE__ */ a("img", { src: f, alt: E ? `Page ${w + 1}` : "", loading: "lazy", referrerPolicy: "no-referrer" })
879
+ className: `peeek__cf-card${b ? " peeek__cf-card--center" : ""}${K ? " peeek__cf-card--zoom" : ""}`,
880
+ style: Tt(z, u),
881
+ tabIndex: b ? 0 : -1,
882
+ "aria-label": K ? n.openFullscreen : `Go to page ${p + 1}`,
883
+ onClick: () => K ? v() : D(p),
884
+ children: /* @__PURE__ */ o("img", { src: m, alt: b ? `Page ${p + 1}` : "", loading: "lazy", referrerPolicy: "no-referrer" })
907
885
  },
908
- w
886
+ p
909
887
  );
910
888
  }),
911
- u.arrows && /* @__PURE__ */ a(
889
+ d.arrows && /* @__PURE__ */ o(
912
890
  "button",
913
891
  {
914
892
  type: "button",
915
893
  className: "peeek__arrow peeek__arrow--next",
916
894
  "aria-label": n.next,
917
- disabled: $,
918
- onClick: () => F(1),
895
+ disabled: M,
896
+ onClick: () => A(1),
919
897
  children: "›"
920
898
  }
921
899
  )
922
900
  ]
923
901
  }
924
902
  ),
925
- u.thumbnails && /* @__PURE__ */ a("div", { className: "peeek__cf-thumbs", role: "group", "aria-label": "Pages", children: e.map((f, w) => {
926
- const M = w === s;
927
- return /* @__PURE__ */ h(
903
+ d.thumbnails && /* @__PURE__ */ o("div", { className: "peeek__cf-thumbs", role: "group", "aria-label": "Pages", children: e.map((m, p) => {
904
+ const z = p === l;
905
+ return /* @__PURE__ */ y(
928
906
  "button",
929
907
  {
930
- ref: (E) => {
931
- X.current[w] = E;
908
+ ref: (b) => {
909
+ j.current[p] = b;
932
910
  },
933
911
  type: "button",
934
- className: `peeek__cf-thumb${M ? " peeek__cf-thumb--active" : ""}`,
935
- "aria-label": `Go to page ${w + 1}`,
936
- "aria-current": M ? "page" : void 0,
937
- onClick: () => O(w),
912
+ className: `peeek__cf-thumb${z ? " peeek__cf-thumb--active" : ""}`,
913
+ "aria-label": `Go to page ${p + 1}`,
914
+ "aria-current": z ? "page" : void 0,
915
+ onClick: () => D(p),
938
916
  children: [
939
- /* @__PURE__ */ a("img", { src: f, alt: "", loading: "lazy", referrerPolicy: "no-referrer" }),
940
- /* @__PURE__ */ a("span", { className: "peeek__cf-thumb-num", children: String(w + 1).padStart(2, "0") })
917
+ /* @__PURE__ */ o("img", { src: m, alt: "", loading: "lazy", referrerPolicy: "no-referrer" }),
918
+ /* @__PURE__ */ o("span", { className: "peeek__cf-thumb-num", children: String(p + 1).padStart(2, "0") })
941
919
  ]
942
920
  },
943
- w
921
+ p
944
922
  );
945
923
  }) })
946
924
  ] });
947
925
  }
948
- function At({ logo: t, logoLink: e }) {
926
+ function Ct({ logo: t, logoLink: e }) {
949
927
  if (!t) return null;
950
- const n = /* @__PURE__ */ a("img", { src: t, alt: "Logo", loading: "lazy", referrerPolicy: "no-referrer" });
951
- return /* @__PURE__ */ a("div", { className: "peeek__branding", children: e ? /* @__PURE__ */ a("a", { href: e, target: "_blank", rel: "noopener noreferrer", children: n }) : n });
928
+ const n = /* @__PURE__ */ o("img", { src: t, alt: "Logo", loading: "lazy", referrerPolicy: "no-referrer" });
929
+ return /* @__PURE__ */ o("div", { className: "peeek__branding", children: e ? /* @__PURE__ */ o("a", { href: e, target: "_blank", rel: "noopener noreferrer", children: n }) : n });
952
930
  }
953
- const Mt = [
931
+ const Pt = [
954
932
  { top: "12%", left: "10%", size: 3, v: "A", dur: 13, delay: 0 },
955
933
  { top: "22%", left: "82%", size: 2, v: "B", dur: 16, delay: 2 },
956
934
  { top: "40%", left: "16%", size: 2, v: "C", dur: 12, delay: 1 },
@@ -964,40 +942,40 @@ const Mt = [
964
942
  { top: "16%", left: "50%", size: 2, v: "B", dur: 14, delay: 3 },
965
943
  { top: "62%", left: "34%", size: 2, v: "C", dur: 12, delay: 2 }
966
944
  ];
967
- function $t({ strings: t, onClose: e }) {
968
- const n = H(null);
969
- return T(() => {
970
- var o;
971
- (o = n.current) == null || o.focus();
972
- }, []), T(() => {
973
- const o = (l) => {
974
- l.key === "Escape" && e();
945
+ function It({ strings: t, onClose: e }) {
946
+ const n = E(null);
947
+ return C(() => {
948
+ var a;
949
+ (a = n.current) == null || a.focus();
950
+ }, []), C(() => {
951
+ const a = (i) => {
952
+ i.key === "Escape" && e();
975
953
  };
976
- return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
977
- }, [e]), /* @__PURE__ */ a("div", { className: "peeek__about-backdrop", onClick: e, children: /* @__PURE__ */ h(
954
+ return document.addEventListener("keydown", a), () => document.removeEventListener("keydown", a);
955
+ }, [e]), /* @__PURE__ */ o("div", { className: "peeek__about-backdrop", onClick: e, children: /* @__PURE__ */ y(
978
956
  "div",
979
957
  {
980
958
  role: "dialog",
981
959
  "aria-modal": "true",
982
960
  "aria-label": "Peeek Viewer",
983
961
  className: "peeek__about",
984
- onClick: (o) => o.stopPropagation(),
962
+ onClick: (a) => a.stopPropagation(),
985
963
  children: [
986
- /* @__PURE__ */ a("span", { className: "peeek__about-particles", "aria-hidden": "true", children: Mt.map((o, l) => /* @__PURE__ */ a(
964
+ /* @__PURE__ */ o("span", { className: "peeek__about-particles", "aria-hidden": "true", children: Pt.map((a, i) => /* @__PURE__ */ o(
987
965
  "span",
988
966
  {
989
967
  className: "peeek__about-particle",
990
968
  style: {
991
- top: o.top,
992
- left: o.left,
993
- width: o.size,
994
- height: o.size,
995
- animation: `peeekAboutDrift${o.v} ${o.dur}s ease-in-out ${o.delay}s infinite`
969
+ top: a.top,
970
+ left: a.left,
971
+ width: a.size,
972
+ height: a.size,
973
+ animation: `peeekAboutDrift${a.v} ${a.dur}s ease-in-out ${a.delay}s infinite`
996
974
  }
997
975
  },
998
- l
976
+ i
999
977
  )) }),
1000
- /* @__PURE__ */ a(
978
+ /* @__PURE__ */ o(
1001
979
  "button",
1002
980
  {
1003
981
  ref: n,
@@ -1008,10 +986,10 @@ function $t({ strings: t, onClose: e }) {
1008
986
  children: "×"
1009
987
  }
1010
988
  ),
1011
- /* @__PURE__ */ h("div", { className: "peeek__about-content", children: [
1012
- /* @__PURE__ */ h("div", { className: "peeek__about-orbwrap", children: [
1013
- /* @__PURE__ */ a("span", { className: "peeek__about-ring", "aria-hidden": "true" }),
1014
- /* @__PURE__ */ h(
989
+ /* @__PURE__ */ y("div", { className: "peeek__about-content", children: [
990
+ /* @__PURE__ */ y("div", { className: "peeek__about-orbwrap", children: [
991
+ /* @__PURE__ */ o("span", { className: "peeek__about-ring", "aria-hidden": "true" }),
992
+ /* @__PURE__ */ y(
1015
993
  "svg",
1016
994
  {
1017
995
  className: "peeek__about-mark",
@@ -1020,13 +998,13 @@ function $t({ strings: t, onClose: e }) {
1020
998
  viewBox: "0 0 256 256",
1021
999
  "aria-hidden": "true",
1022
1000
  children: [
1023
- /* @__PURE__ */ a("defs", { children: /* @__PURE__ */ h("radialGradient", { id: "peeek-about-orb", cx: "38%", cy: "30%", r: "80%", children: [
1024
- /* @__PURE__ */ a("stop", { offset: "0%", stopColor: "#9aa2e6" }),
1025
- /* @__PURE__ */ a("stop", { offset: "55%", stopColor: "#6E79D6" }),
1026
- /* @__PURE__ */ a("stop", { offset: "100%", stopColor: "#535cc0" })
1001
+ /* @__PURE__ */ o("defs", { children: /* @__PURE__ */ y("radialGradient", { id: "peeek-about-orb", cx: "38%", cy: "30%", r: "80%", children: [
1002
+ /* @__PURE__ */ o("stop", { offset: "0%", stopColor: "#9aa2e6" }),
1003
+ /* @__PURE__ */ o("stop", { offset: "55%", stopColor: "#6E79D6" }),
1004
+ /* @__PURE__ */ o("stop", { offset: "100%", stopColor: "#535cc0" })
1027
1005
  ] }) }),
1028
- /* @__PURE__ */ a("circle", { cx: "128", cy: "128", r: "128", fill: "url(#peeek-about-orb)" }),
1029
- /* @__PURE__ */ a(
1006
+ /* @__PURE__ */ o("circle", { cx: "128", cy: "128", r: "128", fill: "url(#peeek-about-orb)" }),
1007
+ /* @__PURE__ */ o(
1030
1008
  "path",
1031
1009
  {
1032
1010
  d: "M90 196 V70 H140 A38 38 0 0 1 140 146 H90",
@@ -1041,27 +1019,27 @@ function $t({ strings: t, onClose: e }) {
1041
1019
  }
1042
1020
  )
1043
1021
  ] }),
1044
- /* @__PURE__ */ a("div", { className: "peeek__about-name", children: "Peeek Viewer" }),
1045
- /* @__PURE__ */ a("div", { className: "peeek__about-tagline", children: t.aboutTagline }),
1046
- /* @__PURE__ */ h("div", { className: "peeek__about-version", children: [
1022
+ /* @__PURE__ */ o("div", { className: "peeek__about-name", children: "Peeek Viewer" }),
1023
+ /* @__PURE__ */ o("div", { className: "peeek__about-tagline", children: t.aboutTagline }),
1024
+ /* @__PURE__ */ y("div", { className: "peeek__about-version", children: [
1047
1025
  "v",
1048
- "0.4.0"
1026
+ "0.4.2"
1049
1027
  ] }),
1050
- /* @__PURE__ */ a("p", { className: "peeek__about-desc", children: t.aboutDescription })
1028
+ /* @__PURE__ */ o("p", { className: "peeek__about-desc", children: t.aboutDescription })
1051
1029
  ] })
1052
1030
  ]
1053
1031
  }
1054
1032
  ) });
1055
1033
  }
1056
- function Lt(t) {
1057
- const e = mt(t), n = gt(e.language), o = H(null), { isFullscreen: l, toggle: c } = _t(o), [p, b] = y(!1), g = t.pages !== void 0, i = tt(
1058
- () => g ? bt(t.pages, { filename: t.filename, mimeType: t.mimeType }) : null,
1059
- [g, t.pages, t.filename, t.mimeType]
1060
- ), k = ht(g ? null : e.src, e.pollInterval), _ = g ? i : k.manifest, u = g ? i ? "ready" : "loading" : k.state, d = {
1034
+ function $t(t) {
1035
+ const e = dt(t), n = ct(e.language), a = E(null), { isFullscreen: i, toggle: u } = pt(a), [_, h] = N(!1), f = t.pages !== void 0, s = Je(
1036
+ () => f ? ft(t.pages, { filename: t.filename, mimeType: t.mimeType }) : null,
1037
+ [f, t.pages, t.filename, t.mimeType]
1038
+ ), v = mt(f ? null : e.src, e.pollInterval), k = f ? s : v.manifest, d = f ? s ? "ready" : "loading" : v.state, c = {
1061
1039
  "--peeek-accent": e.accentColor
1062
1040
  };
1063
- e.background === "transparent" ? d["--peeek-bg"] = "transparent" : e.background === "color" && e.backgroundColor ? d["--peeek-bg"] = e.backgroundColor : e.background === "image" && e.backgroundImage && (d["--peeek-bg"] = `center / cover no-repeat url("${e.backgroundImage}")`);
1064
- const s = {
1041
+ e.background === "transparent" ? c["--peeek-bg"] = "transparent" : e.background === "color" && e.backgroundColor ? c["--peeek-bg"] = e.backgroundColor : e.background === "image" && e.backgroundImage && (c["--peeek-bg"] = `center / cover no-repeat url("${e.backgroundImage}")`);
1042
+ const l = {
1065
1043
  toolbar: e.navigationControls,
1066
1044
  bar: e.navigationBar,
1067
1045
  fullscreen: e.fullscreen,
@@ -1071,46 +1049,45 @@ function Lt(t) {
1071
1049
  about: e.aboutButton,
1072
1050
  goto: e.goToPage,
1073
1051
  rotate: e.rotateControl,
1074
- layoutToggle: e.layoutToggle,
1075
- curl: e.pageCurl
1052
+ layoutToggle: e.layoutToggle
1076
1053
  };
1077
- return /* @__PURE__ */ h(
1054
+ return /* @__PURE__ */ y(
1078
1055
  "div",
1079
1056
  {
1080
- ref: o,
1057
+ ref: a,
1081
1058
  className: `peeek${e.fillHeight ? " peeek--fill-height" : ""}${e.className ? " " + e.className : ""}`,
1082
1059
  "data-skin": e.skin,
1083
1060
  "data-layout": e.layout,
1084
1061
  dir: e.rtl ? "rtl" : void 0,
1085
- style: d,
1062
+ style: c,
1086
1063
  children: [
1087
- /* @__PURE__ */ a(At, { logo: e.logo, logoLink: e.logoLink }),
1088
- u === "loading" && /* @__PURE__ */ h("div", { className: "peeek__state", style: e.loadingColor ? { color: e.loadingColor } : void 0, children: [
1089
- e.loadingImage && /* @__PURE__ */ a("img", { className: "peeek__state-img", src: e.loadingImage, alt: "", referrerPolicy: "no-referrer" }),
1090
- /* @__PURE__ */ a("span", { children: e.loadingCaption ?? n.loading })
1064
+ /* @__PURE__ */ o(Ct, { logo: e.logo, logoLink: e.logoLink }),
1065
+ d === "loading" && /* @__PURE__ */ y("div", { className: "peeek__state", style: e.loadingColor ? { color: e.loadingColor } : void 0, children: [
1066
+ e.loadingImage && /* @__PURE__ */ o("img", { className: "peeek__state-img", src: e.loadingImage, alt: "", referrerPolicy: "no-referrer" }),
1067
+ /* @__PURE__ */ o("span", { children: e.loadingCaption ?? n.loading })
1091
1068
  ] }),
1092
- u === "error" && /* @__PURE__ */ a("div", { className: "peeek__state", children: n.error }),
1093
- u === "ready" && _ && e.mode === "coverflow" && /* @__PURE__ */ a(
1094
- zt,
1069
+ d === "error" && /* @__PURE__ */ o("div", { className: "peeek__state", children: n.error }),
1070
+ d === "ready" && k && e.mode === "coverflow" && /* @__PURE__ */ o(
1071
+ Nt,
1095
1072
  {
1096
- pages: _.pages,
1073
+ pages: k.pages,
1097
1074
  strings: n,
1098
- filename: _.metadata.filename,
1099
- mimeType: _.metadata.mimeType,
1075
+ filename: k.metadata.filename,
1076
+ mimeType: k.metadata.mimeType,
1100
1077
  rtl: e.rtl,
1101
1078
  autoTransition: e.autoTransition,
1102
1079
  autoTransitionInterval: e.autoTransitionInterval,
1103
1080
  downloadUrl: e.downloadUrl,
1104
- isFullscreen: l,
1105
- onToggleFullscreen: c,
1106
- onAbout: () => b(!0),
1081
+ isFullscreen: i,
1082
+ onToggleFullscreen: u,
1083
+ onAbout: () => h(!0),
1107
1084
  show: { arrows: e.arrows, thumbnails: e.pagesOverview, fullscreen: e.fullscreen, about: e.aboutButton, goto: e.goToPage }
1108
1085
  }
1109
1086
  ),
1110
- u === "ready" && _ && e.mode === "flip" && /* @__PURE__ */ a(
1111
- Pt,
1087
+ d === "ready" && k && e.mode === "flip" && /* @__PURE__ */ o(
1088
+ vt,
1112
1089
  {
1113
- pages: _.pages,
1090
+ pages: k.pages,
1114
1091
  strings: n,
1115
1092
  layout: e.layout,
1116
1093
  rtl: e.rtl,
@@ -1118,18 +1095,18 @@ function Lt(t) {
1118
1095
  animateInteractions: e.animateInteractions,
1119
1096
  autoTransition: e.autoTransition,
1120
1097
  autoTransitionInterval: e.autoTransitionInterval,
1121
- show: s,
1098
+ show: l,
1122
1099
  downloadUrl: e.downloadUrl,
1123
- isFullscreen: l,
1124
- onToggleFullscreen: c,
1125
- onAbout: () => b(!0)
1100
+ isFullscreen: i,
1101
+ onToggleFullscreen: u,
1102
+ onAbout: () => h(!0)
1126
1103
  }
1127
1104
  ),
1128
- p && /* @__PURE__ */ a($t, { strings: n, onClose: () => b(!1) })
1105
+ _ && /* @__PURE__ */ o(It, { strings: n, onClose: () => h(!1) })
1129
1106
  ]
1130
1107
  }
1131
1108
  );
1132
1109
  }
1133
1110
  export {
1134
- Lt as PeeekViewer
1111
+ $t as PeeekViewer
1135
1112
  };