@prose-reader/react-reader 1.271.0 → 1.273.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,62 +1,33 @@
1
- import { jsx as e, jsxs as s, Fragment as de } from "react/jsx-runtime";
2
- import { IconButton as k, Portal as ve, Dialog as z, List as B, Link as xe, Stack as O, Text as b, Tabs as P, Button as W, Presence as ue, Box as _, createToaster as en, Toaster as nn, Toast as J, Spinner as tn, RadioGroup as ie, Slider as M, HStack as F, For as on, Fieldset as N, Heading as me, Kbd as we, Popover as ee, Progress as le, chakra as rn, Collapsible as be, Field as oe, Input as an } from "@chakra-ui/react";
3
- import * as A from "react";
4
- import ln, { createContext as sn, useContext as Fe, memo as g, useState as w, useEffect as $, useCallback as T, useMemo as cn, useLayoutEffect as dn, useRef as un } from "react";
5
- import { LuX as hn, LuNotebookPen as pe, LuBookmark as pn, LuCheck as gn, LuArrowBigRight as fn, LuArrowBigLeft as mn, LuChevronDown as bn, LuCircleHelp as Sn, LuTableOfContents as Cn, LuSearch as vn, LuZoomOut as xn, LuZoomIn as kn, LuGalleryHorizontal as In, LuCircleCheck as ye } from "react-icons/lu";
6
- import { signal as ne, useObserve as S, isDefined as _e, useSubscribe as H, useConstant as he, useSignalValue as Se, useMemoCompare as On, useLiveRef as Rn, useSignalState as Tn } from "reactjrx";
7
- import { Subject as zn, map as E, filter as se, switchMap as V, EMPTY as Pe, of as ge, withLatestFrom as ke, NEVER as Ie, startWith as Mn, distinctUntilChanged as De, throttleTime as Le, tap as $e, first as Ne, combineLatest as wn, mergeMap as yn, Observable as Pn, skip as En, merge as Ve, timer as We, finalize as An, BehaviorSubject as Bn, animationFrameScheduler as Fn } from "rxjs";
8
- import { createPortal as _n } from "react-dom";
9
- import { isPositionInArea as Dn } from "@prose-reader/enhancer-gestures";
10
- import { isShallowEqual as Ln } from "@prose-reader/shared";
11
- import { isShallowEqual as $n, observeIntersection as Nn, isHtmlTagElement as Vn } from "@prose-reader/core";
12
- import { BiFontSize as Wn } from "react-icons/bi";
13
- import { BsBookmarks as Hn } from "react-icons/bs";
1
+ import { jsx as a, jsxs as x, Fragment as et } from "react/jsx-runtime";
2
+ import { c as y } from "react/compiler-runtime";
3
+ import { Presence as tt, Button as re, IconButton as ee, Drawer as fe, Portal as ct, Box as he, Stack as J, Text as q, Textarea as en, Dialog as ie, List as me, Link as Ct, Tabs as ue, createToaster as tn, Toaster as nn, Toast as Ne, Spinner as on, RadioGroup as Qe, Slider as ae, HStack as ge, For as ln, Fieldset as Se, Heading as mt, Kbd as zt, Popover as He, Progress as Ze, chakra as sn, Collapsible as gt, Field as je, Input as an } from "@chakra-ui/react";
4
+ import * as se from "react";
5
+ import rn, { createContext as cn, useContext as At, memo as w, useState as le, useEffect as ce, useLayoutEffect as fn, useRef as dn } from "react";
6
+ import { FaEdit as un } from "react-icons/fa";
7
+ import { LuNotebookPen as Ke, LuX as hn, LuBookmark as mn, LuCheck as gn, LuArrowBigRight as pn, LuArrowBigLeft as bn, LuChevronDown as Sn, LuCircleHelp as _n, LuTableOfContents as vn, LuSearch as Cn, LuZoomOut as xn, LuZoomIn as yn, LuGalleryHorizontal as kn, LuCircleCheck as Rt } from "react-icons/lu";
8
+ import { signal as Ve, useObserve as j, useSignalValue as bt, useSubscribe as pe, isDefined as Et, useConstant as at, useMemoCompare as In, useLiveRef as $n, useSignalState as On } from "reactjrx";
9
+ import { Subject as Tn, EMPTY as St, switchMap as be, map as ne, startWith as Bt, tap as xt, filter as Xe, of as _t, NEVER as ft, withLatestFrom as yt, distinctUntilChanged as rt, combineLatest as Dt, throttleTime as Ft, first as Lt, mergeMap as zn, Observable as Rn, skip as wn, merge as Nt, timer as Ht, finalize as Mn, BehaviorSubject as Pn, animationFrameScheduler as An } from "rxjs";
10
+ import { pick as En, watchKeys as Bn, isShallowEqual as Vt, observeIntersection as Dn, isHtmlTagElement as Fn } from "@prose-reader/core";
11
+ import { createPortal as Ln } from "react-dom";
12
+ import { isPositionInArea as Nn } from "@prose-reader/enhancer-gestures";
13
+ import { isShallowEqual as Hn } from "@prose-reader/shared";
14
+ import { BiFontSize as Vn } from "react-icons/bi";
15
+ import { BsBookmarks as Wn } from "react-icons/bs";
14
16
  import { MdOutlineFitScreen as Gn, MdFullscreenExit as qn, MdFullscreen as jn } from "react-icons/md";
15
17
  import { RiGalleryView2 as Un } from "react-icons/ri";
16
- import { RxDoubleArrowUp as Qn, RxDoubleArrowLeft as Yn, RxDoubleArrowDown as Zn, RxDoubleArrowRight as Xn } from "react-icons/rx";
17
- import { HiOutlineInformationCircle as Kn } from "react-icons/hi";
18
+ import { RxDoubleArrowUp as Qn, RxDoubleArrowLeft as Yn, RxDoubleArrowDown as Zn, RxDoubleArrowRight as Kn } from "react-icons/rx";
19
+ import { HiOutlineInformationCircle as Xn } from "react-icons/hi";
18
20
  import Jn from "rc-slider";
19
21
  import "rc-slider/assets/index.css";
20
- import { IoIosArrowBack as et, IoMdMore as nt } from "react-icons/io";
21
- const tt = "data-bookmark-area", He = 5, ot = A.forwardRef(function(t, o) {
22
- return /* @__PURE__ */ e(k, { variant: "ghost", "aria-label": "Close", ref: o, ...t, children: t.children ?? /* @__PURE__ */ e(hn, {}) });
23
- }), G = A.forwardRef(function(t, o) {
24
- const {
25
- children: r,
26
- portalled: i = !0,
27
- portalRef: a,
28
- backdrop: l = !0,
29
- ...c
30
- } = t;
31
- return /* @__PURE__ */ s(ve, { disabled: !i, container: a, children: [
32
- l && /* @__PURE__ */ e(z.Backdrop, {}),
33
- /* @__PURE__ */ e(z.Positioner, { children: /* @__PURE__ */ e(z.Content, { ref: o, ...c, asChild: !1, children: r }) })
34
- ] });
35
- }), q = A.forwardRef(function(t, o) {
36
- return /* @__PURE__ */ e(
37
- z.CloseTrigger,
38
- {
39
- position: "absolute",
40
- top: "2",
41
- insetEnd: "2",
42
- ...t,
43
- asChild: !0,
44
- children: /* @__PURE__ */ e(ot, { size: "sm", ref: o, children: t.children })
45
- }
46
- );
47
- }), j = z.Root, U = z.Footer, Q = z.Header, Y = z.Body;
48
- z.Backdrop;
49
- const Z = z.Title;
50
- z.Description;
51
- z.Trigger;
52
- const X = z.ActionTrigger, Ge = () => ({
22
+ import { IoIosArrowBack as eo, IoMdMore as to } from "react-icons/io";
23
+ const no = "data-bookmark-area", Wt = 5, Gt = () => ({
53
24
  _quickMenuOpen: !1,
54
- _onQuickMenuOpenChange: (n) => n,
25
+ _onQuickMenuOpenChange: (t) => t,
55
26
  reader: void 0,
56
- quickMenuBottomBarBoundingBoxSignal: ne({
27
+ quickMenuBottomBarBoundingBoxSignal: Ve({
57
28
  default: void 0
58
29
  }),
59
- notificationsSubject: new zn(),
30
+ notificationsSubject: new Tn(),
60
31
  refitMenuOpen: !1,
61
32
  onRefitMenuOpenChange: () => {
62
33
  },
@@ -66,598 +37,1005 @@ const X = z.ActionTrigger, Ge = () => ({
66
37
  fontSizeMin: 0.2,
67
38
  fontSizeMax: 5,
68
39
  uncontrolledFontSize: 1,
69
- enableFloatingProgress: !0
70
- }), Oe = sn(
71
- ne({ default: Ge() })
72
- ), y = (n) => {
73
- const t = Fe(Oe);
74
- return S(t, n);
75
- }, qe = () => Fe(Oe), m = () => {
76
- const { reader: n } = y(["reader"]);
77
- return n;
78
- }, je = (n) => !!n && "__PROSE_READER_ENHANCER_SEARCH" in n, ce = (n) => !!n && "__PROSE_READER_ENHANCER_ANNOTATIONS" in n, Ue = (n) => !!n && "__PROSE_READER_ENHANCER_GALLERY" in n, Qe = (n) => !!n && "__PROSE_READER_ENHANCER_REFIT" in n, rt = (n) => {
79
- const t = m(), o = ce(t) ? t : void 0;
80
- return { data: S(
81
- () => o?.annotations.annotations$.pipe(
82
- E((i) => i.find((a) => a.id === n)),
83
- se(_e),
84
- V((i) => o.locateResource(i))
85
- ),
86
- [o]
87
- ) };
88
- }, Ye = ({
89
- id: n,
90
- onNavigate: t,
91
- allowLeftIcon: o = !0
92
- }) => {
93
- const r = m(), { data: i } = rt(n), a = i?.meta.range?.toString() || i?.meta.node?.textContent;
94
- return /* @__PURE__ */ e(B.Item, { children: /* @__PURE__ */ s(
95
- xe,
96
- {
97
- href: "#",
98
- onClick: () => {
99
- t(), r?.navigation.goToCfi(i?.meta.cfi ?? "");
100
- },
101
- children: [
102
- i?.resource?.notes ? /* @__PURE__ */ e(B.Indicator, { asChild: !0, children: /* @__PURE__ */ e(pe, {}) }) : o ? /* @__PURE__ */ e(B.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ e(pe, {}) }) : null,
103
- /* @__PURE__ */ s(O, { gap: 0, children: [
104
- a ? /* @__PURE__ */ e(b, { lineClamp: 2, fontSize: "md", children: a }) : /* @__PURE__ */ s(b, { lineClamp: 2, fontSize: "md", fontStyle: "italic", children: [
105
- "Page ",
106
- (i?.meta.absolutePageIndex ?? 0) + 1
107
- ] }),
108
- /* @__PURE__ */ e(
109
- b,
110
- {
111
- fontStyle: "italic",
112
- fontWeight: "bold",
113
- fontSize: "sm",
114
- children: `Book page: ${i?.meta?.absolutePageIndex !== void 0 ? i.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
115
- }
116
- )
117
- ] })
118
- ]
119
- }
120
- ) });
121
- }, fe = () => {
122
- const n = m(), t = ce(n) ? n : void 0;
123
- return { data: S(
124
- () => t?.annotations.annotations$.pipe(
125
- V(
126
- (r) => t.locateResource(r)
127
- )
128
- ),
129
- [t]
130
- ) };
131
- }, it = () => {
132
- const { data: n } = fe();
133
- return {
134
- data: n?.filter((t) => t.meta.isCfiRange)
135
- };
136
- }, at = ({ onNavigate: n }) => {
137
- const { data: t } = it();
138
- return /* @__PURE__ */ e(B.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: t?.map((o) => /* @__PURE__ */ e(
139
- Ye,
140
- {
141
- id: o.resource.id,
142
- onNavigate: n
143
- },
144
- o.resource.id
145
- )) });
146
- }, lt = () => {
147
- const { data: n } = fe();
40
+ enableFloatingProgress: !0,
41
+ selectedHighlight: void 0
42
+ }), kt = cn(Ve({
43
+ default: Gt()
44
+ })), oe = (t) => {
45
+ const e = y(9), o = At(kt);
46
+ let n;
47
+ e[0] !== o || e[1] !== t ? (n = () => o.pipe(Bn(t)), e[0] = o, e[1] = t, e[2] = n) : n = e[2];
48
+ let l;
49
+ e[3] !== o.value || e[4] !== t ? (l = En(o.value, t), e[3] = o.value, e[4] = t, e[5] = l) : l = e[5];
50
+ let i;
51
+ e[6] !== l ? (i = {
52
+ compareFn: Vt,
53
+ defaultValue: l
54
+ }, e[6] = l, e[7] = i) : i = e[7];
55
+ let s;
56
+ return e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = [], e[8] = s) : s = e[8], j(n, i, s).data;
57
+ }, We = () => At(kt), oo = 24, qt = w((t) => {
58
+ const e = y(9);
59
+ let o, n;
60
+ e[0] !== t ? ({
61
+ children: o,
62
+ ...n
63
+ } = t, e[0] = t, e[1] = o, e[2] = n) : (o = e[1], n = e[2]);
64
+ let l;
65
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = ["quickMenuBottomBarBoundingBoxSignal", "zoomMaxScale"], e[3] = l) : l = e[3];
66
+ const {
67
+ quickMenuBottomBarBoundingBoxSignal: i
68
+ } = oe(l), r = bt(i)?.borderBoxSize?.[0]?.blockSize || oo;
69
+ let c;
70
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = {
71
+ _open: "fade-in",
72
+ _closed: "fade-out"
73
+ }, e[4] = c) : c = e[4];
74
+ const f = `calc(${r}px + var(--chakra-spacing-4))`;
75
+ let u;
76
+ return e[5] !== o || e[6] !== n || e[7] !== f ? (u = /* @__PURE__ */ a(tt, { animationName: c, animationDuration: "moderate", position: "absolute", bottom: f, right: 4, backgroundColor: "bg.panel", shadow: "sm", borderRadius: "md", p: 2, display: "flex", flexDirection: "row", gap: 2, ...n, children: o }), e[5] = o, e[6] = n, e[7] = f, e[8] = u) : u = e[8], u;
77
+ }), U = () => {
78
+ const t = y(1);
79
+ let e;
80
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = ["reader"], t[0] = e) : e = t[0];
81
+ const {
82
+ reader: o
83
+ } = oe(e);
84
+ return o;
85
+ }, jt = (t) => !!t && "__PROSE_READER_ENHANCER_SEARCH" in t, Je = (t) => !!t && "__PROSE_READER_ENHANCER_ANNOTATIONS" in t, Ut = (t) => !!t && "__PROSE_READER_ENHANCER_GALLERY" in t, Qt = (t) => !!t && "__PROSE_READER_ENHANCER_REFIT" in t, nt = () => {
86
+ const t = y(2), e = U();
87
+ let o;
88
+ return t[0] !== e ? (o = Je(e) ? e : void 0, t[0] = e, t[1] = o) : o = t[1], o;
89
+ }, lo = () => {
90
+ const t = y(16), e = nt(), o = We();
91
+ let n;
92
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = ["selectedHighlight"], t[0] = n) : n = t[0];
93
+ const {
94
+ selectedHighlight: l
95
+ } = oe(n);
96
+ let i;
97
+ t[1] !== e ? (i = () => e?.selection.selectionOver$.pipe(be(() => e.selection.selectionEnd$.pipe(ne(io), Bt(!0)))) ?? St, t[1] = e, t[2] = i) : i = t[2];
98
+ let s;
99
+ t[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = {
100
+ defaultValue: !1
101
+ }, t[3] = s) : s = t[3];
102
+ let r;
103
+ t[4] !== e ? (r = [e], t[4] = e, t[5] = r) : r = t[5];
104
+ const {
105
+ data: c
106
+ } = j(i, s, r), f = c && !l;
107
+ let u;
108
+ t[6] !== o || t[7] !== e?.selection ? (u = () => {
109
+ const p = e?.selection.getSelection();
110
+ p && o.update((b) => ({
111
+ ...b,
112
+ selectedHighlight: {
113
+ selection: p
114
+ }
115
+ }));
116
+ }, t[6] = o, t[7] = e?.selection, t[8] = u) : u = t[8];
117
+ let d;
118
+ t[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ a(un, {}), t[9] = d) : d = t[9];
119
+ let h;
120
+ t[10] !== u ? (h = /* @__PURE__ */ x(re, { variant: "outline", size: "sm", onClick: u, children: [
121
+ d,
122
+ "Annotate"
123
+ ] }), t[10] = u, t[11] = h) : h = t[11];
124
+ let m;
125
+ t[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ x(re, { variant: "outline", size: "sm", disabled: !0, children: [
126
+ /* @__PURE__ */ a(Ke, {}),
127
+ "Bookmark"
128
+ ] }), t[12] = m) : m = t[12];
129
+ let g;
130
+ return t[13] !== f || t[14] !== h ? (g = /* @__PURE__ */ x(qt, { present: f, children: [
131
+ h,
132
+ m
133
+ ] }), t[13] = f, t[14] = h, t[15] = g) : g = t[15], g;
134
+ };
135
+ function io() {
136
+ return !1;
137
+ }
138
+ const so = (t, e = 50) => t.length <= e ? t : `${t.slice(0, e)}...`, Yt = se.forwardRef(function(e, o) {
139
+ const n = y(6);
140
+ let l;
141
+ n[0] !== e.children ? (l = e.children ?? /* @__PURE__ */ a(hn, {}), n[0] = e.children, n[1] = l) : l = n[1];
142
+ let i;
143
+ return n[2] !== e || n[3] !== o || n[4] !== l ? (i = /* @__PURE__ */ a(ee, { variant: "ghost", "aria-label": "Close", ref: o, ...e, children: l }), n[2] = e, n[3] = o, n[4] = l, n[5] = i) : i = n[5], i;
144
+ }), ao = se.forwardRef(function(e, o) {
145
+ const n = y(17);
146
+ let l, i, s, r, c;
147
+ n[0] !== e ? ({
148
+ children: l,
149
+ portalled: c,
150
+ portalRef: s,
151
+ offset: i,
152
+ ...r
153
+ } = e, n[0] = e, n[1] = l, n[2] = i, n[3] = s, n[4] = r, n[5] = c) : (l = n[1], i = n[2], s = n[3], r = n[4], c = n[5]);
154
+ const u = !(c === void 0 ? !0 : c);
155
+ let d;
156
+ n[6] !== l || n[7] !== o || n[8] !== r ? (d = /* @__PURE__ */ a(fe.Content, { ref: o, ...r, asChild: !1, children: l }), n[6] = l, n[7] = o, n[8] = r, n[9] = d) : d = n[9];
157
+ let h;
158
+ n[10] !== i || n[11] !== d ? (h = /* @__PURE__ */ a(fe.Positioner, { padding: i, children: d }), n[10] = i, n[11] = d, n[12] = h) : h = n[12];
159
+ let m;
160
+ return n[13] !== s || n[14] !== u || n[15] !== h ? (m = /* @__PURE__ */ a(ct, { disabled: u, container: s, children: h }), n[13] = s, n[14] = u, n[15] = h, n[16] = m) : m = n[16], m;
161
+ });
162
+ se.forwardRef(function(e, o) {
163
+ const n = y(5);
164
+ let l;
165
+ n[0] !== o ? (l = /* @__PURE__ */ a(Yt, { size: "sm", ref: o }), n[0] = o, n[1] = l) : l = n[1];
166
+ let i;
167
+ return n[2] !== e || n[3] !== l ? (i = /* @__PURE__ */ a(fe.CloseTrigger, { position: "absolute", top: "2", insetEnd: "2", ...e, asChild: !0, children: l }), n[2] = e, n[3] = l, n[4] = i) : i = n[4], i;
168
+ });
169
+ fe.Trigger;
170
+ const ro = fe.Root;
171
+ fe.Footer;
172
+ const co = fe.Header, fo = fe.Body, uo = fe.Backdrop;
173
+ fe.Description;
174
+ fe.Title;
175
+ fe.ActionTrigger;
176
+ const pt = [
177
+ "rgba(216, 191, 216, 1)",
178
+ // Light purple
179
+ "rgba(255, 225, 125, 1)",
180
+ // Soft yellow
181
+ "rgba(144, 238, 144, 1)",
182
+ // Light green
183
+ "rgba(173, 216, 230, 1)",
184
+ // Light blue
185
+ "rgba(255, 182, 193, 1)"
186
+ // Light pink
187
+ ], ho = w(() => {
188
+ const t = y(60), e = nt();
189
+ let o;
190
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = ["selectedHighlight", "onAnnotationCreate", "onAnnotationUpdate", "onAnnotationDelete"], t[0] = o) : o = t[0];
191
+ const {
192
+ selectedHighlight: n,
193
+ onAnnotationCreate: l,
194
+ onAnnotationUpdate: i,
195
+ onAnnotationDelete: s
196
+ } = oe(o), r = We(), {
197
+ highlight: c,
198
+ selection: f
199
+ } = n ?? {}, [u, d] = le(pt[0]), [h, m] = le(""), g = !!(f ?? c);
200
+ let p;
201
+ t[1] !== r ? (p = () => {
202
+ r.update(mo);
203
+ }, t[1] = r, t[2] = p) : p = t[2];
204
+ const b = p;
205
+ let S;
206
+ t[3] !== b ? (S = (D) => {
207
+ D.open || b();
208
+ }, t[3] = b, t[4] = S) : S = t[4];
209
+ const _ = S, v = c?.highlightColor, C = c?.notes;
210
+ let I;
211
+ t[5] !== m ? (I = () => {
212
+ m("");
213
+ }, t[5] = m, t[6] = I) : I = t[6];
214
+ let k;
215
+ t[7] !== g ? (k = [g], t[7] = g, t[8] = k) : k = t[8], ce(I, k), ce(() => {
216
+ m(C ?? "");
217
+ }, [C]), ce(() => {
218
+ d(v || pt[0]);
219
+ }, [v, g]);
220
+ let $;
221
+ t[9] !== r || t[10] !== e?.annotations.highlightTap$ ? ($ = function() {
222
+ return e?.annotations.highlightTap$.pipe(xt((de) => {
223
+ const {
224
+ highlight: R
225
+ } = de;
226
+ r.update((te) => ({
227
+ ...te,
228
+ selectedHighlight: {
229
+ highlight: R
230
+ }
231
+ }));
232
+ }));
233
+ }, t[9] = r, t[10] = e?.annotations.highlightTap$, t[11] = $) : $ = t[11];
234
+ let O;
235
+ t[12] !== e ? (O = [e], t[12] = e, t[13] = O) : O = t[13], pe($, O);
236
+ const z = ro, E = "bottom";
237
+ let T;
238
+ t[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ a(uo, {}), t[14] = T) : T = t[14];
239
+ const N = ao, M = co, H = "1px", Q = c ? "Highlight" : `Selection: "${so(f?.selection?.toString() ?? "", 10)}"`;
240
+ let K;
241
+ t[15] !== M || t[16] !== Q ? (K = /* @__PURE__ */ a(M, { borderBottomWidth: H, children: Q }), t[15] = M, t[16] = Q, t[17] = K) : K = t[17];
242
+ let V;
243
+ t[18] !== u || t[19] !== d ? (V = pt.map((D) => /* @__PURE__ */ a(he, { bgColor: D, height: 10, width: 10, borderRadius: "50%", cursor: "pointer", ...u === D && {
244
+ border: "4px solid white"
245
+ }, onClick: () => d(D) }, D)), t[18] = u, t[19] = d, t[20] = V) : V = t[20];
246
+ let W;
247
+ t[21] !== V ? (W = /* @__PURE__ */ a(J, { gap: 2, flexDirection: "row", children: V }), t[21] = V, t[22] = W) : W = t[22];
248
+ let G;
249
+ t[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ a(q, { children: "Annotation:" }), t[23] = G) : G = t[23];
250
+ let F;
251
+ t[24] !== m ? (F = (D) => m(D.target.value), t[24] = m, t[25] = F) : F = t[25];
252
+ let P;
253
+ t[26] !== h || t[27] !== F ? (P = /* @__PURE__ */ a(en, { value: h, onChange: F }), t[26] = h, t[27] = F, t[28] = P) : P = t[28];
254
+ let Y;
255
+ t[29] !== W || t[30] !== P ? (Y = /* @__PURE__ */ x(J, { children: [
256
+ W,
257
+ G,
258
+ P
259
+ ] }), t[29] = W, t[30] = P, t[31] = Y) : Y = t[31];
260
+ let Z;
261
+ t[32] !== h || t[33] !== l || t[34] !== b || t[35] !== e?.annotations || t[36] !== u || t[37] !== f ? (Z = !!f && /* @__PURE__ */ a(re, { onClick: () => {
262
+ b();
263
+ const D = e?.annotations.createAnnotation({
264
+ ...f,
265
+ highlightColor: u,
266
+ notes: h
267
+ });
268
+ D && l?.(D);
269
+ }, children: "Highlight" }), t[32] = h, t[33] = l, t[34] = b, t[35] = e?.annotations, t[36] = u, t[37] = f, t[38] = Z) : Z = t[38];
270
+ let A;
271
+ t[39] !== h || t[40] !== c || t[41] !== s || t[42] !== i || t[43] !== b || t[44] !== u ? (A = !!c && /* @__PURE__ */ x(J, { direction: "row", children: [
272
+ /* @__PURE__ */ a(re, { flex: 1, onClick: () => {
273
+ b(), i?.({
274
+ id: c.id,
275
+ highlightColor: u,
276
+ notes: h
277
+ });
278
+ }, children: "Update" }),
279
+ /* @__PURE__ */ a(re, { flex: 1, variant: "surface", onClick: () => {
280
+ b(), s?.(c.id);
281
+ }, children: "Remove" })
282
+ ] }), t[39] = h, t[40] = c, t[41] = s, t[42] = i, t[43] = b, t[44] = u, t[45] = A) : A = t[45];
283
+ let L;
284
+ t[46] !== Y || t[47] !== Z || t[48] !== A ? (L = /* @__PURE__ */ x(fo, { gap: 4, display: "flex", flexDirection: "column", pb: 4, children: [
285
+ Y,
286
+ Z,
287
+ A
288
+ ] }), t[46] = Y, t[47] = Z, t[48] = A, t[49] = L) : L = t[49];
289
+ let X;
290
+ t[50] !== N || t[51] !== K || t[52] !== L ? (X = /* @__PURE__ */ x(N, { children: [
291
+ K,
292
+ L
293
+ ] }), t[50] = N, t[51] = K, t[52] = L, t[53] = X) : X = t[53];
294
+ let B;
295
+ return t[54] !== z || t[55] !== g || t[56] !== _ || t[57] !== X || t[58] !== T ? (B = /* @__PURE__ */ x(z, { placement: E, onOpenChange: _, open: g, children: [
296
+ T,
297
+ X
298
+ ] }), t[54] = z, t[55] = g, t[56] = _, t[57] = X, t[58] = T, t[59] = B) : B = t[59], B;
299
+ });
300
+ function mo(t) {
148
301
  return {
149
- data: n?.filter(
150
- (t) => !t.meta.isCfiRange && !t.resource.notes
151
- )
302
+ ...t,
303
+ selectedHighlight: void 0
152
304
  };
153
- }, st = ({ onNavigate: n }) => {
154
- const { data: t } = lt();
155
- return /* @__PURE__ */ e(B.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: t?.map((o) => /* @__PURE__ */ e(
156
- Ye,
157
- {
158
- id: o.resource.id,
159
- onNavigate: n,
160
- allowLeftIcon: !1
161
- },
162
- o.resource.id
163
- )) });
164
- }, ct = g(
165
- ({
305
+ }
306
+ const _e = se.forwardRef(function(e, o) {
307
+ const n = y(17);
308
+ let l, i, s, r, c;
309
+ n[0] !== e ? ({
310
+ children: l,
311
+ portalled: r,
312
+ portalRef: i,
313
+ backdrop: c,
314
+ ...s
315
+ } = e, n[0] = e, n[1] = l, n[2] = i, n[3] = s, n[4] = r, n[5] = c) : (l = n[1], i = n[2], s = n[3], r = n[4], c = n[5]);
316
+ const f = r === void 0 ? !0 : r, u = c === void 0 ? !0 : c, d = !f;
317
+ let h;
318
+ n[6] !== u ? (h = u && /* @__PURE__ */ a(ie.Backdrop, {}), n[6] = u, n[7] = h) : h = n[7];
319
+ let m;
320
+ n[8] !== l || n[9] !== o || n[10] !== s ? (m = /* @__PURE__ */ a(ie.Positioner, { children: /* @__PURE__ */ a(ie.Content, { ref: o, ...s, asChild: !1, children: l }) }), n[8] = l, n[9] = o, n[10] = s, n[11] = m) : m = n[11];
321
+ let g;
322
+ return n[12] !== i || n[13] !== d || n[14] !== h || n[15] !== m ? (g = /* @__PURE__ */ x(ct, { disabled: d, container: i, children: [
323
+ h,
324
+ m
325
+ ] }), n[12] = i, n[13] = d, n[14] = h, n[15] = m, n[16] = g) : g = n[16], g;
326
+ }), ve = se.forwardRef(function(e, o) {
327
+ const n = y(6);
328
+ let l;
329
+ n[0] !== e.children || n[1] !== o ? (l = /* @__PURE__ */ a(Yt, { size: "sm", ref: o, children: e.children }), n[0] = e.children, n[1] = o, n[2] = l) : l = n[2];
330
+ let i;
331
+ return n[3] !== e || n[4] !== l ? (i = /* @__PURE__ */ a(ie.CloseTrigger, { position: "absolute", top: "2", insetEnd: "2", ...e, asChild: !0, children: l }), n[3] = e, n[4] = l, n[5] = i) : i = n[5], i;
332
+ }), Ce = ie.Root, xe = ie.Footer, ye = ie.Header, ke = ie.Body;
333
+ ie.Backdrop;
334
+ const Ie = ie.Title;
335
+ ie.Description;
336
+ ie.Trigger;
337
+ const $e = ie.ActionTrigger, go = (t) => {
338
+ const e = y(7), o = U();
339
+ let n;
340
+ e[0] !== o ? (n = Je(o) ? o : void 0, e[0] = o, e[1] = n) : n = e[1];
341
+ const l = n;
342
+ let i;
343
+ e[2] !== t || e[3] !== l ? (i = () => l?.annotations.annotations$.pipe(ne((r) => r.find((c) => c.id === t)), Xe(Et), be((r) => l.locateResource(r))), e[2] = t, e[3] = l, e[4] = i) : i = e[4];
344
+ let s;
345
+ return e[5] !== l ? (s = [l], e[5] = l, e[6] = s) : s = e[6], j(i, s);
346
+ }, Zt = (t) => {
347
+ const e = y(22), {
348
+ id: o,
166
349
  onNavigate: n,
167
- defaultTab: t
168
- }) => {
169
- const [o, r] = w(t ?? "bookmarks");
170
- return /* @__PURE__ */ s(
171
- P.Root,
172
- {
173
- value: o,
174
- onValueChange: (i) => r(i.value),
175
- children: [
176
- /* @__PURE__ */ s(P.List, { children: [
177
- /* @__PURE__ */ s(P.Trigger, { value: "bookmarks", children: [
178
- /* @__PURE__ */ e(pn, {}),
179
- "Bookmarks"
180
- ] }),
181
- /* @__PURE__ */ s(P.Trigger, { value: "annotations", children: [
182
- /* @__PURE__ */ e(pe, {}),
183
- "Annotations"
184
- ] }),
185
- /* @__PURE__ */ e(P.Indicator, {})
186
- ] }),
187
- /* @__PURE__ */ e(P.Content, { value: "bookmarks", children: /* @__PURE__ */ e(st, { onNavigate: n }) }),
188
- /* @__PURE__ */ e(P.Content, { value: "annotations", children: /* @__PURE__ */ e(at, { onNavigate: n }) })
189
- ]
190
- }
191
- );
192
- }
193
- ), dt = g(
194
- ({
195
- openWith: n,
196
- setOpen: t,
350
+ allowLeftIcon: l
351
+ } = t, i = l === void 0 ? !0 : l, s = U(), {
352
+ data: r
353
+ } = go(o);
354
+ let c;
355
+ e[0] !== r?.meta.node?.textContent || e[1] !== r?.meta.range ? (c = r?.meta.range?.toString() || r?.meta.node?.textContent, e[0] = r?.meta.node?.textContent, e[1] = r?.meta.range, e[2] = c) : c = e[2];
356
+ const f = c;
357
+ let u;
358
+ e[3] !== r?.meta || e[4] !== n || e[5] !== s?.navigation ? (u = () => {
359
+ n(), s?.navigation.goToCfi(r?.meta.cfi ?? "");
360
+ }, e[3] = r?.meta, e[4] = n, e[5] = s?.navigation, e[6] = u) : u = e[6];
361
+ let d;
362
+ e[7] !== i || e[8] !== r?.resource?.notes ? (d = r?.resource?.notes ? /* @__PURE__ */ a(me.Indicator, { asChild: !0, children: /* @__PURE__ */ a(Ke, {}) }) : i ? /* @__PURE__ */ a(me.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ a(Ke, {}) }) : null, e[7] = i, e[8] = r?.resource?.notes, e[9] = d) : d = e[9];
363
+ let h;
364
+ e[10] !== r?.meta || e[11] !== f ? (h = f ? /* @__PURE__ */ a(q, { lineClamp: 2, fontSize: "md", children: f }) : /* @__PURE__ */ x(q, { lineClamp: 2, fontSize: "md", fontStyle: "italic", children: [
365
+ "Page ",
366
+ (r?.meta.absolutePageIndex ?? 0) + 1
367
+ ] }), e[10] = r?.meta, e[11] = f, e[12] = h) : h = e[12];
368
+ const m = `Book page: ${r?.meta?.absolutePageIndex !== void 0 ? r.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`;
369
+ let g;
370
+ e[13] !== m ? (g = /* @__PURE__ */ a(q, { fontStyle: "italic", fontWeight: "bold", fontSize: "sm", children: m }), e[13] = m, e[14] = g) : g = e[14];
371
+ let p;
372
+ e[15] !== h || e[16] !== g ? (p = /* @__PURE__ */ x(J, { gap: 0, children: [
373
+ h,
374
+ g
375
+ ] }), e[15] = h, e[16] = g, e[17] = p) : p = e[17];
376
+ let b;
377
+ return e[18] !== u || e[19] !== d || e[20] !== p ? (b = /* @__PURE__ */ a(me.Item, { children: /* @__PURE__ */ x(Ct, { href: "#", onClick: u, children: [
378
+ d,
379
+ p
380
+ ] }) }), e[18] = u, e[19] = d, e[20] = p, e[21] = b) : b = e[21], b;
381
+ }, dt = () => {
382
+ const t = y(5), e = U();
383
+ let o;
384
+ t[0] !== e ? (o = Je(e) ? e : void 0, t[0] = e, t[1] = o) : o = t[1];
385
+ const n = o;
386
+ let l, i;
387
+ return t[2] !== n ? (l = () => n?.annotations.annotations$.pipe(be((s) => n.locateResource(s))), i = [n], t[2] = n, t[3] = l, t[4] = i) : (l = t[3], i = t[4]), j(l, i);
388
+ }, po = () => {
389
+ const t = y(4), {
390
+ data: e
391
+ } = dt();
392
+ let o;
393
+ t[0] !== e ? (o = e?.filter(bo), t[0] = e, t[1] = o) : o = t[1];
394
+ let n;
395
+ return t[2] !== o ? (n = {
396
+ data: o
397
+ }, t[2] = o, t[3] = n) : n = t[3], n;
398
+ };
399
+ function bo(t) {
400
+ return t.meta.isCfiRange;
401
+ }
402
+ const So = (t) => {
403
+ const e = y(5), {
197
404
  onNavigate: o
198
- }) => /* @__PURE__ */ e(
199
- j,
200
- {
201
- lazyMount: !0,
202
- placement: "center",
203
- open: !!n,
204
- onOpenChange: (r) => t(r.open),
205
- size: { mdDown: "full", md: "lg" },
206
- scrollBehavior: "inside",
207
- children: /* @__PURE__ */ s(G, { height: "100%", children: [
208
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(Z, { children: "Annotations" }) }),
209
- /* @__PURE__ */ e(Y, { flex: 1, children: /* @__PURE__ */ e(
210
- ct,
211
- {
212
- onNavigate: o,
213
- defaultTab: n
214
- }
215
- ) }),
216
- /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(X, { asChild: !0, children: /* @__PURE__ */ e(W, { variant: "outline", children: "Cancel" }) }) }),
217
- /* @__PURE__ */ e(q, {})
218
- ] })
219
- }
220
- )
221
- ), ut = g(({ children: n }) => {
222
- const t = m(), o = S(() => t?.spine.element$, [t]);
223
- return o ? /* @__PURE__ */ e(de, { children: _n(n, o) }) : null;
224
- }), ht = ({
225
- absolutePageIndex: n,
226
- itemIndex: t
227
- }) => {
228
- const o = m();
229
- return {
230
- spineItem: S(() => o ? t !== void 0 ? ge(o.spine.spineItemsManager.get(t)) : n !== void 0 ? o.spine.pages.observeFromAbsolutePageIndex(n).pipe(
231
- E((i) => o.spine.spineItemsManager.get(i?.itemIndex))
232
- ) : Pe : Pe, [t, n, o])
233
- };
234
- }, pt = ({
235
- absolutePageIndex: n,
236
- itemIndex: t
237
- }) => {
238
- const { spineItem: o } = ht({ absolutePageIndex: n, itemIndex: t }), r = S(
239
- () => o?.isReady$ ?? ge(!1),
240
- [o]
241
- );
242
- return { spineItem: o, isReady: r };
243
- }, gt = g(
244
- ({
245
- absolutePageIndex: n,
246
- left: t,
247
- top: o,
248
- width: r
249
- }) => {
250
- const { isReady: i } = pt({
251
- absolutePageIndex: n
252
- }), { data: a } = fe(), l = a?.find(
253
- (d) => d?.meta?.absolutePageIndex === n && !d.meta.isCfiRange
254
- );
255
- if (!i) return null;
256
- const c = r * 0.1 / 2;
257
- return /* @__PURE__ */ e(
258
- ue,
259
- {
260
- present: !!l,
261
- lazyMount: !0,
262
- animationName: { _open: "fade-in", _closed: "fade-out" },
263
- animationDuration: "moderate",
264
- children: /* @__PURE__ */ e(
265
- _,
266
- {
267
- "data-bookmark-area": tt,
268
- position: "absolute",
269
- left: t + r,
270
- transform: "translateX(-100%)",
271
- pointerEvents: "none",
272
- top: o,
273
- width: c,
274
- height: c,
275
- _before: {
276
- content: '""',
277
- position: "absolute",
278
- top: 0,
279
- left: 0,
280
- width: 0,
281
- height: 0,
282
- borderTop: `${c}px solid #03030373`,
283
- borderLeft: `${c}px solid transparent`
284
- }
285
- }
286
- )
287
- }
288
- );
289
- }
290
- ), ft = g(() => {
291
- const n = m(), t = S(() => n?.layoutInfo$, [n]);
292
- return /* @__PURE__ */ e(ut, { children: t?.pages.map(
293
- ({ absoluteLayout: { left: o, top: r, width: i } }, a) => /* @__PURE__ */ e(
294
- gt,
295
- {
296
- absolutePageIndex: a,
297
- left: o,
298
- top: r,
299
- width: i
300
- },
301
- a
302
- )
303
- ) });
304
- }), Ze = () => {
305
- const n = m();
306
- return ce(n) ? n : void 0;
307
- }, re = !0, mt = () => {
308
- const n = Ze(), { data: t } = fe();
309
- $(() => n ? n.gestures.hooks.register(
310
- "beforeTapGesture",
311
- ({ event$: r }) => r.pipe(
312
- ke(n?.annotations.candidates$),
313
- E(([i, a]) => {
314
- if (!i.page) return re;
315
- const {
316
- spineItem: l,
317
- spineItemPageIndex: c,
318
- spineItemPagePosition: d,
319
- pageSize: u
320
- } = i.page;
321
- if (Dn(
322
- d,
323
- {
324
- type: "corner",
325
- corner: "top-right",
326
- size: 10,
327
- unit: "%"
328
- },
329
- u
330
- )) {
331
- const h = n.spine.pages.fromSpineItemPageIndex(
332
- l,
333
- c
334
- );
335
- if (!h) return re;
336
- const C = t?.find(
337
- (R) => R?.meta?.absolutePageIndex === h.absolutePageIndex && R.meta.range === void 0
338
- );
339
- if (C)
340
- return n?.annotations.delete(C.resource.id), !re;
341
- if (a?.[h.absolutePageIndex])
342
- return n?.annotations.annotateAbsolutePage({
343
- absolutePageIndex: h.absolutePageIndex
344
- }), !re;
405
+ } = t, {
406
+ data: n
407
+ } = po();
408
+ let l;
409
+ e[0] !== n || e[1] !== o ? (l = n?.map((s) => /* @__PURE__ */ a(Zt, { id: s.resource.id, onNavigate: o }, s.resource.id)), e[0] = n, e[1] = o, e[2] = l) : l = e[2];
410
+ let i;
411
+ return e[3] !== l ? (i = /* @__PURE__ */ a(me.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: l }), e[3] = l, e[4] = i) : i = e[4], i;
412
+ }, _o = () => {
413
+ const t = y(4), {
414
+ data: e
415
+ } = dt();
416
+ let o;
417
+ t[0] !== e ? (o = e?.filter(vo), t[0] = e, t[1] = o) : o = t[1];
418
+ let n;
419
+ return t[2] !== o ? (n = {
420
+ data: o
421
+ }, t[2] = o, t[3] = n) : n = t[3], n;
422
+ };
423
+ function vo(t) {
424
+ return !t.meta.isCfiRange && !t.resource.notes;
425
+ }
426
+ const Co = (t) => {
427
+ const e = y(5), {
428
+ onNavigate: o
429
+ } = t, {
430
+ data: n
431
+ } = _o();
432
+ let l;
433
+ e[0] !== n || e[1] !== o ? (l = n?.map((s) => /* @__PURE__ */ a(Zt, { id: s.resource.id, onNavigate: o, allowLeftIcon: !1 }, s.resource.id)), e[0] = n, e[1] = o, e[2] = l) : l = e[2];
434
+ let i;
435
+ return e[3] !== l ? (i = /* @__PURE__ */ a(me.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: l }), e[3] = l, e[4] = i) : i = e[4], i;
436
+ }, xo = w((t) => {
437
+ const e = y(11), {
438
+ onNavigate: o,
439
+ defaultTab: n
440
+ } = t, [l, i] = le(n ?? "bookmarks");
441
+ let s;
442
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = (h) => i(h.value), e[0] = s) : s = e[0];
443
+ let r;
444
+ e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ x(ue.Trigger, { value: "bookmarks", children: [
445
+ /* @__PURE__ */ a(mn, {}),
446
+ "Bookmarks"
447
+ ] }), e[1] = r) : r = e[1];
448
+ let c;
449
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ x(ue.List, { children: [
450
+ r,
451
+ /* @__PURE__ */ x(ue.Trigger, { value: "annotations", children: [
452
+ /* @__PURE__ */ a(Ke, {}),
453
+ "Annotations"
454
+ ] }),
455
+ /* @__PURE__ */ a(ue.Indicator, {})
456
+ ] }), e[2] = c) : c = e[2];
457
+ let f;
458
+ e[3] !== o ? (f = /* @__PURE__ */ a(ue.Content, { value: "bookmarks", children: /* @__PURE__ */ a(Co, { onNavigate: o }) }), e[3] = o, e[4] = f) : f = e[4];
459
+ let u;
460
+ e[5] !== o ? (u = /* @__PURE__ */ a(ue.Content, { value: "annotations", children: /* @__PURE__ */ a(So, { onNavigate: o }) }), e[5] = o, e[6] = u) : u = e[6];
461
+ let d;
462
+ return e[7] !== f || e[8] !== u || e[9] !== l ? (d = /* @__PURE__ */ x(ue.Root, { value: l, onValueChange: s, children: [
463
+ c,
464
+ f,
465
+ u
466
+ ] }), e[7] = f, e[8] = u, e[9] = l, e[10] = d) : d = e[10], d;
467
+ }), yo = w((t) => {
468
+ const e = y(15), {
469
+ openWith: o,
470
+ setOpen: n,
471
+ onNavigate: l
472
+ } = t, i = !!o;
473
+ let s;
474
+ e[0] !== n ? (s = (g) => n(g.open), e[0] = n, e[1] = s) : s = e[1];
475
+ let r;
476
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = {
477
+ mdDown: "full",
478
+ md: "lg"
479
+ }, e[2] = r) : r = e[2];
480
+ let c;
481
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ a(ye, { children: /* @__PURE__ */ a(Ie, { children: "Annotations" }) }), e[3] = c) : c = e[3];
482
+ let f;
483
+ e[4] !== l || e[5] !== o ? (f = /* @__PURE__ */ a(ke, { flex: 1, children: /* @__PURE__ */ a(xo, { onNavigate: l, defaultTab: o }) }), e[4] = l, e[5] = o, e[6] = f) : f = e[6];
484
+ let u, d;
485
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ a(xe, { children: /* @__PURE__ */ a($e, { asChild: !0, children: /* @__PURE__ */ a(re, { variant: "outline", children: "Cancel" }) }) }), d = /* @__PURE__ */ a(ve, {}), e[7] = u, e[8] = d) : (u = e[7], d = e[8]);
486
+ let h;
487
+ e[9] !== f ? (h = /* @__PURE__ */ x(_e, { height: "100%", children: [
488
+ c,
489
+ f,
490
+ u,
491
+ d
492
+ ] }), e[9] = f, e[10] = h) : h = e[10];
493
+ let m;
494
+ return e[11] !== i || e[12] !== s || e[13] !== h ? (m = /* @__PURE__ */ a(Ce, { lazyMount: !0, placement: "center", open: i, onOpenChange: s, size: r, scrollBehavior: "inside", children: h }), e[11] = i, e[12] = s, e[13] = h, e[14] = m) : m = e[14], m;
495
+ }), ko = w((t) => {
496
+ const e = y(9), {
497
+ children: o
498
+ } = t, n = U();
499
+ let l;
500
+ e[0] !== n?.spine.element$ ? (l = () => n?.spine.element$, e[0] = n?.spine.element$, e[1] = l) : l = e[1];
501
+ let i;
502
+ e[2] !== n ? (i = [n], e[2] = n, e[3] = i) : i = e[3];
503
+ const {
504
+ data: s
505
+ } = j(l, i);
506
+ if (!s)
507
+ return null;
508
+ let r;
509
+ e[4] !== o || e[5] !== s ? (r = Ln(o, s), e[4] = o, e[5] = s, e[6] = r) : r = e[6];
510
+ let c;
511
+ return e[7] !== r ? (c = /* @__PURE__ */ a(et, { children: r }), e[7] = r, e[8] = c) : c = e[8], c;
512
+ }), Io = (t) => {
513
+ const e = y(5), {
514
+ absolutePageIndex: o,
515
+ itemIndex: n
516
+ } = t, l = U();
517
+ let i, s;
518
+ return e[0] !== o || e[1] !== n || e[2] !== l ? (i = () => l ? n !== void 0 ? _t(l.spine.spineItemsManager.get(n)) : o !== void 0 ? l.spine.pages.observeFromAbsolutePageIndex(o).pipe(ne((r) => l.spine.spineItemsManager.get(r?.itemIndex))) : St : St, s = [n, o, l], e[0] = o, e[1] = n, e[2] = l, e[3] = i, e[4] = s) : (i = e[3], s = e[4]), j(i, s);
519
+ }, $o = (t) => {
520
+ const e = y(9), {
521
+ absolutePageIndex: o,
522
+ itemIndex: n
523
+ } = t;
524
+ let l;
525
+ e[0] !== o || e[1] !== n ? (l = {
526
+ absolutePageIndex: o,
527
+ itemIndex: n
528
+ }, e[0] = o, e[1] = n, e[2] = l) : l = e[2];
529
+ const {
530
+ data: i
531
+ } = Io(l);
532
+ let s, r;
533
+ e[3] !== i ? (s = () => i ? i.isReady$ : ft, r = [i], e[3] = i, e[4] = s, e[5] = r) : (s = e[4], r = e[5]);
534
+ const {
535
+ data: c
536
+ } = j(s, r);
537
+ let f;
538
+ return e[6] !== c || e[7] !== i ? (f = {
539
+ spineItem: i,
540
+ isReady: c
541
+ }, e[6] = c, e[7] = i, e[8] = f) : f = e[8], f;
542
+ }, Oo = w((t) => {
543
+ const e = y(17), {
544
+ absolutePageIndex: o,
545
+ left: n,
546
+ top: l,
547
+ width: i
548
+ } = t;
549
+ let s;
550
+ e[0] !== o ? (s = {
551
+ absolutePageIndex: o
552
+ }, e[0] = o, e[1] = s) : s = e[1];
553
+ const {
554
+ isReady: r
555
+ } = $o(s), {
556
+ data: c
557
+ } = dt();
558
+ let f;
559
+ e[2] !== o || e[3] !== c ? (f = c?.find((C) => C?.meta?.absolutePageIndex === o && !C.meta.isCfiRange), e[2] = o, e[3] = c, e[4] = f) : f = e[4];
560
+ const u = f;
561
+ if (!r)
562
+ return null;
563
+ const d = i * 0.1 / 2, h = !!u;
564
+ let m;
565
+ e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = {
566
+ _open: "fade-in",
567
+ _closed: "fade-out"
568
+ }, e[5] = m) : m = e[5];
569
+ const g = n + i, p = `${d}px solid #03030373`, b = `${d}px solid transparent`;
570
+ let S;
571
+ e[6] !== p || e[7] !== b ? (S = {
572
+ content: '""',
573
+ position: "absolute",
574
+ top: 0,
575
+ left: 0,
576
+ width: 0,
577
+ height: 0,
578
+ borderTop: p,
579
+ borderLeft: b
580
+ }, e[6] = p, e[7] = b, e[8] = S) : S = e[8];
581
+ let _;
582
+ e[9] !== d || e[10] !== g || e[11] !== S || e[12] !== l ? (_ = /* @__PURE__ */ a(he, { "data-bookmark-area": no, position: "absolute", left: g, transform: "translateX(-100%)", pointerEvents: "none", top: l, width: d, height: d, _before: S }), e[9] = d, e[10] = g, e[11] = S, e[12] = l, e[13] = _) : _ = e[13];
583
+ let v;
584
+ return e[14] !== h || e[15] !== _ ? (v = /* @__PURE__ */ a(tt, { present: h, lazyMount: !0, animationName: m, animationDuration: "moderate", children: _ }), e[14] = h, e[15] = _, e[16] = v) : v = e[16], v;
585
+ }), To = w(() => {
586
+ const t = y(8), e = U();
587
+ let o;
588
+ t[0] !== e?.layoutInfo$ ? (o = () => e?.layoutInfo$, t[0] = e?.layoutInfo$, t[1] = o) : o = t[1];
589
+ let n;
590
+ t[2] !== e ? (n = [e], t[2] = e, t[3] = n) : n = t[3];
591
+ const {
592
+ data: l
593
+ } = j(o, n);
594
+ let i;
595
+ t[4] !== l?.pages ? (i = l?.pages.map(zo), t[4] = l?.pages, t[5] = i) : i = t[5];
596
+ let s;
597
+ return t[6] !== i ? (s = /* @__PURE__ */ a(ko, { children: i }), t[6] = i, t[7] = s) : s = t[7], s;
598
+ });
599
+ function zo(t, e) {
600
+ const {
601
+ absoluteLayout: o
602
+ } = t, {
603
+ left: n,
604
+ top: l,
605
+ width: i
606
+ } = o;
607
+ return /* @__PURE__ */ a(Oo, { absolutePageIndex: e, left: n, top: l, width: i }, e);
608
+ }
609
+ const Ue = !0, Ro = () => {
610
+ const t = y(5), e = nt(), {
611
+ data: o
612
+ } = dt(), n = We();
613
+ let l, i;
614
+ t[0] !== o || t[1] !== e || t[2] !== n ? (l = () => e ? e.gestures.hooks.register("beforeTapGesture", (r) => {
615
+ const {
616
+ event$: c
617
+ } = r;
618
+ return c.pipe(yt(e?.annotations.candidates$), ne((f) => {
619
+ const [u, d] = f;
620
+ if (!u.page)
621
+ return Ue;
622
+ const {
623
+ spineItem: h,
624
+ spineItemPageIndex: m,
625
+ spineItemPagePosition: g,
626
+ pageSize: p
627
+ } = u.page;
628
+ if (Nn(g, {
629
+ type: "corner",
630
+ corner: "top-right",
631
+ size: 10,
632
+ unit: "%"
633
+ }, p)) {
634
+ const S = e.spine.pages.fromSpineItemPageIndex(h, m);
635
+ if (!S)
636
+ return Ue;
637
+ const _ = o?.find((C) => C?.meta?.absolutePageIndex === S.absolutePageIndex && C.meta.range === void 0);
638
+ if (_)
639
+ return n.value.onAnnotationDelete?.(_.resource.id), !Ue;
640
+ if (d?.[S.absolutePageIndex]) {
641
+ const C = e?.annotations.createAnnotation({
642
+ absolutePageIndex: S.absolutePageIndex
643
+ });
644
+ return C && n.value.onAnnotationCreate?.(C), !Ue;
345
645
  }
346
- return re;
347
- })
348
- )
349
- ) : void 0, [n, t]);
350
- }, bt = () => {
351
- const n = Ze();
352
- H(
353
- () => (
354
- /**
355
- * Hook used to prevent some gestures from being handled.
356
- */
357
- n?.gestures.hooks.register(
358
- "beforeTapGesture",
359
- ({ event$: t }) => t.pipe(
360
- ke(n.selection.lastSelectionOnPointerdown$),
361
- E(([{ event: o }, r]) => {
362
- const i = o.event.target;
363
- return !(i && n.annotations.isTargetWithinHighlight(i) || r);
364
- })
365
- )
366
- )
367
- ),
368
- [n]
369
- );
370
- }, Ce = en({
646
+ }
647
+ return Ue;
648
+ }));
649
+ }) : void 0, i = [e, o, n], t[0] = o, t[1] = e, t[2] = n, t[3] = l, t[4] = i) : (l = t[3], i = t[4]), ce(l, i);
650
+ }, wo = () => {
651
+ const t = y(3), e = nt();
652
+ let o, n;
653
+ t[0] !== e ? (o = () => e?.gestures.hooks.register("beforeTapGesture", (l) => {
654
+ const {
655
+ event$: i
656
+ } = l;
657
+ return i.pipe(yt(e.selection.lastSelectionOnPointerdown$), ne((s) => {
658
+ const [r, c] = s, {
659
+ event: f
660
+ } = r, u = f.event.target;
661
+ return !(u && e.annotations.isTargetWithinHighlight(u) || c);
662
+ }));
663
+ }), n = [e], t[0] = e, t[1] = o, t[2] = n) : (o = t[1], n = t[2]), pe(o, n);
664
+ }, Mo = () => {
665
+ const t = y(4), e = nt(), o = We();
666
+ let n, l;
667
+ t[0] !== o || t[1] !== e ? (n = () => {
668
+ if (e) {
669
+ const i = o.pipe(ne(Po), rt()), s = o.pipe(ne(Ao), rt()), r = Dt([s, i]).pipe(ne(Eo));
670
+ e.annotations.update({
671
+ annotations$: r
672
+ });
673
+ }
674
+ }, l = [e, o], t[0] = o, t[1] = e, t[2] = n, t[3] = l) : (n = t[2], l = t[3]), pe(n, l);
675
+ };
676
+ function Po(t) {
677
+ return t.selectedHighlight?.highlight?.id;
678
+ }
679
+ function Ao(t) {
680
+ return t.annotations ?? [];
681
+ }
682
+ function Eo(t) {
683
+ const [e, o] = t;
684
+ return e.map((n) => ({
685
+ ...n,
686
+ selected: n.id === o
687
+ }));
688
+ }
689
+ const vt = tn({
371
690
  placement: "bottom-end",
372
691
  pauseOnPageIdle: !0
373
- }), St = () => /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(nn, { toaster: Ce, insetInline: { mdDown: "4" }, children: (n) => /* @__PURE__ */ s(J.Root, { width: { md: "sm" }, children: [
374
- n.type === "loading" ? /* @__PURE__ */ e(tn, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ e(J.Indicator, {}),
375
- /* @__PURE__ */ s(O, { gap: "1", flex: "1", maxWidth: "100%", children: [
376
- n.title && /* @__PURE__ */ e(J.Title, { children: n.title }),
377
- n.description && /* @__PURE__ */ e(J.Description, { children: n.description })
378
- ] }),
379
- n.action && /* @__PURE__ */ e(J.ActionTrigger, { children: n.action.label }),
380
- n.meta?.closable && /* @__PURE__ */ e(J.CloseTrigger, {})
381
- ] }) }) }), Ct = ({
382
- children: n,
383
- ...t
384
- }) => {
385
- const o = he(() => ne({ default: Ge() })), r = he(
386
- () => ne({ default: o.value.fontSizeMenuOpen })
387
- ), i = Se(
388
- r
389
- ), a = T(
390
- (h) => {
391
- r.update(h);
392
- },
393
- [r]
394
- ), l = T(
395
- (h) => {
396
- o.update((C) => ({
397
- ...C,
398
- _quickMenuOpen: typeof h == "function" ? h(C._quickMenuOpen) : h
399
- }));
400
- },
401
- [o]
402
- ), c = he(
403
- () => ne({ default: o.value.refitMenuOpen })
404
- ), d = T(
405
- (h) => {
406
- c.update(h);
407
- },
408
- [c]
409
- ), u = Se(
410
- c
411
- ), p = On(t, Ln);
412
- return $(() => {
413
- o.update((h) => ({
414
- ...h,
415
- ...p,
416
- onFontSizeMenuOpenChange: a,
417
- fontSizeMenuOpen: i,
418
- onRefitMenuOpenChange: d,
419
- refitMenuOpen: u,
420
- _onQuickMenuOpenChange: l
421
- }));
422
- }, [
423
- p,
424
- l,
425
- o,
426
- i,
427
- a,
428
- u,
429
- d
430
- ]), /* @__PURE__ */ e(Oe.Provider, { value: o, children: n });
431
- }, vt = g(
432
- ({ children: n, ...t }) => /* @__PURE__ */ e(Ct, { ...t, children: n })
433
- ), ae = A.forwardRef(
434
- function(t, o) {
435
- const { children: r, inputProps: i, rootRef: a, ...l } = t;
436
- return /* @__PURE__ */ s(ie.Item, { ref: a, ...l, children: [
437
- /* @__PURE__ */ e(ie.ItemHiddenInput, { ref: o, ...i }),
438
- /* @__PURE__ */ e(ie.ItemIndicator, {}),
439
- r && /* @__PURE__ */ e(ie.ItemText, { children: r })
440
- ] });
441
- }
442
- ), Xe = ie.Root, Re = A.memo(function({
443
- ref: t,
444
- ...o
445
- }) {
446
- const { marks: r, label: i, showValue: a, ...l } = o, c = o.defaultValue ?? o.value, d = r?.map((p) => typeof p == "number" ? { value: p, label: void 0 } : p), u = !!d?.some((p) => p.label);
447
- return /* @__PURE__ */ s(M.Root, { ref: t, thumbAlignment: "center", ...l, children: [
448
- i && !a && /* @__PURE__ */ e(M.Label, { children: i }),
449
- i && a && /* @__PURE__ */ s(F, { justify: "space-between", children: [
450
- /* @__PURE__ */ e(M.Label, { children: i }),
451
- /* @__PURE__ */ e(M.ValueText, {})
692
+ }), Bo = () => {
693
+ const t = y(1);
694
+ let e;
695
+ return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ a(ct, { children: /* @__PURE__ */ a(nn, { toaster: vt, insetInline: {
696
+ mdDown: "4"
697
+ }, children: Do }) }), t[0] = e) : e = t[0], e;
698
+ };
699
+ function Do(t) {
700
+ return /* @__PURE__ */ x(Ne.Root, { width: {
701
+ md: "sm"
702
+ }, children: [
703
+ t.type === "loading" ? /* @__PURE__ */ a(on, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ a(Ne.Indicator, {}),
704
+ /* @__PURE__ */ x(J, { gap: "1", flex: "1", maxWidth: "100%", children: [
705
+ t.title && /* @__PURE__ */ a(Ne.Title, { children: t.title }),
706
+ t.description && /* @__PURE__ */ a(Ne.Description, { children: t.description })
452
707
  ] }),
453
- /* @__PURE__ */ s(M.Control, { "data-has-mark-label": u || void 0, children: [
454
- /* @__PURE__ */ e(M.Track, { children: /* @__PURE__ */ e(M.Range, {}) }),
455
- /* @__PURE__ */ e(xt, { value: c }),
456
- /* @__PURE__ */ e(kt, { marks: d })
457
- ] })
708
+ t.action && /* @__PURE__ */ a(Ne.ActionTrigger, { children: t.action.label }),
709
+ t.meta?.closable && /* @__PURE__ */ a(Ne.CloseTrigger, {})
458
710
  ] });
711
+ }
712
+ const Fo = (t) => {
713
+ const e = y(25);
714
+ let o, n;
715
+ e[0] !== t ? ({
716
+ children: o,
717
+ ...n
718
+ } = t, e[0] = t, e[1] = o, e[2] = n) : (o = e[1], n = e[2]);
719
+ const l = at(No);
720
+ let i;
721
+ e[3] !== l.value.fontSizeMenuOpen ? (i = () => Ve({
722
+ default: l.value.fontSizeMenuOpen
723
+ }), e[3] = l.value.fontSizeMenuOpen, e[4] = i) : i = e[4];
724
+ const s = at(i), r = bt(s);
725
+ let c;
726
+ e[5] !== s ? (c = (I) => {
727
+ s.update(I);
728
+ }, e[5] = s, e[6] = c) : c = e[6];
729
+ const f = c;
730
+ let u;
731
+ e[7] !== l ? (u = (I) => {
732
+ l.update((k) => ({
733
+ ...k,
734
+ _quickMenuOpen: typeof I == "function" ? I(k._quickMenuOpen) : I
735
+ }));
736
+ }, e[7] = l, e[8] = u) : u = e[8];
737
+ const d = u;
738
+ let h;
739
+ e[9] !== l.value.refitMenuOpen ? (h = () => Ve({
740
+ default: l.value.refitMenuOpen
741
+ }), e[9] = l.value.refitMenuOpen, e[10] = h) : h = e[10];
742
+ const m = at(h);
743
+ let g;
744
+ e[11] !== m ? (g = (I) => {
745
+ m.update(I);
746
+ }, e[11] = m, e[12] = g) : g = e[12];
747
+ const p = g, b = bt(m), S = In(n, Hn);
748
+ let _, v;
749
+ e[13] !== d || e[14] !== S || e[15] !== r || e[16] !== f || e[17] !== p || e[18] !== b || e[19] !== l ? (_ = () => {
750
+ l.update((I) => ({
751
+ ...I,
752
+ ...S,
753
+ onFontSizeMenuOpenChange: f,
754
+ fontSizeMenuOpen: r,
755
+ onRefitMenuOpenChange: p,
756
+ refitMenuOpen: b,
757
+ _onQuickMenuOpenChange: d
758
+ }));
759
+ }, v = [S, d, l, r, f, b, p], e[13] = d, e[14] = S, e[15] = r, e[16] = f, e[17] = p, e[18] = b, e[19] = l, e[20] = _, e[21] = v) : (_ = e[20], v = e[21]), ce(_, v);
760
+ let C;
761
+ return e[22] !== o || e[23] !== l ? (C = /* @__PURE__ */ a(kt.Provider, { value: l, children: o }), e[22] = o, e[23] = l, e[24] = C) : C = e[24], C;
762
+ }, Lo = w((t) => {
763
+ const e = y(6);
764
+ let o, n;
765
+ e[0] !== t ? ({
766
+ children: o,
767
+ ...n
768
+ } = t, e[0] = t, e[1] = o, e[2] = n) : (o = e[1], n = e[2]);
769
+ let l;
770
+ return e[3] !== o || e[4] !== n ? (l = /* @__PURE__ */ a(Fo, { ...n, children: o }), e[3] = o, e[4] = n, e[5] = l) : l = e[5], l;
459
771
  });
460
- function xt(n) {
461
- const { value: t } = n;
462
- return /* @__PURE__ */ e(on, { each: t, children: (o, r) => /* @__PURE__ */ e(M.Thumb, { index: r, children: /* @__PURE__ */ e(M.HiddenInput, {}) }, r) });
772
+ function No() {
773
+ return Ve({
774
+ default: Gt()
775
+ });
463
776
  }
464
- const kt = A.forwardRef(
465
- function(t, o) {
466
- const { marks: r } = t;
467
- return r?.length ? /* @__PURE__ */ e(M.MarkerGroup, { ref: o, children: r.map((i, a) => {
468
- const l = typeof i == "number" ? i : i.value, c = typeof i == "number" ? void 0 : i.label;
469
- return /* @__PURE__ */ s(M.Marker, { value: l, children: [
470
- /* @__PURE__ */ e(M.MarkerIndicator, {}),
471
- c
472
- ] }, a);
473
- }) }) : null;
474
- }
475
- ), Te = [
476
- {
477
- value: "global",
478
- references: ["global"]
479
- },
480
- {
481
- value: "book",
482
- references: ["book"]
483
- },
484
- {
485
- value: "screen",
486
- references: ["mobile", "tablet", "desktop"]
487
- }
488
- ], It = Te.map((n) => n.value), Ee = Te.flatMap(
489
- (n) => n.references
490
- ), Ot = (n) => {
491
- if (n)
492
- return Te.find(
493
- (t) => t.references.includes(n)
494
- )?.value;
495
- }, Rt = g(() => {
496
- const n = qe(), {
497
- fontSizeMenuOpen: t,
498
- onFontSizeMenuOpenChange: o,
499
- uncontrolledFontSize: r,
500
- fontSize: i = r,
501
- fontSizeMin: a,
502
- fontSizeMax: l,
503
- fontSizeScope: c,
504
- fontSizeValues: d,
505
- onFontSizeChange: u,
506
- onFontSizeScopeChange: p
507
- } = y([
508
- "fontSizeMenuOpen",
509
- "onFontSizeMenuOpenChange",
510
- "fontSize",
511
- "fontSizeMin",
512
- "fontSizeMax",
513
- "fontSizeScope",
514
- "onFontSizeChange",
515
- "onFontSizeScopeChange",
516
- "uncontrolledFontSize",
517
- "fontSizeValues"
518
- ]), h = Rn(u), [C, v] = w(
519
- c ?? "global"
520
- ), R = T(
521
- (f, K) => {
522
- h.current ? h.current(f, K) : n.update((Je) => ({
523
- ...Je,
524
- uncontrolledFontSize: K
525
- }));
526
- },
527
- [h, n]
528
- ), D = T(
529
- (f) => d?.[f] ?? i,
530
- [i, d]
531
- ), x = T(
532
- (f) => {
533
- const K = f.value;
534
- p?.(K);
535
- },
536
- [p]
537
- ), L = T((f) => {
538
- v(f.value);
539
- }, []), I = T(
540
- (f) => {
541
- const K = f.value[0] ?? 0;
542
- R(C, K / 100);
543
- },
544
- [R, C]
545
- );
546
- return $(
547
- function() {
548
- v(c ?? "global");
549
- },
550
- [c]
551
- ), /* @__PURE__ */ e(
552
- j,
553
- {
554
- lazyMount: !0,
555
- open: t,
556
- onOpenChange: (f) => {
557
- o(f.open);
558
- },
559
- placement: "center",
560
- children: /* @__PURE__ */ s(G, { maxH: "40vh", overflow: "auto", children: [
561
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(Z, { children: "Font size" }) }),
562
- /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ s(O, { gap: 4, flex: 1, children: [
563
- /* @__PURE__ */ s(N.Root, { children: [
564
- /* @__PURE__ */ e(N.Legend, { children: "Scope" }),
565
- /* @__PURE__ */ e(N.HelperText, { children: "The scope to which apply the font size for this book." }),
566
- /* @__PURE__ */ e(N.Content, { children: /* @__PURE__ */ e(
567
- Xe,
568
- {
569
- onValueChange: x,
570
- value: Ot(c) ?? "global",
571
- disabled: !p,
572
- children: /* @__PURE__ */ e(F, { gap: 2, children: It.map((f) => /* @__PURE__ */ e(ae, { value: f, children: f }, f)) })
573
- }
574
- ) })
575
- ] }),
576
- /* @__PURE__ */ s(
577
- P.Root,
578
- {
579
- value: C,
580
- onValueChange: L,
581
- fitted: !1,
582
- size: "sm",
583
- children: [
584
- /* @__PURE__ */ e(P.List, { children: Ee.map((f) => /* @__PURE__ */ s(
585
- P.Trigger,
586
- {
587
- value: f,
588
- textTransform: "capitalize",
589
- disabled: f !== "global" && !c,
590
- children: [
591
- c === f && /* @__PURE__ */ e(gn, {}),
592
- f
593
- ]
594
- },
595
- f
596
- )) }),
597
- Ee.map((f) => /* @__PURE__ */ e(P.Content, { value: f, children: /* @__PURE__ */ e(
598
- Re,
599
- {
600
- label: "%",
601
- value: [(D(f) ?? 1) * 100],
602
- onValueChange: I,
603
- showValue: !0,
604
- marks: [
605
- { value: 100, label: "Publisher" },
606
- {
607
- value: a * 100,
608
- label: `${a * 100}%`
609
- },
610
- {
611
- value: l * 100,
612
- label: `${l * 100}%`
613
- }
614
- ],
615
- max: l * 100,
616
- min: a * 100,
617
- width: "100%",
618
- step: 0.1 * 100
619
- }
620
- ) }, f))
621
- ]
622
- }
623
- )
624
- ] }) }),
625
- /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(X, { asChild: !0, children: /* @__PURE__ */ e(W, { variant: "outline", children: "Close" }) }) }),
626
- /* @__PURE__ */ e(q, {})
627
- ] })
777
+ const Ye = se.forwardRef(function(e, o) {
778
+ const n = y(16);
779
+ let l, i, s, r;
780
+ n[0] !== e ? ({
781
+ children: l,
782
+ inputProps: i,
783
+ rootRef: r,
784
+ ...s
785
+ } = e, n[0] = e, n[1] = l, n[2] = i, n[3] = s, n[4] = r) : (l = n[1], i = n[2], s = n[3], r = n[4]);
786
+ let c;
787
+ n[5] !== i || n[6] !== o ? (c = /* @__PURE__ */ a(Qe.ItemHiddenInput, { ref: o, ...i }), n[5] = i, n[6] = o, n[7] = c) : c = n[7];
788
+ let f;
789
+ n[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ a(Qe.ItemIndicator, {}), n[8] = f) : f = n[8];
790
+ let u;
791
+ n[9] !== l ? (u = l && /* @__PURE__ */ a(Qe.ItemText, { children: l }), n[9] = l, n[10] = u) : u = n[10];
792
+ let d;
793
+ return n[11] !== s || n[12] !== r || n[13] !== c || n[14] !== u ? (d = /* @__PURE__ */ x(Qe.Item, { ref: r, ...s, children: [
794
+ c,
795
+ f,
796
+ u
797
+ ] }), n[11] = s, n[12] = r, n[13] = c, n[14] = u, n[15] = d) : d = n[15], d;
798
+ }), Kt = Qe.Root, It = se.memo(function(e) {
799
+ const o = y(29);
800
+ let n, l, i, s, r, c, f;
801
+ if (o[0] !== e) {
802
+ const {
803
+ ref: v,
804
+ ...C
805
+ } = e;
806
+ i = v;
807
+ const {
808
+ marks: I,
809
+ label: k,
810
+ showValue: $,
811
+ ...O
812
+ } = C;
813
+ n = k, r = $, s = O, f = C.defaultValue ?? C.value, l = I?.map(Go), c = l?.some(qo), o[0] = e, o[1] = n, o[2] = l, o[3] = i, o[4] = s, o[5] = r, o[6] = c, o[7] = f;
814
+ } else
815
+ n = o[1], l = o[2], i = o[3], s = o[4], r = o[5], c = o[6], f = o[7];
816
+ const u = !!c;
817
+ let d;
818
+ o[8] !== n || o[9] !== r ? (d = n && !r && /* @__PURE__ */ a(ae.Label, { children: n }), o[8] = n, o[9] = r, o[10] = d) : d = o[10];
819
+ let h;
820
+ o[11] !== n || o[12] !== r ? (h = n && r && /* @__PURE__ */ x(ge, { justify: "space-between", children: [
821
+ /* @__PURE__ */ a(ae.Label, { children: n }),
822
+ /* @__PURE__ */ a(ae.ValueText, {})
823
+ ] }), o[11] = n, o[12] = r, o[13] = h) : h = o[13];
824
+ const m = u || void 0;
825
+ let g;
826
+ o[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ a(ae.Track, { children: /* @__PURE__ */ a(ae.Range, {}) }), o[14] = g) : g = o[14];
827
+ let p;
828
+ o[15] !== f ? (p = /* @__PURE__ */ a(Ho, { value: f }), o[15] = f, o[16] = p) : p = o[16];
829
+ let b;
830
+ o[17] !== l ? (b = /* @__PURE__ */ a(Wo, { marks: l }), o[17] = l, o[18] = b) : b = o[18];
831
+ let S;
832
+ o[19] !== m || o[20] !== p || o[21] !== b ? (S = /* @__PURE__ */ x(ae.Control, { "data-has-mark-label": m, children: [
833
+ g,
834
+ p,
835
+ b
836
+ ] }), o[19] = m, o[20] = p, o[21] = b, o[22] = S) : S = o[22];
837
+ let _;
838
+ return o[23] !== i || o[24] !== s || o[25] !== d || o[26] !== h || o[27] !== S ? (_ = /* @__PURE__ */ x(ae.Root, { ref: i, thumbAlignment: "center", ...s, children: [
839
+ d,
840
+ h,
841
+ S
842
+ ] }), o[23] = i, o[24] = s, o[25] = d, o[26] = h, o[27] = S, o[28] = _) : _ = o[28], _;
843
+ });
844
+ function Ho(t) {
845
+ const e = y(2), {
846
+ value: o
847
+ } = t;
848
+ let n;
849
+ return e[0] !== o ? (n = /* @__PURE__ */ a(ln, { each: o, children: Vo }), e[0] = o, e[1] = n) : n = e[1], n;
850
+ }
851
+ function Vo(t, e) {
852
+ return /* @__PURE__ */ a(ae.Thumb, { index: e, children: /* @__PURE__ */ a(ae.HiddenInput, {}) }, e);
853
+ }
854
+ const Wo = se.forwardRef(function(e, o) {
855
+ const n = y(5), {
856
+ marks: l
857
+ } = e;
858
+ if (!l?.length)
859
+ return null;
860
+ let i;
861
+ n[0] !== l ? (i = l.map(jo), n[0] = l, n[1] = i) : i = n[1];
862
+ let s;
863
+ return n[2] !== o || n[3] !== i ? (s = /* @__PURE__ */ a(ae.MarkerGroup, { ref: o, children: i }), n[2] = o, n[3] = i, n[4] = s) : s = n[4], s;
864
+ });
865
+ function Go(t) {
866
+ return typeof t == "number" ? {
867
+ value: t,
868
+ label: void 0
869
+ } : t;
870
+ }
871
+ function qo(t) {
872
+ return t.label;
873
+ }
874
+ function jo(t, e) {
875
+ const o = typeof t == "number" ? t : t.value, n = typeof t == "number" ? void 0 : t.label;
876
+ return /* @__PURE__ */ x(ae.Marker, { value: o, children: [
877
+ /* @__PURE__ */ a(ae.MarkerIndicator, {}),
878
+ n
879
+ ] }, e);
880
+ }
881
+ const $t = [{
882
+ value: "global",
883
+ references: ["global"]
884
+ }, {
885
+ value: "book",
886
+ references: ["book"]
887
+ }, {
888
+ value: "screen",
889
+ references: ["mobile", "tablet", "desktop"]
890
+ }], Uo = $t.map((t) => t.value), wt = $t.flatMap((t) => t.references), Qo = (t) => {
891
+ if (t)
892
+ return $t.find((e) => e.references.includes(t))?.value;
893
+ }, Yo = w(() => {
894
+ const t = y(52), e = We();
895
+ let o;
896
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = ["fontSizeMenuOpen", "onFontSizeMenuOpenChange", "fontSize", "fontSizeMin", "fontSizeMax", "fontSizeScope", "onFontSizeChange", "onFontSizeScopeChange", "uncontrolledFontSize", "fontSizeValues"], t[0] = o) : o = t[0];
897
+ const {
898
+ fontSizeMenuOpen: n,
899
+ onFontSizeMenuOpenChange: l,
900
+ uncontrolledFontSize: i,
901
+ fontSize: s,
902
+ fontSizeMin: r,
903
+ fontSizeMax: c,
904
+ fontSizeScope: f,
905
+ fontSizeValues: u,
906
+ onFontSizeChange: d,
907
+ onFontSizeScopeChange: h
908
+ } = oe(o), m = s === void 0 ? i : s, g = $n(d), [p, b] = le(f ?? "global");
909
+ let S;
910
+ t[1] !== e || t[2] !== g ? (S = (R, te) => {
911
+ g.current ? g.current(R, te) : e.update((qe) => ({
912
+ ...qe,
913
+ uncontrolledFontSize: te
914
+ }));
915
+ }, t[1] = e, t[2] = g, t[3] = S) : S = t[3];
916
+ const _ = S;
917
+ let v;
918
+ t[4] !== m || t[5] !== u ? (v = (R) => u?.[R] ?? m, t[4] = m, t[5] = u, t[6] = v) : v = t[6];
919
+ const C = v;
920
+ let I;
921
+ t[7] !== h ? (I = (R) => {
922
+ const te = R.value;
923
+ h?.(te);
924
+ }, t[7] = h, t[8] = I) : I = t[8];
925
+ const k = I;
926
+ let $;
927
+ t[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? ($ = (R) => {
928
+ b(R.value);
929
+ }, t[9] = $) : $ = t[9];
930
+ const O = $;
931
+ let z;
932
+ t[10] !== _ || t[11] !== p ? (z = (R) => {
933
+ const te = R.value[0] ?? 0;
934
+ _(p, te / 100);
935
+ }, t[10] = _, t[11] = p, t[12] = z) : z = t[12];
936
+ const E = z;
937
+ let T, N;
938
+ t[13] !== f ? (T = function() {
939
+ b(f ?? "global");
940
+ }, N = [f], t[13] = f, t[14] = T, t[15] = N) : (T = t[14], N = t[15]), ce(T, N);
941
+ let M;
942
+ t[16] !== l ? (M = (R) => {
943
+ l(R.open);
944
+ }, t[16] = l, t[17] = M) : M = t[17];
945
+ let H;
946
+ t[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ a(ye, { children: /* @__PURE__ */ a(Ie, { children: "Font size" }) }), t[18] = H) : H = t[18];
947
+ let Q, K;
948
+ t[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Q = /* @__PURE__ */ a(Se.Legend, { children: "Scope" }), K = /* @__PURE__ */ a(Se.HelperText, { children: "The scope to which apply the font size for this book." }), t[19] = Q, t[20] = K) : (Q = t[19], K = t[20]);
949
+ let V;
950
+ t[21] !== f ? (V = Qo(f) ?? "global", t[21] = f, t[22] = V) : V = t[22];
951
+ const W = !h;
952
+ let G;
953
+ t[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ a(ge, { gap: 2, children: Uo.map(Zo) }), t[23] = G) : G = t[23];
954
+ let F;
955
+ t[24] !== k || t[25] !== V || t[26] !== W ? (F = /* @__PURE__ */ x(Se.Root, { children: [
956
+ Q,
957
+ K,
958
+ /* @__PURE__ */ a(Se.Content, { children: /* @__PURE__ */ a(Kt, { onValueChange: k, value: V, disabled: W, children: G }) })
959
+ ] }), t[24] = k, t[25] = V, t[26] = W, t[27] = F) : F = t[27];
960
+ let P;
961
+ t[28] !== f ? (P = wt.map((R) => /* @__PURE__ */ x(ue.Trigger, { value: R, textTransform: "capitalize", disabled: R !== "global" && !f, children: [
962
+ f === R && /* @__PURE__ */ a(gn, {}),
963
+ R
964
+ ] }, R)), t[28] = f, t[29] = P) : P = t[29];
965
+ let Y;
966
+ t[30] !== P ? (Y = /* @__PURE__ */ a(ue.List, { children: P }), t[30] = P, t[31] = Y) : Y = t[31];
967
+ let Z;
968
+ t[32] !== c || t[33] !== r || t[34] !== C || t[35] !== E ? (Z = wt.map((R) => /* @__PURE__ */ a(ue.Content, { value: R, children: /* @__PURE__ */ a(It, { label: "%", value: [(C(R) ?? 1) * 100], onValueChange: E, showValue: !0, marks: [{
969
+ value: 100,
970
+ label: "Publisher"
971
+ }, {
972
+ value: r * 100,
973
+ label: `${r * 100}%`
974
+ }, {
975
+ value: c * 100,
976
+ label: `${c * 100}%`
977
+ }], max: c * 100, min: r * 100, width: "100%", step: 10 }) }, R)), t[32] = c, t[33] = r, t[34] = C, t[35] = E, t[36] = Z) : Z = t[36];
978
+ let A;
979
+ t[37] !== Y || t[38] !== Z || t[39] !== p ? (A = /* @__PURE__ */ x(ue.Root, { value: p, onValueChange: O, fitted: !1, size: "sm", children: [
980
+ Y,
981
+ Z
982
+ ] }), t[37] = Y, t[38] = Z, t[39] = p, t[40] = A) : A = t[40];
983
+ let L;
984
+ t[41] !== F || t[42] !== A ? (L = /* @__PURE__ */ a(ke, { children: /* @__PURE__ */ x(J, { gap: 4, flex: 1, children: [
985
+ F,
986
+ A
987
+ ] }) }), t[41] = F, t[42] = A, t[43] = L) : L = t[43];
988
+ let X, B;
989
+ t[44] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (X = /* @__PURE__ */ a(xe, { children: /* @__PURE__ */ a($e, { asChild: !0, children: /* @__PURE__ */ a(re, { variant: "outline", children: "Close" }) }) }), B = /* @__PURE__ */ a(ve, {}), t[44] = X, t[45] = B) : (X = t[44], B = t[45]);
990
+ let D;
991
+ t[46] !== L ? (D = /* @__PURE__ */ x(_e, { maxH: "40vh", overflow: "auto", children: [
992
+ H,
993
+ L,
994
+ X,
995
+ B
996
+ ] }), t[46] = L, t[47] = D) : D = t[47];
997
+ let de;
998
+ return t[48] !== n || t[49] !== D || t[50] !== M ? (de = /* @__PURE__ */ a(Ce, { lazyMount: !0, open: n, onOpenChange: M, placement: "center", children: D }), t[48] = n, t[49] = D, t[50] = M, t[51] = de) : de = t[51], de;
999
+ });
1000
+ function Zo(t) {
1001
+ return /* @__PURE__ */ a(Ye, { value: t, children: t }, t);
1002
+ }
1003
+ const Ko = () => {
1004
+ const t = y(11), e = U(), o = We();
1005
+ let n;
1006
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = ["fontSize", "uncontrolledFontSize", "onFontSizeChange"], t[0] = n) : n = t[0];
1007
+ const {
1008
+ fontSize: l,
1009
+ uncontrolledFontSize: i
1010
+ } = oe(n), s = l ?? i;
1011
+ let r, c;
1012
+ t[1] !== s || t[2] !== e ? (r = function() {
1013
+ if (e && s) {
1014
+ const h = setTimeout(() => {
1015
+ e.settings.update({
1016
+ fontScale: s
1017
+ });
1018
+ }, 200);
1019
+ return () => clearTimeout(h);
628
1020
  }
629
- );
630
- }), Tt = () => {
631
- const n = m(), t = qe(), { fontSize: o, uncontrolledFontSize: r } = y([
632
- "fontSize",
633
- "uncontrolledFontSize",
634
- "onFontSizeChange"
635
- ]), i = o ?? r;
636
- return $(
637
- function() {
638
- if (n && i) {
639
- const l = setTimeout(() => {
640
- n.settings.update({
641
- fontScale: i
642
- });
643
- }, 200);
644
- return () => clearTimeout(l);
645
- }
646
- },
647
- [n, i]
648
- ), H(
649
- function() {
650
- return n?.settings.values$.pipe(E((l) => l.fontScale)).subscribe((l) => {
651
- const c = t.value.fontSize ?? t.value.uncontrolledFontSize;
652
- l !== c && (t.value.onFontSizeChange?.("internal", l), t.update((d) => ({
653
- ...d,
654
- uncontrolledFontSize: l
655
- })));
656
- });
657
- },
658
- [n, t]
659
- ), null;
660
- }, zt = {
1021
+ }, c = [e, s], t[1] = s, t[2] = e, t[3] = r, t[4] = c) : (r = t[3], c = t[4]), ce(r, c);
1022
+ let f;
1023
+ t[5] !== o || t[6] !== e?.settings.values$ ? (f = function() {
1024
+ return e?.settings.values$.pipe(ne(Xo)).subscribe((h) => {
1025
+ const m = o.value.fontSize ?? o.value.uncontrolledFontSize;
1026
+ h !== m && (o.value.onFontSizeChange?.("internal", h), o.update((g) => ({
1027
+ ...g,
1028
+ uncontrolledFontSize: h
1029
+ })));
1030
+ });
1031
+ }, t[5] = o, t[6] = e?.settings.values$, t[7] = f) : f = t[7];
1032
+ let u;
1033
+ return t[8] !== o || t[9] !== e ? (u = [e, o], t[8] = o, t[9] = e, t[10] = u) : u = t[10], pe(f, u), null;
1034
+ };
1035
+ function Xo(t) {
1036
+ return t.fontScale;
1037
+ }
1038
+ const Jo = {
661
1039
  x: 0,
662
1040
  y: 0,
663
1041
  width: 0,
@@ -667,1430 +1045,1406 @@ const kt = A.forwardRef(
667
1045
  bottom: 0,
668
1046
  right: 0
669
1047
  };
670
- function Mt() {
671
- const [n, t] = w(null), [o, r] = w(zt), i = cn(
672
- () => new ResizeObserver((a) => {
673
- if (a[0]) {
674
- const { x: l, y: c, width: d, height: u, top: p, left: h, bottom: C, right: v } = a[0].contentRect;
675
- r({ x: l, y: c, width: d, height: u, top: p, left: h, bottom: C, right: v });
676
- }
677
- }),
678
- []
679
- );
680
- return dn(() => {
681
- if (n)
682
- return i.observe(n), () => {
683
- i.disconnect();
1048
+ function el() {
1049
+ const t = y(7), [e, o] = le(null), [n, l] = le(Jo);
1050
+ let i;
1051
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = new ResizeObserver((u) => {
1052
+ if (u[0]) {
1053
+ const {
1054
+ x: d,
1055
+ y: h,
1056
+ width: m,
1057
+ height: g,
1058
+ top: p,
1059
+ left: b,
1060
+ bottom: S,
1061
+ right: _
1062
+ } = u[0].contentRect;
1063
+ l({
1064
+ x: d,
1065
+ y: h,
1066
+ width: m,
1067
+ height: g,
1068
+ top: p,
1069
+ left: b,
1070
+ bottom: S,
1071
+ right: _
1072
+ });
1073
+ }
1074
+ }), t[0] = i) : i = t[0];
1075
+ const s = i;
1076
+ let r, c;
1077
+ t[1] !== e ? (r = () => {
1078
+ if (e)
1079
+ return s.observe(e), () => {
1080
+ s.disconnect();
684
1081
  };
685
- }, [n, i]), [t, o, n];
1082
+ }, c = [e, s], t[1] = e, t[2] = r, t[3] = c) : (r = t[2], c = t[3]), fn(r, c);
1083
+ let f;
1084
+ return t[4] !== e || t[5] !== n ? (f = [o, n, e], t[4] = e, t[5] = n, t[6] = f) : f = t[6], f;
686
1085
  }
687
- const wt = (n, t, o) => {
688
- const r = m(), i = Ue(r) ? r : void 0;
689
- H(() => {
690
- if (!i || !n) return Ie;
691
- const a = t.didLayout$.pipe(
692
- Mn(t.layoutInfo),
693
- De($n)
694
- ), l = Nn(
695
- n
696
- ).pipe(E((c) => c.some((d) => d.isIntersecting)));
697
- return a.pipe(
698
- Le(100, void 0, { trailing: !0 }),
699
- V(() => l.pipe(
700
- $e((c) => {
701
- c || (n.innerHTML = "");
702
- }),
703
- se((c) => c),
704
- Ne()
705
- ).pipe(
706
- V(() => (n.innerHTML = "", i?.gallery.snapshot(
707
- t,
708
- n,
709
- o
710
- )))
711
- ))
712
- );
713
- }, [i, t, o, n]);
714
- }, yt = g(
715
- ({ item: n, onNavigated: t }) => {
716
- const [o, r, i] = Mt(), a = m();
717
- wt(i, n, r);
718
- const l = S(
719
- () => a?.locateResource(n, { mode: "shallow" }),
720
- [a, n]
721
- );
722
- return /* @__PURE__ */ s(
723
- _,
724
- {
725
- width: "100%",
726
- aspectRatio: "2/3",
727
- border: "1px solid",
728
- borderColor: "border",
729
- borderRadius: "md",
730
- "data-grid-item": !0,
731
- cursor: "pointer",
732
- position: "relative",
733
- overflow: "hidden",
734
- onClick: () => {
735
- t(), a?.navigation.goToSpineItem({ indexOrId: n });
736
- },
737
- children: [
738
- /* @__PURE__ */ e(
739
- _,
740
- {
741
- height: "100%",
742
- width: "100%",
743
- overflow: "hidden",
744
- pointerEvents: "none",
745
- ref: o
746
- }
747
- ),
748
- /* @__PURE__ */ s(
749
- b,
750
- {
751
- position: "absolute",
752
- bottom: 0,
753
- left: "0",
754
- right: "0",
755
- textAlign: "center",
756
- bgColor: "white",
757
- p: 4,
758
- fontSize: "xs",
759
- children: [
760
- "Page ",
761
- (l?.meta?.absolutePageIndex ?? 0) + 1
762
- ]
763
- }
764
- )
765
- ]
766
- }
767
- );
768
- }
769
- ), Pt = g(
770
- ({ open: n, setOpen: t }) => {
771
- const o = m(), r = S(() => o?.spineItemsManager.items$, [o]);
772
- return /* @__PURE__ */ e(
773
- j,
774
- {
775
- lazyMount: !0,
776
- placement: "center",
777
- open: n,
778
- onOpenChange: (i) => t(i.open),
779
- size: { mdDown: "full", md: "lg" },
780
- scrollBehavior: "inside",
781
- children: /* @__PURE__ */ s(G, { height: "100%", children: [
782
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(Z, { children: "Gallery" }) }),
783
- /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(
784
- _,
785
- {
786
- gridTemplateColumns: [
787
- "repeat(2, minmax(0, 1fr))",
788
- "repeat(3, minmax(0, 1fr))"
789
- ],
790
- display: "grid",
791
- gap: [2, 4],
792
- pt: 2,
793
- "data-grid": !0,
794
- children: r?.map((i) => /* @__PURE__ */ e(
795
- yt,
796
- {
797
- item: i,
798
- onNavigated: () => {
799
- t(!1);
800
- }
801
- },
802
- i.item.id
803
- ))
804
- }
805
- ) }),
806
- /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(X, { asChild: !0, children: /* @__PURE__ */ e(W, { variant: "outline", children: "Cancel" }) }) }),
807
- /* @__PURE__ */ e(q, {})
808
- ] })
809
- }
810
- );
811
- }
812
- ), Et = "@prose-reader/react-reader", At = "1.270.0", Bt = g(
813
- ({ open: n, setOpen: t }) => /* @__PURE__ */ e(
814
- j,
815
- {
816
- lazyMount: !0,
817
- placement: "center",
818
- open: n,
819
- onOpenChange: (o) => t(o.open),
820
- size: { mdDown: "full", md: "lg" },
821
- scrollBehavior: "inside",
822
- children: /* @__PURE__ */ s(G, { children: [
823
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(Z, { children: "Help" }) }),
824
- /* @__PURE__ */ s(
825
- Y,
826
- {
827
- overflowY: "auto",
828
- flex: 1,
829
- display: "flex",
830
- flexDirection: "column",
831
- gap: 4,
832
- children: [
833
- /* @__PURE__ */ s(O, { children: [
834
- /* @__PURE__ */ e(me, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
835
- /* @__PURE__ */ s(F, { mb: 1, children: [
836
- /* @__PURE__ */ e(we, { children: /* @__PURE__ */ e(fn, {}) }),
837
- " ",
838
- /* @__PURE__ */ e(b, { children: "Navigate to right page" })
839
- ] }),
840
- /* @__PURE__ */ s(F, { mb: 1, children: [
841
- /* @__PURE__ */ e(we, { children: /* @__PURE__ */ e(mn, {}) }),
842
- " ",
843
- /* @__PURE__ */ e(b, { children: "Navigate to left page" })
844
- ] })
845
- ] }),
846
- /* @__PURE__ */ s(O, { children: [
847
- /* @__PURE__ */ e(me, { mb: 2, as: "h3", size: "lg", children: "Bookmarks" }),
848
- /* @__PURE__ */ e(F, { mb: 1, children: /* @__PURE__ */ e(b, { children: "Tap on the top right corner of a page bookmark it" }) })
849
- ] }),
850
- /* @__PURE__ */ s(O, { children: [
851
- /* @__PURE__ */ e(me, { mb: 2, as: "h3", size: "lg", children: "About" }),
852
- /* @__PURE__ */ s(b, { children: [
853
- Et,
854
- " version: ",
855
- At
856
- ] })
857
- ] })
858
- ]
859
- }
860
- ),
861
- /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(X, { asChild: !0, children: /* @__PURE__ */ e(W, { variant: "outline", children: "Cancel" }) }) }),
862
- /* @__PURE__ */ e(q, {})
1086
+ const tl = (t, e, o) => {
1087
+ const n = y(8), l = U();
1088
+ let i;
1089
+ n[0] !== l ? (i = Ut(l) ? l : void 0, n[0] = l, n[1] = i) : i = n[1];
1090
+ const s = i;
1091
+ let r, c;
1092
+ n[2] !== t || n[3] !== e || n[4] !== o || n[5] !== s ? (r = () => {
1093
+ if (!s || !t)
1094
+ return ft;
1095
+ const f = e.didLayout$.pipe(Bt(e.layoutInfo), rt(Vt)), u = Dn(t).pipe(ne(ol));
1096
+ return f.pipe(Ft(100, void 0, {
1097
+ trailing: !0
1098
+ }), be(() => u.pipe(xt((d) => {
1099
+ d || (t.innerHTML = "");
1100
+ }), Xe(ll), Lt()).pipe(be(() => (t.innerHTML = "", s?.gallery.snapshot(e, t, o))))));
1101
+ }, c = [s, e, o, t], n[2] = t, n[3] = e, n[4] = o, n[5] = s, n[6] = r, n[7] = c) : (r = n[6], c = n[7]), pe(r, c);
1102
+ };
1103
+ function nl(t) {
1104
+ return t.isIntersecting;
1105
+ }
1106
+ function ol(t) {
1107
+ return t.some(nl);
1108
+ }
1109
+ function ll(t) {
1110
+ return t;
1111
+ }
1112
+ const il = w((t) => {
1113
+ const e = y(16), {
1114
+ item: o,
1115
+ onNavigated: n
1116
+ } = t, [l, i, s] = el(), r = U();
1117
+ tl(s, o, i);
1118
+ let c, f;
1119
+ e[0] !== o || e[1] !== r ? (c = () => r?.locateResource(o, {
1120
+ mode: "shallow"
1121
+ }), f = [r, o], e[0] = o, e[1] = r, e[2] = c, e[3] = f) : (c = e[2], f = e[3]);
1122
+ const {
1123
+ data: u
1124
+ } = j(c, f);
1125
+ let d;
1126
+ e[4] !== o || e[5] !== n || e[6] !== r?.navigation ? (d = () => {
1127
+ n(), r?.navigation.goToSpineItem({
1128
+ indexOrId: o
1129
+ });
1130
+ }, e[4] = o, e[5] = n, e[6] = r?.navigation, e[7] = d) : d = e[7];
1131
+ let h;
1132
+ e[8] !== l ? (h = /* @__PURE__ */ a(he, { height: "100%", width: "100%", overflow: "hidden", pointerEvents: "none", ref: l }), e[8] = l, e[9] = h) : h = e[9];
1133
+ const m = (u?.meta?.absolutePageIndex ?? 0) + 1;
1134
+ let g;
1135
+ e[10] !== m ? (g = /* @__PURE__ */ x(q, { position: "absolute", bottom: 0, left: "0", right: "0", textAlign: "center", bgColor: "white", p: 4, fontSize: "xs", children: [
1136
+ "Page ",
1137
+ m
1138
+ ] }), e[10] = m, e[11] = g) : g = e[11];
1139
+ let p;
1140
+ return e[12] !== d || e[13] !== h || e[14] !== g ? (p = /* @__PURE__ */ x(he, { width: "100%", aspectRatio: "2/3", border: "1px solid", borderColor: "border", borderRadius: "md", "data-grid-item": !0, cursor: "pointer", position: "relative", overflow: "hidden", onClick: d, children: [
1141
+ h,
1142
+ g
1143
+ ] }), e[12] = d, e[13] = h, e[14] = g, e[15] = p) : p = e[15], p;
1144
+ }), sl = w((t) => {
1145
+ const e = y(23), {
1146
+ open: o,
1147
+ setOpen: n
1148
+ } = t, l = U();
1149
+ let i;
1150
+ e[0] !== l?.spineItemsManager.items$ ? (i = () => l?.spineItemsManager.items$, e[0] = l?.spineItemsManager.items$, e[1] = i) : i = e[1];
1151
+ let s;
1152
+ e[2] !== l ? (s = [l], e[2] = l, e[3] = s) : s = e[3];
1153
+ const {
1154
+ data: r
1155
+ } = j(i, s);
1156
+ let c;
1157
+ e[4] !== n ? (c = (v) => n(v.open), e[4] = n, e[5] = c) : c = e[5];
1158
+ let f;
1159
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = {
1160
+ mdDown: "full",
1161
+ md: "lg"
1162
+ }, e[6] = f) : f = e[6];
1163
+ let u;
1164
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ a(ye, { children: /* @__PURE__ */ a(Ie, { children: "Gallery" }) }), e[7] = u) : u = e[7];
1165
+ let d;
1166
+ e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = ["repeat(2, minmax(0, 1fr))", "repeat(3, minmax(0, 1fr))"], e[8] = d) : d = e[8];
1167
+ let h;
1168
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = [2, 4], e[9] = h) : h = e[9];
1169
+ let m;
1170
+ e[10] !== r || e[11] !== n ? (m = r?.map((v) => /* @__PURE__ */ a(il, { item: v, onNavigated: () => {
1171
+ n(!1);
1172
+ } }, v.item.id)), e[10] = r, e[11] = n, e[12] = m) : m = e[12];
1173
+ let g;
1174
+ e[13] !== m ? (g = /* @__PURE__ */ a(ke, { children: /* @__PURE__ */ a(he, { gridTemplateColumns: d, display: "grid", gap: h, pt: 2, "data-grid": !0, children: m }) }), e[13] = m, e[14] = g) : g = e[14];
1175
+ let p, b;
1176
+ e[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ a(xe, { children: /* @__PURE__ */ a($e, { asChild: !0, children: /* @__PURE__ */ a(re, { variant: "outline", children: "Cancel" }) }) }), b = /* @__PURE__ */ a(ve, {}), e[15] = p, e[16] = b) : (p = e[15], b = e[16]);
1177
+ let S;
1178
+ e[17] !== g ? (S = /* @__PURE__ */ x(_e, { height: "100%", children: [
1179
+ u,
1180
+ g,
1181
+ p,
1182
+ b
1183
+ ] }), e[17] = g, e[18] = S) : S = e[18];
1184
+ let _;
1185
+ return e[19] !== o || e[20] !== S || e[21] !== c ? (_ = /* @__PURE__ */ a(Ce, { lazyMount: !0, placement: "center", open: o, onOpenChange: c, size: f, scrollBehavior: "inside", children: S }), e[19] = o, e[20] = S, e[21] = c, e[22] = _) : _ = e[22], _;
1186
+ }), al = "@prose-reader/react-reader", rl = "1.272.0", cl = w((t) => {
1187
+ const e = y(16), {
1188
+ open: o,
1189
+ setOpen: n
1190
+ } = t;
1191
+ let l;
1192
+ e[0] !== n ? (l = (S) => n(S.open), e[0] = n, e[1] = l) : l = e[1];
1193
+ let i;
1194
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = {
1195
+ mdDown: "full",
1196
+ md: "lg"
1197
+ }, e[2] = i) : i = e[2];
1198
+ let s;
1199
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ a(ye, { children: /* @__PURE__ */ a(Ie, { children: "Help" }) }), e[3] = s) : s = e[3];
1200
+ let r;
1201
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ a(mt, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }), e[4] = r) : r = e[4];
1202
+ let c;
1203
+ e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ a(zt, { children: /* @__PURE__ */ a(pn, {}) }), e[5] = c) : c = e[5];
1204
+ let f;
1205
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ x(ge, { mb: 1, children: [
1206
+ c,
1207
+ " ",
1208
+ /* @__PURE__ */ a(q, { children: "Navigate to right page" })
1209
+ ] }), e[6] = f) : f = e[6];
1210
+ let u;
1211
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ a(zt, { children: /* @__PURE__ */ a(bn, {}) }), e[7] = u) : u = e[7];
1212
+ let d;
1213
+ e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ x(J, { children: [
1214
+ r,
1215
+ f,
1216
+ /* @__PURE__ */ x(ge, { mb: 1, children: [
1217
+ u,
1218
+ " ",
1219
+ /* @__PURE__ */ a(q, { children: "Navigate to left page" })
1220
+ ] })
1221
+ ] }), e[8] = d) : d = e[8];
1222
+ let h;
1223
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ a(mt, { mb: 2, as: "h3", size: "lg", children: "Bookmarks" }), e[9] = h) : h = e[9];
1224
+ let m;
1225
+ e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ x(J, { children: [
1226
+ h,
1227
+ /* @__PURE__ */ a(ge, { mb: 1, children: /* @__PURE__ */ a(q, { children: "Tap on the top right corner of a page bookmark it" }) })
1228
+ ] }), e[10] = m) : m = e[10];
1229
+ let g;
1230
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ x(ke, { overflowY: "auto", flex: 1, display: "flex", flexDirection: "column", gap: 4, children: [
1231
+ d,
1232
+ m,
1233
+ /* @__PURE__ */ x(J, { children: [
1234
+ /* @__PURE__ */ a(mt, { mb: 2, as: "h3", size: "lg", children: "About" }),
1235
+ /* @__PURE__ */ x(q, { children: [
1236
+ al,
1237
+ " version: ",
1238
+ rl
863
1239
  ] })
864
- }
865
- )
866
- ), te = () => {
867
- const n = m();
868
- return S(
869
- () => n ? wn([n.pagination.state$, n.context]).pipe(
870
- E(([t, o]) => {
871
- const r = o.manifest?.spineItems.every(
872
- (i) => i.mediaType?.startsWith("image/")
873
- );
874
- return {
875
- ...t,
876
- hasChapters: !o.isFullyPrePaginated && !r
877
- };
878
- })
879
- ) : Ie,
880
- [n]
881
- );
882
- }, Ft = { _open: "fade-in", _closed: "fade-out" }, _t = () => {
883
- const { enableFloatingProgress: n, quickMenuOpen: t } = y([
884
- "enableFloatingProgress",
885
- "quickMenuOpen"
886
- ]), o = te(), r = Math.floor(
887
- (o?.percentageEstimateOfBook ?? 0) * 100
888
- ), i = r > 0 ? r : 1;
889
- return o?.percentageEstimateOfBook === void 0 || !n ? null : /* @__PURE__ */ e(
890
- ue,
891
- {
892
- present: !t,
893
- animationName: Ft,
894
- animationDuration: "moderate",
895
- children: /* @__PURE__ */ e(
896
- _,
897
- {
898
- position: "absolute",
899
- right: 0,
900
- bottom: 0,
901
- p: 2,
902
- WebkitTextStroke: "2px black",
903
- paintOrder: "stroke fill",
904
- pointerEvents: "none",
905
- letterSpacing: 1,
906
- color: "white",
907
- children: /* @__PURE__ */ s(b, { fontSize: "md", children: [
908
- i,
909
- " %"
910
- ] })
911
- }
912
- )
913
- }
914
- );
915
- }, Dt = () => {
916
- const [n, t] = w(/* @__PURE__ */ new Date());
917
- return $(() => {
918
- const o = setInterval(() => {
919
- t(/* @__PURE__ */ new Date());
1240
+ ] })
1241
+ ] }), e[11] = g) : g = e[11];
1242
+ let p;
1243
+ e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ x(_e, { children: [
1244
+ s,
1245
+ g,
1246
+ /* @__PURE__ */ a(xe, { children: /* @__PURE__ */ a($e, { asChild: !0, children: /* @__PURE__ */ a(re, { variant: "outline", children: "Cancel" }) }) }),
1247
+ /* @__PURE__ */ a(ve, {})
1248
+ ] }), e[12] = p) : p = e[12];
1249
+ let b;
1250
+ return e[13] !== o || e[14] !== l ? (b = /* @__PURE__ */ a(Ce, { lazyMount: !0, placement: "center", open: o, onOpenChange: l, size: i, scrollBehavior: "inside", children: p }), e[13] = o, e[14] = l, e[15] = b) : b = e[15], b;
1251
+ }), Ge = () => {
1252
+ const t = y(3), e = U();
1253
+ let o, n;
1254
+ return t[0] !== e ? (o = () => e ? Dt([e.pagination.state$, e.context]).pipe(ne(dl)) : ft, n = [e], t[0] = e, t[1] = o, t[2] = n) : (o = t[1], n = t[2]), j(o, n).data;
1255
+ };
1256
+ function fl(t) {
1257
+ return t.mediaType?.startsWith("image/");
1258
+ }
1259
+ function dl(t) {
1260
+ const [e, o] = t, n = o.manifest?.spineItems.every(fl);
1261
+ return {
1262
+ ...e,
1263
+ hasChapters: !o.isFullyPrePaginated && !n
1264
+ };
1265
+ }
1266
+ const ul = {
1267
+ _open: "fade-in",
1268
+ _closed: "fade-out"
1269
+ }, hl = () => {
1270
+ const t = y(6);
1271
+ let e;
1272
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = ["enableFloatingProgress", "quickMenuOpen"], t[0] = e) : e = t[0];
1273
+ const {
1274
+ enableFloatingProgress: o,
1275
+ quickMenuOpen: n
1276
+ } = oe(e), l = Ge(), i = Math.floor((l?.percentageEstimateOfBook ?? 0) * 100), s = i > 0 ? i : 1;
1277
+ if (l?.percentageEstimateOfBook === void 0 || !o)
1278
+ return null;
1279
+ const r = !n;
1280
+ let c;
1281
+ t[1] !== s ? (c = /* @__PURE__ */ a(he, { position: "absolute", right: 0, bottom: 0, p: 2, WebkitTextStroke: "2px black", paintOrder: "stroke fill", pointerEvents: "none", letterSpacing: 1, color: "white", children: /* @__PURE__ */ x(q, { fontSize: "sm", children: [
1282
+ s,
1283
+ " %"
1284
+ ] }) }), t[1] = s, t[2] = c) : c = t[2];
1285
+ let f;
1286
+ return t[3] !== r || t[4] !== c ? (f = /* @__PURE__ */ a(tt, { present: r, animationName: ul, animationDuration: "moderate", children: c }), t[3] = r, t[4] = c, t[5] = f) : f = t[5], f;
1287
+ }, ml = () => {
1288
+ const t = y(3);
1289
+ let e;
1290
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ new Date(), t[0] = e) : e = t[0];
1291
+ const [o, n] = le(e);
1292
+ let l, i;
1293
+ return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = () => {
1294
+ const s = setInterval(() => {
1295
+ n(/* @__PURE__ */ new Date());
920
1296
  }, 6e4);
921
- return () => clearInterval(o);
922
- }, []), n;
923
- }, Lt = (n) => {
924
- const t = Dt();
925
- return /* @__PURE__ */ e(b, { fontSize: "md", ...n, children: t.toLocaleTimeString(navigator.language, {
1297
+ return () => clearInterval(s);
1298
+ }, i = [], t[1] = l, t[2] = i) : (l = t[1], i = t[2]), ce(l, i), o;
1299
+ }, gl = (t) => {
1300
+ const e = y(5), o = ml();
1301
+ let n;
1302
+ e[0] !== o ? (n = o.toLocaleTimeString(navigator.language, {
926
1303
  hour: "2-digit",
927
1304
  minute: "2-digit"
928
- }) });
929
- }, $t = g(() => /* @__PURE__ */ e(
930
- _,
931
- {
932
- position: "absolute",
933
- left: 0,
934
- bottom: 0,
935
- p: 2,
936
- color: "white",
937
- WebkitTextStroke: "2px black",
938
- paintOrder: "stroke fill",
939
- pointerEvents: "none",
940
- letterSpacing: 1,
941
- children: /* @__PURE__ */ e(Lt, {})
1305
+ }), e[0] = o, e[1] = n) : n = e[1];
1306
+ let l;
1307
+ return e[2] !== t || e[3] !== n ? (l = /* @__PURE__ */ a(q, { fontSize: "sm", ...t, children: n }), e[2] = t, e[3] = n, e[4] = l) : l = e[4], l;
1308
+ }, pl = w(() => {
1309
+ const t = y(1);
1310
+ let e;
1311
+ return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ a(he, { position: "absolute", left: 0, bottom: 0, p: 2, color: "white", WebkitTextStroke: "2px black", paintOrder: "stroke fill", pointerEvents: "none", letterSpacing: 1, children: /* @__PURE__ */ a(gl, {}) }), t[0] = e) : e = t[0], e;
1312
+ }), bl = () => {
1313
+ const t = y(4), e = U();
1314
+ let o;
1315
+ t[0] !== e?.links$ ? (o = () => e?.links$.subscribe(Sl), t[0] = e?.links$, t[1] = o) : o = t[1];
1316
+ let n;
1317
+ t[2] !== e ? (n = [e], t[2] = e, t[3] = n) : n = t[3], pe(o, n);
1318
+ };
1319
+ function Sl(t) {
1320
+ if (t.type === "click" && Fn(t.target, "a")) {
1321
+ if (!t.target.href)
1322
+ return;
1323
+ const e = new URL(t.target.href);
1324
+ window.location.host !== e.host && confirm("You are going to be redirected to external link") && window.open(t.target.href, "__blank");
942
1325
  }
943
- )), Nt = () => {
944
- const n = m();
945
- H(
946
- () => n?.links$.subscribe((t) => {
947
- if (t.type === "click" && Vn(t.target, "a")) {
948
- if (!t.target.href) return;
949
- const o = new URL(t.target.href);
950
- window.location.host !== o.host && confirm(
951
- "You are going to be redirected to external link"
952
- ) && window.open(t.target.href, "__blank");
953
- }
954
- }),
955
- [n]
956
- );
957
- }, Vt = () => {
958
- const { notificationsSubject: n } = y([
959
- "notificationsSubject"
960
- ]);
961
- H(
962
- () => n.pipe(
963
- se(_e),
964
- yn((t) => {
965
- const o = t.duration ?? 3e3, r = new Pn((a) => {
966
- try {
967
- queueMicrotask(() => {
968
- const l = Ce.create({
969
- title: t.title,
970
- description: t.description,
971
- duration: o
972
- });
973
- a.next(l), a.complete();
974
- });
975
- } catch (l) {
976
- a.error(l);
977
- }
978
- }), i = n.pipe(
979
- En(1),
980
- se((a) => !!t.key && a?.key === t.key)
981
- );
982
- return r.pipe(
983
- V(
984
- (a) => Ve(
985
- We(o),
986
- t.abort ?? Ie,
987
- i
988
- ).pipe(
989
- Ne(),
990
- An(() => {
991
- queueMicrotask(() => {
992
- Ce.dismiss(a);
993
- });
994
- })
995
- )
996
- )
997
- );
998
- })
999
- ),
1000
- [n]
1001
- );
1002
- }, Wt = A.forwardRef(
1003
- function(t, o) {
1004
- const {
1005
- showArrow: r,
1006
- children: i,
1007
- portalled: a = !0,
1008
- content: l,
1009
- portalRef: c,
1010
- ...d
1011
- } = t;
1012
- return /* @__PURE__ */ s(
1013
- ee.Root,
1014
- {
1015
- ...d,
1016
- positioning: { ...d.positioning, gutter: 4 },
1017
- children: [
1018
- /* @__PURE__ */ e(ee.Trigger, { asChild: !0, children: i }),
1019
- /* @__PURE__ */ e(ve, { disabled: !a, container: c, children: /* @__PURE__ */ e(ee.Positioner, { children: /* @__PURE__ */ s(
1020
- ee.Content,
1021
- {
1022
- width: "auto",
1023
- px: "2",
1024
- py: "1",
1025
- textStyle: "xs",
1026
- rounded: "sm",
1027
- ref: o,
1028
- children: [
1029
- r && /* @__PURE__ */ e(ee.Arrow, { children: /* @__PURE__ */ e(ee.ArrowTip, {}) }),
1030
- l
1031
- ]
1032
- }
1033
- ) }) })
1034
- ]
1326
+ }
1327
+ const _l = () => {
1328
+ const t = y(4);
1329
+ let e;
1330
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = ["notificationsSubject"], t[0] = e) : e = t[0];
1331
+ const {
1332
+ notificationsSubject: o
1333
+ } = oe(e);
1334
+ let n, l;
1335
+ t[1] !== o ? (n = () => o.pipe(Xe(Et), zn((i) => {
1336
+ const s = i.duration ?? 3e3, r = new Rn((f) => {
1337
+ try {
1338
+ queueMicrotask(() => {
1339
+ const u = vt.create({
1340
+ title: i.title,
1341
+ description: i.description,
1342
+ duration: s
1343
+ });
1344
+ f.next(u), f.complete();
1345
+ });
1346
+ } catch (u) {
1347
+ const d = u;
1348
+ f.error(d);
1035
1349
  }
1036
- );
1037
- }
1038
- ), Ht = A.forwardRef(function(t, o) {
1039
- const { children: r, ...i } = t;
1040
- return /* @__PURE__ */ e(Wt, { content: r, ...i, ref: o, children: /* @__PURE__ */ e(
1041
- k,
1042
- {
1043
- variant: "ghost",
1044
- "aria-label": "info",
1045
- size: "2xs",
1046
- colorPalette: "gray",
1047
- children: /* @__PURE__ */ e(Kn, {})
1048
- }
1049
- ) });
1050
- }), Gt = A.forwardRef(function(t, o) {
1051
- return /* @__PURE__ */ e(le.Track, { ...t, ref: o, children: /* @__PURE__ */ e(le.Range, {}) });
1350
+ }), c = o.pipe(wn(1), Xe((f) => !!i.key && f?.key === i.key));
1351
+ return r.pipe(be((f) => Nt(Ht(s), i.abort ?? ft, c).pipe(Lt(), Mn(() => {
1352
+ queueMicrotask(() => {
1353
+ vt.dismiss(f);
1354
+ });
1355
+ }))));
1356
+ })), l = [o], t[1] = o, t[2] = n, t[3] = l) : (n = t[2], l = t[3]), pe(n, l);
1357
+ }, vl = se.forwardRef(function(e, o) {
1358
+ const n = y(26);
1359
+ let l, i, s, r, c, f;
1360
+ n[0] !== e ? ({
1361
+ showArrow: c,
1362
+ children: l,
1363
+ portalled: f,
1364
+ content: i,
1365
+ portalRef: s,
1366
+ ...r
1367
+ } = e, n[0] = e, n[1] = l, n[2] = i, n[3] = s, n[4] = r, n[5] = c, n[6] = f) : (l = n[1], i = n[2], s = n[3], r = n[4], c = n[5], f = n[6]);
1368
+ const u = f === void 0 ? !0 : f;
1369
+ let d;
1370
+ n[7] !== r.positioning ? (d = {
1371
+ ...r.positioning,
1372
+ gutter: 4
1373
+ }, n[7] = r.positioning, n[8] = d) : d = n[8];
1374
+ let h;
1375
+ n[9] !== l ? (h = /* @__PURE__ */ a(He.Trigger, { asChild: !0, children: l }), n[9] = l, n[10] = h) : h = n[10];
1376
+ const m = !u;
1377
+ let g;
1378
+ n[11] !== c ? (g = c && /* @__PURE__ */ a(He.Arrow, { children: /* @__PURE__ */ a(He.ArrowTip, {}) }), n[11] = c, n[12] = g) : g = n[12];
1379
+ let p;
1380
+ n[13] !== i || n[14] !== o || n[15] !== g ? (p = /* @__PURE__ */ a(He.Positioner, { children: /* @__PURE__ */ x(He.Content, { width: "auto", px: "2", py: "1", textStyle: "xs", rounded: "sm", ref: o, children: [
1381
+ g,
1382
+ i
1383
+ ] }) }), n[13] = i, n[14] = o, n[15] = g, n[16] = p) : p = n[16];
1384
+ let b;
1385
+ n[17] !== s || n[18] !== m || n[19] !== p ? (b = /* @__PURE__ */ a(ct, { disabled: m, container: s, children: p }), n[17] = s, n[18] = m, n[19] = p, n[20] = b) : b = n[20];
1386
+ let S;
1387
+ return n[21] !== r || n[22] !== d || n[23] !== h || n[24] !== b ? (S = /* @__PURE__ */ x(He.Root, { ...r, positioning: d, children: [
1388
+ h,
1389
+ b
1390
+ ] }), n[21] = r, n[22] = d, n[23] = h, n[24] = b, n[25] = S) : S = n[25], S;
1391
+ }), Cl = se.forwardRef(function(e, o) {
1392
+ const n = y(8);
1393
+ let l, i;
1394
+ n[0] !== e ? ({
1395
+ children: l,
1396
+ ...i
1397
+ } = e, n[0] = e, n[1] = l, n[2] = i) : (l = n[1], i = n[2]);
1398
+ let s;
1399
+ n[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ a(ee, { variant: "ghost", "aria-label": "info", size: "2xs", colorPalette: "gray", children: /* @__PURE__ */ a(Xn, {}) }), n[3] = s) : s = n[3];
1400
+ let r;
1401
+ return n[4] !== l || n[5] !== o || n[6] !== i ? (r = /* @__PURE__ */ a(vl, { content: l, ...i, ref: o, children: s }), n[4] = l, n[5] = o, n[6] = i, n[7] = r) : r = n[7], r;
1402
+ }), xl = se.forwardRef(function(e, o) {
1403
+ const n = y(4);
1404
+ let l;
1405
+ n[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ a(Ze.Range, {}), n[0] = l) : l = n[0];
1406
+ let i;
1407
+ return n[1] !== e || n[2] !== o ? (i = /* @__PURE__ */ a(Ze.Track, { ...e, ref: o, children: l }), n[1] = e, n[2] = o, n[3] = i) : i = n[3], i;
1052
1408
  });
1053
- A.forwardRef(function(t, o) {
1054
- const { children: r, info: i, ...a } = t;
1055
- return /* @__PURE__ */ s(le.Label, { ...a, ref: o, children: [
1056
- r,
1057
- i && /* @__PURE__ */ e(Ht, { children: i })
1058
- ] });
1409
+ se.forwardRef(function(e, o) {
1410
+ const n = y(11);
1411
+ let l, i, s;
1412
+ n[0] !== e ? ({
1413
+ children: l,
1414
+ info: i,
1415
+ ...s
1416
+ } = e, n[0] = e, n[1] = l, n[2] = i, n[3] = s) : (l = n[1], i = n[2], s = n[3]);
1417
+ let r;
1418
+ n[4] !== i ? (r = i && /* @__PURE__ */ a(Cl, { children: i }), n[4] = i, n[5] = r) : r = n[5];
1419
+ let c;
1420
+ return n[6] !== l || n[7] !== o || n[8] !== s || n[9] !== r ? (c = /* @__PURE__ */ x(Ze.Label, { ...s, ref: o, children: [
1421
+ l,
1422
+ r
1423
+ ] }), n[6] = l, n[7] = o, n[8] = s, n[9] = r, n[10] = c) : c = n[10], c;
1059
1424
  });
1060
- const qt = le.Root, jt = le.ValueText, ze = () => {
1061
- const n = te(), t = n?.numberOfTotalPages === 1, o = (n?.beginNumberOfPagesInSpineItem ?? 0) > 1, r = (n?.endNumberOfPagesInSpineItem ?? 0) > 1, i = (n?.hasChapters ? n?.beginPageIndexInSpineItem : n?.beginAbsolutePageIndex) ?? 0, a = (n?.hasChapters ? n?.endPageIndexInSpineItem : n?.endAbsolutePageIndex) ?? 0, [l = 0, c = 0] = [
1062
- i,
1063
- a
1064
- ].sort((p, h) => p - h), d = n?.beginPageIndexInSpineItem !== n?.endPageIndexInSpineItem || n?.beginSpineItemIndex !== n?.endSpineItemIndex, u = n?.hasChapters ? n?.beginNumberOfPagesInSpineItem : n?.numberOfTotalPages;
1425
+ const yl = Ze.Root, kl = Ze.ValueText, Ot = () => {
1426
+ const t = Ge(), e = t?.numberOfTotalPages === 1, o = (t?.beginNumberOfPagesInSpineItem ?? 0) > 1, n = (t?.endNumberOfPagesInSpineItem ?? 0) > 1, l = (t?.hasChapters ? t?.beginPageIndexInSpineItem : t?.beginAbsolutePageIndex) ?? 0, i = (t?.hasChapters ? t?.endPageIndexInSpineItem : t?.endAbsolutePageIndex) ?? 0, [s = 0, r = 0] = [l, i].sort((u, d) => u - d), c = t?.beginPageIndexInSpineItem !== t?.endPageIndexInSpineItem || t?.beginSpineItemIndex !== t?.endSpineItemIndex, f = t?.hasChapters ? t?.beginNumberOfPagesInSpineItem : t?.numberOfTotalPages;
1065
1427
  return {
1066
- hasOnlyOnePage: t,
1067
- beginPageIndex: i,
1068
- endPageIndex: a,
1428
+ hasOnlyOnePage: e,
1429
+ beginPageIndex: l,
1430
+ endPageIndex: i,
1069
1431
  isBeginWithinChapter: o,
1070
- isEndWithinChapter: r,
1071
- beginAndEndAreDifferent: d,
1072
- totalApproximatePages: u,
1073
- leftPageIndex: l,
1074
- rightPageIndex: c
1432
+ isEndWithinChapter: n,
1433
+ beginAndEndAreDifferent: c,
1434
+ totalApproximatePages: f,
1435
+ leftPageIndex: s,
1436
+ rightPageIndex: r
1075
1437
  };
1076
- }, Ut = () => {
1077
- const n = te(), {
1078
- hasOnlyOnePage: t,
1079
- leftPageIndex: o,
1080
- rightPageIndex: r,
1438
+ }, Il = () => {
1439
+ const t = y(24), e = Ge(), {
1440
+ hasOnlyOnePage: o,
1441
+ leftPageIndex: n,
1442
+ rightPageIndex: l,
1081
1443
  totalApproximatePages: i,
1082
- beginAndEndAreDifferent: a
1083
- } = ze(), l = Math.round((n?.percentageEstimateOfBook ?? 0) * 100), c = (u) => u?.subChapter ? `${u.title} / ${c(u.subChapter)}` : u?.title || "", d = c(n?.beginChapterInfo);
1084
- return /* @__PURE__ */ s(O, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
1085
- /* @__PURE__ */ e(qt, { value: l, size: "xs", width: 150, children: /* @__PURE__ */ s(F, { justifyContent: "space-between", children: [
1086
- /* @__PURE__ */ e(Gt, { width: 110 }),
1087
- /* @__PURE__ */ e(jt, { children: `${l}%` })
1088
- ] }) }),
1089
- /* @__PURE__ */ e(b, { truncate: !0, maxWidth: "100%", fontSize: "sm", mt: 1, children: d ? `Chapter: ${d}` : " " }),
1090
- !t && /* @__PURE__ */ s(F, { children: [
1091
- /* @__PURE__ */ e(b, { fontSize: "xs", children: a ? `${o + 1} - ${r + 1} of ${i}` : `${o + 1} of ${i}` }),
1092
- !!n?.hasChapters && /* @__PURE__ */ s(de, { children: [
1093
- /* @__PURE__ */ e(b, { children: "-" }),
1094
- /* @__PURE__ */ s(b, { fontSize: "xs", children: [
1095
- "(",
1096
- (n?.beginAbsolutePageIndex ?? 0) + 1,
1097
- ")"
1098
- ] })
1444
+ beginAndEndAreDifferent: s
1445
+ } = Ot();
1446
+ let r;
1447
+ t[0] !== e?.percentageEstimateOfBook ? (r = Math.round((e?.percentageEstimateOfBook ?? 0) * 100), t[0] = e?.percentageEstimateOfBook, t[1] = r) : r = t[1];
1448
+ const c = r;
1449
+ let f;
1450
+ if (t[2] !== e?.beginChapterInfo) {
1451
+ const v = (C) => C?.subChapter ? `${C.title} / ${v(C.subChapter)}` : C?.title || "";
1452
+ f = v(e?.beginChapterInfo), t[2] = e?.beginChapterInfo, t[3] = f;
1453
+ } else
1454
+ f = t[3];
1455
+ const u = f;
1456
+ let d;
1457
+ t[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ a(xl, { width: 110 }), t[4] = d) : d = t[4];
1458
+ const h = `${c}%`;
1459
+ let m;
1460
+ t[5] !== h ? (m = /* @__PURE__ */ x(ge, { justifyContent: "space-between", children: [
1461
+ d,
1462
+ /* @__PURE__ */ a(kl, { children: h })
1463
+ ] }), t[5] = h, t[6] = m) : m = t[6];
1464
+ let g;
1465
+ t[7] !== c || t[8] !== m ? (g = /* @__PURE__ */ a(yl, { value: c, size: "xs", width: 150, children: m }), t[7] = c, t[8] = m, t[9] = g) : g = t[9];
1466
+ const p = u ? `Chapter: ${u}` : " ";
1467
+ let b;
1468
+ t[10] !== p ? (b = /* @__PURE__ */ a(q, { truncate: !0, maxWidth: "100%", fontSize: "sm", mt: 1, children: p }), t[10] = p, t[11] = b) : b = t[11];
1469
+ let S;
1470
+ t[12] !== s || t[13] !== o || t[14] !== n || t[15] !== e?.beginAbsolutePageIndex || t[16] !== e?.hasChapters || t[17] !== l || t[18] !== i ? (S = !o && /* @__PURE__ */ x(ge, { children: [
1471
+ /* @__PURE__ */ a(q, { fontSize: "xs", children: s ? `${n + 1} - ${l + 1} of ${i}` : `${n + 1} of ${i}` }),
1472
+ !!e?.hasChapters && /* @__PURE__ */ x(et, { children: [
1473
+ /* @__PURE__ */ a(q, { children: "-" }),
1474
+ /* @__PURE__ */ x(q, { fontSize: "xs", children: [
1475
+ "(",
1476
+ (e?.beginAbsolutePageIndex ?? 0) + 1,
1477
+ ")"
1099
1478
  ] })
1100
1479
  ] })
1101
- ] });
1102
- }, Ke = g(
1103
- ({
1104
- children: n,
1105
- position: t,
1106
- ...o
1107
- }) => /* @__PURE__ */ e(
1108
- ue,
1109
- {
1110
- display: "flex",
1111
- flexDirection: "row",
1112
- width: "100%",
1113
- position: "absolute",
1114
- ...t === "bottom" ? { bottom: 0 } : { top: 0 },
1115
- animationName: t === "bottom" ? {
1116
- _open: "slide-from-bottom, fade-in",
1117
- _closed: "slide-to-bottom, fade-out"
1118
- } : {
1119
- _open: "slide-from-top, fade-in",
1120
- _closed: "slide-to-top, fade-out"
1121
- },
1122
- animationDuration: "moderate",
1123
- bgColor: "bg.panel",
1124
- alignItems: "center",
1125
- justifyContent: "center",
1126
- shadow: "md",
1127
- p: 4,
1128
- ...o,
1129
- children: n
1130
- }
1131
- )
1132
- ), Qt = rn(Jn), Yt = g((n) => /* @__PURE__ */ e(
1133
- _,
1134
- {
1135
- display: "contents",
1136
- css: {
1137
- "--bg": "colors.bg",
1138
- "--bg-emphasized": "colors.bg.emphasized",
1139
- "--color-solid": "colors.colorPalette.solid"
1480
+ ] }), t[12] = s, t[13] = o, t[14] = n, t[15] = e?.beginAbsolutePageIndex, t[16] = e?.hasChapters, t[17] = l, t[18] = i, t[19] = S) : S = t[19];
1481
+ let _;
1482
+ return t[20] !== g || t[21] !== b || t[22] !== S ? (_ = /* @__PURE__ */ x(J, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
1483
+ g,
1484
+ b,
1485
+ S
1486
+ ] }), t[20] = g, t[21] = b, t[22] = S, t[23] = _) : _ = t[23], _;
1487
+ }, Xt = w((t) => {
1488
+ const e = y(12);
1489
+ let o, n, l;
1490
+ e[0] !== t ? ({
1491
+ children: o,
1492
+ position: n,
1493
+ ...l
1494
+ } = t, e[0] = t, e[1] = o, e[2] = n, e[3] = l) : (o = e[1], n = e[2], l = e[3]);
1495
+ let i, s;
1496
+ e[4] !== n ? (i = n === "bottom" ? {
1497
+ bottom: 0
1498
+ } : {
1499
+ top: 0
1500
+ }, s = n === "bottom" ? {
1501
+ _open: "slide-from-bottom, fade-in",
1502
+ _closed: "slide-to-bottom, fade-out"
1503
+ } : {
1504
+ _open: "slide-from-top, fade-in",
1505
+ _closed: "slide-to-top, fade-out"
1506
+ }, e[4] = n, e[5] = i, e[6] = s) : (i = e[5], s = e[6]);
1507
+ let r;
1508
+ return e[7] !== o || e[8] !== l || e[9] !== i || e[10] !== s ? (r = /* @__PURE__ */ a(tt, { display: "flex", flexDirection: "row", width: "100%", position: "absolute", ...i, animationName: s, animationDuration: "moderate", bgColor: "bg.panel", alignItems: "center", justifyContent: "center", shadow: "md", p: 4, ...l, children: o }), e[7] = o, e[8] = l, e[9] = i, e[10] = s, e[11] = r) : r = e[11], r;
1509
+ }), $l = sn(Jn), Ol = w((t) => {
1510
+ const e = y(10);
1511
+ let o;
1512
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = {
1513
+ "--bg": "colors.bg",
1514
+ "--bg-emphasized": "colors.bg.emphasized",
1515
+ "--color-solid": "colors.colorPalette.solid"
1516
+ }, e[0] = o) : o = e[0];
1517
+ let n, l, i, s;
1518
+ e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = {
1519
+ padding: 0
1520
+ }, l = {
1521
+ "& > .rc-slider-handle:focus-visible": {
1522
+ boxShadow: "0 0 0 2px var(--color-solid) !important"
1140
1523
  },
1141
- children: /* @__PURE__ */ e(
1142
- Qt,
1143
- {
1144
- keyboard: !1,
1145
- style: {
1146
- padding: 0
1147
- },
1148
- css: {
1149
- "& > .rc-slider-handle:focus-visible": {
1150
- boxShadow: "0 0 0 2px var(--color-solid) !important"
1151
- },
1152
- "& > .rc-slider-handle:active": {
1153
- boxShadow: "0 0 5px var(--color-solid) !important"
1154
- },
1155
- "& > .rc-slider-handle.rc-slider-handle-dragging": {
1156
- boxShadow: "0 0 0 3px var(--color-solid) !important"
1157
- }
1158
- },
1159
- styles: {
1160
- rail: {
1161
- height: "8px",
1162
- top: "50%",
1163
- transform: "translateY(-50%)",
1164
- backgroundColor: "var(--bg-emphasized)"
1165
- },
1166
- track: {
1167
- height: "8px",
1168
- top: "50%",
1169
- transform: "translateY(-50%)",
1170
- backgroundColor: "var(--color-solid)"
1171
- },
1172
- handle: {
1173
- width: "24px",
1174
- height: "24px",
1175
- top: "50%",
1176
- borderColor: "var(--color-solid)",
1177
- transform: `translate(${n.reverse ? "50%" : "-50%"}, -50%)`,
1178
- backgroundColor: "var(--bg)",
1179
- marginTop: "0px"
1180
- }
1181
- },
1182
- ...n
1183
- }
1184
- )
1185
- }
1186
- )), Zt = () => {
1187
- const t = te()?.isUsingSpread, { beginPageIndex: o, totalApproximatePages: r = 0 } = ze(), i = t ? Math.floor((o || 0) / 2) : o, [a, l] = Tn(
1188
- () => ne({
1189
- default: i || 0
1190
- })
1191
- ), c = 0, d = Math.max(
1192
- 0,
1193
- t ? Math.floor((r - 1) / 2) : r - 1
1194
- );
1195
- return $(() => {
1196
- l.update(i || 0);
1197
- }, [i, l]), {
1198
- value: a,
1199
- valueSignal: l,
1200
- min: c,
1201
- max: d
1202
- };
1203
- }, Xt = (n) => {
1204
- const t = m(), o = te(), { manifest: r } = S(() => t?.context, [t]) ?? {}, i = r?.readingDirection === "rtl", a = o?.isUsingSpread, { totalApproximatePages: l = 0, isBeginWithinChapter: c } = ze(), d = 1, u = c, { value: p, valueSignal: h, min: C, max: v } = Zt(), R = T(
1205
- (x) => {
1206
- const [L = 0] = Array.isArray(x) ? x : [x];
1207
- h.update(L);
1208
- const I = a ? Math.floor(L) * 2 : Math.floor(L);
1209
- u ? t?.navigation.goToPageOfSpineItem({
1210
- pageIndex: I,
1211
- spineItemId: t.pagination.state.beginSpineItemIndex ?? 0,
1212
- animation: !1
1213
- }) : t?.navigation.goToAbsolutePageIndex({
1214
- absolutePageIndex: I,
1215
- animation: !1
1216
- });
1524
+ "& > .rc-slider-handle:active": {
1525
+ boxShadow: "0 0 5px var(--color-solid) !important"
1217
1526
  },
1218
- [t, a, h, u]
1219
- );
1220
- return H(
1221
- () => t?.navigation.throttleLock({
1222
- duration: 100,
1223
- trigger: h.subject
1224
- }),
1225
- [t, h]
1226
- ), l === 1 || a && l === 2 ? /* @__PURE__ */ e(_, { style: n.style }) : /* @__PURE__ */ e(
1227
- Yt,
1228
- {
1229
- value: [p],
1230
- max: v,
1231
- min: C,
1232
- reverse: i,
1233
- step: d,
1234
- onChange: R,
1235
- ...n
1527
+ "& > .rc-slider-handle.rc-slider-handle-dragging": {
1528
+ boxShadow: "0 0 0 3px var(--color-solid) !important"
1236
1529
  }
1237
- );
1238
- }, Kt = g(
1239
- ({
1240
- open: n,
1241
- onItemClick: t
1242
- }) => {
1243
- const o = un(null), r = m(), {
1244
- quickMenuBottomBarBoundingBoxSignal: i,
1245
- onFontSizeMenuOpenChange: a,
1246
- onRefitMenuOpenChange: l
1247
- } = y([
1248
- "quickMenuBottomBarBoundingBoxSignal",
1249
- "onFontSizeMenuOpenChange",
1250
- "onRefitMenuOpenChange"
1251
- ]), c = S(() => r?.navigation.state$, [r]), d = S(() => r?.settings.values$, [r]), u = S(
1252
- () => r?.zoom.state$.pipe(
1253
- E(
1254
- (x) => x.currentScale > 1 ? "in" : x.currentScale < 1 ? "out" : void 0
1255
- )
1256
- ),
1257
- [r]
1258
- ), p = u === "in", h = u === "out", C = d?.computedPageTurnMode === "scrollable", v = d?.computedPageTurnDirection === "vertical", [R, D] = w(!0);
1259
- return $(() => {
1260
- if (!o.current) return;
1261
- const x = new ResizeObserver((L) => {
1262
- for (const I of L)
1263
- i.update(I);
1264
- });
1265
- return x.observe(o.current), () => {
1266
- x.disconnect();
1267
- };
1268
- }, [i]), /* @__PURE__ */ s(
1269
- Ke,
1270
- {
1271
- present: n,
1272
- position: "bottom",
1273
- display: "flex",
1274
- flexDirection: "column",
1275
- overflow: "auto",
1276
- pb: 8,
1277
- px: 0,
1278
- ref: o,
1279
- children: [
1280
- /* @__PURE__ */ s(
1281
- F,
1282
- {
1283
- flex: 1,
1284
- alignItems: "center",
1285
- justifyContent: "center",
1286
- maxWidth: "100%",
1287
- px: 4,
1288
- children: [
1289
- /* @__PURE__ */ e(
1290
- k,
1291
- {
1292
- "aria-label": "left",
1293
- size: "lg",
1294
- variant: "ghost",
1295
- flexShrink: 0,
1296
- onClick: () => r?.navigation.goToLeftOrTopSpineItem(),
1297
- disabled: !c?.canGoLeftSpineItem && !c?.canGoTopSpineItem,
1298
- children: v ? /* @__PURE__ */ e(Qn, {}) : /* @__PURE__ */ e(Yn, {})
1299
- }
1300
- ),
1301
- /* @__PURE__ */ s(
1302
- O,
1303
- {
1304
- flex: 1,
1305
- maxW: 400,
1306
- gap: 2,
1307
- alignItems: "center",
1308
- overflow: "auto",
1309
- px: 4,
1310
- children: [
1311
- /* @__PURE__ */ e(Ut, {}),
1312
- /* @__PURE__ */ e(
1313
- Xt,
1314
- {
1315
- style: {
1316
- width: "100%",
1317
- maxWidth: "300px",
1318
- height: "35px"
1319
- }
1320
- }
1321
- )
1322
- ]
1323
- }
1324
- ),
1325
- /* @__PURE__ */ e(
1326
- k,
1327
- {
1328
- "aria-label": "right",
1329
- size: "lg",
1330
- flexShrink: 0,
1331
- variant: "ghost",
1332
- disabled: !c?.canGoRightSpineItem && !c?.canGoBottomSpineItem,
1333
- onClick: () => {
1334
- r?.navigation.goToRightOrBottomSpineItem();
1335
- },
1336
- children: v ? /* @__PURE__ */ e(Zn, {}) : /* @__PURE__ */ e(Xn, {})
1337
- }
1338
- )
1339
- ]
1340
- }
1341
- ),
1342
- /* @__PURE__ */ e(F, { alignSelf: "stretch", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ s(
1343
- be.Root,
1344
- {
1345
- open: R,
1346
- flex: 1,
1347
- onOpenChange: ({ open: x }) => {
1348
- D(x);
1349
- },
1350
- width: "100%",
1351
- children: [
1352
- /* @__PURE__ */ e(
1353
- be.Trigger,
1354
- {
1355
- paddingY: "3",
1356
- width: "100%",
1357
- display: "flex",
1358
- justifyContent: "center",
1359
- children: /* @__PURE__ */ e(
1360
- bn,
1361
- {
1362
- style: {
1363
- transform: R ? "rotate(0deg)" : "rotate(180deg)"
1364
- }
1365
- }
1366
- )
1367
- }
1368
- ),
1369
- /* @__PURE__ */ e(be.Content, { display: "flex", justifyContent: "center", children: /* @__PURE__ */ s(_, { display: "flex", overflowX: "auto", px: 4, pb: 1, children: [
1370
- /* @__PURE__ */ e(
1371
- k,
1372
- {
1373
- "aria-label": "Help",
1374
- size: "lg",
1375
- variant: "ghost",
1376
- onClick: () => t("help"),
1377
- children: /* @__PURE__ */ e(Sn, {})
1378
- }
1379
- ),
1380
- /* @__PURE__ */ e(
1381
- k,
1382
- {
1383
- "aria-label": "Table of contents",
1384
- size: "lg",
1385
- variant: "ghost",
1386
- onClick: () => t("toc"),
1387
- children: /* @__PURE__ */ e(Cn, {})
1388
- }
1389
- ),
1390
- je(r) && /* @__PURE__ */ e(
1391
- k,
1392
- {
1393
- "aria-label": "Search",
1394
- size: "lg",
1395
- variant: "ghost",
1396
- onClick: () => t("search"),
1397
- children: /* @__PURE__ */ e(vn, {})
1398
- }
1399
- ),
1400
- /* @__PURE__ */ e(
1401
- k,
1402
- {
1403
- "aria-label": "Zoom",
1404
- size: "lg",
1405
- variant: p ? "solid" : "ghost",
1406
- onClick: () => {
1407
- p ? r?.zoom.exit({ animate: !0 }) : r?.zoom.enter({
1408
- animate: !0,
1409
- scale: 2
1410
- });
1411
- },
1412
- children: p ? /* @__PURE__ */ e(xn, {}) : /* @__PURE__ */ e(kn, {})
1413
- }
1414
- ),
1415
- /* @__PURE__ */ e(
1416
- k,
1417
- {
1418
- "aria-label": "font size",
1419
- size: "lg",
1420
- onClick: () => {
1421
- a(!0);
1422
- },
1423
- variant: "ghost",
1424
- children: /* @__PURE__ */ e(Wn, {})
1425
- }
1426
- ),
1427
- ce(r) && /* @__PURE__ */ e(
1428
- k,
1429
- {
1430
- "aria-label": "Bookmarks",
1431
- size: "lg",
1432
- variant: "ghost",
1433
- onClick: () => t("bookmarks"),
1434
- children: /* @__PURE__ */ e(Hn, {})
1435
- }
1436
- ),
1437
- ce(r) && /* @__PURE__ */ e(
1438
- k,
1439
- {
1440
- "aria-label": "Annotations",
1441
- size: "lg",
1442
- variant: "ghost",
1443
- onClick: () => t("annotations"),
1444
- children: /* @__PURE__ */ e(pe, {})
1445
- }
1446
- ),
1447
- Qe(r) && /* @__PURE__ */ e(
1448
- k,
1449
- {
1450
- "aria-label": "Refit",
1451
- size: "lg",
1452
- variant: "ghost",
1453
- onClick: () => {
1454
- l(!0);
1455
- },
1456
- disabled: !C,
1457
- children: /* @__PURE__ */ e(Gn, {})
1458
- }
1459
- ),
1460
- /* @__PURE__ */ e(
1461
- k,
1462
- {
1463
- "aria-label": "Thumbnails",
1464
- size: "lg",
1465
- variant: h ? "solid" : "ghost",
1466
- onClick: () => {
1467
- h ? r?.zoom.exit({ animate: !0 }) : r?.zoom.enter({
1468
- animate: !0,
1469
- scale: 0.5
1470
- });
1471
- },
1472
- children: /* @__PURE__ */ e(In, {})
1473
- }
1474
- ),
1475
- Ue(r) && /* @__PURE__ */ e(
1476
- k,
1477
- {
1478
- "aria-label": "Gallery",
1479
- size: "lg",
1480
- variant: "ghost",
1481
- onClick: () => t("gallery"),
1482
- children: /* @__PURE__ */ e(Un, {})
1483
- }
1484
- )
1485
- ] }) })
1486
- ]
1487
- }
1488
- ) })
1489
- ]
1490
- }
1491
- );
1492
- }
1493
- ), Jt = () => {
1494
- const [n, t] = w(!1), o = T(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
1495
- t(!1);
1496
- }) : document.documentElement.requestFullscreen({ navigationUI: "hide" }).catch(console.error).then(() => {
1497
- t(!0);
1498
- }), []);
1499
- return $(() => {
1500
- function r() {
1501
- t(!!document.fullscreenElement);
1530
+ }, i = {
1531
+ height: "8px",
1532
+ top: "50%",
1533
+ transform: "translateY(-50%)",
1534
+ backgroundColor: "var(--bg-emphasized)"
1535
+ }, s = {
1536
+ height: "8px",
1537
+ top: "50%",
1538
+ transform: "translateY(-50%)",
1539
+ backgroundColor: "var(--color-solid)"
1540
+ }, e[1] = n, e[2] = l, e[3] = i, e[4] = s) : (n = e[1], l = e[2], i = e[3], s = e[4]);
1541
+ const r = `translate(${t.reverse ? "50%" : "-50%"}, -50%)`;
1542
+ let c;
1543
+ e[5] !== r ? (c = {
1544
+ rail: i,
1545
+ track: s,
1546
+ handle: {
1547
+ width: "24px",
1548
+ height: "24px",
1549
+ top: "50%",
1550
+ borderColor: "var(--color-solid)",
1551
+ transform: r,
1552
+ backgroundColor: "var(--bg)",
1553
+ marginTop: "0px"
1502
1554
  }
1503
- return document.addEventListener("fullscreenchange", r), () => {
1504
- document.removeEventListener("fullscreenchange", r);
1505
- };
1506
- }, []), {
1507
- isFullscreen: n,
1508
- onToggleFullscreenClick: o
1509
- };
1510
- }, eo = g(
1511
- ({
1512
- open: n,
1513
- onItemClick: t
1514
- }) => {
1515
- const o = m(), r = S(() => o?.context.manifest$, [o]), { isFullscreen: i, onToggleFullscreenClick: a } = Jt();
1516
- return /* @__PURE__ */ s(
1517
- Ke,
1518
- {
1519
- present: n,
1520
- position: "top",
1521
- height: "80px",
1522
- justifyContent: "space-between",
1523
- children: [
1524
- /* @__PURE__ */ e(
1525
- k,
1526
- {
1527
- "aria-label": "left",
1528
- size: "lg",
1529
- variant: "ghost",
1530
- flexShrink: 0,
1531
- onClick: () => t("back"),
1532
- children: /* @__PURE__ */ e(et, {})
1533
- }
1534
- ),
1535
- /* @__PURE__ */ e(
1536
- O,
1537
- {
1538
- flex: 1,
1539
- maxW: 600,
1540
- gap: 1,
1541
- alignItems: "center",
1542
- overflow: "auto",
1543
- px: 4,
1544
- children: /* @__PURE__ */ e(b, { truncate: !0, maxWidth: "100%", children: r?.title })
1545
- }
1546
- ),
1547
- /* @__PURE__ */ s(F, { children: [
1548
- /* @__PURE__ */ e(
1549
- k,
1550
- {
1551
- "aria-label": "right",
1552
- size: "lg",
1553
- flexShrink: 0,
1554
- variant: "ghost",
1555
- onClick: () => t("more"),
1556
- children: /* @__PURE__ */ e(nt, {})
1557
- }
1558
- ),
1559
- /* @__PURE__ */ e(
1560
- k,
1561
- {
1562
- "aria-label": "right",
1563
- size: "lg",
1564
- flexShrink: 0,
1565
- variant: "ghost",
1566
- onClick: a,
1567
- children: i ? /* @__PURE__ */ e(qn, {}) : /* @__PURE__ */ e(jn, {})
1568
- }
1569
- )
1570
- ] })
1571
- ]
1572
- }
1573
- );
1555
+ }, e[5] = r, e[6] = c) : c = e[6];
1556
+ let f;
1557
+ return e[7] !== t || e[8] !== c ? (f = /* @__PURE__ */ a(he, { display: "contents", css: o, children: /* @__PURE__ */ a($l, { keyboard: !1, style: n, css: l, styles: c, ...t }) }), e[7] = t, e[8] = c, e[9] = f) : f = e[9], f;
1558
+ }), Tl = () => {
1559
+ const t = y(10), o = Ge()?.isUsingSpread, {
1560
+ beginPageIndex: n,
1561
+ totalApproximatePages: l
1562
+ } = Ot(), i = l === void 0 ? 0 : l, s = o ? Math.floor((n || 0) / 2) : n;
1563
+ let r;
1564
+ t[0] !== s ? (r = () => Ve({
1565
+ default: s || 0
1566
+ }), t[0] = s, t[1] = r) : r = t[1];
1567
+ const [c, f] = On(r), u = Math.max(0, o ? Math.floor((i - 1) / 2) : i - 1);
1568
+ let d, h;
1569
+ t[2] !== s || t[3] !== f ? (d = () => {
1570
+ f.update(s || 0);
1571
+ }, h = [s, f], t[2] = s, t[3] = f, t[4] = d, t[5] = h) : (d = t[4], h = t[5]), ce(d, h);
1572
+ let m;
1573
+ return t[6] !== u || t[7] !== c || t[8] !== f ? (m = {
1574
+ value: c,
1575
+ valueSignal: f,
1576
+ min: 0,
1577
+ max: u
1578
+ }, t[6] = u, t[7] = c, t[8] = f, t[9] = m) : m = t[9], m;
1579
+ }, zl = (t) => {
1580
+ const e = y(24), o = U(), n = Ge(), {
1581
+ data: l
1582
+ } = j(() => o?.context, [o]) ?? {};
1583
+ let i;
1584
+ e[0] !== l ? (i = l === void 0 ? {} : l, e[0] = l, e[1] = i) : i = e[1];
1585
+ const {
1586
+ manifest: s
1587
+ } = i, r = s?.readingDirection === "rtl", c = n?.isUsingSpread, {
1588
+ totalApproximatePages: f,
1589
+ isBeginWithinChapter: u
1590
+ } = Ot(), d = f === void 0 ? 0 : f, h = u, {
1591
+ value: m,
1592
+ valueSignal: g,
1593
+ min: p,
1594
+ max: b
1595
+ } = Tl();
1596
+ let S;
1597
+ e[2] !== h || e[3] !== c || e[4] !== o || e[5] !== g ? (S = (O) => {
1598
+ const [z] = Array.isArray(O) ? O : [O], E = z === void 0 ? 0 : z;
1599
+ g.update(E);
1600
+ const T = c ? Math.floor(E) * 2 : Math.floor(E);
1601
+ h ? o?.navigation.goToPageOfSpineItem({
1602
+ pageIndex: T,
1603
+ spineItemId: o.pagination.state.beginSpineItemIndex ?? 0,
1604
+ animation: !1
1605
+ }) : o?.navigation.goToAbsolutePageIndex({
1606
+ absolutePageIndex: T,
1607
+ animation: !1
1608
+ });
1609
+ }, e[2] = h, e[3] = c, e[4] = o, e[5] = g, e[6] = S) : S = e[6];
1610
+ const _ = S;
1611
+ let v;
1612
+ e[7] !== o?.navigation || e[8] !== g.subject ? (v = () => o?.navigation.throttleLock({
1613
+ duration: 100,
1614
+ trigger: g.subject
1615
+ }), e[7] = o?.navigation, e[8] = g.subject, e[9] = v) : v = e[9];
1616
+ let C;
1617
+ if (e[10] !== o || e[11] !== g ? (C = [o, g], e[10] = o, e[11] = g, e[12] = C) : C = e[12], pe(v, C), d === 1 || c && d === 2) {
1618
+ let O;
1619
+ return e[13] !== t.style ? (O = /* @__PURE__ */ a(he, { style: t.style }), e[13] = t.style, e[14] = O) : O = e[14], O;
1574
1620
  }
1575
- ), Me = () => {
1621
+ let k;
1622
+ e[15] !== m ? (k = [m], e[15] = m, e[16] = k) : k = e[16];
1623
+ let $;
1624
+ return e[17] !== b || e[18] !== p || e[19] !== _ || e[20] !== t || e[21] !== r || e[22] !== k ? ($ = /* @__PURE__ */ a(Ol, { value: k, max: b, min: p, reverse: r, step: 1, onChange: _, ...t }), e[17] = b, e[18] = p, e[19] = _, e[20] = t, e[21] = r, e[22] = k, e[23] = $) : $ = e[23], $;
1625
+ }, Rl = w((t) => {
1626
+ const e = y(106), {
1627
+ open: o,
1628
+ onItemClick: n
1629
+ } = t, l = dn(null), i = U();
1630
+ let s;
1631
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = ["quickMenuBottomBarBoundingBoxSignal", "onFontSizeMenuOpenChange", "onRefitMenuOpenChange"], e[0] = s) : s = e[0];
1632
+ const {
1633
+ quickMenuBottomBarBoundingBoxSignal: r,
1634
+ onFontSizeMenuOpenChange: c,
1635
+ onRefitMenuOpenChange: f
1636
+ } = oe(s);
1637
+ let u;
1638
+ e[1] !== i?.navigation.state$ ? (u = () => i?.navigation.state$, e[1] = i?.navigation.state$, e[2] = u) : u = e[2];
1639
+ let d;
1640
+ e[3] !== i ? (d = [i], e[3] = i, e[4] = d) : d = e[4];
1641
+ const {
1642
+ data: h
1643
+ } = j(u, d);
1644
+ let m;
1645
+ e[5] !== i?.settings.values$ ? (m = () => i?.settings.values$, e[5] = i?.settings.values$, e[6] = m) : m = e[6];
1646
+ let g;
1647
+ e[7] !== i ? (g = [i], e[7] = i, e[8] = g) : g = e[8];
1576
1648
  const {
1577
- quickMenuOpen: n,
1578
- onQuickMenuOpenChange: t,
1579
- _quickMenuOpen: o,
1580
- _onQuickMenuOpenChange: r
1581
- } = y([
1582
- "quickMenuOpen",
1583
- "onQuickMenuOpenChange",
1584
- "_quickMenuOpen",
1585
- "_onQuickMenuOpenChange"
1586
- ]);
1587
- return [
1588
- n ?? o,
1589
- t ?? r
1590
- ];
1591
- }, no = g(
1592
- ({
1649
+ data: p
1650
+ } = j(m, g);
1651
+ let b;
1652
+ e[9] !== i?.zoom.state$ ? (b = () => i?.zoom.state$.pipe(ne(wl)), e[9] = i?.zoom.state$, e[10] = b) : b = e[10];
1653
+ let S;
1654
+ e[11] !== i ? (S = [i], e[11] = i, e[12] = S) : S = e[12];
1655
+ const {
1656
+ data: _
1657
+ } = j(b, S), v = _ === "in", C = _ === "out", I = p?.computedPageTurnMode === "scrollable", k = p?.computedPageTurnDirection === "vertical", [$, O] = le(!0);
1658
+ let z, E;
1659
+ e[13] !== r ? (z = () => {
1660
+ if (!l.current)
1661
+ return;
1662
+ const st = new ResizeObserver((ht) => {
1663
+ for (const Jt of ht)
1664
+ r.update(Jt);
1665
+ });
1666
+ return st.observe(l.current), () => {
1667
+ st.disconnect();
1668
+ };
1669
+ }, E = [r], e[13] = r, e[14] = z, e[15] = E) : (z = e[14], E = e[15]), ce(z, E);
1670
+ let T;
1671
+ e[16] !== i?.navigation ? (T = () => i?.navigation.goToLeftOrTopSpineItem(), e[16] = i?.navigation, e[17] = T) : T = e[17];
1672
+ const N = !h?.canGoLeftSpineItem && !h?.canGoTopSpineItem;
1673
+ let M;
1674
+ e[18] !== k ? (M = k ? /* @__PURE__ */ a(Qn, {}) : /* @__PURE__ */ a(Yn, {}), e[18] = k, e[19] = M) : M = e[19];
1675
+ let H;
1676
+ e[20] !== T || e[21] !== N || e[22] !== M ? (H = /* @__PURE__ */ a(ee, { "aria-label": "left", size: "lg", variant: "ghost", flexShrink: 0, onClick: T, disabled: N, children: M }), e[20] = T, e[21] = N, e[22] = M, e[23] = H) : H = e[23];
1677
+ let Q;
1678
+ e[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Q = /* @__PURE__ */ a(Il, {}), e[24] = Q) : Q = e[24];
1679
+ let K;
1680
+ e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ x(J, { flex: 1, maxW: 400, gap: 2, alignItems: "center", overflow: "auto", px: 4, children: [
1681
+ Q,
1682
+ /* @__PURE__ */ a(zl, { style: {
1683
+ width: "100%",
1684
+ maxWidth: "300px",
1685
+ height: "35px"
1686
+ } })
1687
+ ] }), e[25] = K) : K = e[25];
1688
+ const V = !h?.canGoRightSpineItem && !h?.canGoBottomSpineItem;
1689
+ let W;
1690
+ e[26] !== i?.navigation ? (W = () => {
1691
+ i?.navigation.goToRightOrBottomSpineItem();
1692
+ }, e[26] = i?.navigation, e[27] = W) : W = e[27];
1693
+ let G;
1694
+ e[28] !== k ? (G = k ? /* @__PURE__ */ a(Zn, {}) : /* @__PURE__ */ a(Kn, {}), e[28] = k, e[29] = G) : G = e[29];
1695
+ let F;
1696
+ e[30] !== V || e[31] !== W || e[32] !== G ? (F = /* @__PURE__ */ a(ee, { "aria-label": "right", size: "lg", flexShrink: 0, variant: "ghost", disabled: V, onClick: W, children: G }), e[30] = V, e[31] = W, e[32] = G, e[33] = F) : F = e[33];
1697
+ let P;
1698
+ e[34] !== H || e[35] !== F ? (P = /* @__PURE__ */ x(ge, { flex: 1, alignItems: "center", justifyContent: "center", maxWidth: "100%", px: 4, children: [
1699
+ H,
1700
+ K,
1701
+ F
1702
+ ] }), e[34] = H, e[35] = F, e[36] = P) : P = e[36];
1703
+ let Y;
1704
+ e[37] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Y = (st) => {
1705
+ const {
1706
+ open: ht
1707
+ } = st;
1708
+ O(ht);
1709
+ }, e[37] = Y) : Y = e[37];
1710
+ const Z = $ ? "rotate(0deg)" : "rotate(180deg)";
1711
+ let A;
1712
+ e[38] !== Z ? (A = /* @__PURE__ */ a(gt.Trigger, { paddingY: "3", width: "100%", display: "flex", justifyContent: "center", children: /* @__PURE__ */ a(Sn, { style: {
1713
+ transform: Z
1714
+ } }) }), e[38] = Z, e[39] = A) : A = e[39];
1715
+ let L;
1716
+ e[40] !== n ? (L = () => n("help"), e[40] = n, e[41] = L) : L = e[41];
1717
+ let X;
1718
+ e[42] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (X = /* @__PURE__ */ a(_n, {}), e[42] = X) : X = e[42];
1719
+ let B;
1720
+ e[43] !== L ? (B = /* @__PURE__ */ a(ee, { "aria-label": "Help", size: "lg", variant: "ghost", onClick: L, children: X }), e[43] = L, e[44] = B) : B = e[44];
1721
+ let D;
1722
+ e[45] !== n ? (D = () => n("toc"), e[45] = n, e[46] = D) : D = e[46];
1723
+ let de;
1724
+ e[47] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (de = /* @__PURE__ */ a(vn, {}), e[47] = de) : de = e[47];
1725
+ let R;
1726
+ e[48] !== D ? (R = /* @__PURE__ */ a(ee, { "aria-label": "Table of contents", size: "lg", variant: "ghost", onClick: D, children: de }), e[48] = D, e[49] = R) : R = e[49];
1727
+ let te;
1728
+ e[50] !== n || e[51] !== i ? (te = jt(i) && /* @__PURE__ */ a(ee, { "aria-label": "Search", size: "lg", variant: "ghost", onClick: () => n("search"), children: /* @__PURE__ */ a(Cn, {}) }), e[50] = n, e[51] = i, e[52] = te) : te = e[52];
1729
+ const qe = v ? "solid" : "ghost";
1730
+ let Oe;
1731
+ e[53] !== v || e[54] !== i?.zoom ? (Oe = () => {
1732
+ v ? i?.zoom.exit({
1733
+ animate: !0
1734
+ }) : i?.zoom.enter({
1735
+ animate: !0,
1736
+ scale: 2
1737
+ });
1738
+ }, e[53] = v, e[54] = i?.zoom, e[55] = Oe) : Oe = e[55];
1739
+ let Te;
1740
+ e[56] !== v ? (Te = v ? /* @__PURE__ */ a(xn, {}) : /* @__PURE__ */ a(yn, {}), e[56] = v, e[57] = Te) : Te = e[57];
1741
+ let ze;
1742
+ e[58] !== qe || e[59] !== Oe || e[60] !== Te ? (ze = /* @__PURE__ */ a(ee, { "aria-label": "Zoom", size: "lg", variant: qe, onClick: Oe, children: Te }), e[58] = qe, e[59] = Oe, e[60] = Te, e[61] = ze) : ze = e[61];
1743
+ let Re;
1744
+ e[62] !== c ? (Re = () => {
1745
+ c(!0);
1746
+ }, e[62] = c, e[63] = Re) : Re = e[63];
1747
+ let ot;
1748
+ e[64] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ot = /* @__PURE__ */ a(Vn, {}), e[64] = ot) : ot = e[64];
1749
+ let we;
1750
+ e[65] !== Re ? (we = /* @__PURE__ */ a(ee, { "aria-label": "font size", size: "lg", onClick: Re, variant: "ghost", children: ot }), e[65] = Re, e[66] = we) : we = e[66];
1751
+ let Me;
1752
+ e[67] !== n || e[68] !== i ? (Me = Je(i) && /* @__PURE__ */ a(ee, { "aria-label": "Bookmarks", size: "lg", variant: "ghost", onClick: () => n("bookmarks"), children: /* @__PURE__ */ a(Wn, {}) }), e[67] = n, e[68] = i, e[69] = Me) : Me = e[69];
1753
+ let Pe;
1754
+ e[70] !== n || e[71] !== i ? (Pe = Je(i) && /* @__PURE__ */ a(ee, { "aria-label": "Annotations", size: "lg", variant: "ghost", onClick: () => n("annotations"), children: /* @__PURE__ */ a(Ke, {}) }), e[70] = n, e[71] = i, e[72] = Pe) : Pe = e[72];
1755
+ let Ae;
1756
+ e[73] !== I || e[74] !== f || e[75] !== i ? (Ae = Qt(i) && /* @__PURE__ */ a(ee, { "aria-label": "Refit", size: "lg", variant: "ghost", onClick: () => {
1757
+ f(!0);
1758
+ }, disabled: !I, children: /* @__PURE__ */ a(Gn, {}) }), e[73] = I, e[74] = f, e[75] = i, e[76] = Ae) : Ae = e[76];
1759
+ const ut = C ? "solid" : "ghost";
1760
+ let Ee;
1761
+ e[77] !== C || e[78] !== i?.zoom ? (Ee = () => {
1762
+ C ? i?.zoom.exit({
1763
+ animate: !0
1764
+ }) : i?.zoom.enter({
1765
+ animate: !0,
1766
+ scale: 0.5
1767
+ });
1768
+ }, e[77] = C, e[78] = i?.zoom, e[79] = Ee) : Ee = e[79];
1769
+ let lt;
1770
+ e[80] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (lt = /* @__PURE__ */ a(kn, {}), e[80] = lt) : lt = e[80];
1771
+ let Be;
1772
+ e[81] !== ut || e[82] !== Ee ? (Be = /* @__PURE__ */ a(ee, { "aria-label": "Thumbnails", size: "lg", variant: ut, onClick: Ee, children: lt }), e[81] = ut, e[82] = Ee, e[83] = Be) : Be = e[83];
1773
+ let De;
1774
+ e[84] !== n || e[85] !== i ? (De = Ut(i) && /* @__PURE__ */ a(ee, { "aria-label": "Gallery", size: "lg", variant: "ghost", onClick: () => n("gallery"), children: /* @__PURE__ */ a(Un, {}) }), e[84] = n, e[85] = i, e[86] = De) : De = e[86];
1775
+ let Fe;
1776
+ e[87] !== B || e[88] !== R || e[89] !== te || e[90] !== ze || e[91] !== we || e[92] !== Me || e[93] !== Pe || e[94] !== Ae || e[95] !== Be || e[96] !== De ? (Fe = /* @__PURE__ */ a(gt.Content, { display: "flex", justifyContent: "center", children: /* @__PURE__ */ x(he, { display: "flex", overflowX: "auto", px: 4, pb: 1, children: [
1777
+ B,
1778
+ R,
1779
+ te,
1780
+ ze,
1781
+ we,
1782
+ Me,
1783
+ Pe,
1784
+ Ae,
1785
+ Be,
1786
+ De
1787
+ ] }) }), e[87] = B, e[88] = R, e[89] = te, e[90] = ze, e[91] = we, e[92] = Me, e[93] = Pe, e[94] = Ae, e[95] = Be, e[96] = De, e[97] = Fe) : Fe = e[97];
1788
+ let Le;
1789
+ e[98] !== $ || e[99] !== A || e[100] !== Fe ? (Le = /* @__PURE__ */ a(ge, { alignSelf: "stretch", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ x(gt.Root, { open: $, flex: 1, onOpenChange: Y, width: "100%", children: [
1790
+ A,
1791
+ Fe
1792
+ ] }) }), e[98] = $, e[99] = A, e[100] = Fe, e[101] = Le) : Le = e[101];
1793
+ let it;
1794
+ return e[102] !== o || e[103] !== P || e[104] !== Le ? (it = /* @__PURE__ */ x(Xt, { present: o, position: "bottom", display: "flex", flexDirection: "column", overflow: "auto", pb: 8, px: 0, ref: l, children: [
1795
+ P,
1796
+ Le
1797
+ ] }), e[102] = o, e[103] = P, e[104] = Le, e[105] = it) : it = e[105], it;
1798
+ });
1799
+ function wl(t) {
1800
+ return t.currentScale > 1 ? "in" : t.currentScale < 1 ? "out" : void 0;
1801
+ }
1802
+ const Ml = () => {
1803
+ const t = y(5), [e, o] = le(!1);
1804
+ let n;
1805
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = () => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
1806
+ o(!1);
1807
+ }) : document.documentElement.requestFullscreen({
1808
+ navigationUI: "hide"
1809
+ }).catch(console.error).then(() => {
1810
+ o(!0);
1811
+ }), t[0] = n) : n = t[0];
1812
+ const l = n;
1813
+ let i, s;
1814
+ t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = () => {
1815
+ const c = function() {
1816
+ o(!!document.fullscreenElement);
1817
+ };
1818
+ return document.addEventListener("fullscreenchange", c), () => {
1819
+ document.removeEventListener("fullscreenchange", c);
1820
+ };
1821
+ }, s = [], t[1] = i, t[2] = s) : (i = t[1], s = t[2]), ce(i, s);
1822
+ let r;
1823
+ return t[3] !== e ? (r = {
1824
+ isFullscreen: e,
1825
+ onToggleFullscreenClick: l
1826
+ }, t[3] = e, t[4] = r) : r = t[4], r;
1827
+ }, Pl = w((t) => {
1828
+ const e = y(29), {
1829
+ open: o,
1593
1830
  onItemClick: n
1594
- }) => {
1595
- const [t] = Me(), { refitMenuOpen: o, fontSizeMenuOpen: r } = y([
1596
- "refitMenuOpen",
1597
- "fontSizeMenuOpen"
1598
- ]);
1599
- return /* @__PURE__ */ s(de, { children: [
1600
- /* @__PURE__ */ e(
1601
- eo,
1602
- {
1603
- open: t && !o && !r,
1604
- onItemClick: n
1605
- }
1606
- ),
1607
- /* @__PURE__ */ e(
1608
- Kt,
1609
- {
1610
- open: t && !o && !r,
1611
- onItemClick: n
1612
- }
1613
- )
1614
- ] });
1615
- }
1616
- ), to = () => {
1617
- const [n, t] = Me(), o = m();
1618
- H(() => o?.gestures.gestures$.pipe(
1619
- se((r) => r.type === "tap" && !r.handled),
1620
- ke(
1621
- o.selection.selection$,
1622
- o.selection.lastSelectionOnPointerdown$
1623
- ),
1624
- $e(([, r, i]) => {
1625
- t(r || i ? !1 : (a) => !a);
1626
- })
1627
- ), [o]);
1628
- }, oo = A.forwardRef(
1629
- function(t, o) {
1630
- const { label: r, children: i, helperText: a, errorText: l, optionalText: c, ...d } = t;
1631
- return /* @__PURE__ */ s(oe.Root, { ref: o, ...d, children: [
1632
- r && /* @__PURE__ */ s(oe.Label, { children: [
1633
- r,
1634
- /* @__PURE__ */ e(oe.RequiredIndicator, { fallback: c })
1635
- ] }),
1636
- i,
1637
- a && /* @__PURE__ */ e(oe.HelperText, { children: a }),
1638
- l && /* @__PURE__ */ e(oe.ErrorText, { children: l })
1639
- ] });
1640
- }
1641
- ), ro = g(() => {
1642
- const { refitMenuOpen: t, onRefitMenuOpenChange: o } = y([
1643
- "refitMenuOpen",
1644
- "onRefitMenuOpenChange"
1645
- ]), r = m(), i = Qe(r) ? r : void 0, a = S(
1646
- () => i?.refit.settings$,
1647
- [i]
1648
- );
1649
- return /* @__PURE__ */ e(
1650
- j,
1651
- {
1652
- lazyMount: !0,
1653
- open: t,
1654
- onOpenChange: (l) => o(l.open),
1655
- placement: "center",
1656
- children: /* @__PURE__ */ s(G, { children: [
1657
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(Z, { children: "Viewport fit" }) }),
1658
- /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ s(N.Root, { children: [
1659
- /* @__PURE__ */ e(N.HelperText, { children: "Adjust the viewport for a more comfortable reading experience." }),
1660
- /* @__PURE__ */ s(N.Content, { children: [
1661
- /* @__PURE__ */ e(oo, { label: "Profile", children: /* @__PURE__ */ e(
1662
- Xe,
1663
- {
1664
- defaultValue: "fit",
1665
- onValueChange: (l) => {
1666
- const c = l.value;
1667
- i?.refit.update({
1668
- viewportFit: c,
1669
- customWidth: 60
1670
- });
1671
- },
1672
- value: a?.viewportFit ?? "fit",
1673
- children: /* @__PURE__ */ s(O, { gap: 2, children: [
1674
- /* @__PURE__ */ e(ae, { value: "desktop", children: "Desktop" }),
1675
- /* @__PURE__ */ e(ae, { value: "tablet", children: "Tablet" }),
1676
- /* @__PURE__ */ e(ae, { value: "fit", children: "Full width (default)" }),
1677
- /* @__PURE__ */ e(ae, { value: "custom", children: "Custom" })
1678
- ] })
1679
- }
1680
- ) }),
1681
- /* @__PURE__ */ e(
1682
- Re,
1683
- {
1684
- label: "Maximum width (%)",
1685
- showValue: !0,
1686
- max: 100,
1687
- min: 10,
1688
- step: 1,
1689
- disabled: a?.viewportFit !== "custom",
1690
- value: [a?.customWidth ?? 60],
1691
- onValueChange: (l) => {
1692
- const c = l.value[0] ?? 0;
1693
- i?.refit.update({
1694
- customWidth: c
1695
- });
1696
- }
1697
- }
1698
- )
1699
- ] })
1700
- ] }) }),
1701
- /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(X, { asChild: !0, children: /* @__PURE__ */ e(W, { variant: "outline", children: "Close" }) }) }),
1702
- /* @__PURE__ */ e(q, {})
1703
- ] })
1704
- }
1705
- );
1706
- }), io = g(
1707
- ({
1708
- contextText: n = "",
1709
- startOffset: t = 0,
1710
- text: o,
1711
- cfi: r = "#",
1712
- onClick: i,
1713
- absolutePageIndex: a
1714
- }) => {
1715
- const c = n.substring(
1716
- Math.max(t - 15, 0),
1717
- Math.max(t, 0)
1718
- ), d = n.substring(
1719
- Math.min(t + o.length, n.length - 1),
1720
- Math.min(
1721
- t + o.length + 15,
1722
- n.length - 1
1723
- )
1724
- );
1725
- return /* @__PURE__ */ s(
1726
- xe,
1727
- {
1728
- href: r,
1729
- style: { margin: 5, overflow: "hidden" },
1730
- onClick: (u) => {
1731
- u.preventDefault(), i(r);
1732
- },
1733
- display: "flex",
1734
- flexDirection: "column",
1735
- alignItems: "flex-start",
1736
- gap: 0,
1737
- children: [
1738
- /* @__PURE__ */ s(b, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
1739
- '"',
1740
- c,
1741
- /* @__PURE__ */ e("b", { children: o }),
1742
- d,
1743
- '"'
1744
- ] }),
1745
- /* @__PURE__ */ e(b, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${a !== void 0 ? a + 1 : "unknown (not loaded)"}` })
1746
- ]
1747
- }
1748
- );
1749
- }
1750
- ), ao = 500, lo = () => {
1751
- const n = he(() => new Bn("")), t = S(n), o = m(), r = je(o) ? o : void 0, i = S(() => n.pipe(
1752
- De(),
1753
- V(
1754
- (a) => a === "" || !r ? ge(void 0) : Ve(
1755
- ge({
1756
- type: "start",
1757
- data: void 0
1758
- }),
1759
- We(ao).pipe(
1760
- V(() => r.search.search(a)),
1761
- E((l) => ({ type: "end", data: l }))
1762
- )
1763
- )
1764
- )
1765
- ), [r, n]);
1831
+ } = t, l = U();
1832
+ let i;
1833
+ e[0] !== l?.context.manifest$ ? (i = () => l?.context.manifest$, e[0] = l?.context.manifest$, e[1] = i) : i = e[1];
1834
+ let s;
1835
+ e[2] !== l ? (s = [l], e[2] = l, e[3] = s) : s = e[3];
1836
+ const {
1837
+ data: r
1838
+ } = j(i, s), {
1839
+ isFullscreen: c,
1840
+ onToggleFullscreenClick: f
1841
+ } = Ml();
1842
+ let u;
1843
+ e[4] !== n ? (u = () => n("back"), e[4] = n, e[5] = u) : u = e[5];
1844
+ let d;
1845
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ a(eo, {}), e[6] = d) : d = e[6];
1846
+ let h;
1847
+ e[7] !== u ? (h = /* @__PURE__ */ a(ee, { "aria-label": "left", size: "lg", variant: "ghost", flexShrink: 0, onClick: u, children: d }), e[7] = u, e[8] = h) : h = e[8];
1848
+ const m = r?.title;
1849
+ let g;
1850
+ e[9] !== m ? (g = /* @__PURE__ */ a(J, { flex: 1, maxW: 600, gap: 1, alignItems: "center", overflow: "auto", px: 4, children: /* @__PURE__ */ a(q, { truncate: !0, maxWidth: "100%", children: m }) }), e[9] = m, e[10] = g) : g = e[10];
1851
+ let p;
1852
+ e[11] !== n ? (p = () => n("more"), e[11] = n, e[12] = p) : p = e[12];
1853
+ let b;
1854
+ e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ a(to, {}), e[13] = b) : b = e[13];
1855
+ let S;
1856
+ e[14] !== p ? (S = /* @__PURE__ */ a(ee, { "aria-label": "right", size: "lg", flexShrink: 0, variant: "ghost", onClick: p, children: b }), e[14] = p, e[15] = S) : S = e[15];
1857
+ let _;
1858
+ e[16] !== c ? (_ = c ? /* @__PURE__ */ a(qn, {}) : /* @__PURE__ */ a(jn, {}), e[16] = c, e[17] = _) : _ = e[17];
1859
+ let v;
1860
+ e[18] !== f || e[19] !== _ ? (v = /* @__PURE__ */ a(ee, { "aria-label": "right", size: "lg", flexShrink: 0, variant: "ghost", onClick: f, children: _ }), e[18] = f, e[19] = _, e[20] = v) : v = e[20];
1861
+ let C;
1862
+ e[21] !== S || e[22] !== v ? (C = /* @__PURE__ */ x(ge, { children: [
1863
+ S,
1864
+ v
1865
+ ] }), e[21] = S, e[22] = v, e[23] = C) : C = e[23];
1866
+ let I;
1867
+ return e[24] !== o || e[25] !== C || e[26] !== h || e[27] !== g ? (I = /* @__PURE__ */ x(Xt, { present: o, position: "top", height: "80px", justifyContent: "space-between", children: [
1868
+ h,
1869
+ g,
1870
+ C
1871
+ ] }), e[24] = o, e[25] = C, e[26] = h, e[27] = g, e[28] = I) : I = e[28], I;
1872
+ }), Tt = () => {
1873
+ const t = y(4);
1874
+ let e;
1875
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = ["quickMenuOpen", "onQuickMenuOpenChange", "_quickMenuOpen", "_onQuickMenuOpenChange"], t[0] = e) : e = t[0];
1876
+ const {
1877
+ quickMenuOpen: o,
1878
+ onQuickMenuOpenChange: n,
1879
+ _quickMenuOpen: l,
1880
+ _onQuickMenuOpenChange: i
1881
+ } = oe(e), s = o ?? l, r = n ?? i;
1882
+ let c;
1883
+ return t[1] !== s || t[2] !== r ? (c = [s, r], t[1] = s, t[2] = r, t[3] = c) : c = t[3], c;
1884
+ }, Al = w((t) => {
1885
+ const e = y(10), {
1886
+ onItemClick: o
1887
+ } = t, [n] = Tt();
1888
+ let l;
1889
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = ["refitMenuOpen", "fontSizeMenuOpen", "selectedHighlight"], e[0] = l) : l = e[0];
1890
+ const {
1891
+ refitMenuOpen: i,
1892
+ fontSizeMenuOpen: s,
1893
+ selectedHighlight: r
1894
+ } = oe(l), c = n && !i && !s && !r;
1895
+ let f;
1896
+ e[1] !== o || e[2] !== c ? (f = /* @__PURE__ */ a(Pl, { open: c, onItemClick: o }), e[1] = o, e[2] = c, e[3] = f) : f = e[3];
1897
+ const u = n && !i && !s;
1898
+ let d;
1899
+ e[4] !== o || e[5] !== u ? (d = /* @__PURE__ */ a(Rl, { open: u, onItemClick: o }), e[4] = o, e[5] = u, e[6] = d) : d = e[6];
1900
+ let h;
1901
+ return e[7] !== f || e[8] !== d ? (h = /* @__PURE__ */ x(et, { children: [
1902
+ f,
1903
+ d
1904
+ ] }), e[7] = f, e[8] = d, e[9] = h) : h = e[9], h;
1905
+ }), El = () => {
1906
+ const t = y(5), [, e] = Tt(), o = U();
1907
+ let n;
1908
+ t[0] !== e || t[1] !== o ? (n = () => o?.gestures.gestures$.pipe(Xe(Bl), yt(o.selection.selection$, o.selection.lastSelectionOnPointerdown$), xt((i) => {
1909
+ const [, s, r] = i;
1910
+ e(s || r ? !1 : Dl);
1911
+ })), t[0] = e, t[1] = o, t[2] = n) : n = t[2];
1912
+ let l;
1913
+ t[3] !== o ? (l = [o], t[3] = o, t[4] = l) : l = t[4], pe(n, l);
1914
+ };
1915
+ function Bl(t) {
1916
+ return t.type === "tap" && !t.handled;
1917
+ }
1918
+ function Dl(t) {
1919
+ return !t;
1920
+ }
1921
+ const Fl = se.forwardRef(function(e, o) {
1922
+ const n = y(21);
1923
+ let l, i, s, r, c, f;
1924
+ n[0] !== e ? ({
1925
+ label: r,
1926
+ children: l,
1927
+ helperText: s,
1928
+ errorText: i,
1929
+ optionalText: c,
1930
+ ...f
1931
+ } = e, n[0] = e, n[1] = l, n[2] = i, n[3] = s, n[4] = r, n[5] = c, n[6] = f) : (l = n[1], i = n[2], s = n[3], r = n[4], c = n[5], f = n[6]);
1932
+ let u;
1933
+ n[7] !== r || n[8] !== c ? (u = r && /* @__PURE__ */ x(je.Label, { children: [
1934
+ r,
1935
+ /* @__PURE__ */ a(je.RequiredIndicator, { fallback: c })
1936
+ ] }), n[7] = r, n[8] = c, n[9] = u) : u = n[9];
1937
+ let d;
1938
+ n[10] !== s ? (d = s && /* @__PURE__ */ a(je.HelperText, { children: s }), n[10] = s, n[11] = d) : d = n[11];
1939
+ let h;
1940
+ n[12] !== i ? (h = i && /* @__PURE__ */ a(je.ErrorText, { children: i }), n[12] = i, n[13] = h) : h = n[13];
1941
+ let m;
1942
+ return n[14] !== l || n[15] !== o || n[16] !== f || n[17] !== u || n[18] !== d || n[19] !== h ? (m = /* @__PURE__ */ x(je.Root, { ref: o, ...f, children: [
1943
+ u,
1944
+ l,
1945
+ d,
1946
+ h
1947
+ ] }), n[14] = l, n[15] = o, n[16] = f, n[17] = u, n[18] = d, n[19] = h, n[20] = m) : m = n[20], m;
1948
+ }), Ll = w(() => {
1949
+ const t = y(39);
1950
+ let e;
1951
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = ["refitMenuOpen", "onRefitMenuOpenChange"], t[0] = e) : e = t[0];
1952
+ const {
1953
+ refitMenuOpen: o,
1954
+ onRefitMenuOpenChange: n
1955
+ } = oe(e), l = U();
1956
+ let i;
1957
+ t[1] !== l ? (i = Qt(l) ? l : void 0, t[1] = l, t[2] = i) : i = t[2];
1958
+ const s = i;
1959
+ let r;
1960
+ t[3] !== s?.refit.settings$ ? (r = () => s?.refit.settings$, t[3] = s?.refit.settings$, t[4] = r) : r = t[4];
1961
+ let c;
1962
+ t[5] !== s ? (c = [s], t[5] = s, t[6] = c) : c = t[6];
1963
+ const {
1964
+ data: f
1965
+ } = j(r, c);
1966
+ let u;
1967
+ t[7] !== n ? (u = (H) => n(H.open), t[7] = n, t[8] = u) : u = t[8];
1968
+ let d;
1969
+ t[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ a(ye, { children: /* @__PURE__ */ a(Ie, { children: "Viewport fit" }) }), t[9] = d) : d = t[9];
1970
+ let h;
1971
+ t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ a(Se.HelperText, { children: "Adjust the viewport for a more comfortable reading experience." }), t[10] = h) : h = t[10];
1972
+ let m;
1973
+ t[11] !== s?.refit ? (m = (H) => {
1974
+ const Q = H.value;
1975
+ s?.refit.update({
1976
+ viewportFit: Q,
1977
+ customWidth: 60
1978
+ });
1979
+ }, t[11] = s?.refit, t[12] = m) : m = t[12];
1980
+ const g = f?.viewportFit ?? "fit";
1981
+ let p;
1982
+ t[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ a(Ye, { value: "desktop", children: "Desktop" }), t[13] = p) : p = t[13];
1983
+ let b;
1984
+ t[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ a(Ye, { value: "tablet", children: "Tablet" }), t[14] = b) : b = t[14];
1985
+ let S;
1986
+ t[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ a(Ye, { value: "fit", children: "Full width (default)" }), t[15] = S) : S = t[15];
1987
+ let _;
1988
+ t[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ x(J, { gap: 2, children: [
1989
+ p,
1990
+ b,
1991
+ S,
1992
+ /* @__PURE__ */ a(Ye, { value: "custom", children: "Custom" })
1993
+ ] }), t[16] = _) : _ = t[16];
1994
+ let v;
1995
+ t[17] !== m || t[18] !== g ? (v = /* @__PURE__ */ a(Fl, { label: "Profile", children: /* @__PURE__ */ a(Kt, { defaultValue: "fit", onValueChange: m, value: g, children: _ }) }), t[17] = m, t[18] = g, t[19] = v) : v = t[19];
1996
+ const C = f?.viewportFit !== "custom", I = f?.customWidth ?? 60;
1997
+ let k;
1998
+ t[20] !== I ? (k = [I], t[20] = I, t[21] = k) : k = t[21];
1999
+ let $;
2000
+ t[22] !== s?.refit ? ($ = (H) => {
2001
+ const Q = H.value[0] ?? 0;
2002
+ s?.refit.update({
2003
+ customWidth: Q
2004
+ });
2005
+ }, t[22] = s?.refit, t[23] = $) : $ = t[23];
2006
+ let O;
2007
+ t[24] !== C || t[25] !== k || t[26] !== $ ? (O = /* @__PURE__ */ a(It, { label: "Maximum width (%)", showValue: !0, max: 100, min: 10, step: 1, disabled: C, value: k, onValueChange: $ }), t[24] = C, t[25] = k, t[26] = $, t[27] = O) : O = t[27];
2008
+ let z;
2009
+ t[28] !== v || t[29] !== O ? (z = /* @__PURE__ */ a(ke, { children: /* @__PURE__ */ x(Se.Root, { children: [
2010
+ h,
2011
+ /* @__PURE__ */ x(Se.Content, { children: [
2012
+ v,
2013
+ O
2014
+ ] })
2015
+ ] }) }), t[28] = v, t[29] = O, t[30] = z) : z = t[30];
2016
+ let E, T;
2017
+ t[31] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ a(xe, { children: /* @__PURE__ */ a($e, { asChild: !0, children: /* @__PURE__ */ a(re, { variant: "outline", children: "Close" }) }) }), T = /* @__PURE__ */ a(ve, {}), t[31] = E, t[32] = T) : (E = t[31], T = t[32]);
2018
+ let N;
2019
+ t[33] !== z ? (N = /* @__PURE__ */ x(_e, { children: [
2020
+ d,
2021
+ z,
2022
+ E,
2023
+ T
2024
+ ] }), t[33] = z, t[34] = N) : N = t[34];
2025
+ let M;
2026
+ return t[35] !== o || t[36] !== N || t[37] !== u ? (M = /* @__PURE__ */ a(Ce, { lazyMount: !0, open: o, onOpenChange: u, placement: "center", children: N }), t[35] = o, t[36] = N, t[37] = u, t[38] = M) : M = t[38], M;
2027
+ }), Nl = w((t) => {
2028
+ const e = y(26), {
2029
+ contextText: o,
2030
+ startOffset: n,
2031
+ text: l,
2032
+ cfi: i,
2033
+ onClick: s,
2034
+ absolutePageIndex: r
2035
+ } = t, c = o === void 0 ? "" : o, f = n === void 0 ? 0 : n, u = i === void 0 ? "#" : i;
2036
+ let d;
2037
+ e[0] !== c || e[1] !== f ? (d = c.substring(Math.max(f - 15, 0), Math.max(f, 0)), e[0] = c, e[1] = f, e[2] = d) : d = e[2];
2038
+ const h = d;
2039
+ let m;
2040
+ e[3] !== c || e[4] !== f || e[5] !== l.length ? (m = c.substring(Math.min(f + l.length, c.length - 1), Math.min(f + l.length + 15, c.length - 1)), e[3] = c, e[4] = f, e[5] = l.length, e[6] = m) : m = e[6];
2041
+ const g = m;
2042
+ let p;
2043
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = {
2044
+ margin: 5,
2045
+ overflow: "hidden"
2046
+ }, e[7] = p) : p = e[7];
2047
+ let b;
2048
+ e[8] !== u || e[9] !== s ? (b = (O) => {
2049
+ O.preventDefault(), s(u);
2050
+ }, e[8] = u, e[9] = s, e[10] = b) : b = e[10];
2051
+ let S;
2052
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = {
2053
+ display: "block"
2054
+ }, e[11] = S) : S = e[11];
2055
+ let _;
2056
+ e[12] !== l ? (_ = /* @__PURE__ */ a("b", { children: l }), e[12] = l, e[13] = _) : _ = e[13];
2057
+ let v;
2058
+ e[14] !== g || e[15] !== h || e[16] !== _ ? (v = /* @__PURE__ */ x(q, { lineClamp: 1, as: "cite", style: S, children: [
2059
+ '"',
2060
+ h,
2061
+ _,
2062
+ g,
2063
+ '"'
2064
+ ] }), e[14] = g, e[15] = h, e[16] = _, e[17] = v) : v = e[17];
2065
+ let C;
2066
+ e[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (C = {
2067
+ textDecoration: "none"
2068
+ }, e[18] = C) : C = e[18];
2069
+ const I = `Book page: ${r !== void 0 ? r + 1 : "unknown (not loaded)"}`;
2070
+ let k;
2071
+ e[19] !== I ? (k = /* @__PURE__ */ a(q, { fontSize: "sm", color: "gray.500", style: C, children: I }), e[19] = I, e[20] = k) : k = e[20];
2072
+ let $;
2073
+ return e[21] !== u || e[22] !== v || e[23] !== k || e[24] !== b ? ($ = /* @__PURE__ */ x(Ct, { href: u, style: p, onClick: b, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 0, children: [
2074
+ v,
2075
+ k
2076
+ ] }), e[21] = u, e[22] = v, e[23] = k, e[24] = b, e[25] = $) : $ = e[25], $;
2077
+ }), Hl = 500, Vl = () => {
2078
+ const t = y(13), e = at(Wl), {
2079
+ data: o
2080
+ } = j(e), n = U();
2081
+ let l;
2082
+ t[0] !== n ? (l = jt(n) ? n : void 0, t[0] = n, t[1] = l) : l = t[1];
2083
+ const i = l;
2084
+ let s, r;
2085
+ t[2] !== i || t[3] !== e ? (s = () => e.pipe(rt(), be((m) => m === "" || !i ? _t(void 0) : Nt(_t({
2086
+ type: "start",
2087
+ data: void 0
2088
+ }), Ht(Hl).pipe(be(() => i.search.search(m)), ne(Gl))))), r = [i, e], t[2] = i, t[3] = e, t[4] = s, t[5] = r) : (s = t[4], r = t[5]);
2089
+ const {
2090
+ data: c
2091
+ } = j(s, r);
2092
+ let f;
2093
+ t[6] !== e ? (f = e.next.bind(e), t[6] = e, t[7] = f) : f = t[7];
2094
+ const u = c?.type ?? "idle", d = c?.data;
2095
+ let h;
2096
+ return t[8] !== o || t[9] !== f || t[10] !== u || t[11] !== d ? (h = {
2097
+ value: o,
2098
+ setValue: f,
2099
+ status: u,
2100
+ data: d
2101
+ }, t[8] = o, t[9] = f, t[10] = u, t[11] = d, t[12] = h) : h = t[12], h;
2102
+ };
2103
+ function Wl() {
2104
+ return new Pn("");
2105
+ }
2106
+ function Gl(t) {
1766
2107
  return {
1767
- value: t,
1768
- setValue: n.next.bind(n),
1769
- status: i?.type ?? "idle",
1770
- data: i?.data
2108
+ type: "end",
2109
+ data: t
1771
2110
  };
1772
- }, so = g(
1773
- ({ onNavigate: n }) => {
1774
- const t = m(), { value: o, setValue: r, status: i, data: a } = lo(), l = (u) => {
1775
- r(u.target.value);
1776
- }, c = T(
1777
- (u) => {
1778
- n(), t?.navigation.goToCfi(u);
1779
- },
1780
- [t, n]
1781
- ), d = S(
1782
- () => t?.locateResource(a?.slice(0, 100) ?? []),
1783
- [a]
1784
- );
1785
- return /* @__PURE__ */ s(O, { flex: 1, height: "100%", gap: 2, children: [
1786
- /* @__PURE__ */ e(
1787
- an,
1788
- {
1789
- placeholder: "Type something...",
1790
- value: o,
1791
- onChange: l,
1792
- flexShrink: 0,
1793
- variant: "subtle",
1794
- name: "search",
1795
- focusRing: "none",
1796
- focusVisibleRing: "none",
1797
- outline: "none",
1798
- focusRingColor: "transparent"
1799
- }
1800
- ),
1801
- /* @__PURE__ */ s(
1802
- O,
1803
- {
1804
- style: { overflow: "hidden", overflowY: "auto" },
1805
- overflow: "auto",
1806
- px: 4,
1807
- flex: 1,
1808
- children: [
1809
- i === "start" && /* @__PURE__ */ e(b, { children: "Searching ..." }),
1810
- a?.length === 0 && /* @__PURE__ */ e(b, { children: "No results" }),
1811
- i === "end" && (a?.length ?? 0) > 0 && /* @__PURE__ */ s(O, { children: [
1812
- /* @__PURE__ */ s(b, { fontSize: "md", children: [
1813
- a?.length,
1814
- " result(s)"
1815
- ] }),
1816
- /* @__PURE__ */ e(O, { gap: 0, children: d?.map((u, p) => /* @__PURE__ */ e(
1817
- io,
1818
- {
1819
- contextText: u.meta?.range?.startContainer.parentElement?.textContent ?? "",
1820
- pageIndex: u.meta?.itemPageIndex,
1821
- startOffset: u.meta?.range?.startOffset ?? 0,
1822
- text: o,
1823
- cfi: u.meta.cfi,
1824
- onClick: c,
1825
- absolutePageIndex: u.meta?.absolutePageIndex
1826
- },
1827
- p
1828
- )) })
1829
- ] })
1830
- ]
1831
- }
1832
- )
1833
- ] });
1834
- }
1835
- ), co = g(
1836
- ({
1837
- open: n,
1838
- setOpen: t,
2111
+ }
2112
+ const ql = w((t) => {
2113
+ const e = y(31), {
1839
2114
  onNavigate: o
1840
- }) => /* @__PURE__ */ e(
1841
- j,
1842
- {
1843
- lazyMount: !0,
1844
- placement: "center",
1845
- open: n,
1846
- onOpenChange: (r) => t(r.open),
1847
- size: { mdDown: "full", md: "lg" },
1848
- scrollBehavior: "inside",
1849
- children: /* @__PURE__ */ s(G, { height: "100%", children: [
1850
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(Z, { children: "Search" }) }),
1851
- /* @__PURE__ */ e(Y, { flex: 1, p: 0, children: /* @__PURE__ */ e(so, { onNavigate: o }) }),
1852
- /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(X, { asChild: !0, children: /* @__PURE__ */ e(W, { variant: "outline", children: "Cancel" }) }) }),
1853
- /* @__PURE__ */ e(q, {})
1854
- ] })
1855
- }
1856
- )
1857
- ), uo = g(
1858
- ({ onNavigate: n }) => {
1859
- const t = m(), { manifest: o, assumedRenditionLayout: r } = S(() => t?.context, [t]) ?? {}, { nav: i } = o ?? {}, a = te();
1860
- i?.toc;
1861
- const { beginSpineItemIndex: l, beginPageIndexInSpineItem: c } = a ?? {}, d = (r === "reflowable" ? c : l) || 0;
1862
- let u = a?.beginChapterInfo;
1863
- for (; u?.subChapter; )
1864
- u = u?.subChapter;
1865
- const p = (h, C, v) => /* @__PURE__ */ s(ln.Fragment, { children: [
1866
- /* @__PURE__ */ e(
1867
- B.Item,
1868
- {
1869
- pl: 4 * (v + 1),
1870
- style: {
1871
- display: "flex",
1872
- alignItems: "center"
1873
- },
1874
- children: /* @__PURE__ */ s(
1875
- xe,
1876
- {
1877
- onClick: () => {
1878
- n(), t?.navigation.goToUrl(h.href);
1879
- },
1880
- href: "#",
1881
- children: [
1882
- u?.path === h.path && /* @__PURE__ */ e(B.Indicator, { asChild: !0, children: /* @__PURE__ */ e(ye, {}) }),
1883
- u?.path !== h.path && /* @__PURE__ */ e(B.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ e(ye, {}) }),
1884
- /* @__PURE__ */ s(O, { gap: 0, children: [
1885
- /* @__PURE__ */ e(b, { fontSize: "md", children: h.title || h.path }),
1886
- u?.path === h.path && /* @__PURE__ */ e(
1887
- b,
1888
- {
1889
- fontStyle: "italic",
1890
- fontWeight: "bold",
1891
- fontSize: "sm",
1892
- children: `Currently on page ${d + 1}`
1893
- }
1894
- )
1895
- ] })
1896
- ]
1897
- }
1898
- )
1899
- }
1900
- ),
1901
- h.contents.length > 0 && /* @__PURE__ */ e(B.Root, { as: "div", gap: 2, children: h.contents.map(
1902
- (R, D) => p(R, D, v + 1)
1903
- ) })
1904
- ] }, C);
1905
- return /* @__PURE__ */ e(B.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: i?.toc.map((h, C) => p(h, C, 0)) });
1906
- }
1907
- ), ho = g(
1908
- ({
1909
- open: n,
1910
- setOpen: t,
2115
+ } = t, n = U(), {
2116
+ value: l,
2117
+ setValue: i,
2118
+ status: s,
2119
+ data: r
2120
+ } = Vl();
2121
+ let c;
2122
+ e[0] !== i ? (c = (k) => {
2123
+ i(k.target.value);
2124
+ }, e[0] = i, e[1] = c) : c = e[1];
2125
+ const f = c;
2126
+ let u;
2127
+ e[2] !== o || e[3] !== n?.navigation ? (u = (k) => {
2128
+ o(), n?.navigation.goToCfi(k);
2129
+ }, e[2] = o, e[3] = n?.navigation, e[4] = u) : u = e[4];
2130
+ const d = u;
2131
+ let h;
2132
+ e[5] !== r || e[6] !== n ? (h = () => n?.locateResource(r?.slice(0, 100) ?? []), e[5] = r, e[6] = n, e[7] = h) : h = e[7];
2133
+ let m;
2134
+ e[8] !== r ? (m = [r], e[8] = r, e[9] = m) : m = e[9];
2135
+ const {
2136
+ data: g
2137
+ } = j(h, m);
2138
+ let p;
2139
+ e[10] !== f || e[11] !== l ? (p = /* @__PURE__ */ a(an, { placeholder: "Type something...", value: l, onChange: f, flexShrink: 0, variant: "subtle", name: "search", focusRing: "none", focusVisibleRing: "none", outline: "none", focusRingColor: "transparent" }), e[10] = f, e[11] = l, e[12] = p) : p = e[12];
2140
+ let b;
2141
+ e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = {
2142
+ overflow: "hidden",
2143
+ overflowY: "auto"
2144
+ }, e[13] = b) : b = e[13];
2145
+ let S;
2146
+ e[14] !== s ? (S = s === "start" && /* @__PURE__ */ a(q, { children: "Searching ..." }), e[14] = s, e[15] = S) : S = e[15];
2147
+ let _;
2148
+ e[16] !== r?.length ? (_ = r?.length === 0 && /* @__PURE__ */ a(q, { children: "No results" }), e[16] = r?.length, e[17] = _) : _ = e[17];
2149
+ let v;
2150
+ e[18] !== g || e[19] !== r?.length || e[20] !== d || e[21] !== l || e[22] !== s ? (v = s === "end" && (r?.length ?? 0) > 0 && /* @__PURE__ */ x(J, { children: [
2151
+ /* @__PURE__ */ x(q, { fontSize: "md", children: [
2152
+ r?.length,
2153
+ " result(s)"
2154
+ ] }),
2155
+ /* @__PURE__ */ a(J, { gap: 0, children: g?.map((k, $) => /* @__PURE__ */ a(Nl, { contextText: k.meta?.range?.startContainer.parentElement?.textContent ?? "", pageIndex: k.meta?.itemPageIndex, startOffset: k.meta?.range?.startOffset ?? 0, text: l, cfi: k.meta.cfi, onClick: d, absolutePageIndex: k.meta?.absolutePageIndex }, $)) })
2156
+ ] }), e[18] = g, e[19] = r?.length, e[20] = d, e[21] = l, e[22] = s, e[23] = v) : v = e[23];
2157
+ let C;
2158
+ e[24] !== S || e[25] !== _ || e[26] !== v ? (C = /* @__PURE__ */ x(J, { style: b, overflow: "auto", px: 4, flex: 1, children: [
2159
+ S,
2160
+ _,
2161
+ v
2162
+ ] }), e[24] = S, e[25] = _, e[26] = v, e[27] = C) : C = e[27];
2163
+ let I;
2164
+ return e[28] !== C || e[29] !== p ? (I = /* @__PURE__ */ x(J, { flex: 1, height: "100%", gap: 2, children: [
2165
+ p,
2166
+ C
2167
+ ] }), e[28] = C, e[29] = p, e[30] = I) : I = e[30], I;
2168
+ }), jl = w((t) => {
2169
+ const e = y(14), {
2170
+ open: o,
2171
+ setOpen: n,
2172
+ onNavigate: l
2173
+ } = t;
2174
+ let i;
2175
+ e[0] !== n ? (i = (m) => n(m.open), e[0] = n, e[1] = i) : i = e[1];
2176
+ let s;
2177
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = {
2178
+ mdDown: "full",
2179
+ md: "lg"
2180
+ }, e[2] = s) : s = e[2];
2181
+ let r;
2182
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ a(ye, { children: /* @__PURE__ */ a(Ie, { children: "Search" }) }), e[3] = r) : r = e[3];
2183
+ let c;
2184
+ e[4] !== l ? (c = /* @__PURE__ */ a(ke, { flex: 1, p: 0, children: /* @__PURE__ */ a(ql, { onNavigate: l }) }), e[4] = l, e[5] = c) : c = e[5];
2185
+ let f, u;
2186
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ a(xe, { children: /* @__PURE__ */ a($e, { asChild: !0, children: /* @__PURE__ */ a(re, { variant: "outline", children: "Cancel" }) }) }), u = /* @__PURE__ */ a(ve, {}), e[6] = f, e[7] = u) : (f = e[6], u = e[7]);
2187
+ let d;
2188
+ e[8] !== c ? (d = /* @__PURE__ */ x(_e, { height: "100%", children: [
2189
+ r,
2190
+ c,
2191
+ f,
2192
+ u
2193
+ ] }), e[8] = c, e[9] = d) : d = e[9];
2194
+ let h;
2195
+ return e[10] !== o || e[11] !== i || e[12] !== d ? (h = /* @__PURE__ */ a(Ce, { lazyMount: !0, placement: "center", open: o, onOpenChange: i, size: s, scrollBehavior: "inside", children: d }), e[10] = o, e[11] = i, e[12] = d, e[13] = h) : h = e[13], h;
2196
+ }), Ul = w((t) => {
2197
+ const e = y(7), {
1911
2198
  onNavigate: o
1912
- }) => /* @__PURE__ */ e(
1913
- j,
1914
- {
1915
- lazyMount: !0,
1916
- placement: "center",
1917
- open: n,
1918
- onOpenChange: (r) => t(r.open),
1919
- size: { mdDown: "full", md: "lg" },
1920
- scrollBehavior: "inside",
1921
- children: /* @__PURE__ */ s(G, { children: [
1922
- /* @__PURE__ */ e(Q, { children: /* @__PURE__ */ e(Z, { children: "Table of Contents" }) }),
1923
- /* @__PURE__ */ e(Y, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ e(uo, { onNavigate: o }) }),
1924
- /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(X, { asChild: !0, children: /* @__PURE__ */ e(W, { variant: "outline", children: "Cancel" }) }) }),
1925
- /* @__PURE__ */ e(q, {})
2199
+ } = t, n = U(), {
2200
+ data: l
2201
+ } = j(() => n?.context, [n]) ?? {}, {
2202
+ manifest: i,
2203
+ assumedRenditionLayout: s
2204
+ } = l === void 0 ? {} : l, {
2205
+ nav: r
2206
+ } = i ?? {}, c = Ge();
2207
+ r?.toc;
2208
+ let f;
2209
+ e[0] !== c ? (f = c ?? {}, e[0] = c, e[1] = f) : f = e[1];
2210
+ const {
2211
+ beginSpineItemIndex: u,
2212
+ beginPageIndexInSpineItem: d
2213
+ } = f, h = (s === "reflowable" ? d : u) || 0;
2214
+ let m;
2215
+ if (e[2] !== c?.beginChapterInfo) {
2216
+ for (m = c?.beginChapterInfo; m?.subChapter; )
2217
+ m = m?.subChapter;
2218
+ e[2] = c?.beginChapterInfo, e[3] = m;
2219
+ } else
2220
+ m = e[3];
2221
+ const g = (k, $, O) => /* @__PURE__ */ x(rn.Fragment, { children: [
2222
+ /* @__PURE__ */ a(me.Item, { pl: 4 * (O + 1), style: {
2223
+ display: "flex",
2224
+ alignItems: "center"
2225
+ }, children: /* @__PURE__ */ x(Ct, { onClick: () => {
2226
+ o(), n?.navigation.goToUrl(k.href);
2227
+ }, href: "#", children: [
2228
+ m?.path === k.path && /* @__PURE__ */ a(me.Indicator, { asChild: !0, children: /* @__PURE__ */ a(Rt, {}) }),
2229
+ m?.path !== k.path && /* @__PURE__ */ a(me.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ a(Rt, {}) }),
2230
+ /* @__PURE__ */ x(J, { gap: 0, children: [
2231
+ /* @__PURE__ */ a(q, { fontSize: "md", children: k.title || k.path }),
2232
+ m?.path === k.path && /* @__PURE__ */ a(q, { fontStyle: "italic", fontWeight: "bold", fontSize: "sm", children: `Currently on page ${h + 1}` })
1926
2233
  ] })
1927
- }
1928
- )
1929
- ), po = () => {
1930
- const n = m(), { zoomMaxScale: t } = y(["zoomMaxScale"]);
1931
- $(
1932
- function() {
1933
- n?.gestures.settings.update({
1934
- zoomMaxScale: t ?? He
1935
- });
1936
- },
1937
- [n, t]
1938
- );
1939
- }, Ae = 0.5, Be = 1, go = (n, t, o, r) => {
1940
- if (n > t && n < t + r)
1941
- return t + r;
1942
- const i = Math.min(Math.max(n, t), o), a = Math.round((i - t) / r) * r + t;
1943
- return Math.round(a * 100) / 100;
1944
- }, fo = g(() => {
1945
- const { quickMenuBottomBarBoundingBoxSignal: n, zoomMaxScale: t = He } = y([
1946
- "quickMenuBottomBarBoundingBoxSignal",
1947
- "zoomMaxScale"
1948
- ]), o = Se(
1949
- n
1950
- ), r = m(), i = S(
1951
- () => r?.zoom.state$.pipe(
1952
- E((d) => d.currentScale),
1953
- Le(100, Fn, {
1954
- leading: !0,
1955
- trailing: !0
1956
- })
1957
- ),
1958
- [r]
1959
- ) ?? 1, a = S(
1960
- () => r?.zoom.state$.pipe(E((d) => d.isZooming)),
1961
- [r]
1962
- ) ?? !1, l = go(
1963
- i,
1964
- Be,
1965
- t,
1966
- Ae
1967
- ), c = o?.borderBoxSize?.[0]?.blockSize ?? 1;
1968
- return /* @__PURE__ */ e(
1969
- ue,
1970
- {
1971
- present: a && i > 1,
1972
- animationName: { _open: "fade-in", _closed: "fade-out" },
1973
- animationDuration: "moderate",
1974
- position: "absolute",
1975
- bottom: `calc(${c}px + var(--chakra-spacing-4))`,
1976
- right: 4,
1977
- backgroundColor: "bg.panel",
1978
- shadow: "sm",
1979
- borderRadius: "md",
1980
- p: 4,
1981
- children: /* @__PURE__ */ e(
1982
- Re,
1983
- {
1984
- value: [l],
1985
- min: Be,
1986
- max: t,
1987
- step: Ae,
1988
- minWidth: 200,
1989
- onValueChange: (d) => {
1990
- const u = d.value?.[0] ?? 1;
1991
- u === 1 ? r?.zoom.exit() : r?.zoom.scaleAt(u, {
1992
- constrain: "within-viewport"
1993
- });
1994
- }
1995
- }
1996
- )
1997
- }
1998
- );
1999
- }), mo = { _open: "fade-in", _closed: "fade-out" }, bo = g(() => (mt(), null)), So = g(() => (po(), Nt(), Vt(), to(), bt(), /* @__PURE__ */ s(de, { children: [
2000
- /* @__PURE__ */ e(Tt, {}),
2001
- /* @__PURE__ */ e(bo, {})
2002
- ] }))), Co = g(
2003
- ({
2004
- children: n,
2005
- ...t
2006
- }) => {
2007
- const { enableFloatingTime: o, onItemClick: r } = y([
2008
- "enableFloatingTime",
2009
- "onItemClick"
2010
- ]), [i, a] = w(!1), [l, c] = w(!1), [d, u] = w(!1), [p, h] = w(void 0), [C, v] = w(!1), [R, D] = Me(), x = T(() => {
2011
- a(!1), c(!1), u(!1), h(void 0), D(!1), v(!1);
2012
- }, [D]), L = T(
2013
- (I) => {
2014
- I === "annotations" ? h("annotations") : I === "search" ? u(!0) : I === "help" ? c(!0) : I === "toc" ? a(!0) : I === "bookmarks" ? h("bookmarks") : I === "gallery" && v(!0), r?.(I);
2015
- },
2016
- [r]
2017
- );
2018
- return /* @__PURE__ */ s(de, { children: [
2019
- /* @__PURE__ */ e(So, {}),
2020
- /* @__PURE__ */ s(
2021
- _,
2022
- {
2023
- position: "absolute",
2024
- top: 0,
2025
- left: 0,
2026
- height: "100%",
2027
- width: "100%",
2028
- overflow: "hidden",
2029
- "data-prose-react-reader": !0,
2030
- ...t,
2031
- children: [
2032
- n,
2033
- /* @__PURE__ */ e(_t, {}),
2034
- /* @__PURE__ */ e(Pt, { open: C, setOpen: v }),
2035
- /* @__PURE__ */ e(ro, {}),
2036
- /* @__PURE__ */ e(no, { onItemClick: L }),
2037
- /* @__PURE__ */ e(fo, {}),
2038
- /* @__PURE__ */ e(Rt, {}),
2039
- /* @__PURE__ */ e(ft, {}),
2040
- /* @__PURE__ */ e(Bt, { open: l, setOpen: c }),
2041
- /* @__PURE__ */ e(
2042
- ho,
2043
- {
2044
- open: i,
2045
- setOpen: a,
2046
- onNavigate: x
2047
- }
2048
- ),
2049
- /* @__PURE__ */ e(
2050
- co,
2051
- {
2052
- open: d,
2053
- setOpen: u,
2054
- onNavigate: x
2055
- }
2056
- ),
2057
- /* @__PURE__ */ e(
2058
- dt,
2059
- {
2060
- openWith: p,
2061
- setOpen: (I) => h(I ? "annotations" : void 0),
2062
- onNavigate: x
2063
- }
2064
- ),
2065
- /* @__PURE__ */ e(
2066
- ue,
2067
- {
2068
- present: o || R,
2069
- animationName: mo,
2070
- animationDuration: "slow",
2071
- overflow: "hidden",
2072
- children: /* @__PURE__ */ e($t, {})
2073
- }
2074
- ),
2075
- /* @__PURE__ */ e(St, {})
2076
- ]
2077
- }
2078
- )
2079
- ] });
2080
- }
2081
- ), $o = g(
2082
- ({
2083
- children: n,
2084
- slots: t,
2085
- ...o
2086
- }) => {
2087
- const { container: { props: r = {} } = {} } = t ?? {};
2088
- return /* @__PURE__ */ e(vt, { ...o, children: /* @__PURE__ */ e(Co, { ...r, children: n }) });
2089
- }
2090
- );
2234
+ ] }) }),
2235
+ k.contents.length > 0 && /* @__PURE__ */ a(me.Root, { as: "div", gap: 2, children: k.contents.map((z, E) => g(z, E, O + 1)) })
2236
+ ] }, $), p = me, b = 3, S = "auto", _ = 4, v = 1, C = r?.toc.map((k, $) => g(k, $, 0));
2237
+ let I;
2238
+ return e[4] !== p.Root || e[5] !== C ? (I = /* @__PURE__ */ a(p.Root, { gap: b, overflowY: S, py: _, flex: v, children: C }), e[4] = p.Root, e[5] = C, e[6] = I) : I = e[6], I;
2239
+ }), Ql = w((t) => {
2240
+ const e = y(14), {
2241
+ open: o,
2242
+ setOpen: n,
2243
+ onNavigate: l
2244
+ } = t;
2245
+ let i;
2246
+ e[0] !== n ? (i = (m) => n(m.open), e[0] = n, e[1] = i) : i = e[1];
2247
+ let s;
2248
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = {
2249
+ mdDown: "full",
2250
+ md: "lg"
2251
+ }, e[2] = s) : s = e[2];
2252
+ let r;
2253
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ a(ye, { children: /* @__PURE__ */ a(Ie, { children: "Table of Contents" }) }), e[3] = r) : r = e[3];
2254
+ let c;
2255
+ e[4] !== l ? (c = /* @__PURE__ */ a(ke, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ a(Ul, { onNavigate: l }) }), e[4] = l, e[5] = c) : c = e[5];
2256
+ let f, u;
2257
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ a(xe, { children: /* @__PURE__ */ a($e, { asChild: !0, children: /* @__PURE__ */ a(re, { variant: "outline", children: "Cancel" }) }) }), u = /* @__PURE__ */ a(ve, {}), e[6] = f, e[7] = u) : (f = e[6], u = e[7]);
2258
+ let d;
2259
+ e[8] !== c ? (d = /* @__PURE__ */ x(_e, { children: [
2260
+ r,
2261
+ c,
2262
+ f,
2263
+ u
2264
+ ] }), e[8] = c, e[9] = d) : d = e[9];
2265
+ let h;
2266
+ return e[10] !== o || e[11] !== i || e[12] !== d ? (h = /* @__PURE__ */ a(Ce, { lazyMount: !0, placement: "center", open: o, onOpenChange: i, size: s, scrollBehavior: "inside", children: d }), e[10] = o, e[11] = i, e[12] = d, e[13] = h) : h = e[13], h;
2267
+ }), Yl = () => {
2268
+ const t = y(7), e = U();
2269
+ let o;
2270
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = ["zoomMaxScale"], t[0] = o) : o = t[0];
2271
+ const {
2272
+ zoomMaxScale: n
2273
+ } = oe(o);
2274
+ let l;
2275
+ t[1] !== e?.gestures.settings || t[2] !== n ? (l = function() {
2276
+ e?.gestures.settings.update({
2277
+ zoomMaxScale: n ?? Wt
2278
+ });
2279
+ }, t[1] = e?.gestures.settings, t[2] = n, t[3] = l) : l = t[3];
2280
+ let i;
2281
+ t[4] !== e || t[5] !== n ? (i = [e, n], t[4] = e, t[5] = n, t[6] = i) : i = t[6], ce(l, i);
2282
+ }, Mt = 0.5, Pt = 1, Zl = (t, e, o, n) => {
2283
+ if (t > e && t < e + n)
2284
+ return e + n;
2285
+ const l = Math.min(Math.max(t, e), o), i = Math.round((l - e) / n) * n + e;
2286
+ return Math.round(i * 100) / 100;
2287
+ }, Kl = w(() => {
2288
+ const t = y(23);
2289
+ let e;
2290
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = ["zoomMaxScale"], t[0] = e) : e = t[0];
2291
+ const {
2292
+ zoomMaxScale: o
2293
+ } = oe(e), n = o === void 0 ? Wt : o, l = U();
2294
+ let i;
2295
+ t[1] !== l?.zoom.state$ ? (i = () => l?.zoom.state$.pipe(ne(Xl), Ft(100, An, {
2296
+ leading: !0,
2297
+ trailing: !0
2298
+ })), t[1] = l?.zoom.state$, t[2] = i) : i = t[2];
2299
+ let s;
2300
+ t[3] !== l ? (s = [l], t[3] = l, t[4] = s) : s = t[4];
2301
+ const {
2302
+ data: r
2303
+ } = j(i, s), c = r === void 0 ? 1 : r;
2304
+ let f;
2305
+ t[5] !== l?.zoom.state$ ? (f = () => l?.zoom.state$.pipe(ne(Jl)), t[5] = l?.zoom.state$, t[6] = f) : f = t[6];
2306
+ let u;
2307
+ t[7] !== l ? (u = [l], t[7] = l, t[8] = u) : u = t[8];
2308
+ const {
2309
+ data: d
2310
+ } = j(f, u), h = d === void 0 ? !1 : d;
2311
+ let m;
2312
+ t[9] !== n || t[10] !== c ? (m = Zl(c, Pt, n, Mt), t[9] = n, t[10] = c, t[11] = m) : m = t[11];
2313
+ const g = m, p = h && c > 1;
2314
+ let b;
2315
+ t[12] !== g ? (b = [g], t[12] = g, t[13] = b) : b = t[13];
2316
+ let S;
2317
+ t[14] !== l?.zoom ? (S = (C) => {
2318
+ const I = C.value?.[0] ?? 1;
2319
+ I === 1 ? l?.zoom.exit() : l?.zoom.scaleAt(I, {
2320
+ constrain: "within-viewport"
2321
+ });
2322
+ }, t[14] = l?.zoom, t[15] = S) : S = t[15];
2323
+ let _;
2324
+ t[16] !== b || t[17] !== S || t[18] !== n ? (_ = /* @__PURE__ */ a(It, { value: b, min: Pt, max: n, step: Mt, minWidth: 200, onValueChange: S }), t[16] = b, t[17] = S, t[18] = n, t[19] = _) : _ = t[19];
2325
+ let v;
2326
+ return t[20] !== _ || t[21] !== p ? (v = /* @__PURE__ */ a(qt, { present: p, children: _ }), t[20] = _, t[21] = p, t[22] = v) : v = t[22], v;
2327
+ });
2328
+ function Xl(t) {
2329
+ return t.currentScale;
2330
+ }
2331
+ function Jl(t) {
2332
+ return t.isZooming;
2333
+ }
2334
+ const ei = {
2335
+ _open: "fade-in",
2336
+ _closed: "fade-out"
2337
+ }, ti = w(() => (Ro(), null)), ni = w(() => {
2338
+ const t = y(1);
2339
+ Yl(), bl(), _l(), El(), wo(), Mo();
2340
+ let e;
2341
+ return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ x(et, { children: [
2342
+ /* @__PURE__ */ a(Ko, {}),
2343
+ /* @__PURE__ */ a(ti, {})
2344
+ ] }), t[0] = e) : e = t[0], e;
2345
+ }), oi = w((t) => {
2346
+ const e = y(46);
2347
+ let o, n;
2348
+ e[0] !== t ? ({
2349
+ children: o,
2350
+ ...n
2351
+ } = t, e[0] = t, e[1] = o, e[2] = n) : (o = e[1], n = e[2]);
2352
+ let l;
2353
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (l = ["enableFloatingTime", "onItemClick"], e[3] = l) : l = e[3];
2354
+ const {
2355
+ enableFloatingTime: i,
2356
+ onItemClick: s
2357
+ } = oe(l), [r, c] = le(!1), [f, u] = le(!1), [d, h] = le(!1), [m, g] = le(void 0), [p, b] = le(!1), [S, _] = Tt();
2358
+ let v;
2359
+ e[4] !== _ ? (v = () => {
2360
+ c(!1), u(!1), h(!1), g(void 0), _(!1), b(!1);
2361
+ }, e[4] = _, e[5] = v) : v = e[5];
2362
+ const C = v;
2363
+ let I;
2364
+ e[6] !== s ? (I = (B) => {
2365
+ B === "annotations" ? g("annotations") : B === "search" ? h(!0) : B === "help" ? u(!0) : B === "toc" ? c(!0) : B === "bookmarks" ? g("bookmarks") : B === "gallery" && b(!0), s?.(B);
2366
+ }, e[6] = s, e[7] = I) : I = e[7];
2367
+ const k = I;
2368
+ let $;
2369
+ e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? ($ = /* @__PURE__ */ a(ni, {}), e[8] = $) : $ = e[8];
2370
+ let O;
2371
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ a(hl, {}), e[9] = O) : O = e[9];
2372
+ let z;
2373
+ e[10] !== p ? (z = /* @__PURE__ */ a(sl, { open: p, setOpen: b }), e[10] = p, e[11] = z) : z = e[11];
2374
+ let E;
2375
+ e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ a(Ll, {}), e[12] = E) : E = e[12];
2376
+ let T;
2377
+ e[13] !== k ? (T = /* @__PURE__ */ a(Al, { onItemClick: k }), e[13] = k, e[14] = T) : T = e[14];
2378
+ let N, M, H, Q, K;
2379
+ e[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ a(Kl, {}), N = /* @__PURE__ */ a(lo, {}), M = /* @__PURE__ */ a(ho, {}), H = /* @__PURE__ */ a(Yo, {}), Q = /* @__PURE__ */ a(To, {}), e[15] = N, e[16] = M, e[17] = H, e[18] = Q, e[19] = K) : (N = e[15], M = e[16], H = e[17], Q = e[18], K = e[19]);
2380
+ let V;
2381
+ e[20] !== f ? (V = /* @__PURE__ */ a(cl, { open: f, setOpen: u }), e[20] = f, e[21] = V) : V = e[21];
2382
+ let W;
2383
+ e[22] !== r || e[23] !== C ? (W = /* @__PURE__ */ a(Ql, { open: r, setOpen: c, onNavigate: C }), e[22] = r, e[23] = C, e[24] = W) : W = e[24];
2384
+ let G;
2385
+ e[25] !== d || e[26] !== C ? (G = /* @__PURE__ */ a(jl, { open: d, setOpen: h, onNavigate: C }), e[25] = d, e[26] = C, e[27] = G) : G = e[27];
2386
+ let F;
2387
+ e[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (F = (B) => g(B ? "annotations" : void 0), e[28] = F) : F = e[28];
2388
+ let P;
2389
+ e[29] !== m || e[30] !== C ? (P = /* @__PURE__ */ a(yo, { openWith: m, setOpen: F, onNavigate: C }), e[29] = m, e[30] = C, e[31] = P) : P = e[31];
2390
+ const Y = i || S;
2391
+ let Z;
2392
+ e[32] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Z = /* @__PURE__ */ a(pl, {}), e[32] = Z) : Z = e[32];
2393
+ let A;
2394
+ e[33] !== Y ? (A = /* @__PURE__ */ a(tt, { present: Y, animationName: ei, animationDuration: "slow", overflow: "hidden", children: Z }), e[33] = Y, e[34] = A) : A = e[34];
2395
+ let L;
2396
+ e[35] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ a(Bo, {}), e[35] = L) : L = e[35];
2397
+ let X;
2398
+ return e[36] !== o || e[37] !== n || e[38] !== V || e[39] !== W || e[40] !== G || e[41] !== P || e[42] !== A || e[43] !== z || e[44] !== T ? (X = /* @__PURE__ */ x(et, { children: [
2399
+ $,
2400
+ /* @__PURE__ */ x(he, { position: "absolute", top: 0, left: 0, height: "100%", width: "100%", overflow: "hidden", "data-prose-react-reader": !0, ...n, children: [
2401
+ o,
2402
+ O,
2403
+ z,
2404
+ E,
2405
+ T,
2406
+ K,
2407
+ N,
2408
+ M,
2409
+ H,
2410
+ Q,
2411
+ V,
2412
+ W,
2413
+ G,
2414
+ P,
2415
+ A,
2416
+ L
2417
+ ] })
2418
+ ] }), e[36] = o, e[37] = n, e[38] = V, e[39] = W, e[40] = G, e[41] = P, e[42] = A, e[43] = z, e[44] = T, e[45] = X) : X = e[45], X;
2419
+ }), Ii = w((t) => {
2420
+ const e = y(16);
2421
+ let o, n, l;
2422
+ e[0] !== t ? ({
2423
+ children: o,
2424
+ slots: l,
2425
+ ...n
2426
+ } = t, e[0] = t, e[1] = o, e[2] = n, e[3] = l) : (o = e[1], n = e[2], l = e[3]);
2427
+ let i;
2428
+ e[4] !== l ? (i = l ?? {}, e[4] = l, e[5] = i) : i = e[5];
2429
+ const {
2430
+ container: s
2431
+ } = i;
2432
+ let r;
2433
+ e[6] !== s ? (r = s === void 0 ? {} : s, e[6] = s, e[7] = r) : r = e[7];
2434
+ const {
2435
+ props: c
2436
+ } = r;
2437
+ let f;
2438
+ e[8] !== c ? (f = c === void 0 ? {} : c, e[8] = c, e[9] = f) : f = e[9];
2439
+ const u = f;
2440
+ let d;
2441
+ e[10] !== o || e[11] !== u ? (d = /* @__PURE__ */ a(oi, { ...u, children: o }), e[10] = o, e[11] = u, e[12] = d) : d = e[12];
2442
+ let h;
2443
+ return e[13] !== n || e[14] !== d ? (h = /* @__PURE__ */ a(Lo, { ...n, children: d }), e[13] = n, e[14] = d, e[15] = h) : h = e[15], h;
2444
+ });
2091
2445
  export {
2092
- tt as BOOKMARK_AREA_DATA_ATTRIBUTE,
2093
- He as MAX_ZOOM_SCALE,
2094
- $o as ReactReader
2446
+ no as BOOKMARK_AREA_DATA_ATTRIBUTE,
2447
+ Wt as MAX_ZOOM_SCALE,
2448
+ Ii as ReactReader
2095
2449
  };
2096
2450
  //# sourceMappingURL=index.js.map