@prose-reader/react-reader 1.201.0 → 1.202.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,126 +1,127 @@
1
- import { jsx as n, jsxs as a, Fragment as K } from "react/jsx-runtime";
2
- import * as z from "react";
3
- import ye, { createContext as Te, memo as m, useMemo as we, useEffect as X, useContext as me, useState as P, useCallback as L } from "react";
4
- import { signal as fe, useSignal as be, useLiveRef as Pe, useSubscribe as M, useObserve as b, useSignalValue as Re, isDefined as Oe } from "reactjrx";
5
- import { tap as xe, switchMap as oe, NEVER as re, combineLatest as De, map as ie, EMPTY as ze, Subject as Ae, finalize as Ce, filter as ue, mergeMap as Ee, skip as ve, merge as Me, timer as Be, first as _e, distinctUntilChanged as $e, startWith as Le } from "rxjs";
6
- import { IconButton as f, Portal as le, Dialog as k, List as I, Link as Z, Stack as y, Text as p, Button as B, Presence as G, Box as O, createToaster as Ne, Toaster as Fe, Toast as A, Spinner as He, Heading as ee, HStack as D, Kbd as ge, Popover as E, Progress as N, chakra as je, Collapsible as J, Input as Ve } from "@chakra-ui/react";
7
- import { LuX as Ye, LuNotebookPen as ne, LuArrowBigRight as Ue, LuArrowBigLeft as qe, LuChevronDown as Qe, LuCircleHelp as Ge, LuTableOfContents as We, LuSearch as Ke, LuCircleCheck as pe } from "react-icons/lu";
8
- import { createPortal as Xe } from "react-dom";
9
- import { BsBookmarkPlus as Ze, BsBookmarkXFill as Je, BsBookmarks as en } from "react-icons/bs";
10
- import { isHtmlTagElement as nn } from "@prose-reader/core";
11
- import { RxDoubleArrowUp as tn, RxDoubleArrowLeft as on, RxDoubleArrowDown as rn, RxDoubleArrowRight as ln } from "react-icons/rx";
12
- import { HiOutlineInformationCircle as sn } from "react-icons/hi";
13
- import an from "rc-slider";
1
+ import { jsx as n, jsxs as c, Fragment as Z } from "react/jsx-runtime";
2
+ import * as A from "react";
3
+ import we, { createContext as Te, memo as m, useMemo as Pe, useEffect as K, useContext as fe, useState as S, useCallback as q } from "react";
4
+ import { signal as be, useSignal as xe, useLiveRef as Re, useSubscribe as L, useObserve as b, useSignalValue as Oe, isDefined as De } from "reactjrx";
5
+ import { tap as Ce, switchMap as ie, NEVER as le, combineLatest as ze, map as se, EMPTY as Ee, Subject as Ae, finalize as ve, skip as ne, filter as ge, mergeMap as Me, merge as _e, timer as Be, first as Le, distinctUntilChanged as $e, startWith as Ne } from "rxjs";
6
+ import { IconButton as f, Portal as ae, Dialog as C, List as I, Link as J, Stack as P, Text as p, Button as M, Presence as W, Box as z, createToaster as Fe, Toaster as He, Toast as _, Spinner as je, Heading as te, HStack as E, Kbd as pe, Popover as B, Progress as Q, chakra as Ve, Collapsible as ee, Input as Ge } from "@chakra-ui/react";
7
+ import { LuX as Ye, LuNotebookPen as oe, LuArrowBigRight as Ue, LuArrowBigLeft as qe, LuChevronDown as Qe, LuCircleHelp as Ke, LuTableOfContents as We, LuSearch as Xe, LuGalleryHorizontal as Ze, LuCircleCheck as me } from "react-icons/lu";
8
+ import { createPortal as Je } from "react-dom";
9
+ import { BsBookmarkPlus as en, BsBookmarkXFill as nn, BsBookmarks as tn } from "react-icons/bs";
10
+ import { isHtmlTagElement as on } from "@prose-reader/core";
11
+ import { RiGalleryView2 as rn } from "react-icons/ri";
12
+ import { RxDoubleArrowUp as ln, RxDoubleArrowLeft as sn, RxDoubleArrowDown as an, RxDoubleArrowRight as cn } from "react-icons/rx";
13
+ import { HiOutlineInformationCircle as dn } from "react-icons/hi";
14
+ import hn from "rc-slider";
14
15
  import "rc-slider/assets/index.css";
15
- import { IoIosArrowBack as cn, IoMdMore as dn } from "react-icons/io";
16
- import { MdFullscreenExit as hn, MdFullscreen as un } from "react-icons/md";
17
- const se = Te({
16
+ import { IoIosArrowBack as un, IoMdMore as gn } from "react-icons/io";
17
+ import { MdFullscreenExit as pn, MdFullscreen as mn } from "react-icons/md";
18
+ const ce = Te({
18
19
  reader: void 0,
19
- quickMenuSignal: fe({ default: !1 })
20
- }), ht = m(
20
+ quickMenuSignal: be({ default: !1 })
21
+ }), ft = m(
21
22
  ({
22
23
  children: e,
23
24
  reader: t,
24
25
  quickMenuOpen: o,
25
26
  onQuickMenuOpenChange: r
26
27
  }) => {
27
- const [, i] = be({
28
+ const [, l] = xe({
28
29
  default: o
29
- }), l = Pe(r), c = we(
30
+ }), i = Re(r), s = Pe(
30
31
  () => ({
31
- quickMenuSignal: i,
32
+ quickMenuSignal: l,
32
33
  reader: t
33
34
  }),
34
- [i, t]
35
+ [l, t]
35
36
  );
36
- return X(() => {
37
- i.setValue(o);
38
- }, [o, i]), M(
39
- () => i.subject.pipe(xe(l.current)),
40
- [i, l]
41
- ), /* @__PURE__ */ n(se.Provider, { value: c, children: e });
37
+ return K(() => {
38
+ l.setValue(o);
39
+ }, [o, l]), L(
40
+ () => l.subject.pipe(Ce(i.current)),
41
+ [l, i]
42
+ ), /* @__PURE__ */ n(ce.Provider, { value: s, children: e });
42
43
  }
43
- ), gn = z.forwardRef(function(t, o) {
44
+ ), fn = A.forwardRef(function(t, o) {
44
45
  return /* @__PURE__ */ n(f, { variant: "ghost", "aria-label": "Close", ref: o, ...t, children: t.children ?? /* @__PURE__ */ n(Ye, {}) });
45
- }), F = z.forwardRef(function(t, o) {
46
+ }), $ = A.forwardRef(function(t, o) {
46
47
  const {
47
48
  children: r,
48
- portalled: i = !0,
49
- portalRef: l,
50
- backdrop: c = !0,
51
- ...h
49
+ portalled: l = !0,
50
+ portalRef: i,
51
+ backdrop: s = !0,
52
+ ...d
52
53
  } = t;
53
- return /* @__PURE__ */ a(le, { disabled: !i, container: l, children: [
54
- c && /* @__PURE__ */ n(k.Backdrop, {}),
55
- /* @__PURE__ */ n(k.Positioner, { children: /* @__PURE__ */ n(k.Content, { ref: o, ...h, asChild: !1, children: r }) })
54
+ return /* @__PURE__ */ c(ae, { disabled: !l, container: i, children: [
55
+ s && /* @__PURE__ */ n(C.Backdrop, {}),
56
+ /* @__PURE__ */ n(C.Positioner, { children: /* @__PURE__ */ n(C.Content, { ref: o, ...d, asChild: !1, children: r }) })
56
57
  ] });
57
- }), H = z.forwardRef(function(t, o) {
58
+ }), N = A.forwardRef(function(t, o) {
58
59
  return /* @__PURE__ */ n(
59
- k.CloseTrigger,
60
+ C.CloseTrigger,
60
61
  {
61
62
  position: "absolute",
62
63
  top: "2",
63
64
  insetEnd: "2",
64
65
  ...t,
65
66
  asChild: !0,
66
- children: /* @__PURE__ */ n(gn, { size: "sm", ref: o, children: t.children })
67
+ children: /* @__PURE__ */ n(fn, { size: "sm", ref: o, children: t.children })
67
68
  }
68
69
  );
69
- }), j = k.Root, V = k.Footer, Y = k.Header, U = k.Body;
70
- k.Backdrop;
71
- const q = k.Title;
72
- k.Description;
73
- k.Trigger;
74
- const Q = k.ActionTrigger, S = () => {
75
- const { reader: e } = me(se);
70
+ }), F = C.Root, H = C.Footer, j = C.Header, V = C.Body;
71
+ C.Backdrop;
72
+ const G = C.Title;
73
+ C.Description;
74
+ C.Trigger;
75
+ const Y = C.ActionTrigger, v = () => {
76
+ const { reader: e } = fe(ce);
76
77
  return e;
77
- }, ke = (e) => !!e && "__PROSE_READER_ENHANCER_SEARCH" in e, ae = (e) => !!e && "__PROSE_READER_ENHANCER_BOOKMARKS" in e, Se = (e) => !!e && "__PROSE_READER_ENHANCER_ANNOTATIONS" in e, pn = m(
78
+ }, ke = (e) => !!e && "__PROSE_READER_ENHANCER_SEARCH" in e, de = (e) => !!e && "__PROSE_READER_ENHANCER_BOOKMARKS" in e, ye = (e) => !!e && "__PROSE_READER_ENHANCER_ANNOTATIONS" in e, Se = (e) => !!e && "__PROSE_READER_ENHANCER_GALLERY" in e, bn = m(
78
79
  ({ onNavigate: e }) => {
79
- const t = S(), o = Se(t) ? t : void 0, r = b(
80
+ const t = v(), o = ye(t) ? t : void 0, r = b(
80
81
  () => o == null ? void 0 : o.annotations.highlights$.pipe(
81
- oe(
82
- (l) => o.pagination.locate(l)
82
+ ie(
83
+ (i) => o.pagination.locate(i)
83
84
  )
84
85
  ),
85
86
  [o]
86
- ), i = (l, c) => {
87
- var h;
88
- return /* @__PURE__ */ n(I.Item, { children: /* @__PURE__ */ a(
89
- Z,
87
+ ), l = (i, s) => {
88
+ var d;
89
+ return /* @__PURE__ */ n(I.Item, { children: /* @__PURE__ */ c(
90
+ J,
90
91
  {
91
92
  href: "#",
92
93
  onClick: () => {
93
- e(), t == null || t.navigation.goToCfi(l.cfi ?? "");
94
+ e(), t == null || t.navigation.goToCfi(i.cfi ?? "");
94
95
  },
95
96
  children: [
96
- (l.contents ?? [])[0] ? /* @__PURE__ */ n(I.Indicator, { asChild: !0, children: /* @__PURE__ */ n(ne, {}) }) : /* @__PURE__ */ n(I.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(ne, {}) }),
97
- /* @__PURE__ */ a(y, { gap: 0, children: [
98
- /* @__PURE__ */ n(p, { lineClamp: 2, fontSize: "md", children: l.selectionAsText ? l.selectionAsText ?? "" : /* @__PURE__ */ n("i", { children: /* @__PURE__ */ n("b", { children: "unknown (not loaded)" }) }) }),
97
+ (i.contents ?? [])[0] ? /* @__PURE__ */ n(I.Indicator, { asChild: !0, children: /* @__PURE__ */ n(oe, {}) }) : /* @__PURE__ */ n(I.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(oe, {}) }),
98
+ /* @__PURE__ */ c(P, { gap: 0, children: [
99
+ /* @__PURE__ */ n(p, { lineClamp: 2, fontSize: "md", children: i.selectionAsText ? i.selectionAsText ?? "" : /* @__PURE__ */ n("i", { children: /* @__PURE__ */ n("b", { children: "unknown (not loaded)" }) }) }),
99
100
  /* @__PURE__ */ n(
100
101
  p,
101
102
  {
102
103
  fontStyle: "italic",
103
104
  fontWeight: "bold",
104
105
  fontSize: "sm",
105
- children: `Book page: ${((h = l.meta) == null ? void 0 : h.absolutePageIndex) !== void 0 ? l.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
106
+ children: `Book page: ${((d = i.meta) == null ? void 0 : d.absolutePageIndex) !== void 0 ? i.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
106
107
  }
107
108
  )
108
109
  ] })
109
110
  ]
110
111
  }
111
- ) }, c);
112
+ ) }, s);
112
113
  };
113
114
  return /* @__PURE__ */ n(I.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: r == null ? void 0 : r.map(
114
- (l, c) => i(l, c)
115
+ (i, s) => l(i, s)
115
116
  ) });
116
117
  }
117
- ), mn = m(
118
+ ), xn = m(
118
119
  ({
119
120
  open: e,
120
121
  setOpen: t,
121
122
  onNavigate: o
122
123
  }) => /* @__PURE__ */ n(
123
- j,
124
+ F,
124
125
  {
125
126
  lazyMount: !0,
126
127
  placement: "center",
@@ -128,65 +129,65 @@ const Q = k.ActionTrigger, S = () => {
128
129
  onOpenChange: (r) => t(r.open),
129
130
  size: { mdDown: "full", md: "lg" },
130
131
  scrollBehavior: "inside",
131
- children: /* @__PURE__ */ a(F, { height: "100%", children: [
132
- /* @__PURE__ */ n(Y, { children: /* @__PURE__ */ n(q, { children: "Annotations" }) }),
133
- /* @__PURE__ */ n(U, { flex: 1, children: /* @__PURE__ */ n(pn, { onNavigate: o }) }),
134
- /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Q, { asChild: !0, children: /* @__PURE__ */ n(B, { variant: "outline", children: "Cancel" }) }) }),
135
- /* @__PURE__ */ n(H, {})
132
+ children: /* @__PURE__ */ c($, { height: "100%", children: [
133
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Annotations" }) }),
134
+ /* @__PURE__ */ n(V, { flex: 1, children: /* @__PURE__ */ n(bn, { onNavigate: o }) }),
135
+ /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
136
+ /* @__PURE__ */ n(N, {})
136
137
  ] })
137
138
  }
138
139
  )
139
- ), fn = m(() => {
140
- const e = S(), t = ae(e) ? e : void 0, o = b(() => e == null ? void 0 : e.spine.element$, [e]), r = b(
140
+ ), Cn = m(() => {
141
+ const e = v(), t = de(e) ? e : void 0, o = b(() => e == null ? void 0 : e.spine.element$, [e]), r = b(
141
142
  () => t == null ? void 0 : t.bookmarks.pages$,
142
143
  [t]
143
- ), i = b(
144
+ ), l = b(
144
145
  () => t == null ? void 0 : t.bookmarks.bookmarks$,
145
146
  [t]
146
- ), l = b(
147
- () => e == null ? void 0 : e.pagination.locate(i ?? []),
148
- [e, i]
147
+ ), i = b(
148
+ () => e == null ? void 0 : e.pagination.locate(l ?? []),
149
+ [e, l]
149
150
  );
150
- return o ? /* @__PURE__ */ n(K, { children: Xe(
151
+ return o ? /* @__PURE__ */ n(Z, { children: Je(
151
152
  r == null ? void 0 : r.map(
152
- ({ isBookmarkable: c, absolutePosition: { left: h, top: u, width: s } }, g) => {
153
- const d = l == null ? void 0 : l.find(
153
+ ({ isBookmarkable: s, absolutePosition: { left: d, top: u, width: a } }, g) => {
154
+ const h = i == null ? void 0 : i.find(
154
155
  (x) => {
155
- var C;
156
- return ((C = x.meta) == null ? void 0 : C.absolutePageIndex) === g;
156
+ var k;
157
+ return ((k = x.meta) == null ? void 0 : k.absolutePageIndex) === g;
157
158
  }
158
159
  );
159
- return c ? /* @__PURE__ */ n(
160
- G,
160
+ return s ? /* @__PURE__ */ n(
161
+ W,
161
162
  {
162
163
  present: !0,
163
164
  lazyMount: !0,
164
165
  animationName: { _open: "fade-in", _closed: "fade-out" },
165
166
  animationDuration: "moderate",
166
167
  children: /* @__PURE__ */ n(
167
- O,
168
+ z,
168
169
  {
169
170
  "data-bookmark-area": !0,
170
171
  position: "absolute",
171
- left: h + s,
172
+ left: d + a,
172
173
  transform: "translateX(-100%)",
173
174
  top: u,
174
175
  p: 2,
175
- children: d ? /* @__PURE__ */ n(
176
+ children: h ? /* @__PURE__ */ n(
176
177
  f,
177
178
  {
178
179
  "aria-label": "bookmark",
179
180
  opacity: 0.5,
180
181
  _hover: { opacity: 1 },
181
182
  onClick: () => {
182
- d && (t == null || t.bookmarks.delete(
183
- d == null ? void 0 : d.id
183
+ h && (t == null || t.bookmarks.delete(
184
+ h == null ? void 0 : h.id
184
185
  ));
185
186
  },
186
187
  size: "lg",
187
188
  variant: "ghost",
188
189
  _icon: { boxSize: "36px" },
189
- children: /* @__PURE__ */ n(Je, {})
190
+ children: /* @__PURE__ */ n(nn, {})
190
191
  }
191
192
  ) : /* @__PURE__ */ n(
192
193
  f,
@@ -201,7 +202,7 @@ const Q = k.ActionTrigger, S = () => {
201
202
  _hover: { opacity: 1 },
202
203
  variant: "ghost",
203
204
  _icon: { boxSize: "36px" },
204
- children: /* @__PURE__ */ n(Ze, {})
205
+ children: /* @__PURE__ */ n(en, {})
205
206
  }
206
207
  )
207
208
  }
@@ -213,25 +214,25 @@ const Q = k.ActionTrigger, S = () => {
213
214
  ),
214
215
  o
215
216
  ) }) : null;
216
- }), bn = m(
217
+ }), vn = m(
217
218
  ({ onNavigate: e }) => {
218
- const t = S(), o = ae(t) ? t : void 0, r = b(
219
+ const t = v(), o = de(t) ? t : void 0, r = b(
219
220
  () => o == null ? void 0 : o.bookmarks.bookmarks$.pipe(
220
- oe((l) => o.pagination.locate(l))
221
+ ie((i) => o.pagination.locate(i))
221
222
  ),
222
223
  [o]
223
- ), i = (l, c) => {
224
- var h, u, s, g, d;
225
- return /* @__PURE__ */ a(I.Item, { justifyContent: "space-between", alignItems: "center", children: [
224
+ ), l = (i, s) => {
225
+ var d, u, a, g, h;
226
+ return /* @__PURE__ */ c(I.Item, { justifyContent: "space-between", alignItems: "center", children: [
226
227
  /* @__PURE__ */ n(
227
- Z,
228
+ J,
228
229
  {
229
230
  href: "#",
230
231
  onClick: () => {
231
- e(), t == null || t.navigation.goToCfi(l.cfi ?? "");
232
+ e(), t == null || t.navigation.goToCfi(i.cfi ?? "");
232
233
  },
233
- children: /* @__PURE__ */ a(y, { gap: 0, children: [
234
- /* @__PURE__ */ n(p, { fontSize: "md", children: `Book page: ${((h = l.meta) == null ? void 0 : h.absolutePageIndex) !== void 0 ? l.meta.absolutePageIndex + 1 : "unknown"}` }),
234
+ children: /* @__PURE__ */ c(P, { gap: 0, children: [
235
+ /* @__PURE__ */ n(p, { fontSize: "md", children: `Book page: ${((d = i.meta) == null ? void 0 : d.absolutePageIndex) !== void 0 ? i.meta.absolutePageIndex + 1 : "unknown"}` }),
235
236
  /* @__PURE__ */ n(
236
237
  p,
237
238
  {
@@ -240,37 +241,37 @@ const Q = k.ActionTrigger, S = () => {
240
241
  fontSize: "sm",
241
242
  truncate: !0,
242
243
  lineClamp: 2,
243
- children: (s = (u = l.meta) == null ? void 0 : u.startNode) != null && s.textContent ? (d = (g = l.meta) == null ? void 0 : g.startNode) == null ? void 0 : d.textContent : "..."
244
+ children: (a = (u = i.meta) == null ? void 0 : u.startNode) != null && a.textContent ? (h = (g = i.meta) == null ? void 0 : g.startNode) == null ? void 0 : h.textContent : "..."
244
245
  }
245
246
  )
246
247
  ] })
247
248
  }
248
249
  ),
249
250
  /* @__PURE__ */ n(
250
- B,
251
+ M,
251
252
  {
252
253
  colorPalette: "red",
253
254
  variant: "solid",
254
255
  size: "xs",
255
256
  onClick: () => {
256
- o == null || o.bookmarks.delete(l.id);
257
+ o == null || o.bookmarks.delete(i.id);
257
258
  },
258
259
  children: "Delete"
259
260
  }
260
261
  )
261
- ] }, c);
262
+ ] }, s);
262
263
  };
263
264
  return /* @__PURE__ */ n(I.Root, { overflowY: "auto", gap: 3, variant: "plain", overflow: "auto", children: r == null ? void 0 : r.map(
264
- (l, c) => i(l, c)
265
+ (i, s) => l(i, s)
265
266
  ) });
266
267
  }
267
- ), xn = m(
268
+ ), kn = m(
268
269
  ({
269
270
  open: e,
270
271
  setOpen: t,
271
272
  onNavigate: o
272
273
  }) => /* @__PURE__ */ n(
273
- j,
274
+ F,
274
275
  {
275
276
  lazyMount: !0,
276
277
  placement: "center",
@@ -278,34 +279,78 @@ const Q = k.ActionTrigger, S = () => {
278
279
  onOpenChange: (r) => t(r.open),
279
280
  size: { mdDown: "full", md: "lg" },
280
281
  scrollBehavior: "inside",
281
- children: /* @__PURE__ */ a(F, { height: "100%", children: [
282
- /* @__PURE__ */ n(Y, { children: /* @__PURE__ */ n(q, { children: "Bookmarks" }) }),
283
- /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(bn, { onNavigate: o }) }),
284
- /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Q, { asChild: !0, children: /* @__PURE__ */ n(B, { variant: "outline", children: "Cancel" }) }) }),
285
- /* @__PURE__ */ n(H, {})
282
+ children: /* @__PURE__ */ c($, { height: "100%", children: [
283
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Bookmarks" }) }),
284
+ /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(vn, { onNavigate: o }) }),
285
+ /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
286
+ /* @__PURE__ */ n(N, {})
286
287
  ] })
287
288
  }
288
289
  )
289
- ), te = Ne({
290
+ ), re = Fe({
290
291
  placement: "bottom-end",
291
292
  pauseOnPageIdle: !0
292
- }), Cn = () => /* @__PURE__ */ n(le, { children: /* @__PURE__ */ n(Fe, { toaster: te, insetInline: { mdDown: "4" }, children: (e) => {
293
+ }), yn = () => /* @__PURE__ */ n(ae, { children: /* @__PURE__ */ n(He, { toaster: re, insetInline: { mdDown: "4" }, children: (e) => {
293
294
  var t;
294
- return /* @__PURE__ */ a(A.Root, { width: { md: "sm" }, children: [
295
- e.type === "loading" ? /* @__PURE__ */ n(He, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ n(A.Indicator, {}),
296
- /* @__PURE__ */ a(y, { gap: "1", flex: "1", maxWidth: "100%", children: [
297
- e.title && /* @__PURE__ */ n(A.Title, { children: e.title }),
298
- e.description && /* @__PURE__ */ n(A.Description, { children: e.description })
295
+ return /* @__PURE__ */ c(_.Root, { width: { md: "sm" }, children: [
296
+ e.type === "loading" ? /* @__PURE__ */ n(je, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ n(_.Indicator, {}),
297
+ /* @__PURE__ */ c(P, { gap: "1", flex: "1", maxWidth: "100%", children: [
298
+ e.title && /* @__PURE__ */ n(_.Title, { children: e.title }),
299
+ e.description && /* @__PURE__ */ n(_.Description, { children: e.description })
299
300
  ] }),
300
- e.action && /* @__PURE__ */ n(A.ActionTrigger, { children: e.action.label }),
301
- ((t = e.meta) == null ? void 0 : t.closable) && /* @__PURE__ */ n(A.CloseTrigger, {})
301
+ e.action && /* @__PURE__ */ n(_.ActionTrigger, { children: e.action.label }),
302
+ ((t = e.meta) == null ? void 0 : t.closable) && /* @__PURE__ */ n(_.CloseTrigger, {})
302
303
  ] });
303
- } }) }), vn = "@prose-reader/react-reader", kn = "1.200.0", Sn = m(
304
+ } }) }), Sn = m(
305
+ ({
306
+ open: e,
307
+ setOpen: t
308
+ }) => {
309
+ const o = v(), [r, l] = S(null), i = Se(o) ? o : void 0, s = "prose-gallery-grid-item", d = b(
310
+ () => i == null ? void 0 : i.gallery.create({
311
+ gridItemClassName: s
312
+ }),
313
+ [i]
314
+ );
315
+ return K(() => {
316
+ r && d && (r.innerHTML = "", r.appendChild(d));
317
+ }, [d, r]), /* @__PURE__ */ n(
318
+ F,
319
+ {
320
+ lazyMount: !0,
321
+ placement: "center",
322
+ open: e,
323
+ onOpenChange: (u) => t(u.open),
324
+ size: { mdDown: "full", md: "lg" },
325
+ scrollBehavior: "inside",
326
+ children: /* @__PURE__ */ c($, { height: "100%", children: [
327
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Gallery" }) }),
328
+ /* @__PURE__ */ n(
329
+ V,
330
+ {
331
+ ref: l,
332
+ css: {
333
+ "--prose-gallery-columns": ["2", "3"],
334
+ [`& .${s}`]: {
335
+ border: "1px solid red",
336
+ borderColor: "border",
337
+ borderRadius: "md"
338
+ }
339
+ }
340
+ }
341
+ ),
342
+ /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
343
+ /* @__PURE__ */ n(N, {})
344
+ ] })
345
+ }
346
+ );
347
+ }
348
+ ), In = "@prose-reader/react-reader", wn = "1.201.0", Tn = m(
304
349
  ({
305
350
  open: e,
306
351
  setOpen: t
307
352
  }) => /* @__PURE__ */ n(
308
- j,
353
+ F,
309
354
  {
310
355
  lazyMount: !0,
311
356
  placement: "center",
@@ -313,42 +358,42 @@ const Q = k.ActionTrigger, S = () => {
313
358
  onOpenChange: (o) => t(o.open),
314
359
  size: { mdDown: "full", md: "lg" },
315
360
  scrollBehavior: "inside",
316
- children: /* @__PURE__ */ a(F, { children: [
317
- /* @__PURE__ */ n(Y, { children: /* @__PURE__ */ n(q, { children: "Help" }) }),
318
- /* @__PURE__ */ a(U, { overflowY: "auto", flex: 1, children: [
319
- /* @__PURE__ */ n(ee, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
320
- /* @__PURE__ */ a(D, { mb: 1, children: [
321
- /* @__PURE__ */ n(ge, { children: /* @__PURE__ */ n(Ue, {}) }),
361
+ children: /* @__PURE__ */ c($, { children: [
362
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Help" }) }),
363
+ /* @__PURE__ */ c(V, { overflowY: "auto", flex: 1, children: [
364
+ /* @__PURE__ */ n(te, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
365
+ /* @__PURE__ */ c(E, { mb: 1, children: [
366
+ /* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(Ue, {}) }),
322
367
  " ",
323
368
  /* @__PURE__ */ n(p, { children: "Navigate to right page" })
324
369
  ] }),
325
- /* @__PURE__ */ a(D, { mb: 1, children: [
326
- /* @__PURE__ */ n(ge, { children: /* @__PURE__ */ n(qe, {}) }),
370
+ /* @__PURE__ */ c(E, { mb: 1, children: [
371
+ /* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(qe, {}) }),
327
372
  " ",
328
373
  /* @__PURE__ */ n(p, { children: "Navigate to left page" })
329
374
  ] }),
330
- /* @__PURE__ */ n(ee, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
331
- /* @__PURE__ */ a(p, { children: [
332
- vn,
375
+ /* @__PURE__ */ n(te, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
376
+ /* @__PURE__ */ c(p, { children: [
377
+ In,
333
378
  " version: ",
334
- kn
379
+ wn
335
380
  ] })
336
381
  ] }),
337
- /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Q, { asChild: !0, children: /* @__PURE__ */ n(B, { variant: "outline", children: "Cancel" }) }) }),
338
- /* @__PURE__ */ n(H, {})
382
+ /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
383
+ /* @__PURE__ */ n(N, {})
339
384
  ] })
340
385
  }
341
386
  )
342
- ), _ = () => {
343
- const e = S();
387
+ ), U = () => {
388
+ const e = v();
344
389
  return b(
345
- () => e ? De([e.pagination.state$, e.context.state$]).pipe(
346
- ie(([t, o]) => {
347
- var i;
348
- const r = (i = o.manifest) == null ? void 0 : i.spineItems.every(
349
- (l) => {
350
- var c;
351
- return (c = l.mediaType) == null ? void 0 : c.startsWith("image/");
390
+ () => e ? ze([e.pagination.state$, e.context.state$]).pipe(
391
+ se(([t, o]) => {
392
+ var l;
393
+ const r = (l = o.manifest) == null ? void 0 : l.spineItems.every(
394
+ (i) => {
395
+ var s;
396
+ return (s = i.mediaType) == null ? void 0 : s.startsWith("image/");
352
397
  }
353
398
  );
354
399
  return {
@@ -356,52 +401,52 @@ const Q = k.ActionTrigger, S = () => {
356
401
  hasChapters: !o.isFullyPrePaginated && !r
357
402
  };
358
403
  })
359
- ) : re,
404
+ ) : le,
360
405
  [e]
361
406
  );
362
- }, In = () => {
363
- const e = _(), t = Math.floor(
407
+ }, Pn = () => {
408
+ const e = U(), t = Math.floor(
364
409
  ((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100
365
410
  ), o = t > 0 ? t : 1;
366
- return (e == null ? void 0 : e.percentageEstimateOfBook) === void 0 ? null : /* @__PURE__ */ n(O, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ a(p, { fontSize: "sm", children: [
411
+ return (e == null ? void 0 : e.percentageEstimateOfBook) === void 0 ? null : /* @__PURE__ */ n(z, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ c(p, { fontSize: "sm", children: [
367
412
  o,
368
413
  " %"
369
414
  ] }) });
370
- }, yn = () => {
371
- const [e, t] = P(/* @__PURE__ */ new Date());
372
- return X(() => {
415
+ }, Rn = () => {
416
+ const [e, t] = S(/* @__PURE__ */ new Date());
417
+ return K(() => {
373
418
  const o = setInterval(() => {
374
419
  t(/* @__PURE__ */ new Date());
375
420
  }, 6e4);
376
421
  return () => clearInterval(o);
377
422
  }, []), e;
378
- }, Tn = (e) => {
379
- const t = yn();
423
+ }, On = (e) => {
424
+ const t = Rn();
380
425
  return /* @__PURE__ */ n(p, { fontSize: "xs", ...e, children: t.toLocaleTimeString(navigator.language, {
381
426
  hour: "2-digit",
382
427
  minute: "2-digit"
383
428
  }) });
384
- }, ce = () => {
385
- const { quickMenuSignal: e } = me(se);
386
- return [Re(e), e.setValue, e];
387
- }, wn = () => {
388
- const [e] = ce();
429
+ }, he = () => {
430
+ const { quickMenuSignal: e } = fe(ce);
431
+ return [Oe(e), e.setValue, e];
432
+ }, Dn = () => {
433
+ const [e] = he();
389
434
  return /* @__PURE__ */ n(
390
- O,
435
+ z,
391
436
  {
392
437
  position: "absolute",
393
438
  left: 0,
394
439
  bottom: 0,
395
440
  p: 2,
396
441
  color: e ? void 0 : "colorPalette.contrast",
397
- children: /* @__PURE__ */ n(Tn, {})
442
+ children: /* @__PURE__ */ n(On, {})
398
443
  }
399
444
  );
400
- }, Pn = () => {
401
- const e = S();
402
- M(
445
+ }, zn = () => {
446
+ const e = v();
447
+ L(
403
448
  () => e == null ? void 0 : e.links$.subscribe((t) => {
404
- if (t.type === "click" && nn(t.target, "a")) {
449
+ if (t.type === "click" && on(t.target, "a")) {
405
450
  if (!t.target.href) return;
406
451
  const o = new URL(t.target.href);
407
452
  window.location.host !== o.host && confirm(
@@ -411,22 +456,22 @@ const Q = k.ActionTrigger, S = () => {
411
456
  }),
412
457
  [e]
413
458
  );
414
- }, W = fe({
459
+ }, X = be({
415
460
  default: void 0
416
- }), Rn = () => {
417
- const e = S();
418
- M(
461
+ }), En = () => {
462
+ const e = v();
463
+ L(
419
464
  () => e == null ? void 0 : e.zoom.isZooming$.pipe(
420
- oe((t) => {
421
- if (!t) return ze;
465
+ ie((t) => {
466
+ if (!t) return Ee;
422
467
  const o = new Ae();
423
- return W.setValue({
468
+ return X.setValue({
424
469
  key: "zoom",
425
470
  title: "Zooming",
426
471
  duration: 999999,
427
472
  abort: o
428
- }), re.pipe(
429
- Ce(() => {
473
+ }), le.pipe(
474
+ ve(() => {
430
475
  o.next(), o.complete();
431
476
  })
432
477
  );
@@ -434,15 +479,15 @@ const Q = k.ActionTrigger, S = () => {
434
479
  ),
435
480
  [e]
436
481
  );
437
- }, On = () => {
438
- const e = S();
439
- M(
482
+ }, An = () => {
483
+ const e = v();
484
+ L(
440
485
  () => e == null ? void 0 : e.settings.values$.pipe(
441
- ie(({ fontScale: t }) => t),
486
+ se(({ fontScale: t }) => t),
442
487
  $e(),
443
- ve(1),
444
- xe((t) => {
445
- W.setValue({
488
+ ne(1),
489
+ Ce((t) => {
490
+ X.setValue({
446
491
  key: "fontScaleChange",
447
492
  title: "Font size changed",
448
493
  description: `${t * 100} %`
@@ -451,51 +496,53 @@ const Q = k.ActionTrigger, S = () => {
451
496
  ),
452
497
  [e]
453
498
  );
454
- }, Dn = () => {
455
- On(), Rn(), M(
456
- () => W.subject.pipe(
457
- ue(Oe),
458
- Ee((e) => {
459
- const t = e.duration ?? 3e3, o = te.create({
499
+ }, Mn = () => {
500
+ An(), En(), L(
501
+ () => X.subject.pipe(
502
+ // @todo implement Signal / BehaviorSignal / ReplaySignal
503
+ ne(1),
504
+ ge(De),
505
+ Me((e) => {
506
+ const t = e.duration ?? 3e3, o = re.create({
460
507
  title: e.title,
461
508
  description: e.description,
462
509
  duration: t
463
- }), r = W.subject.pipe(
464
- ve(1),
465
- ue((i) => !!e.key && (i == null ? void 0 : i.key) === e.key)
510
+ }), r = X.subject.pipe(
511
+ ne(1),
512
+ ge((l) => !!e.key && (l == null ? void 0 : l.key) === e.key)
466
513
  );
467
- return Me(
514
+ return _e(
468
515
  Be(t),
469
- e.abort ?? re,
516
+ e.abort ?? le,
470
517
  r
471
518
  ).pipe(
472
- _e(),
473
- Ce(() => {
474
- te.dismiss(o);
519
+ Le(),
520
+ ve(() => {
521
+ re.dismiss(o);
475
522
  })
476
523
  );
477
524
  })
478
525
  )
479
526
  );
480
- }, zn = z.forwardRef(
527
+ }, _n = A.forwardRef(
481
528
  function(t, o) {
482
529
  const {
483
530
  showArrow: r,
484
- children: i,
485
- portalled: l = !0,
486
- content: c,
487
- portalRef: h,
531
+ children: l,
532
+ portalled: i = !0,
533
+ content: s,
534
+ portalRef: d,
488
535
  ...u
489
536
  } = t;
490
- return /* @__PURE__ */ a(
491
- E.Root,
537
+ return /* @__PURE__ */ c(
538
+ B.Root,
492
539
  {
493
540
  ...u,
494
541
  positioning: { ...u.positioning, gutter: 4 },
495
542
  children: [
496
- /* @__PURE__ */ n(E.Trigger, { asChild: !0, children: i }),
497
- /* @__PURE__ */ n(le, { disabled: !l, container: h, children: /* @__PURE__ */ n(E.Positioner, { children: /* @__PURE__ */ a(
498
- E.Content,
543
+ /* @__PURE__ */ n(B.Trigger, { asChild: !0, children: l }),
544
+ /* @__PURE__ */ n(ae, { disabled: !i, container: d, children: /* @__PURE__ */ n(B.Positioner, { children: /* @__PURE__ */ c(
545
+ B.Content,
499
546
  {
500
547
  width: "auto",
501
548
  px: "2",
@@ -504,8 +551,8 @@ const Q = k.ActionTrigger, S = () => {
504
551
  rounded: "sm",
505
552
  ref: o,
506
553
  children: [
507
- r && /* @__PURE__ */ n(E.Arrow, { children: /* @__PURE__ */ n(E.ArrowTip, {}) }),
508
- c
554
+ r && /* @__PURE__ */ n(B.Arrow, { children: /* @__PURE__ */ n(B.ArrowTip, {}) }),
555
+ s
509
556
  ]
510
557
  }
511
558
  ) }) })
@@ -513,63 +560,63 @@ const Q = k.ActionTrigger, S = () => {
513
560
  }
514
561
  );
515
562
  }
516
- ), An = z.forwardRef(function(t, o) {
517
- const { children: r, ...i } = t;
518
- return /* @__PURE__ */ n(zn, { content: r, ...i, ref: o, children: /* @__PURE__ */ n(
563
+ ), Bn = A.forwardRef(function(t, o) {
564
+ const { children: r, ...l } = t;
565
+ return /* @__PURE__ */ n(_n, { content: r, ...l, ref: o, children: /* @__PURE__ */ n(
519
566
  f,
520
567
  {
521
568
  variant: "ghost",
522
569
  "aria-label": "info",
523
570
  size: "2xs",
524
571
  colorPalette: "gray",
525
- children: /* @__PURE__ */ n(sn, {})
572
+ children: /* @__PURE__ */ n(dn, {})
526
573
  }
527
574
  ) });
528
- }), En = z.forwardRef(function(t, o) {
529
- return /* @__PURE__ */ n(N.Track, { ...t, ref: o, children: /* @__PURE__ */ n(N.Range, {}) });
575
+ }), Ln = A.forwardRef(function(t, o) {
576
+ return /* @__PURE__ */ n(Q.Track, { ...t, ref: o, children: /* @__PURE__ */ n(Q.Range, {}) });
530
577
  });
531
- z.forwardRef(function(t, o) {
532
- const { children: r, info: i, ...l } = t;
533
- return /* @__PURE__ */ a(N.Label, { ...l, ref: o, children: [
578
+ A.forwardRef(function(t, o) {
579
+ const { children: r, info: l, ...i } = t;
580
+ return /* @__PURE__ */ c(Q.Label, { ...i, ref: o, children: [
534
581
  r,
535
- i && /* @__PURE__ */ n(An, { children: i })
582
+ l && /* @__PURE__ */ n(Bn, { children: l })
536
583
  ] });
537
584
  });
538
- const Mn = N.Root, Bn = N.ValueText, de = () => {
539
- const e = _(), t = (e == null ? void 0 : e.numberOfTotalPages) === 1, o = ((e == null ? void 0 : e.beginNumberOfPagesInSpineItem) ?? 0) > 1, r = ((e == null ? void 0 : e.endNumberOfPagesInSpineItem) ?? 0) > 1, i = (e != null && e.hasChapters ? e == null ? void 0 : e.beginPageIndexInSpineItem : e == null ? void 0 : e.beginAbsolutePageIndex) ?? 0, l = (e != null && e.hasChapters ? e == null ? void 0 : e.endPageIndexInSpineItem : e == null ? void 0 : e.endAbsolutePageIndex) ?? 0, [c = 0, h = 0] = [
540
- i,
541
- l
542
- ].sort((g, d) => g - d), u = (e == null ? void 0 : e.beginPageIndexInSpineItem) !== (e == null ? void 0 : e.endPageIndexInSpineItem) || (e == null ? void 0 : e.beginSpineItemIndex) !== (e == null ? void 0 : e.endSpineItemIndex), s = e != null && e.hasChapters ? e == null ? void 0 : e.beginNumberOfPagesInSpineItem : e == null ? void 0 : e.numberOfTotalPages;
585
+ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
586
+ const e = U(), t = (e == null ? void 0 : e.numberOfTotalPages) === 1, o = ((e == null ? void 0 : e.beginNumberOfPagesInSpineItem) ?? 0) > 1, r = ((e == null ? void 0 : e.endNumberOfPagesInSpineItem) ?? 0) > 1, l = (e != null && e.hasChapters ? e == null ? void 0 : e.beginPageIndexInSpineItem : e == null ? void 0 : e.beginAbsolutePageIndex) ?? 0, i = (e != null && e.hasChapters ? e == null ? void 0 : e.endPageIndexInSpineItem : e == null ? void 0 : e.endAbsolutePageIndex) ?? 0, [s = 0, d = 0] = [
587
+ l,
588
+ i
589
+ ].sort((g, h) => g - h), u = (e == null ? void 0 : e.beginPageIndexInSpineItem) !== (e == null ? void 0 : e.endPageIndexInSpineItem) || (e == null ? void 0 : e.beginSpineItemIndex) !== (e == null ? void 0 : e.endSpineItemIndex), a = e != null && e.hasChapters ? e == null ? void 0 : e.beginNumberOfPagesInSpineItem : e == null ? void 0 : e.numberOfTotalPages;
543
590
  return {
544
591
  hasOnlyOnePage: t,
545
- beginPageIndex: i,
546
- endPageIndex: l,
592
+ beginPageIndex: l,
593
+ endPageIndex: i,
547
594
  isBeginWithinChapter: o,
548
595
  isEndWithinChapter: r,
549
596
  beginAndEndAreDifferent: u,
550
- totalApproximatePages: s,
551
- leftPageIndex: c,
552
- rightPageIndex: h
597
+ totalApproximatePages: a,
598
+ leftPageIndex: s,
599
+ rightPageIndex: d
553
600
  };
554
- }, _n = () => {
555
- const e = _(), {
601
+ }, Fn = () => {
602
+ const e = U(), {
556
603
  hasOnlyOnePage: t,
557
604
  leftPageIndex: o,
558
605
  rightPageIndex: r,
559
- totalApproximatePages: i,
560
- beginAndEndAreDifferent: l
561
- } = de(), c = Math.round(((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100), h = (s) => s != null && s.subChapter ? `${s.title} / ${h(s.subChapter)}` : (s == null ? void 0 : s.title) || "", u = h(e == null ? void 0 : e.beginChapterInfo);
562
- return /* @__PURE__ */ a(y, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
563
- /* @__PURE__ */ n(Mn, { value: c, size: "xs", width: 150, children: /* @__PURE__ */ a(D, { justifyContent: "space-between", children: [
564
- /* @__PURE__ */ n(En, { width: 110 }),
565
- /* @__PURE__ */ n(Bn, { children: `${c}%` })
606
+ totalApproximatePages: l,
607
+ beginAndEndAreDifferent: i
608
+ } = ue(), s = Math.round(((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100), d = (a) => a != null && a.subChapter ? `${a.title} / ${d(a.subChapter)}` : (a == null ? void 0 : a.title) || "", u = d(e == null ? void 0 : e.beginChapterInfo);
609
+ return /* @__PURE__ */ c(P, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
610
+ /* @__PURE__ */ n($n, { value: s, size: "xs", width: 150, children: /* @__PURE__ */ c(E, { justifyContent: "space-between", children: [
611
+ /* @__PURE__ */ n(Ln, { width: 110 }),
612
+ /* @__PURE__ */ n(Nn, { children: `${s}%` })
566
613
  ] }) }),
567
614
  /* @__PURE__ */ n(p, { truncate: !0, maxWidth: "100%", fontSize: "sm", mt: 1, children: u ? `Chapter: ${u}` : " " }),
568
- !t && /* @__PURE__ */ a(D, { children: [
569
- /* @__PURE__ */ n(p, { fontSize: "xs", children: l ? `${o + 1} - ${r + 1} of ${i}` : `${o + 1} of ${i}` }),
570
- !!(e != null && e.hasChapters) && /* @__PURE__ */ a(K, { children: [
615
+ !t && /* @__PURE__ */ c(E, { children: [
616
+ /* @__PURE__ */ n(p, { fontSize: "xs", children: i ? `${o + 1} - ${r + 1} of ${l}` : `${o + 1} of ${l}` }),
617
+ !!(e != null && e.hasChapters) && /* @__PURE__ */ c(Z, { children: [
571
618
  /* @__PURE__ */ n(p, { children: "-" }),
572
- /* @__PURE__ */ a(p, { fontSize: "xs", children: [
619
+ /* @__PURE__ */ c(p, { fontSize: "xs", children: [
573
620
  "(",
574
621
  ((e == null ? void 0 : e.beginAbsolutePageIndex) ?? 0) + 1,
575
622
  ")"
@@ -583,7 +630,7 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
583
630
  position: t,
584
631
  ...o
585
632
  }) => /* @__PURE__ */ n(
586
- G,
633
+ W,
587
634
  {
588
635
  display: "flex",
589
636
  flexDirection: "row",
@@ -607,8 +654,8 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
607
654
  children: e
608
655
  }
609
656
  )
610
- ), $n = je(an), Ln = m((e) => /* @__PURE__ */ n(
611
- O,
657
+ ), Hn = Ve(hn), jn = m((e) => /* @__PURE__ */ n(
658
+ z,
612
659
  {
613
660
  display: "contents",
614
661
  css: {
@@ -617,7 +664,7 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
617
664
  "--color-solid": "colors.colorPalette.solid"
618
665
  },
619
666
  children: /* @__PURE__ */ n(
620
- $n,
667
+ Hn,
621
668
  {
622
669
  keyboard: !1,
623
670
  style: {
@@ -661,205 +708,240 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
661
708
  }
662
709
  )
663
710
  }
664
- )), Nn = () => {
665
- const e = _(), t = e == null ? void 0 : e.isUsingSpread, { beginPageIndex: o, totalApproximatePages: r = 0 } = de(), i = t ? Math.floor((o || 0) / 2) : o, [l, c] = be({
666
- default: i || 0
667
- }), h = 0, u = Math.max(
711
+ )), Vn = () => {
712
+ const e = U(), t = e == null ? void 0 : e.isUsingSpread, { beginPageIndex: o, totalApproximatePages: r = 0 } = ue(), l = t ? Math.floor((o || 0) / 2) : o, [i, s] = xe({
713
+ default: l || 0
714
+ }), d = 0, u = Math.max(
668
715
  0,
669
716
  t ? Math.floor((r - 1) / 2) : r - 1
670
717
  );
671
- return X(() => {
672
- c.setValue(i || 0);
673
- }, [i, c]), {
674
- value: l,
675
- valueSignal: c,
676
- min: h,
718
+ return K(() => {
719
+ s.setValue(l || 0);
720
+ }, [l, s]), {
721
+ value: i,
722
+ valueSignal: s,
723
+ min: d,
677
724
  max: u
678
725
  };
679
- }, Fn = (e) => {
680
- const t = S(), o = _(), { manifest: r } = b(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, i = (r == null ? void 0 : r.readingDirection) === "rtl", l = o == null ? void 0 : o.isUsingSpread, { totalApproximatePages: c = 0, isBeginWithinChapter: h } = de(), u = 1, s = h, { value: g, valueSignal: d, min: x, max: C } = Nn(), w = L(
726
+ }, Gn = (e) => {
727
+ const t = v(), o = U(), { manifest: r } = b(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, l = (r == null ? void 0 : r.readingDirection) === "rtl", i = o == null ? void 0 : o.isUsingSpread, { totalApproximatePages: s = 0, isBeginWithinChapter: d } = ue(), u = 1, a = d, { value: g, valueSignal: h, min: x, max: k } = Vn(), w = q(
681
728
  (R) => {
682
- const [v = 0] = Array.isArray(R) ? R : [R];
683
- d.setValue(v);
684
- const $ = l ? Math.floor(v) * 2 : Math.floor(v);
685
- s ? t == null || t.navigation.goToPageOfSpineItem({
686
- pageIndex: $,
729
+ const [y = 0] = Array.isArray(R) ? R : [R];
730
+ h.setValue(y);
731
+ const D = i ? Math.floor(y) * 2 : Math.floor(y);
732
+ a ? t == null || t.navigation.goToPageOfSpineItem({
733
+ pageIndex: D,
687
734
  spineItemId: t.pagination.getState().beginSpineItemIndex ?? 0,
688
735
  animation: !1
689
736
  }) : t == null || t.navigation.goToAbsolutePageIndex({
690
- absolutePageIndex: $,
737
+ absolutePageIndex: D,
691
738
  animation: !1
692
739
  });
693
740
  },
694
- [t, l, d, s]
741
+ [t, i, h, a]
695
742
  );
696
- return M(
743
+ return L(
697
744
  () => t == null ? void 0 : t.navigation.throttleLock({
698
745
  duration: 100,
699
- trigger: d.subject
746
+ trigger: h.subject
700
747
  }),
701
- [t, d]
702
- ), c === 1 || l && c === 2 ? /* @__PURE__ */ n(O, { style: e.style }) : /* @__PURE__ */ n(
703
- Ln,
748
+ [t, h]
749
+ ), s === 1 || i && s === 2 ? /* @__PURE__ */ n(z, { style: e.style }) : /* @__PURE__ */ n(
750
+ jn,
704
751
  {
705
752
  value: [g],
706
- max: C,
753
+ max: k,
707
754
  min: x,
708
- reverse: i,
755
+ reverse: l,
709
756
  step: u,
710
757
  onChange: w,
711
758
  ...e
712
759
  }
713
760
  );
714
- }, Hn = m(
761
+ }, Yn = m(
715
762
  ({
716
763
  open: e,
717
764
  onItemClick: t
718
765
  }) => {
719
- const o = S(), r = b(() => o == null ? void 0 : o.navigation.state$, [o]), i = b(() => o == null ? void 0 : o.settings.values$, [o]), l = (i == null ? void 0 : i.computedPageTurnDirection) === "vertical", [c, h] = P(!0);
720
- return /* @__PURE__ */ n(Ie, { present: e, position: "bottom", children: /* @__PURE__ */ a(y, { flex: 1, overflow: "auto", children: [
721
- /* @__PURE__ */ a(D, { flex: 1, alignItems: "center", justifyContent: "center", children: [
722
- /* @__PURE__ */ n(
723
- f,
724
- {
725
- "aria-label": "left",
726
- size: "lg",
727
- variant: "ghost",
728
- flexShrink: 0,
729
- onClick: () => o == null ? void 0 : o.navigation.goToLeftOrTopSpineItem(),
730
- disabled: !(r != null && r.canGoLeftSpineItem) && !(r != null && r.canGoTopSpineItem),
731
- children: l ? /* @__PURE__ */ n(tn, {}) : /* @__PURE__ */ n(on, {})
732
- }
733
- ),
734
- /* @__PURE__ */ a(
735
- y,
736
- {
737
- flex: 1,
738
- maxW: 400,
739
- gap: 2,
740
- alignItems: "center",
741
- overflow: "auto",
742
- px: 4,
743
- children: [
744
- /* @__PURE__ */ n(_n, {}),
745
- /* @__PURE__ */ n(
746
- Fn,
747
- {
748
- style: {
749
- width: "100%",
750
- maxWidth: "300px",
751
- height: "35px"
752
- }
753
- }
754
- )
755
- ]
756
- }
757
- ),
758
- /* @__PURE__ */ n(
759
- f,
760
- {
761
- "aria-label": "right",
762
- size: "lg",
763
- flexShrink: 0,
764
- variant: "ghost",
765
- disabled: !(r != null && r.canGoRightSpineItem) && !(r != null && r.canGoBottomSpineItem),
766
- onClick: () => {
767
- o == null || o.navigation.goToRightOrBottomSpineItem();
768
- },
769
- children: l ? /* @__PURE__ */ n(rn, {}) : /* @__PURE__ */ n(ln, {})
770
- }
771
- )
772
- ] }),
773
- /* @__PURE__ */ n(D, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ a(
774
- J.Root,
775
- {
776
- open: c,
777
- flex: 1,
778
- onOpenChange: ({ open: u }) => {
779
- h(u);
780
- },
781
- children: [
766
+ const o = v(), r = b(() => o == null ? void 0 : o.navigation.state$, [o]), l = b(() => o == null ? void 0 : o.settings.values$, [o]), i = (l == null ? void 0 : l.computedPageTurnDirection) === "vertical", [s, d] = S(!0);
767
+ return /* @__PURE__ */ c(
768
+ Ie,
769
+ {
770
+ present: e,
771
+ position: "bottom",
772
+ display: "flex",
773
+ flexDirection: "column",
774
+ overflow: "auto",
775
+ pb: 8,
776
+ children: [
777
+ /* @__PURE__ */ c(E, { flex: 1, alignItems: "center", justifyContent: "center", children: [
782
778
  /* @__PURE__ */ n(
783
- J.Trigger,
779
+ f,
784
780
  {
785
- paddingY: "3",
786
- width: "100%",
787
- display: "flex",
788
- justifyContent: "center",
789
- children: /* @__PURE__ */ n(
790
- Qe,
791
- {
792
- style: {
793
- transform: c ? "rotate(0deg)" : "rotate(180deg)"
781
+ "aria-label": "left",
782
+ size: "lg",
783
+ variant: "ghost",
784
+ flexShrink: 0,
785
+ onClick: () => o == null ? void 0 : o.navigation.goToLeftOrTopSpineItem(),
786
+ disabled: !(r != null && r.canGoLeftSpineItem) && !(r != null && r.canGoTopSpineItem),
787
+ children: i ? /* @__PURE__ */ n(ln, {}) : /* @__PURE__ */ n(sn, {})
788
+ }
789
+ ),
790
+ /* @__PURE__ */ c(
791
+ P,
792
+ {
793
+ flex: 1,
794
+ maxW: 400,
795
+ gap: 2,
796
+ alignItems: "center",
797
+ overflow: "auto",
798
+ px: 4,
799
+ children: [
800
+ /* @__PURE__ */ n(Fn, {}),
801
+ /* @__PURE__ */ n(
802
+ Gn,
803
+ {
804
+ style: {
805
+ width: "100%",
806
+ maxWidth: "300px",
807
+ height: "35px"
808
+ }
794
809
  }
795
- }
796
- )
810
+ )
811
+ ]
797
812
  }
798
813
  ),
799
- /* @__PURE__ */ a(J.Content, { display: "flex", justifyContent: "center", children: [
800
- /* @__PURE__ */ n(
801
- f,
802
- {
803
- "aria-label": "Help",
804
- size: "lg",
805
- variant: "ghost",
806
- onClick: () => t("help"),
807
- children: /* @__PURE__ */ n(Ge, {})
808
- }
809
- ),
810
- /* @__PURE__ */ n(
811
- f,
812
- {
813
- "aria-label": "Table of contents",
814
- size: "lg",
815
- variant: "ghost",
816
- onClick: () => t("toc"),
817
- children: /* @__PURE__ */ n(We, {})
818
- }
819
- ),
820
- ke(o) && /* @__PURE__ */ n(
821
- f,
822
- {
823
- "aria-label": "Search",
824
- size: "lg",
825
- variant: "ghost",
826
- onClick: () => t("search"),
827
- children: /* @__PURE__ */ n(Ke, {})
828
- }
829
- ),
830
- ae(o) && /* @__PURE__ */ n(
831
- f,
832
- {
833
- "aria-label": "Search",
834
- size: "lg",
835
- variant: "ghost",
836
- onClick: () => t("bookmarks"),
837
- children: /* @__PURE__ */ n(en, {})
838
- }
839
- ),
840
- Se(o) && /* @__PURE__ */ n(
841
- f,
842
- {
843
- "aria-label": "Search",
844
- size: "lg",
845
- variant: "ghost",
846
- onClick: () => t("annotations"),
847
- children: /* @__PURE__ */ n(ne, {})
848
- }
849
- )
850
- ] })
851
- ]
852
- }
853
- ) })
854
- ] }) });
814
+ /* @__PURE__ */ n(
815
+ f,
816
+ {
817
+ "aria-label": "right",
818
+ size: "lg",
819
+ flexShrink: 0,
820
+ variant: "ghost",
821
+ disabled: !(r != null && r.canGoRightSpineItem) && !(r != null && r.canGoBottomSpineItem),
822
+ onClick: () => {
823
+ o == null || o.navigation.goToRightOrBottomSpineItem();
824
+ },
825
+ children: i ? /* @__PURE__ */ n(an, {}) : /* @__PURE__ */ n(cn, {})
826
+ }
827
+ )
828
+ ] }),
829
+ /* @__PURE__ */ n(E, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ c(
830
+ ee.Root,
831
+ {
832
+ open: s,
833
+ flex: 1,
834
+ onOpenChange: ({ open: u }) => {
835
+ d(u);
836
+ },
837
+ children: [
838
+ /* @__PURE__ */ n(
839
+ ee.Trigger,
840
+ {
841
+ paddingY: "3",
842
+ width: "100%",
843
+ display: "flex",
844
+ justifyContent: "center",
845
+ children: /* @__PURE__ */ n(
846
+ Qe,
847
+ {
848
+ style: {
849
+ transform: s ? "rotate(0deg)" : "rotate(180deg)"
850
+ }
851
+ }
852
+ )
853
+ }
854
+ ),
855
+ /* @__PURE__ */ c(ee.Content, { display: "flex", justifyContent: "center", children: [
856
+ /* @__PURE__ */ n(
857
+ f,
858
+ {
859
+ "aria-label": "Help",
860
+ size: "lg",
861
+ variant: "ghost",
862
+ onClick: () => t("help"),
863
+ children: /* @__PURE__ */ n(Ke, {})
864
+ }
865
+ ),
866
+ /* @__PURE__ */ n(
867
+ f,
868
+ {
869
+ "aria-label": "Table of contents",
870
+ size: "lg",
871
+ variant: "ghost",
872
+ onClick: () => t("toc"),
873
+ children: /* @__PURE__ */ n(We, {})
874
+ }
875
+ ),
876
+ ke(o) && /* @__PURE__ */ n(
877
+ f,
878
+ {
879
+ "aria-label": "Search",
880
+ size: "lg",
881
+ variant: "ghost",
882
+ onClick: () => t("search"),
883
+ children: /* @__PURE__ */ n(Xe, {})
884
+ }
885
+ ),
886
+ de(o) && /* @__PURE__ */ n(
887
+ f,
888
+ {
889
+ "aria-label": "Search",
890
+ size: "lg",
891
+ variant: "ghost",
892
+ onClick: () => t("bookmarks"),
893
+ children: /* @__PURE__ */ n(tn, {})
894
+ }
895
+ ),
896
+ ye(o) && /* @__PURE__ */ n(
897
+ f,
898
+ {
899
+ "aria-label": "Search",
900
+ size: "lg",
901
+ variant: "ghost",
902
+ onClick: () => t("annotations"),
903
+ children: /* @__PURE__ */ n(oe, {})
904
+ }
905
+ ),
906
+ /* @__PURE__ */ n(
907
+ f,
908
+ {
909
+ "aria-label": "Thumbnails",
910
+ size: "lg",
911
+ variant: (o == null ? void 0 : o.settings.values.viewportMode) === "thumbnails" ? "solid" : "ghost",
912
+ onClick: () => {
913
+ o == null || o.settings.update({
914
+ viewportMode: (o == null ? void 0 : o.settings.values.viewportMode) === "normal" ? "thumbnails" : "normal"
915
+ });
916
+ },
917
+ children: /* @__PURE__ */ n(Ze, {})
918
+ }
919
+ ),
920
+ Se(o) && /* @__PURE__ */ n(
921
+ f,
922
+ {
923
+ "aria-label": "Gallery",
924
+ size: "lg",
925
+ variant: "ghost",
926
+ onClick: () => t("gallery"),
927
+ children: /* @__PURE__ */ n(rn, {})
928
+ }
929
+ )
930
+ ] })
931
+ ]
932
+ }
933
+ ) })
934
+ ]
935
+ }
936
+ );
855
937
  }
856
- ), jn = () => {
857
- const [e, t] = P(!1), o = L(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
938
+ ), Un = () => {
939
+ const [e, t] = S(!1), o = q(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
858
940
  t(!1);
859
941
  }) : document.documentElement.requestFullscreen({ navigationUI: "hide" }).catch(console.error).then(() => {
860
942
  t(!0);
861
943
  }), []);
862
- return X(() => {
944
+ return K(() => {
863
945
  function r() {
864
946
  t(!!document.fullscreenElement);
865
947
  }
@@ -870,13 +952,13 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
870
952
  isFullscreen: e,
871
953
  onToggleFullscreenClick: o
872
954
  };
873
- }, Vn = m(
955
+ }, qn = m(
874
956
  ({
875
957
  open: e,
876
958
  onItemClick: t
877
959
  }) => {
878
- const o = S(), r = b(() => o == null ? void 0 : o.context.manifest$, [o]), { isFullscreen: i, onToggleFullscreenClick: l } = jn();
879
- return /* @__PURE__ */ a(
960
+ const o = v(), r = b(() => o == null ? void 0 : o.context.manifest$, [o]), { isFullscreen: l, onToggleFullscreenClick: i } = Un();
961
+ return /* @__PURE__ */ c(
880
962
  Ie,
881
963
  {
882
964
  present: e,
@@ -892,11 +974,11 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
892
974
  variant: "ghost",
893
975
  flexShrink: 0,
894
976
  onClick: () => t("back"),
895
- children: /* @__PURE__ */ n(cn, {})
977
+ children: /* @__PURE__ */ n(un, {})
896
978
  }
897
979
  ),
898
980
  /* @__PURE__ */ n(
899
- y,
981
+ P,
900
982
  {
901
983
  flex: 1,
902
984
  maxW: 600,
@@ -907,7 +989,7 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
907
989
  children: /* @__PURE__ */ n(p, { truncate: !0, maxWidth: "100%", children: r == null ? void 0 : r.title })
908
990
  }
909
991
  ),
910
- /* @__PURE__ */ a(D, { children: [
992
+ /* @__PURE__ */ c(E, { children: [
911
993
  /* @__PURE__ */ n(
912
994
  f,
913
995
  {
@@ -916,7 +998,7 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
916
998
  flexShrink: 0,
917
999
  variant: "ghost",
918
1000
  onClick: () => t("more"),
919
- children: /* @__PURE__ */ n(dn, {})
1001
+ children: /* @__PURE__ */ n(gn, {})
920
1002
  }
921
1003
  ),
922
1004
  /* @__PURE__ */ n(
@@ -926,8 +1008,8 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
926
1008
  size: "lg",
927
1009
  flexShrink: 0,
928
1010
  variant: "ghost",
929
- onClick: l,
930
- children: i ? /* @__PURE__ */ n(hn, {}) : /* @__PURE__ */ n(un, {})
1011
+ onClick: i,
1012
+ children: l ? /* @__PURE__ */ n(pn, {}) : /* @__PURE__ */ n(mn, {})
931
1013
  }
932
1014
  )
933
1015
  ] })
@@ -935,26 +1017,26 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
935
1017
  }
936
1018
  );
937
1019
  }
938
- ), Yn = m(
1020
+ ), Qn = m(
939
1021
  ({
940
1022
  onItemClick: e
941
1023
  }) => {
942
- const [t] = ce();
943
- return /* @__PURE__ */ a(K, { children: [
944
- /* @__PURE__ */ n(Vn, { open: t, onItemClick: e }),
945
- /* @__PURE__ */ n(Hn, { open: t, onItemClick: e })
1024
+ const [t] = he();
1025
+ return /* @__PURE__ */ c(Z, { children: [
1026
+ /* @__PURE__ */ n(qn, { open: t, onItemClick: e }),
1027
+ /* @__PURE__ */ n(Yn, { open: t, onItemClick: e })
946
1028
  ] });
947
1029
  }
948
- ), Un = m(
1030
+ ), Kn = m(
949
1031
  ({
950
1032
  contextText: e = "",
951
1033
  startOffset: t = 0,
952
1034
  text: o,
953
1035
  cfi: r = "#",
954
- onClick: i,
955
- absolutePageIndex: l
1036
+ onClick: l,
1037
+ absolutePageIndex: i
956
1038
  }) => {
957
- const h = e.substring(
1039
+ const d = e.substring(
958
1040
  Math.max(t - 15, 0),
959
1041
  Math.max(t, 0)
960
1042
  ), u = e.substring(
@@ -964,64 +1046,64 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
964
1046
  e.length - 1
965
1047
  )
966
1048
  );
967
- return /* @__PURE__ */ a(
968
- Z,
1049
+ return /* @__PURE__ */ c(
1050
+ J,
969
1051
  {
970
1052
  href: r,
971
1053
  style: { margin: 5, overflow: "hidden" },
972
- onClick: (s) => {
973
- s.preventDefault(), i(r);
1054
+ onClick: (a) => {
1055
+ a.preventDefault(), l(r);
974
1056
  },
975
1057
  display: "flex",
976
1058
  flexDirection: "column",
977
1059
  alignItems: "flex-start",
978
1060
  gap: 0,
979
1061
  children: [
980
- /* @__PURE__ */ a(p, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
1062
+ /* @__PURE__ */ c(p, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
981
1063
  '"',
982
- h,
1064
+ d,
983
1065
  /* @__PURE__ */ n("b", { children: o }),
984
1066
  u,
985
1067
  '"'
986
1068
  ] }),
987
- /* @__PURE__ */ n(p, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${l !== void 0 ? l + 1 : "unknown (not loaded)"}` })
1069
+ /* @__PURE__ */ n(p, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${i !== void 0 ? i + 1 : "unknown (not loaded)"}` })
988
1070
  ]
989
1071
  }
990
1072
  );
991
1073
  }
992
- ), qn = m(
1074
+ ), Wn = m(
993
1075
  ({
994
1076
  onNavigate: e
995
1077
  }) => {
996
- const [t, o] = P(""), r = S(), i = ke(r) ? r : void 0, l = (d) => {
997
- o(d.target.value);
998
- }, c = L(
999
- (d) => {
1000
- e(), r == null || r.navigation.goToCfi(d);
1078
+ const [t, o] = S(""), r = v(), l = ke(r) ? r : void 0, i = (h) => {
1079
+ o(h.target.value);
1080
+ }, s = q(
1081
+ (h) => {
1082
+ e(), r == null || r.navigation.goToCfi(h);
1001
1083
  },
1002
1084
  [r, e]
1003
- ), h = b(
1004
- () => i == null ? void 0 : i.search.search(t).pipe(
1005
- ie((d) => ({ type: "end", data: d })),
1006
- Le({ type: "start" })
1085
+ ), d = b(
1086
+ () => l == null ? void 0 : l.search.search(t).pipe(
1087
+ se((h) => ({ type: "end", data: h })),
1088
+ Ne({ type: "start" })
1007
1089
  ),
1008
1090
  [r, t]
1009
- ), u = (h == null ? void 0 : h.type) === "start", s = (h == null ? void 0 : h.type) === "end" ? h.data : [], g = b(
1010
- () => r == null ? void 0 : r.pagination.locate(s.slice(0, 100)),
1011
- [s]
1091
+ ), u = (d == null ? void 0 : d.type) === "start", a = (d == null ? void 0 : d.type) === "end" ? d.data : [], g = b(
1092
+ () => r == null ? void 0 : r.pagination.locate(a.slice(0, 100)),
1093
+ [a]
1012
1094
  );
1013
- return /* @__PURE__ */ a(y, { flex: 1, height: "100%", children: [
1014
- /* @__PURE__ */ n(O, { px: 4, children: /* @__PURE__ */ n(
1015
- Ve,
1095
+ return /* @__PURE__ */ c(P, { flex: 1, height: "100%", children: [
1096
+ /* @__PURE__ */ n(z, { px: 4, children: /* @__PURE__ */ n(
1097
+ Ge,
1016
1098
  {
1017
1099
  placeholder: "Type something...",
1018
1100
  value: t,
1019
- onChange: l,
1101
+ onChange: i,
1020
1102
  borderRadius: 0
1021
1103
  }
1022
1104
  ) }),
1023
- /* @__PURE__ */ a(
1024
- O,
1105
+ /* @__PURE__ */ c(
1106
+ z,
1025
1107
  {
1026
1108
  px: 4,
1027
1109
  pb: 4,
@@ -1030,24 +1112,24 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
1030
1112
  style: { overflow: "hidden", overflowY: "auto" },
1031
1113
  children: [
1032
1114
  u && /* @__PURE__ */ n(p, { children: "Searching ..." }),
1033
- !u && s.length === 0 && /* @__PURE__ */ n("p", { children: "There are no results" }),
1034
- !u && s.length >= 0 && /* @__PURE__ */ a(y, { children: [
1035
- /* @__PURE__ */ a(ee, { as: "h2", size: "md", children: [
1036
- s.length,
1115
+ !u && a.length === 0 && /* @__PURE__ */ n("p", { children: "There are no results" }),
1116
+ !u && a.length >= 0 && /* @__PURE__ */ c(P, { children: [
1117
+ /* @__PURE__ */ c(te, { as: "h2", size: "md", children: [
1118
+ a.length,
1037
1119
  " result(s)"
1038
1120
  ] }),
1039
- /* @__PURE__ */ n(y, { gap: 0, children: g == null ? void 0 : g.map((d, x) => {
1040
- var C, w, T, R, v, $, he;
1121
+ /* @__PURE__ */ n(P, { gap: 0, children: g == null ? void 0 : g.map((h, x) => {
1122
+ var k, w, O, R, y, D, T;
1041
1123
  return /* @__PURE__ */ n(
1042
- Un,
1124
+ Kn,
1043
1125
  {
1044
- contextText: ((T = (w = (C = d.meta) == null ? void 0 : C.range) == null ? void 0 : w.startContainer.parentElement) == null ? void 0 : T.textContent) ?? "",
1045
- pageIndex: (R = d.meta) == null ? void 0 : R.itemPageIndex,
1046
- startOffset: (($ = (v = d.meta) == null ? void 0 : v.range) == null ? void 0 : $.startOffset) ?? 0,
1126
+ contextText: ((O = (w = (k = h.meta) == null ? void 0 : k.range) == null ? void 0 : w.startContainer.parentElement) == null ? void 0 : O.textContent) ?? "",
1127
+ pageIndex: (R = h.meta) == null ? void 0 : R.itemPageIndex,
1128
+ startOffset: ((D = (y = h.meta) == null ? void 0 : y.range) == null ? void 0 : D.startOffset) ?? 0,
1047
1129
  text: t,
1048
- cfi: d.cfi,
1049
- onClick: c,
1050
- absolutePageIndex: (he = d.meta) == null ? void 0 : he.absolutePageIndex
1130
+ cfi: h.cfi,
1131
+ onClick: s,
1132
+ absolutePageIndex: (T = h.meta) == null ? void 0 : T.absolutePageIndex
1051
1133
  },
1052
1134
  x
1053
1135
  );
@@ -1058,13 +1140,13 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
1058
1140
  )
1059
1141
  ] });
1060
1142
  }
1061
- ), Qn = m(
1143
+ ), Xn = m(
1062
1144
  ({
1063
1145
  open: e,
1064
1146
  setOpen: t,
1065
1147
  onNavigate: o
1066
1148
  }) => /* @__PURE__ */ n(
1067
- j,
1149
+ F,
1068
1150
  {
1069
1151
  lazyMount: !0,
1070
1152
  placement: "center",
@@ -1072,47 +1154,47 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
1072
1154
  onOpenChange: (r) => t(r.open),
1073
1155
  size: { mdDown: "full", md: "lg" },
1074
1156
  scrollBehavior: "inside",
1075
- children: /* @__PURE__ */ a(F, { height: "100%", children: [
1076
- /* @__PURE__ */ n(Y, { children: /* @__PURE__ */ n(q, { children: "Search" }) }),
1077
- /* @__PURE__ */ n(U, { flex: 1, children: /* @__PURE__ */ n(qn, { onNavigate: o }) }),
1078
- /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Q, { asChild: !0, children: /* @__PURE__ */ n(B, { variant: "outline", children: "Cancel" }) }) }),
1079
- /* @__PURE__ */ n(H, {})
1157
+ children: /* @__PURE__ */ c($, { height: "100%", children: [
1158
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Search" }) }),
1159
+ /* @__PURE__ */ n(V, { flex: 1, children: /* @__PURE__ */ n(Wn, { onNavigate: o }) }),
1160
+ /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
1161
+ /* @__PURE__ */ n(N, {})
1080
1162
  ] })
1081
1163
  }
1082
1164
  )
1083
- ), Gn = m(
1165
+ ), Zn = m(
1084
1166
  ({
1085
1167
  onNavigate: e
1086
1168
  }) => {
1087
- const t = S(), { manifest: o, assumedRenditionLayout: r } = b(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, { nav: i } = o ?? {}, l = _();
1088
- i != null && i.toc;
1089
- const { beginSpineItemIndex: c, beginPageIndexInSpineItem: h } = l ?? {}, u = (r === "reflowable" ? h : c) || 0;
1169
+ const t = v(), { manifest: o, assumedRenditionLayout: r } = b(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, { nav: l } = o ?? {}, i = U();
1170
+ l != null && l.toc;
1171
+ const { beginSpineItemIndex: s, beginPageIndexInSpineItem: d } = i ?? {}, u = (r === "reflowable" ? d : s) || 0;
1090
1172
  console.log({ assumedRenditionLayout: r, currentSpineItemOrChapterPageIndex: u });
1091
- let s = l == null ? void 0 : l.beginChapterInfo;
1092
- for (; s != null && s.subChapter; )
1093
- s = s == null ? void 0 : s.subChapter;
1094
- const g = (d, x, C) => /* @__PURE__ */ a(ye.Fragment, { children: [
1173
+ let a = i == null ? void 0 : i.beginChapterInfo;
1174
+ for (; a != null && a.subChapter; )
1175
+ a = a == null ? void 0 : a.subChapter;
1176
+ const g = (h, x, k) => /* @__PURE__ */ c(we.Fragment, { children: [
1095
1177
  /* @__PURE__ */ n(
1096
1178
  I.Item,
1097
1179
  {
1098
- pl: 4 * (C + 1),
1180
+ pl: 4 * (k + 1),
1099
1181
  style: {
1100
1182
  display: "flex",
1101
1183
  alignItems: "center"
1102
1184
  },
1103
- children: /* @__PURE__ */ a(
1104
- Z,
1185
+ children: /* @__PURE__ */ c(
1186
+ J,
1105
1187
  {
1106
1188
  onClick: () => {
1107
- e(), t == null || t.navigation.goToUrl(d.href);
1189
+ e(), t == null || t.navigation.goToUrl(h.href);
1108
1190
  },
1109
1191
  href: "#",
1110
1192
  children: [
1111
- (s == null ? void 0 : s.path) === d.path && /* @__PURE__ */ n(I.Indicator, { asChild: !0, children: /* @__PURE__ */ n(pe, {}) }),
1112
- (s == null ? void 0 : s.path) !== d.path && /* @__PURE__ */ n(I.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(pe, {}) }),
1113
- /* @__PURE__ */ a(y, { gap: 0, children: [
1114
- /* @__PURE__ */ n(p, { fontSize: "md", children: d.title || d.path }),
1115
- (s == null ? void 0 : s.path) === d.path && /* @__PURE__ */ n(
1193
+ (a == null ? void 0 : a.path) === h.path && /* @__PURE__ */ n(I.Indicator, { asChild: !0, children: /* @__PURE__ */ n(me, {}) }),
1194
+ (a == null ? void 0 : a.path) !== h.path && /* @__PURE__ */ n(I.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(me, {}) }),
1195
+ /* @__PURE__ */ c(P, { gap: 0, children: [
1196
+ /* @__PURE__ */ n(p, { fontSize: "md", children: h.title || h.path }),
1197
+ (a == null ? void 0 : a.path) === h.path && /* @__PURE__ */ n(
1116
1198
  p,
1117
1199
  {
1118
1200
  fontStyle: "italic",
@@ -1127,19 +1209,19 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
1127
1209
  )
1128
1210
  }
1129
1211
  ),
1130
- d.contents.length > 0 && /* @__PURE__ */ n(I.Root, { as: "div", gap: 2, children: d.contents.map(
1131
- (w, T) => g(w, T, C + 1)
1212
+ h.contents.length > 0 && /* @__PURE__ */ n(I.Root, { as: "div", gap: 2, children: h.contents.map(
1213
+ (w, O) => g(w, O, k + 1)
1132
1214
  ) })
1133
1215
  ] }, x);
1134
- return /* @__PURE__ */ n(I.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: i == null ? void 0 : i.toc.map((d, x) => g(d, x, 0)) });
1216
+ return /* @__PURE__ */ n(I.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: l == null ? void 0 : l.toc.map((h, x) => g(h, x, 0)) });
1135
1217
  }
1136
- ), Wn = m(
1218
+ ), Jn = m(
1137
1219
  ({
1138
1220
  open: e,
1139
1221
  setOpen: t,
1140
1222
  onNavigate: o
1141
1223
  }) => /* @__PURE__ */ n(
1142
- j,
1224
+ F,
1143
1225
  {
1144
1226
  lazyMount: !0,
1145
1227
  placement: "center",
@@ -1147,87 +1229,88 @@ const Mn = N.Root, Bn = N.ValueText, de = () => {
1147
1229
  onOpenChange: (r) => t(r.open),
1148
1230
  size: { mdDown: "full", md: "lg" },
1149
1231
  scrollBehavior: "inside",
1150
- children: /* @__PURE__ */ a(F, { children: [
1151
- /* @__PURE__ */ n(Y, { children: /* @__PURE__ */ n(q, { children: "Table of Contents" }) }),
1152
- /* @__PURE__ */ n(U, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ n(Gn, { onNavigate: o }) }),
1153
- /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Q, { asChild: !0, children: /* @__PURE__ */ n(B, { variant: "outline", children: "Cancel" }) }) }),
1154
- /* @__PURE__ */ n(H, {})
1232
+ children: /* @__PURE__ */ c($, { children: [
1233
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Table of Contents" }) }),
1234
+ /* @__PURE__ */ n(V, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ n(Zn, { onNavigate: o }) }),
1235
+ /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
1236
+ /* @__PURE__ */ n(N, {})
1155
1237
  ] })
1156
1238
  }
1157
1239
  )
1158
- ), ut = ({
1240
+ ), bt = ({
1159
1241
  enableFloatingTime: e = !0,
1160
1242
  enableFloatingProgress: t = !0,
1161
1243
  onItemClick: o
1162
1244
  }) => {
1163
- const [r, i] = P(!1), [l, c] = P(!1), [h, u] = P(!1), [s, g] = P(!1), [d, x] = P(!1), [C, w] = ce(), T = L(() => {
1164
- i(!1), c(!1), u(!1), g(!1), x(!1), w(!1);
1165
- }, [w]), R = L(
1166
- (v) => {
1167
- v === "annotations" ? g(!0) : v === "search" ? u(!0) : v === "help" ? c(!0) : v === "toc" ? i(!0) : v === "bookmarks" && x(!0), o == null || o(v);
1245
+ const [r, l] = S(!1), [i, s] = S(!1), [d, u] = S(!1), [a, g] = S(!1), [h, x] = S(!1), [k, w] = S(!1), [O, R] = he(), y = q(() => {
1246
+ l(!1), s(!1), u(!1), g(!1), x(!1), R(!1), w(!1);
1247
+ }, [R]), D = q(
1248
+ (T) => {
1249
+ T === "annotations" ? g(!0) : T === "search" ? u(!0) : T === "help" ? s(!0) : T === "toc" ? l(!0) : T === "bookmarks" ? x(!0) : T === "gallery" && w(!0), o == null || o(T);
1168
1250
  },
1169
1251
  [o]
1170
1252
  );
1171
- return Pn(), Dn(), /* @__PURE__ */ a(K, { children: [
1253
+ return zn(), Mn(), /* @__PURE__ */ c(Z, { children: [
1172
1254
  t && /* @__PURE__ */ n(
1173
- G,
1255
+ W,
1174
1256
  {
1175
- present: !C,
1257
+ present: !O,
1176
1258
  animationName: { _open: "fade-in", _closed: "fade-out" },
1177
1259
  animationDuration: "moderate",
1178
- children: /* @__PURE__ */ n(In, {})
1260
+ children: /* @__PURE__ */ n(Pn, {})
1179
1261
  }
1180
1262
  ),
1181
- /* @__PURE__ */ n(Yn, { onItemClick: R }),
1182
- /* @__PURE__ */ n(fn, {}),
1183
- /* @__PURE__ */ n(Sn, { open: l, setOpen: c }),
1263
+ /* @__PURE__ */ n(Sn, { open: k, setOpen: w }),
1264
+ /* @__PURE__ */ n(Qn, { onItemClick: D }),
1265
+ /* @__PURE__ */ n(Cn, {}),
1266
+ /* @__PURE__ */ n(Tn, { open: i, setOpen: s }),
1184
1267
  /* @__PURE__ */ n(
1185
- Wn,
1268
+ Jn,
1186
1269
  {
1187
1270
  open: r,
1188
- setOpen: i,
1189
- onNavigate: T
1271
+ setOpen: l,
1272
+ onNavigate: y
1190
1273
  }
1191
1274
  ),
1192
1275
  /* @__PURE__ */ n(
1193
- Qn,
1276
+ Xn,
1194
1277
  {
1195
- open: h,
1278
+ open: d,
1196
1279
  setOpen: u,
1197
- onNavigate: T
1280
+ onNavigate: y
1198
1281
  }
1199
1282
  ),
1200
1283
  /* @__PURE__ */ n(
1201
- mn,
1284
+ xn,
1202
1285
  {
1203
- open: s,
1286
+ open: a,
1204
1287
  setOpen: g,
1205
- onNavigate: T
1288
+ onNavigate: y
1206
1289
  }
1207
1290
  ),
1208
1291
  /* @__PURE__ */ n(
1209
- xn,
1292
+ kn,
1210
1293
  {
1211
- open: d,
1294
+ open: h,
1212
1295
  setOpen: x,
1213
- onNavigate: T
1296
+ onNavigate: y
1214
1297
  }
1215
1298
  ),
1216
1299
  /* @__PURE__ */ n(
1217
- G,
1300
+ W,
1218
1301
  {
1219
- present: e || C,
1302
+ present: e || O,
1220
1303
  animationName: { _open: "fade-in", _closed: "fade-out" },
1221
1304
  animationDuration: "slow",
1222
1305
  overflow: "hidden",
1223
- children: /* @__PURE__ */ n(wn, {})
1306
+ children: /* @__PURE__ */ n(Dn, {})
1224
1307
  }
1225
1308
  ),
1226
- /* @__PURE__ */ n(Cn, {})
1309
+ /* @__PURE__ */ n(yn, {})
1227
1310
  ] });
1228
1311
  };
1229
1312
  export {
1230
- ut as ReactReader,
1231
- ht as ReactReaderProvider
1313
+ bt as ReactReader,
1314
+ ft as ReactReaderProvider
1232
1315
  };
1233
1316
  //# sourceMappingURL=index.js.map