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.
package/dist/toolbar/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
let
|
|
4
|
-
function
|
|
5
|
-
return
|
|
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
|
|
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
|
-
},
|
|
20
|
+
}, Re = [
|
|
21
21
|
{ key: "ArrowRight" },
|
|
22
22
|
{ key: "PageDown" },
|
|
23
23
|
{ key: " " }
|
|
24
24
|
// Space
|
|
25
|
-
],
|
|
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:
|
|
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
|
-
},
|
|
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:
|
|
42
|
+
hotkeys: Ke,
|
|
43
43
|
execute: (e) => {
|
|
44
44
|
e.handle?.flipPrev();
|
|
45
45
|
},
|
|
46
46
|
canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) > 0
|
|
47
|
-
},
|
|
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:
|
|
53
|
+
hotkeys: He,
|
|
54
54
|
execute: (e) => {
|
|
55
55
|
e.handle?.jumpToPage(0);
|
|
56
56
|
},
|
|
57
57
|
canExecute: (e) => e.handle?.getCurrentPageIndex() !== 0
|
|
58
|
-
},
|
|
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:
|
|
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
|
-
},
|
|
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:
|
|
79
|
+
hotkeys: Ue,
|
|
80
80
|
execute: (e) => {
|
|
81
|
-
const t = e.handle?.getTocPageIndex?.() ??
|
|
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?.() ??
|
|
85
|
+
const t = e.handle?.getTocPageIndex?.() ?? xe();
|
|
86
86
|
return e.handle?.getCurrentPageIndex() !== t;
|
|
87
87
|
}
|
|
88
|
-
},
|
|
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:
|
|
94
|
+
hotkeys: ze,
|
|
95
95
|
execute: (e) => {
|
|
96
96
|
e.handle?.toggleDebugBar?.();
|
|
97
97
|
}
|
|
98
|
-
},
|
|
98
|
+
}, te = () => document, ke = [
|
|
99
99
|
"fullscreenchange",
|
|
100
100
|
"webkitfullscreenchange",
|
|
101
101
|
"fullscreenerror",
|
|
102
102
|
"webkitfullscreenerror"
|
|
103
103
|
];
|
|
104
|
-
function
|
|
105
|
-
return typeof document > "u" ? null :
|
|
104
|
+
function me() {
|
|
105
|
+
return typeof document > "u" ? null : te().fullscreenElement ?? te().webkitFullscreenElement ?? null;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function ge(e) {
|
|
108
108
|
if (typeof document > "u") return !1;
|
|
109
|
-
const t = e ??
|
|
110
|
-
return typeof (t.requestFullscreen ?? t.webkitRequestFullscreen) != "function" ? !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
|
|
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
|
|
125
|
-
const e =
|
|
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
|
|
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:
|
|
140
|
-
canExecute: (e) =>
|
|
141
|
-
isActive: () =>
|
|
139
|
+
hotkeys: Je,
|
|
140
|
+
canExecute: (e) => ge(e.data?.getFullscreenTarget?.()),
|
|
141
|
+
isActive: () => me() !== null,
|
|
142
142
|
setActive: (e, t) => {
|
|
143
|
-
const o =
|
|
143
|
+
const o = me();
|
|
144
144
|
if (t) {
|
|
145
145
|
if (o) return;
|
|
146
146
|
const n = e.data?.getFullscreenTarget?.() ?? document.documentElement;
|
|
147
|
-
if (!
|
|
148
|
-
|
|
147
|
+
if (!ge(n)) return !1;
|
|
148
|
+
We(n).catch(console.warn);
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
o &&
|
|
151
|
+
o && Ve().catch(console.warn);
|
|
152
152
|
},
|
|
153
|
-
execute: (e) =>
|
|
154
|
-
},
|
|
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 =
|
|
168
|
+
const t = re.setActive(
|
|
169
169
|
e,
|
|
170
|
-
!
|
|
170
|
+
!re.isActive(e)
|
|
171
171
|
);
|
|
172
172
|
return t !== !1 && window.getSelection()?.removeAllRanges(), t;
|
|
173
173
|
}
|
|
174
|
-
},
|
|
175
|
-
ne,
|
|
176
|
-
re,
|
|
177
|
-
ae,
|
|
178
|
-
le,
|
|
174
|
+
}, Ge = [
|
|
179
175
|
se,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
176
|
+
ie,
|
|
177
|
+
ce,
|
|
178
|
+
de,
|
|
179
|
+
ue,
|
|
180
|
+
oe,
|
|
181
|
+
qe,
|
|
182
|
+
re,
|
|
183
|
+
Ae
|
|
184
184
|
];
|
|
185
|
-
function
|
|
185
|
+
function Ee(e, t) {
|
|
186
186
|
return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
if (
|
|
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
|
|
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
|
|
203
|
-
const n =
|
|
204
|
-
return n === e.key || n.length === 1 && n.toLowerCase() === e.key.toLowerCase() ? !0 :
|
|
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
|
|
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
|
|
216
|
-
return e.key === t.key && e.mode === t.mode && (e.active ?? !0) === (t.active ?? !0) &&
|
|
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
|
|
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) =>
|
|
226
|
-
const
|
|
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(
|
|
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) =>
|
|
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((
|
|
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
|
|
252
|
-
if (
|
|
253
|
-
o = !0, r.bindings =
|
|
254
|
-
const i =
|
|
255
|
-
r.command.setActive(r.context, i),
|
|
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
|
|
261
|
-
function
|
|
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
|
|
264
|
+
function tt(e) {
|
|
265
265
|
return e.options.disableHotkeys ? [] : e.options.hotkeys ?? e.command.hotkeys ?? [];
|
|
266
266
|
}
|
|
267
|
-
function
|
|
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
|
|
270
|
+
function nt(e, t, o, n) {
|
|
271
271
|
for (const r of Object.values(e)) {
|
|
272
|
-
const
|
|
273
|
-
(i) =>
|
|
272
|
+
const l = tt(r).find(
|
|
273
|
+
(i) => _e(i, t, o) && ot(r.command, i, n)
|
|
274
274
|
);
|
|
275
|
-
if (
|
|
275
|
+
if (l) return { command: r.command, binding: l };
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
const
|
|
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:
|
|
284
|
+
commandOptions: l = {},
|
|
285
285
|
disableHotkeys: i = !1,
|
|
286
|
-
children:
|
|
286
|
+
children: d
|
|
287
287
|
}) => {
|
|
288
|
-
const
|
|
289
|
-
const
|
|
290
|
-
for (const
|
|
291
|
-
|
|
292
|
-
command:
|
|
293
|
-
options:
|
|
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
|
|
296
|
-
|
|
297
|
-
command:
|
|
298
|
-
options:
|
|
295
|
+
for (const g of r)
|
|
296
|
+
c[g.id] = {
|
|
297
|
+
command: g,
|
|
298
|
+
options: l[g.id] ?? {}
|
|
299
299
|
};
|
|
300
|
-
return
|
|
301
|
-
}, [r,
|
|
302
|
-
(
|
|
303
|
-
const
|
|
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:
|
|
306
|
+
data: S
|
|
307
307
|
};
|
|
308
308
|
},
|
|
309
|
-
[e,
|
|
310
|
-
),
|
|
311
|
-
(
|
|
312
|
-
if (
|
|
313
|
-
const
|
|
314
|
-
|
|
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
|
-
[
|
|
317
|
-
),
|
|
318
|
-
(
|
|
319
|
-
if (
|
|
320
|
-
const
|
|
321
|
-
return
|
|
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
|
-
[
|
|
324
|
-
), j =
|
|
325
|
-
(
|
|
326
|
-
[
|
|
327
|
-
),
|
|
328
|
-
() => Object.values(
|
|
329
|
-
[
|
|
330
|
-
),
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}, [
|
|
334
|
-
const
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
},
|
|
339
|
-
const { registry:
|
|
340
|
-
if (
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
},
|
|
344
|
-
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
},
|
|
348
|
-
document.hidden &&
|
|
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",
|
|
351
|
-
document.removeEventListener("keydown",
|
|
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
|
-
}, [
|
|
354
|
-
const
|
|
355
|
-
return /* @__PURE__ */ a(
|
|
356
|
-
},
|
|
357
|
-
const e =
|
|
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
|
|
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
|
|
369
|
-
return { ext: "json", data:
|
|
368
|
+
function ye(e) {
|
|
369
|
+
return { ext: "json", data: at(JSON.stringify(e, null, " ")) };
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function Pt(e) {
|
|
372
372
|
const { pagesCount: t, pageSemantics: o } = e, n = (r) => {
|
|
373
|
-
const
|
|
374
|
-
return o ? { pageIndex: r, semanticName:
|
|
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
|
|
380
|
-
const i = n(
|
|
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(
|
|
383
|
+
return Promise.resolve(ye(r));
|
|
384
384
|
},
|
|
385
|
-
onDownloadPageRange: (r) => Promise.resolve(
|
|
385
|
+
onDownloadPageRange: (r) => Promise.resolve(ye(r.map(n)))
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
|
-
const
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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
|
-
),
|
|
501
|
-
size: e =
|
|
500
|
+
), mt = ({
|
|
501
|
+
size: e = q.size,
|
|
502
502
|
className: t
|
|
503
|
-
}) => /* @__PURE__ */
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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:
|
|
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 ${
|
|
585
|
+
className: `flipbook-toolbar-button ${l}`.trim(),
|
|
586
586
|
children: r
|
|
587
587
|
}
|
|
588
|
-
),
|
|
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
|
-
|
|
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
|
-
),
|
|
603
|
+
), It = ({
|
|
604
604
|
enabled: e,
|
|
605
605
|
onChange: t,
|
|
606
606
|
ariaLabel: o,
|
|
607
607
|
className: n
|
|
608
608
|
}) => /* @__PURE__ */ a(
|
|
609
|
-
|
|
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
|
-
),
|
|
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
|
-
},
|
|
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
|
-
},
|
|
679
|
-
"en-US":
|
|
680
|
-
"he-IL":
|
|
681
|
-
},
|
|
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
|
|
703
|
-
return
|
|
704
|
+
function Le(e) {
|
|
705
|
+
return fe[e] ?? fe[pe];
|
|
704
706
|
}
|
|
705
|
-
function
|
|
706
|
-
return
|
|
707
|
+
function he(e) {
|
|
708
|
+
return Le(e).direction === "rtl";
|
|
707
709
|
}
|
|
708
|
-
function
|
|
709
|
-
return
|
|
710
|
+
function bt(e) {
|
|
711
|
+
return he(e) ? "rtl" : "ltr";
|
|
710
712
|
}
|
|
711
|
-
function
|
|
712
|
-
const o =
|
|
713
|
+
function y(e, t) {
|
|
714
|
+
const o = Le(t).translations[e];
|
|
713
715
|
if (o !== void 0 && o !== "") return o;
|
|
714
|
-
const n =
|
|
715
|
-
return n !== void 0 && n !== "" ? n :
|
|
716
|
+
const n = fe[pe].translations[e];
|
|
717
|
+
return n !== void 0 && n !== "" ? n : pt[e] ?? e;
|
|
716
718
|
}
|
|
717
|
-
const
|
|
718
|
-
function
|
|
719
|
-
const e =
|
|
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
|
|
726
|
+
function Pe(e) {
|
|
725
727
|
return e.replace(/[׳'״"]/g, "");
|
|
726
728
|
}
|
|
727
|
-
function
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
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
|
|
736
|
+
function wt(e, t) {
|
|
739
737
|
const o = [];
|
|
740
738
|
for (let n = 0; n < e; n++) {
|
|
741
|
-
const r = t?.indexToSemanticName(n) ?? "",
|
|
742
|
-
if (!r && !
|
|
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:
|
|
747
|
+
title: l || r
|
|
750
748
|
});
|
|
751
749
|
}
|
|
752
750
|
return o;
|
|
753
751
|
}
|
|
754
|
-
const
|
|
752
|
+
const Dt = ({
|
|
755
753
|
ariaLabel: e = "Download",
|
|
756
|
-
className: t
|
|
754
|
+
className: t,
|
|
755
|
+
children: o
|
|
757
756
|
}) => {
|
|
758
757
|
const {
|
|
759
|
-
totalPages:
|
|
760
|
-
pageSemantics:
|
|
761
|
-
locale:
|
|
762
|
-
openDownloadMenuRef:
|
|
763
|
-
downloadExecutorRef:
|
|
764
|
-
flipBookRef:
|
|
765
|
-
} =
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
}), [
|
|
769
|
-
const [
|
|
770
|
-
() =>
|
|
771
|
-
[
|
|
772
|
-
),
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}, [
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
}, [])
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
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
|
-
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
const
|
|
795
|
-
return
|
|
796
|
-
|
|
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
|
-
}, [
|
|
799
|
-
if (!
|
|
800
|
-
const
|
|
801
|
-
|
|
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",
|
|
804
|
-
}, [
|
|
805
|
-
const
|
|
806
|
-
const
|
|
807
|
-
if (
|
|
808
|
-
|
|
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
|
|
811
|
-
|
|
817
|
+
const f = await s.onDownloadSefer();
|
|
818
|
+
f && Ce(f, s.entireBookFilename ?? "book"), b();
|
|
819
|
+
} catch (f) {
|
|
820
|
+
K(f);
|
|
812
821
|
} finally {
|
|
813
|
-
|
|
822
|
+
g(null);
|
|
814
823
|
}
|
|
815
824
|
}
|
|
816
|
-
}, [
|
|
817
|
-
async (
|
|
818
|
-
const
|
|
819
|
-
if (!
|
|
820
|
-
const
|
|
821
|
-
for (let
|
|
822
|
-
|
|
823
|
-
const
|
|
824
|
-
|
|
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
|
-
|
|
835
|
+
g("range"), S(null);
|
|
827
836
|
try {
|
|
828
|
-
const
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
837
|
+
const C = await w.onDownloadPageRange(
|
|
838
|
+
ee,
|
|
839
|
+
G,
|
|
840
|
+
w.downloadContext
|
|
832
841
|
);
|
|
833
|
-
if (
|
|
834
|
-
const
|
|
835
|
-
|
|
842
|
+
if (C) {
|
|
843
|
+
const H = Pe(G[0]?.semanticName ?? String(s)), _ = Pe(
|
|
844
|
+
G[G.length - 1]?.semanticName ?? String(f)
|
|
836
845
|
);
|
|
837
|
-
|
|
846
|
+
Ce(C, `${w.rangeFilename ?? "pages"}-${H}-${_}`);
|
|
838
847
|
}
|
|
839
|
-
|
|
848
|
+
b();
|
|
849
|
+
} catch (C) {
|
|
850
|
+
K(C);
|
|
840
851
|
} finally {
|
|
841
|
-
|
|
852
|
+
g(null);
|
|
842
853
|
}
|
|
843
854
|
},
|
|
844
|
-
[
|
|
855
|
+
[u, F, b, K]
|
|
845
856
|
);
|
|
846
|
-
return
|
|
847
|
-
|
|
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
|
-
|
|
850
|
-
}), [
|
|
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: () =>
|
|
857
|
-
"aria-label": e ??
|
|
858
|
-
"aria-expanded":
|
|
867
|
+
onClick: () => p((s) => !s),
|
|
868
|
+
"aria-label": e ?? y("toolbarItem.download", l),
|
|
869
|
+
"aria-expanded": m,
|
|
859
870
|
"aria-haspopup": "true",
|
|
860
|
-
disabled:
|
|
861
|
-
children: /* @__PURE__ */ a(
|
|
871
|
+
disabled: c !== null,
|
|
872
|
+
children: /* @__PURE__ */ a(gt, { size: 18 })
|
|
862
873
|
}
|
|
863
874
|
),
|
|
864
|
-
|
|
875
|
+
m && /* @__PURE__ */ M(
|
|
865
876
|
"div",
|
|
866
877
|
{
|
|
867
|
-
ref:
|
|
868
|
-
className: `flipbook-toolbar-download-menu ${
|
|
878
|
+
ref: B,
|
|
879
|
+
className: `flipbook-toolbar-download-menu ${O ? "flipbook-toolbar-download-menu--open-up" : ""}`.trim(),
|
|
869
880
|
role: "menu",
|
|
870
|
-
dir:
|
|
881
|
+
dir: he(l) ? "rtl" : "ltr",
|
|
871
882
|
children: [
|
|
872
|
-
/* @__PURE__ */
|
|
883
|
+
/* @__PURE__ */ M(
|
|
873
884
|
"fieldset",
|
|
874
885
|
{
|
|
875
886
|
className: "flipbook-toolbar-download-mode",
|
|
876
|
-
"aria-label":
|
|
887
|
+
"aria-label": y("toolbarItem.download", l),
|
|
877
888
|
children: [
|
|
878
|
-
|
|
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:
|
|
896
|
+
checked: E === "entire",
|
|
886
897
|
onChange: () => N("entire")
|
|
887
898
|
}
|
|
888
899
|
),
|
|
889
|
-
/* @__PURE__ */ a("span", { children:
|
|
900
|
+
/* @__PURE__ */ a("span", { children: y("command.downloadEntireBook", l) })
|
|
890
901
|
] }),
|
|
891
|
-
|
|
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:
|
|
909
|
+
checked: E === "range",
|
|
899
910
|
onChange: () => N("range")
|
|
900
911
|
}
|
|
901
912
|
),
|
|
902
|
-
/* @__PURE__ */ a("span", { children:
|
|
913
|
+
/* @__PURE__ */ a("span", { children: y("toolbarItem.downloadPageRange", l) })
|
|
903
914
|
] })
|
|
904
915
|
]
|
|
905
916
|
}
|
|
906
917
|
),
|
|
907
|
-
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
|
|
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:
|
|
914
|
-
onChange: (
|
|
924
|
+
value: j,
|
|
925
|
+
onChange: (s) => $(Number(s.target.value)),
|
|
915
926
|
className: "flipbook-toolbar-download-range-select",
|
|
916
|
-
children:
|
|
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__ */
|
|
921
|
-
|
|
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:
|
|
926
|
-
onChange: (
|
|
936
|
+
value: x,
|
|
937
|
+
onChange: (s) => A(Number(s.target.value)),
|
|
927
938
|
className: "flipbook-toolbar-download-range-select",
|
|
928
|
-
children:
|
|
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 (
|
|
941
|
-
|
|
952
|
+
if (E === "entire")
|
|
953
|
+
J();
|
|
942
954
|
else {
|
|
943
|
-
const
|
|
944
|
-
let
|
|
945
|
-
if (
|
|
946
|
-
|
|
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:
|
|
950
|
-
children:
|
|
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
|
-
},
|
|
958
|
-
const { locale: o } =
|
|
959
|
-
n(
|
|
960
|
-
}, i = /* @__PURE__ */ a(
|
|
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
|
-
|
|
975
|
+
W,
|
|
963
976
|
{
|
|
964
|
-
onClick:
|
|
965
|
-
ariaLabel:
|
|
966
|
-
title:
|
|
967
|
-
disabled: !r(
|
|
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
|
-
},
|
|
985
|
+
}, Nt = ({
|
|
973
986
|
targetRef: e,
|
|
974
987
|
enterIcon: t,
|
|
975
988
|
exitIcon: o,
|
|
976
989
|
ariaLabelEnter: n,
|
|
977
990
|
ariaLabelExit: r,
|
|
978
|
-
unsupportedBehavior:
|
|
991
|
+
unsupportedBehavior: l = "hide",
|
|
979
992
|
className: i
|
|
980
993
|
}) => {
|
|
981
|
-
const
|
|
982
|
-
|
|
983
|
-
const
|
|
984
|
-
|
|
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
|
-
|
|
987
|
-
for (const
|
|
988
|
-
document.addEventListener(
|
|
999
|
+
c();
|
|
1000
|
+
for (const g of ke)
|
|
1001
|
+
document.addEventListener(g, c);
|
|
989
1002
|
return () => {
|
|
990
|
-
for (const
|
|
991
|
-
document.removeEventListener(
|
|
1003
|
+
for (const g of ke)
|
|
1004
|
+
document.removeEventListener(g, c);
|
|
992
1005
|
};
|
|
993
|
-
}, [
|
|
994
|
-
const
|
|
995
|
-
e ?
|
|
1006
|
+
}, [m]);
|
|
1007
|
+
const $ = () => {
|
|
1008
|
+
e ? u(oe, {
|
|
996
1009
|
getFullscreenTarget: () => e.current ?? null
|
|
997
|
-
}) :
|
|
1010
|
+
}) : u(oe);
|
|
998
1011
|
};
|
|
999
|
-
if (!
|
|
1000
|
-
const
|
|
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
|
-
|
|
1015
|
+
W,
|
|
1003
1016
|
{
|
|
1004
|
-
onClick:
|
|
1005
|
-
ariaLabel:
|
|
1006
|
-
ariaPressed:
|
|
1007
|
-
disabled: !
|
|
1008
|
-
title:
|
|
1009
|
-
className: `flipbook-toolbar-fullscreen ${
|
|
1010
|
-
children:
|
|
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
|
-
},
|
|
1014
|
-
const { locale: o } =
|
|
1015
|
-
n(
|
|
1016
|
-
}, i = /* @__PURE__ */ a(
|
|
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
|
-
|
|
1031
|
+
W,
|
|
1019
1032
|
{
|
|
1020
|
-
onClick:
|
|
1021
|
-
ariaLabel:
|
|
1022
|
-
title:
|
|
1023
|
-
disabled: !r(
|
|
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
|
-
},
|
|
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:
|
|
1048
|
+
const { execute: l, canExecute: i, isActive: d } = X();
|
|
1036
1049
|
return /* @__PURE__ */ a(
|
|
1037
|
-
|
|
1050
|
+
W,
|
|
1038
1051
|
{
|
|
1039
|
-
onClick: () =>
|
|
1052
|
+
onClick: () => l(e),
|
|
1040
1053
|
ariaLabel: t,
|
|
1041
|
-
ariaPressed:
|
|
1054
|
+
ariaPressed: d(e),
|
|
1042
1055
|
disabled: n || !i(e),
|
|
1043
1056
|
className: r,
|
|
1044
1057
|
children: o
|
|
1045
1058
|
}
|
|
1046
1059
|
);
|
|
1047
|
-
},
|
|
1060
|
+
}, Ft = ({
|
|
1048
1061
|
letters: e,
|
|
1049
1062
|
ariaLabel: t,
|
|
1050
1063
|
className: o
|
|
1051
1064
|
}) => {
|
|
1052
|
-
const { locale: n } =
|
|
1065
|
+
const { locale: n } = V(), r = t ?? y("toolbarItem.selectText", n);
|
|
1053
1066
|
return /* @__PURE__ */ a(
|
|
1054
|
-
|
|
1067
|
+
xt,
|
|
1055
1068
|
{
|
|
1056
|
-
command:
|
|
1069
|
+
command: re,
|
|
1057
1070
|
ariaLabel: r,
|
|
1058
1071
|
className: `flipbook-toolbar-mouse-mode ${o ?? ""}`.trim(),
|
|
1059
|
-
children: /* @__PURE__ */
|
|
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 ??
|
|
1074
|
+
/* @__PURE__ */ a("span", { children: e ?? y("toolbarItem.selectionLetters", n) })
|
|
1062
1075
|
] })
|
|
1063
1076
|
}
|
|
1064
1077
|
);
|
|
1065
|
-
},
|
|
1066
|
-
const { locale: o } =
|
|
1067
|
-
n(
|
|
1068
|
-
}, i =
|
|
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
|
-
|
|
1083
|
+
W,
|
|
1071
1084
|
{
|
|
1072
|
-
onClick:
|
|
1085
|
+
onClick: l,
|
|
1073
1086
|
ariaLabel: i,
|
|
1074
1087
|
title: i,
|
|
1075
|
-
disabled: !r(
|
|
1088
|
+
disabled: !r(se),
|
|
1076
1089
|
className: `flipbook-toolbar-next ${t ?? ""}`.trim(),
|
|
1077
|
-
children: e ??
|
|
1090
|
+
children: e ?? d
|
|
1078
1091
|
}
|
|
1079
1092
|
);
|
|
1080
|
-
},
|
|
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:
|
|
1099
|
+
ariaLabel: l = "Go to page",
|
|
1087
1100
|
maxLength: i = 10
|
|
1088
1101
|
}) => {
|
|
1089
|
-
const { flipBookRef:
|
|
1090
|
-
(
|
|
1091
|
-
[
|
|
1092
|
-
),
|
|
1093
|
-
const
|
|
1094
|
-
let
|
|
1095
|
-
return !
|
|
1096
|
-
}, [
|
|
1097
|
-
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1100
|
-
}, [
|
|
1101
|
-
const
|
|
1102
|
-
(
|
|
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
|
-
|
|
1105
|
-
const
|
|
1106
|
-
typeof requestAnimationFrame < "u" ? requestAnimationFrame(
|
|
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,
|
|
1110
|
-
),
|
|
1111
|
-
|
|
1112
|
-
}, [
|
|
1113
|
-
(
|
|
1114
|
-
if (
|
|
1115
|
-
if (
|
|
1116
|
-
const
|
|
1117
|
-
|
|
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
|
-
|
|
1120
|
-
} else
|
|
1132
|
+
h.currentTarget.blur();
|
|
1133
|
+
} else h.key === "Escape" && h.currentTarget.blur();
|
|
1121
1134
|
},
|
|
1122
|
-
[
|
|
1123
|
-
),
|
|
1124
|
-
|
|
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 ${
|
|
1131
|
-
value:
|
|
1132
|
-
onFocus:
|
|
1133
|
-
onBlur:
|
|
1134
|
-
onKeyDown:
|
|
1135
|
-
onChange:
|
|
1136
|
-
"aria-label":
|
|
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:
|
|
1161
|
+
children: P
|
|
1149
1162
|
}
|
|
1150
1163
|
);
|
|
1151
|
-
},
|
|
1152
|
-
const { locale: o } =
|
|
1153
|
-
n(
|
|
1154
|
-
}, i =
|
|
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
|
-
|
|
1169
|
+
W,
|
|
1157
1170
|
{
|
|
1158
|
-
onClick:
|
|
1171
|
+
onClick: l,
|
|
1159
1172
|
ariaLabel: i,
|
|
1160
1173
|
title: i,
|
|
1161
|
-
disabled: !r(
|
|
1174
|
+
disabled: !r(ie),
|
|
1162
1175
|
className: `flipbook-toolbar-prev ${t ?? ""}`.trim(),
|
|
1163
|
-
children: e ??
|
|
1176
|
+
children: e ?? d
|
|
1164
1177
|
}
|
|
1165
1178
|
);
|
|
1166
|
-
},
|
|
1167
|
-
const { locale: n } =
|
|
1168
|
-
r(
|
|
1169
|
-
},
|
|
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
|
-
|
|
1184
|
+
W,
|
|
1172
1185
|
{
|
|
1173
|
-
onClick:
|
|
1186
|
+
onClick: d,
|
|
1174
1187
|
ariaLabel: i,
|
|
1175
|
-
disabled:
|
|
1188
|
+
disabled: u,
|
|
1176
1189
|
className: `flipbook-toolbar-toc ${o ?? ""}`.trim(),
|
|
1177
|
-
children: e ?? /* @__PURE__ */ a(
|
|
1190
|
+
children: e ?? /* @__PURE__ */ a(mt, { size: 18 })
|
|
1178
1191
|
}
|
|
1179
1192
|
);
|
|
1180
|
-
},
|
|
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
|
-
},
|
|
1203
|
+
}, $t = ({
|
|
1191
1204
|
flipBookRef: e,
|
|
1192
1205
|
direction: t,
|
|
1193
1206
|
locale: o,
|
|
1194
1207
|
pageSemantics: n,
|
|
1195
1208
|
className: r = "",
|
|
1196
|
-
children:
|
|
1209
|
+
children: l,
|
|
1197
1210
|
enableHotkeys: i = !0,
|
|
1198
|
-
commands:
|
|
1199
|
-
commandOptions:
|
|
1200
|
-
fullscreenTargetRef:
|
|
1211
|
+
commands: d,
|
|
1212
|
+
commandOptions: u,
|
|
1213
|
+
fullscreenTargetRef: D
|
|
1201
1214
|
}) => {
|
|
1202
|
-
const
|
|
1203
|
-
...
|
|
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: () =>
|
|
1219
|
+
getFullscreenTarget: () => D.current ?? null
|
|
1207
1220
|
}
|
|
1208
1221
|
}
|
|
1209
1222
|
} : {},
|
|
1210
1223
|
openDownloadMenu: {
|
|
1211
|
-
data: { open: () =>
|
|
1224
|
+
data: { open: () => E.current?.() }
|
|
1212
1225
|
},
|
|
1213
1226
|
download: {
|
|
1214
1227
|
data: {
|
|
1215
|
-
onDownload: (
|
|
1228
|
+
onDownload: (b, K) => N.current?.(b, K)
|
|
1216
1229
|
}
|
|
1217
1230
|
}
|
|
1218
|
-
},
|
|
1219
|
-
for (const [
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
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
|
|
1227
|
-
const
|
|
1228
|
-
|
|
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
|
-
|
|
1231
|
-
|
|
1232
|
-
const
|
|
1233
|
-
return () => clearInterval(
|
|
1234
|
-
}, [
|
|
1235
|
-
const
|
|
1236
|
-
|
|
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:
|
|
1241
|
-
locale:
|
|
1253
|
+
direction: m,
|
|
1254
|
+
locale: p,
|
|
1242
1255
|
pageSemantics: n,
|
|
1243
1256
|
currentPage: j,
|
|
1244
|
-
totalPages:
|
|
1245
|
-
of:
|
|
1246
|
-
isFirstPage:
|
|
1247
|
-
isLastPage:
|
|
1248
|
-
mouseMode:
|
|
1249
|
-
openDownloadMenuRef:
|
|
1250
|
-
downloadExecutorRef:
|
|
1251
|
-
fullscreenTargetRef:
|
|
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 ${
|
|
1269
|
+
className: `flipbook-toolbar ${m === "rtl" ? "flipbook-toolbar--rtl" : ""} ${r}`.trim(),
|
|
1257
1270
|
role: "toolbar",
|
|
1258
1271
|
"aria-label": "FlipBook navigation",
|
|
1259
|
-
dir:
|
|
1260
|
-
children:
|
|
1272
|
+
dir: m,
|
|
1273
|
+
children: l
|
|
1261
1274
|
}
|
|
1262
1275
|
)
|
|
1263
1276
|
}
|
|
1264
|
-
),
|
|
1277
|
+
), Z = [kt, ...d ?? []];
|
|
1265
1278
|
return /* @__PURE__ */ a(
|
|
1266
|
-
|
|
1279
|
+
rt,
|
|
1267
1280
|
{
|
|
1268
1281
|
flipBookRef: e,
|
|
1269
1282
|
currentPage: j,
|
|
1270
|
-
totalPages:
|
|
1271
|
-
direction:
|
|
1272
|
-
commands:
|
|
1273
|
-
commandOptions:
|
|
1283
|
+
totalPages: x,
|
|
1284
|
+
direction: m,
|
|
1285
|
+
commands: Z,
|
|
1286
|
+
commandOptions: U,
|
|
1274
1287
|
disableHotkeys: !i,
|
|
1275
|
-
children:
|
|
1288
|
+
children: Y
|
|
1276
1289
|
}
|
|
1277
1290
|
);
|
|
1278
1291
|
};
|
|
1279
1292
|
export {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
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
|