@prose-reader/react-reader 1.186.0 → 1.187.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,122 +1,192 @@
1
- import { jsx as t, jsxs as a, Fragment as E } from "react/jsx-runtime";
2
- import * as C from "react";
3
- import ie, { createContext as le, memo as b, useMemo as se, useEffect as B, useContext as _, useState as R, useCallback as q } from "react";
4
- import { signal as ce, useSignal as U, useLiveRef as ae, useSubscribe as Y, useObserve as v, useSignalValue as de } from "reactjrx";
5
- import { tap as ue, NEVER as he, combineLatest as ge, map as me } from "rxjs";
6
- import { Box as z, Text as m, Popover as I, Portal as Q, IconButton as p, Progress as O, Stack as y, HStack as x, Presence as L, chakra as fe, Collapsible as M, Dialog as g, Heading as j, Kbd as N, Button as G, List as w, Link as pe } from "@chakra-ui/react";
7
- import { LuChevronDown as be, LuCircleHelp as xe, LuTableOfContents as Ce, LuX as Ie, LuArrowBigRight as ve, LuArrowBigLeft as Pe, LuCircleCheck as V } from "react-icons/lu";
8
- import { RxDoubleArrowUp as Se, RxDoubleArrowLeft as Te, RxDoubleArrowDown as ke, RxDoubleArrowRight as we } from "react-icons/rx";
9
- import { HiOutlineInformationCircle as Re } from "react-icons/hi";
10
- import Oe from "rc-slider";
1
+ import { jsx as t, jsxs as a, Fragment as F } from "react/jsx-runtime";
2
+ import * as w from "react";
3
+ import he, { createContext as ue, memo as p, useMemo as ge, useEffect as M, useContext as oe, useState as T, useCallback as H } from "react";
4
+ import { signal as me, useSignal as re, useLiveRef as fe, useSubscribe as le, useObserve as I, useSignalValue as pe } from "reactjrx";
5
+ import { tap as be, NEVER as xe, combineLatest as Ce, map as ie, startWith as ve } from "rxjs";
6
+ import { IconButton as b, Portal as se, Dialog as f, Heading as L, HStack as k, Kbd as te, Text as m, Button as _, Box as R, Popover as y, Progress as B, Stack as v, Presence as $, chakra as Ie, Collapsible as E, Link as ae, Input as Se, List as z } from "@chakra-ui/react";
7
+ import { LuX as Pe, LuArrowBigRight as Te, LuArrowBigLeft as ke, LuChevronDown as we, LuCircleHelp as ye, LuTableOfContents as Re, LuSearch as Oe, LuCircleCheck as ne } from "react-icons/lu";
8
+ import { RxDoubleArrowUp as De, RxDoubleArrowLeft as Ae, RxDoubleArrowDown as ze, RxDoubleArrowRight as Be } from "react-icons/rx";
9
+ import { HiOutlineInformationCircle as Me } from "react-icons/hi";
10
+ import Ee from "rc-slider";
11
11
  import "rc-slider/assets/index.css";
12
- import { IoIosArrowBack as ye, IoMdMore as De } from "react-icons/io";
13
- import { MdFullscreenExit as Ae, MdFullscreen as Be } from "react-icons/md";
14
- const F = le({
12
+ import { IoIosArrowBack as Le, IoMdMore as $e } from "react-icons/io";
13
+ import { MdFullscreenExit as Fe, MdFullscreen as He } from "react-icons/md";
14
+ const N = ue({
15
15
  reader: void 0,
16
- quickMenuSignal: ce({ default: !1 })
17
- }), ft = b(
16
+ quickMenuSignal: me({ default: !1 })
17
+ }), kt = p(
18
18
  ({
19
19
  children: e,
20
20
  reader: n,
21
21
  quickMenuOpen: r,
22
- onQuickMenuOpenChange: i
22
+ onQuickMenuOpenChange: l
23
23
  }) => {
24
- const [, o] = U({
24
+ const [, o] = re({
25
25
  default: r
26
- }), l = ae(i), c = se(
26
+ }), i = fe(l), c = ge(
27
27
  () => ({
28
28
  quickMenuSignal: o,
29
29
  reader: n
30
30
  }),
31
31
  [o, n]
32
32
  );
33
- return B(() => {
33
+ return M(() => {
34
34
  o.setValue(r);
35
- }, [r, o]), Y(
36
- () => o.subject.pipe(ue(l.current)),
37
- [o, l]
38
- ), /* @__PURE__ */ t(F.Provider, { value: c, children: e });
35
+ }, [r, o]), le(
36
+ () => o.subject.pipe(be(i.current)),
37
+ [o, i]
38
+ ), /* @__PURE__ */ t(N.Provider, { value: c, children: e });
39
39
  }
40
- ), D = () => {
41
- const { reader: e } = _(F);
40
+ ), _e = "@prose-reader/react-reader", Ne = "1.186.0", We = w.forwardRef(function(n, r) {
41
+ return /* @__PURE__ */ t(b, { variant: "ghost", "aria-label": "Close", ref: r, ...n, children: n.children ?? /* @__PURE__ */ t(Pe, {}) });
42
+ }), W = w.forwardRef(function(n, r) {
43
+ const {
44
+ children: l,
45
+ portalled: o = !0,
46
+ portalRef: i,
47
+ backdrop: c = !0,
48
+ ...d
49
+ } = n;
50
+ return /* @__PURE__ */ a(se, { disabled: !o, container: i, children: [
51
+ c && /* @__PURE__ */ t(f.Backdrop, {}),
52
+ /* @__PURE__ */ t(f.Positioner, { children: /* @__PURE__ */ t(f.Content, { ref: r, ...d, asChild: !1, children: l }) })
53
+ ] });
54
+ }), j = w.forwardRef(function(n, r) {
55
+ return /* @__PURE__ */ t(
56
+ f.CloseTrigger,
57
+ {
58
+ position: "absolute",
59
+ top: "2",
60
+ insetEnd: "2",
61
+ ...n,
62
+ asChild: !0,
63
+ children: /* @__PURE__ */ t(We, { size: "sm", ref: r, children: n.children })
64
+ }
65
+ );
66
+ }), V = f.Root, q = f.Footer, U = f.Header, Y = f.Body;
67
+ f.Backdrop;
68
+ const Q = f.Title;
69
+ f.Description;
70
+ f.Trigger;
71
+ const G = f.ActionTrigger, je = p(
72
+ ({
73
+ open: e,
74
+ setOpen: n
75
+ }) => /* @__PURE__ */ t(
76
+ V,
77
+ {
78
+ lazyMount: !0,
79
+ placement: "center",
80
+ open: e,
81
+ onOpenChange: (r) => n(r.open),
82
+ size: { mdDown: "full", md: "lg" },
83
+ scrollBehavior: "inside",
84
+ children: /* @__PURE__ */ a(W, { children: [
85
+ /* @__PURE__ */ t(U, { children: /* @__PURE__ */ t(Q, { children: "Help" }) }),
86
+ /* @__PURE__ */ a(Y, { overflowY: "auto", flex: 1, children: [
87
+ /* @__PURE__ */ t(L, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
88
+ /* @__PURE__ */ a(k, { mb: 1, children: [
89
+ /* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(Te, {}) }),
90
+ " ",
91
+ /* @__PURE__ */ t(m, { children: "Navigate to right page" })
92
+ ] }),
93
+ /* @__PURE__ */ a(k, { mb: 1, children: [
94
+ /* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(ke, {}) }),
95
+ " ",
96
+ /* @__PURE__ */ t(m, { children: "Navigate to left page" })
97
+ ] }),
98
+ /* @__PURE__ */ t(L, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
99
+ /* @__PURE__ */ a(m, { children: [
100
+ _e,
101
+ " version: ",
102
+ Ne
103
+ ] })
104
+ ] }),
105
+ /* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(G, { asChild: !0, children: /* @__PURE__ */ t(_, { variant: "outline", children: "Cancel" }) }) }),
106
+ /* @__PURE__ */ t(j, {})
107
+ ] })
108
+ }
109
+ )
110
+ ), O = () => {
111
+ const { reader: e } = oe(N);
42
112
  return e;
43
- }, P = () => {
44
- const e = D();
45
- return v(
46
- () => e ? ge([e.pagination.state$, e.context.state$]).pipe(
47
- me(([n, r]) => {
113
+ }, ce = (e) => !!e && "__PROSE_READER_ENHANCER_SEARCH" in e, D = () => {
114
+ const e = O();
115
+ return I(
116
+ () => e ? Ce([e.pagination.state$, e.context.state$]).pipe(
117
+ ie(([n, r]) => {
48
118
  var o;
49
- const i = (o = r.manifest) == null ? void 0 : o.spineItems.every(
50
- (l) => {
119
+ const l = (o = r.manifest) == null ? void 0 : o.spineItems.every(
120
+ (i) => {
51
121
  var c;
52
- return (c = l.mediaType) == null ? void 0 : c.startsWith("image/");
122
+ return (c = i.mediaType) == null ? void 0 : c.startsWith("image/");
53
123
  }
54
124
  );
55
125
  return {
56
126
  ...n,
57
- hasChapters: !r.isFullyPrePaginated && !i
127
+ hasChapters: !r.isFullyPrePaginated && !l
58
128
  };
59
129
  })
60
- ) : he,
130
+ ) : xe,
61
131
  [e]
62
132
  );
63
- }, ze = () => {
64
- const e = P(), n = Math.floor(
133
+ }, Ve = () => {
134
+ const e = D(), n = Math.floor(
65
135
  ((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100
66
136
  ), r = n > 0 ? n : 1;
67
- return (e == null ? void 0 : e.percentageEstimateOfBook) === void 0 ? null : /* @__PURE__ */ t(z, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ a(m, { fontSize: "sm", children: [
137
+ return (e == null ? void 0 : e.percentageEstimateOfBook) === void 0 ? null : /* @__PURE__ */ t(R, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ a(m, { fontSize: "sm", children: [
68
138
  r,
69
139
  " %"
70
140
  ] }) });
71
- }, Me = () => {
72
- const [e, n] = R(/* @__PURE__ */ new Date());
73
- return B(() => {
141
+ }, qe = () => {
142
+ const [e, n] = T(/* @__PURE__ */ new Date());
143
+ return M(() => {
74
144
  const r = setInterval(() => {
75
145
  n(/* @__PURE__ */ new Date());
76
146
  }, 6e4);
77
147
  return () => clearInterval(r);
78
148
  }, []), e;
79
- }, Le = (e) => {
80
- const n = Me();
149
+ }, Ue = (e) => {
150
+ const n = qe();
81
151
  return /* @__PURE__ */ t(m, { fontSize: "xs", ...e, children: n.toLocaleTimeString(navigator.language, {
82
152
  hour: "2-digit",
83
153
  minute: "2-digit"
84
154
  }) });
85
- }, $ = () => {
86
- const { quickMenuSignal: e } = _(F);
87
- return [de(e), e.setValue, e];
88
- }, Ee = () => {
89
- const [e] = $();
155
+ }, K = () => {
156
+ const { quickMenuSignal: e } = oe(N);
157
+ return [pe(e), e.setValue, e];
158
+ }, Ye = () => {
159
+ const [e] = K();
90
160
  return /* @__PURE__ */ t(
91
- z,
161
+ R,
92
162
  {
93
163
  position: "absolute",
94
164
  left: 0,
95
165
  bottom: 0,
96
166
  p: 2,
97
167
  color: e ? void 0 : "colorPalette.contrast",
98
- children: /* @__PURE__ */ t(Le, {})
168
+ children: /* @__PURE__ */ t(Ue, {})
99
169
  }
100
170
  );
101
- }, Fe = C.forwardRef(
171
+ }, Qe = w.forwardRef(
102
172
  function(n, r) {
103
173
  const {
104
- showArrow: i,
174
+ showArrow: l,
105
175
  children: o,
106
- portalled: l = !0,
176
+ portalled: i = !0,
107
177
  content: c,
108
178
  portalRef: d,
109
179
  ...u
110
180
  } = n;
111
181
  return /* @__PURE__ */ a(
112
- I.Root,
182
+ y.Root,
113
183
  {
114
184
  ...u,
115
185
  positioning: { ...u.positioning, gutter: 4 },
116
186
  children: [
117
- /* @__PURE__ */ t(I.Trigger, { asChild: !0, children: o }),
118
- /* @__PURE__ */ t(Q, { disabled: !l, container: d, children: /* @__PURE__ */ t(I.Positioner, { children: /* @__PURE__ */ a(
119
- I.Content,
187
+ /* @__PURE__ */ t(y.Trigger, { asChild: !0, children: o }),
188
+ /* @__PURE__ */ t(se, { disabled: !i, container: d, children: /* @__PURE__ */ t(y.Positioner, { children: /* @__PURE__ */ a(
189
+ y.Content,
120
190
  {
121
191
  width: "auto",
122
192
  px: "2",
@@ -125,7 +195,7 @@ const F = le({
125
195
  rounded: "sm",
126
196
  ref: r,
127
197
  children: [
128
- i && /* @__PURE__ */ t(I.Arrow, { children: /* @__PURE__ */ t(I.ArrowTip, {}) }),
198
+ l && /* @__PURE__ */ t(y.Arrow, { children: /* @__PURE__ */ t(y.ArrowTip, {}) }),
129
199
  c
130
200
  ]
131
201
  }
@@ -134,61 +204,61 @@ const F = le({
134
204
  }
135
205
  );
136
206
  }
137
- ), $e = C.forwardRef(function(n, r) {
138
- const { children: i, ...o } = n;
139
- return /* @__PURE__ */ t(Fe, { content: i, ...o, ref: r, children: /* @__PURE__ */ t(
140
- p,
207
+ ), Ge = w.forwardRef(function(n, r) {
208
+ const { children: l, ...o } = n;
209
+ return /* @__PURE__ */ t(Qe, { content: l, ...o, ref: r, children: /* @__PURE__ */ t(
210
+ b,
141
211
  {
142
212
  variant: "ghost",
143
213
  "aria-label": "info",
144
214
  size: "2xs",
145
215
  colorPalette: "gray",
146
- children: /* @__PURE__ */ t(Re, {})
216
+ children: /* @__PURE__ */ t(Me, {})
147
217
  }
148
218
  ) });
149
- }), He = C.forwardRef(function(n, r) {
150
- return /* @__PURE__ */ t(O.Track, { ...n, ref: r, children: /* @__PURE__ */ t(O.Range, {}) });
219
+ }), Ke = w.forwardRef(function(n, r) {
220
+ return /* @__PURE__ */ t(B.Track, { ...n, ref: r, children: /* @__PURE__ */ t(B.Range, {}) });
151
221
  });
152
- C.forwardRef(function(n, r) {
153
- const { children: i, info: o, ...l } = n;
154
- return /* @__PURE__ */ a(O.Label, { ...l, ref: r, children: [
155
- i,
156
- o && /* @__PURE__ */ t($e, { children: o })
222
+ w.forwardRef(function(n, r) {
223
+ const { children: l, info: o, ...i } = n;
224
+ return /* @__PURE__ */ a(B.Label, { ...i, ref: r, children: [
225
+ l,
226
+ o && /* @__PURE__ */ t(Ge, { children: o })
157
227
  ] });
158
228
  });
159
- const We = O.Root, je = O.ValueText, H = () => {
160
- const e = P(), n = (e == null ? void 0 : e.numberOfTotalPages) === 1, r = ((e == null ? void 0 : e.beginNumberOfPagesInSpineItem) ?? 0) > 1, i = ((e == null ? void 0 : e.endNumberOfPagesInSpineItem) ?? 0) > 1, o = (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, d = 0] = [
229
+ const Xe = B.Root, Je = B.ValueText, X = () => {
230
+ const e = D(), n = (e == null ? void 0 : e.numberOfTotalPages) === 1, r = ((e == null ? void 0 : e.beginNumberOfPagesInSpineItem) ?? 0) > 1, l = ((e == null ? void 0 : e.endNumberOfPagesInSpineItem) ?? 0) > 1, o = (e != null && e.hasChapters ? e == null ? void 0 : e.beginPageIndexInSpineItem : e == null ? void 0 : e.beginAbsolutePageIndex) ?? 0, i = (e != null && e.hasChapters ? e == null ? void 0 : e.endPageIndexInSpineItem : e == null ? void 0 : e.endAbsolutePageIndex) ?? 0, [c = 0, d = 0] = [
161
231
  o,
162
- l
163
- ].sort((f, h) => f - 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), s = e != null && e.hasChapters ? e == null ? void 0 : e.beginNumberOfPagesInSpineItem : e == null ? void 0 : e.numberOfTotalPages;
232
+ i
233
+ ].sort((g, h) => g - h), u = (e == null ? void 0 : e.beginPageIndexInSpineItem) !== (e == null ? void 0 : e.endPageIndexInSpineItem) || (e == null ? void 0 : e.beginSpineItemIndex) !== (e == null ? void 0 : e.endSpineItemIndex), s = e != null && e.hasChapters ? e == null ? void 0 : e.beginNumberOfPagesInSpineItem : e == null ? void 0 : e.numberOfTotalPages;
164
234
  return {
165
235
  hasOnlyOnePage: n,
166
236
  beginPageIndex: o,
167
- endPageIndex: l,
237
+ endPageIndex: i,
168
238
  isBeginWithinChapter: r,
169
- isEndWithinChapter: i,
239
+ isEndWithinChapter: l,
170
240
  beginAndEndAreDifferent: u,
171
241
  totalApproximatePages: s,
172
242
  leftPageIndex: c,
173
243
  rightPageIndex: d
174
244
  };
175
- }, Ne = () => {
176
- const e = P(), {
245
+ }, Ze = () => {
246
+ const e = D(), {
177
247
  hasOnlyOnePage: n,
178
248
  leftPageIndex: r,
179
- rightPageIndex: i,
249
+ rightPageIndex: l,
180
250
  totalApproximatePages: o,
181
- beginAndEndAreDifferent: l
182
- } = H(), c = Math.round(((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100), d = (s) => s != null && s.subChapter ? `${s.title} / ${d(s.subChapter)}` : (s == null ? void 0 : s.title) || "", u = d(e == null ? void 0 : e.beginChapterInfo);
183
- return /* @__PURE__ */ a(y, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
184
- /* @__PURE__ */ t(We, { value: c, size: "xs", width: 150, children: /* @__PURE__ */ a(x, { justifyContent: "space-between", children: [
185
- /* @__PURE__ */ t(He, { width: 110 }),
186
- /* @__PURE__ */ t(je, { children: `${c}%` })
251
+ beginAndEndAreDifferent: i
252
+ } = X(), c = Math.round(((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100), d = (s) => s != null && s.subChapter ? `${s.title} / ${d(s.subChapter)}` : (s == null ? void 0 : s.title) || "", u = d(e == null ? void 0 : e.beginChapterInfo);
253
+ return /* @__PURE__ */ a(v, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
254
+ /* @__PURE__ */ t(Xe, { value: c, size: "xs", width: 150, children: /* @__PURE__ */ a(k, { justifyContent: "space-between", children: [
255
+ /* @__PURE__ */ t(Ke, { width: 110 }),
256
+ /* @__PURE__ */ t(Je, { children: `${c}%` })
187
257
  ] }) }),
188
258
  /* @__PURE__ */ t(m, { truncate: !0, maxWidth: "100%", fontSize: "sm", mt: 1, children: u ? `Chapter: ${u}` : " " }),
189
- !n && /* @__PURE__ */ a(x, { children: [
190
- /* @__PURE__ */ t(m, { fontSize: "xs", children: l ? `${r + 1} - ${i + 1} of ${o}` : `${r + 1} of ${o}` }),
191
- !!(e != null && e.hasChapters) && /* @__PURE__ */ a(E, { children: [
259
+ !n && /* @__PURE__ */ a(k, { children: [
260
+ /* @__PURE__ */ t(m, { fontSize: "xs", children: i ? `${r + 1} - ${l + 1} of ${o}` : `${r + 1} of ${o}` }),
261
+ !!(e != null && e.hasChapters) && /* @__PURE__ */ a(F, { children: [
192
262
  /* @__PURE__ */ t(m, { children: "-" }),
193
263
  /* @__PURE__ */ a(m, { fontSize: "xs", children: [
194
264
  "(",
@@ -198,13 +268,13 @@ const We = O.Root, je = O.ValueText, H = () => {
198
268
  ] })
199
269
  ] })
200
270
  ] });
201
- }, K = b(
271
+ }, de = p(
202
272
  ({
203
273
  children: e,
204
274
  position: n,
205
275
  ...r
206
276
  }) => /* @__PURE__ */ t(
207
- L,
277
+ $,
208
278
  {
209
279
  display: "flex",
210
280
  flexDirection: "row",
@@ -228,8 +298,8 @@ const We = O.Root, je = O.ValueText, H = () => {
228
298
  children: e
229
299
  }
230
300
  )
231
- ), Ve = fe(Oe), _e = b((e) => /* @__PURE__ */ t(
232
- z,
301
+ ), et = Ie(Ee), tt = p((e) => /* @__PURE__ */ t(
302
+ R,
233
303
  {
234
304
  display: "contents",
235
305
  css: {
@@ -238,7 +308,7 @@ const We = O.Root, je = O.ValueText, H = () => {
238
308
  "--color-solid": "colors.colorPalette.solid"
239
309
  },
240
310
  children: /* @__PURE__ */ t(
241
- Ve,
311
+ et,
242
312
  {
243
313
  keyboard: !1,
244
314
  style: {
@@ -282,87 +352,88 @@ const We = O.Root, je = O.ValueText, H = () => {
282
352
  }
283
353
  )
284
354
  }
285
- )), qe = () => {
286
- const e = P(), n = e == null ? void 0 : e.isUsingSpread, { beginPageIndex: r, totalApproximatePages: i = 0 } = H(), o = n ? Math.floor((r || 0) / 2) : r, [l, c] = U({
355
+ )), nt = () => {
356
+ const e = D(), n = e == null ? void 0 : e.isUsingSpread, { beginPageIndex: r, totalApproximatePages: l = 0 } = X(), o = n ? Math.floor((r || 0) / 2) : r, [i, c] = re({
287
357
  default: o || 0
288
358
  }), d = 0, u = Math.max(
289
359
  0,
290
- n ? Math.floor((i - 1) / 2) : i - 1
360
+ n ? Math.floor((l - 1) / 2) : l - 1
291
361
  );
292
- return B(() => {
362
+ return M(() => {
293
363
  c.setValue(o || 0);
294
364
  }, [o, c]), {
295
- value: l,
365
+ value: i,
296
366
  valueSignal: c,
297
367
  min: d,
298
368
  max: u
299
369
  };
300
- }, Ue = () => {
301
- const e = D(), n = P(), { manifest: r } = v(() => e == null ? void 0 : e.context.state$, []) ?? {}, i = (r == null ? void 0 : r.readingDirection) === "rtl", o = n == null ? void 0 : n.isUsingSpread, { totalApproximatePages: l = 0, isBeginWithinChapter: c } = H(), d = 1, u = c, { value: s, valueSignal: f, min: h, max: S } = qe(), A = q(
302
- (T) => {
303
- const [k = 0] = Array.isArray(T) ? T : [T];
304
- f.setValue(k);
305
- const W = o ? Math.floor(k) * 2 : Math.floor(k);
370
+ }, ot = () => {
371
+ const e = O(), n = D(), { manifest: r } = I(() => e == null ? void 0 : e.context.state$, []) ?? {}, l = (r == null ? void 0 : r.readingDirection) === "rtl", o = n == null ? void 0 : n.isUsingSpread, { totalApproximatePages: i = 0, isBeginWithinChapter: c } = X(), d = 1, u = c, { value: s, valueSignal: g, min: h, max: S } = nt(), P = H(
372
+ (x) => {
373
+ const [C = 0] = Array.isArray(x) ? x : [x];
374
+ g.setValue(C);
375
+ const A = o ? Math.floor(C) * 2 : Math.floor(C);
306
376
  u ? e == null || e.navigation.goToPageOfSpineItem({
307
- pageIndex: W,
377
+ pageIndex: A,
308
378
  spineItemId: e.pagination.getState().beginSpineItemIndex ?? 0,
309
379
  animation: !1
310
380
  }) : e == null || e.navigation.goToAbsolutePageIndex({
311
- absolutePageIndex: W,
381
+ absolutePageIndex: A,
312
382
  animation: !1
313
383
  });
314
384
  },
315
- [e, o, f, u]
385
+ [e, o, g, u]
316
386
  );
317
- return Y(
387
+ return le(
318
388
  () => e == null ? void 0 : e.navigation.throttleLock({
319
389
  duration: 100,
320
- trigger: f.subject
390
+ trigger: g.subject
321
391
  }),
322
- [e, f]
323
- ), l === 1 || o && l === 2 ? null : /* @__PURE__ */ t(
324
- _e,
392
+ [e, g]
393
+ ), i === 1 || o && i === 2 ? null : /* @__PURE__ */ t(
394
+ tt,
325
395
  {
326
396
  value: [s],
327
397
  max: S,
328
398
  min: h,
329
- reverse: i,
399
+ reverse: l,
330
400
  step: d,
331
- onChange: A
401
+ onChange: P
332
402
  }
333
403
  );
334
- }, Ye = b(
404
+ }, rt = p(
335
405
  ({
336
406
  open: e,
337
407
  onTableOfContentsClick: n,
338
- onHelpClick: r
408
+ onHelpClick: r,
409
+ onSearchClick: l
339
410
  }) => {
340
- const i = D(), o = v(() => i == null ? void 0 : i.navigation.state$, [i]), l = v(() => i == null ? void 0 : i.settings.values$, [i]), c = (l == null ? void 0 : l.computedPageTurnDirection) === "vertical", [d, u] = R(!0);
411
+ const o = O(), i = I(() => o == null ? void 0 : o.navigation.state$, [o]), c = I(() => o == null ? void 0 : o.settings.values$, [o]), d = (c == null ? void 0 : c.computedPageTurnDirection) === "vertical", [u, s] = T(!0);
341
412
  return /* @__PURE__ */ t(
342
- K,
413
+ de,
343
414
  {
344
415
  present: e,
345
416
  position: "bottom",
346
417
  children: /* @__PURE__ */ a(
347
- y,
418
+ v,
348
419
  {
349
420
  flex: 1,
350
421
  children: [
351
- /* @__PURE__ */ a(x, { flex: 1, alignItems: "center", justifyContent: "center", children: [
422
+ /* @__PURE__ */ a(k, { flex: 1, alignItems: "center", justifyContent: "center", children: [
352
423
  /* @__PURE__ */ t(
353
- p,
424
+ b,
354
425
  {
355
426
  "aria-label": "left",
356
427
  size: "lg",
357
428
  variant: "ghost",
358
429
  flexShrink: 0,
359
- onClick: () => i == null ? void 0 : i.navigation.goToLeftOrTopSpineItem(),
360
- disabled: !(o != null && o.canGoLeftSpineItem) && !(o != null && o.canGoTopSpineItem),
361
- children: c ? /* @__PURE__ */ t(Se, {}) : /* @__PURE__ */ t(Te, {})
430
+ onClick: () => o == null ? void 0 : o.navigation.goToLeftOrTopSpineItem(),
431
+ disabled: !(i != null && i.canGoLeftSpineItem) && !(i != null && i.canGoTopSpineItem),
432
+ children: d ? /* @__PURE__ */ t(De, {}) : /* @__PURE__ */ t(Ae, {})
362
433
  }
363
434
  ),
364
435
  /* @__PURE__ */ a(
365
- y,
436
+ v,
366
437
  {
367
438
  flex: 1,
368
439
  maxW: 400,
@@ -371,82 +442,92 @@ const We = O.Root, je = O.ValueText, H = () => {
371
442
  overflow: "visible",
372
443
  px: 4,
373
444
  children: [
374
- /* @__PURE__ */ t(Ne, {}),
375
- /* @__PURE__ */ t(z, { height: 5, maxW: 300, width: "100%", overflow: "visible", children: /* @__PURE__ */ t(Ue, {}) })
445
+ /* @__PURE__ */ t(Ze, {}),
446
+ /* @__PURE__ */ t(R, { height: 5, maxW: 300, width: "100%", overflow: "visible", children: /* @__PURE__ */ t(ot, {}) })
376
447
  ]
377
448
  }
378
449
  ),
379
450
  /* @__PURE__ */ t(
380
- p,
451
+ b,
381
452
  {
382
453
  "aria-label": "right",
383
454
  size: "lg",
384
455
  flexShrink: 0,
385
456
  variant: "ghost",
386
- disabled: !(o != null && o.canGoRightSpineItem) && !(o != null && o.canGoBottomSpineItem),
457
+ disabled: !(i != null && i.canGoRightSpineItem) && !(i != null && i.canGoBottomSpineItem),
387
458
  onClick: () => {
388
- i == null || i.navigation.goToRightOrBottomSpineItem();
459
+ o == null || o.navigation.goToRightOrBottomSpineItem();
389
460
  },
390
- children: c ? /* @__PURE__ */ t(ke, {}) : /* @__PURE__ */ t(we, {})
461
+ children: d ? /* @__PURE__ */ t(ze, {}) : /* @__PURE__ */ t(Be, {})
391
462
  }
392
463
  )
393
464
  ] }),
394
465
  /* @__PURE__ */ t(
395
- x,
466
+ k,
396
467
  {
397
468
  alignItems: "center",
398
469
  justifyContent: "center",
399
470
  children: /* @__PURE__ */ a(
400
- M.Root,
471
+ E.Root,
401
472
  {
402
- open: d,
473
+ open: u,
403
474
  flex: 1,
404
- onOpenChange: ({ open: s }) => {
405
- u(s);
475
+ onOpenChange: ({ open: g }) => {
476
+ s(g);
406
477
  },
407
478
  children: [
408
479
  /* @__PURE__ */ t(
409
- M.Trigger,
480
+ E.Trigger,
410
481
  {
411
482
  paddingY: "3",
412
483
  width: "100%",
413
484
  display: "flex",
414
485
  justifyContent: "center",
415
486
  children: /* @__PURE__ */ t(
416
- be,
487
+ we,
417
488
  {
418
489
  style: {
419
- transform: d ? "rotate(0deg)" : "rotate(180deg)"
490
+ transform: u ? "rotate(0deg)" : "rotate(180deg)"
420
491
  }
421
492
  }
422
493
  )
423
494
  }
424
495
  ),
425
496
  /* @__PURE__ */ a(
426
- M.Content,
497
+ E.Content,
427
498
  {
428
499
  display: "flex",
429
500
  justifyContent: "center",
430
501
  gap: 2,
431
502
  children: [
432
503
  /* @__PURE__ */ t(
433
- p,
504
+ b,
434
505
  {
435
506
  "aria-label": "Help",
436
507
  size: "lg",
437
508
  variant: "ghost",
438
509
  onClick: r,
439
- children: /* @__PURE__ */ t(xe, {})
510
+ children: /* @__PURE__ */ t(ye, {})
440
511
  }
441
512
  ),
442
513
  /* @__PURE__ */ t(
443
- p,
514
+ b,
444
515
  {
445
516
  "aria-label": "Table of contents",
446
517
  size: "lg",
447
518
  variant: "ghost",
448
519
  onClick: n,
449
- children: /* @__PURE__ */ t(Ce, {})
520
+ children: /* @__PURE__ */ t(Re, {})
521
+ }
522
+ ),
523
+ ce(o) && /* @__PURE__ */ t(
524
+ b,
525
+ {
526
+ "aria-label": "Search",
527
+ size: "lg",
528
+ variant: "ghost",
529
+ onClick: l,
530
+ children: /* @__PURE__ */ t(Oe, {})
450
531
  }
451
532
  )
452
533
  ]
@@ -463,31 +544,31 @@ const We = O.Root, je = O.ValueText, H = () => {
463
544
  }
464
545
  );
465
546
  }
466
- ), Qe = () => {
467
- const [e, n] = R(!1), r = q(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
547
+ ), lt = () => {
548
+ const [e, n] = T(!1), r = H(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
468
549
  n(!1);
469
550
  }) : document.documentElement.requestFullscreen({ navigationUI: "hide" }).catch(console.error).then(() => {
470
551
  n(!0);
471
552
  }), []);
472
- return B(() => {
473
- function i() {
553
+ return M(() => {
554
+ function l() {
474
555
  n(!!document.fullscreenElement);
475
556
  }
476
- return document.addEventListener("fullscreenchange", i), () => {
477
- document.removeEventListener("fullscreenchange", i);
557
+ return document.addEventListener("fullscreenchange", l), () => {
558
+ document.removeEventListener("fullscreenchange", l);
478
559
  };
479
560
  }, []), {
480
561
  isFullscreen: e,
481
562
  onToggleFullscreenClick: r
482
563
  };
483
- }, Ge = ({
564
+ }, it = ({
484
565
  open: e,
485
566
  onBackClick: n,
486
567
  onMoreClick: r
487
568
  }) => {
488
- const i = D(), o = v(() => i == null ? void 0 : i.context.manifest$, [i]), { isFullscreen: l, onToggleFullscreenClick: c } = Qe();
569
+ const l = O(), o = I(() => l == null ? void 0 : l.context.manifest$, [l]), { isFullscreen: i, onToggleFullscreenClick: c } = lt();
489
570
  return /* @__PURE__ */ a(
490
- K,
571
+ de,
491
572
  {
492
573
  present: e,
493
574
  position: "top",
@@ -495,18 +576,18 @@ const We = O.Root, je = O.ValueText, H = () => {
495
576
  justifyContent: "space-between",
496
577
  children: [
497
578
  /* @__PURE__ */ t(
498
- p,
579
+ b,
499
580
  {
500
581
  "aria-label": "left",
501
582
  size: "lg",
502
583
  variant: "ghost",
503
584
  flexShrink: 0,
504
585
  onClick: n,
505
- children: /* @__PURE__ */ t(ye, {})
586
+ children: /* @__PURE__ */ t(Le, {})
506
587
  }
507
588
  ),
508
589
  /* @__PURE__ */ t(
509
- y,
590
+ v,
510
591
  {
511
592
  flex: 1,
512
593
  maxW: 600,
@@ -517,161 +598,228 @@ const We = O.Root, je = O.ValueText, H = () => {
517
598
  children: /* @__PURE__ */ t(m, { truncate: !0, maxWidth: "100%", children: o == null ? void 0 : o.title })
518
599
  }
519
600
  ),
520
- /* @__PURE__ */ a(x, { children: [
601
+ /* @__PURE__ */ a(k, { children: [
521
602
  /* @__PURE__ */ t(
522
- p,
603
+ b,
523
604
  {
524
605
  "aria-label": "right",
525
606
  size: "lg",
526
607
  flexShrink: 0,
527
608
  variant: "ghost",
528
609
  onClick: r,
529
- children: /* @__PURE__ */ t(De, {})
610
+ children: /* @__PURE__ */ t($e, {})
530
611
  }
531
612
  ),
532
613
  /* @__PURE__ */ t(
533
- p,
614
+ b,
534
615
  {
535
616
  "aria-label": "right",
536
617
  size: "lg",
537
618
  flexShrink: 0,
538
619
  variant: "ghost",
539
620
  onClick: c,
540
- children: l ? /* @__PURE__ */ t(Ae, {}) : /* @__PURE__ */ t(Be, {})
621
+ children: i ? /* @__PURE__ */ t(Fe, {}) : /* @__PURE__ */ t(He, {})
541
622
  }
542
623
  )
543
624
  ] })
544
625
  ]
545
626
  }
546
627
  );
547
- }, Ke = b(
628
+ }, st = p(
548
629
  ({
549
630
  onBackClick: e,
550
631
  onMoreClick: n,
551
632
  onTableOfContentsClick: r,
552
- onHelpClick: i
633
+ onHelpClick: l,
634
+ onSearchClick: o
553
635
  }) => {
554
- const [o] = $();
555
- return /* @__PURE__ */ a(E, { children: [
636
+ const [i] = K();
637
+ return /* @__PURE__ */ a(F, { children: [
556
638
  /* @__PURE__ */ t(
557
- Ge,
639
+ it,
558
640
  {
559
- open: o,
641
+ open: i,
560
642
  onBackClick: e,
561
643
  onMoreClick: n
562
644
  }
563
645
  ),
564
646
  /* @__PURE__ */ t(
565
- Ye,
647
+ rt,
566
648
  {
567
- open: o,
649
+ open: i,
568
650
  onTableOfContentsClick: r,
569
- onHelpClick: i
651
+ onHelpClick: l,
652
+ onSearchClick: o
570
653
  }
571
654
  )
572
655
  ] });
573
656
  }
574
- ), Xe = "@prose-reader/react-reader", Je = "1.185.0", Ze = C.forwardRef(function(n, r) {
575
- return /* @__PURE__ */ t(p, { variant: "ghost", "aria-label": "Close", ref: r, ...n, children: n.children ?? /* @__PURE__ */ t(Ie, {}) });
576
- }), X = C.forwardRef(function(n, r) {
577
- const {
578
- children: i,
579
- portalled: o = !0,
580
- portalRef: l,
581
- backdrop: c = !0,
582
- ...d
583
- } = n;
584
- return /* @__PURE__ */ a(Q, { disabled: !o, container: l, children: [
585
- c && /* @__PURE__ */ t(g.Backdrop, {}),
586
- /* @__PURE__ */ t(g.Positioner, { children: /* @__PURE__ */ t(g.Content, { ref: r, ...d, asChild: !1, children: i }) })
587
- ] });
588
- }), J = C.forwardRef(function(n, r) {
589
- return /* @__PURE__ */ t(
590
- g.CloseTrigger,
591
- {
592
- position: "absolute",
593
- top: "2",
594
- insetEnd: "2",
595
- ...n,
596
- asChild: !0,
597
- children: /* @__PURE__ */ t(Ze, { size: "sm", ref: r, children: n.children })
598
- }
599
- );
600
- }), Z = g.Root, ee = g.Footer, te = g.Header, ne = g.Body;
601
- g.Backdrop;
602
- const oe = g.Title;
603
- g.Description;
604
- g.Trigger;
605
- const re = g.ActionTrigger, et = b(
657
+ ), at = p(
658
+ ({
659
+ contextText: e = "",
660
+ startOffset: n = 0,
661
+ text: r,
662
+ cfi: l = "#",
663
+ onClick: o,
664
+ absolutePageIndex: i
665
+ }) => {
666
+ const d = e.substring(
667
+ Math.max(n - 15, 0),
668
+ Math.max(n, 0)
669
+ ), u = e.substring(
670
+ Math.min(n + r.length, e.length - 1),
671
+ Math.min(
672
+ n + r.length + 15,
673
+ e.length - 1
674
+ )
675
+ );
676
+ return /* @__PURE__ */ a(
677
+ ae,
678
+ {
679
+ href: l,
680
+ style: { margin: 5, overflow: "hidden" },
681
+ onClick: (s) => {
682
+ s.preventDefault(), o(l);
683
+ },
684
+ display: "flex",
685
+ flexDirection: "column",
686
+ alignItems: "flex-start",
687
+ gap: 0,
688
+ children: [
689
+ /* @__PURE__ */ a(m, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
690
+ '"',
691
+ d,
692
+ /* @__PURE__ */ t("b", { children: r }),
693
+ u,
694
+ '"'
695
+ ] }),
696
+ /* @__PURE__ */ t(m, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${i !== void 0 ? i + 1 : "unknown (not loaded)"}` })
697
+ ]
698
+ }
699
+ );
700
+ }
701
+ ), ct = p(
702
+ ({
703
+ onNavigate: e
704
+ }) => {
705
+ const [n, r] = T(""), l = O(), o = ce(l) ? l : void 0, i = (h) => {
706
+ r(h.target.value);
707
+ }, c = H(
708
+ (h) => {
709
+ e(), l == null || l.navigation.goToCfi(h);
710
+ },
711
+ [l, e]
712
+ ), d = I(
713
+ () => o == null ? void 0 : o.search.search(n).pipe(
714
+ ie((h) => ({ type: "end", data: h })),
715
+ ve({ type: "start" })
716
+ ),
717
+ [l, n]
718
+ ), u = (d == null ? void 0 : d.type) === "start", s = (d == null ? void 0 : d.type) === "end" ? d.data : [], g = I(
719
+ () => l == null ? void 0 : l.pagination.locate(s.slice(0, 100)),
720
+ [s]
721
+ );
722
+ return /* @__PURE__ */ a(v, { flex: 1, height: "100%", children: [
723
+ /* @__PURE__ */ t(R, { px: 4, children: /* @__PURE__ */ t(
724
+ Se,
725
+ {
726
+ placeholder: "Type something...",
727
+ value: n,
728
+ onChange: i,
729
+ borderRadius: 0
730
+ }
731
+ ) }),
732
+ /* @__PURE__ */ a(
733
+ R,
734
+ {
735
+ px: 4,
736
+ pb: 4,
737
+ mt: 2,
738
+ flex: 1,
739
+ style: { overflow: "hidden", overflowY: "auto" },
740
+ children: [
741
+ u && /* @__PURE__ */ t(m, { children: "Searching ..." }),
742
+ !u && s.length === 0 && /* @__PURE__ */ t("p", { children: "There are no results" }),
743
+ !u && s.length >= 0 && /* @__PURE__ */ a(v, { children: [
744
+ /* @__PURE__ */ a(L, { as: "h2", size: "md", children: [
745
+ s.length,
746
+ " result(s)"
747
+ ] }),
748
+ /* @__PURE__ */ t(v, { gap: 0, children: g == null ? void 0 : g.map((h, S) => {
749
+ var P, x, C, A, J, Z, ee;
750
+ return /* @__PURE__ */ t(
751
+ at,
752
+ {
753
+ contextText: ((C = (x = (P = h.meta) == null ? void 0 : P.range) == null ? void 0 : x.startContainer.parentElement) == null ? void 0 : C.textContent) ?? "",
754
+ pageIndex: (A = h.meta) == null ? void 0 : A.itemPageIndex,
755
+ startOffset: ((Z = (J = h.meta) == null ? void 0 : J.range) == null ? void 0 : Z.startOffset) ?? 0,
756
+ text: n,
757
+ cfi: h.cfi,
758
+ onClick: c,
759
+ absolutePageIndex: (ee = h.meta) == null ? void 0 : ee.absolutePageIndex
760
+ },
761
+ S
762
+ );
763
+ }) })
764
+ ] })
765
+ ]
766
+ }
767
+ )
768
+ ] });
769
+ }
770
+ ), dt = p(
606
771
  ({
607
772
  open: e,
608
- setOpen: n
773
+ setOpen: n,
774
+ onNavigate: r
609
775
  }) => /* @__PURE__ */ t(
610
- Z,
776
+ V,
611
777
  {
612
778
  lazyMount: !0,
613
779
  placement: "center",
614
780
  open: e,
615
- onOpenChange: (r) => n(r.open),
781
+ onOpenChange: (l) => n(l.open),
616
782
  size: { mdDown: "full", md: "lg" },
617
783
  scrollBehavior: "inside",
618
- children: /* @__PURE__ */ a(X, { children: [
619
- /* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(oe, { children: "Help" }) }),
620
- /* @__PURE__ */ a(ne, { overflowY: "auto", flex: 1, children: [
621
- /* @__PURE__ */ t(j, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
622
- /* @__PURE__ */ a(x, { mb: 1, children: [
623
- /* @__PURE__ */ t(N, { children: /* @__PURE__ */ t(ve, {}) }),
624
- " ",
625
- /* @__PURE__ */ t(m, { children: "Navigate to right page" })
626
- ] }),
627
- /* @__PURE__ */ a(x, { mb: 1, children: [
628
- /* @__PURE__ */ t(N, { children: /* @__PURE__ */ t(Pe, {}) }),
629
- " ",
630
- /* @__PURE__ */ t(m, { children: "Navigate to left page" })
631
- ] }),
632
- /* @__PURE__ */ t(j, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
633
- /* @__PURE__ */ a(m, { children: [
634
- Xe,
635
- " version: ",
636
- Je
637
- ] })
638
- ] }),
639
- /* @__PURE__ */ t(ee, { children: /* @__PURE__ */ t(re, { asChild: !0, children: /* @__PURE__ */ t(G, { variant: "outline", children: "Cancel" }) }) }),
640
- /* @__PURE__ */ t(J, {})
784
+ children: /* @__PURE__ */ a(W, { height: "100%", children: [
785
+ /* @__PURE__ */ t(U, { children: /* @__PURE__ */ t(Q, { children: "Search" }) }),
786
+ /* @__PURE__ */ t(Y, { flex: 1, children: /* @__PURE__ */ t(ct, { onNavigate: r }) }),
787
+ /* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(G, { asChild: !0, children: /* @__PURE__ */ t(_, { variant: "outline", children: "Cancel" }) }) }),
788
+ /* @__PURE__ */ t(j, {})
641
789
  ] })
642
790
  }
643
791
  )
644
- ), tt = b(
792
+ ), ht = p(
645
793
  ({
646
794
  onNavigate: e
647
795
  }) => {
648
- const n = D(), { manifest: r, assumedRenditionLayout: i } = v(() => n == null ? void 0 : n.context.state$, [n]) ?? {}, { nav: o } = r ?? {}, l = P();
796
+ const n = O(), { manifest: r, assumedRenditionLayout: l } = I(() => n == null ? void 0 : n.context.state$, [n]) ?? {}, { nav: o } = r ?? {}, i = D();
649
797
  o != null && o.toc;
650
- const { beginSpineItemIndex: c, beginPageIndexInSpineItem: d } = l ?? {}, u = (i === "reflowable" ? d : c) || 0;
651
- console.log({ assumedRenditionLayout: i, currentSpineItemOrChapterPageIndex: u });
652
- let s = l == null ? void 0 : l.beginChapterInfo;
798
+ const { beginSpineItemIndex: c, beginPageIndexInSpineItem: d } = i ?? {}, u = (l === "reflowable" ? d : c) || 0;
799
+ console.log({ assumedRenditionLayout: l, currentSpineItemOrChapterPageIndex: u });
800
+ let s = i == null ? void 0 : i.beginChapterInfo;
653
801
  for (; s != null && s.subChapter; )
654
802
  s = s == null ? void 0 : s.subChapter;
655
- const f = (h, S, A) => /* @__PURE__ */ a(ie.Fragment, { children: [
803
+ const g = (h, S, P) => /* @__PURE__ */ a(he.Fragment, { children: [
656
804
  /* @__PURE__ */ t(
657
- w.Item,
805
+ z.Item,
658
806
  {
659
- pl: 4 * (A + 1),
807
+ pl: 4 * (P + 1),
660
808
  style: {
661
809
  display: "flex",
662
810
  alignItems: "center"
663
811
  },
664
812
  children: /* @__PURE__ */ a(
665
- pe,
813
+ ae,
666
814
  {
667
815
  onClick: () => {
668
816
  e(), n == null || n.navigation.goToUrl(h.href);
669
817
  },
670
818
  href: "#",
671
819
  children: [
672
- (s == null ? void 0 : s.path) === h.path && /* @__PURE__ */ t(w.Indicator, { asChild: !0, children: /* @__PURE__ */ t(V, {}) }),
673
- (s == null ? void 0 : s.path) !== h.path && /* @__PURE__ */ t(w.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ t(V, {}) }),
674
- /* @__PURE__ */ a(y, { gap: 0, children: [
820
+ (s == null ? void 0 : s.path) === h.path && /* @__PURE__ */ t(z.Indicator, { asChild: !0, children: /* @__PURE__ */ t(ne, {}) }),
821
+ (s == null ? void 0 : s.path) !== h.path && /* @__PURE__ */ t(z.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ t(ne, {}) }),
822
+ /* @__PURE__ */ a(v, { gap: 0, children: [
675
823
  /* @__PURE__ */ t(m, { fontSize: "md", children: h.title || h.path }),
676
824
  (s == null ? void 0 : s.path) === h.path && /* @__PURE__ */ t(
677
825
  m,
@@ -688,83 +836,96 @@ const re = g.ActionTrigger, et = b(
688
836
  )
689
837
  }
690
838
  ),
691
- h.contents.length > 0 && /* @__PURE__ */ t(w.Root, { as: "div", gap: 2, children: h.contents.map(
692
- (T, k) => f(T, k, A + 1)
839
+ h.contents.length > 0 && /* @__PURE__ */ t(z.Root, { as: "div", gap: 2, children: h.contents.map(
840
+ (x, C) => g(x, C, P + 1)
693
841
  ) })
694
842
  ] }, S);
695
- return /* @__PURE__ */ t(w.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: o == null ? void 0 : o.toc.map((h, S) => f(h, S, 0)) });
843
+ return /* @__PURE__ */ t(z.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: o == null ? void 0 : o.toc.map((h, S) => g(h, S, 0)) });
696
844
  }
697
- ), nt = b(
845
+ ), ut = p(
698
846
  ({
699
847
  open: e,
700
848
  setOpen: n,
701
849
  onNavigate: r
702
850
  }) => /* @__PURE__ */ t(
703
- Z,
851
+ V,
704
852
  {
705
853
  lazyMount: !0,
706
854
  placement: "center",
707
855
  open: e,
708
- onOpenChange: (i) => n(i.open),
856
+ onOpenChange: (l) => n(l.open),
709
857
  size: { mdDown: "full", md: "lg" },
710
858
  scrollBehavior: "inside",
711
- children: /* @__PURE__ */ a(X, { children: [
712
- /* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(oe, { children: "Table of Contents" }) }),
713
- /* @__PURE__ */ t(ne, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ t(tt, { onNavigate: r }) }),
714
- /* @__PURE__ */ t(ee, { children: /* @__PURE__ */ t(re, { asChild: !0, children: /* @__PURE__ */ t(G, { variant: "outline", children: "Cancel" }) }) }),
715
- /* @__PURE__ */ t(J, {})
859
+ children: /* @__PURE__ */ a(W, { children: [
860
+ /* @__PURE__ */ t(U, { children: /* @__PURE__ */ t(Q, { children: "Table of Contents" }) }),
861
+ /* @__PURE__ */ t(Y, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ t(ht, { onNavigate: r }) }),
862
+ /* @__PURE__ */ t(q, { children: /* @__PURE__ */ t(G, { asChild: !0, children: /* @__PURE__ */ t(_, { variant: "outline", children: "Cancel" }) }) }),
863
+ /* @__PURE__ */ t(j, {})
716
864
  ] })
717
865
  }
718
866
  )
719
- ), pt = ({
867
+ ), wt = ({
720
868
  enableFloatingTime: e = !0,
721
869
  enableFloatingProgress: n = !0,
722
- ...r
870
+ onBackClick: r,
871
+ onMoreClick: l
723
872
  }) => {
724
- const [i, o] = R(!1), [l, c] = R(!1), [d, u] = $();
725
- return /* @__PURE__ */ a(E, { children: [
873
+ const [o, i] = T(!1), [c, d] = T(!1), [u, s] = T(!1), [g, h] = K();
874
+ return /* @__PURE__ */ a(F, { children: [
726
875
  n && /* @__PURE__ */ t(
727
- L,
876
+ $,
728
877
  {
729
- present: !d,
878
+ present: !g,
730
879
  animationName: { _open: "fade-in", _closed: "fade-out" },
731
880
  animationDuration: "moderate",
732
- children: /* @__PURE__ */ t(ze, {})
881
+ children: /* @__PURE__ */ t(Ve, {})
733
882
  }
734
883
  ),
735
884
  /* @__PURE__ */ t(
736
- Ke,
885
+ st,
737
886
  {
738
- ...r,
739
- onTableOfContentsClick: () => o(!0),
740
- onHelpClick: () => c(!0)
887
+ onBackClick: r,
888
+ onMoreClick: l,
889
+ onTableOfContentsClick: () => i(!0),
890
+ onHelpClick: () => d(!0),
891
+ onSearchClick: () => s(!0)
892
+ }
893
+ ),
894
+ /* @__PURE__ */ t(je, { open: c, setOpen: d }),
895
+ /* @__PURE__ */ t(
896
+ ut,
897
+ {
898
+ open: o,
899
+ setOpen: i,
900
+ onNavigate: () => {
901
+ i(!1), h(!1);
902
+ }
741
903
  }
742
904
  ),
743
- /* @__PURE__ */ t(et, { open: l, setOpen: c }),
744
905
  /* @__PURE__ */ t(
745
- nt,
906
+ dt,
746
907
  {
747
- open: i,
748
- setOpen: o,
908
+ open: u,
909
+ setOpen: s,
749
910
  onNavigate: () => {
750
- o(!1), u(!1);
911
+ s(!1), h(!1);
751
912
  }
752
913
  }
753
914
  ),
754
915
  /* @__PURE__ */ t(
755
- L,
916
+ $,
756
917
  {
757
- present: e || d,
918
+ present: e || g,
758
919
  animationName: { _open: "fade-in", _closed: "fade-out" },
759
920
  animationDuration: "slow",
760
921
  overflow: "hidden",
761
- children: /* @__PURE__ */ t(Ee, {})
922
+ children: /* @__PURE__ */ t(Ye, {})
762
923
  }
763
924
  )
764
925
  ] });
765
926
  };
766
927
  export {
767
- pt as ReactReader,
768
- ft as ReactReaderProvider
928
+ wt as ReactReader,
929
+ kt as ReactReaderProvider
769
930
  };
770
931
  //# sourceMappingURL=index.js.map