@prose-reader/react-reader 1.234.0 → 1.236.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,117 +1,116 @@
1
- import { jsx as n, jsxs as c, Fragment as oe } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as s, Fragment as oe } from "react/jsx-runtime";
2
2
  import * as E from "react";
3
- import Me, { createContext as Le, memo as f, useMemo as Ie, useEffect as W, useContext as $e, useState as T, useLayoutEffect as _e, useCallback as N } from "react";
4
- import { signal as ce, useSignalState as Se, useConstant as ye, useLiveRef as Ne, useSubscribe as B, useObserve as b, isDefined as ke, useSignalValue as He } from "reactjrx";
5
- import { Subject as de, tap as ue, map as M, filter as J, switchMap as D, EMPTY as le, of as ee, withLatestFrom as Fe, NEVER as re, startWith as We, distinctUntilChanged as he, throttleTime as je, first as Te, combineLatest as Ve, finalize as we, mergeMap as Ge, skip as Pe, merge as Re, timer as Ae, BehaviorSubject as Ye } from "rxjs";
6
- import { IconButton as I, Portal as ge, Dialog as y, List as w, Link as pe, Stack as P, Text as g, Tabs as O, Button as j, Presence as te, Box as A, createToaster as Ue, Toaster as qe, Toast as L, Spinner as Qe, Heading as xe, HStack as z, Kbd as ve, Popover as $, Progress as H, chakra as Ke, Collapsible as se, Input as Ze } from "@chakra-ui/react";
7
- import { LuX as Xe, LuNotebookPen as ne, LuBookmark as Je, LuArrowBigRight as et, LuArrowBigLeft as tt, LuChevronDown as nt, LuCircleHelp as ot, LuTableOfContents as rt, LuSearch as it, LuGalleryHorizontal as st, LuCircleCheck as Ce } from "react-icons/lu";
8
- import { createPortal as lt } from "react-dom";
9
- import { isPositionInArea as at } from "@prose-reader/enhancer-gestures";
10
- import { isShallowEqual as ct, observeIntersection as dt, isHtmlTagElement as ut } from "@prose-reader/core";
11
- import { BsBookmarks as ht } from "react-icons/bs";
12
- import { RiGalleryView2 as gt } from "react-icons/ri";
13
- import { RxDoubleArrowUp as pt, RxDoubleArrowLeft as ft, RxDoubleArrowDown as mt, RxDoubleArrowRight as bt } from "react-icons/rx";
14
- import { HiOutlineInformationCircle as xt } from "react-icons/hi";
15
- import vt from "rc-slider";
3
+ import Me, { createContext as Le, memo as m, useMemo as Ie, useEffect as F, useContext as $e, useState as k, useLayoutEffect as _e, useCallback as N } from "react";
4
+ import { signal as ce, useSignalState as ke, useConstant as Se, useLiveRef as Ne, useSubscribe as D, useObserve as f, isDefined as ye, useSignalValue as He } from "reactjrx";
5
+ import { Subject as de, tap as ue, map as z, filter as J, switchMap as A, EMPTY as se, of as ee, withLatestFrom as We, NEVER as re, startWith as Fe, distinctUntilChanged as he, throttleTime as je, first as Te, combineLatest as Ve, finalize as we, mergeMap as Ge, skip as Re, merge as Pe, timer as Ae, BehaviorSubject as Ye } from "rxjs";
6
+ import { IconButton as v, Portal as ge, Dialog as I, List as y, Link as pe, Stack as T, Text as g, Tabs as P, Button as j, Presence as ne, Box as R, createToaster as Ue, Toaster as qe, Toast as M, Spinner as Qe, Heading as xe, HStack as O, Kbd as ve, Popover as L, Progress as H, chakra as Ke, Collapsible as ae, Input as Ze } from "@chakra-ui/react";
7
+ import { LuX as Xe, LuNotebookPen as te, LuBookmark as Je, LuArrowBigRight as en, LuArrowBigLeft as nn, LuChevronDown as tn, LuCircleHelp as on, LuTableOfContents as rn, LuSearch as an, LuGalleryHorizontal as sn, LuCircleCheck as Ce } from "react-icons/lu";
8
+ import { createPortal as ln } from "react-dom";
9
+ import { isPositionInArea as cn } from "@prose-reader/enhancer-gestures";
10
+ import { isShallowEqual as dn, observeIntersection as un, isHtmlTagElement as hn } from "@prose-reader/core";
11
+ import { BsBookmarks as gn } from "react-icons/bs";
12
+ import { RiGalleryView2 as pn } from "react-icons/ri";
13
+ import { RxDoubleArrowUp as mn, RxDoubleArrowLeft as fn, RxDoubleArrowDown as bn, RxDoubleArrowRight as xn } from "react-icons/rx";
14
+ import { HiOutlineInformationCircle as vn } from "react-icons/hi";
15
+ import Cn from "rc-slider";
16
16
  import "rc-slider/assets/index.css";
17
- import { IoIosArrowBack as Ct, IoMdMore as It } from "react-icons/io";
18
- import { MdFullscreenExit as St, MdFullscreen as yt } from "react-icons/md";
17
+ import { IoIosArrowBack as In, IoMdMore as kn } from "react-icons/io";
18
+ import { MdFullscreenExit as Sn, MdFullscreen as yn } from "react-icons/md";
19
19
  const Oe = Le({
20
20
  reader: void 0,
21
21
  quickMenuSignal: ce({ default: !1 }),
22
22
  notificationsSubject: new de()
23
- }), Wn = f(
23
+ }), Ft = m(
24
24
  ({
25
25
  children: e,
26
26
  reader: t,
27
27
  quickMenuOpen: o,
28
28
  onQuickMenuOpenChange: i
29
29
  }) => {
30
- const [, r] = Se(
30
+ const [, r] = ke(
31
31
  () => ce({
32
32
  default: o
33
33
  })
34
- ), s = ye(
34
+ ), a = Se(
35
35
  () => new de()
36
- ), a = Ne(i), d = Ie(
36
+ ), l = Ne(i), c = Ie(
37
37
  () => ({
38
38
  quickMenuSignal: r,
39
39
  reader: t,
40
- notificationsSubject: s
40
+ notificationsSubject: a
41
41
  }),
42
- [r, t, s]
42
+ [r, t, a]
43
43
  );
44
- return W(() => {
44
+ return F(() => {
45
45
  r.setValue(o);
46
- }, [o, r]), B(
47
- () => r.pipe(ue(a.current)),
48
- [r, a]
49
- ), /* @__PURE__ */ n(Oe.Provider, { value: d, children: e });
46
+ }, [o, r]), D(
47
+ () => r.pipe(ue(l.current)),
48
+ [r, l]
49
+ ), /* @__PURE__ */ n(Oe.Provider, { value: c, children: e });
50
50
  }
51
- ), kt = E.forwardRef(function(t, o) {
52
- return /* @__PURE__ */ n(I, { variant: "ghost", "aria-label": "Close", ref: o, ...t, children: t.children ?? /* @__PURE__ */ n(Xe, {}) });
51
+ ), Tn = E.forwardRef(function(t, o) {
52
+ return /* @__PURE__ */ n(v, { variant: "ghost", "aria-label": "Close", ref: o, ...t, children: t.children ?? /* @__PURE__ */ n(Xe, {}) });
53
53
  }), V = E.forwardRef(function(t, o) {
54
54
  const {
55
55
  children: i,
56
56
  portalled: r = !0,
57
- portalRef: s,
58
- backdrop: a = !0,
59
- ...d
57
+ portalRef: a,
58
+ backdrop: l = !0,
59
+ ...c
60
60
  } = t;
61
- return /* @__PURE__ */ c(ge, { disabled: !r, container: s, children: [
62
- a && /* @__PURE__ */ n(y.Backdrop, {}),
63
- /* @__PURE__ */ n(y.Positioner, { children: /* @__PURE__ */ n(y.Content, { ref: o, ...d, asChild: !1, children: i }) })
61
+ return /* @__PURE__ */ s(ge, { disabled: !r, container: a, children: [
62
+ l && /* @__PURE__ */ n(I.Backdrop, {}),
63
+ /* @__PURE__ */ n(I.Positioner, { children: /* @__PURE__ */ n(I.Content, { ref: o, ...c, asChild: !1, children: i }) })
64
64
  ] });
65
65
  }), G = E.forwardRef(function(t, o) {
66
66
  return /* @__PURE__ */ n(
67
- y.CloseTrigger,
67
+ I.CloseTrigger,
68
68
  {
69
69
  position: "absolute",
70
70
  top: "2",
71
71
  insetEnd: "2",
72
72
  ...t,
73
73
  asChild: !0,
74
- children: /* @__PURE__ */ n(kt, { size: "sm", ref: o, children: t.children })
74
+ children: /* @__PURE__ */ n(Tn, { size: "sm", ref: o, children: t.children })
75
75
  }
76
76
  );
77
- }), Y = y.Root, U = y.Footer, q = y.Header, Q = y.Body;
78
- y.Backdrop;
79
- const K = y.Title;
80
- y.Description;
81
- y.Trigger;
82
- const Z = y.ActionTrigger, X = () => $e(Oe), p = () => {
77
+ }), Y = I.Root, U = I.Footer, q = I.Header, Q = I.Body;
78
+ I.Backdrop;
79
+ const K = I.Title;
80
+ I.Description;
81
+ I.Trigger;
82
+ const Z = I.ActionTrigger, X = () => $e(Oe), p = () => {
83
83
  const { reader: e } = X();
84
84
  return e;
85
- }, De = (e) => !!e && "__PROSE_READER_ENHANCER_SEARCH" in e, F = (e) => !!e && "__PROSE_READER_ENHANCER_ANNOTATIONS" in e, ze = (e) => !!e && "__PROSE_READER_ENHANCER_GALLERY" in e, Tt = (e) => {
86
- const t = p(), o = F(t) ? t : void 0;
87
- return { data: b(
88
- () => o == null ? void 0 : o.annotations.annotations$.pipe(
89
- M((r) => r.find((s) => s.id === e)),
90
- J(ke),
91
- D((r) => o.locateResource(r))
85
+ }, Ee = (e) => !!e && "__PROSE_READER_ENHANCER_SEARCH" in e, W = (e) => !!e && "__PROSE_READER_ENHANCER_ANNOTATIONS" in e, De = (e) => !!e && "__PROSE_READER_ENHANCER_GALLERY" in e, wn = (e) => {
86
+ const t = p(), o = W(t) ? t : void 0;
87
+ return { data: f(
88
+ () => o?.annotations.annotations$.pipe(
89
+ z((r) => r.find((a) => a.id === e)),
90
+ J(ye),
91
+ A((r) => o.locateResource(r))
92
92
  ),
93
93
  [o]
94
94
  ) };
95
- }, Ee = ({
95
+ }, ze = ({
96
96
  id: e,
97
97
  onNavigate: t,
98
98
  allowLeftIcon: o = !0
99
99
  }) => {
100
- var a, d, u, l;
101
- const i = p(), { data: r } = Tt(e), s = ((a = r == null ? void 0 : r.meta.range) == null ? void 0 : a.toString()) || ((d = r == null ? void 0 : r.meta.node) == null ? void 0 : d.textContent);
102
- return /* @__PURE__ */ n(w.Item, { children: /* @__PURE__ */ c(
100
+ const i = p(), { data: r } = wn(e), a = r?.meta.range?.toString() || r?.meta.node?.textContent;
101
+ return /* @__PURE__ */ n(y.Item, { children: /* @__PURE__ */ s(
103
102
  pe,
104
103
  {
105
104
  href: "#",
106
105
  onClick: () => {
107
- t(), i == null || i.navigation.goToCfi((r == null ? void 0 : r.meta.cfi) ?? "");
106
+ t(), i?.navigation.goToCfi(r?.meta.cfi ?? "");
108
107
  },
109
108
  children: [
110
- (u = r == null ? void 0 : r.resource) != null && u.notes ? /* @__PURE__ */ n(w.Indicator, { asChild: !0, children: /* @__PURE__ */ n(ne, {}) }) : o ? /* @__PURE__ */ n(w.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(ne, {}) }) : null,
111
- /* @__PURE__ */ c(P, { gap: 0, children: [
112
- s ? /* @__PURE__ */ n(g, { lineClamp: 2, fontSize: "md", children: s }) : /* @__PURE__ */ c(g, { lineClamp: 2, fontSize: "md", fontStyle: "italic", children: [
109
+ r?.resource?.notes ? /* @__PURE__ */ n(y.Indicator, { asChild: !0, children: /* @__PURE__ */ n(te, {}) }) : o ? /* @__PURE__ */ n(y.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(te, {}) }) : null,
110
+ /* @__PURE__ */ s(T, { gap: 0, children: [
111
+ a ? /* @__PURE__ */ n(g, { lineClamp: 2, fontSize: "md", children: a }) : /* @__PURE__ */ s(g, { lineClamp: 2, fontSize: "md", fontStyle: "italic", children: [
113
112
  "Page ",
114
- ((r == null ? void 0 : r.meta.absolutePageIndex) ?? 0) + 1
113
+ (r?.meta.absolutePageIndex ?? 0) + 1
115
114
  ] }),
116
115
  /* @__PURE__ */ n(
117
116
  g,
@@ -119,7 +118,7 @@ const Z = y.ActionTrigger, X = () => $e(Oe), p = () => {
119
118
  fontStyle: "italic",
120
119
  fontWeight: "bold",
121
120
  fontSize: "sm",
122
- children: `Book page: ${((l = r == null ? void 0 : r.meta) == null ? void 0 : l.absolutePageIndex) !== void 0 ? r.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
121
+ children: `Book page: ${r?.meta?.absolutePageIndex !== void 0 ? r.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
123
122
  }
124
123
  )
125
124
  ] })
@@ -127,41 +126,41 @@ const Z = y.ActionTrigger, X = () => $e(Oe), p = () => {
127
126
  }
128
127
  ) });
129
128
  }, ie = () => {
130
- const e = p(), t = F(e) ? e : void 0;
131
- return { data: b(
132
- () => t == null ? void 0 : t.annotations.annotations$.pipe(
133
- D(
129
+ const e = p(), t = W(e) ? e : void 0;
130
+ return { data: f(
131
+ () => t?.annotations.annotations$.pipe(
132
+ A(
134
133
  (i) => t.locateResource(i)
135
134
  )
136
135
  ),
137
136
  [t]
138
137
  ) };
139
- }, wt = () => {
138
+ }, Rn = () => {
140
139
  const { data: e } = ie();
141
140
  return {
142
- data: e == null ? void 0 : e.filter((t) => t.meta.isCfiRange)
141
+ data: e?.filter((t) => t.meta.isCfiRange)
143
142
  };
144
- }, Pt = ({ onNavigate: e }) => {
145
- const { data: t } = wt();
146
- return /* @__PURE__ */ n(w.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: t == null ? void 0 : t.map((o) => /* @__PURE__ */ n(
147
- Ee,
143
+ }, Pn = ({ onNavigate: e }) => {
144
+ const { data: t } = Rn();
145
+ return /* @__PURE__ */ n(y.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: t?.map((o) => /* @__PURE__ */ n(
146
+ ze,
148
147
  {
149
148
  id: o.resource.id,
150
149
  onNavigate: e
151
150
  },
152
151
  o.resource.id
153
152
  )) });
154
- }, Rt = () => {
153
+ }, An = () => {
155
154
  const { data: e } = ie();
156
155
  return {
157
- data: e == null ? void 0 : e.filter(
156
+ data: e?.filter(
158
157
  (t) => !t.meta.isCfiRange && !t.resource.notes
159
158
  )
160
159
  };
161
- }, At = ({ onNavigate: e }) => {
162
- const { data: t } = Rt();
163
- return /* @__PURE__ */ n(w.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: t == null ? void 0 : t.map((o) => /* @__PURE__ */ n(
164
- Ee,
160
+ }, On = ({ onNavigate: e }) => {
161
+ const { data: t } = An();
162
+ return /* @__PURE__ */ n(y.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: t?.map((o) => /* @__PURE__ */ n(
163
+ ze,
165
164
  {
166
165
  id: o.resource.id,
167
166
  onNavigate: e,
@@ -169,36 +168,36 @@ const Z = y.ActionTrigger, X = () => $e(Oe), p = () => {
169
168
  },
170
169
  o.resource.id
171
170
  )) });
172
- }, Ot = f(
171
+ }, En = m(
173
172
  ({
174
173
  onNavigate: e,
175
174
  defaultTab: t
176
175
  }) => {
177
- const [o, i] = T(t ?? "bookmarks");
178
- return /* @__PURE__ */ c(
179
- O.Root,
176
+ const [o, i] = k(t ?? "bookmarks");
177
+ return /* @__PURE__ */ s(
178
+ P.Root,
180
179
  {
181
180
  value: o,
182
181
  onValueChange: (r) => i(r.value),
183
182
  children: [
184
- /* @__PURE__ */ c(O.List, { children: [
185
- /* @__PURE__ */ c(O.Trigger, { value: "bookmarks", children: [
183
+ /* @__PURE__ */ s(P.List, { children: [
184
+ /* @__PURE__ */ s(P.Trigger, { value: "bookmarks", children: [
186
185
  /* @__PURE__ */ n(Je, {}),
187
186
  "Bookmarks"
188
187
  ] }),
189
- /* @__PURE__ */ c(O.Trigger, { value: "annotations", children: [
190
- /* @__PURE__ */ n(ne, {}),
188
+ /* @__PURE__ */ s(P.Trigger, { value: "annotations", children: [
189
+ /* @__PURE__ */ n(te, {}),
191
190
  "Annotations"
192
191
  ] }),
193
- /* @__PURE__ */ n(O.Indicator, {})
192
+ /* @__PURE__ */ n(P.Indicator, {})
194
193
  ] }),
195
- /* @__PURE__ */ n(O.Content, { value: "bookmarks", children: /* @__PURE__ */ n(At, { onNavigate: e }) }),
196
- /* @__PURE__ */ n(O.Content, { value: "annotations", children: /* @__PURE__ */ n(Pt, { onNavigate: e }) })
194
+ /* @__PURE__ */ n(P.Content, { value: "bookmarks", children: /* @__PURE__ */ n(On, { onNavigate: e }) }),
195
+ /* @__PURE__ */ n(P.Content, { value: "annotations", children: /* @__PURE__ */ n(Pn, { onNavigate: e }) })
197
196
  ]
198
197
  }
199
198
  );
200
199
  }
201
- ), Dt = f(
200
+ ), Dn = m(
202
201
  ({
203
202
  openWith: e,
204
203
  setOpen: t,
@@ -212,10 +211,10 @@ const Z = y.ActionTrigger, X = () => $e(Oe), p = () => {
212
211
  onOpenChange: (i) => t(i.open),
213
212
  size: { mdDown: "full", md: "lg" },
214
213
  scrollBehavior: "inside",
215
- children: /* @__PURE__ */ c(V, { height: "100%", children: [
214
+ children: /* @__PURE__ */ s(V, { height: "100%", children: [
216
215
  /* @__PURE__ */ n(q, { children: /* @__PURE__ */ n(K, { children: "Annotations" }) }),
217
216
  /* @__PURE__ */ n(Q, { flex: 1, children: /* @__PURE__ */ n(
218
- Ot,
217
+ En,
219
218
  {
220
219
  onNavigate: o,
221
220
  defaultTab: e
@@ -226,63 +225,60 @@ const Z = y.ActionTrigger, X = () => $e(Oe), p = () => {
226
225
  ] })
227
226
  }
228
227
  )
229
- ), zt = f(({ children: e }) => {
230
- const t = p(), o = b(() => t == null ? void 0 : t.spine.element$, [t]);
231
- return o ? /* @__PURE__ */ n(oe, { children: lt(e, o) }) : null;
232
- }), Et = ({
228
+ ), zn = m(({ children: e }) => {
229
+ const t = p(), o = f(() => t?.spine.element$, [t]);
230
+ return o ? /* @__PURE__ */ n(oe, { children: ln(e, o) }) : null;
231
+ }), Bn = ({
233
232
  absolutePageIndex: e,
234
233
  itemIndex: t
235
234
  }) => {
236
235
  const o = p();
237
236
  return {
238
- spineItem: b(() => o ? t !== void 0 ? ee(o.spine.spineItemsManager.get(t)) : e !== void 0 ? o.spine.pages.observeFromAbsolutePageIndex(e).pipe(
239
- M((r) => o.spine.spineItemsManager.get(r == null ? void 0 : r.itemIndex))
240
- ) : le : le, [t, e, o])
237
+ spineItem: f(() => o ? t !== void 0 ? ee(o.spine.spineItemsManager.get(t)) : e !== void 0 ? o.spine.pages.observeFromAbsolutePageIndex(e).pipe(
238
+ z((r) => o.spine.spineItemsManager.get(r?.itemIndex))
239
+ ) : se : se, [t, e, o])
241
240
  };
242
- }, Bt = ({
241
+ }, Mn = ({
243
242
  absolutePageIndex: e,
244
243
  itemIndex: t
245
244
  }) => {
246
- const { spineItem: o } = Et({ absolutePageIndex: e, itemIndex: t }), i = b(
247
- () => (o == null ? void 0 : o.isReady$) ?? ee(!1),
245
+ const { spineItem: o } = Bn({ absolutePageIndex: e, itemIndex: t }), i = f(
246
+ () => o?.isReady$ ?? ee(!1),
248
247
  [o]
249
248
  );
250
249
  return { spineItem: o, isReady: i };
251
- }, Mt = "data-bookmark-area", Lt = f(
250
+ }, Ln = "data-bookmark-area", $n = m(
252
251
  ({
253
252
  absolutePageIndex: e,
254
253
  left: t,
255
254
  top: o,
256
255
  width: i
257
256
  }) => {
258
- const { isReady: r } = Bt({
257
+ const { isReady: r } = Mn({
259
258
  absolutePageIndex: e
260
- }), { data: s } = ie(), a = s == null ? void 0 : s.find(
261
- (u) => {
262
- var l;
263
- return ((l = u == null ? void 0 : u.meta) == null ? void 0 : l.absolutePageIndex) === e && u.meta.range === void 0;
264
- }
259
+ }), { data: a } = ie(), l = a?.find(
260
+ (u) => u?.meta?.absolutePageIndex === e && u.meta.range === void 0
265
261
  );
266
262
  if (!r) return null;
267
- const d = i * 0.1 / 2;
263
+ const c = i * 0.1 / 2;
268
264
  return /* @__PURE__ */ n(
269
- te,
265
+ ne,
270
266
  {
271
- present: !!a,
267
+ present: !!l,
272
268
  lazyMount: !0,
273
269
  animationName: { _open: "fade-in", _closed: "fade-out" },
274
270
  animationDuration: "moderate",
275
271
  children: /* @__PURE__ */ n(
276
- A,
272
+ R,
277
273
  {
278
- "data-bookmark-area": Mt,
274
+ "data-bookmark-area": Ln,
279
275
  position: "absolute",
280
276
  left: t + i,
281
277
  transform: "translateX(-100%)",
282
278
  pointerEvents: "none",
283
279
  top: o,
284
- width: d,
285
- height: d,
280
+ width: c,
281
+ height: c,
286
282
  _before: {
287
283
  content: '""',
288
284
  position: "absolute",
@@ -290,46 +286,46 @@ const Z = y.ActionTrigger, X = () => $e(Oe), p = () => {
290
286
  left: 0,
291
287
  width: 0,
292
288
  height: 0,
293
- borderTop: `${d}px solid #03030373`,
294
- borderLeft: `${d}px solid transparent`
289
+ borderTop: `${c}px solid #03030373`,
290
+ borderLeft: `${c}px solid transparent`
295
291
  }
296
292
  }
297
293
  )
298
294
  }
299
295
  );
300
296
  }
301
- ), $t = f(() => {
302
- const e = p(), t = b(() => e == null ? void 0 : e.layoutInfo$, [e]);
303
- return /* @__PURE__ */ n(zt, { children: t == null ? void 0 : t.pages.map(
304
- ({ absoluteLayout: { left: o, top: i, width: r } }, s) => /* @__PURE__ */ n(
305
- Lt,
297
+ ), _n = m(() => {
298
+ const e = p(), t = f(() => e?.layoutInfo$, [e]);
299
+ return /* @__PURE__ */ n(zn, { children: t?.pages.map(
300
+ ({ absoluteLayout: { left: o, top: i, width: r } }, a) => /* @__PURE__ */ n(
301
+ $n,
306
302
  {
307
- absolutePageIndex: s,
303
+ absolutePageIndex: a,
308
304
  left: o,
309
305
  top: i,
310
306
  width: r
311
307
  },
312
- s
308
+ a
313
309
  )
314
310
  ) });
315
- }), _t = () => {
311
+ }), Nn = () => {
316
312
  const e = p();
317
- return F(e) ? e : void 0;
318
- }, Nt = () => {
319
- const e = _t(), { data: t } = ie();
320
- W(() => e ? e.gestures.hooks.register(
313
+ return W(e) ? e : void 0;
314
+ }, Hn = () => {
315
+ const e = Nn(), { data: t } = ie();
316
+ F(() => e ? e.gestures.hooks.register(
321
317
  "beforeTapGesture",
322
318
  ({ event$: i }) => i.pipe(
323
- Fe(e == null ? void 0 : e.annotations.candidates$),
324
- M(([r, s]) => {
319
+ We(e?.annotations.candidates$),
320
+ z(([r, a]) => {
325
321
  if (!r.page) return !0;
326
322
  const {
327
- spineItem: a,
328
- spineItemPageIndex: d,
323
+ spineItem: l,
324
+ spineItemPageIndex: c,
329
325
  spineItemPagePosition: u,
330
- pageSize: l
326
+ pageSize: d
331
327
  } = r.page;
332
- if (at(
328
+ if (cn(
333
329
  u,
334
330
  {
335
331
  type: "corner",
@@ -337,23 +333,20 @@ const Z = y.ActionTrigger, X = () => $e(Oe), p = () => {
337
333
  size: 10,
338
334
  unit: "%"
339
335
  },
340
- l
336
+ d
341
337
  )) {
342
338
  const h = e.spine.pages.fromSpineItemPageIndex(
343
- a,
344
- d
339
+ l,
340
+ c
345
341
  );
346
342
  if (!h) return !0;
347
- const m = t == null ? void 0 : t.find(
348
- (C) => {
349
- var k;
350
- return ((k = C == null ? void 0 : C.meta) == null ? void 0 : k.absolutePageIndex) === h.absolutePageIndex && C.meta.range === void 0;
351
- }
343
+ const x = t?.find(
344
+ (w) => w?.meta?.absolutePageIndex === h.absolutePageIndex && w.meta.range === void 0
352
345
  );
353
- if (m)
354
- return e == null || e.annotations.delete(m.resource.id), !1;
355
- if (s == null ? void 0 : s[h.absolutePageIndex])
356
- return e == null || e.annotations.annotateAbsolutePage({
346
+ if (x)
347
+ return e?.annotations.delete(x.resource.id), !1;
348
+ if (a?.[h.absolutePageIndex])
349
+ return e?.annotations.annotateAbsolutePage({
357
350
  absolutePageIndex: h.absolutePageIndex
358
351
  }), !1;
359
352
  }
@@ -361,21 +354,18 @@ const Z = y.ActionTrigger, X = () => $e(Oe), p = () => {
361
354
  })
362
355
  )
363
356
  ) : void 0, [e, t]);
364
- }, ae = Ue({
357
+ }, le = Ue({
365
358
  placement: "bottom-end",
366
359
  pauseOnPageIdle: !0
367
- }), Ht = () => /* @__PURE__ */ n(ge, { children: /* @__PURE__ */ n(qe, { toaster: ae, insetInline: { mdDown: "4" }, children: (e) => {
368
- var t;
369
- return /* @__PURE__ */ c(L.Root, { width: { md: "sm" }, children: [
370
- e.type === "loading" ? /* @__PURE__ */ n(Qe, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ n(L.Indicator, {}),
371
- /* @__PURE__ */ c(P, { gap: "1", flex: "1", maxWidth: "100%", children: [
372
- e.title && /* @__PURE__ */ n(L.Title, { children: e.title }),
373
- e.description && /* @__PURE__ */ n(L.Description, { children: e.description })
374
- ] }),
375
- e.action && /* @__PURE__ */ n(L.ActionTrigger, { children: e.action.label }),
376
- ((t = e.meta) == null ? void 0 : t.closable) && /* @__PURE__ */ n(L.CloseTrigger, {})
377
- ] });
378
- } }) }), Ft = {
360
+ }), Wn = () => /* @__PURE__ */ n(ge, { children: /* @__PURE__ */ n(qe, { toaster: le, insetInline: { mdDown: "4" }, children: (e) => /* @__PURE__ */ s(M.Root, { width: { md: "sm" }, children: [
361
+ e.type === "loading" ? /* @__PURE__ */ n(Qe, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ n(M.Indicator, {}),
362
+ /* @__PURE__ */ s(T, { gap: "1", flex: "1", maxWidth: "100%", children: [
363
+ e.title && /* @__PURE__ */ n(M.Title, { children: e.title }),
364
+ e.description && /* @__PURE__ */ n(M.Description, { children: e.description })
365
+ ] }),
366
+ e.action && /* @__PURE__ */ n(M.ActionTrigger, { children: e.action.label }),
367
+ e.meta?.closable && /* @__PURE__ */ n(M.CloseTrigger, {})
368
+ ] }) }) }), Fn = {
379
369
  x: 0,
380
370
  y: 0,
381
371
  width: 0,
@@ -385,12 +375,12 @@ const Z = y.ActionTrigger, X = () => $e(Oe), p = () => {
385
375
  bottom: 0,
386
376
  right: 0
387
377
  };
388
- function Wt() {
389
- const [e, t] = T(null), [o, i] = T(Ft), r = Ie(
390
- () => new ResizeObserver((s) => {
391
- if (s[0]) {
392
- const { x: a, y: d, width: u, height: l, top: x, left: h, bottom: m, right: S } = s[0].contentRect;
393
- i({ x: a, y: d, width: u, height: l, top: x, left: h, bottom: m, right: S });
378
+ function jn() {
379
+ const [e, t] = k(null), [o, i] = k(Fn), r = Ie(
380
+ () => new ResizeObserver((a) => {
381
+ if (a[0]) {
382
+ const { x: l, y: c, width: u, height: d, top: b, left: h, bottom: x, right: S } = a[0].contentRect;
383
+ i({ x: l, y: c, width: u, height: d, top: b, left: h, bottom: x, right: S });
394
384
  }
395
385
  }),
396
386
  []
@@ -402,26 +392,26 @@ function Wt() {
402
392
  };
403
393
  }, [e, r]), [t, o, e];
404
394
  }
405
- const jt = (e, t, o) => {
406
- const i = p(), r = ze(i) ? i : void 0;
407
- B(() => {
395
+ const Vn = (e, t, o) => {
396
+ const i = p(), r = De(i) ? i : void 0;
397
+ D(() => {
408
398
  if (!r || !e) return re;
409
- const s = t.layout.layout$.pipe(
410
- We(t.layout.layoutInfo),
411
- he(ct)
412
- ), a = dt(
399
+ const a = t.layout.layout$.pipe(
400
+ Fe(t.layout.layoutInfo),
401
+ he(dn)
402
+ ), l = un(
413
403
  e
414
- ).pipe(M((d) => d.some((u) => u.isIntersecting)));
415
- return s.pipe(
404
+ ).pipe(z((c) => c.some((u) => u.isIntersecting)));
405
+ return a.pipe(
416
406
  je(100, void 0, { trailing: !0 }),
417
- D(() => a.pipe(
418
- ue((d) => {
419
- d || (e.innerHTML = "");
407
+ A(() => l.pipe(
408
+ ue((c) => {
409
+ c || (e.innerHTML = "");
420
410
  }),
421
- J((d) => d),
411
+ J((c) => c),
422
412
  Te()
423
413
  ).pipe(
424
- D(() => (e.innerHTML = "", r == null ? void 0 : r.gallery.snapshot(
414
+ A(() => (e.innerHTML = "", r?.gallery.snapshot(
425
415
  t,
426
416
  e,
427
417
  o
@@ -429,20 +419,16 @@ const jt = (e, t, o) => {
429
419
  ))
430
420
  );
431
421
  }, [r, t, o, e]);
432
- }, Vt = f(
433
- ({
434
- item: e,
435
- onNavigated: t
436
- }) => {
437
- var d;
438
- const [o, i, r] = Wt(), s = p();
439
- jt(r, e, i);
440
- const a = b(
441
- () => s == null ? void 0 : s.locateResource(e, { mode: "shallow" }),
442
- [s, e]
422
+ }, Gn = m(
423
+ ({ item: e, onNavigated: t }) => {
424
+ const [o, i, r] = jn(), a = p();
425
+ Vn(r, e, i);
426
+ const l = f(
427
+ () => a?.locateResource(e, { mode: "shallow" }),
428
+ [a, e]
443
429
  );
444
- return /* @__PURE__ */ c(
445
- A,
430
+ return /* @__PURE__ */ s(
431
+ R,
446
432
  {
447
433
  width: "100%",
448
434
  aspectRatio: "2/3",
@@ -454,11 +440,11 @@ const jt = (e, t, o) => {
454
440
  position: "relative",
455
441
  overflow: "hidden",
456
442
  onClick: () => {
457
- t(), s == null || s.navigation.goToSpineItem({ indexOrId: e });
443
+ t(), a?.navigation.goToSpineItem({ indexOrId: e });
458
444
  },
459
445
  children: [
460
446
  /* @__PURE__ */ n(
461
- A,
447
+ R,
462
448
  {
463
449
  height: "100%",
464
450
  width: "100%",
@@ -467,7 +453,7 @@ const jt = (e, t, o) => {
467
453
  ref: o
468
454
  }
469
455
  ),
470
- /* @__PURE__ */ c(
456
+ /* @__PURE__ */ s(
471
457
  g,
472
458
  {
473
459
  position: "absolute",
@@ -480,7 +466,7 @@ const jt = (e, t, o) => {
480
466
  fontSize: "xs",
481
467
  children: [
482
468
  "Page ",
483
- (((d = a == null ? void 0 : a.meta) == null ? void 0 : d.absolutePageIndex) ?? 0) + 1
469
+ (l?.meta?.absolutePageIndex ?? 0) + 1
484
470
  ]
485
471
  }
486
472
  )
@@ -488,12 +474,9 @@ const jt = (e, t, o) => {
488
474
  }
489
475
  );
490
476
  }
491
- ), Gt = f(
492
- ({
493
- open: e,
494
- setOpen: t
495
- }) => {
496
- const o = p(), i = b(() => o == null ? void 0 : o.spineItemsManager.items$, [o]);
477
+ ), Yn = m(
478
+ ({ open: e, setOpen: t }) => {
479
+ const o = p(), i = f(() => o?.spineItemsManager.items$, [o]);
497
480
  return /* @__PURE__ */ n(
498
481
  Y,
499
482
  {
@@ -503,10 +486,10 @@ const jt = (e, t, o) => {
503
486
  onOpenChange: (r) => t(r.open),
504
487
  size: { mdDown: "full", md: "lg" },
505
488
  scrollBehavior: "inside",
506
- children: /* @__PURE__ */ c(V, { height: "100%", children: [
489
+ children: /* @__PURE__ */ s(V, { height: "100%", children: [
507
490
  /* @__PURE__ */ n(q, { children: /* @__PURE__ */ n(K, { children: "Gallery" }) }),
508
491
  /* @__PURE__ */ n(Q, { children: /* @__PURE__ */ n(
509
- A,
492
+ R,
510
493
  {
511
494
  gridTemplateColumns: [
512
495
  "repeat(2, minmax(0, 1fr))",
@@ -516,8 +499,8 @@ const jt = (e, t, o) => {
516
499
  gap: [2, 4],
517
500
  pt: 2,
518
501
  "data-grid": !0,
519
- children: i == null ? void 0 : i.map((r) => /* @__PURE__ */ n(
520
- Vt,
502
+ children: i?.map((r) => /* @__PURE__ */ n(
503
+ Gn,
521
504
  {
522
505
  item: r,
523
506
  onNavigated: () => {
@@ -534,11 +517,8 @@ const jt = (e, t, o) => {
534
517
  }
535
518
  );
536
519
  }
537
- ), Yt = "@prose-reader/react-reader", Ut = "1.233.0", qt = f(
538
- ({
539
- open: e,
540
- setOpen: t
541
- }) => /* @__PURE__ */ n(
520
+ ), Un = "@prose-reader/react-reader", qn = "1.235.0", Qn = m(
521
+ ({ open: e, setOpen: t }) => /* @__PURE__ */ n(
542
522
  Y,
543
523
  {
544
524
  lazyMount: !0,
@@ -547,25 +527,25 @@ const jt = (e, t, o) => {
547
527
  onOpenChange: (o) => t(o.open),
548
528
  size: { mdDown: "full", md: "lg" },
549
529
  scrollBehavior: "inside",
550
- children: /* @__PURE__ */ c(V, { children: [
530
+ children: /* @__PURE__ */ s(V, { children: [
551
531
  /* @__PURE__ */ n(q, { children: /* @__PURE__ */ n(K, { children: "Help" }) }),
552
- /* @__PURE__ */ c(Q, { overflowY: "auto", flex: 1, children: [
532
+ /* @__PURE__ */ s(Q, { overflowY: "auto", flex: 1, children: [
553
533
  /* @__PURE__ */ n(xe, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
554
- /* @__PURE__ */ c(z, { mb: 1, children: [
555
- /* @__PURE__ */ n(ve, { children: /* @__PURE__ */ n(et, {}) }),
534
+ /* @__PURE__ */ s(O, { mb: 1, children: [
535
+ /* @__PURE__ */ n(ve, { children: /* @__PURE__ */ n(en, {}) }),
556
536
  " ",
557
537
  /* @__PURE__ */ n(g, { children: "Navigate to right page" })
558
538
  ] }),
559
- /* @__PURE__ */ c(z, { mb: 1, children: [
560
- /* @__PURE__ */ n(ve, { children: /* @__PURE__ */ n(tt, {}) }),
539
+ /* @__PURE__ */ s(O, { mb: 1, children: [
540
+ /* @__PURE__ */ n(ve, { children: /* @__PURE__ */ n(nn, {}) }),
561
541
  " ",
562
542
  /* @__PURE__ */ n(g, { children: "Navigate to left page" })
563
543
  ] }),
564
544
  /* @__PURE__ */ n(xe, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
565
- /* @__PURE__ */ c(g, { children: [
566
- Yt,
545
+ /* @__PURE__ */ s(g, { children: [
546
+ Un,
567
547
  " version: ",
568
- Ut
548
+ qn
569
549
  ] })
570
550
  ] }),
571
551
  /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(Z, { asChild: !0, children: /* @__PURE__ */ n(j, { variant: "outline", children: "Cancel" }) }) }),
@@ -573,17 +553,13 @@ const jt = (e, t, o) => {
573
553
  ] })
574
554
  }
575
555
  )
576
- ), _ = () => {
556
+ ), $ = () => {
577
557
  const e = p();
578
- return b(
558
+ return f(
579
559
  () => e ? Ve([e.pagination.state$, e.context.state$]).pipe(
580
- M(([t, o]) => {
581
- var r;
582
- const i = (r = o.manifest) == null ? void 0 : r.spineItems.every(
583
- (s) => {
584
- var a;
585
- return (a = s.mediaType) == null ? void 0 : a.startsWith("image/");
586
- }
560
+ z(([t, o]) => {
561
+ const i = o.manifest?.spineItems.every(
562
+ (r) => r.mediaType?.startsWith("image/")
587
563
  );
588
564
  return {
589
565
  ...t,
@@ -593,49 +569,49 @@ const jt = (e, t, o) => {
593
569
  ) : re,
594
570
  [e]
595
571
  );
596
- }, Qt = () => {
597
- const e = _(), t = Math.floor(
598
- ((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100
572
+ }, Kn = () => {
573
+ const e = $(), t = Math.floor(
574
+ (e?.percentageEstimateOfBook ?? 0) * 100
599
575
  ), o = t > 0 ? t : 1;
600
- return (e == null ? void 0 : e.percentageEstimateOfBook) === void 0 ? null : /* @__PURE__ */ n(A, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ c(g, { fontSize: "sm", children: [
576
+ return e?.percentageEstimateOfBook === void 0 ? null : /* @__PURE__ */ n(R, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ s(g, { fontSize: "sm", children: [
601
577
  o,
602
578
  " %"
603
579
  ] }) });
604
- }, Kt = () => {
605
- const [e, t] = T(/* @__PURE__ */ new Date());
606
- return W(() => {
580
+ }, Zn = () => {
581
+ const [e, t] = k(/* @__PURE__ */ new Date());
582
+ return F(() => {
607
583
  const o = setInterval(() => {
608
584
  t(/* @__PURE__ */ new Date());
609
585
  }, 6e4);
610
586
  return () => clearInterval(o);
611
587
  }, []), e;
612
- }, Zt = (e) => {
613
- const t = Kt();
588
+ }, Xn = (e) => {
589
+ const t = Zn();
614
590
  return /* @__PURE__ */ n(g, { fontSize: "xs", ...e, children: t.toLocaleTimeString(navigator.language, {
615
591
  hour: "2-digit",
616
592
  minute: "2-digit"
617
593
  }) });
618
- }, fe = () => {
594
+ }, me = () => {
619
595
  const { quickMenuSignal: e } = X();
620
596
  return [He(e), e.setValue, e];
621
- }, Xt = () => {
622
- const [e] = fe();
597
+ }, Jn = () => {
598
+ const [e] = me();
623
599
  return /* @__PURE__ */ n(
624
- A,
600
+ R,
625
601
  {
626
602
  position: "absolute",
627
603
  left: 0,
628
604
  bottom: 0,
629
605
  p: 2,
630
606
  color: e ? void 0 : "colorPalette.contrast",
631
- children: /* @__PURE__ */ n(Zt, {})
607
+ children: /* @__PURE__ */ n(Xn, {})
632
608
  }
633
609
  );
634
- }, Jt = () => {
610
+ }, et = () => {
635
611
  const e = p();
636
- B(
637
- () => e == null ? void 0 : e.links$.subscribe((t) => {
638
- if (t.type === "click" && ut(t.target, "a")) {
612
+ D(
613
+ () => e?.links$.subscribe((t) => {
614
+ if (t.type === "click" && hn(t.target, "a")) {
639
615
  if (!t.target.href) return;
640
616
  const o = new URL(t.target.href);
641
617
  window.location.host !== o.host && confirm(
@@ -645,12 +621,12 @@ const jt = (e, t, o) => {
645
621
  }),
646
622
  [e]
647
623
  );
648
- }, en = () => {
624
+ }, nt = () => {
649
625
  const e = p(), { notificationsSubject: t } = X();
650
- B(
651
- () => e == null ? void 0 : e.zoom.isZooming$.pipe(
652
- D((o) => {
653
- if (!o) return le;
626
+ D(
627
+ () => e?.zoom.isZooming$.pipe(
628
+ A((o) => {
629
+ if (!o) return se;
654
630
  const i = new de();
655
631
  return t.next({
656
632
  key: "zoom",
@@ -666,13 +642,13 @@ const jt = (e, t, o) => {
666
642
  ),
667
643
  [e]
668
644
  );
669
- }, tn = () => {
645
+ }, tt = () => {
670
646
  const e = p(), { notificationsSubject: t } = X();
671
- B(
672
- () => e == null ? void 0 : e.settings.values$.pipe(
673
- M(({ fontScale: o }) => o),
647
+ D(
648
+ () => e?.settings.values$.pipe(
649
+ z(({ fontScale: o }) => o),
674
650
  he(),
675
- Pe(1),
651
+ Re(1),
676
652
  ue((o) => {
677
653
  t.next({
678
654
  key: "fontScaleChange",
@@ -683,53 +659,53 @@ const jt = (e, t, o) => {
683
659
  ),
684
660
  [e, t]
685
661
  );
686
- }, nn = () => {
662
+ }, ot = () => {
687
663
  const { notificationsSubject: e } = X();
688
- tn(), en(), B(
664
+ tt(), nt(), D(
689
665
  () => e.pipe(
690
- J(ke),
666
+ J(ye),
691
667
  Ge((t) => {
692
- const o = t.duration ?? 3e3, i = ae.create({
668
+ const o = t.duration ?? 3e3, i = le.create({
693
669
  title: t.title,
694
670
  description: t.description,
695
671
  duration: o
696
672
  }), r = e.pipe(
697
- Pe(1),
698
- J((s) => !!t.key && (s == null ? void 0 : s.key) === t.key)
673
+ Re(1),
674
+ J((a) => !!t.key && a?.key === t.key)
699
675
  );
700
- return Re(
676
+ return Pe(
701
677
  Ae(o),
702
678
  t.abort ?? re,
703
679
  r
704
680
  ).pipe(
705
681
  Te(),
706
682
  we(() => {
707
- ae.dismiss(i);
683
+ le.dismiss(i);
708
684
  })
709
685
  );
710
686
  })
711
687
  ),
712
688
  [e]
713
689
  );
714
- }, on = E.forwardRef(
690
+ }, rt = E.forwardRef(
715
691
  function(t, o) {
716
692
  const {
717
693
  showArrow: i,
718
694
  children: r,
719
- portalled: s = !0,
720
- content: a,
721
- portalRef: d,
695
+ portalled: a = !0,
696
+ content: l,
697
+ portalRef: c,
722
698
  ...u
723
699
  } = t;
724
- return /* @__PURE__ */ c(
725
- $.Root,
700
+ return /* @__PURE__ */ s(
701
+ L.Root,
726
702
  {
727
703
  ...u,
728
704
  positioning: { ...u.positioning, gutter: 4 },
729
705
  children: [
730
- /* @__PURE__ */ n($.Trigger, { asChild: !0, children: r }),
731
- /* @__PURE__ */ n(ge, { disabled: !s, container: d, children: /* @__PURE__ */ n($.Positioner, { children: /* @__PURE__ */ c(
732
- $.Content,
706
+ /* @__PURE__ */ n(L.Trigger, { asChild: !0, children: r }),
707
+ /* @__PURE__ */ n(ge, { disabled: !a, container: c, children: /* @__PURE__ */ n(L.Positioner, { children: /* @__PURE__ */ s(
708
+ L.Content,
733
709
  {
734
710
  width: "auto",
735
711
  px: "2",
@@ -738,8 +714,8 @@ const jt = (e, t, o) => {
738
714
  rounded: "sm",
739
715
  ref: o,
740
716
  children: [
741
- i && /* @__PURE__ */ n($.Arrow, { children: /* @__PURE__ */ n($.ArrowTip, {}) }),
742
- a
717
+ i && /* @__PURE__ */ n(L.Arrow, { children: /* @__PURE__ */ n(L.ArrowTip, {}) }),
718
+ l
743
719
  ]
744
720
  }
745
721
  ) }) })
@@ -747,77 +723,77 @@ const jt = (e, t, o) => {
747
723
  }
748
724
  );
749
725
  }
750
- ), rn = E.forwardRef(function(t, o) {
726
+ ), it = E.forwardRef(function(t, o) {
751
727
  const { children: i, ...r } = t;
752
- return /* @__PURE__ */ n(on, { content: i, ...r, ref: o, children: /* @__PURE__ */ n(
753
- I,
728
+ return /* @__PURE__ */ n(rt, { content: i, ...r, ref: o, children: /* @__PURE__ */ n(
729
+ v,
754
730
  {
755
731
  variant: "ghost",
756
732
  "aria-label": "info",
757
733
  size: "2xs",
758
734
  colorPalette: "gray",
759
- children: /* @__PURE__ */ n(xt, {})
735
+ children: /* @__PURE__ */ n(vn, {})
760
736
  }
761
737
  ) });
762
- }), sn = E.forwardRef(function(t, o) {
738
+ }), at = E.forwardRef(function(t, o) {
763
739
  return /* @__PURE__ */ n(H.Track, { ...t, ref: o, children: /* @__PURE__ */ n(H.Range, {}) });
764
740
  });
765
741
  E.forwardRef(function(t, o) {
766
- const { children: i, info: r, ...s } = t;
767
- return /* @__PURE__ */ c(H.Label, { ...s, ref: o, children: [
742
+ const { children: i, info: r, ...a } = t;
743
+ return /* @__PURE__ */ s(H.Label, { ...a, ref: o, children: [
768
744
  i,
769
- r && /* @__PURE__ */ n(rn, { children: r })
745
+ r && /* @__PURE__ */ n(it, { children: r })
770
746
  ] });
771
747
  });
772
- const ln = H.Root, an = H.ValueText, me = () => {
773
- const e = _(), t = (e == null ? void 0 : e.numberOfTotalPages) === 1, o = ((e == null ? void 0 : e.beginNumberOfPagesInSpineItem) ?? 0) > 1, i = ((e == null ? void 0 : e.endNumberOfPagesInSpineItem) ?? 0) > 1, r = (e != null && e.hasChapters ? e == null ? void 0 : e.beginPageIndexInSpineItem : e == null ? void 0 : e.beginAbsolutePageIndex) ?? 0, s = (e != null && e.hasChapters ? e == null ? void 0 : e.endPageIndexInSpineItem : e == null ? void 0 : e.endAbsolutePageIndex) ?? 0, [a = 0, d = 0] = [
748
+ const st = H.Root, lt = H.ValueText, fe = () => {
749
+ const e = $(), t = e?.numberOfTotalPages === 1, o = (e?.beginNumberOfPagesInSpineItem ?? 0) > 1, i = (e?.endNumberOfPagesInSpineItem ?? 0) > 1, r = (e?.hasChapters ? e?.beginPageIndexInSpineItem : e?.beginAbsolutePageIndex) ?? 0, a = (e?.hasChapters ? e?.endPageIndexInSpineItem : e?.endAbsolutePageIndex) ?? 0, [l = 0, c = 0] = [
774
750
  r,
775
- s
776
- ].sort((x, h) => x - 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), l = e != null && e.hasChapters ? e == null ? void 0 : e.beginNumberOfPagesInSpineItem : e == null ? void 0 : e.numberOfTotalPages;
751
+ a
752
+ ].sort((b, h) => b - h), u = e?.beginPageIndexInSpineItem !== e?.endPageIndexInSpineItem || e?.beginSpineItemIndex !== e?.endSpineItemIndex, d = e?.hasChapters ? e?.beginNumberOfPagesInSpineItem : e?.numberOfTotalPages;
777
753
  return {
778
754
  hasOnlyOnePage: t,
779
755
  beginPageIndex: r,
780
- endPageIndex: s,
756
+ endPageIndex: a,
781
757
  isBeginWithinChapter: o,
782
758
  isEndWithinChapter: i,
783
759
  beginAndEndAreDifferent: u,
784
- totalApproximatePages: l,
785
- leftPageIndex: a,
786
- rightPageIndex: d
760
+ totalApproximatePages: d,
761
+ leftPageIndex: l,
762
+ rightPageIndex: c
787
763
  };
788
- }, cn = () => {
789
- const e = _(), {
764
+ }, ct = () => {
765
+ const e = $(), {
790
766
  hasOnlyOnePage: t,
791
767
  leftPageIndex: o,
792
768
  rightPageIndex: i,
793
769
  totalApproximatePages: r,
794
- beginAndEndAreDifferent: s
795
- } = me(), a = Math.round(((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100), d = (l) => l != null && l.subChapter ? `${l.title} / ${d(l.subChapter)}` : (l == null ? void 0 : l.title) || "", u = d(e == null ? void 0 : e.beginChapterInfo);
796
- return /* @__PURE__ */ c(P, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
797
- /* @__PURE__ */ n(ln, { value: a, size: "xs", width: 150, children: /* @__PURE__ */ c(z, { justifyContent: "space-between", children: [
798
- /* @__PURE__ */ n(sn, { width: 110 }),
799
- /* @__PURE__ */ n(an, { children: `${a}%` })
770
+ beginAndEndAreDifferent: a
771
+ } = fe(), l = Math.round((e?.percentageEstimateOfBook ?? 0) * 100), c = (d) => d?.subChapter ? `${d.title} / ${c(d.subChapter)}` : d?.title || "", u = c(e?.beginChapterInfo);
772
+ return /* @__PURE__ */ s(T, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
773
+ /* @__PURE__ */ n(st, { value: l, size: "xs", width: 150, children: /* @__PURE__ */ s(O, { justifyContent: "space-between", children: [
774
+ /* @__PURE__ */ n(at, { width: 110 }),
775
+ /* @__PURE__ */ n(lt, { children: `${l}%` })
800
776
  ] }) }),
801
777
  /* @__PURE__ */ n(g, { truncate: !0, maxWidth: "100%", fontSize: "sm", mt: 1, children: u ? `Chapter: ${u}` : " " }),
802
- !t && /* @__PURE__ */ c(z, { children: [
803
- /* @__PURE__ */ n(g, { fontSize: "xs", children: s ? `${o + 1} - ${i + 1} of ${r}` : `${o + 1} of ${r}` }),
804
- !!(e != null && e.hasChapters) && /* @__PURE__ */ c(oe, { children: [
778
+ !t && /* @__PURE__ */ s(O, { children: [
779
+ /* @__PURE__ */ n(g, { fontSize: "xs", children: a ? `${o + 1} - ${i + 1} of ${r}` : `${o + 1} of ${r}` }),
780
+ !!e?.hasChapters && /* @__PURE__ */ s(oe, { children: [
805
781
  /* @__PURE__ */ n(g, { children: "-" }),
806
- /* @__PURE__ */ c(g, { fontSize: "xs", children: [
782
+ /* @__PURE__ */ s(g, { fontSize: "xs", children: [
807
783
  "(",
808
- ((e == null ? void 0 : e.beginAbsolutePageIndex) ?? 0) + 1,
784
+ (e?.beginAbsolutePageIndex ?? 0) + 1,
809
785
  ")"
810
786
  ] })
811
787
  ] })
812
788
  ] })
813
789
  ] });
814
- }, Be = f(
790
+ }, Be = m(
815
791
  ({
816
792
  children: e,
817
793
  position: t,
818
794
  ...o
819
795
  }) => /* @__PURE__ */ n(
820
- te,
796
+ ne,
821
797
  {
822
798
  display: "flex",
823
799
  flexDirection: "row",
@@ -841,8 +817,8 @@ const ln = H.Root, an = H.ValueText, me = () => {
841
817
  children: e
842
818
  }
843
819
  )
844
- ), dn = Ke(vt), un = f((e) => /* @__PURE__ */ n(
845
- A,
820
+ ), dt = Ke(Cn), ut = m((e) => /* @__PURE__ */ n(
821
+ R,
846
822
  {
847
823
  display: "contents",
848
824
  css: {
@@ -851,7 +827,7 @@ const ln = H.Root, an = H.ValueText, me = () => {
851
827
  "--color-solid": "colors.colorPalette.solid"
852
828
  },
853
829
  children: /* @__PURE__ */ n(
854
- dn,
830
+ dt,
855
831
  {
856
832
  keyboard: !1,
857
833
  style: {
@@ -895,65 +871,65 @@ const ln = H.Root, an = H.ValueText, me = () => {
895
871
  }
896
872
  )
897
873
  }
898
- )), hn = () => {
899
- const e = _(), t = e == null ? void 0 : e.isUsingSpread, { beginPageIndex: o, totalApproximatePages: i = 0 } = me(), r = t ? Math.floor((o || 0) / 2) : o, [s, a] = Se(
874
+ )), ht = () => {
875
+ const t = $()?.isUsingSpread, { beginPageIndex: o, totalApproximatePages: i = 0 } = fe(), r = t ? Math.floor((o || 0) / 2) : o, [a, l] = ke(
900
876
  () => ce({
901
877
  default: r || 0
902
878
  })
903
- ), d = 0, u = Math.max(
879
+ ), c = 0, u = Math.max(
904
880
  0,
905
881
  t ? Math.floor((i - 1) / 2) : i - 1
906
882
  );
907
- return W(() => {
908
- a.update(r || 0);
909
- }, [r, a]), {
910
- value: s,
911
- valueSignal: a,
912
- min: d,
883
+ return F(() => {
884
+ l.update(r || 0);
885
+ }, [r, l]), {
886
+ value: a,
887
+ valueSignal: l,
888
+ min: c,
913
889
  max: u
914
890
  };
915
- }, gn = (e) => {
916
- const t = p(), o = _(), { manifest: i } = b(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, r = (i == null ? void 0 : i.readingDirection) === "rtl", s = o == null ? void 0 : o.isUsingSpread, { totalApproximatePages: a = 0, isBeginWithinChapter: d } = me(), u = 1, l = d, { value: x, valueSignal: h, min: m, max: S } = hn(), C = N(
917
- (R) => {
918
- const [v = 0] = Array.isArray(R) ? R : [R];
919
- h.setValue(v);
920
- const be = s ? Math.floor(v) * 2 : Math.floor(v);
921
- l ? t == null || t.navigation.goToPageOfSpineItem({
891
+ }, gt = (e) => {
892
+ const t = p(), o = $(), { manifest: i } = f(() => t?.context.state$, [t]) ?? {}, r = i?.readingDirection === "rtl", a = o?.isUsingSpread, { totalApproximatePages: l = 0, isBeginWithinChapter: c } = fe(), u = 1, d = c, { value: b, valueSignal: h, min: x, max: S } = ht(), w = N(
893
+ (_) => {
894
+ const [C = 0] = Array.isArray(_) ? _ : [_];
895
+ h.setValue(C);
896
+ const be = a ? Math.floor(C) * 2 : Math.floor(C);
897
+ d ? t?.navigation.goToPageOfSpineItem({
922
898
  pageIndex: be,
923
899
  spineItemId: t.pagination.state.beginSpineItemIndex ?? 0,
924
900
  animation: !1
925
- }) : t == null || t.navigation.goToAbsolutePageIndex({
901
+ }) : t?.navigation.goToAbsolutePageIndex({
926
902
  absolutePageIndex: be,
927
903
  animation: !1
928
904
  });
929
905
  },
930
- [t, s, h, l]
906
+ [t, a, h, d]
931
907
  );
932
- return B(
933
- () => t == null ? void 0 : t.navigation.throttleLock({
908
+ return D(
909
+ () => t?.navigation.throttleLock({
934
910
  duration: 100,
935
911
  trigger: h.subject
936
912
  }),
937
913
  [t, h]
938
- ), a === 1 || s && a === 2 ? /* @__PURE__ */ n(A, { style: e.style }) : /* @__PURE__ */ n(
939
- un,
914
+ ), l === 1 || a && l === 2 ? /* @__PURE__ */ n(R, { style: e.style }) : /* @__PURE__ */ n(
915
+ ut,
940
916
  {
941
- value: [x],
917
+ value: [b],
942
918
  max: S,
943
- min: m,
919
+ min: x,
944
920
  reverse: r,
945
921
  step: u,
946
- onChange: C,
922
+ onChange: w,
947
923
  ...e
948
924
  }
949
925
  );
950
- }, pn = f(
926
+ }, pt = m(
951
927
  ({
952
928
  open: e,
953
929
  onItemClick: t
954
930
  }) => {
955
- const o = p(), i = b(() => o == null ? void 0 : o.navigation.state$, [o]), r = b(() => o == null ? void 0 : o.settings.values$, [o]), s = (r == null ? void 0 : r.computedPageTurnDirection) === "vertical", [a, d] = T(!0);
956
- return /* @__PURE__ */ c(
931
+ const o = p(), i = f(() => o?.navigation.state$, [o]), a = f(() => o?.settings.values$, [o])?.computedPageTurnDirection === "vertical", [l, c] = k(!0);
932
+ return /* @__PURE__ */ s(
957
933
  Be,
958
934
  {
959
935
  present: e,
@@ -963,8 +939,8 @@ const ln = H.Root, an = H.ValueText, me = () => {
963
939
  overflow: "auto",
964
940
  pb: 8,
965
941
  children: [
966
- /* @__PURE__ */ c(
967
- z,
942
+ /* @__PURE__ */ s(
943
+ O,
968
944
  {
969
945
  flex: 1,
970
946
  alignItems: "center",
@@ -972,19 +948,19 @@ const ln = H.Root, an = H.ValueText, me = () => {
972
948
  maxWidth: "100%",
973
949
  children: [
974
950
  /* @__PURE__ */ n(
975
- I,
951
+ v,
976
952
  {
977
953
  "aria-label": "left",
978
954
  size: "lg",
979
955
  variant: "ghost",
980
956
  flexShrink: 0,
981
- onClick: () => o == null ? void 0 : o.navigation.goToLeftOrTopSpineItem(),
982
- disabled: !(i != null && i.canGoLeftSpineItem) && !(i != null && i.canGoTopSpineItem),
983
- children: s ? /* @__PURE__ */ n(pt, {}) : /* @__PURE__ */ n(ft, {})
957
+ onClick: () => o?.navigation.goToLeftOrTopSpineItem(),
958
+ disabled: !i?.canGoLeftSpineItem && !i?.canGoTopSpineItem,
959
+ children: a ? /* @__PURE__ */ n(mn, {}) : /* @__PURE__ */ n(fn, {})
984
960
  }
985
961
  ),
986
- /* @__PURE__ */ c(
987
- P,
962
+ /* @__PURE__ */ s(
963
+ T,
988
964
  {
989
965
  flex: 1,
990
966
  maxW: 400,
@@ -993,9 +969,9 @@ const ln = H.Root, an = H.ValueText, me = () => {
993
969
  overflow: "auto",
994
970
  px: 4,
995
971
  children: [
996
- /* @__PURE__ */ n(cn, {}),
972
+ /* @__PURE__ */ n(ct, {}),
997
973
  /* @__PURE__ */ n(
998
- gn,
974
+ gt,
999
975
  {
1000
976
  style: {
1001
977
  width: "100%",
@@ -1008,121 +984,121 @@ const ln = H.Root, an = H.ValueText, me = () => {
1008
984
  }
1009
985
  ),
1010
986
  /* @__PURE__ */ n(
1011
- I,
987
+ v,
1012
988
  {
1013
989
  "aria-label": "right",
1014
990
  size: "lg",
1015
991
  flexShrink: 0,
1016
992
  variant: "ghost",
1017
- disabled: !(i != null && i.canGoRightSpineItem) && !(i != null && i.canGoBottomSpineItem),
993
+ disabled: !i?.canGoRightSpineItem && !i?.canGoBottomSpineItem,
1018
994
  onClick: () => {
1019
- o == null || o.navigation.goToRightOrBottomSpineItem();
995
+ o?.navigation.goToRightOrBottomSpineItem();
1020
996
  },
1021
- children: s ? /* @__PURE__ */ n(mt, {}) : /* @__PURE__ */ n(bt, {})
997
+ children: a ? /* @__PURE__ */ n(bn, {}) : /* @__PURE__ */ n(xn, {})
1022
998
  }
1023
999
  )
1024
1000
  ]
1025
1001
  }
1026
1002
  ),
1027
- /* @__PURE__ */ n(z, { alignSelf: "stretch", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ c(
1028
- se.Root,
1003
+ /* @__PURE__ */ n(O, { alignSelf: "stretch", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ s(
1004
+ ae.Root,
1029
1005
  {
1030
- open: a,
1006
+ open: l,
1031
1007
  flex: 1,
1032
1008
  onOpenChange: ({ open: u }) => {
1033
- d(u);
1009
+ c(u);
1034
1010
  },
1035
1011
  children: [
1036
1012
  /* @__PURE__ */ n(
1037
- se.Trigger,
1013
+ ae.Trigger,
1038
1014
  {
1039
1015
  paddingY: "3",
1040
1016
  width: "100%",
1041
1017
  display: "flex",
1042
1018
  justifyContent: "center",
1043
1019
  children: /* @__PURE__ */ n(
1044
- nt,
1020
+ tn,
1045
1021
  {
1046
1022
  style: {
1047
- transform: a ? "rotate(0deg)" : "rotate(180deg)"
1023
+ transform: l ? "rotate(0deg)" : "rotate(180deg)"
1048
1024
  }
1049
1025
  }
1050
1026
  )
1051
1027
  }
1052
1028
  ),
1053
- /* @__PURE__ */ c(se.Content, { display: "flex", justifyContent: "center", children: [
1029
+ /* @__PURE__ */ s(ae.Content, { display: "flex", justifyContent: "center", children: [
1054
1030
  /* @__PURE__ */ n(
1055
- I,
1031
+ v,
1056
1032
  {
1057
1033
  "aria-label": "Help",
1058
1034
  size: "lg",
1059
1035
  variant: "ghost",
1060
1036
  onClick: () => t("help"),
1061
- children: /* @__PURE__ */ n(ot, {})
1037
+ children: /* @__PURE__ */ n(on, {})
1062
1038
  }
1063
1039
  ),
1064
1040
  /* @__PURE__ */ n(
1065
- I,
1041
+ v,
1066
1042
  {
1067
1043
  "aria-label": "Table of contents",
1068
1044
  size: "lg",
1069
1045
  variant: "ghost",
1070
1046
  onClick: () => t("toc"),
1071
- children: /* @__PURE__ */ n(rt, {})
1047
+ children: /* @__PURE__ */ n(rn, {})
1072
1048
  }
1073
1049
  ),
1074
- De(o) && /* @__PURE__ */ n(
1075
- I,
1050
+ Ee(o) && /* @__PURE__ */ n(
1051
+ v,
1076
1052
  {
1077
1053
  "aria-label": "Search",
1078
1054
  size: "lg",
1079
1055
  variant: "ghost",
1080
1056
  onClick: () => t("search"),
1081
- children: /* @__PURE__ */ n(it, {})
1057
+ children: /* @__PURE__ */ n(an, {})
1082
1058
  }
1083
1059
  ),
1084
- F(o) && /* @__PURE__ */ n(
1085
- I,
1060
+ W(o) && /* @__PURE__ */ n(
1061
+ v,
1086
1062
  {
1087
1063
  "aria-label": "Bookmarks",
1088
1064
  size: "lg",
1089
1065
  variant: "ghost",
1090
1066
  onClick: () => t("bookmarks"),
1091
- children: /* @__PURE__ */ n(ht, {})
1067
+ children: /* @__PURE__ */ n(gn, {})
1092
1068
  }
1093
1069
  ),
1094
- F(o) && /* @__PURE__ */ n(
1095
- I,
1070
+ W(o) && /* @__PURE__ */ n(
1071
+ v,
1096
1072
  {
1097
1073
  "aria-label": "Annotations",
1098
1074
  size: "lg",
1099
1075
  variant: "ghost",
1100
1076
  onClick: () => t("annotations"),
1101
- children: /* @__PURE__ */ n(ne, {})
1077
+ children: /* @__PURE__ */ n(te, {})
1102
1078
  }
1103
1079
  ),
1104
1080
  /* @__PURE__ */ n(
1105
- I,
1081
+ v,
1106
1082
  {
1107
1083
  "aria-label": "Thumbnails",
1108
1084
  size: "lg",
1109
- variant: (o == null ? void 0 : o.settings.values.viewportMode) === "thumbnails" ? "solid" : "ghost",
1085
+ variant: o?.settings.values.viewportMode === "thumbnails" ? "solid" : "ghost",
1110
1086
  onClick: () => {
1111
- o == null || o.settings.update({
1112
- viewportMode: (o == null ? void 0 : o.settings.values.viewportMode) === "normal" ? "thumbnails" : "normal"
1087
+ o?.settings.update({
1088
+ viewportMode: o?.settings.values.viewportMode === "normal" ? "thumbnails" : "normal"
1113
1089
  });
1114
1090
  },
1115
- children: /* @__PURE__ */ n(st, {})
1091
+ children: /* @__PURE__ */ n(sn, {})
1116
1092
  }
1117
1093
  ),
1118
- ze(o) && /* @__PURE__ */ n(
1119
- I,
1094
+ De(o) && /* @__PURE__ */ n(
1095
+ v,
1120
1096
  {
1121
1097
  "aria-label": "Gallery",
1122
1098
  size: "lg",
1123
1099
  variant: "ghost",
1124
1100
  onClick: () => t("gallery"),
1125
- children: /* @__PURE__ */ n(gt, {})
1101
+ children: /* @__PURE__ */ n(pn, {})
1126
1102
  }
1127
1103
  )
1128
1104
  ] })
@@ -1133,13 +1109,13 @@ const ln = H.Root, an = H.ValueText, me = () => {
1133
1109
  }
1134
1110
  );
1135
1111
  }
1136
- ), fn = () => {
1137
- const [e, t] = T(!1), o = N(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
1112
+ ), mt = () => {
1113
+ const [e, t] = k(!1), o = N(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
1138
1114
  t(!1);
1139
1115
  }) : document.documentElement.requestFullscreen({ navigationUI: "hide" }).catch(console.error).then(() => {
1140
1116
  t(!0);
1141
1117
  }), []);
1142
- return W(() => {
1118
+ return F(() => {
1143
1119
  function i() {
1144
1120
  t(!!document.fullscreenElement);
1145
1121
  }
@@ -1150,13 +1126,13 @@ const ln = H.Root, an = H.ValueText, me = () => {
1150
1126
  isFullscreen: e,
1151
1127
  onToggleFullscreenClick: o
1152
1128
  };
1153
- }, mn = f(
1129
+ }, ft = m(
1154
1130
  ({
1155
1131
  open: e,
1156
1132
  onItemClick: t
1157
1133
  }) => {
1158
- const o = p(), i = b(() => o == null ? void 0 : o.context.manifest$, [o]), { isFullscreen: r, onToggleFullscreenClick: s } = fn();
1159
- return /* @__PURE__ */ c(
1134
+ const o = p(), i = f(() => o?.context.manifest$, [o]), { isFullscreen: r, onToggleFullscreenClick: a } = mt();
1135
+ return /* @__PURE__ */ s(
1160
1136
  Be,
1161
1137
  {
1162
1138
  present: e,
@@ -1165,18 +1141,18 @@ const ln = H.Root, an = H.ValueText, me = () => {
1165
1141
  justifyContent: "space-between",
1166
1142
  children: [
1167
1143
  /* @__PURE__ */ n(
1168
- I,
1144
+ v,
1169
1145
  {
1170
1146
  "aria-label": "left",
1171
1147
  size: "lg",
1172
1148
  variant: "ghost",
1173
1149
  flexShrink: 0,
1174
1150
  onClick: () => t("back"),
1175
- children: /* @__PURE__ */ n(Ct, {})
1151
+ children: /* @__PURE__ */ n(In, {})
1176
1152
  }
1177
1153
  ),
1178
1154
  /* @__PURE__ */ n(
1179
- P,
1155
+ T,
1180
1156
  {
1181
1157
  flex: 1,
1182
1158
  maxW: 600,
@@ -1184,30 +1160,30 @@ const ln = H.Root, an = H.ValueText, me = () => {
1184
1160
  alignItems: "center",
1185
1161
  overflow: "auto",
1186
1162
  px: 4,
1187
- children: /* @__PURE__ */ n(g, { truncate: !0, maxWidth: "100%", children: i == null ? void 0 : i.title })
1163
+ children: /* @__PURE__ */ n(g, { truncate: !0, maxWidth: "100%", children: i?.title })
1188
1164
  }
1189
1165
  ),
1190
- /* @__PURE__ */ c(z, { children: [
1166
+ /* @__PURE__ */ s(O, { children: [
1191
1167
  /* @__PURE__ */ n(
1192
- I,
1168
+ v,
1193
1169
  {
1194
1170
  "aria-label": "right",
1195
1171
  size: "lg",
1196
1172
  flexShrink: 0,
1197
1173
  variant: "ghost",
1198
1174
  onClick: () => t("more"),
1199
- children: /* @__PURE__ */ n(It, {})
1175
+ children: /* @__PURE__ */ n(kn, {})
1200
1176
  }
1201
1177
  ),
1202
1178
  /* @__PURE__ */ n(
1203
- I,
1179
+ v,
1204
1180
  {
1205
1181
  "aria-label": "right",
1206
1182
  size: "lg",
1207
1183
  flexShrink: 0,
1208
1184
  variant: "ghost",
1209
- onClick: s,
1210
- children: r ? /* @__PURE__ */ n(St, {}) : /* @__PURE__ */ n(yt, {})
1185
+ onClick: a,
1186
+ children: r ? /* @__PURE__ */ n(Sn, {}) : /* @__PURE__ */ n(yn, {})
1211
1187
  }
1212
1188
  )
1213
1189
  ] })
@@ -1215,26 +1191,26 @@ const ln = H.Root, an = H.ValueText, me = () => {
1215
1191
  }
1216
1192
  );
1217
1193
  }
1218
- ), bn = f(
1194
+ ), bt = m(
1219
1195
  ({
1220
1196
  onItemClick: e
1221
1197
  }) => {
1222
- const [t] = fe();
1223
- return /* @__PURE__ */ c(oe, { children: [
1224
- /* @__PURE__ */ n(mn, { open: t, onItemClick: e }),
1225
- /* @__PURE__ */ n(pn, { open: t, onItemClick: e })
1198
+ const [t] = me();
1199
+ return /* @__PURE__ */ s(oe, { children: [
1200
+ /* @__PURE__ */ n(ft, { open: t, onItemClick: e }),
1201
+ /* @__PURE__ */ n(pt, { open: t, onItemClick: e })
1226
1202
  ] });
1227
1203
  }
1228
- ), xn = f(
1204
+ ), xt = m(
1229
1205
  ({
1230
1206
  contextText: e = "",
1231
1207
  startOffset: t = 0,
1232
1208
  text: o,
1233
1209
  cfi: i = "#",
1234
1210
  onClick: r,
1235
- absolutePageIndex: s
1211
+ absolutePageIndex: a
1236
1212
  }) => {
1237
- const d = e.substring(
1213
+ const c = e.substring(
1238
1214
  Math.max(t - 15, 0),
1239
1215
  Math.max(t, 0)
1240
1216
  ), u = e.substring(
@@ -1244,43 +1220,43 @@ const ln = H.Root, an = H.ValueText, me = () => {
1244
1220
  e.length - 1
1245
1221
  )
1246
1222
  );
1247
- return /* @__PURE__ */ c(
1223
+ return /* @__PURE__ */ s(
1248
1224
  pe,
1249
1225
  {
1250
1226
  href: i,
1251
1227
  style: { margin: 5, overflow: "hidden" },
1252
- onClick: (l) => {
1253
- l.preventDefault(), r(i);
1228
+ onClick: (d) => {
1229
+ d.preventDefault(), r(i);
1254
1230
  },
1255
1231
  display: "flex",
1256
1232
  flexDirection: "column",
1257
1233
  alignItems: "flex-start",
1258
1234
  gap: 0,
1259
1235
  children: [
1260
- /* @__PURE__ */ c(g, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
1236
+ /* @__PURE__ */ s(g, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
1261
1237
  '"',
1262
- d,
1238
+ c,
1263
1239
  /* @__PURE__ */ n("b", { children: o }),
1264
1240
  u,
1265
1241
  '"'
1266
1242
  ] }),
1267
- /* @__PURE__ */ n(g, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${s !== void 0 ? s + 1 : "unknown (not loaded)"}` })
1243
+ /* @__PURE__ */ n(g, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${a !== void 0 ? a + 1 : "unknown (not loaded)"}` })
1268
1244
  ]
1269
1245
  }
1270
1246
  );
1271
1247
  }
1272
- ), vn = 500, Cn = () => {
1273
- const e = ye(() => new Ye("")), t = b(e), o = p(), i = De(o) ? o : void 0, r = b(() => e.pipe(
1248
+ ), vt = 500, Ct = () => {
1249
+ const e = Se(() => new Ye("")), t = f(e), o = p(), i = Ee(o) ? o : void 0, r = f(() => e.pipe(
1274
1250
  he(),
1275
- D(
1276
- (s) => s === "" || !i ? ee(void 0) : Re(
1251
+ A(
1252
+ (a) => a === "" || !i ? ee(void 0) : Pe(
1277
1253
  ee({
1278
1254
  type: "start",
1279
1255
  data: void 0
1280
1256
  }),
1281
- Ae(vn).pipe(
1282
- D(() => i.search.search(s)),
1283
- M((a) => ({ type: "end", data: a }))
1257
+ Ae(vt).pipe(
1258
+ A(() => i.search.search(a)),
1259
+ z((l) => ({ type: "end", data: l }))
1284
1260
  )
1285
1261
  )
1286
1262
  )
@@ -1288,31 +1264,29 @@ const ln = H.Root, an = H.ValueText, me = () => {
1288
1264
  return {
1289
1265
  value: t,
1290
1266
  setValue: e.next.bind(e),
1291
- status: (r == null ? void 0 : r.type) ?? "idle",
1292
- data: r == null ? void 0 : r.data
1267
+ status: r?.type ?? "idle",
1268
+ data: r?.data
1293
1269
  };
1294
- }, In = f(
1295
- ({
1296
- onNavigate: e
1297
- }) => {
1298
- const t = p(), { value: o, setValue: i, status: r, data: s } = Cn(), a = (l) => {
1299
- i(l.target.value);
1300
- }, d = N(
1301
- (l) => {
1302
- e(), t == null || t.navigation.goToCfi(l);
1270
+ }, It = m(
1271
+ ({ onNavigate: e }) => {
1272
+ const t = p(), { value: o, setValue: i, status: r, data: a } = Ct(), l = (d) => {
1273
+ i(d.target.value);
1274
+ }, c = N(
1275
+ (d) => {
1276
+ e(), t?.navigation.goToCfi(d);
1303
1277
  },
1304
1278
  [t, e]
1305
- ), u = b(
1306
- () => t == null ? void 0 : t.locateResource((s == null ? void 0 : s.slice(0, 100)) ?? []),
1307
- [s]
1279
+ ), u = f(
1280
+ () => t?.locateResource(a?.slice(0, 100) ?? []),
1281
+ [a]
1308
1282
  );
1309
- return /* @__PURE__ */ c(P, { flex: 1, height: "100%", gap: 2, children: [
1283
+ return /* @__PURE__ */ s(T, { flex: 1, height: "100%", gap: 2, children: [
1310
1284
  /* @__PURE__ */ n(
1311
1285
  Ze,
1312
1286
  {
1313
1287
  placeholder: "Type something...",
1314
1288
  value: o,
1315
- onChange: a,
1289
+ onChange: l,
1316
1290
  flexShrink: 0,
1317
1291
  variant: "subtle",
1318
1292
  name: "search",
@@ -1322,8 +1296,8 @@ const ln = H.Root, an = H.ValueText, me = () => {
1322
1296
  focusRingColor: "transparent"
1323
1297
  }
1324
1298
  ),
1325
- /* @__PURE__ */ c(
1326
- P,
1299
+ /* @__PURE__ */ s(
1300
+ T,
1327
1301
  {
1328
1302
  style: { overflow: "hidden", overflowY: "auto" },
1329
1303
  overflow: "auto",
@@ -1331,35 +1305,32 @@ const ln = H.Root, an = H.ValueText, me = () => {
1331
1305
  flex: 1,
1332
1306
  children: [
1333
1307
  r === "start" && /* @__PURE__ */ n(g, { children: "Searching ..." }),
1334
- (s == null ? void 0 : s.length) === 0 && /* @__PURE__ */ n(g, { children: "No results" }),
1335
- r === "end" && ((s == null ? void 0 : s.length) ?? 0) > 0 && /* @__PURE__ */ c(P, { children: [
1336
- /* @__PURE__ */ c(g, { fontSize: "md", children: [
1337
- s == null ? void 0 : s.length,
1308
+ a?.length === 0 && /* @__PURE__ */ n(g, { children: "No results" }),
1309
+ r === "end" && (a?.length ?? 0) > 0 && /* @__PURE__ */ s(T, { children: [
1310
+ /* @__PURE__ */ s(g, { fontSize: "md", children: [
1311
+ a?.length,
1338
1312
  " result(s)"
1339
1313
  ] }),
1340
- /* @__PURE__ */ n(P, { gap: 0, children: u == null ? void 0 : u.map((l, x) => {
1341
- var h, m, S, C, k, R, v;
1342
- return /* @__PURE__ */ n(
1343
- xn,
1344
- {
1345
- contextText: ((S = (m = (h = l.meta) == null ? void 0 : h.range) == null ? void 0 : m.startContainer.parentElement) == null ? void 0 : S.textContent) ?? "",
1346
- pageIndex: (C = l.meta) == null ? void 0 : C.itemPageIndex,
1347
- startOffset: ((R = (k = l.meta) == null ? void 0 : k.range) == null ? void 0 : R.startOffset) ?? 0,
1348
- text: o,
1349
- cfi: l.meta.cfi,
1350
- onClick: d,
1351
- absolutePageIndex: (v = l.meta) == null ? void 0 : v.absolutePageIndex
1352
- },
1353
- x
1354
- );
1355
- }) })
1314
+ /* @__PURE__ */ n(T, { gap: 0, children: u?.map((d, b) => /* @__PURE__ */ n(
1315
+ xt,
1316
+ {
1317
+ contextText: d.meta?.range?.startContainer.parentElement?.textContent ?? "",
1318
+ pageIndex: d.meta?.itemPageIndex,
1319
+ startOffset: d.meta?.range?.startOffset ?? 0,
1320
+ text: o,
1321
+ cfi: d.meta.cfi,
1322
+ onClick: c,
1323
+ absolutePageIndex: d.meta?.absolutePageIndex
1324
+ },
1325
+ b
1326
+ )) })
1356
1327
  ] })
1357
1328
  ]
1358
1329
  }
1359
1330
  )
1360
1331
  ] });
1361
1332
  }
1362
- ), Sn = f(
1333
+ ), kt = m(
1363
1334
  ({
1364
1335
  open: e,
1365
1336
  setOpen: t,
@@ -1373,46 +1344,44 @@ const ln = H.Root, an = H.ValueText, me = () => {
1373
1344
  onOpenChange: (i) => t(i.open),
1374
1345
  size: { mdDown: "full", md: "lg" },
1375
1346
  scrollBehavior: "inside",
1376
- children: /* @__PURE__ */ c(V, { height: "100%", children: [
1347
+ children: /* @__PURE__ */ s(V, { height: "100%", children: [
1377
1348
  /* @__PURE__ */ n(q, { children: /* @__PURE__ */ n(K, { children: "Search" }) }),
1378
- /* @__PURE__ */ n(Q, { flex: 1, p: 0, children: /* @__PURE__ */ n(In, { onNavigate: o }) }),
1349
+ /* @__PURE__ */ n(Q, { flex: 1, p: 0, children: /* @__PURE__ */ n(It, { onNavigate: o }) }),
1379
1350
  /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(Z, { asChild: !0, children: /* @__PURE__ */ n(j, { variant: "outline", children: "Cancel" }) }) }),
1380
1351
  /* @__PURE__ */ n(G, {})
1381
1352
  ] })
1382
1353
  }
1383
1354
  )
1384
- ), yn = f(
1385
- ({
1386
- onNavigate: e
1387
- }) => {
1388
- const t = p(), { manifest: o, assumedRenditionLayout: i } = b(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, { nav: r } = o ?? {}, s = _();
1389
- r != null && r.toc;
1390
- const { beginSpineItemIndex: a, beginPageIndexInSpineItem: d } = s ?? {}, u = (i === "reflowable" ? d : a) || 0;
1391
- let l = s == null ? void 0 : s.beginChapterInfo;
1392
- for (; l != null && l.subChapter; )
1393
- l = l == null ? void 0 : l.subChapter;
1394
- const x = (h, m, S) => /* @__PURE__ */ c(Me.Fragment, { children: [
1355
+ ), St = m(
1356
+ ({ onNavigate: e }) => {
1357
+ const t = p(), { manifest: o, assumedRenditionLayout: i } = f(() => t?.context.state$, [t]) ?? {}, { nav: r } = o ?? {}, a = $();
1358
+ r?.toc;
1359
+ const { beginSpineItemIndex: l, beginPageIndexInSpineItem: c } = a ?? {}, u = (i === "reflowable" ? c : l) || 0;
1360
+ let d = a?.beginChapterInfo;
1361
+ for (; d?.subChapter; )
1362
+ d = d?.subChapter;
1363
+ const b = (h, x, S) => /* @__PURE__ */ s(Me.Fragment, { children: [
1395
1364
  /* @__PURE__ */ n(
1396
- w.Item,
1365
+ y.Item,
1397
1366
  {
1398
1367
  pl: 4 * (S + 1),
1399
1368
  style: {
1400
1369
  display: "flex",
1401
1370
  alignItems: "center"
1402
1371
  },
1403
- children: /* @__PURE__ */ c(
1372
+ children: /* @__PURE__ */ s(
1404
1373
  pe,
1405
1374
  {
1406
1375
  onClick: () => {
1407
- e(), t == null || t.navigation.goToUrl(h.href);
1376
+ e(), t?.navigation.goToUrl(h.href);
1408
1377
  },
1409
1378
  href: "#",
1410
1379
  children: [
1411
- (l == null ? void 0 : l.path) === h.path && /* @__PURE__ */ n(w.Indicator, { asChild: !0, children: /* @__PURE__ */ n(Ce, {}) }),
1412
- (l == null ? void 0 : l.path) !== h.path && /* @__PURE__ */ n(w.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(Ce, {}) }),
1413
- /* @__PURE__ */ c(P, { gap: 0, children: [
1380
+ d?.path === h.path && /* @__PURE__ */ n(y.Indicator, { asChild: !0, children: /* @__PURE__ */ n(Ce, {}) }),
1381
+ d?.path !== h.path && /* @__PURE__ */ n(y.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(Ce, {}) }),
1382
+ /* @__PURE__ */ s(T, { gap: 0, children: [
1414
1383
  /* @__PURE__ */ n(g, { fontSize: "md", children: h.title || h.path }),
1415
- (l == null ? void 0 : l.path) === h.path && /* @__PURE__ */ n(
1384
+ d?.path === h.path && /* @__PURE__ */ n(
1416
1385
  g,
1417
1386
  {
1418
1387
  fontStyle: "italic",
@@ -1427,13 +1396,13 @@ const ln = H.Root, an = H.ValueText, me = () => {
1427
1396
  )
1428
1397
  }
1429
1398
  ),
1430
- h.contents.length > 0 && /* @__PURE__ */ n(w.Root, { as: "div", gap: 2, children: h.contents.map(
1431
- (C, k) => x(C, k, S + 1)
1399
+ h.contents.length > 0 && /* @__PURE__ */ n(y.Root, { as: "div", gap: 2, children: h.contents.map(
1400
+ (w, B) => b(w, B, S + 1)
1432
1401
  ) })
1433
- ] }, m);
1434
- return /* @__PURE__ */ n(w.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: r == null ? void 0 : r.toc.map((h, m) => x(h, m, 0)) });
1402
+ ] }, x);
1403
+ return /* @__PURE__ */ n(y.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: r?.toc.map((h, x) => b(h, x, 0)) });
1435
1404
  }
1436
- ), kn = f(
1405
+ ), yt = m(
1437
1406
  ({
1438
1407
  open: e,
1439
1408
  setOpen: t,
@@ -1447,81 +1416,81 @@ const ln = H.Root, an = H.ValueText, me = () => {
1447
1416
  onOpenChange: (i) => t(i.open),
1448
1417
  size: { mdDown: "full", md: "lg" },
1449
1418
  scrollBehavior: "inside",
1450
- children: /* @__PURE__ */ c(V, { children: [
1419
+ children: /* @__PURE__ */ s(V, { children: [
1451
1420
  /* @__PURE__ */ n(q, { children: /* @__PURE__ */ n(K, { children: "Table of Contents" }) }),
1452
- /* @__PURE__ */ n(Q, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ n(yn, { onNavigate: o }) }),
1421
+ /* @__PURE__ */ n(Q, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ n(St, { onNavigate: o }) }),
1453
1422
  /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(Z, { asChild: !0, children: /* @__PURE__ */ n(j, { variant: "outline", children: "Cancel" }) }) }),
1454
1423
  /* @__PURE__ */ n(G, {})
1455
1424
  ] })
1456
1425
  }
1457
1426
  )
1458
- ), jn = ({
1427
+ ), jt = ({
1459
1428
  enableFloatingTime: e = !0,
1460
1429
  enableFloatingProgress: t = !0,
1461
1430
  onItemClick: o
1462
1431
  }) => {
1463
- const [i, r] = T(!1), [s, a] = T(!1), [d, u] = T(!1), [l, x] = T(void 0), [h, m] = T(!1), [S, C] = fe(), k = N(() => {
1464
- r(!1), a(!1), u(!1), x(void 0), C(!1), m(!1);
1465
- }, [C]), R = N(
1466
- (v) => {
1467
- v === "annotations" ? x("annotations") : v === "search" ? u(!0) : v === "help" ? a(!0) : v === "toc" ? r(!0) : v === "bookmarks" ? x("bookmarks") : v === "gallery" && m(!0), o == null || o(v);
1432
+ const [i, r] = k(!1), [a, l] = k(!1), [c, u] = k(!1), [d, b] = k(void 0), [h, x] = k(!1), [S, w] = me(), B = N(() => {
1433
+ r(!1), l(!1), u(!1), b(void 0), w(!1), x(!1);
1434
+ }, [w]), _ = N(
1435
+ (C) => {
1436
+ C === "annotations" ? b("annotations") : C === "search" ? u(!0) : C === "help" ? l(!0) : C === "toc" ? r(!0) : C === "bookmarks" ? b("bookmarks") : C === "gallery" && x(!0), o?.(C);
1468
1437
  },
1469
1438
  [o]
1470
1439
  );
1471
- return Jt(), nn(), Nt(), /* @__PURE__ */ c(oe, { children: [
1440
+ return et(), ot(), Hn(), /* @__PURE__ */ s(oe, { children: [
1472
1441
  t && /* @__PURE__ */ n(
1473
- te,
1442
+ ne,
1474
1443
  {
1475
1444
  present: !S,
1476
1445
  animationName: { _open: "fade-in", _closed: "fade-out" },
1477
1446
  animationDuration: "moderate",
1478
- children: /* @__PURE__ */ n(Qt, {})
1447
+ children: /* @__PURE__ */ n(Kn, {})
1479
1448
  }
1480
1449
  ),
1481
- /* @__PURE__ */ n(Gt, { open: h, setOpen: m }),
1482
- /* @__PURE__ */ n(bn, { onItemClick: R }),
1483
- /* @__PURE__ */ n($t, {}),
1484
- /* @__PURE__ */ n(qt, { open: s, setOpen: a }),
1450
+ /* @__PURE__ */ n(Yn, { open: h, setOpen: x }),
1451
+ /* @__PURE__ */ n(bt, { onItemClick: _ }),
1452
+ /* @__PURE__ */ n(_n, {}),
1453
+ /* @__PURE__ */ n(Qn, { open: a, setOpen: l }),
1485
1454
  /* @__PURE__ */ n(
1486
- kn,
1455
+ yt,
1487
1456
  {
1488
1457
  open: i,
1489
1458
  setOpen: r,
1490
- onNavigate: k
1459
+ onNavigate: B
1491
1460
  }
1492
1461
  ),
1493
1462
  /* @__PURE__ */ n(
1494
- Sn,
1463
+ kt,
1495
1464
  {
1496
- open: d,
1465
+ open: c,
1497
1466
  setOpen: u,
1498
- onNavigate: k
1467
+ onNavigate: B
1499
1468
  }
1500
1469
  ),
1501
1470
  /* @__PURE__ */ n(
1502
- Dt,
1471
+ Dn,
1503
1472
  {
1504
- openWith: l,
1505
- setOpen: (v) => x(v ? "annotations" : void 0),
1506
- onNavigate: k
1473
+ openWith: d,
1474
+ setOpen: (C) => b(C ? "annotations" : void 0),
1475
+ onNavigate: B
1507
1476
  }
1508
1477
  ),
1509
1478
  /* @__PURE__ */ n(
1510
- te,
1479
+ ne,
1511
1480
  {
1512
1481
  present: e || S,
1513
1482
  animationName: { _open: "fade-in", _closed: "fade-out" },
1514
1483
  animationDuration: "slow",
1515
1484
  overflow: "hidden",
1516
- children: /* @__PURE__ */ n(Xt, {})
1485
+ children: /* @__PURE__ */ n(Jn, {})
1517
1486
  }
1518
1487
  ),
1519
- /* @__PURE__ */ n(Ht, {})
1488
+ /* @__PURE__ */ n(Wn, {})
1520
1489
  ] });
1521
1490
  };
1522
1491
  export {
1523
- Mt as BOOKMARK_AREA_DATA_ATTRIBUTE,
1524
- jn as ReactReader,
1525
- Wn as ReactReaderProvider
1492
+ Ln as BOOKMARK_AREA_DATA_ATTRIBUTE,
1493
+ jt as ReactReader,
1494
+ Ft as ReactReaderProvider
1526
1495
  };
1527
1496
  //# sourceMappingURL=index.js.map