html-flip-book-react 0.0.0-alpha.71 → 0.0.0-alpha.73

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 a, jsxs as E } from "react/jsx-runtime";
2
- import { createContext as ve, useContext as ye, useRef as J, useReducer as Fe, useMemo as Pe, useCallback as L, useEffect as U, useState as F, useLayoutEffect as Ne } from "react";
3
- let Me = 4;
4
- function he() {
5
- return Me;
1
+ import { jsx as a, jsxs as M } from "react/jsx-runtime";
2
+ import { createContext as Te, useContext as Ie, useRef as Q, useReducer as Be, useMemo as De, useCallback as T, useEffect as z, useState as I, useLayoutEffect as Se } from "react";
3
+ let $e = 4;
4
+ function xe() {
5
+ return $e;
6
6
  }
7
- const je = {
7
+ const Ae = {
8
8
  id: "download",
9
9
  enName: "Download",
10
10
  enDescription: "Download entire book or page range",
@@ -17,51 +17,51 @@ const je = {
17
17
  );
18
18
  },
19
19
  canExecute: (e) => typeof e.data?.onDownload == "function"
20
- }, Be = [
20
+ }, Re = [
21
21
  { key: "ArrowRight" },
22
22
  { key: "PageDown" },
23
23
  { key: " " }
24
24
  // Space
25
- ], ne = {
25
+ ], se = {
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: Re,
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
- }, Se = [{ key: "ArrowLeft" }, { key: "PageUp" }], re = {
36
+ }, Ke = [{ key: "ArrowLeft" }, { key: "PageUp" }], ie = {
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: Se,
42
+ hotkeys: Ke,
43
43
  execute: (e) => {
44
44
  e.handle?.flipPrev();
45
45
  },
46
46
  canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) > 0
47
- }, $e = [{ key: "Home" }, { key: "ArrowLeft", modifiers: { ctrl: !0 } }], ae = {
47
+ }, He = [{ key: "Home" }, { key: "ArrowLeft", modifiers: { ctrl: !0 } }], ce = {
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: $e,
53
+ hotkeys: He,
54
54
  execute: (e) => {
55
55
  e.handle?.jumpToPage(0);
56
56
  },
57
57
  canExecute: (e) => e.handle?.getCurrentPageIndex() !== 0
58
- }, Ae = [{ key: "End" }, { key: "ArrowRight", modifiers: { ctrl: !0 } }], le = {
58
+ }, Oe = [{ key: "End" }, { key: "ArrowRight", modifiers: { ctrl: !0 } }], de = {
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: Ae,
64
+ hotkeys: Oe,
65
65
  execute: (e) => {
66
66
  const t = e.handle?.getTotalPages() ?? 0;
67
67
  e.handle?.jumpToPage(t - 1);
@@ -70,46 +70,46 @@ const je = {
70
70
  const t = e.handle?.getCurrentPageIndex() ?? 0, o = e.handle?.getTotalPages() ?? 0;
71
71
  return t !== o - 1;
72
72
  }
73
- }, Re = [{ key: "t" }], se = {
73
+ }, Ue = [{ key: "t" }], ue = {
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: Re,
79
+ hotkeys: Ue,
80
80
  execute: (e) => {
81
- const t = e.handle?.getTocPageIndex?.() ?? he();
81
+ const t = e.handle?.getTocPageIndex?.() ?? xe();
82
82
  e.handle?.jumpToPage(t);
83
83
  },
84
84
  canExecute: (e) => {
85
- const t = e.handle?.getTocPageIndex?.() ?? he();
85
+ const t = e.handle?.getTocPageIndex?.() ?? xe();
86
86
  return e.handle?.getCurrentPageIndex() !== t;
87
87
  }
88
- }, Ke = [{ key: "d", modifiers: { ctrl: !0, alt: !0 } }], He = {
88
+ }, ze = [{ key: "d", modifiers: { ctrl: !0, alt: !0 } }], qe = {
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: Ke,
94
+ hotkeys: ze,
95
95
  execute: (e) => {
96
96
  e.handle?.toggleDebugBar?.();
97
97
  }
98
- }, X = () => document, pe = [
98
+ }, te = () => document, ke = [
99
99
  "fullscreenchange",
100
100
  "webkitfullscreenchange",
101
101
  "fullscreenerror",
102
102
  "webkitfullscreenerror"
103
103
  ];
104
- function ie() {
105
- return typeof document > "u" ? null : X().fullscreenElement ?? X().webkitFullscreenElement ?? null;
104
+ function me() {
105
+ return typeof document > "u" ? null : te().fullscreenElement ?? te().webkitFullscreenElement ?? null;
106
106
  }
107
- function ce(e) {
107
+ function ge(e) {
108
108
  if (typeof document > "u") return !1;
109
- const t = e ?? X().documentElement;
110
- return typeof (t.requestFullscreen ?? t.webkitRequestFullscreen) != "function" ? !1 : (X().fullscreenEnabled ?? X().webkitFullscreenEnabled) !== !1;
109
+ const t = e ?? te().documentElement;
110
+ return typeof (t.requestFullscreen ?? t.webkitRequestFullscreen) != "function" ? !1 : (te().fullscreenEnabled ?? te().webkitFullscreenEnabled) !== !1;
111
111
  }
112
- async function Oe(e) {
112
+ async function We(e) {
113
113
  const t = e;
114
114
  if (t.requestFullscreen) {
115
115
  await t.requestFullscreen();
@@ -121,37 +121,37 @@ async function Oe(e) {
121
121
  }
122
122
  throw new Error("Fullscreen API is not available");
123
123
  }
124
- async function Ue() {
125
- const e = X();
124
+ async function Ve() {
125
+ const e = te();
126
126
  if (e.exitFullscreen) {
127
127
  await e.exitFullscreen();
128
128
  return;
129
129
  }
130
130
  e.webkitExitFullscreen && e.webkitExitFullscreen();
131
131
  }
132
- const ze = [{ key: "F11" }], Y = {
132
+ const Je = [{ key: "F11" }], oe = {
133
133
  id: "toggleFullscreen",
134
134
  kind: "toggle",
135
135
  enName: "Toggle Fullscreen",
136
136
  enDescription: "Enter or exit fullscreen mode",
137
137
  nameKey: "command.toggleFullscreen",
138
138
  descriptionKey: "command.toggleFullscreenDesc",
139
- hotkeys: ze,
140
- canExecute: (e) => ce(e.data?.getFullscreenTarget?.()),
141
- isActive: () => ie() !== null,
139
+ hotkeys: Je,
140
+ canExecute: (e) => ge(e.data?.getFullscreenTarget?.()),
141
+ isActive: () => me() !== null,
142
142
  setActive: (e, t) => {
143
- const o = ie();
143
+ const o = me();
144
144
  if (t) {
145
145
  if (o) return;
146
146
  const n = e.data?.getFullscreenTarget?.() ?? document.documentElement;
147
- if (!ce(n)) return !1;
148
- Oe(n).catch(console.warn);
147
+ if (!ge(n)) return !1;
148
+ We(n).catch(console.warn);
149
149
  return;
150
150
  }
151
- o && Ue().catch(console.warn);
151
+ o && Ve().catch(console.warn);
152
152
  },
153
- execute: (e) => Y.setActive(e, !Y.isActive(e))
154
- }, ee = {
153
+ execute: (e) => oe.setActive(e, !oe.isActive(e))
154
+ }, re = {
155
155
  id: "toggleTextSelection",
156
156
  kind: "toggle",
157
157
  enName: "Select Text",
@@ -165,32 +165,32 @@ const ze = [{ key: "F11" }], Y = {
165
165
  e.transient ? e.handle.setMouseMode(o, { persist: !1 }) : e.handle.setMouseMode(o);
166
166
  },
167
167
  execute: (e) => {
168
- const t = ee.setActive(
168
+ const t = re.setActive(
169
169
  e,
170
- !ee.isActive(e)
170
+ !re.isActive(e)
171
171
  );
172
172
  return t !== !1 && window.getSelection()?.removeAllRanges(), t;
173
173
  }
174
- }, qe = [
175
- ne,
176
- re,
177
- ae,
178
- le,
174
+ }, Ge = [
179
175
  se,
180
- Y,
181
- He,
182
- ee,
183
- je
176
+ ie,
177
+ ce,
178
+ de,
179
+ ue,
180
+ oe,
181
+ qe,
182
+ re,
183
+ Ae
184
184
  ];
185
- function Ce(e, t) {
185
+ function Ee(e, t) {
186
186
  return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
187
187
  }
188
- function We(e, t, o) {
189
- if (Ce(t.key, o) !== e.key) return !1;
188
+ function _e(e, t, o) {
189
+ if (Ee(t.key, o) !== e.key) return !1;
190
190
  const n = e.modifiers ?? {};
191
191
  return !(e.key !== "Control" && !!n.ctrl !== t.ctrlKey || e.key !== "Shift" && !!n.shift !== t.shiftKey || e.key !== "Alt" && !!n.alt !== t.altKey || e.key !== "Meta" && !!n.meta !== t.metaKey);
192
192
  }
193
- function Ve(e, t) {
193
+ function Qe(e, t) {
194
194
  const o = e.modifiers ?? {};
195
195
  return [
196
196
  o.ctrl && !t.ctrlKey,
@@ -199,11 +199,11 @@ function Ve(e, t) {
199
199
  o.meta && !t.metaKey
200
200
  ].some(Boolean);
201
201
  }
202
- function Je(e, t, o) {
203
- const n = Ce(t.key, o);
204
- return n === e.key || n.length === 1 && n.toLowerCase() === e.key.toLowerCase() ? !0 : Ve(e, t);
202
+ function Xe(e, t, o) {
203
+ const n = Ee(t.key, o);
204
+ return n === e.key || n.length === 1 && n.toLowerCase() === e.key.toLowerCase() ? !0 : Qe(e, t);
205
205
  }
206
- function Ge(e, t) {
206
+ function Ye(e, t) {
207
207
  const o = e.modifiers ?? {}, n = t.modifiers ?? {};
208
208
  return [
209
209
  !!o.ctrl == !!n.ctrl,
@@ -212,27 +212,27 @@ function Ge(e, t) {
212
212
  !!o.meta == !!n.meta
213
213
  ].every(Boolean);
214
214
  }
215
- function be(e, t) {
216
- return e.key === t.key && e.mode === t.mode && (e.active ?? !0) === (t.active ?? !0) && Ge(e, t);
215
+ function ve(e, t) {
216
+ return e.key === t.key && e.mode === t.mode && (e.active ?? !0) === (t.active ?? !0) && Ye(e, t);
217
217
  }
218
- class _e {
218
+ class Ze {
219
219
  held = /* @__PURE__ */ new Map();
220
220
  has(t) {
221
221
  return this.held.has(t);
222
222
  }
223
223
  press(t, o, n) {
224
224
  const r = this.held.get(t.id);
225
- if (r?.bindings.some((i) => be(i, o))) return !1;
226
- const s = r ?? {
225
+ if (r?.bindings.some((i) => ve(i, o))) return !1;
226
+ const l = r ?? {
227
227
  command: t,
228
228
  context: { ...n, transient: !0 },
229
229
  initial: t.isActive(n),
230
230
  bindings: []
231
231
  };
232
- return t.setActive(s.context, o.active ?? !0) === !1 ? !1 : (s.bindings.push(o), this.held.set(t.id, s), !0);
232
+ return t.setActive(l.context, o.active ?? !0) === !1 ? !1 : (l.bindings.push(o), this.held.set(t.id, l), !0);
233
233
  }
234
234
  release(t, o) {
235
- return this.removeBindings((n) => Je(n, t, o));
235
+ return this.removeBindings((n) => Xe(n, t, o));
236
236
  }
237
237
  /** Restore removed/disabled bindings without interrupting holds on ordinary rerenders. */
238
238
  reconcile(t, o) {
@@ -240,7 +240,7 @@ class _e {
240
240
  }
241
241
  isRegistered(t, o, n) {
242
242
  const r = n[o.command.id];
243
- return !r || r.options.disableHotkeys || r.command !== o.command ? !1 : (r.options.hotkeys ?? r.command.hotkeys ?? []).some((s) => be(s, t));
243
+ return !r || r.options.disableHotkeys || r.command !== o.command ? !1 : (r.options.hotkeys ?? r.command.hotkeys ?? []).some((l) => ve(l, t));
244
244
  }
245
245
  clear() {
246
246
  return this.removeBindings(() => !0);
@@ -248,144 +248,144 @@ class _e {
248
248
  removeBindings(t) {
249
249
  let o = !1;
250
250
  for (const [n, r] of this.held) {
251
- const s = r.bindings.filter((c) => !t(c, r));
252
- if (s.length === r.bindings.length) continue;
253
- o = !0, r.bindings = s;
254
- const i = s.length ? s[s.length - 1].active ?? !0 : r.initial;
255
- r.command.setActive(r.context, i), s.length || this.held.delete(n);
251
+ const l = r.bindings.filter((d) => !t(d, r));
252
+ if (l.length === r.bindings.length) continue;
253
+ o = !0, r.bindings = l;
254
+ const i = l.length ? l[l.length - 1].active ?? !0 : r.initial;
255
+ r.command.setActive(r.context, i), l.length || this.held.delete(n);
256
256
  }
257
257
  return o;
258
258
  }
259
259
  }
260
- const Te = ve(null);
261
- function Qe(e) {
260
+ const Ne = Te(null);
261
+ function et(e) {
262
262
  return e instanceof HTMLElement ? !!(e.isContentEditable || e.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]')) : !1;
263
263
  }
264
- function Xe(e) {
264
+ function tt(e) {
265
265
  return e.options.disableHotkeys ? [] : e.options.hotkeys ?? e.command.hotkeys ?? [];
266
266
  }
267
- function Ye(e, t, o) {
267
+ function ot(e, t, o) {
268
268
  return t.mode !== "hold" ? !0 : e.kind !== "toggle" ? !1 : !e.canExecute || e.canExecute(o(e));
269
269
  }
270
- function Ze(e, t, o, n) {
270
+ function nt(e, t, o, n) {
271
271
  for (const r of Object.values(e)) {
272
- const s = Xe(r).find(
273
- (i) => We(i, t, o) && Ye(r.command, i, n)
272
+ const l = tt(r).find(
273
+ (i) => _e(i, t, o) && ot(r.command, i, n)
274
274
  );
275
- if (s) return { command: r.command, binding: s };
275
+ if (l) return { command: r.command, binding: l };
276
276
  }
277
277
  }
278
- const et = ({
278
+ const rt = ({
279
279
  flipBookRef: e,
280
280
  currentPage: t,
281
281
  totalPages: o,
282
282
  direction: n = "ltr",
283
283
  commands: r = [],
284
- commandOptions: s = {},
284
+ commandOptions: l = {},
285
285
  disableHotkeys: i = !1,
286
- children: c
286
+ children: d
287
287
  }) => {
288
- const m = J(new _e()).current, [, x] = Fe((d) => d + 1, 0), g = Pe(() => {
289
- const d = {};
290
- for (const u of qe)
291
- d[u.id] = {
292
- command: u,
293
- options: s[u.id] ?? {}
288
+ const u = Q(new Ze()).current, [, D] = Be((c) => c + 1, 0), m = De(() => {
289
+ const c = {};
290
+ for (const g of Ge)
291
+ c[g.id] = {
292
+ command: g,
293
+ options: l[g.id] ?? {}
294
294
  };
295
- for (const u of r)
296
- d[u.id] = {
297
- command: u,
298
- options: s[u.id] ?? {}
295
+ for (const g of r)
296
+ c[g.id] = {
297
+ command: g,
298
+ options: l[g.id] ?? {}
299
299
  };
300
- return d;
301
- }, [r, s]), h = L(
302
- (d, u) => {
303
- const M = g[d.id]?.options ?? {}, I = u ? { ...M.data, ...u } : M.data;
300
+ return c;
301
+ }, [r, l]), p = T(
302
+ (c, g) => {
303
+ const L = m[c.id]?.options ?? {}, S = g ? { ...L.data, ...g } : L.data;
304
304
  return {
305
305
  handle: e.current,
306
- data: I
306
+ data: S
307
307
  };
308
308
  },
309
- [e, g]
310
- ), N = L(
311
- (d, u) => {
312
- if (m.has(d.id)) return;
313
- const M = h(d, u);
314
- d.canExecute && !d.canExecute(M) || (d.execute(M), x());
309
+ [e, m]
310
+ ), E = T(
311
+ (c, g) => {
312
+ if (u.has(c.id)) return;
313
+ const L = p(c, g);
314
+ c.canExecute && !c.canExecute(L) || (c.execute(L), D());
315
315
  },
316
- [h, m]
317
- ), T = L(
318
- (d) => {
319
- if (m.has(d.id)) return !1;
320
- const u = h(d);
321
- return d.canExecute ? d.canExecute(u) : !0;
316
+ [p, u]
317
+ ), N = T(
318
+ (c) => {
319
+ if (u.has(c.id)) return !1;
320
+ const g = p(c);
321
+ return c.canExecute ? c.canExecute(g) : !0;
322
322
  },
323
- [h, m]
324
- ), j = L(
325
- (d) => d.isActive(h(d)),
326
- [h]
327
- ), B = L(
328
- () => Object.values(g).map((d) => d.command),
329
- [g]
330
- ), P = J({ registry: g, execute: N, createCommandContext: h, direction: n, disableHotkeys: i });
331
- P.current = { registry: g, execute: N, createCommandContext: h, direction: n, disableHotkeys: i }, U(() => {
332
- m.reconcile(g, i) && x();
333
- }, [m, g, i]), U(() => {
334
- const d = (p, D, $) => {
335
- if (p.kind !== "toggle") return;
336
- const K = P.current.createCommandContext(p);
337
- !$.repeat && m.press(p, D, K) && x(), ["Control", "Shift", "Alt", "Meta"].includes(D.key) || $.preventDefault();
338
- }, u = (p) => {
339
- const { registry: D, execute: $, direction: K, disableHotkeys: H, createCommandContext: O } = P.current;
340
- if (H || p.defaultPrevented || Qe(p.target)) return;
341
- const k = Ze(D, p, K, O);
342
- k && (k.binding.mode === "hold" ? d(k.command, k.binding, p) : (p.preventDefault(), $(k.command)));
343
- }, M = (p) => {
344
- m.release(p, P.current.direction) && x();
345
- }, I = () => {
346
- m.clear() && x();
347
- }, A = () => {
348
- document.hidden && I();
323
+ [p, u]
324
+ ), j = T(
325
+ (c) => c.isActive(p(c)),
326
+ [p]
327
+ ), $ = T(
328
+ () => Object.values(m).map((c) => c.command),
329
+ [m]
330
+ ), x = Q({ registry: m, execute: E, createCommandContext: p, direction: n, disableHotkeys: i });
331
+ x.current = { registry: m, execute: E, createCommandContext: p, direction: n, disableHotkeys: i }, z(() => {
332
+ u.reconcile(m, i) && D();
333
+ }, [u, m, i]), z(() => {
334
+ const c = (k, v, B) => {
335
+ if (k.kind !== "toggle") return;
336
+ const F = x.current.createCommandContext(k);
337
+ !B.repeat && u.press(k, v, F) && D(), ["Control", "Shift", "Alt", "Meta"].includes(v.key) || B.preventDefault();
338
+ }, g = (k) => {
339
+ const { registry: v, execute: B, direction: F, disableHotkeys: R, createCommandContext: U } = x.current;
340
+ if (R || k.defaultPrevented || et(k.target)) return;
341
+ const P = nt(v, k, F, U);
342
+ P && (P.binding.mode === "hold" ? c(P.command, P.binding, k) : (k.preventDefault(), B(P.command)));
343
+ }, L = (k) => {
344
+ u.release(k, x.current.direction) && D();
345
+ }, S = () => {
346
+ u.clear() && D();
347
+ }, O = () => {
348
+ document.hidden && S();
349
349
  };
350
- return document.addEventListener("keydown", u), document.addEventListener("keyup", M), window.addEventListener("blur", I), document.addEventListener("visibilitychange", A), () => {
351
- document.removeEventListener("keydown", u), document.removeEventListener("keyup", M), window.removeEventListener("blur", I), document.removeEventListener("visibilitychange", A), m.clear();
350
+ return document.addEventListener("keydown", g), document.addEventListener("keyup", L), window.addEventListener("blur", S), document.addEventListener("visibilitychange", O), () => {
351
+ document.removeEventListener("keydown", g), document.removeEventListener("keyup", L), window.removeEventListener("blur", S), document.removeEventListener("visibilitychange", O), u.clear();
352
352
  };
353
- }, [m]);
354
- const S = { execute: N, canExecute: T, isActive: j, getAllCommands: B };
355
- return /* @__PURE__ */ a(Te.Provider, { value: S, children: c });
356
- }, Q = () => {
357
- const e = ye(Te);
353
+ }, [u]);
354
+ const A = { execute: E, canExecute: N, isActive: j, getAllCommands: $ };
355
+ return /* @__PURE__ */ a(Ne.Provider, { value: A, children: d });
356
+ }, X = () => {
357
+ const e = Ie(Ne);
358
358
  if (!e)
359
359
  throw new Error("useCommands must be used within a CommandProvider");
360
360
  return e;
361
361
  };
362
- function tt(e) {
362
+ function at(e) {
363
363
  let t = "";
364
364
  for (const o of new TextEncoder().encode(e))
365
365
  t += String.fromCharCode(o);
366
366
  return btoa(t);
367
367
  }
368
- function we(e) {
369
- return { ext: "json", data: tt(JSON.stringify(e, null, " ")) };
368
+ function ye(e) {
369
+ return { ext: "json", data: at(JSON.stringify(e, null, " ")) };
370
370
  }
371
- function xt(e) {
371
+ function Pt(e) {
372
372
  const { pagesCount: t, pageSemantics: o } = e, n = (r) => {
373
- const s = o?.indexToSemanticName(r) ?? "", i = o?.indexToTitle(r) ?? "";
374
- return o ? { pageIndex: r, semanticName: s, title: i } : { pageIndex: r, semanticName: String(r + 1), title: `Page ${r + 1}` };
373
+ const l = o?.indexToSemanticName(r) ?? "", i = o?.indexToTitle(r) ?? "";
374
+ return o ? { pageIndex: r, semanticName: l, title: i } : { pageIndex: r, semanticName: String(r + 1), title: `Page ${r + 1}` };
375
375
  };
376
376
  return {
377
377
  onDownloadSefer: () => {
378
378
  const r = [];
379
- for (let s = 0; s < t; s++) {
380
- const i = n(s);
379
+ for (let l = 0; l < t; l++) {
380
+ const i = n(l);
381
381
  (i.semanticName || i.title) && r.push(i);
382
382
  }
383
- return Promise.resolve(we(r));
383
+ return Promise.resolve(ye(r));
384
384
  },
385
- onDownloadPageRange: (r) => Promise.resolve(we(r.map(n)))
385
+ onDownloadPageRange: (r) => Promise.resolve(ye(r.map(n)))
386
386
  };
387
387
  }
388
- const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE__ */ a(
388
+ const q = { size: 24 }, lt = ({ size: e = q.size, className: t }) => /* @__PURE__ */ a(
389
389
  "svg",
390
390
  {
391
391
  xmlns: "http://www.w3.org/2000/svg",
@@ -401,7 +401,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
401
401
  "aria-hidden": "true",
402
402
  children: /* @__PURE__ */ a("path", { d: "m15 18-6-6 6-6" })
403
403
  }
404
- ), nt = ({ size: e = z.size, className: t }) => /* @__PURE__ */ a(
404
+ ), st = ({ size: e = q.size, className: t }) => /* @__PURE__ */ a(
405
405
  "svg",
406
406
  {
407
407
  xmlns: "http://www.w3.org/2000/svg",
@@ -417,7 +417,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
417
417
  "aria-hidden": "true",
418
418
  children: /* @__PURE__ */ a("path", { d: "m9 18 6-6-6-6" })
419
419
  }
420
- ), rt = ({ size: e = z.size, className: t }) => /* @__PURE__ */ E(
420
+ ), it = ({ size: e = q.size, className: t }) => /* @__PURE__ */ M(
421
421
  "svg",
422
422
  {
423
423
  xmlns: "http://www.w3.org/2000/svg",
@@ -436,7 +436,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
436
436
  /* @__PURE__ */ a("path", { d: "M7 6v12" })
437
437
  ]
438
438
  }
439
- ), at = ({ size: e = z.size, className: t }) => /* @__PURE__ */ E(
439
+ ), ct = ({ size: e = q.size, className: t }) => /* @__PURE__ */ M(
440
440
  "svg",
441
441
  {
442
442
  xmlns: "http://www.w3.org/2000/svg",
@@ -455,7 +455,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
455
455
  /* @__PURE__ */ a("path", { d: "M17 6v12" })
456
456
  ]
457
457
  }
458
- ), lt = ({ size: e = z.size, className: t }) => /* @__PURE__ */ E(
458
+ ), dt = ({ size: e = q.size, className: t }) => /* @__PURE__ */ M(
459
459
  "svg",
460
460
  {
461
461
  xmlns: "http://www.w3.org/2000/svg",
@@ -476,7 +476,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
476
476
  /* @__PURE__ */ a("path", { d: "M16 21h3a2 2 0 0 0 2-2v-3" })
477
477
  ]
478
478
  }
479
- ), st = ({ size: e = z.size, className: t }) => /* @__PURE__ */ E(
479
+ ), ut = ({ size: e = q.size, className: t }) => /* @__PURE__ */ M(
480
480
  "svg",
481
481
  {
482
482
  xmlns: "http://www.w3.org/2000/svg",
@@ -497,10 +497,10 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
497
497
  /* @__PURE__ */ a("path", { d: "M16 21v-3a2 2 0 0 1 2-2h3" })
498
498
  ]
499
499
  }
500
- ), it = ({
501
- size: e = z.size,
500
+ ), mt = ({
501
+ size: e = q.size,
502
502
  className: t
503
- }) => /* @__PURE__ */ E(
503
+ }) => /* @__PURE__ */ M(
504
504
  "svg",
505
505
  {
506
506
  xmlns: "http://www.w3.org/2000/svg",
@@ -523,7 +523,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
523
523
  /* @__PURE__ */ a("path", { d: "M21 19h.01" })
524
524
  ]
525
525
  }
526
- ), kt = ({ size: e = z.size, className: t }) => /* @__PURE__ */ E(
526
+ ), Ct = ({ size: e = q.size, className: t }) => /* @__PURE__ */ M(
527
527
  "svg",
528
528
  {
529
529
  xmlns: "http://www.w3.org/2000/svg",
@@ -545,7 +545,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
545
545
  /* @__PURE__ */ a("rect", { x: "16", y: "6", width: "4", height: "15", rx: "0.5" })
546
546
  ]
547
547
  }
548
- ), ct = ({ size: e = z.size, className: t }) => /* @__PURE__ */ E(
548
+ ), gt = ({ size: e = q.size, className: t }) => /* @__PURE__ */ M(
549
549
  "svg",
550
550
  {
551
551
  xmlns: "http://www.w3.org/2000/svg",
@@ -565,13 +565,13 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
565
565
  /* @__PURE__ */ a("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
566
566
  ]
567
567
  }
568
- ), q = ({
568
+ ), W = ({
569
569
  onClick: e,
570
570
  ariaLabel: t,
571
571
  ariaPressed: o,
572
572
  disabled: n = !1,
573
573
  children: r,
574
- className: s = "",
574
+ className: l = "",
575
575
  title: i
576
576
  }) => /* @__PURE__ */ a(
577
577
  "button",
@@ -582,17 +582,17 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
582
582
  "aria-pressed": o,
583
583
  disabled: n,
584
584
  title: i ?? t,
585
- className: `flipbook-toolbar-button ${s}`.trim(),
585
+ className: `flipbook-toolbar-button ${l}`.trim(),
586
586
  children: r
587
587
  }
588
- ), vt = ({
588
+ ), Tt = ({
589
589
  onClick: e,
590
590
  ariaLabel: t,
591
591
  children: o,
592
592
  disabled: n = !1,
593
593
  className: r
594
594
  }) => /* @__PURE__ */ a(
595
- q,
595
+ W,
596
596
  {
597
597
  onClick: e,
598
598
  ariaLabel: t,
@@ -600,13 +600,13 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
600
600
  className: `flipbook-toolbar-action ${r ?? ""}`.trim(),
601
601
  children: o
602
602
  }
603
- ), yt = ({
603
+ ), It = ({
604
604
  enabled: e,
605
605
  onChange: t,
606
606
  ariaLabel: o,
607
607
  className: n
608
608
  }) => /* @__PURE__ */ a(
609
- q,
609
+ W,
610
610
  {
611
611
  onClick: () => t(!e),
612
612
  ariaLabel: o ?? (e ? "Hide bookmarks" : "Show bookmarks"),
@@ -623,7 +623,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
623
623
  }
624
624
  ) })
625
625
  }
626
- ), dt = {
626
+ ), ft = {
627
627
  align: "left",
628
628
  direction: "ltr",
629
629
  translations: {
@@ -632,6 +632,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
632
632
  "toolbarItem.download.from": "From",
633
633
  "toolbarItem.download.to": "To",
634
634
  "toolbarItem.download.download": "Download",
635
+ "toolbarItem.download.error": "Download failed — try again",
635
636
  "command.downloadEntireBook": "Download entire book",
636
637
  "command.jumpToToc": "Table of contents",
637
638
  "command.jumpToFirstPage": "First page",
@@ -649,7 +650,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
649
650
  "toolbarItem.exitFullscreen": "Exit fullscreen",
650
651
  "toolbarItem.fullscreenUnsupported": "Fullscreen is not supported by this browser"
651
652
  }
652
- }, ut = {
653
+ }, ht = {
653
654
  align: "right",
654
655
  direction: "rtl",
655
656
  translations: {
@@ -658,6 +659,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
658
659
  "toolbarItem.download.from": "מ",
659
660
  "toolbarItem.download.to": "עד",
660
661
  "toolbarItem.download.download": "הורד",
662
+ "toolbarItem.download.error": "ההורדה נכשלה — נסו שוב",
661
663
  "command.downloadEntireBook": "הורד את כל הספר",
662
664
  "command.jumpToToc": "תוכן העניינים",
663
665
  "command.jumpToFirstPage": "עמוד ראשון",
@@ -675,10 +677,10 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
675
677
  "toolbarItem.exitFullscreen": "יציאה ממסך מלא",
676
678
  "toolbarItem.fullscreenUnsupported": "מסך מלא אינו נתמך בדפדפן זה"
677
679
  }
678
- }, de = {
679
- "en-US": dt,
680
- "he-IL": ut
681
- }, me = "en-US", mt = {
680
+ }, fe = {
681
+ "en-US": ft,
682
+ "he-IL": ht
683
+ }, pe = "en-US", pt = {
682
684
  "toolbarItem.download": "Download",
683
685
  "toolbarItem.downloadPageRange": "Download page range…",
684
686
  "toolbarItem.download.from": "From",
@@ -699,237 +701,247 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
699
701
  "toolbarItem.exitFullscreen": "Exit fullscreen",
700
702
  "toolbarItem.fullscreenUnsupported": "Fullscreen is not supported by this browser"
701
703
  };
702
- function Ie(e) {
703
- return de[e] ?? de[me];
704
+ function Le(e) {
705
+ return fe[e] ?? fe[pe];
704
706
  }
705
- function ue(e) {
706
- return Ie(e).direction === "rtl";
707
+ function he(e) {
708
+ return Le(e).direction === "rtl";
707
709
  }
708
- function gt(e) {
709
- return ue(e) ? "rtl" : "ltr";
710
+ function bt(e) {
711
+ return he(e) ? "rtl" : "ltr";
710
712
  }
711
- function C(e, t) {
712
- const o = Ie(t).translations[e];
713
+ function y(e, t) {
714
+ const o = Le(t).translations[e];
713
715
  if (o !== void 0 && o !== "") return o;
714
- const n = de[me].translations[e];
715
- return n !== void 0 && n !== "" ? n : mt[e] ?? e;
716
+ const n = fe[pe].translations[e];
717
+ return n !== void 0 && n !== "" ? n : pt[e] ?? e;
716
718
  }
717
- const De = ve(null);
718
- function W() {
719
- const e = ye(De);
719
+ const Fe = Te(null);
720
+ function V() {
721
+ const e = Ie(Fe);
720
722
  if (!e)
721
723
  throw new Error("Toolbar components must be used within a Toolbar");
722
724
  return e;
723
725
  }
724
- function xe(e) {
726
+ function Pe(e) {
725
727
  return e.replace(/[׳'״"]/g, "");
726
728
  }
727
- function ke(e, t) {
728
- try {
729
- const o = atob(e.data), n = new Uint8Array(o.length);
730
- for (let c = 0; c < o.length; c++)
731
- n[c] = o.charCodeAt(c);
732
- const r = new Blob([n]), s = URL.createObjectURL(r), i = document.createElement("a");
733
- i.href = s, i.download = `${t}.${e.ext}`, i.click(), URL.revokeObjectURL(s);
734
- } catch (o) {
735
- console.error("Download failed:", o);
736
- }
729
+ function Ce(e, t) {
730
+ const o = atob(e.data), n = new Uint8Array(o.length);
731
+ for (let d = 0; d < o.length; d++)
732
+ n[d] = o.charCodeAt(d);
733
+ const r = new Blob([n]), l = URL.createObjectURL(r), i = document.createElement("a");
734
+ i.href = l, i.download = `${t}.${e.ext}`, i.click(), URL.revokeObjectURL(l);
737
735
  }
738
- function ft(e, t) {
736
+ function wt(e, t) {
739
737
  const o = [];
740
738
  for (let n = 0; n < e; n++) {
741
- const r = t?.indexToSemanticName(n) ?? "", s = t?.indexToTitle(n) ?? "";
742
- if (!r && !s) {
739
+ const r = t?.indexToSemanticName(n) ?? "", l = t?.indexToTitle(n) ?? "";
740
+ if (!r && !l) {
743
741
  t || o.push({ pageIndex: n, semanticName: String(n + 1), title: `Page ${n + 1}` });
744
742
  continue;
745
743
  }
746
744
  o.push({
747
745
  pageIndex: n,
748
746
  semanticName: r || String(n + 1),
749
- title: s || r
747
+ title: l || r
750
748
  });
751
749
  }
752
750
  return o;
753
751
  }
754
- const Pt = ({
752
+ const Dt = ({
755
753
  ariaLabel: e = "Download",
756
- className: t
754
+ className: t,
755
+ children: o
757
756
  }) => {
758
757
  const {
759
- totalPages: o,
760
- pageSemantics: n,
761
- locale: r,
762
- openDownloadMenuRef: s,
763
- downloadExecutorRef: i,
764
- flipBookRef: c
765
- } = W(), m = c.current?.getDownloadConfig?.() ?? void 0, [x, g] = F(!1);
766
- U(() => (s.current = () => g(!0), () => {
767
- s.current = null;
768
- }), [s]);
769
- const [h, N] = F("entire"), [T, j] = F(0), [B, P] = F(0), [S, d] = F(null), [u, M] = F(!1), I = J(null), A = J(null), p = Pe(
770
- () => ft(o, n),
771
- [o, n]
772
- ), D = !!m?.onDownloadSefer, $ = !!m?.onDownloadPageRange, K = D || $, H = p[0]?.pageIndex ?? 0, O = p[p.length - 1]?.pageIndex ?? 0;
773
- U(() => {
774
- x && (N(D ? "entire" : "range"), j(H), P(O));
775
- }, [x, D, H, O]);
776
- const k = L(() => {
777
- g(!1);
778
- }, []);
779
- Ne(() => {
780
- if (!x || !A.current || !I.current) return;
781
- const l = A.current, b = I.current.querySelector(".flipbook-toolbar-download-trigger"), y = () => {
782
- const w = b?.getBoundingClientRect();
783
- if (!w) return;
784
- const R = 8, V = 6, te = window.innerHeight - w.bottom - V - R, ge = w.top - V - R, fe = Math.min(l.scrollHeight, window.innerHeight * 0.7, 480), oe = te < fe && ge > te;
785
- l.style.maxHeight = `${Math.max(0, Math.min(fe, oe ? ge : te))}px`;
786
- const Z = l.getBoundingClientRect(), Ee = ue(r) ? w.left : w.right - Z.width;
787
- l.style.left = `${Math.max(R, Math.min(Ee, window.innerWidth - Z.width - R))}px`;
788
- const Le = oe ? w.top - V - Z.height : w.bottom + V;
789
- l.style.top = `${Math.max(R, Math.min(Le, window.innerHeight - Z.height - R))}px`, M(oe);
758
+ totalPages: n,
759
+ pageSemantics: r,
760
+ locale: l,
761
+ openDownloadMenuRef: i,
762
+ downloadExecutorRef: d,
763
+ flipBookRef: u
764
+ } = V(), D = u.current?.getDownloadConfig?.() ?? void 0, [m, p] = I(!1);
765
+ z(() => (i.current = () => p(!0), () => {
766
+ i.current = null;
767
+ }), [i]);
768
+ const [E, N] = I("entire"), [j, $] = I(0), [x, A] = I(0), [c, g] = I(null), [L, S] = I(null), [O, k] = I(!1), v = Q(null), B = Q(null), F = De(
769
+ () => wt(n, r),
770
+ [n, r]
771
+ ), R = !!D?.onDownloadSefer, U = !!D?.onDownloadPageRange, P = R || U, Y = F[0]?.pageIndex ?? 0, Z = F[F.length - 1]?.pageIndex ?? 0;
772
+ z(() => {
773
+ m && (N(R ? "entire" : "range"), $(Y), A(Z));
774
+ }, [m, R, Y, Z]);
775
+ const b = T(() => {
776
+ p(!1), S(null);
777
+ }, []), K = T(
778
+ (s) => {
779
+ const w = u.current?.getDownloadConfig?.()?.onDownloadError?.(s);
780
+ S(
781
+ typeof w == "string" && w ? w : y("toolbarItem.download.error", l)
782
+ );
783
+ },
784
+ [u, l]
785
+ );
786
+ Se(() => {
787
+ if (!m || !B.current || !v.current) return;
788
+ const s = B.current, f = v.current.querySelector(".flipbook-toolbar-download-trigger"), w = () => {
789
+ const C = f?.getBoundingClientRect();
790
+ if (!C) return;
791
+ const H = 8, _ = 6, ae = window.innerHeight - C.bottom - _ - H, be = C.top - _ - H, we = Math.min(s.scrollHeight, window.innerHeight * 0.7, 480), le = ae < we && be > ae;
792
+ s.style.maxHeight = `${Math.max(0, Math.min(we, le ? be : ae))}px`;
793
+ const ne = s.getBoundingClientRect(), Me = he(l) ? C.left : C.right - ne.width;
794
+ s.style.left = `${Math.max(H, Math.min(Me, window.innerWidth - ne.width - H))}px`;
795
+ const je = le ? C.top - _ - ne.height : C.bottom + _;
796
+ s.style.top = `${Math.max(H, Math.min(je, window.innerHeight - ne.height - H))}px`, k(le);
790
797
  };
791
- y();
792
- const f = new ResizeObserver(y);
793
- f.observe(l);
794
- const v = I.current.closest('[role="toolbar"]');
795
- return v && f.observe(v), window.addEventListener("resize", y), window.addEventListener("scroll", y, !0), () => {
796
- f.disconnect(), window.removeEventListener("resize", y), window.removeEventListener("scroll", y, !0);
798
+ w();
799
+ const ee = new ResizeObserver(w);
800
+ ee.observe(s);
801
+ const G = v.current.closest('[role="toolbar"]');
802
+ return G && ee.observe(G), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), () => {
803
+ ee.disconnect(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0);
797
804
  };
798
- }, [x, r]), U(() => {
799
- if (!x) return;
800
- const l = (b) => {
801
- I.current && !I.current.contains(b.target) && k();
805
+ }, [m, l]), z(() => {
806
+ if (!m) return;
807
+ const s = (f) => {
808
+ v.current && !v.current.contains(f.target) && b();
802
809
  };
803
- return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
804
- }, [x, k]);
805
- const G = L(async () => {
806
- const l = c.current?.getDownloadConfig?.();
807
- if (l?.onDownloadSefer) {
808
- d("sefer");
810
+ return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
811
+ }, [m, b]);
812
+ const J = T(async () => {
813
+ const s = u.current?.getDownloadConfig?.();
814
+ if (s?.onDownloadSefer) {
815
+ g("sefer"), S(null);
809
816
  try {
810
- const b = await l.onDownloadSefer();
811
- b && ke(b, l.entireBookFilename ?? "book"), k();
817
+ const f = await s.onDownloadSefer();
818
+ f && Ce(f, s.entireBookFilename ?? "book"), b();
819
+ } catch (f) {
820
+ K(f);
812
821
  } finally {
813
- d(null);
822
+ g(null);
814
823
  }
815
824
  }
816
- }, [c, k]), _ = L(
817
- async (l, b) => {
818
- const y = c.current?.getDownloadConfig?.();
819
- if (!y?.onDownloadPageRange) return;
820
- const f = [], v = [];
821
- for (let w = l; w <= b; w++) {
822
- f.push(w);
823
- const R = p.find((V) => V.pageIndex === w);
824
- R && v.push(R);
825
+ }, [u, b, K]), h = T(
826
+ async (s, f) => {
827
+ const w = u.current?.getDownloadConfig?.();
828
+ if (!w?.onDownloadPageRange) return;
829
+ const ee = [], G = [];
830
+ for (let C = s; C <= f; C++) {
831
+ ee.push(C);
832
+ const H = F.find((_) => _.pageIndex === C);
833
+ H && G.push(H);
825
834
  }
826
- d("range");
835
+ g("range"), S(null);
827
836
  try {
828
- const w = await y.onDownloadPageRange(
829
- f,
830
- v,
831
- y.downloadContext
837
+ const C = await w.onDownloadPageRange(
838
+ ee,
839
+ G,
840
+ w.downloadContext
832
841
  );
833
- if (w) {
834
- const R = xe(v[0]?.semanticName ?? String(l)), V = xe(
835
- v[v.length - 1]?.semanticName ?? String(b)
842
+ if (C) {
843
+ const H = Pe(G[0]?.semanticName ?? String(s)), _ = Pe(
844
+ G[G.length - 1]?.semanticName ?? String(f)
836
845
  );
837
- ke(w, `${y.rangeFilename ?? "pages"}-${R}-${V}`);
846
+ Ce(C, `${w.rangeFilename ?? "pages"}-${H}-${_}`);
838
847
  }
839
- k();
848
+ b();
849
+ } catch (C) {
850
+ K(C);
840
851
  } finally {
841
- d(null);
852
+ g(null);
842
853
  }
843
854
  },
844
- [c, p, k]
855
+ [u, F, b, K]
845
856
  );
846
- return U(() => (i.current = (l, b) => {
847
- l === void 0 && b === void 0 ? G() : l !== void 0 && b !== void 0 && _(l, b);
857
+ return z(() => (d.current = (s, f) => {
858
+ s === void 0 && f === void 0 ? J() : s !== void 0 && f !== void 0 && h(s, f);
848
859
  }, () => {
849
- i.current = null;
850
- }), [i, G, _]), K ? /* @__PURE__ */ E("div", { className: `flipbook-toolbar-download-wrap ${t ?? ""}`.trim(), ref: I, children: [
860
+ d.current = null;
861
+ }), [d, J, h]), P ? /* @__PURE__ */ M("div", { className: `flipbook-toolbar-download-wrap ${t ?? ""}`.trim(), ref: v, children: [
851
862
  /* @__PURE__ */ a(
852
863
  "button",
853
864
  {
854
865
  type: "button",
855
866
  className: "flipbook-toolbar-button flipbook-toolbar-download-trigger",
856
- onClick: () => g((l) => !l),
857
- "aria-label": e ?? C("toolbarItem.download", r),
858
- "aria-expanded": x,
867
+ onClick: () => p((s) => !s),
868
+ "aria-label": e ?? y("toolbarItem.download", l),
869
+ "aria-expanded": m,
859
870
  "aria-haspopup": "true",
860
- disabled: S !== null,
861
- children: /* @__PURE__ */ a(ct, { size: 18 })
871
+ disabled: c !== null,
872
+ children: /* @__PURE__ */ a(gt, { size: 18 })
862
873
  }
863
874
  ),
864
- x && /* @__PURE__ */ E(
875
+ m && /* @__PURE__ */ M(
865
876
  "div",
866
877
  {
867
- ref: A,
868
- className: `flipbook-toolbar-download-menu ${u ? "flipbook-toolbar-download-menu--open-up" : ""}`.trim(),
878
+ ref: B,
879
+ className: `flipbook-toolbar-download-menu ${O ? "flipbook-toolbar-download-menu--open-up" : ""}`.trim(),
869
880
  role: "menu",
870
- dir: ue(r) ? "rtl" : "ltr",
881
+ dir: he(l) ? "rtl" : "ltr",
871
882
  children: [
872
- /* @__PURE__ */ E(
883
+ /* @__PURE__ */ M(
873
884
  "fieldset",
874
885
  {
875
886
  className: "flipbook-toolbar-download-mode",
876
- "aria-label": C("toolbarItem.download", r),
887
+ "aria-label": y("toolbarItem.download", l),
877
888
  children: [
878
- D && /* @__PURE__ */ E("label", { className: "flipbook-toolbar-download-radio-label", children: [
889
+ R && /* @__PURE__ */ M("label", { className: "flipbook-toolbar-download-radio-label", children: [
879
890
  /* @__PURE__ */ a(
880
891
  "input",
881
892
  {
882
893
  type: "radio",
883
894
  name: "download-mode",
884
895
  className: "flipbook-toolbar-download-radio",
885
- checked: h === "entire",
896
+ checked: E === "entire",
886
897
  onChange: () => N("entire")
887
898
  }
888
899
  ),
889
- /* @__PURE__ */ a("span", { children: C("command.downloadEntireBook", r) })
900
+ /* @__PURE__ */ a("span", { children: y("command.downloadEntireBook", l) })
890
901
  ] }),
891
- $ && /* @__PURE__ */ E("label", { className: "flipbook-toolbar-download-radio-label", children: [
902
+ U && /* @__PURE__ */ M("label", { className: "flipbook-toolbar-download-radio-label", children: [
892
903
  /* @__PURE__ */ a(
893
904
  "input",
894
905
  {
895
906
  type: "radio",
896
907
  name: "download-mode",
897
908
  className: "flipbook-toolbar-download-radio",
898
- checked: h === "range",
909
+ checked: E === "range",
899
910
  onChange: () => N("range")
900
911
  }
901
912
  ),
902
- /* @__PURE__ */ a("span", { children: C("toolbarItem.downloadPageRange", r) })
913
+ /* @__PURE__ */ a("span", { children: y("toolbarItem.downloadPageRange", l) })
903
914
  ] })
904
915
  ]
905
916
  }
906
917
  ),
907
- h === "range" && /* @__PURE__ */ E("div", { className: "flipbook-toolbar-download-range", children: [
908
- /* @__PURE__ */ E("label", { className: "flipbook-toolbar-download-range-label", children: [
909
- C("toolbarItem.download.from", r),
918
+ E === "range" && /* @__PURE__ */ M("div", { className: "flipbook-toolbar-download-range", children: [
919
+ /* @__PURE__ */ M("label", { className: "flipbook-toolbar-download-range-label", children: [
920
+ y("toolbarItem.download.from", l),
910
921
  /* @__PURE__ */ a(
911
922
  "select",
912
923
  {
913
- value: T,
914
- onChange: (l) => j(Number(l.target.value)),
924
+ value: j,
925
+ onChange: (s) => $(Number(s.target.value)),
915
926
  className: "flipbook-toolbar-download-range-select",
916
- children: p.map((l) => /* @__PURE__ */ a("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
927
+ children: F.map((s) => /* @__PURE__ */ a("option", { value: s.pageIndex, children: s.semanticName || s.title || `Page ${s.pageIndex + 1}` }, s.pageIndex))
917
928
  }
918
929
  )
919
930
  ] }),
920
- /* @__PURE__ */ E("label", { className: "flipbook-toolbar-download-range-label", children: [
921
- C("toolbarItem.download.to", r),
931
+ /* @__PURE__ */ M("label", { className: "flipbook-toolbar-download-range-label", children: [
932
+ y("toolbarItem.download.to", l),
922
933
  /* @__PURE__ */ a(
923
934
  "select",
924
935
  {
925
- value: B,
926
- onChange: (l) => P(Number(l.target.value)),
936
+ value: x,
937
+ onChange: (s) => A(Number(s.target.value)),
927
938
  className: "flipbook-toolbar-download-range-select",
928
- children: p.map((l) => /* @__PURE__ */ a("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
939
+ children: F.map((s) => /* @__PURE__ */ a("option", { value: s.pageIndex, children: s.semanticName || s.title || `Page ${s.pageIndex + 1}` }, s.pageIndex))
929
940
  }
930
941
  )
931
942
  ] })
932
943
  ] }),
944
+ L && /* @__PURE__ */ a("div", { role: "alert", className: "flipbook-toolbar-download-error", children: L }),
933
945
  /* @__PURE__ */ a(
934
946
  "button",
935
947
  {
@@ -937,203 +949,204 @@ const Pt = ({
937
949
  role: "menuitem",
938
950
  className: "flipbook-toolbar-download-menuitem flipbook-toolbar-download-primary",
939
951
  onClick: () => {
940
- if (h === "entire")
941
- G();
952
+ if (E === "entire")
953
+ J();
942
954
  else {
943
- const l = c.current?.getTotalPages?.() ?? o, b = Math.min(T, B);
944
- let y = Math.max(T, B);
945
- if (l > 0 && y >= l && (y = l - 1), y < b) return;
946
- _(b, y);
955
+ const s = u.current?.getTotalPages?.() ?? n, f = Math.min(j, x);
956
+ let w = Math.max(j, x);
957
+ if (s > 0 && w >= s && (w = s - 1), w < f) return;
958
+ h(f, w);
947
959
  }
948
960
  },
949
- disabled: S !== null,
950
- children: S === "sefer" || S === "range" ? "…" : C("toolbarItem.download.download", r)
961
+ disabled: c !== null,
962
+ children: c === "sefer" || c === "range" ? "…" : y("toolbarItem.download.download", l)
951
963
  }
952
- )
964
+ ),
965
+ o && /* @__PURE__ */ a("div", { className: "flipbook-toolbar-download-extra", children: o })
953
966
  ]
954
967
  }
955
968
  )
956
969
  ] }) : null;
957
- }, Ct = ({ children: e, className: t }) => {
958
- const { locale: o } = W(), { execute: n, canExecute: r } = Q(), s = () => {
959
- n(ae);
960
- }, i = /* @__PURE__ */ a(rt, { size: 18 }), c = C("command.jumpToFirstPage", o);
970
+ }, Et = ({ children: e, className: t }) => {
971
+ const { locale: o } = V(), { execute: n, canExecute: r } = X(), l = () => {
972
+ n(ce);
973
+ }, i = /* @__PURE__ */ a(it, { size: 18 }), d = y("command.jumpToFirstPage", o);
961
974
  return /* @__PURE__ */ a(
962
- q,
975
+ W,
963
976
  {
964
- onClick: s,
965
- ariaLabel: c,
966
- title: c,
967
- disabled: !r(ae),
977
+ onClick: l,
978
+ ariaLabel: d,
979
+ title: d,
980
+ disabled: !r(ce),
968
981
  className: `flipbook-toolbar-first ${t ?? ""}`.trim(),
969
982
  children: e ?? i
970
983
  }
971
984
  );
972
- }, Tt = ({
985
+ }, Nt = ({
973
986
  targetRef: e,
974
987
  enterIcon: t,
975
988
  exitIcon: o,
976
989
  ariaLabelEnter: n,
977
990
  ariaLabelExit: r,
978
- unsupportedBehavior: s = "hide",
991
+ unsupportedBehavior: l = "hide",
979
992
  className: i
980
993
  }) => {
981
- const c = W(), { execute: m, canExecute: x } = Q(), g = e ?? c.fullscreenTargetRef, [h, N] = F(!1), [T, j] = F(!1);
982
- U(() => {
983
- const d = () => {
984
- N(ie() !== null), j(ce(g?.current));
994
+ const d = V(), { execute: u, canExecute: D } = X(), m = e ?? d.fullscreenTargetRef, [p, E] = I(!1), [N, j] = I(!1);
995
+ z(() => {
996
+ const c = () => {
997
+ E(me() !== null), j(ge(m?.current));
985
998
  };
986
- d();
987
- for (const u of pe)
988
- document.addEventListener(u, d);
999
+ c();
1000
+ for (const g of ke)
1001
+ document.addEventListener(g, c);
989
1002
  return () => {
990
- for (const u of pe)
991
- document.removeEventListener(u, d);
1003
+ for (const g of ke)
1004
+ document.removeEventListener(g, c);
992
1005
  };
993
- }, [g]);
994
- const B = () => {
995
- e ? m(Y, {
1006
+ }, [m]);
1007
+ const $ = () => {
1008
+ e ? u(oe, {
996
1009
  getFullscreenTarget: () => e.current ?? null
997
- }) : m(Y);
1010
+ }) : u(oe);
998
1011
  };
999
- if (!T && s === "hide") return null;
1000
- const P = h ? r ?? C("toolbarItem.exitFullscreen", c.locale) : n ?? C("toolbarItem.enterFullscreen", c.locale), S = h ? o ?? /* @__PURE__ */ a(st, { size: 18 }) : t ?? /* @__PURE__ */ a(lt, { size: 18 });
1012
+ if (!N && l === "hide") return null;
1013
+ const x = p ? r ?? y("toolbarItem.exitFullscreen", d.locale) : n ?? y("toolbarItem.enterFullscreen", d.locale), A = p ? o ?? /* @__PURE__ */ a(ut, { size: 18 }) : t ?? /* @__PURE__ */ a(dt, { size: 18 });
1001
1014
  return /* @__PURE__ */ a(
1002
- q,
1015
+ W,
1003
1016
  {
1004
- onClick: B,
1005
- ariaLabel: P,
1006
- ariaPressed: h,
1007
- disabled: !T || !x(Y),
1008
- title: T ? P : C("toolbarItem.fullscreenUnsupported", c.locale),
1009
- className: `flipbook-toolbar-fullscreen ${h ? "flipbook-toolbar-fullscreen--active" : ""} ${i ?? ""}`.trim(),
1010
- children: S
1017
+ onClick: $,
1018
+ ariaLabel: x,
1019
+ ariaPressed: p,
1020
+ disabled: !N || !D(oe),
1021
+ title: N ? x : y("toolbarItem.fullscreenUnsupported", d.locale),
1022
+ className: `flipbook-toolbar-fullscreen ${p ? "flipbook-toolbar-fullscreen--active" : ""} ${i ?? ""}`.trim(),
1023
+ children: A
1011
1024
  }
1012
1025
  );
1013
- }, It = ({ children: e, className: t }) => {
1014
- const { locale: o } = W(), { execute: n, canExecute: r } = Q(), s = () => {
1015
- n(le);
1016
- }, i = /* @__PURE__ */ a(at, { size: 18 }), c = C("command.jumpToLastPage", o);
1026
+ }, Lt = ({ children: e, className: t }) => {
1027
+ const { locale: o } = V(), { execute: n, canExecute: r } = X(), l = () => {
1028
+ n(de);
1029
+ }, i = /* @__PURE__ */ a(ct, { size: 18 }), d = y("command.jumpToLastPage", o);
1017
1030
  return /* @__PURE__ */ a(
1018
- q,
1031
+ W,
1019
1032
  {
1020
- onClick: s,
1021
- ariaLabel: c,
1022
- title: c,
1023
- disabled: !r(le),
1033
+ onClick: l,
1034
+ ariaLabel: d,
1035
+ title: d,
1036
+ disabled: !r(de),
1024
1037
  className: `flipbook-toolbar-last ${t ?? ""}`.trim(),
1025
1038
  children: e ?? i
1026
1039
  }
1027
1040
  );
1028
- }, ht = ({
1041
+ }, xt = ({
1029
1042
  command: e,
1030
1043
  ariaLabel: t,
1031
1044
  children: o,
1032
1045
  disabled: n = !1,
1033
1046
  className: r
1034
1047
  }) => {
1035
- const { execute: s, canExecute: i, isActive: c } = Q();
1048
+ const { execute: l, canExecute: i, isActive: d } = X();
1036
1049
  return /* @__PURE__ */ a(
1037
- q,
1050
+ W,
1038
1051
  {
1039
- onClick: () => s(e),
1052
+ onClick: () => l(e),
1040
1053
  ariaLabel: t,
1041
- ariaPressed: c(e),
1054
+ ariaPressed: d(e),
1042
1055
  disabled: n || !i(e),
1043
1056
  className: r,
1044
1057
  children: o
1045
1058
  }
1046
1059
  );
1047
- }, Dt = ({
1060
+ }, Ft = ({
1048
1061
  letters: e,
1049
1062
  ariaLabel: t,
1050
1063
  className: o
1051
1064
  }) => {
1052
- const { locale: n } = W(), r = t ?? C("toolbarItem.selectText", n);
1065
+ const { locale: n } = V(), r = t ?? y("toolbarItem.selectText", n);
1053
1066
  return /* @__PURE__ */ a(
1054
- ht,
1067
+ xt,
1055
1068
  {
1056
- command: ee,
1069
+ command: re,
1057
1070
  ariaLabel: r,
1058
1071
  className: `flipbook-toolbar-mouse-mode ${o ?? ""}`.trim(),
1059
- children: /* @__PURE__ */ E("span", { className: "flipbook-toolbar-mouse-mode-icon", "aria-hidden": "true", children: [
1072
+ children: /* @__PURE__ */ M("span", { className: "flipbook-toolbar-mouse-mode-icon", "aria-hidden": "true", children: [
1060
1073
  /* @__PURE__ */ a("span", { className: "flipbook-toolbar-mouse-mode-caret" }),
1061
- /* @__PURE__ */ a("span", { children: e ?? C("toolbarItem.selectionLetters", n) })
1074
+ /* @__PURE__ */ a("span", { children: e ?? y("toolbarItem.selectionLetters", n) })
1062
1075
  ] })
1063
1076
  }
1064
1077
  );
1065
- }, Et = ({ children: e, className: t }) => {
1066
- const { locale: o } = W(), { execute: n, canExecute: r } = Q(), s = () => {
1067
- n(ne);
1068
- }, i = C("command.jumpToNextPage", o), c = /* @__PURE__ */ a(nt, { size: 20 });
1078
+ }, Mt = ({ children: e, className: t }) => {
1079
+ const { locale: o } = V(), { execute: n, canExecute: r } = X(), l = () => {
1080
+ n(se);
1081
+ }, i = y("command.jumpToNextPage", o), d = /* @__PURE__ */ a(st, { size: 20 });
1069
1082
  return /* @__PURE__ */ a(
1070
- q,
1083
+ W,
1071
1084
  {
1072
- onClick: s,
1085
+ onClick: l,
1073
1086
  ariaLabel: i,
1074
1087
  title: i,
1075
- disabled: !r(ne),
1088
+ disabled: !r(se),
1076
1089
  className: `flipbook-toolbar-next ${t ?? ""}`.trim(),
1077
- children: e ?? c
1090
+ children: e ?? d
1078
1091
  }
1079
1092
  );
1080
- }, Lt = ({
1093
+ }, jt = ({
1081
1094
  mode: e,
1082
1095
  showTotal: t = !0,
1083
1096
  placeholder: o = "—",
1084
1097
  editable: n,
1085
1098
  className: r,
1086
- ariaLabel: s = "Go to page",
1099
+ ariaLabel: l = "Go to page",
1087
1100
  maxLength: i = 10
1088
1101
  }) => {
1089
- const { flipBookRef: c, pageSemantics: m, direction: x, currentPage: g, totalPages: h, of: N } = W(), T = e ?? (m ? "semantic" : "index"), j = n ?? (T === "semantic" && !!m), [B, P] = F(""), [S, d] = F(!1), u = J(!1), M = J(g), I = g, A = g + 1 < h ? g + 1 : null, p = L(
1090
- (f) => T === "semantic" && m ? m.indexToSemanticName(f) || "" : String(f + 1),
1091
- [T, m]
1092
- ), D = p(I), $ = A != null ? p(A) : "", K = L(() => String(N), [N]), H = L(() => {
1093
- const f = D, v = $;
1094
- let w;
1095
- return !f && !v ? w = o : f ? v ? f === v ? w = f : w = `${f} - ${v}` : w = f : w = v, t ? `${w} / ${K()}` : w;
1096
- }, [D, $, o, t, K]), O = x === "rtl" ? $ || D : D || $, k = H();
1097
- U(() => {
1098
- const f = g !== M.current;
1099
- M.current = g, f && (u.current = !1), !S && !u.current && P(k);
1100
- }, [k, S, g]);
1101
- const G = L(
1102
- (f) => {
1102
+ const { flipBookRef: d, pageSemantics: u, direction: D, currentPage: m, totalPages: p, of: E } = V(), N = e ?? (u ? "semantic" : "index"), j = n ?? (N === "semantic" && !!u), [$, x] = I(""), [A, c] = I(!1), g = Q(!1), L = Q(m), S = m, O = m + 1 < p ? m + 1 : null, k = T(
1103
+ (h) => N === "semantic" && u ? u.indexToSemanticName(h) || "" : String(h + 1),
1104
+ [N, u]
1105
+ ), v = k(S), B = O != null ? k(O) : "", F = T(() => String(E), [E]), R = T(() => {
1106
+ const h = v, s = B;
1107
+ let f;
1108
+ return !h && !s ? f = o : h ? s ? h === s ? f = h : f = `${h} - ${s}` : f = h : f = s, t ? `${f} / ${F()}` : f;
1109
+ }, [v, B, o, t, F]), U = D === "rtl" ? B || v : v || B, P = R();
1110
+ z(() => {
1111
+ const h = m !== L.current;
1112
+ L.current = m, h && (g.current = !1), !A && !g.current && x(P);
1113
+ }, [P, A, m]);
1114
+ const Y = T(
1115
+ (h) => {
1103
1116
  if (j) {
1104
- d(!0), P(O), u.current = !1;
1105
- const v = () => f.target.select();
1106
- typeof requestAnimationFrame < "u" ? requestAnimationFrame(v) : v();
1117
+ c(!0), x(U), g.current = !1;
1118
+ const s = () => h.target.select();
1119
+ typeof requestAnimationFrame < "u" ? requestAnimationFrame(s) : s();
1107
1120
  }
1108
1121
  },
1109
- [j, O]
1110
- ), _ = L(() => {
1111
- d(!1), u.current || P(k);
1112
- }, [k]), l = L(
1113
- (f) => {
1114
- if (f.key === "Enter") {
1115
- if (m && B.trim()) {
1116
- const v = m.semanticNameToIndex(B.trim());
1117
- v != null && v >= 0 && v < h && (c.current?.jumpToPage(v), u.current = !0);
1122
+ [j, U]
1123
+ ), Z = T(() => {
1124
+ c(!1), g.current || x(P);
1125
+ }, [P]), b = T(
1126
+ (h) => {
1127
+ if (h.key === "Enter") {
1128
+ if (u && $.trim()) {
1129
+ const s = u.semanticNameToIndex($.trim());
1130
+ s != null && s >= 0 && s < p && (d.current?.jumpToPage(s), g.current = !0);
1118
1131
  }
1119
- f.currentTarget.blur();
1120
- } else f.key === "Escape" && f.currentTarget.blur();
1132
+ h.currentTarget.blur();
1133
+ } else h.key === "Escape" && h.currentTarget.blur();
1121
1134
  },
1122
- [B, m, h, c]
1123
- ), b = L((f) => {
1124
- P(f.target.value);
1135
+ [$, u, p, d]
1136
+ ), K = T((h) => {
1137
+ x(h.target.value);
1125
1138
  }, []);
1126
1139
  return j ? /* @__PURE__ */ a(
1127
1140
  "input",
1128
1141
  {
1129
1142
  type: "text",
1130
- className: `flipbook-toolbar-indicator ${S ? "flipbook-toolbar-indicator--editing" : ""} ${r ?? ""}`.trim(),
1131
- value: B,
1132
- onFocus: G,
1133
- onBlur: _,
1134
- onKeyDown: l,
1135
- onChange: b,
1136
- "aria-label": s,
1143
+ className: `flipbook-toolbar-indicator ${A ? "flipbook-toolbar-indicator--editing" : ""} ${r ?? ""}`.trim(),
1144
+ value: $,
1145
+ onFocus: Y,
1146
+ onBlur: Z,
1147
+ onKeyDown: b,
1148
+ onChange: K,
1149
+ "aria-label": l,
1137
1150
  "aria-live": "polite",
1138
1151
  "aria-atomic": "true",
1139
1152
  maxLength: i,
@@ -1145,39 +1158,39 @@ const Pt = ({
1145
1158
  className: `flipbook-toolbar-indicator ${r ?? ""}`.trim(),
1146
1159
  "aria-live": "polite",
1147
1160
  "aria-atomic": "true",
1148
- children: k
1161
+ children: P
1149
1162
  }
1150
1163
  );
1151
- }, Ft = ({ children: e, className: t }) => {
1152
- const { locale: o } = W(), { execute: n, canExecute: r } = Q(), s = () => {
1153
- n(re);
1154
- }, i = C("command.jumpToPrevPage", o), c = /* @__PURE__ */ a(ot, { size: 20 });
1164
+ }, Bt = ({ children: e, className: t }) => {
1165
+ const { locale: o } = V(), { execute: n, canExecute: r } = X(), l = () => {
1166
+ n(ie);
1167
+ }, i = y("command.jumpToPrevPage", o), d = /* @__PURE__ */ a(lt, { size: 20 });
1155
1168
  return /* @__PURE__ */ a(
1156
- q,
1169
+ W,
1157
1170
  {
1158
- onClick: s,
1171
+ onClick: l,
1159
1172
  ariaLabel: i,
1160
1173
  title: i,
1161
- disabled: !r(re),
1174
+ disabled: !r(ie),
1162
1175
  className: `flipbook-toolbar-prev ${t ?? ""}`.trim(),
1163
- children: e ?? c
1176
+ children: e ?? d
1164
1177
  }
1165
1178
  );
1166
- }, Nt = ({ children: e, ariaLabel: t, className: o }) => {
1167
- const { locale: n } = W(), { execute: r, canExecute: s } = Q(), i = t ?? C("command.jumpToToc", n), c = () => {
1168
- r(se);
1169
- }, m = !s(se);
1179
+ }, St = ({ children: e, ariaLabel: t, className: o }) => {
1180
+ const { locale: n } = V(), { execute: r, canExecute: l } = X(), i = t ?? y("command.jumpToToc", n), d = () => {
1181
+ r(ue);
1182
+ }, u = !l(ue);
1170
1183
  return /* @__PURE__ */ a(
1171
- q,
1184
+ W,
1172
1185
  {
1173
- onClick: c,
1186
+ onClick: d,
1174
1187
  ariaLabel: i,
1175
- disabled: m,
1188
+ disabled: u,
1176
1189
  className: `flipbook-toolbar-toc ${o ?? ""}`.trim(),
1177
- children: e ?? /* @__PURE__ */ a(it, { size: 18 })
1190
+ children: e ?? /* @__PURE__ */ a(mt, { size: 18 })
1178
1191
  }
1179
1192
  );
1180
- }, pt = {
1193
+ }, kt = {
1181
1194
  id: "openDownloadMenu",
1182
1195
  enName: "Open download menu",
1183
1196
  enDescription: "Open the download menu",
@@ -1187,137 +1200,137 @@ const Pt = ({
1187
1200
  e.data?.open?.();
1188
1201
  },
1189
1202
  canExecute: (e) => typeof e.data?.open == "function"
1190
- }, Mt = ({
1203
+ }, $t = ({
1191
1204
  flipBookRef: e,
1192
1205
  direction: t,
1193
1206
  locale: o,
1194
1207
  pageSemantics: n,
1195
1208
  className: r = "",
1196
- children: s,
1209
+ children: l,
1197
1210
  enableHotkeys: i = !0,
1198
- commands: c,
1199
- commandOptions: m,
1200
- fullscreenTargetRef: x
1211
+ commands: d,
1212
+ commandOptions: u,
1213
+ fullscreenTargetRef: D
1201
1214
  }) => {
1202
- const g = t ?? gt(o ?? me), h = o ?? (g === "rtl" ? "he-IL" : "en-US"), N = J(null), T = J(null), [j, B] = F(0), [P, S] = F(0), [d, u] = F(0), [M, I] = F(!0), [A, p] = F(!1), [D, $] = F("turn"), K = {
1203
- ...x ? {
1215
+ const m = t ?? bt(o ?? pe), p = o ?? (m === "rtl" ? "he-IL" : "en-US"), E = Q(null), N = Q(null), [j, $] = I(0), [x, A] = I(0), [c, g] = I(0), [L, S] = I(!0), [O, k] = I(!1), [v, B] = I("turn"), F = {
1216
+ ...D ? {
1204
1217
  toggleFullscreen: {
1205
1218
  data: {
1206
- getFullscreenTarget: () => x.current ?? null
1219
+ getFullscreenTarget: () => D.current ?? null
1207
1220
  }
1208
1221
  }
1209
1222
  } : {},
1210
1223
  openDownloadMenu: {
1211
- data: { open: () => N.current?.() }
1224
+ data: { open: () => E.current?.() }
1212
1225
  },
1213
1226
  download: {
1214
1227
  data: {
1215
- onDownload: (l, b) => T.current?.(l, b)
1228
+ onDownload: (b, K) => N.current?.(b, K)
1216
1229
  }
1217
1230
  }
1218
- }, H = new Map(Object.entries(m ?? {}));
1219
- for (const [l, b] of Object.entries(K)) {
1220
- const y = H.get(l);
1221
- H.set(
1222
- l,
1223
- y ? { ...b, ...y, data: { ...b.data, ...y.data } } : b
1231
+ }, R = new Map(Object.entries(u ?? {}));
1232
+ for (const [b, K] of Object.entries(F)) {
1233
+ const J = R.get(b);
1234
+ R.set(
1235
+ b,
1236
+ J ? { ...K, ...J, data: { ...K.data, ...J.data } } : K
1224
1237
  );
1225
1238
  }
1226
- const O = Object.fromEntries(H), k = L(() => {
1227
- const l = e.current;
1228
- l && (B(l.getCurrentPageIndex()), S(l.getTotalPages()), u(l.getOf()), I(l.isFirstPage()), p(l.isLastPage()), $(l.getMouseMode?.() ?? "turn"));
1239
+ const U = Object.fromEntries(R), P = T(() => {
1240
+ const b = e.current;
1241
+ b && ($(b.getCurrentPageIndex()), A(b.getTotalPages()), g(b.getOf()), S(b.isFirstPage()), k(b.isLastPage()), B(b.getMouseMode?.() ?? "turn"));
1229
1242
  }, [e]);
1230
- U(() => {
1231
- k();
1232
- const l = setInterval(k, 200);
1233
- return () => clearInterval(l);
1234
- }, [k]);
1235
- const G = /* @__PURE__ */ a(
1236
- De.Provider,
1243
+ z(() => {
1244
+ P();
1245
+ const b = setInterval(P, 200);
1246
+ return () => clearInterval(b);
1247
+ }, [P]);
1248
+ const Y = /* @__PURE__ */ a(
1249
+ Fe.Provider,
1237
1250
  {
1238
1251
  value: {
1239
1252
  flipBookRef: e,
1240
- direction: g,
1241
- locale: h,
1253
+ direction: m,
1254
+ locale: p,
1242
1255
  pageSemantics: n,
1243
1256
  currentPage: j,
1244
- totalPages: P,
1245
- of: d,
1246
- isFirstPage: M,
1247
- isLastPage: A,
1248
- mouseMode: D,
1249
- openDownloadMenuRef: N,
1250
- downloadExecutorRef: T,
1251
- fullscreenTargetRef: x
1257
+ totalPages: x,
1258
+ of: c,
1259
+ isFirstPage: L,
1260
+ isLastPage: O,
1261
+ mouseMode: v,
1262
+ openDownloadMenuRef: E,
1263
+ downloadExecutorRef: N,
1264
+ fullscreenTargetRef: D
1252
1265
  },
1253
1266
  children: /* @__PURE__ */ a(
1254
1267
  "div",
1255
1268
  {
1256
- className: `flipbook-toolbar ${g === "rtl" ? "flipbook-toolbar--rtl" : ""} ${r}`.trim(),
1269
+ className: `flipbook-toolbar ${m === "rtl" ? "flipbook-toolbar--rtl" : ""} ${r}`.trim(),
1257
1270
  role: "toolbar",
1258
1271
  "aria-label": "FlipBook navigation",
1259
- dir: g,
1260
- children: s
1272
+ dir: m,
1273
+ children: l
1261
1274
  }
1262
1275
  )
1263
1276
  }
1264
- ), _ = [pt, ...c ?? []];
1277
+ ), Z = [kt, ...d ?? []];
1265
1278
  return /* @__PURE__ */ a(
1266
- et,
1279
+ rt,
1267
1280
  {
1268
1281
  flipBookRef: e,
1269
1282
  currentPage: j,
1270
- totalPages: P,
1271
- direction: g,
1272
- commands: _,
1273
- commandOptions: O,
1283
+ totalPages: x,
1284
+ direction: m,
1285
+ commands: Z,
1286
+ commandOptions: U,
1274
1287
  disableHotkeys: !i,
1275
- children: G
1288
+ children: Y
1276
1289
  }
1277
1290
  );
1278
1291
  };
1279
1292
  export {
1280
- vt as ActionButton,
1281
- yt as BookmarkToggleButton,
1282
- kt as BookshelfIcon,
1283
- rt as ChevronFirstIcon,
1284
- at as ChevronLastIcon,
1285
- ot as ChevronLeftIcon,
1286
- nt as ChevronRightIcon,
1287
- Pt as DownloadDropdown,
1288
- ct as DownloadIcon,
1289
- Ct as FirstPageButton,
1290
- Tt as FullscreenButton,
1291
- It as LastPageButton,
1292
- lt as MaximizeIcon,
1293
- st as MinimizeIcon,
1294
- Dt as MouseModeButton,
1295
- Et as NextButton,
1296
- Lt as PageIndicator,
1297
- Ft as PrevButton,
1298
- Lt as SemanticPageIndicator,
1299
- it as TableOfContentsIcon,
1300
- Nt as TocButton,
1301
- ht as ToggleButton,
1302
- Mt as Toolbar,
1303
- q as ToolbarButton,
1304
- ce as canUseFullscreen,
1305
- xt as createDefaultDownloadConfig,
1306
- qe as defaultCommands,
1307
- je as downloadCommand,
1308
- Ue as exitFullscreen,
1309
- ne as flipNextCommand,
1310
- re as flipPrevCommand,
1311
- pe as fullscreenStateEvents,
1312
- ie as getFullscreenElement,
1313
- ae as goToFirstCommand,
1314
- le as goToLastCommand,
1315
- se as goToTocCommand,
1316
- Oe as requestFullscreen,
1317
- He as toggleDebugCommand,
1318
- Y as toggleFullscreenCommand,
1319
- ee as toggleTextSelectionCommand,
1320
- Q as useCommands,
1321
- W as useToolbar
1293
+ Tt as ActionButton,
1294
+ It as BookmarkToggleButton,
1295
+ Ct as BookshelfIcon,
1296
+ it as ChevronFirstIcon,
1297
+ ct as ChevronLastIcon,
1298
+ lt as ChevronLeftIcon,
1299
+ st as ChevronRightIcon,
1300
+ Dt as DownloadDropdown,
1301
+ gt as DownloadIcon,
1302
+ Et as FirstPageButton,
1303
+ Nt as FullscreenButton,
1304
+ Lt as LastPageButton,
1305
+ dt as MaximizeIcon,
1306
+ ut as MinimizeIcon,
1307
+ Ft as MouseModeButton,
1308
+ Mt as NextButton,
1309
+ jt as PageIndicator,
1310
+ Bt as PrevButton,
1311
+ jt as SemanticPageIndicator,
1312
+ mt as TableOfContentsIcon,
1313
+ St as TocButton,
1314
+ xt as ToggleButton,
1315
+ $t as Toolbar,
1316
+ W as ToolbarButton,
1317
+ ge as canUseFullscreen,
1318
+ Pt as createDefaultDownloadConfig,
1319
+ Ge as defaultCommands,
1320
+ Ae as downloadCommand,
1321
+ Ve as exitFullscreen,
1322
+ se as flipNextCommand,
1323
+ ie as flipPrevCommand,
1324
+ ke as fullscreenStateEvents,
1325
+ me as getFullscreenElement,
1326
+ ce as goToFirstCommand,
1327
+ de as goToLastCommand,
1328
+ ue as goToTocCommand,
1329
+ We as requestFullscreen,
1330
+ qe as toggleDebugCommand,
1331
+ oe as toggleFullscreenCommand,
1332
+ re as toggleTextSelectionCommand,
1333
+ X as useCommands,
1334
+ V as useToolbar
1322
1335
  };
1323
1336
  //# sourceMappingURL=index.js.map