@peeekpage/viewer 0.4.2 → 0.4.4

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