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