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