html-flip-book-react 0.0.0-alpha.47 → 0.0.0-alpha.49

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.
@@ -1,10 +1,10 @@
1
- import { jsx as t, jsxs as T } from "react/jsx-runtime";
2
- import { createContext as ce, useContext as ie, useMemo as Q, useCallback as v, useEffect as z, useState as I, useRef as J, useLayoutEffect as he } from "react";
3
- let pe = 4;
4
- function re() {
5
- return pe;
1
+ import { jsx as t, jsxs as y } from "react/jsx-runtime";
2
+ import { createContext as he, useContext as pe, useMemo as ee, useCallback as P, useEffect as W, useState as D, useRef as _, useLayoutEffect as ve } from "react";
3
+ let Pe = 4;
4
+ function ue() {
5
+ return Pe;
6
6
  }
7
- const fe = {
7
+ const Te = {
8
8
  id: "download",
9
9
  enName: "Download",
10
10
  enDescription: "Download entire book or page range",
@@ -17,51 +17,51 @@ const fe = {
17
17
  );
18
18
  },
19
19
  canExecute: (e) => typeof e.data?.onDownload == "function"
20
- }, be = [
20
+ }, ye = [
21
21
  { key: "ArrowRight" },
22
22
  { key: "PageDown" },
23
23
  { key: " " }
24
24
  // Space
25
- ], Y = {
25
+ ], oe = {
26
26
  id: "flipNext",
27
27
  navKind: "flip",
28
28
  enName: "Next Page",
29
29
  enDescription: "Flip to the next page",
30
30
  nameKey: "command.jumpToNextPage",
31
- hotkeys: be,
31
+ hotkeys: ye,
32
32
  execute: (e) => {
33
33
  e.handle?.flipNext();
34
34
  },
35
35
  canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) < (e.handle?.getTotalPages() ?? 0) - 1
36
- }, we = [{ key: "ArrowLeft" }, { key: "PageUp" }], Z = {
36
+ }, Ce = [{ key: "ArrowLeft" }, { key: "PageUp" }], te = {
37
37
  id: "flipPrev",
38
38
  navKind: "flip",
39
39
  enName: "Previous Page",
40
40
  enDescription: "Flip to the previous page",
41
41
  nameKey: "command.jumpToPrevPage",
42
- hotkeys: we,
42
+ hotkeys: Ce,
43
43
  execute: (e) => {
44
44
  e.handle?.flipPrev();
45
45
  },
46
46
  canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) > 0
47
- }, xe = [{ key: "Home" }, { key: "ArrowLeft", modifiers: { ctrl: !0 } }], ee = {
47
+ }, Ie = [{ key: "Home" }, { key: "ArrowLeft", modifiers: { ctrl: !0 } }], ne = {
48
48
  id: "goToFirst",
49
49
  navKind: "jump",
50
50
  enName: "First Page",
51
51
  enDescription: "Jump to the first page",
52
52
  nameKey: "command.jumpToFirstPage",
53
- hotkeys: xe,
53
+ hotkeys: Ie,
54
54
  execute: (e) => {
55
55
  e.handle?.jumpToPage(0);
56
56
  },
57
57
  canExecute: (e) => e.handle?.getCurrentPageIndex() !== 0
58
- }, ke = [{ key: "End" }, { key: "ArrowRight", modifiers: { ctrl: !0 } }], oe = {
58
+ }, De = [{ key: "End" }, { key: "ArrowRight", modifiers: { ctrl: !0 } }], ae = {
59
59
  id: "goToLast",
60
60
  navKind: "jump",
61
61
  enName: "Last Page",
62
62
  enDescription: "Jump to the last page",
63
63
  nameKey: "command.jumpToLastPage",
64
- hotkeys: ke,
64
+ hotkeys: De,
65
65
  execute: (e) => {
66
66
  const o = e.handle?.getTotalPages() ?? 0;
67
67
  e.handle?.jumpToPage(o - 1);
@@ -70,142 +70,142 @@ const fe = {
70
70
  const o = e.handle?.getCurrentPageIndex() ?? 0, a = e.handle?.getTotalPages() ?? 0;
71
71
  return o !== a - 1;
72
72
  }
73
- }, ve = [{ key: "t" }], te = {
73
+ }, Ne = [{ key: "t" }], re = {
74
74
  id: "goToToc",
75
75
  navKind: "jump",
76
76
  enName: "Table of Contents",
77
77
  enDescription: "Jump to the table of contents",
78
78
  nameKey: "command.jumpToToc",
79
- hotkeys: ve,
79
+ hotkeys: Ne,
80
80
  execute: (e) => {
81
- const o = e.handle?.getTocPageIndex?.() ?? re();
81
+ const o = e.handle?.getTocPageIndex?.() ?? ue();
82
82
  e.handle?.jumpToPage(o);
83
83
  },
84
84
  canExecute: (e) => {
85
- const o = e.handle?.getTocPageIndex?.() ?? re();
85
+ const o = e.handle?.getTocPageIndex?.() ?? ue();
86
86
  return e.handle?.getCurrentPageIndex() !== o;
87
87
  }
88
- }, Pe = [{ key: "d", modifiers: { ctrl: !0, alt: !0 } }], Te = {
88
+ }, Le = [{ key: "d", modifiers: { ctrl: !0, alt: !0 } }], Ee = {
89
89
  id: "toggleDebug",
90
90
  enName: "Toggle Debug Toolbar",
91
91
  enDescription: "Show or hide the debug toolbar (Ctrl+Alt+D)",
92
92
  nameKey: "command.toggleDebug",
93
93
  descriptionKey: "command.toggleDebugDesc",
94
- hotkeys: Pe,
94
+ hotkeys: Le,
95
95
  execute: (e) => {
96
96
  e.handle?.toggleDebugBar?.();
97
97
  }
98
- }, ye = [{ key: "F11" }], Ce = {
98
+ }, Fe = [{ key: "F11" }], je = {
99
99
  id: "toggleFullscreen",
100
100
  enName: "Toggle Fullscreen",
101
101
  enDescription: "Enter or exit fullscreen mode",
102
102
  nameKey: "command.toggleFullscreen",
103
103
  descriptionKey: "command.toggleFullscreenDesc",
104
- hotkeys: ye,
104
+ hotkeys: Fe,
105
105
  execute: (e) => {
106
106
  const o = e.data;
107
107
  document.fullscreenElement ? document.exitFullscreen().catch(console.warn) : (o?.getFullscreenTarget?.() ?? document.documentElement).requestFullscreen().catch(console.warn);
108
108
  }
109
- }, Ie = [
110
- Y,
111
- Z,
112
- ee,
109
+ }, Me = [
113
110
  oe,
114
111
  te,
115
- Ce,
116
- Te,
117
- fe
112
+ ne,
113
+ ae,
114
+ re,
115
+ je,
116
+ Ee,
117
+ Te
118
118
  ];
119
- function De(e, o) {
119
+ function $e(e, o) {
120
120
  return o !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
121
121
  }
122
- function Ne(e, o, a) {
123
- if (De(o.key, a) !== e.key) return !1;
122
+ function Be(e, o, a) {
123
+ if ($e(o.key, a) !== e.key) return !1;
124
124
  const n = e.modifiers ?? {};
125
125
  return !(!!n.ctrl !== o.ctrlKey || !!n.shift !== o.shiftKey || !!n.alt !== o.altKey || !!n.meta !== o.metaKey);
126
126
  }
127
- const de = ce(null), Le = ({
127
+ const fe = he(null), Re = ({
128
128
  flipBookRef: e,
129
129
  currentPage: o,
130
130
  totalPages: a,
131
131
  direction: n = "ltr",
132
- commands: r = [],
133
- commandOptions: c = {},
132
+ commands: l = [],
133
+ commandOptions: i = {},
134
134
  disableHotkeys: s = !1,
135
- children: i
135
+ children: c
136
136
  }) => {
137
- const h = Q(() => {
137
+ const h = ee(() => {
138
138
  const d = {};
139
- for (const u of Ie)
139
+ for (const u of Me)
140
140
  d[u.id] = {
141
141
  command: u,
142
- options: c[u.id] ?? {}
142
+ options: i[u.id] ?? {}
143
143
  };
144
- for (const u of r)
144
+ for (const u of l)
145
145
  d[u.id] = {
146
146
  command: u,
147
- options: c[u.id] ?? {}
147
+ options: i[u.id] ?? {}
148
148
  };
149
149
  return d;
150
- }, [r, c]), f = v(
150
+ }, [l, i]), b = P(
151
151
  (d, u) => {
152
- const b = h[d.id]?.options ?? {}, F = u ? { ...b.data, ...u } : b.data;
152
+ const w = h[d.id]?.options ?? {}, F = u ? { ...w.data, ...u } : w.data;
153
153
  return {
154
154
  handle: e.current,
155
155
  data: F
156
156
  };
157
157
  },
158
158
  [e, h]
159
- ), m = v(
159
+ ), g = P(
160
160
  (d, u) => {
161
- const b = f(d, u);
162
- d.canExecute && !d.canExecute(b) || d.execute(b);
161
+ const w = b(d, u);
162
+ d.canExecute && !d.canExecute(w) || d.execute(w);
163
163
  },
164
- [f]
165
- ), y = v(
164
+ [b]
165
+ ), C = P(
166
166
  (d) => {
167
- const u = f(d);
167
+ const u = b(d);
168
168
  return d.canExecute ? d.canExecute(u) : !0;
169
169
  },
170
- [f]
171
- ), D = v(
170
+ [b]
171
+ ), N = P(
172
172
  () => Object.values(h).map((d) => d.command),
173
173
  [h]
174
- ), P = v(
174
+ ), T = P(
175
175
  (d) => {
176
176
  const u = d.target;
177
177
  if (!(u.tagName === "INPUT" || u.tagName === "TEXTAREA" || u.isContentEditable))
178
- for (const b of Object.values(h)) {
179
- if (b.options.disableHotkeys) continue;
180
- const F = b.options.hotkeys ?? b.command.hotkeys ?? [];
178
+ for (const w of Object.values(h)) {
179
+ if (w.options.disableHotkeys) continue;
180
+ const F = w.options.hotkeys ?? w.command.hotkeys ?? [];
181
181
  for (const M of F)
182
- if (Ne(M, d, n)) {
183
- d.preventDefault(), m(b.command);
182
+ if (Be(M, d, n)) {
183
+ d.preventDefault(), g(w.command);
184
184
  return;
185
185
  }
186
186
  }
187
187
  },
188
- [h, m, n]
188
+ [h, g, n]
189
189
  );
190
- z(() => {
190
+ W(() => {
191
191
  if (!s)
192
- return document.addEventListener("keydown", P), () => document.removeEventListener("keydown", P);
193
- }, [s, P]);
194
- const C = Q(
192
+ return document.addEventListener("keydown", T), () => document.removeEventListener("keydown", T);
193
+ }, [s, T]);
194
+ const I = ee(
195
195
  () => ({
196
- execute: m,
197
- canExecute: y,
198
- getAllCommands: D
196
+ execute: g,
197
+ canExecute: C,
198
+ getAllCommands: N
199
199
  }),
200
- [m, y, D]
200
+ [g, C, N]
201
201
  );
202
- return /* @__PURE__ */ t(de.Provider, { value: C, children: i });
203
- }, _ = () => {
204
- const e = ie(de);
202
+ return /* @__PURE__ */ t(fe.Provider, { value: I, children: c });
203
+ }, X = () => {
204
+ const e = pe(fe);
205
205
  if (!e)
206
206
  throw new Error("useCommands must be used within a CommandProvider");
207
207
  return e;
208
- }, S = { size: 24 }, Fe = ({ size: e = S.size, className: o }) => /* @__PURE__ */ t(
208
+ }, K = { size: 24 }, Se = ({ size: e = K.size, className: o }) => /* @__PURE__ */ t(
209
209
  "svg",
210
210
  {
211
211
  xmlns: "http://www.w3.org/2000/svg",
@@ -221,7 +221,7 @@ const de = ce(null), Le = ({
221
221
  "aria-hidden": "true",
222
222
  children: /* @__PURE__ */ t("path", { d: "m15 18-6-6 6-6" })
223
223
  }
224
- ), Ee = ({ size: e = S.size, className: o }) => /* @__PURE__ */ t(
224
+ ), Ke = ({ size: e = K.size, className: o }) => /* @__PURE__ */ t(
225
225
  "svg",
226
226
  {
227
227
  xmlns: "http://www.w3.org/2000/svg",
@@ -237,7 +237,7 @@ const de = ce(null), Le = ({
237
237
  "aria-hidden": "true",
238
238
  children: /* @__PURE__ */ t("path", { d: "m9 18 6-6-6-6" })
239
239
  }
240
- ), je = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
240
+ ), Ae = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
241
241
  "svg",
242
242
  {
243
243
  xmlns: "http://www.w3.org/2000/svg",
@@ -256,7 +256,7 @@ const de = ce(null), Le = ({
256
256
  /* @__PURE__ */ t("path", { d: "M7 6v12" })
257
257
  ]
258
258
  }
259
- ), Me = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
259
+ ), ze = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
260
260
  "svg",
261
261
  {
262
262
  xmlns: "http://www.w3.org/2000/svg",
@@ -275,7 +275,7 @@ const de = ce(null), Le = ({
275
275
  /* @__PURE__ */ t("path", { d: "M17 6v12" })
276
276
  ]
277
277
  }
278
- ), $e = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
278
+ ), He = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
279
279
  "svg",
280
280
  {
281
281
  xmlns: "http://www.w3.org/2000/svg",
@@ -296,7 +296,7 @@ const de = ce(null), Le = ({
296
296
  /* @__PURE__ */ t("path", { d: "M16 21h3a2 2 0 0 0 2-2v-3" })
297
297
  ]
298
298
  }
299
- ), Be = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
299
+ ), Oe = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
300
300
  "svg",
301
301
  {
302
302
  xmlns: "http://www.w3.org/2000/svg",
@@ -317,10 +317,10 @@ const de = ce(null), Le = ({
317
317
  /* @__PURE__ */ t("path", { d: "M16 21v-3a2 2 0 0 1 2-2h3" })
318
318
  ]
319
319
  }
320
- ), Re = ({
321
- size: e = S.size,
320
+ ), Ue = ({
321
+ size: e = K.size,
322
322
  className: o
323
- }) => /* @__PURE__ */ T(
323
+ }) => /* @__PURE__ */ y(
324
324
  "svg",
325
325
  {
326
326
  xmlns: "http://www.w3.org/2000/svg",
@@ -343,7 +343,7 @@ const de = ce(null), Le = ({
343
343
  /* @__PURE__ */ t("path", { d: "M21 19h.01" })
344
344
  ]
345
345
  }
346
- ), Ve = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
346
+ ), Ze = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
347
347
  "svg",
348
348
  {
349
349
  xmlns: "http://www.w3.org/2000/svg",
@@ -365,7 +365,7 @@ const de = ce(null), Le = ({
365
365
  /* @__PURE__ */ t("rect", { x: "16", y: "6", width: "4", height: "15", rx: "0.5" })
366
366
  ]
367
367
  }
368
- ), Se = ({ size: e = S.size, className: o }) => /* @__PURE__ */ T(
368
+ ), We = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
369
369
  "svg",
370
370
  {
371
371
  xmlns: "http://www.w3.org/2000/svg",
@@ -385,13 +385,13 @@ const de = ce(null), Le = ({
385
385
  /* @__PURE__ */ t("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
386
386
  ]
387
387
  }
388
- ), U = ({
388
+ ), A = ({
389
389
  onClick: e,
390
390
  ariaLabel: o,
391
391
  ariaPressed: a,
392
392
  disabled: n = !1,
393
- children: r,
394
- className: c = "",
393
+ children: l,
394
+ className: i = "",
395
395
  title: s
396
396
  }) => /* @__PURE__ */ t(
397
397
  "button",
@@ -402,25 +402,48 @@ const de = ce(null), Le = ({
402
402
  "aria-pressed": a,
403
403
  disabled: n,
404
404
  title: s ?? o,
405
- className: `flipbook-toolbar-button ${c}`.trim(),
406
- children: r
405
+ className: `flipbook-toolbar-button ${i}`.trim(),
406
+ children: l
407
407
  }
408
- ), Ge = ({
408
+ ), eo = ({
409
409
  onClick: e,
410
410
  ariaLabel: o,
411
411
  children: a,
412
412
  disabled: n = !1,
413
- className: r
413
+ className: l
414
414
  }) => /* @__PURE__ */ t(
415
- U,
415
+ A,
416
416
  {
417
417
  onClick: e,
418
418
  ariaLabel: o,
419
419
  disabled: n,
420
- className: `flipbook-toolbar-action ${r ?? ""}`.trim(),
420
+ className: `flipbook-toolbar-action ${l ?? ""}`.trim(),
421
421
  children: a
422
422
  }
423
- ), Ke = {
423
+ ), oo = ({
424
+ enabled: e,
425
+ onChange: o,
426
+ ariaLabel: a,
427
+ className: n
428
+ }) => /* @__PURE__ */ t(
429
+ A,
430
+ {
431
+ onClick: () => o(!e),
432
+ ariaLabel: a ?? (e ? "Hide bookmarks" : "Show bookmarks"),
433
+ ariaPressed: e,
434
+ className: `flipbook-toolbar-bookmarks ${n ?? ""}`.trim(),
435
+ children: /* @__PURE__ */ t("svg", { width: "18", height: "18", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ t(
436
+ "path",
437
+ {
438
+ d: "M5 2.5h10v15l-5-3-5 3z",
439
+ fill: e ? "currentColor" : "none",
440
+ stroke: "currentColor",
441
+ strokeWidth: "1.5",
442
+ strokeLinejoin: "round"
443
+ }
444
+ ) })
445
+ }
446
+ ), qe = {
424
447
  align: "left",
425
448
  direction: "ltr",
426
449
  translations: {
@@ -443,7 +466,7 @@ const de = ce(null), Le = ({
443
466
  "toolbarItem.selectText": "Select text with mouse",
444
467
  "toolbarItem.selectionLetters": "Aa"
445
468
  }
446
- }, Ae = {
469
+ }, Ve = {
447
470
  align: "right",
448
471
  direction: "rtl",
449
472
  translations: {
@@ -466,10 +489,10 @@ const de = ce(null), Le = ({
466
489
  "toolbarItem.selectText": "בחירת טקסט עם העכבר",
467
490
  "toolbarItem.selectionLetters": "אב"
468
491
  }
469
- }, ne = {
470
- "en-US": Ke,
471
- "he-IL": Ae
472
- }, ae = "en-US", Oe = {
492
+ }, le = {
493
+ "en-US": qe,
494
+ "he-IL": Ve
495
+ }, ie = "en-US", Ge = {
473
496
  "toolbarItem.download": "Download",
474
497
  "toolbarItem.downloadPageRange": "Download page range…",
475
498
  "toolbarItem.download.from": "From",
@@ -487,225 +510,233 @@ const de = ce(null), Le = ({
487
510
  "command.toggleDebugDesc": "Show or hide the debug toolbar (Ctrl+Alt+D)",
488
511
  "toolbarItem.goToPage": "Go to page"
489
512
  };
490
- function ue(e) {
491
- return ne[e] ?? ne[ae];
513
+ function be(e) {
514
+ return le[e] ?? le[ie];
492
515
  }
493
- function me(e) {
494
- return ue(e).direction === "rtl";
516
+ function se(e) {
517
+ return be(e).direction === "rtl";
495
518
  }
496
- function ze(e) {
497
- return me(e) ? "rtl" : "ltr";
519
+ function Je(e) {
520
+ return se(e) ? "rtl" : "ltr";
498
521
  }
499
- function L(e, o) {
500
- const a = ue(o).translations[e];
522
+ function E(e, o) {
523
+ const a = be(o).translations[e];
501
524
  if (a !== void 0 && a !== "") return a;
502
- const n = ne[ae].translations[e];
503
- return n !== void 0 && n !== "" ? n : Oe[e] ?? e;
525
+ const n = le[ie].translations[e];
526
+ return n !== void 0 && n !== "" ? n : Ge[e] ?? e;
504
527
  }
505
- const ge = ce(null);
506
- function K() {
507
- const e = ie(ge);
528
+ const we = he(null);
529
+ function z() {
530
+ const e = pe(we);
508
531
  if (!e)
509
532
  throw new Error("Toolbar components must be used within a Toolbar");
510
533
  return e;
511
534
  }
512
- function le(e) {
535
+ function me(e) {
513
536
  return e.replace(/[׳'״"]/g, "");
514
537
  }
515
- function se(e, o) {
538
+ function ge(e, o) {
516
539
  try {
517
540
  const a = atob(e.data), n = new Uint8Array(a.length);
518
- for (let i = 0; i < a.length; i++)
519
- n[i] = a.charCodeAt(i);
520
- const r = new Blob([n]), c = URL.createObjectURL(r), s = document.createElement("a");
521
- s.href = c, s.download = `${o}.${e.ext}`, s.click(), URL.revokeObjectURL(c);
541
+ for (let c = 0; c < a.length; c++)
542
+ n[c] = a.charCodeAt(c);
543
+ const l = new Blob([n]), i = URL.createObjectURL(l), s = document.createElement("a");
544
+ s.href = i, s.download = `${o}.${e.ext}`, s.click(), URL.revokeObjectURL(i);
522
545
  } catch (a) {
523
546
  console.error("Download failed:", a);
524
547
  }
525
548
  }
526
- function Ue(e, o) {
549
+ function _e(e, o) {
527
550
  const a = [];
528
551
  for (let n = 0; n < e; n++) {
529
- const r = o?.indexToSemanticName(n) ?? "", c = o?.indexToTitle(n) ?? "";
530
- if (!r && !c) {
552
+ const l = o?.indexToSemanticName(n) ?? "", i = o?.indexToTitle(n) ?? "";
553
+ if (!l && !i) {
531
554
  o || a.push({ pageIndex: n, semanticName: String(n + 1), title: `Page ${n + 1}` });
532
555
  continue;
533
556
  }
534
557
  a.push({
535
558
  pageIndex: n,
536
- semanticName: r || String(n + 1),
537
- title: c || r
559
+ semanticName: l || String(n + 1),
560
+ title: i || l
538
561
  });
539
562
  }
540
563
  return a;
541
564
  }
542
- const Je = ({
565
+ const to = ({
543
566
  ariaLabel: e = "Download",
544
567
  className: o
545
568
  }) => {
546
569
  const {
547
570
  totalPages: a,
548
571
  pageSemantics: n,
549
- locale: r,
550
- openDownloadMenuRef: c,
572
+ locale: l,
573
+ openDownloadMenuRef: i,
551
574
  downloadExecutorRef: s,
552
- flipBookRef: i
553
- } = K(), h = i.current?.getDownloadConfig?.() ?? void 0, [f, m] = I(!1);
554
- z(() => (c.current = () => m(!0), () => {
555
- c.current = null;
556
- }), [c]);
557
- const [y, D] = I("entire"), [P, C] = I(0), [d, u] = I(0), [b, F] = I(null), [M, q] = I(!1), B = J(null), A = J(null), j = Q(
558
- () => Ue(a, n),
575
+ flipBookRef: c
576
+ } = z(), h = c.current?.getDownloadConfig?.() ?? void 0, [b, g] = D(!1);
577
+ W(() => (i.current = () => g(!0), () => {
578
+ i.current = null;
579
+ }), [i]);
580
+ const [C, N] = D("entire"), [T, I] = D(0), [d, u] = D(0), [w, F] = D(null), [M, G] = D(!1), R = _(null), H = _(null), j = ee(
581
+ () => _e(a, n),
559
582
  [a, n]
560
- ), $ = !!h?.onDownloadSefer, R = !!h?.onDownloadPageRange, V = $ || R, O = j[0]?.pageIndex ?? 0, H = j[j.length - 1]?.pageIndex ?? 0;
561
- z(() => {
562
- f && (D($ ? "entire" : "range"), C(O), u(H));
563
- }, [f, $, O, H]);
564
- const N = v(() => {
565
- m(!1);
583
+ ), $ = !!h?.onDownloadSefer, S = !!h?.onDownloadPageRange, J = $ || S, O = j[0]?.pageIndex ?? 0, q = j[j.length - 1]?.pageIndex ?? 0;
584
+ W(() => {
585
+ b && (N($ ? "entire" : "range"), I(O), u(q));
586
+ }, [b, $, O, q]);
587
+ const L = P(() => {
588
+ g(!1);
566
589
  }, []);
567
- he(() => {
568
- if (!f || !A.current || !B.current) return;
569
- const l = A.current, w = B.current.querySelector(".flipbook-toolbar-download-trigger"), E = () => {
570
- const p = w?.getBoundingClientRect();
590
+ ve(() => {
591
+ if (!b || !H.current || !R.current) return;
592
+ const r = H.current, k = R.current.querySelector(".flipbook-toolbar-download-trigger"), v = () => {
593
+ const p = k?.getBoundingClientRect();
571
594
  if (!p) return;
572
- const k = l.getBoundingClientRect().height, G = window.innerHeight - p.bottom;
573
- q(G < k + 8);
595
+ const B = 8, U = 6, Y = window.innerHeight - p.bottom - U - B, ce = p.top - U - B, de = Math.min(r.scrollHeight, window.innerHeight * 0.7, 480), Z = Y < de && ce > Y;
596
+ r.style.maxHeight = `${Math.max(0, Math.min(de, Z ? ce : Y))}px`;
597
+ const Q = r.getBoundingClientRect(), ke = se(l) ? p.left : p.right - Q.width;
598
+ r.style.left = `${Math.max(B, Math.min(ke, window.innerWidth - Q.width - B))}px`;
599
+ const xe = Z ? p.top - U - Q.height : p.bottom + U;
600
+ r.style.top = `${Math.max(B, Math.min(xe, window.innerHeight - Q.height - B))}px`, G(Z);
574
601
  };
575
- E();
576
- const g = new ResizeObserver(E);
577
- return g.observe(l), () => g.disconnect();
578
- }, [f]), z(() => {
579
- if (!f) return;
580
- const l = (w) => {
581
- B.current && !B.current.contains(w.target) && N();
602
+ v();
603
+ const m = new ResizeObserver(v);
604
+ m.observe(r);
605
+ const f = R.current.closest('[role="toolbar"]');
606
+ return f && m.observe(f), window.addEventListener("resize", v), window.addEventListener("scroll", v, !0), () => {
607
+ m.disconnect(), window.removeEventListener("resize", v), window.removeEventListener("scroll", v, !0);
582
608
  };
583
- return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
584
- }, [f, N]);
585
- const x = v(async () => {
586
- const l = i.current?.getDownloadConfig?.();
587
- if (l?.onDownloadSefer) {
609
+ }, [b, l]), W(() => {
610
+ if (!b) return;
611
+ const r = (k) => {
612
+ R.current && !R.current.contains(k.target) && L();
613
+ };
614
+ return document.addEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
615
+ }, [b, L]);
616
+ const x = P(async () => {
617
+ const r = c.current?.getDownloadConfig?.();
618
+ if (r?.onDownloadSefer) {
588
619
  F("sefer");
589
620
  try {
590
- const w = await l.onDownloadSefer();
591
- w && se(w, l.entireBookFilename ?? "book"), N();
621
+ const k = await r.onDownloadSefer();
622
+ k && ge(k, r.entireBookFilename ?? "book"), L();
592
623
  } finally {
593
624
  F(null);
594
625
  }
595
626
  }
596
- }, [i, N]), W = v(
597
- async (l, w) => {
598
- const E = i.current?.getDownloadConfig?.();
599
- if (!E?.onDownloadPageRange) return;
600
- const g = [], p = [];
601
- for (let k = l; k <= w; k++) {
602
- g.push(k);
603
- const G = j.find((X) => X.pageIndex === k);
604
- G && p.push(G);
627
+ }, [c, L]), V = P(
628
+ async (r, k) => {
629
+ const v = c.current?.getDownloadConfig?.();
630
+ if (!v?.onDownloadPageRange) return;
631
+ const m = [], f = [];
632
+ for (let p = r; p <= k; p++) {
633
+ m.push(p);
634
+ const B = j.find((U) => U.pageIndex === p);
635
+ B && f.push(B);
605
636
  }
606
637
  F("range");
607
638
  try {
608
- const k = await E.onDownloadPageRange(
609
- g,
610
- p,
611
- E.downloadContext
639
+ const p = await v.onDownloadPageRange(
640
+ m,
641
+ f,
642
+ v.downloadContext
612
643
  );
613
- if (k) {
614
- const G = le(p[0]?.semanticName ?? String(l)), X = le(
615
- p[p.length - 1]?.semanticName ?? String(w)
644
+ if (p) {
645
+ const B = me(f[0]?.semanticName ?? String(r)), U = me(
646
+ f[f.length - 1]?.semanticName ?? String(k)
616
647
  );
617
- se(k, `${E.rangeFilename ?? "pages"}-${G}-${X}`);
648
+ ge(p, `${v.rangeFilename ?? "pages"}-${B}-${U}`);
618
649
  }
619
- N();
650
+ L();
620
651
  } finally {
621
652
  F(null);
622
653
  }
623
654
  },
624
- [i, j, N]
655
+ [c, j, L]
625
656
  );
626
- return z(() => (s.current = (l, w) => {
627
- l === void 0 && w === void 0 ? x() : l !== void 0 && w !== void 0 && W(l, w);
657
+ return W(() => (s.current = (r, k) => {
658
+ r === void 0 && k === void 0 ? x() : r !== void 0 && k !== void 0 && V(r, k);
628
659
  }, () => {
629
660
  s.current = null;
630
- }), [s, x, W]), V ? /* @__PURE__ */ T("div", { className: `flipbook-toolbar-download-wrap ${o ?? ""}`.trim(), ref: B, children: [
661
+ }), [s, x, V]), J ? /* @__PURE__ */ y("div", { className: `flipbook-toolbar-download-wrap ${o ?? ""}`.trim(), ref: R, children: [
631
662
  /* @__PURE__ */ t(
632
663
  "button",
633
664
  {
634
665
  type: "button",
635
666
  className: "flipbook-toolbar-button flipbook-toolbar-download-trigger",
636
- onClick: () => m((l) => !l),
637
- "aria-label": e ?? L("toolbarItem.download", r),
638
- "aria-expanded": f,
667
+ onClick: () => g((r) => !r),
668
+ "aria-label": e ?? E("toolbarItem.download", l),
669
+ "aria-expanded": b,
639
670
  "aria-haspopup": "true",
640
- disabled: b !== null,
641
- children: /* @__PURE__ */ t(Se, { size: 18 })
671
+ disabled: w !== null,
672
+ children: /* @__PURE__ */ t(We, { size: 18 })
642
673
  }
643
674
  ),
644
- f && /* @__PURE__ */ T(
675
+ b && /* @__PURE__ */ y(
645
676
  "div",
646
677
  {
647
- ref: A,
678
+ ref: H,
648
679
  className: `flipbook-toolbar-download-menu ${M ? "flipbook-toolbar-download-menu--open-up" : ""}`.trim(),
649
680
  role: "menu",
650
- dir: me(r) ? "rtl" : "ltr",
681
+ dir: se(l) ? "rtl" : "ltr",
651
682
  children: [
652
- /* @__PURE__ */ T(
683
+ /* @__PURE__ */ y(
653
684
  "fieldset",
654
685
  {
655
686
  className: "flipbook-toolbar-download-mode",
656
- "aria-label": L("toolbarItem.download", r),
687
+ "aria-label": E("toolbarItem.download", l),
657
688
  children: [
658
- $ && /* @__PURE__ */ T("label", { className: "flipbook-toolbar-download-radio-label", children: [
689
+ $ && /* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-radio-label", children: [
659
690
  /* @__PURE__ */ t(
660
691
  "input",
661
692
  {
662
693
  type: "radio",
663
694
  name: "download-mode",
664
695
  className: "flipbook-toolbar-download-radio",
665
- checked: y === "entire",
666
- onChange: () => D("entire")
696
+ checked: C === "entire",
697
+ onChange: () => N("entire")
667
698
  }
668
699
  ),
669
- /* @__PURE__ */ t("span", { children: L("command.downloadEntireBook", r) })
700
+ /* @__PURE__ */ t("span", { children: E("command.downloadEntireBook", l) })
670
701
  ] }),
671
- R && /* @__PURE__ */ T("label", { className: "flipbook-toolbar-download-radio-label", children: [
702
+ S && /* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-radio-label", children: [
672
703
  /* @__PURE__ */ t(
673
704
  "input",
674
705
  {
675
706
  type: "radio",
676
707
  name: "download-mode",
677
708
  className: "flipbook-toolbar-download-radio",
678
- checked: y === "range",
679
- onChange: () => D("range")
709
+ checked: C === "range",
710
+ onChange: () => N("range")
680
711
  }
681
712
  ),
682
- /* @__PURE__ */ t("span", { children: L("toolbarItem.downloadPageRange", r) })
713
+ /* @__PURE__ */ t("span", { children: E("toolbarItem.downloadPageRange", l) })
683
714
  ] })
684
715
  ]
685
716
  }
686
717
  ),
687
- y === "range" && /* @__PURE__ */ T("div", { className: "flipbook-toolbar-download-range", children: [
688
- /* @__PURE__ */ T("label", { className: "flipbook-toolbar-download-range-label", children: [
689
- L("toolbarItem.download.from", r),
718
+ C === "range" && /* @__PURE__ */ y("div", { className: "flipbook-toolbar-download-range", children: [
719
+ /* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-range-label", children: [
720
+ E("toolbarItem.download.from", l),
690
721
  /* @__PURE__ */ t(
691
722
  "select",
692
723
  {
693
- value: P,
694
- onChange: (l) => C(Number(l.target.value)),
724
+ value: T,
725
+ onChange: (r) => I(Number(r.target.value)),
695
726
  className: "flipbook-toolbar-download-range-select",
696
- children: j.map((l) => /* @__PURE__ */ t("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
727
+ children: j.map((r) => /* @__PURE__ */ t("option", { value: r.pageIndex, children: r.semanticName || r.title || `Page ${r.pageIndex + 1}` }, r.pageIndex))
697
728
  }
698
729
  )
699
730
  ] }),
700
- /* @__PURE__ */ T("label", { className: "flipbook-toolbar-download-range-label", children: [
701
- L("toolbarItem.download.to", r),
731
+ /* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-range-label", children: [
732
+ E("toolbarItem.download.to", l),
702
733
  /* @__PURE__ */ t(
703
734
  "select",
704
735
  {
705
736
  value: d,
706
- onChange: (l) => u(Number(l.target.value)),
737
+ onChange: (r) => u(Number(r.target.value)),
707
738
  className: "flipbook-toolbar-download-range-select",
708
- children: j.map((l) => /* @__PURE__ */ t("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
739
+ children: j.map((r) => /* @__PURE__ */ t("option", { value: r.pageIndex, children: r.semanticName || r.title || `Page ${r.pageIndex + 1}` }, r.pageIndex))
709
740
  }
710
741
  )
711
742
  ] })
@@ -717,220 +748,220 @@ const Je = ({
717
748
  role: "menuitem",
718
749
  className: "flipbook-toolbar-download-menuitem flipbook-toolbar-download-primary",
719
750
  onClick: () => {
720
- if (y === "entire")
751
+ if (C === "entire")
721
752
  x();
722
753
  else {
723
- const l = i.current?.getTotalPages?.() ?? a, w = Math.min(P, d);
724
- let E = Math.max(P, d);
725
- if (l > 0 && E >= l && (E = l - 1), E < w) return;
726
- W(w, E);
754
+ const r = c.current?.getTotalPages?.() ?? a, k = Math.min(T, d);
755
+ let v = Math.max(T, d);
756
+ if (r > 0 && v >= r && (v = r - 1), v < k) return;
757
+ V(k, v);
727
758
  }
728
759
  },
729
- disabled: b !== null,
730
- children: b === "sefer" || b === "range" ? "…" : L("toolbarItem.download.download", r)
760
+ disabled: w !== null,
761
+ children: w === "sefer" || w === "range" ? "…" : E("toolbarItem.download.download", l)
731
762
  }
732
763
  )
733
764
  ]
734
765
  }
735
766
  )
736
767
  ] }) : null;
737
- }, _e = ({ children: e, className: o }) => {
738
- const { locale: a } = K(), { execute: n, canExecute: r } = _(), c = () => {
739
- n(ee);
740
- }, s = /* @__PURE__ */ t(je, { size: 18 }), i = L("command.jumpToFirstPage", a);
768
+ }, no = ({ children: e, className: o }) => {
769
+ const { locale: a } = z(), { execute: n, canExecute: l } = X(), i = () => {
770
+ n(ne);
771
+ }, s = /* @__PURE__ */ t(Ae, { size: 18 }), c = E("command.jumpToFirstPage", a);
741
772
  return /* @__PURE__ */ t(
742
- U,
773
+ A,
743
774
  {
744
- onClick: c,
745
- ariaLabel: i,
746
- title: i,
747
- disabled: !r(ee),
775
+ onClick: i,
776
+ ariaLabel: c,
777
+ title: c,
778
+ disabled: !l(ne),
748
779
  className: `flipbook-toolbar-first ${o ?? ""}`.trim(),
749
780
  children: e ?? s
750
781
  }
751
782
  );
752
- }, Xe = ({
783
+ }, ao = ({
753
784
  targetRef: e,
754
785
  enterIcon: o,
755
786
  exitIcon: a,
756
787
  ariaLabelEnter: n = "Enter fullscreen",
757
- ariaLabelExit: r = "Exit fullscreen",
758
- className: c
788
+ ariaLabelExit: l = "Exit fullscreen",
789
+ className: i
759
790
  }) => {
760
- const [s, i] = I(!1), h = K(), f = e ?? h.fullscreenTargetRef, m = v(() => {
761
- i(!!document.fullscreenElement);
791
+ const [s, c] = D(!1), h = z(), b = e ?? h.fullscreenTargetRef, g = P(() => {
792
+ c(!!document.fullscreenElement);
762
793
  }, []);
763
- z(() => (document.addEventListener("fullscreenchange", m), () => {
764
- document.removeEventListener("fullscreenchange", m);
765
- }), [m]);
766
- const y = async () => {
794
+ W(() => (document.addEventListener("fullscreenchange", g), () => {
795
+ document.removeEventListener("fullscreenchange", g);
796
+ }), [g]);
797
+ const C = async () => {
767
798
  try {
768
- s ? await document.exitFullscreen() : await (f?.current ?? document.documentElement).requestFullscreen();
769
- } catch (C) {
770
- console.warn("Fullscreen request failed:", C);
799
+ s ? await document.exitFullscreen() : await (b?.current ?? document.documentElement).requestFullscreen();
800
+ } catch (I) {
801
+ console.warn("Fullscreen request failed:", I);
771
802
  }
772
- }, D = s ? r : n, P = s ? a ?? /* @__PURE__ */ t(Be, { size: 18 }) : o ?? /* @__PURE__ */ t($e, { size: 18 });
803
+ }, N = s ? l : n, T = s ? a ?? /* @__PURE__ */ t(Oe, { size: 18 }) : o ?? /* @__PURE__ */ t(He, { size: 18 });
773
804
  return /* @__PURE__ */ t(
774
- U,
805
+ A,
775
806
  {
776
- onClick: y,
777
- ariaLabel: D,
778
- className: `flipbook-toolbar-fullscreen ${s ? "flipbook-toolbar-fullscreen--active" : ""} ${c ?? ""}`.trim(),
779
- children: P
807
+ onClick: C,
808
+ ariaLabel: N,
809
+ className: `flipbook-toolbar-fullscreen ${s ? "flipbook-toolbar-fullscreen--active" : ""} ${i ?? ""}`.trim(),
810
+ children: T
780
811
  }
781
812
  );
782
- }, Qe = ({ children: e, className: o }) => {
783
- const { locale: a } = K(), { execute: n, canExecute: r } = _(), c = () => {
784
- n(oe);
785
- }, s = /* @__PURE__ */ t(Me, { size: 18 }), i = L("command.jumpToLastPage", a);
813
+ }, ro = ({ children: e, className: o }) => {
814
+ const { locale: a } = z(), { execute: n, canExecute: l } = X(), i = () => {
815
+ n(ae);
816
+ }, s = /* @__PURE__ */ t(ze, { size: 18 }), c = E("command.jumpToLastPage", a);
786
817
  return /* @__PURE__ */ t(
787
- U,
818
+ A,
788
819
  {
789
- onClick: c,
790
- ariaLabel: i,
791
- title: i,
792
- disabled: !r(oe),
820
+ onClick: i,
821
+ ariaLabel: c,
822
+ title: c,
823
+ disabled: !l(ae),
793
824
  className: `flipbook-toolbar-last ${o ?? ""}`.trim(),
794
825
  children: e ?? s
795
826
  }
796
827
  );
797
- }, Ye = ({
828
+ }, lo = ({
798
829
  letters: e,
799
830
  ariaLabel: o,
800
831
  className: a
801
832
  }) => {
802
- const { flipBookRef: n, locale: r, mouseMode: c } = K(), s = o ?? L("toolbarItem.selectText", r);
833
+ const { flipBookRef: n, locale: l, mouseMode: i } = z(), s = o ?? E("toolbarItem.selectText", l);
803
834
  return /* @__PURE__ */ t(
804
- U,
835
+ A,
805
836
  {
806
837
  onClick: () => {
807
- n.current?.setMouseMode(c === "turn" ? "select" : "turn"), window.getSelection()?.removeAllRanges();
838
+ n.current?.setMouseMode(i === "turn" ? "select" : "turn"), window.getSelection()?.removeAllRanges();
808
839
  },
809
840
  ariaLabel: s,
810
- ariaPressed: c === "select",
841
+ ariaPressed: i === "select",
811
842
  className: `flipbook-toolbar-mouse-mode ${a ?? ""}`.trim(),
812
- children: /* @__PURE__ */ T("span", { className: "flipbook-toolbar-mouse-mode-icon", "aria-hidden": "true", children: [
843
+ children: /* @__PURE__ */ y("span", { className: "flipbook-toolbar-mouse-mode-icon", "aria-hidden": "true", children: [
813
844
  /* @__PURE__ */ t("span", { className: "flipbook-toolbar-mouse-mode-caret" }),
814
- /* @__PURE__ */ t("span", { children: e ?? L("toolbarItem.selectionLetters", r) })
845
+ /* @__PURE__ */ t("span", { children: e ?? E("toolbarItem.selectionLetters", l) })
815
846
  ] })
816
847
  }
817
848
  );
818
- }, Ze = ({ children: e, className: o }) => {
819
- const { locale: a } = K(), { execute: n, canExecute: r } = _(), c = () => {
820
- n(Y);
821
- }, s = L("command.jumpToNextPage", a), i = /* @__PURE__ */ t(Ee, { size: 20 });
849
+ }, so = ({ children: e, className: o }) => {
850
+ const { locale: a } = z(), { execute: n, canExecute: l } = X(), i = () => {
851
+ n(oe);
852
+ }, s = E("command.jumpToNextPage", a), c = /* @__PURE__ */ t(Ke, { size: 20 });
822
853
  return /* @__PURE__ */ t(
823
- U,
854
+ A,
824
855
  {
825
- onClick: c,
856
+ onClick: i,
826
857
  ariaLabel: s,
827
858
  title: s,
828
- disabled: !r(Y),
859
+ disabled: !l(oe),
829
860
  className: `flipbook-toolbar-next ${o ?? ""}`.trim(),
830
- children: e ?? i
861
+ children: e ?? c
831
862
  }
832
863
  );
833
- }, eo = ({
864
+ }, io = ({
834
865
  mode: e,
835
866
  showTotal: o = !0,
836
867
  placeholder: a = "—",
837
868
  editable: n,
838
- className: r,
839
- ariaLabel: c = "Go to page",
869
+ className: l,
870
+ ariaLabel: i = "Go to page",
840
871
  maxLength: s = 10
841
872
  }) => {
842
- const { flipBookRef: i, pageSemantics: h, direction: f, currentPage: m, totalPages: y, of: D } = K(), P = e ?? (h ? "semantic" : "index"), C = n ?? (P === "semantic" && !!h), [d, u] = I(""), [b, F] = I(!1), M = J(!1), q = J(m), B = m, A = m + 1 < y ? m + 1 : null, j = v(
843
- (g) => P === "semantic" && h ? h.indexToSemanticName(g) || "" : String(g + 1),
844
- [P, h]
845
- ), $ = j(B), R = A != null ? j(A) : "", V = v(() => String(D), [D]), O = v(() => {
846
- const g = $, p = R;
847
- let k;
848
- return !g && !p ? k = a : g ? p ? g === p ? k = g : k = `${g} - ${p}` : k = g : k = p, o ? `${k} / ${V()}` : k;
849
- }, [$, R, a, o, V]), H = f === "rtl" ? R || $ : $ || R, N = O();
850
- z(() => {
851
- const g = m !== q.current;
852
- q.current = m, g && (M.current = !1), !b && !M.current && u(N);
853
- }, [N, b, m]);
854
- const x = v(
855
- (g) => {
856
- if (C) {
857
- F(!0), u(H), M.current = !1;
858
- const p = () => g.target.select();
859
- typeof requestAnimationFrame < "u" ? requestAnimationFrame(p) : p();
873
+ const { flipBookRef: c, pageSemantics: h, direction: b, currentPage: g, totalPages: C, of: N } = z(), T = e ?? (h ? "semantic" : "index"), I = n ?? (T === "semantic" && !!h), [d, u] = D(""), [w, F] = D(!1), M = _(!1), G = _(g), R = g, H = g + 1 < C ? g + 1 : null, j = P(
874
+ (m) => T === "semantic" && h ? h.indexToSemanticName(m) || "" : String(m + 1),
875
+ [T, h]
876
+ ), $ = j(R), S = H != null ? j(H) : "", J = P(() => String(N), [N]), O = P(() => {
877
+ const m = $, f = S;
878
+ let p;
879
+ return !m && !f ? p = a : m ? f ? m === f ? p = m : p = `${m} - ${f}` : p = m : p = f, o ? `${p} / ${J()}` : p;
880
+ }, [$, S, a, o, J]), q = b === "rtl" ? S || $ : $ || S, L = O();
881
+ W(() => {
882
+ const m = g !== G.current;
883
+ G.current = g, m && (M.current = !1), !w && !M.current && u(L);
884
+ }, [L, w, g]);
885
+ const x = P(
886
+ (m) => {
887
+ if (I) {
888
+ F(!0), u(q), M.current = !1;
889
+ const f = () => m.target.select();
890
+ typeof requestAnimationFrame < "u" ? requestAnimationFrame(f) : f();
860
891
  }
861
892
  },
862
- [C, H]
863
- ), W = v(() => {
864
- F(!1), M.current || u(N);
865
- }, [N]), l = v(
866
- (g) => {
867
- if (g.key === "Enter") {
893
+ [I, q]
894
+ ), V = P(() => {
895
+ F(!1), M.current || u(L);
896
+ }, [L]), r = P(
897
+ (m) => {
898
+ if (m.key === "Enter") {
868
899
  if (h && d.trim()) {
869
- const p = h.semanticNameToIndex(d.trim());
870
- p != null && p >= 0 && p < y && (i.current?.jumpToPage(p), M.current = !0);
900
+ const f = h.semanticNameToIndex(d.trim());
901
+ f != null && f >= 0 && f < C && (c.current?.jumpToPage(f), M.current = !0);
871
902
  }
872
- g.currentTarget.blur();
873
- } else g.key === "Escape" && g.currentTarget.blur();
903
+ m.currentTarget.blur();
904
+ } else m.key === "Escape" && m.currentTarget.blur();
874
905
  },
875
- [d, h, y, i]
876
- ), w = v((g) => {
877
- u(g.target.value);
906
+ [d, h, C, c]
907
+ ), k = P((m) => {
908
+ u(m.target.value);
878
909
  }, []);
879
- return C ? /* @__PURE__ */ t(
910
+ return I ? /* @__PURE__ */ t(
880
911
  "input",
881
912
  {
882
913
  type: "text",
883
- className: `flipbook-toolbar-indicator ${b ? "flipbook-toolbar-indicator--editing" : ""} ${r ?? ""}`.trim(),
914
+ className: `flipbook-toolbar-indicator ${w ? "flipbook-toolbar-indicator--editing" : ""} ${l ?? ""}`.trim(),
884
915
  value: d,
885
916
  onFocus: x,
886
- onBlur: W,
887
- onKeyDown: l,
888
- onChange: w,
889
- "aria-label": c,
917
+ onBlur: V,
918
+ onKeyDown: r,
919
+ onChange: k,
920
+ "aria-label": i,
890
921
  "aria-live": "polite",
891
922
  "aria-atomic": "true",
892
923
  maxLength: s,
893
- readOnly: !C
924
+ readOnly: !I
894
925
  }
895
926
  ) : /* @__PURE__ */ t(
896
927
  "span",
897
928
  {
898
- className: `flipbook-toolbar-indicator ${r ?? ""}`.trim(),
929
+ className: `flipbook-toolbar-indicator ${l ?? ""}`.trim(),
899
930
  "aria-live": "polite",
900
931
  "aria-atomic": "true",
901
- children: N
932
+ children: L
902
933
  }
903
934
  );
904
- }, oo = ({ children: e, className: o }) => {
905
- const { locale: a } = K(), { execute: n, canExecute: r } = _(), c = () => {
906
- n(Z);
907
- }, s = L("command.jumpToPrevPage", a), i = /* @__PURE__ */ t(Fe, { size: 20 });
935
+ }, co = ({ children: e, className: o }) => {
936
+ const { locale: a } = z(), { execute: n, canExecute: l } = X(), i = () => {
937
+ n(te);
938
+ }, s = E("command.jumpToPrevPage", a), c = /* @__PURE__ */ t(Se, { size: 20 });
908
939
  return /* @__PURE__ */ t(
909
- U,
940
+ A,
910
941
  {
911
- onClick: c,
942
+ onClick: i,
912
943
  ariaLabel: s,
913
944
  title: s,
914
- disabled: !r(Z),
945
+ disabled: !l(te),
915
946
  className: `flipbook-toolbar-prev ${o ?? ""}`.trim(),
916
- children: e ?? i
947
+ children: e ?? c
917
948
  }
918
949
  );
919
- }, to = ({ children: e, ariaLabel: o, className: a }) => {
920
- const { locale: n } = K(), { execute: r, canExecute: c } = _(), s = o ?? L("command.jumpToToc", n), i = () => {
921
- r(te);
922
- }, h = !c(te);
950
+ }, uo = ({ children: e, ariaLabel: o, className: a }) => {
951
+ const { locale: n } = z(), { execute: l, canExecute: i } = X(), s = o ?? E("command.jumpToToc", n), c = () => {
952
+ l(re);
953
+ }, h = !i(re);
923
954
  return /* @__PURE__ */ t(
924
- U,
955
+ A,
925
956
  {
926
- onClick: i,
957
+ onClick: c,
927
958
  ariaLabel: s,
928
959
  disabled: h,
929
960
  className: `flipbook-toolbar-toc ${a ?? ""}`.trim(),
930
- children: e ?? /* @__PURE__ */ t(Re, { size: 18 })
961
+ children: e ?? /* @__PURE__ */ t(Ue, { size: 18 })
931
962
  }
932
963
  );
933
- }, He = {
964
+ }, Xe = {
934
965
  id: "openDownloadMenu",
935
966
  enName: "Open download menu",
936
967
  enDescription: "Open the download menu",
@@ -940,121 +971,122 @@ const Je = ({
940
971
  e.data?.open?.();
941
972
  },
942
973
  canExecute: (e) => typeof e.data?.open == "function"
943
- }, no = ({
974
+ }, mo = ({
944
975
  flipBookRef: e,
945
976
  direction: o,
946
977
  locale: a,
947
978
  pageSemantics: n,
948
- className: r = "",
949
- children: c,
979
+ className: l = "",
980
+ children: i,
950
981
  enableHotkeys: s = !0,
951
- commands: i,
982
+ commands: c,
952
983
  commandOptions: h,
953
- fullscreenTargetRef: f
984
+ fullscreenTargetRef: b
954
985
  }) => {
955
- const m = o ?? ze(a ?? ae), y = a ?? (m === "rtl" ? "he-IL" : "en-US"), D = J(null), P = J(null), [C, d] = I(0), [u, b] = I(0), [F, M] = I(0), [q, B] = I(!0), [A, j] = I(!1), [$, R] = I("turn"), V = {
956
- ...f ? {
986
+ const g = o ?? Je(a ?? ie), C = a ?? (g === "rtl" ? "he-IL" : "en-US"), N = _(null), T = _(null), [I, d] = D(0), [u, w] = D(0), [F, M] = D(0), [G, R] = D(!0), [H, j] = D(!1), [$, S] = D("turn"), J = {
987
+ ...b ? {
957
988
  toggleFullscreen: {
958
989
  data: {
959
- getFullscreenTarget: () => f.current ?? null
990
+ getFullscreenTarget: () => b.current ?? null
960
991
  }
961
992
  }
962
993
  } : {},
963
994
  openDownloadMenu: {
964
- data: { open: () => D.current?.() }
995
+ data: { open: () => N.current?.() }
965
996
  },
966
997
  download: {
967
998
  data: {
968
- onDownload: (x, W) => P.current?.(x, W)
999
+ onDownload: (x, V) => T.current?.(x, V)
969
1000
  }
970
1001
  },
971
1002
  ...h
972
- }, O = v(() => {
1003
+ }, O = P(() => {
973
1004
  const x = e.current;
974
- x && (d(x.getCurrentPageIndex()), b(x.getTotalPages()), M(x.getOf()), B(x.isFirstPage()), j(x.isLastPage()), R(x.getMouseMode?.() ?? "turn"));
1005
+ x && (d(x.getCurrentPageIndex()), w(x.getTotalPages()), M(x.getOf()), R(x.isFirstPage()), j(x.isLastPage()), S(x.getMouseMode?.() ?? "turn"));
975
1006
  }, [e]);
976
- z(() => {
1007
+ W(() => {
977
1008
  O();
978
1009
  const x = setInterval(O, 200);
979
1010
  return () => clearInterval(x);
980
1011
  }, [O]);
981
- const H = /* @__PURE__ */ t(
982
- ge.Provider,
1012
+ const q = /* @__PURE__ */ t(
1013
+ we.Provider,
983
1014
  {
984
1015
  value: {
985
1016
  flipBookRef: e,
986
- direction: m,
987
- locale: y,
1017
+ direction: g,
1018
+ locale: C,
988
1019
  pageSemantics: n,
989
- currentPage: C,
1020
+ currentPage: I,
990
1021
  totalPages: u,
991
1022
  of: F,
992
- isFirstPage: q,
993
- isLastPage: A,
1023
+ isFirstPage: G,
1024
+ isLastPage: H,
994
1025
  mouseMode: $,
995
- openDownloadMenuRef: D,
996
- downloadExecutorRef: P,
997
- fullscreenTargetRef: f
1026
+ openDownloadMenuRef: N,
1027
+ downloadExecutorRef: T,
1028
+ fullscreenTargetRef: b
998
1029
  },
999
1030
  children: /* @__PURE__ */ t(
1000
1031
  "div",
1001
1032
  {
1002
- className: `flipbook-toolbar ${m === "rtl" ? "flipbook-toolbar--rtl" : ""} ${r}`.trim(),
1033
+ className: `flipbook-toolbar ${g === "rtl" ? "flipbook-toolbar--rtl" : ""} ${l}`.trim(),
1003
1034
  role: "toolbar",
1004
1035
  "aria-label": "FlipBook navigation",
1005
- dir: m,
1006
- children: c
1036
+ dir: g,
1037
+ children: i
1007
1038
  }
1008
1039
  )
1009
1040
  }
1010
- ), N = [He, ...i ?? []];
1041
+ ), L = [Xe, ...c ?? []];
1011
1042
  return /* @__PURE__ */ t(
1012
- Le,
1043
+ Re,
1013
1044
  {
1014
1045
  flipBookRef: e,
1015
- currentPage: C,
1046
+ currentPage: I,
1016
1047
  totalPages: u,
1017
- direction: m,
1018
- commands: N,
1019
- commandOptions: V,
1048
+ direction: g,
1049
+ commands: L,
1050
+ commandOptions: J,
1020
1051
  disableHotkeys: !s,
1021
- children: H
1052
+ children: q
1022
1053
  }
1023
1054
  );
1024
1055
  };
1025
1056
  export {
1026
- Ge as ActionButton,
1027
- Ve as BookshelfIcon,
1028
- je as ChevronFirstIcon,
1029
- Me as ChevronLastIcon,
1030
- Fe as ChevronLeftIcon,
1031
- Ee as ChevronRightIcon,
1032
- Je as DownloadDropdown,
1033
- Se as DownloadIcon,
1034
- _e as FirstPageButton,
1035
- Xe as FullscreenButton,
1036
- Qe as LastPageButton,
1037
- $e as MaximizeIcon,
1038
- Be as MinimizeIcon,
1039
- Ye as MouseModeButton,
1040
- Ze as NextButton,
1041
- eo as PageIndicator,
1042
- oo as PrevButton,
1043
- eo as SemanticPageIndicator,
1044
- Re as TableOfContentsIcon,
1045
- to as TocButton,
1046
- no as Toolbar,
1047
- U as ToolbarButton,
1048
- Ie as defaultCommands,
1049
- fe as downloadCommand,
1050
- Y as flipNextCommand,
1051
- Z as flipPrevCommand,
1052
- ee as goToFirstCommand,
1053
- oe as goToLastCommand,
1054
- te as goToTocCommand,
1055
- Te as toggleDebugCommand,
1056
- Ce as toggleFullscreenCommand,
1057
- _ as useCommands,
1058
- K as useToolbar
1057
+ eo as ActionButton,
1058
+ oo as BookmarkToggleButton,
1059
+ Ze as BookshelfIcon,
1060
+ Ae as ChevronFirstIcon,
1061
+ ze as ChevronLastIcon,
1062
+ Se as ChevronLeftIcon,
1063
+ Ke as ChevronRightIcon,
1064
+ to as DownloadDropdown,
1065
+ We as DownloadIcon,
1066
+ no as FirstPageButton,
1067
+ ao as FullscreenButton,
1068
+ ro as LastPageButton,
1069
+ He as MaximizeIcon,
1070
+ Oe as MinimizeIcon,
1071
+ lo as MouseModeButton,
1072
+ so as NextButton,
1073
+ io as PageIndicator,
1074
+ co as PrevButton,
1075
+ io as SemanticPageIndicator,
1076
+ Ue as TableOfContentsIcon,
1077
+ uo as TocButton,
1078
+ mo as Toolbar,
1079
+ A as ToolbarButton,
1080
+ Me as defaultCommands,
1081
+ Te as downloadCommand,
1082
+ oe as flipNextCommand,
1083
+ te as flipPrevCommand,
1084
+ ne as goToFirstCommand,
1085
+ ae as goToLastCommand,
1086
+ re as goToTocCommand,
1087
+ Ee as toggleDebugCommand,
1088
+ je as toggleFullscreenCommand,
1089
+ X as useCommands,
1090
+ z as useToolbar
1059
1091
  };
1060
1092
  //# sourceMappingURL=index.js.map