@prose-reader/react-reader 1.241.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 D 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 E, useObserve as f, isDefined as ye, useSignalValue as He } from "reactjrx";
5
- import { Subject as he, tap as ue, map as z, 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 we, mergeMap as Ge, skip as Re, merge as Pe, timer as Ae, BehaviorSubject as Ye } from "rxjs";
6
- import { IconButton as v, Portal as 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 P, createToaster as Ue, Toaster as qe, Toast as M, Spinner as Qe, Heading as ae, HStack as R, Kbd as ve, Popover as L, Progress as H, chakra as Ke, Collapsible as se, Input as Ze } from "@chakra-ui/react";
7
- import { LuX as Xe, LuNotebookPen as te, LuBookmark as Je, LuArrowBigRight as en, LuArrowBigLeft as nn, LuChevronDown as tn, LuCircleHelp as on, LuTableOfContents as rn, LuSearch as an, LuGalleryHorizontal as sn, LuCircleCheck as Ce } from "react-icons/lu";
8
- import { createPortal as ln } from "react-dom";
9
- import { isPositionInArea as cn } from "@prose-reader/enhancer-gestures";
10
- import { isShallowEqual as dn, observeIntersection as hn, isHtmlTagElement as un } from "@prose-reader/core";
11
- import { BsBookmarks as gn } from "react-icons/bs";
12
- import { RiGalleryView2 as pn } from "react-icons/ri";
13
- import { RxDoubleArrowUp as mn, RxDoubleArrowLeft as fn, RxDoubleArrowDown as bn, RxDoubleArrowRight as xn } from "react-icons/rx";
14
- import { HiOutlineInformationCircle as vn } from "react-icons/hi";
15
- import Cn from "rc-slider";
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 kn, IoMdMore as In } from "react-icons/io";
18
- import { MdFullscreenExit as Sn, MdFullscreen as yn } 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
- }), Ft = 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);
46
- }, [o, r]), E(
47
- () => r.pipe(ue(l.current)),
48
- [r, l]
49
- ), /* @__PURE__ */ n(Oe.Provider, { value: c, children: e });
50
+ return ne(() => {
51
+ r.next(o);
52
+ }, [o, r]), D(
53
+ () => r.pipe(ve(c.current)),
54
+ [r, c]
55
+ ), /* @__PURE__ */ e(Be.Provider, { value: d, children: t });
50
56
  }
51
- ), Tn = D.forwardRef(function(t, o) {
52
- return /* @__PURE__ */ n(v, { variant: "ghost", "aria-label": "Close", ref: o, ...t, children: t.children ?? /* @__PURE__ */ n(Xe, {}) });
53
- }), V = D.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 = D.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(Tn, { 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 K = I.Title;
85
+ const Y = I.Title;
80
86
  I.Description;
81
87
  I.Trigger;
82
- const Z = I.ActionTrigger, X = () => _e(Oe), p = () => {
83
- const { reader: e } = X();
84
- return e;
85
- }, De = (e) => !!e && "__PROSE_READER_ENHANCER_SEARCH" in e, W = (e) => !!e && "__PROSE_READER_ENHANCER_ANNOTATIONS" in e, Ee = (e) => !!e && "__PROSE_READER_ENHANCER_GALLERY" in e, wn = (e) => {
86
- const t = p(), o = W(t) ? t : void 0;
87
- return { data: f(
88
+ 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
- z((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
- }, ze = ({
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 } = wn(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 Z = 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
- }, Rn = () => {
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
- }, Pn = ({ onNavigate: e }) => {
144
- const { data: t } = Rn();
145
- return /* @__PURE__ */ n(T.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: t?.map((o) => /* @__PURE__ */ n(
146
- ze,
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
- }, An = () => {
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
- }, On = ({ onNavigate: e }) => {
161
- const { data: t } = An();
162
- return /* @__PURE__ */ n(T.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: t?.map((o) => /* @__PURE__ */ n(
163
- ze,
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(On, { onNavigate: e }) }),
195
- /* @__PURE__ */ n(A.Content, { value: "annotations", children: /* @__PURE__ */ n(Pn, { 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(K, { 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(Z, { 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
- ), zn = m(({ children: e }) => {
229
- const t = p(), o = f(() => t?.spine.element$, [t]);
230
- return o ? /* @__PURE__ */ n(oe, { children: ln(e, o) }) : null;
231
- }), Bn = ({
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
- z((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
- }, Mn = ({
242
- absolutePageIndex: e,
243
- itemIndex: t
247
+ }, jt = ({
248
+ absolutePageIndex: t,
249
+ itemIndex: n
244
250
  }) => {
245
- const { spineItem: o } = Bn({ 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
- }, Ln = "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 } = Mn({
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
- P,
277
+ children: /* @__PURE__ */ e(
278
+ O,
273
279
  {
274
- "data-bookmark-area": Ln,
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 Z = I.ActionTrigger, X = () => _e(Oe), p = () => {
294
300
  }
295
301
  );
296
302
  }
297
- ), $n = m(() => {
298
- const e = p(), t = f(() => e?.layoutInfo$, [e]);
299
- return /* @__PURE__ */ n(zn, { children: t?.pages.map(
300
- ({ absoluteLayout: { left: o, top: i, width: r } }, a) => /* @__PURE__ */ n(
301
- _n,
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 Z = I.ActionTrigger, X = () => _e(Oe), p = () => {
308
314
  a
309
315
  )
310
316
  ) });
311
- }), Nn = () => {
312
- const e = p();
313
- return W(e) ? e : void 0;
314
- }, Hn = () => {
315
- const e = Nn(), { 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
- z(([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
- (w) => w?.meta?.absolutePageIndex === u.absolutePageIndex && w.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
- }), Wn = () => /* @__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
- ] }) }) }), Fn = {
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 Z = I.ActionTrigger, X = () => _e(Oe), p = () => {
375
381
  bottom: 0,
376
382
  right: 0
377
383
  };
378
- function jn() {
379
- const [e, t] = S(null), [o, i] = S(Fn), 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 Vn = (e, t, o) => {
396
- const i = p(), r = Ee(i) ? i : void 0;
397
- E(() => {
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(z((c) => c.some((h) => h.isIntersecting)));
401
+ const Xt = (t, n, o) => {
402
+ const i = f(), r = _e(i) ? i : void 0;
403
+ D(() => {
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
- }, Gn = m(
423
- ({ item: e, onNavigated: t }) => {
424
- const [o, i, r] = jn(), a = p();
425
- Vn(r, e, i);
426
- const l = f(
427
- () => a?.locateResource(e, { mode: "shallow" }),
428
- [a, e]
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
- P,
437
+ O,
432
438
  {
433
439
  width: "100%",
434
440
  aspectRatio: "2/3",
@@ -440,11 +446,11 @@ const Vn = (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
- P,
452
+ /* @__PURE__ */ e(
453
+ O,
448
454
  {
449
455
  height: "100%",
450
456
  width: "100%",
@@ -454,7 +460,7 @@ const Vn = (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 Vn = (e, t, o) => {
474
480
  }
475
481
  );
476
482
  }
477
- ), Yn = 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(K, { children: "Gallery" }) }),
491
- /* @__PURE__ */ n(Q, { children: /* @__PURE__ */ n(
492
- P,
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 Vn = (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
- Gn,
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(Z, { 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
- ), Un = "@prose-reader/react-reader", qn = "1.240.0", Qn = 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(K, { 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,192 +544,193 @@ const Vn = (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(R, { mb: 1, children: [
544
- /* @__PURE__ */ n(ve, { 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(R, { mb: 1, children: [
549
- /* @__PURE__ */ n(ve, { 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(R, { 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
- Un,
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(Z, { 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
- z(([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(P, { 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
- }, Zn = () => {
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
- }, Xn = (e) => {
607
- const t = Zn();
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
- }, Jn = () => {
616
- const [e] = fe();
617
- return /* @__PURE__ */ n(
618
- P,
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(Xn, {})
630
+ color: t ? void 0 : "colorPalette.contrast",
631
+ children: /* @__PURE__ */ e(sn, {})
626
632
  }
627
633
  );
628
- }, et = () => {
629
- const e = p();
630
- E(
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);
634
+ }, cn = () => {
635
+ const t = f();
636
+ D(
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
- }, nt = () => {
643
- const e = p(), { notificationsSubject: t } = X();
644
- E(
645
- () => e?.zoom.isZooming$.pipe(
646
- O((o) => {
647
- if (!o) return le;
648
- const i = new he();
649
- return t.next({
648
+ }, dn = () => {
649
+ const t = f(), { notificationsSubject: n } = E();
650
+ D(
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({
650
657
  key: "zoom",
651
658
  title: "Zooming",
652
659
  duration: 999999,
653
- abort: i
654
- }), re.pipe(
655
- we(() => {
656
- i.next(), i.complete();
660
+ abort: r
661
+ }), de.pipe(
662
+ Ee(() => {
663
+ r.next(), r.complete();
657
664
  })
658
665
  );
659
666
  })
660
667
  ),
661
- [e]
668
+ [t]
662
669
  );
663
- }, tt = () => {
664
- const e = p(), { notificationsSubject: t } = X();
665
- E(
666
- () => e?.settings.values$.pipe(
667
- z(({ fontScale: o }) => o),
668
- ge(),
669
- Re(1),
670
- ue((o) => {
671
- t.next({
670
+ }, un = () => {
671
+ const t = f(), { notificationsSubject: n } = E();
672
+ D(
673
+ () => t?.settings.values$.pipe(
674
+ B(({ fontScale: o }) => o),
675
+ Ce(),
676
+ ze(1),
677
+ ve((o) => {
678
+ n.next({
672
679
  key: "fontScaleChange",
673
680
  title: "Font size changed",
674
681
  description: `${o * 100} %`
675
682
  });
676
683
  })
677
684
  ),
678
- [e, t]
685
+ [t, n]
679
686
  );
680
- }, ot = () => {
681
- const { notificationsSubject: e } = X();
682
- tt(), nt(), E(
683
- () => e.pipe(
684
- J(ye),
685
- Ge((t) => {
686
- const o = t.duration ?? 3e3, i = ce.create({
687
- title: t.title,
688
- 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,
689
696
  duration: o
690
- }), r = e.pipe(
691
- Re(1),
692
- J((a) => !!t.key && a?.key === t.key)
697
+ }), r = t.pipe(
698
+ ze(1),
699
+ ie((a) => !!n.key && a?.key === n.key)
693
700
  );
694
- return Pe(
695
- Ae(o),
696
- t.abort ?? re,
701
+ return Me(
702
+ De(o),
703
+ n.abort ?? de,
697
704
  r
698
705
  ).pipe(
699
- Te(),
700
- we(() => {
701
- ce.dismiss(i);
706
+ Oe(),
707
+ Ee(() => {
708
+ me.dismiss(i);
702
709
  })
703
710
  );
704
711
  })
705
712
  ),
706
- [e]
713
+ [t]
707
714
  );
708
- }, rt = D.forwardRef(
709
- function(t, o) {
715
+ }, gn = y.forwardRef(
716
+ function(n, o) {
710
717
  const {
711
718
  showArrow: i,
712
719
  children: r,
713
720
  portalled: a = !0,
714
721
  content: l,
715
722
  portalRef: c,
716
- ...h
717
- } = t;
723
+ ...d
724
+ } = n;
718
725
  return /* @__PURE__ */ s(
719
- L.Root,
726
+ $.Root,
720
727
  {
721
- ...h,
722
- positioning: { ...h.positioning, gutter: 4 },
728
+ ...d,
729
+ positioning: { ...d.positioning, gutter: 4 },
723
730
  children: [
724
- /* @__PURE__ */ n(L.Trigger, { asChild: !0, children: r }),
725
- /* @__PURE__ */ n(pe, { disabled: !a, container: c, children: /* @__PURE__ */ n(L.Positioner, { children: /* @__PURE__ */ s(
726
- 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,
727
734
  {
728
735
  width: "auto",
729
736
  px: "2",
@@ -732,7 +739,7 @@ const Vn = (e, t, o) => {
732
739
  rounded: "sm",
733
740
  ref: o,
734
741
  children: [
735
- i && /* @__PURE__ */ n(L.Arrow, { children: /* @__PURE__ */ n(L.ArrowTip, {}) }),
742
+ i && /* @__PURE__ */ e($.Arrow, { children: /* @__PURE__ */ e($.ArrowTip, {}) }),
736
743
  l
737
744
  ]
738
745
  }
@@ -741,84 +748,84 @@ const Vn = (e, t, o) => {
741
748
  }
742
749
  );
743
750
  }
744
- ), it = D.forwardRef(function(t, o) {
745
- const { children: i, ...r } = t;
746
- return /* @__PURE__ */ n(rt, { content: i, ...r, ref: o, children: /* @__PURE__ */ n(
747
- v,
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,
748
755
  {
749
756
  variant: "ghost",
750
757
  "aria-label": "info",
751
758
  size: "2xs",
752
759
  colorPalette: "gray",
753
- children: /* @__PURE__ */ n(vn, {})
760
+ children: /* @__PURE__ */ e(At, {})
754
761
  }
755
762
  ) });
756
- }), at = D.forwardRef(function(t, o) {
757
- 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, {}) });
758
765
  });
759
- D.forwardRef(function(t, o) {
760
- const { children: i, info: r, ...a } = t;
761
- 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: [
762
769
  i,
763
- r && /* @__PURE__ */ n(it, { children: r })
770
+ r && /* @__PURE__ */ e(pn, { children: r })
764
771
  ] });
765
772
  });
766
- const st = H.Root, lt = H.ValueText, be = () => {
767
- 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] = [
768
775
  r,
769
776
  a
770
- ].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;
771
778
  return {
772
- hasOnlyOnePage: t,
779
+ hasOnlyOnePage: n,
773
780
  beginPageIndex: r,
774
781
  endPageIndex: a,
775
782
  isBeginWithinChapter: o,
776
783
  isEndWithinChapter: i,
777
- beginAndEndAreDifferent: h,
778
- totalApproximatePages: d,
784
+ beginAndEndAreDifferent: d,
785
+ totalApproximatePages: u,
779
786
  leftPageIndex: l,
780
787
  rightPageIndex: c
781
788
  };
782
- }, ct = () => {
783
- const e = _(), {
784
- hasOnlyOnePage: t,
789
+ }, xn = () => {
790
+ const t = q(), {
791
+ hasOnlyOnePage: n,
785
792
  leftPageIndex: o,
786
793
  rightPageIndex: i,
787
794
  totalApproximatePages: r,
788
795
  beginAndEndAreDifferent: a
789
- } = be(), l = Math.round((e?.percentageEstimateOfBook ?? 0) * 100), c = (d) => d?.subChapter ? `${d.title} / ${c(d.subChapter)}` : d?.title || "", h = c(e?.beginChapterInfo);
790
- return /* @__PURE__ */ s(k, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
791
- /* @__PURE__ */ n(st, { value: l, size: "xs", width: 150, children: /* @__PURE__ */ s(R, { justifyContent: "space-between", children: [
792
- /* @__PURE__ */ n(at, { width: 110 }),
793
- /* @__PURE__ */ n(lt, { 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}%` })
794
801
  ] }) }),
795
- /* @__PURE__ */ n(g, { truncate: !0, maxWidth: "100%", fontSize: "sm", mt: 1, children: h ? `Chapter: ${h}` : " " }),
796
- !t && /* @__PURE__ */ s(R, { children: [
797
- /* @__PURE__ */ n(g, { fontSize: "xs", children: a ? `${o + 1} - ${i + 1} of ${r}` : `${o + 1} of ${r}` }),
798
- !!e?.hasChapters && /* @__PURE__ */ s(oe, { children: [
799
- /* @__PURE__ */ n(g, { children: "-" }),
800
- /* @__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: [
801
808
  "(",
802
- (e?.beginAbsolutePageIndex ?? 0) + 1,
809
+ (t?.beginAbsolutePageIndex ?? 0) + 1,
803
810
  ")"
804
811
  ] })
805
812
  ] })
806
813
  ] })
807
814
  ] });
808
- }, Be = m(
815
+ }, We = m(
809
816
  ({
810
- children: e,
811
- position: t,
817
+ children: t,
818
+ position: n,
812
819
  ...o
813
- }) => /* @__PURE__ */ n(
814
- ne,
820
+ }) => /* @__PURE__ */ e(
821
+ se,
815
822
  {
816
823
  display: "flex",
817
824
  flexDirection: "row",
818
825
  width: "100%",
819
826
  position: "absolute",
820
- ...t === "bottom" ? { bottom: 0 } : { top: 0 },
821
- animationName: t === "bottom" ? {
827
+ ...n === "bottom" ? { bottom: 0 } : { top: 0 },
828
+ animationName: n === "bottom" ? {
822
829
  _open: "slide-from-bottom, fade-in",
823
830
  _closed: "slide-to-bottom, fade-out"
824
831
  } : {
@@ -832,11 +839,11 @@ const st = H.Root, lt = H.ValueText, be = () => {
832
839
  shadow: "md",
833
840
  p: 4,
834
841
  ...o,
835
- children: e
842
+ children: t
836
843
  }
837
844
  )
838
- ), dt = Ke(Cn), ht = m((e) => /* @__PURE__ */ n(
839
- P,
845
+ ), vn = nt(Ot), Cn = m((t) => /* @__PURE__ */ e(
846
+ O,
840
847
  {
841
848
  display: "contents",
842
849
  css: {
@@ -844,8 +851,8 @@ const st = H.Root, lt = H.ValueText, be = () => {
844
851
  "--bg-emphasized": "colors.bg.emphasized",
845
852
  "--color-solid": "colors.colorPalette.solid"
846
853
  },
847
- children: /* @__PURE__ */ n(
848
- dt,
854
+ children: /* @__PURE__ */ e(
855
+ vn,
849
856
  {
850
857
  keyboard: !1,
851
858
  style: {
@@ -880,77 +887,77 @@ const st = H.Root, lt = H.ValueText, be = () => {
880
887
  height: "24px",
881
888
  top: "50%",
882
889
  borderColor: "var(--color-solid)",
883
- transform: `translate(${e.reverse ? "50%" : "-50%"}, -50%)`,
890
+ transform: `translate(${t.reverse ? "50%" : "-50%"}, -50%)`,
884
891
  backgroundColor: "var(--bg)",
885
892
  marginTop: "0px"
886
893
  }
887
894
  },
888
- ...e
895
+ ...t
889
896
  }
890
897
  )
891
898
  }
892
- )), ut = () => {
893
- const t = _()?.isUsingSpread, { beginPageIndex: o, totalApproximatePages: i = 0 } = be(), r = t ? Math.floor((o || 0) / 2) : o, [a, l] = Ie(
894
- () => 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({
895
902
  default: r || 0
896
903
  })
897
- ), c = 0, h = Math.max(
904
+ ), c = 0, d = Math.max(
898
905
  0,
899
- t ? Math.floor((i - 1) / 2) : i - 1
906
+ n ? Math.floor((i - 1) / 2) : i - 1
900
907
  );
901
- return F(() => {
908
+ return ne(() => {
902
909
  l.update(r || 0);
903
910
  }, [r, l]), {
904
911
  value: a,
905
912
  valueSignal: l,
906
913
  min: c,
907
- max: h
914
+ max: d
908
915
  };
909
- }, gt = (e) => {
910
- 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 } = ut(), w = N(
911
- ($) => {
912
- const [C = 0] = Array.isArray($) ? $ : [$];
913
- u.setValue(C);
914
- const xe = a ? Math.floor(C) * 2 : Math.floor(C);
915
- d ? t?.navigation.goToPageOfSpineItem({
916
- pageIndex: xe,
917
- 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,
918
925
  animation: !1
919
- }) : t?.navigation.goToAbsolutePageIndex({
920
- absolutePageIndex: xe,
926
+ }) : n?.navigation.goToAbsolutePageIndex({
927
+ absolutePageIndex: ye,
921
928
  animation: !1
922
929
  });
923
930
  },
924
- [t, a, u, d]
931
+ [n, a, h, u]
925
932
  );
926
- return E(
927
- () => t?.navigation.throttleLock({
933
+ return D(
934
+ () => n?.navigation.throttleLock({
928
935
  duration: 100,
929
- trigger: u.subject
936
+ trigger: h.subject
930
937
  }),
931
- [t, u]
932
- ), l === 1 || a && l === 2 ? /* @__PURE__ */ n(P, { style: e.style }) : /* @__PURE__ */ n(
933
- ht,
938
+ [n, h]
939
+ ), l === 1 || a && l === 2 ? /* @__PURE__ */ e(O, { style: t.style }) : /* @__PURE__ */ e(
940
+ Cn,
934
941
  {
935
- value: [b],
936
- max: y,
937
- min: x,
942
+ value: [g],
943
+ max: T,
944
+ min: v,
938
945
  reverse: r,
939
- step: h,
940
- onChange: w,
941
- ...e
946
+ step: d,
947
+ onChange: P,
948
+ ...t
942
949
  }
943
950
  );
944
- }, pt = m(
951
+ }, Sn = m(
945
952
  ({
946
- open: e,
947
- onItemClick: t
953
+ open: t,
954
+ onItemClick: n
948
955
  }) => {
949
- const o = p(), i = f(() => o?.navigation.state$, [o]), a = f(() => o?.settings.values$, [o])?.computedPageTurnDirection === "vertical", [l, c] = 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);
950
957
  return /* @__PURE__ */ s(
951
- Be,
958
+ We,
952
959
  {
953
- present: e,
960
+ present: t,
954
961
  position: "bottom",
955
962
  display: "flex",
956
963
  flexDirection: "column",
@@ -958,27 +965,27 @@ const st = H.Root, lt = H.ValueText, be = () => {
958
965
  pb: 8,
959
966
  children: [
960
967
  /* @__PURE__ */ s(
961
- R,
968
+ A,
962
969
  {
963
970
  flex: 1,
964
971
  alignItems: "center",
965
972
  justifyContent: "center",
966
973
  maxWidth: "100%",
967
974
  children: [
968
- /* @__PURE__ */ n(
969
- v,
975
+ /* @__PURE__ */ e(
976
+ x,
970
977
  {
971
978
  "aria-label": "left",
972
979
  size: "lg",
973
980
  variant: "ghost",
974
981
  flexShrink: 0,
975
982
  onClick: () => o?.navigation.goToLeftOrTopSpineItem(),
976
- disabled: !i?.canGoLeftSpineItem && !i?.canGoTopSpineItem,
977
- children: a ? /* @__PURE__ */ n(mn, {}) : /* @__PURE__ */ n(fn, {})
983
+ disabled: !r?.canGoLeftSpineItem && !r?.canGoTopSpineItem,
984
+ children: c ? /* @__PURE__ */ e(yt, {}) : /* @__PURE__ */ e(Tt, {})
978
985
  }
979
986
  ),
980
987
  /* @__PURE__ */ s(
981
- k,
988
+ C,
982
989
  {
983
990
  flex: 1,
984
991
  maxW: 400,
@@ -987,9 +994,9 @@ const st = H.Root, lt = H.ValueText, be = () => {
987
994
  overflow: "auto",
988
995
  px: 4,
989
996
  children: [
990
- /* @__PURE__ */ n(ct, {}),
991
- /* @__PURE__ */ n(
992
- gt,
997
+ /* @__PURE__ */ e(xn, {}),
998
+ /* @__PURE__ */ e(
999
+ In,
993
1000
  {
994
1001
  style: {
995
1002
  width: "100%",
@@ -1001,122 +1008,135 @@ const st = H.Root, lt = H.ValueText, be = () => {
1001
1008
  ]
1002
1009
  }
1003
1010
  ),
1004
- /* @__PURE__ */ n(
1005
- v,
1011
+ /* @__PURE__ */ e(
1012
+ x,
1006
1013
  {
1007
1014
  "aria-label": "right",
1008
1015
  size: "lg",
1009
1016
  flexShrink: 0,
1010
1017
  variant: "ghost",
1011
- disabled: !i?.canGoRightSpineItem && !i?.canGoBottomSpineItem,
1018
+ disabled: !r?.canGoRightSpineItem && !r?.canGoBottomSpineItem,
1012
1019
  onClick: () => {
1013
1020
  o?.navigation.goToRightOrBottomSpineItem();
1014
1021
  },
1015
- children: a ? /* @__PURE__ */ n(bn, {}) : /* @__PURE__ */ n(xn, {})
1022
+ children: c ? /* @__PURE__ */ e(wt, {}) : /* @__PURE__ */ e(Pt, {})
1016
1023
  }
1017
1024
  )
1018
1025
  ]
1019
1026
  }
1020
1027
  ),
1021
- /* @__PURE__ */ n(R, { alignSelf: "stretch", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ s(
1022
- se.Root,
1028
+ /* @__PURE__ */ e(A, { alignSelf: "stretch", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ s(
1029
+ ge.Root,
1023
1030
  {
1024
- open: l,
1031
+ open: d,
1025
1032
  flex: 1,
1026
- onOpenChange: ({ open: h }) => {
1027
- c(h);
1033
+ onOpenChange: ({ open: g }) => {
1034
+ u(g);
1028
1035
  },
1029
1036
  children: [
1030
- /* @__PURE__ */ n(
1031
- se.Trigger,
1037
+ /* @__PURE__ */ e(
1038
+ ge.Trigger,
1032
1039
  {
1033
1040
  paddingY: "3",
1034
1041
  width: "100%",
1035
1042
  display: "flex",
1036
1043
  justifyContent: "center",
1037
- children: /* @__PURE__ */ n(
1038
- tn,
1044
+ children: /* @__PURE__ */ e(
1045
+ ct,
1039
1046
  {
1040
1047
  style: {
1041
- transform: l ? "rotate(0deg)" : "rotate(180deg)"
1048
+ transform: d ? "rotate(0deg)" : "rotate(180deg)"
1042
1049
  }
1043
1050
  }
1044
1051
  )
1045
1052
  }
1046
1053
  ),
1047
- /* @__PURE__ */ s(se.Content, { display: "flex", justifyContent: "center", children: [
1048
- /* @__PURE__ */ n(
1049
- v,
1054
+ /* @__PURE__ */ s(ge.Content, { display: "flex", justifyContent: "center", children: [
1055
+ /* @__PURE__ */ e(
1056
+ x,
1050
1057
  {
1051
1058
  "aria-label": "Help",
1052
1059
  size: "lg",
1053
1060
  variant: "ghost",
1054
- onClick: () => t("help"),
1055
- children: /* @__PURE__ */ n(on, {})
1061
+ onClick: () => n("help"),
1062
+ children: /* @__PURE__ */ e(dt, {})
1056
1063
  }
1057
1064
  ),
1058
- /* @__PURE__ */ n(
1059
- v,
1065
+ /* @__PURE__ */ e(
1066
+ x,
1060
1067
  {
1061
1068
  "aria-label": "Table of contents",
1062
1069
  size: "lg",
1063
1070
  variant: "ghost",
1064
- onClick: () => t("toc"),
1065
- children: /* @__PURE__ */ n(rn, {})
1071
+ onClick: () => n("toc"),
1072
+ children: /* @__PURE__ */ e(ut, {})
1066
1073
  }
1067
1074
  ),
1068
- De(o) && /* @__PURE__ */ n(
1069
- v,
1075
+ Le(o) && /* @__PURE__ */ e(
1076
+ x,
1070
1077
  {
1071
1078
  "aria-label": "Search",
1072
1079
  size: "lg",
1073
1080
  variant: "ghost",
1074
- onClick: () => t("search"),
1075
- children: /* @__PURE__ */ n(an, {})
1081
+ onClick: () => n("search"),
1082
+ children: /* @__PURE__ */ e(ht, {})
1076
1083
  }
1077
1084
  ),
1078
- W(o) && /* @__PURE__ */ n(
1079
- v,
1085
+ te(o) && /* @__PURE__ */ e(
1086
+ x,
1080
1087
  {
1081
1088
  "aria-label": "Bookmarks",
1082
1089
  size: "lg",
1083
1090
  variant: "ghost",
1084
- onClick: () => t("bookmarks"),
1085
- children: /* @__PURE__ */ n(gn, {})
1091
+ onClick: () => n("bookmarks"),
1092
+ children: /* @__PURE__ */ e(Ct, {})
1086
1093
  }
1087
1094
  ),
1088
- W(o) && /* @__PURE__ */ n(
1089
- v,
1095
+ te(o) && /* @__PURE__ */ e(
1096
+ x,
1090
1097
  {
1091
1098
  "aria-label": "Annotations",
1092
1099
  size: "lg",
1093
1100
  variant: "ghost",
1094
- onClick: () => t("annotations"),
1095
- children: /* @__PURE__ */ n(te, {})
1101
+ onClick: () => n("annotations"),
1102
+ children: /* @__PURE__ */ e(le, {})
1096
1103
  }
1097
1104
  ),
1098
- /* @__PURE__ */ n(
1099
- v,
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,
1100
1119
  {
1101
1120
  "aria-label": "Thumbnails",
1102
1121
  size: "lg",
1103
- variant: o?.settings.values.viewportMode === "thumbnails" ? "solid" : "ghost",
1122
+ variant: l?.isZooming && l.currentScale < 1 ? "solid" : "ghost",
1104
1123
  onClick: () => {
1105
- o?.settings.update({
1106
- viewportMode: o?.settings.values.viewportMode === "normal" ? "thumbnails" : "normal"
1124
+ l?.isZooming ? o?.zoom.exit() : o?.zoom.enter({
1125
+ animate: !0,
1126
+ scale: 0.5
1107
1127
  });
1108
1128
  },
1109
- children: /* @__PURE__ */ n(sn, {})
1129
+ children: /* @__PURE__ */ e(gt, {})
1110
1130
  }
1111
1131
  ),
1112
- Ee(o) && /* @__PURE__ */ n(
1113
- v,
1132
+ _e(o) && /* @__PURE__ */ e(
1133
+ x,
1114
1134
  {
1115
1135
  "aria-label": "Gallery",
1116
1136
  size: "lg",
1117
1137
  variant: "ghost",
1118
- onClick: () => t("gallery"),
1119
- children: /* @__PURE__ */ n(pn, {})
1138
+ onClick: () => n("gallery"),
1139
+ children: /* @__PURE__ */ e(Rt, {})
1120
1140
  }
1121
1141
  )
1122
1142
  ] })
@@ -1127,50 +1147,50 @@ const st = H.Root, lt = H.ValueText, be = () => {
1127
1147
  }
1128
1148
  );
1129
1149
  }
1130
- ), mt = () => {
1131
- const [e, t] = S(!1), o = N(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
1132
- t(!1);
1150
+ ), Rn = () => {
1151
+ const [t, n] = R(!1), o = X(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
1152
+ n(!1);
1133
1153
  }) : document.documentElement.requestFullscreen({ navigationUI: "hide" }).catch(console.error).then(() => {
1134
- t(!0);
1154
+ n(!0);
1135
1155
  }), []);
1136
- return F(() => {
1156
+ return ne(() => {
1137
1157
  function i() {
1138
- t(!!document.fullscreenElement);
1158
+ n(!!document.fullscreenElement);
1139
1159
  }
1140
1160
  return document.addEventListener("fullscreenchange", i), () => {
1141
1161
  document.removeEventListener("fullscreenchange", i);
1142
1162
  };
1143
1163
  }, []), {
1144
- isFullscreen: e,
1164
+ isFullscreen: t,
1145
1165
  onToggleFullscreenClick: o
1146
1166
  };
1147
- }, ft = m(
1167
+ }, yn = m(
1148
1168
  ({
1149
- open: e,
1150
- onItemClick: t
1169
+ open: t,
1170
+ onItemClick: n
1151
1171
  }) => {
1152
- const o = p(), i = f(() => o?.context.manifest$, [o]), { isFullscreen: r, onToggleFullscreenClick: a } = mt();
1172
+ const o = f(), i = b(() => o?.context.manifest$, [o]), { isFullscreen: r, onToggleFullscreenClick: a } = Rn();
1153
1173
  return /* @__PURE__ */ s(
1154
- Be,
1174
+ We,
1155
1175
  {
1156
- present: e,
1176
+ present: t,
1157
1177
  position: "top",
1158
1178
  height: "80px",
1159
1179
  justifyContent: "space-between",
1160
1180
  children: [
1161
- /* @__PURE__ */ n(
1162
- v,
1181
+ /* @__PURE__ */ e(
1182
+ x,
1163
1183
  {
1164
1184
  "aria-label": "left",
1165
1185
  size: "lg",
1166
1186
  variant: "ghost",
1167
1187
  flexShrink: 0,
1168
- onClick: () => t("back"),
1169
- children: /* @__PURE__ */ n(kn, {})
1188
+ onClick: () => n("back"),
1189
+ children: /* @__PURE__ */ e(Et, {})
1170
1190
  }
1171
1191
  ),
1172
- /* @__PURE__ */ n(
1173
- k,
1192
+ /* @__PURE__ */ e(
1193
+ C,
1174
1194
  {
1175
1195
  flex: 1,
1176
1196
  maxW: 600,
@@ -1178,30 +1198,30 @@ const st = H.Root, lt = H.ValueText, be = () => {
1178
1198
  alignItems: "center",
1179
1199
  overflow: "auto",
1180
1200
  px: 4,
1181
- children: /* @__PURE__ */ n(g, { truncate: !0, maxWidth: "100%", children: i?.title })
1201
+ children: /* @__PURE__ */ e(p, { truncate: !0, maxWidth: "100%", children: i?.title })
1182
1202
  }
1183
1203
  ),
1184
- /* @__PURE__ */ s(R, { children: [
1185
- /* @__PURE__ */ n(
1186
- v,
1204
+ /* @__PURE__ */ s(A, { children: [
1205
+ /* @__PURE__ */ e(
1206
+ x,
1187
1207
  {
1188
1208
  "aria-label": "right",
1189
1209
  size: "lg",
1190
1210
  flexShrink: 0,
1191
1211
  variant: "ghost",
1192
- onClick: () => t("more"),
1193
- children: /* @__PURE__ */ n(In, {})
1212
+ onClick: () => n("more"),
1213
+ children: /* @__PURE__ */ e(zt, {})
1194
1214
  }
1195
1215
  ),
1196
- /* @__PURE__ */ n(
1197
- v,
1216
+ /* @__PURE__ */ e(
1217
+ x,
1198
1218
  {
1199
1219
  "aria-label": "right",
1200
1220
  size: "lg",
1201
1221
  flexShrink: 0,
1202
1222
  variant: "ghost",
1203
1223
  onClick: a,
1204
- children: r ? /* @__PURE__ */ n(Sn, {}) : /* @__PURE__ */ n(yn, {})
1224
+ children: r ? /* @__PURE__ */ e(It, {}) : /* @__PURE__ */ e(St, {})
1205
1225
  }
1206
1226
  )
1207
1227
  ] })
@@ -1209,98 +1229,220 @@ const st = H.Root, lt = H.ValueText, be = () => {
1209
1229
  }
1210
1230
  );
1211
1231
  }
1212
- ), bt = m(
1232
+ ), Tn = m(
1213
1233
  ({
1214
- onItemClick: e
1234
+ onItemClick: t
1215
1235
  }) => {
1216
- const [t] = fe();
1217
- return /* @__PURE__ */ s(oe, { children: [
1218
- /* @__PURE__ */ n(ft, { open: t, onItemClick: e }),
1219
- /* @__PURE__ */ n(pt, { 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
+ )
1220
1246
  ] });
1221
1247
  }
1222
- ), xt = 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(
1223
1365
  ({
1224
- contextText: e = "",
1225
- startOffset: t = 0,
1366
+ contextText: t = "",
1367
+ startOffset: n = 0,
1226
1368
  text: o,
1227
1369
  cfi: i = "#",
1228
1370
  onClick: r,
1229
1371
  absolutePageIndex: a
1230
1372
  }) => {
1231
- const c = e.substring(
1232
- Math.max(t - 15, 0),
1233
- Math.max(t, 0)
1234
- ), h = e.substring(
1235
- 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),
1236
1378
  Math.min(
1237
- t + o.length + 15,
1238
- e.length - 1
1379
+ n + o.length + 15,
1380
+ t.length - 1
1239
1381
  )
1240
1382
  );
1241
1383
  return /* @__PURE__ */ s(
1242
- me,
1384
+ Ie,
1243
1385
  {
1244
1386
  href: i,
1245
1387
  style: { margin: 5, overflow: "hidden" },
1246
- onClick: (d) => {
1247
- d.preventDefault(), r(i);
1388
+ onClick: (u) => {
1389
+ u.preventDefault(), r(i);
1248
1390
  },
1249
1391
  display: "flex",
1250
1392
  flexDirection: "column",
1251
1393
  alignItems: "flex-start",
1252
1394
  gap: 0,
1253
1395
  children: [
1254
- /* @__PURE__ */ s(g, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
1396
+ /* @__PURE__ */ s(p, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
1255
1397
  '"',
1256
1398
  c,
1257
- /* @__PURE__ */ n("b", { children: o }),
1258
- h,
1399
+ /* @__PURE__ */ e("b", { children: o }),
1400
+ d,
1259
1401
  '"'
1260
1402
  ] }),
1261
- /* @__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)"}` })
1262
1404
  ]
1263
1405
  }
1264
1406
  );
1265
1407
  }
1266
- ), vt = 500, Ct = () => {
1267
- const e = Se(() => new Ye("")), t = f(e), o = p(), i = De(o) ? o : void 0, r = f(() => e.pipe(
1268
- ge(),
1269
- O(
1270
- (a) => a === "" || !i ? ee(void 0) : Pe(
1271
- 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({
1272
1414
  type: "start",
1273
1415
  data: void 0
1274
1416
  }),
1275
- Ae(vt).pipe(
1276
- O(() => i.search.search(a)),
1277
- z((l) => ({ type: "end", data: l }))
1417
+ De(Dn).pipe(
1418
+ M(() => i.search.search(a)),
1419
+ B((l) => ({ type: "end", data: l }))
1278
1420
  )
1279
1421
  )
1280
1422
  )
1281
- ), [i, e]);
1423
+ ), [i, t]);
1282
1424
  return {
1283
- value: t,
1284
- setValue: e.next.bind(e),
1425
+ value: n,
1426
+ setValue: t.next.bind(t),
1285
1427
  status: r?.type ?? "idle",
1286
1428
  data: r?.data
1287
1429
  };
1288
- }, kt = m(
1289
- ({ onNavigate: e }) => {
1290
- const t = p(), { value: o, setValue: i, status: r, data: a } = Ct(), l = (d) => {
1291
- i(d.target.value);
1292
- }, c = N(
1293
- (d) => {
1294
- 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);
1295
1437
  },
1296
- [t, e]
1297
- ), h = f(
1298
- () => t?.locateResource(a?.slice(0, 100) ?? []),
1438
+ [n, t]
1439
+ ), d = b(
1440
+ () => n?.locateResource(a?.slice(0, 100) ?? []),
1299
1441
  [a]
1300
1442
  );
1301
- return /* @__PURE__ */ s(k, { flex: 1, height: "100%", gap: 2, children: [
1302
- /* @__PURE__ */ n(
1303
- Ze,
1443
+ return /* @__PURE__ */ s(C, { flex: 1, height: "100%", gap: 2, children: [
1444
+ /* @__PURE__ */ e(
1445
+ rt,
1304
1446
  {
1305
1447
  placeholder: "Type something...",
1306
1448
  value: o,
@@ -1315,32 +1457,32 @@ const st = H.Root, lt = H.ValueText, be = () => {
1315
1457
  }
1316
1458
  ),
1317
1459
  /* @__PURE__ */ s(
1318
- k,
1460
+ C,
1319
1461
  {
1320
1462
  style: { overflow: "hidden", overflowY: "auto" },
1321
1463
  overflow: "auto",
1322
1464
  px: 4,
1323
1465
  flex: 1,
1324
1466
  children: [
1325
- r === "start" && /* @__PURE__ */ n(g, { children: "Searching ..." }),
1326
- a?.length === 0 && /* @__PURE__ */ n(g, { children: "No results" }),
1327
- r === "end" && (a?.length ?? 0) > 0 && /* @__PURE__ */ s(k, { children: [
1328
- /* @__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: [
1329
1471
  a?.length,
1330
1472
  " result(s)"
1331
1473
  ] }),
1332
- /* @__PURE__ */ n(k, { gap: 0, children: h?.map((d, b) => /* @__PURE__ */ n(
1333
- xt,
1474
+ /* @__PURE__ */ e(C, { gap: 0, children: d?.map((u, g) => /* @__PURE__ */ e(
1475
+ Mn,
1334
1476
  {
1335
- contextText: d.meta?.range?.startContainer.parentElement?.textContent ?? "",
1336
- pageIndex: d.meta?.itemPageIndex,
1337
- 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,
1338
1480
  text: o,
1339
- cfi: d.meta.cfi,
1481
+ cfi: u.meta.cfi,
1340
1482
  onClick: c,
1341
- absolutePageIndex: d.meta?.absolutePageIndex
1483
+ absolutePageIndex: u.meta?.absolutePageIndex
1342
1484
  },
1343
- b
1485
+ g
1344
1486
  )) })
1345
1487
  ] })
1346
1488
  ]
@@ -1348,64 +1490,64 @@ const st = H.Root, lt = H.ValueText, be = () => {
1348
1490
  )
1349
1491
  ] });
1350
1492
  }
1351
- ), It = m(
1493
+ ), _n = m(
1352
1494
  ({
1353
- open: e,
1354
- setOpen: t,
1495
+ open: t,
1496
+ setOpen: n,
1355
1497
  onNavigate: o
1356
- }) => /* @__PURE__ */ n(
1357
- Y,
1498
+ }) => /* @__PURE__ */ e(
1499
+ N,
1358
1500
  {
1359
1501
  lazyMount: !0,
1360
1502
  placement: "center",
1361
- open: e,
1362
- onOpenChange: (i) => t(i.open),
1503
+ open: t,
1504
+ onOpenChange: (i) => n(i.open),
1363
1505
  size: { mdDown: "full", md: "lg" },
1364
1506
  scrollBehavior: "inside",
1365
- children: /* @__PURE__ */ s(V, { height: "100%", children: [
1366
- /* @__PURE__ */ n(q, { children: /* @__PURE__ */ n(K, { children: "Search" }) }),
1367
- /* @__PURE__ */ n(Q, { flex: 1, p: 0, children: /* @__PURE__ */ n(kt, { onNavigate: o }) }),
1368
- /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(Z, { asChild: !0, children: /* @__PURE__ */ n(j, { variant: "outline", children: "Cancel" }) }) }),
1369
- /* @__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, {})
1370
1512
  ] })
1371
1513
  }
1372
1514
  )
1373
- ), St = m(
1374
- ({ onNavigate: e }) => {
1375
- 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();
1376
1518
  r?.toc;
1377
- const { beginSpineItemIndex: l, beginPageIndexInSpineItem: c } = a ?? {}, h = (i === "reflowable" ? c : l) || 0;
1378
- let d = a?.beginChapterInfo;
1379
- for (; d?.subChapter; )
1380
- d = d?.subChapter;
1381
- const b = (u, x, y) => /* @__PURE__ */ s(Me.Fragment, { children: [
1382
- /* @__PURE__ */ n(
1383
- 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,
1384
1526
  {
1385
- pl: 4 * (y + 1),
1527
+ pl: 4 * (T + 1),
1386
1528
  style: {
1387
1529
  display: "flex",
1388
1530
  alignItems: "center"
1389
1531
  },
1390
1532
  children: /* @__PURE__ */ s(
1391
- me,
1533
+ Ie,
1392
1534
  {
1393
1535
  onClick: () => {
1394
- e(), t?.navigation.goToUrl(u.href);
1536
+ t(), n?.navigation.goToUrl(h.href);
1395
1537
  },
1396
1538
  href: "#",
1397
1539
  children: [
1398
- d?.path === u.path && /* @__PURE__ */ n(T.Indicator, { asChild: !0, children: /* @__PURE__ */ n(Ce, {}) }),
1399
- d?.path !== u.path && /* @__PURE__ */ n(T.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(Ce, {}) }),
1400
- /* @__PURE__ */ s(k, { gap: 0, children: [
1401
- /* @__PURE__ */ n(g, { fontSize: "md", children: u.title || u.path }),
1402
- d?.path === u.path && /* @__PURE__ */ n(
1403
- 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,
1404
1546
  {
1405
1547
  fontStyle: "italic",
1406
1548
  fontWeight: "bold",
1407
1549
  fontSize: "sm",
1408
- children: `Currently on page ${h + 1}`
1550
+ children: `Currently on page ${d + 1}`
1409
1551
  }
1410
1552
  )
1411
1553
  ] })
@@ -1414,101 +1556,102 @@ const st = H.Root, lt = H.ValueText, be = () => {
1414
1556
  )
1415
1557
  }
1416
1558
  ),
1417
- u.contents.length > 0 && /* @__PURE__ */ n(T.Root, { as: "div", gap: 2, children: u.contents.map(
1418
- (w, B) => b(w, 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)
1419
1561
  ) })
1420
- ] }, x);
1421
- 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)) });
1422
1564
  }
1423
- ), yt = m(
1565
+ ), Fn = m(
1424
1566
  ({
1425
- open: e,
1426
- setOpen: t,
1567
+ open: t,
1568
+ setOpen: n,
1427
1569
  onNavigate: o
1428
- }) => /* @__PURE__ */ n(
1429
- Y,
1570
+ }) => /* @__PURE__ */ e(
1571
+ N,
1430
1572
  {
1431
1573
  lazyMount: !0,
1432
1574
  placement: "center",
1433
- open: e,
1434
- onOpenChange: (i) => t(i.open),
1575
+ open: t,
1576
+ onOpenChange: (i) => n(i.open),
1435
1577
  size: { mdDown: "full", md: "lg" },
1436
1578
  scrollBehavior: "inside",
1437
- children: /* @__PURE__ */ s(V, { children: [
1438
- /* @__PURE__ */ n(q, { children: /* @__PURE__ */ n(K, { children: "Table of Contents" }) }),
1439
- /* @__PURE__ */ n(Q, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ n(St, { onNavigate: o }) }),
1440
- /* @__PURE__ */ n(U, { children: /* @__PURE__ */ n(Z, { asChild: !0, children: /* @__PURE__ */ n(j, { variant: "outline", children: "Cancel" }) }) }),
1441
- /* @__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, {})
1442
1584
  ] })
1443
1585
  }
1444
1586
  )
1445
- ), jt = ({
1446
- enableFloatingTime: e = !0,
1447
- enableFloatingProgress: t = !0,
1587
+ ), ro = ({
1588
+ enableFloatingTime: t = !0,
1589
+ enableFloatingProgress: n = !0,
1448
1590
  onItemClick: o
1449
1591
  }) => {
1450
- const [i, r] = S(!1), [a, l] = S(!1), [c, h] = S(!1), [d, b] = S(void 0), [u, x] = S(!1), [y, w] = fe(), B = N(() => {
1451
- r(!1), l(!1), h(!1), b(void 0), w(!1), x(!1);
1452
- }, [w]), $ = N(
1453
- (C) => {
1454
- C === "annotations" ? b("annotations") : C === "search" ? h(!0) : C === "help" ? l(!0) : C === "toc" ? r(!0) : C === "bookmarks" ? b("bookmarks") : C === "gallery" && x(!0), o?.(C);
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);
1455
1597
  },
1456
1598
  [o]
1457
1599
  );
1458
- return et(), ot(), Hn(), /* @__PURE__ */ s(oe, { children: [
1459
- t && /* @__PURE__ */ n(
1460
- ne,
1600
+ return cn(), hn(), qt(), /* @__PURE__ */ s(ce, { children: [
1601
+ n && /* @__PURE__ */ e(
1602
+ se,
1461
1603
  {
1462
- present: !y,
1604
+ present: !T,
1463
1605
  animationName: { _open: "fade-in", _closed: "fade-out" },
1464
1606
  animationDuration: "moderate",
1465
- children: /* @__PURE__ */ n(Kn, {})
1607
+ children: /* @__PURE__ */ e(rn, {})
1466
1608
  }
1467
1609
  ),
1468
- /* @__PURE__ */ n(Yn, { open: u, setOpen: x }),
1469
- /* @__PURE__ */ n(bt, { onItemClick: $ }),
1470
- /* @__PURE__ */ n($n, {}),
1471
- /* @__PURE__ */ n(Qn, { open: a, setOpen: l }),
1472
- /* @__PURE__ */ n(
1473
- yt,
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,
1474
1617
  {
1475
1618
  open: i,
1476
1619
  setOpen: r,
1477
- onNavigate: B
1620
+ onNavigate: L
1478
1621
  }
1479
1622
  ),
1480
- /* @__PURE__ */ n(
1481
- It,
1623
+ /* @__PURE__ */ e(
1624
+ _n,
1482
1625
  {
1483
1626
  open: c,
1484
- setOpen: h,
1485
- onNavigate: B
1627
+ setOpen: d,
1628
+ onNavigate: L
1486
1629
  }
1487
1630
  ),
1488
- /* @__PURE__ */ n(
1489
- En,
1631
+ /* @__PURE__ */ e(
1632
+ Ht,
1490
1633
  {
1491
- openWith: d,
1492
- setOpen: (C) => b(C ? "annotations" : void 0),
1493
- onNavigate: B
1634
+ openWith: u,
1635
+ setOpen: (k) => g(k ? "annotations" : void 0),
1636
+ onNavigate: L
1494
1637
  }
1495
1638
  ),
1496
- /* @__PURE__ */ n(
1497
- ne,
1639
+ /* @__PURE__ */ e(
1640
+ se,
1498
1641
  {
1499
- present: e || y,
1642
+ present: t || T,
1500
1643
  animationName: { _open: "fade-in", _closed: "fade-out" },
1501
1644
  animationDuration: "slow",
1502
1645
  overflow: "hidden",
1503
- children: /* @__PURE__ */ n(Jn, {})
1646
+ children: /* @__PURE__ */ e(ln, {})
1504
1647
  }
1505
1648
  ),
1506
- /* @__PURE__ */ n(Wn, {})
1649
+ /* @__PURE__ */ e(Qt, {})
1507
1650
  ] });
1508
1651
  };
1509
1652
  export {
1510
- Ln as BOOKMARK_AREA_DATA_ATTRIBUTE,
1511
- jt as ReactReader,
1512
- Ft as ReactReaderProvider
1653
+ Mt as BOOKMARK_AREA_DATA_ATTRIBUTE,
1654
+ ro as ReactReader,
1655
+ oo as ReactReaderProvider
1513
1656
  };
1514
1657
  //# sourceMappingURL=index.js.map