html-flip-book-react 0.0.0-alpha.54 → 0.0.0-alpha.56

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.
@@ -68,9 +68,9 @@ export interface FlipBookProps {
68
68
  enableDownload?: boolean;
69
69
  }
70
70
  declare const FlipBookReact: React.ForwardRefExoticComponent<FlipBookProps & React.RefAttributes<FlipBookHandle>>;
71
- export { FlipBookReact as FlipBook };
72
71
  export type { Bookmark, BookmarkContext, BookmarkPlacement, FlipPageSemantic, HistoryMapper, MouseMode, PageFlipParams, PageSemantics, } from "html-flip-book-vanilla";
73
72
  export { createDefaultHistoryMapper } from "html-flip-book-vanilla";
74
73
  export type { TocEntry, TocPageProps } from "./TocPage";
75
74
  export { TocPage } from "./TocPage";
75
+ export { FlipBookReact as FlipBook };
76
76
  //# sourceMappingURL=FlipBook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlipBook.d.ts","sourceRoot":"","sources":["../src/FlipBook.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,gBAAgB,IAAI,oBAAoB,EAG7C,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAoBrE,MAAM,WAAW,cAAc;IAE9B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD,UAAU,EAAE,CAAC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AAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAMpD,gBAAgB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAIrD,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAM5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAK9B,YAAY,CAAC,EAAE,MAAM,CAAC;IAMtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAKhC,UAAU,CAAC,EAAE,OAAO,CAAC;IAOrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAK7B,aAAa,CAAC,EAAE,OAAO,CAAC;IAMxB,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAsBD,QAAA,MAAM,aAAa,sFAmZlB,CAAC;AAIF,YAAY,EACX,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,cAAc,EACd,aAAa,GACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,CAAC"}
package/dist/flip-book.js CHANGED
@@ -1,134 +1,144 @@
1
- import { jsx as c, jsxs as O, Fragment as ae } from "react/jsx-runtime";
2
- import { FlipBook as ce } from "html-flip-book-vanilla";
3
- import { createDefaultHistoryMapper as Ce } from "html-flip-book-vanilla";
4
- import { forwardRef as le, useState as W, useRef as F, useEffect as S, useImperativeHandle as ie, Children as ue } from "react";
5
- import { createPortal as de } from "react-dom";
6
- const pe = (x) => x.title.length > 0, Ie = ({
7
- onNavigate: x,
1
+ import { jsx as l, jsxs as U, Fragment as ie } from "react/jsx-runtime";
2
+ import { FlipBook as ue } from "html-flip-book-vanilla";
3
+ import { createDefaultHistoryMapper as ve } from "html-flip-book-vanilla";
4
+ import { forwardRef as de, useState as H, useRef as x, useEffect as w, useImperativeHandle as ge, Children as pe } from "react";
5
+ import { createPortal as fe } from "react-dom";
6
+ const he = (k) => k.title.length > 0, Ce = ({
7
+ onNavigate: k,
8
8
  totalPages: d,
9
9
  pageSemantics: T,
10
- heading: B = "Table of Contents",
11
- className: y,
12
- direction: p = "ltr",
13
- filter: $ = pe,
14
- getHref: g,
10
+ heading: b = "Table of Contents",
11
+ className: L,
12
+ direction: g = "ltr",
13
+ filter: $ = he,
14
+ getHref: p,
15
15
  renderEntry: f
16
16
  }) => {
17
- const k = [];
18
- for (let n = 0; n < d; n++) {
19
- const u = T?.indexToTitle(n) ?? "", m = T?.indexToSemanticName(n) ?? "", N = { pageIndex: n, title: u, semanticName: m };
20
- $(N, n) && k.push(N);
17
+ const C = [];
18
+ for (let r = 0; r < d; r++) {
19
+ const u = T?.indexToTitle(r) ?? "", h = T?.indexToSemanticName(r) ?? "", M = { pageIndex: r, title: u, semanticName: h };
20
+ $(M, r) && C.push(M);
21
21
  }
22
- const D = (n, u, m) => {
23
- const N = n.title || n.semanticName || `Page ${n.pageIndex + 1}`, L = n.semanticName || String(n.pageIndex + 1), a = /* @__PURE__ */ O(ae, { children: [
24
- /* @__PURE__ */ c("span", { className: "toc-title", children: N }),
25
- /* @__PURE__ */ c("span", { className: "toc-dots", "aria-hidden": !0 }),
26
- /* @__PURE__ */ c("span", { className: "toc-page-num", children: L })
22
+ const D = (r, u, h) => {
23
+ const M = r.title || r.semanticName || `Page ${r.pageIndex + 1}`, _ = r.semanticName || String(r.pageIndex + 1), c = /* @__PURE__ */ U(ie, { children: [
24
+ /* @__PURE__ */ l("span", { className: "toc-title", children: M }),
25
+ /* @__PURE__ */ l("span", { className: "toc-dots", "aria-hidden": !0 }),
26
+ /* @__PURE__ */ l("span", { className: "toc-page-num", children: _ })
27
27
  ] });
28
- return /* @__PURE__ */ c("li", { children: m ? /* @__PURE__ */ c(
28
+ return /* @__PURE__ */ l("li", { children: h ? /* @__PURE__ */ l(
29
29
  "a",
30
30
  {
31
- href: m,
31
+ href: h,
32
32
  className: "toc-link",
33
- onClick: (h) => {
34
- h.button !== 0 || h.ctrlKey || h.metaKey || h.shiftKey || h.altKey || (h.preventDefault(), u());
33
+ onClick: (m) => {
34
+ m.button !== 0 || m.ctrlKey || m.metaKey || m.shiftKey || m.altKey || (m.preventDefault(), u());
35
35
  },
36
- children: a
36
+ children: c
37
37
  }
38
- ) : /* @__PURE__ */ c("button", { type: "button", className: "toc-link", onClick: u, children: a }) }, n.pageIndex);
38
+ ) : /* @__PURE__ */ l("button", { type: "button", className: "toc-link", onClick: u, children: c }) }, r.pageIndex);
39
39
  };
40
- return /* @__PURE__ */ c(
40
+ return /* @__PURE__ */ l(
41
41
  "div",
42
42
  {
43
- className: `toc-page ${y ?? ""}`.trim(),
44
- style: { direction: p, textAlign: p === "rtl" ? "right" : "left" },
45
- children: /* @__PURE__ */ O("div", { className: "toc-page__scroll", children: [
46
- /* @__PURE__ */ c("h2", { className: "toc-heading", children: B }),
47
- /* @__PURE__ */ c("ul", { className: "toc-list", children: k.map((n) => {
48
- const u = () => x(n.pageIndex), m = g?.(n) ?? void 0;
49
- return f ? f(n, u, m) : D(n, u, m);
43
+ className: `toc-page ${L ?? ""}`.trim(),
44
+ style: { direction: g, textAlign: g === "rtl" ? "right" : "left" },
45
+ children: /* @__PURE__ */ U("div", { className: "toc-page__scroll", children: [
46
+ /* @__PURE__ */ l("h2", { className: "toc-heading", children: b }),
47
+ /* @__PURE__ */ l("ul", { className: "toc-list", children: C.map((r) => {
48
+ const u = () => k(r.pageIndex), h = p?.(r) ?? void 0;
49
+ return f ? f(r, u, h) : D(r, u, h);
50
50
  }) })
51
51
  ] })
52
52
  }
53
53
  );
54
- }, ge = le(
54
+ }, me = de(
55
55
  ({
56
- pages: x,
56
+ pages: k,
57
57
  className: d,
58
58
  debug: T = !1,
59
- direction: B = "ltr",
60
- mouseMode: y = "turn",
61
- mouseModeStorageKey: p,
59
+ direction: b = "ltr",
60
+ mouseMode: L = "turn",
61
+ mouseModeStorageKey: g,
62
62
  pageSemantics: $ = void 0,
63
- bookmarkProvider: g,
63
+ bookmarkProvider: p,
64
64
  enableBookmarks: f = !1,
65
- initialTurnedLeaves: k = [],
65
+ initialTurnedLeaves: C = [],
66
66
  fastDeltaThreshold: D,
67
- leavesBuffer: n,
67
+ leavesBuffer: r,
68
68
  pageShadow: u = !0,
69
- snapshotDuringFlip: m = !0,
70
- enableHistory: N,
71
- enableDownload: L,
72
- coverConfig: a,
73
- of: h,
74
- leafAspectRatio: z,
75
- coverAspectRatio: G,
76
- handlers: A,
77
- historyMapper: J,
78
- tocPageIndex: K,
79
- downloadConfig: Q
80
- }, X) => {
81
- const [Y, _] = W(() => {
82
- if (k && k.length > 0) {
83
- const t = Math.max(...k) * 2 + 1;
84
- return t >= x.length ? (Math.ceil(x.length / 2) - 1) * 2 : t;
69
+ snapshotDuringFlip: h = !0,
70
+ enableHistory: M,
71
+ enableDownload: _,
72
+ coverConfig: c,
73
+ of: m,
74
+ leafAspectRatio: J,
75
+ coverAspectRatio: K,
76
+ handlers: j,
77
+ historyMapper: Q,
78
+ tocPageIndex: X,
79
+ downloadConfig: Y
80
+ }, Z) => {
81
+ const [ee, q] = H(() => {
82
+ if (C && C.length > 0) {
83
+ const t = Math.max(...C) * 2 + 1;
84
+ return t >= k.length ? (Math.ceil(k.length / 2) - 1) * 2 : t;
85
85
  }
86
86
  return 0;
87
- }), w = F(_), [Z, H] = W([]);
88
- w.current = _;
89
- const j = F(h);
90
- j.current = h;
91
- const ee = 80, v = F(null), U = F((e) => {
92
- w.current?.(e);
87
+ }), B = x(q), [te, V] = H([]);
88
+ B.current = q;
89
+ const O = x(m);
90
+ O.current = m;
91
+ const ne = 80, v = x(null), R = x(/* @__PURE__ */ new Set()), [, re] = H(0), W = x((e) => {
92
+ B.current?.(e);
93
93
  });
94
- U.current = (e) => {
95
- if (v.current != null && clearTimeout(v.current), n == null) {
96
- w.current?.(e);
94
+ W.current = (e) => {
95
+ if (v.current != null && clearTimeout(v.current), r == null) {
96
+ B.current?.(e);
97
97
  return;
98
98
  }
99
99
  v.current = setTimeout(() => {
100
- v.current = null, w.current?.(e);
101
- }, ee);
102
- }, S(() => () => {
100
+ v.current = null, R.current.clear(), B.current?.(e);
101
+ }, ne);
102
+ };
103
+ const z = x((e) => {
104
+ j?.onPageFlipping?.(e);
105
+ });
106
+ z.current = (e) => {
107
+ if (r != null) {
108
+ const t = e.direction === "backward" ? e.pageIndices[1] : e.pageIndices[0], n = Math.floor(t / 2);
109
+ R.current.has(n) || (R.current.add(n), re((a) => a + 1));
110
+ }
111
+ j?.onPageFlipping?.(e);
112
+ }, w(() => () => {
103
113
  v.current != null && clearTimeout(v.current);
104
114
  }, []);
105
- const s = F(
106
- new ce({
115
+ const s = x(
116
+ new ue({
107
117
  pageSemantics: $,
108
118
  enableBookmarks: f,
109
- pagesCount: x.length,
110
- direction: B,
111
- mouseMode: y,
112
- initialTurnedLeaves: k,
119
+ pagesCount: k.length,
120
+ direction: b,
121
+ mouseMode: L,
122
+ initialTurnedLeaves: C,
113
123
  fastDeltaThreshold: D,
114
- leavesBuffer: n,
115
- leafAspectRatio: z,
116
- coverAspectRatio: G,
117
- coverPageIndices: a?.coverIndices,
118
- onPageChanged: (e) => U.current(e),
119
- onPageFlipping: A?.onPageFlipping,
120
- onPageFlipped: A?.onPageFlipped,
121
- historyMapper: J,
122
- tocPageIndex: K ?? 4,
123
- downloadConfig: Q,
124
+ leavesBuffer: r,
125
+ leafAspectRatio: J,
126
+ coverAspectRatio: K,
127
+ coverPageIndices: c?.coverIndices,
128
+ onPageChanged: (e) => W.current(e),
129
+ onPageFlipping: (e) => z.current(e),
130
+ onPageFlipped: j?.onPageFlipped,
131
+ historyMapper: Q,
132
+ tocPageIndex: X ?? 4,
133
+ downloadConfig: Y,
124
134
  pageShadow: u,
125
- snapshotDuringFlip: m,
126
- enableHistory: N,
127
- enableDownload: L
135
+ snapshotDuringFlip: h,
136
+ enableHistory: M,
137
+ enableDownload: _
128
138
  })
129
139
  );
130
- ie(
131
- X,
140
+ ge(
141
+ Z,
132
142
  () => ({
133
143
  flipNext: () => s.current.flipNext(),
134
144
  flipPrev: () => s.current.flipPrev(),
@@ -136,142 +146,142 @@ const pe = (x) => x.title.length > 0, Ie = ({
136
146
  jumpToPage: (e) => s.current.jumpToPage(e),
137
147
  restorePage: (e) => s.current.restorePage(e),
138
148
  toggleDebugBar: () => {
139
- const e = d.split(/\s+/)[0], r = document.querySelector(`.${e}`)?.querySelector(".flipbook-debug-bar");
140
- r && r.classList.toggle("flipbook-debug-bar--hidden");
149
+ const e = d.split(/\s+/)[0], n = document.querySelector(`.${e}`)?.querySelector(".flipbook-debug-bar");
150
+ n && n.classList.toggle("flipbook-debug-bar--hidden");
141
151
  },
142
152
  getCurrentPageIndex: () => s.current.currentPageIndex,
143
153
  getTotalPages: () => s.current.totalPages,
144
- getOf: () => j.current !== void 0 ? j.current : s.current.totalPages,
154
+ getOf: () => O.current !== void 0 ? O.current : s.current.totalPages,
145
155
  isFirstPage: () => s.current.isFirstPage,
146
156
  isLastPage: () => s.current.isLastPage,
147
157
  getDownloadConfig: () => s.current.getDownloadConfig(),
148
158
  getTocPageIndex: () => s.current.getTocPageIndex(),
149
159
  getMouseMode: () => s.current.getMouseMode(),
150
160
  setMouseMode: (e, t) => {
151
- if (s.current.setMouseMode(e), p && t?.persist !== !1)
161
+ if (s.current.setMouseMode(e), g && t?.persist !== !1)
152
162
  try {
153
- localStorage.setItem(p, e);
163
+ localStorage.setItem(g, e);
154
164
  } catch {
155
165
  }
156
166
  }
157
167
  }),
158
- [d, p]
159
- ), S(() => {
168
+ [d, g]
169
+ ), w(() => {
160
170
  const e = s.current, t = d.split(/\s+/)[0];
161
- if (e.render(`.${t}`, T), p)
171
+ if (e.render(`.${t}`, T), g)
162
172
  try {
163
- const r = localStorage.getItem(p);
164
- (r === "turn" || r === "select") && e.setMouseMode(r);
173
+ const n = localStorage.getItem(g);
174
+ (n === "turn" || n === "select") && e.setMouseMode(n);
165
175
  } catch {
166
176
  }
167
- return _(e.currentPageIndex), () => {
177
+ return q(e.currentPageIndex), () => {
168
178
  e.destroy();
169
179
  };
170
- }, [d, T, p]);
171
- const V = F(f);
172
- S(() => {
173
- V.current !== f && (V.current = f, s.current.setBookmarksEnabled(f));
174
- }, [f]), S(() => {
180
+ }, [d, T, g]);
181
+ const G = x(f);
182
+ w(() => {
183
+ G.current !== f && (G.current = f, s.current.setBookmarksEnabled(f));
184
+ }, [f]), w(() => {
175
185
  const e = s.current;
176
- if (!g) {
177
- H([]);
186
+ if (!p) {
187
+ V([]);
178
188
  return;
179
189
  }
180
190
  let t = !0;
181
- const r = /* @__PURE__ */ new Map(), l = (i, C) => {
182
- const P = `${C ? "expanded" : "brief"}:${i.id}`;
183
- let o = r.get(P);
191
+ const n = /* @__PURE__ */ new Map(), a = (i, N) => {
192
+ const P = `${N ? "expanded" : "brief"}:${i.id}`;
193
+ let o = n.get(P);
184
194
  return o || (o = {
185
195
  key: P,
186
196
  bookmark: i,
187
197
  element: document.createElement("span"),
188
- renderer: C ? g.renderExpandedBookmark : g.renderBookmark
189
- }, r.set(P, o)), o.bookmark = i, o.element;
190
- }, b = {
191
- ...g,
198
+ renderer: N ? p.renderExpandedBookmark : p.renderBookmark
199
+ }, n.set(P, o)), o.bookmark = i, o.element;
200
+ }, S = {
201
+ ...p,
192
202
  getBookmarks: (i) => {
193
- const C = g.getBookmarks(i), P = new Set(C.map((o) => o.id));
194
- for (const [o, I] of r)
195
- P.has(I.bookmark.id) || r.delete(o);
203
+ const N = p.getBookmarks(i), P = new Set(N.map((o) => o.id));
204
+ for (const [o, I] of n)
205
+ P.has(I.bookmark.id) || n.delete(o);
196
206
  return queueMicrotask(() => {
197
207
  if (t) {
198
- for (const [o, I] of r)
199
- I.element.isConnected || r.delete(o);
200
- H([...r.values()]);
208
+ for (const [o, I] of n)
209
+ I.element.isConnected || n.delete(o);
210
+ V([...n.values()]);
201
211
  }
202
- }), C;
212
+ }), N;
203
213
  },
204
- renderBookmark: (i) => l(i, !1),
205
- renderExpandedBookmark: g.renderExpandedBookmark ? (i) => l(i, !0) : void 0
214
+ renderBookmark: (i) => a(i, !1),
215
+ renderExpandedBookmark: p.renderExpandedBookmark ? (i) => a(i, !0) : void 0
206
216
  };
207
- return e.setBookmarkProvider(b), () => {
217
+ return e.setBookmarkProvider(S), () => {
208
218
  t = !1, e.setBookmarkProvider(void 0);
209
219
  };
210
- }, [g]), S(() => {
220
+ }, [p]), w(() => {
211
221
  const e = d.split(/\s+/)[0], t = document.querySelector(`.${e}`);
212
222
  t && (u ? t.classList.remove("flipbook--no-page-shadow") : t.classList.add("flipbook--no-page-shadow"));
213
223
  }, [d, u]);
214
- const R = ue.toArray(x), M = R.length, E = new Set(
215
- a?.coverIndices === "auto" ? [0, M - 1] : a?.coverIndices ?? [0]
216
- ), te = (e) => E.has(e), q = /* @__PURE__ */ new Map();
217
- if (a?.interiorCoverClassName || a?.frontInteriorCoverClassName || a?.backInteriorCoverClassName)
224
+ const y = pe.toArray(k), F = y.length, E = new Set(
225
+ c?.coverIndices === "auto" ? [0, F - 1] : c?.coverIndices ?? [0]
226
+ ), oe = (e) => E.has(e), A = /* @__PURE__ */ new Map();
227
+ if (c?.interiorCoverClassName || c?.frontInteriorCoverClassName || c?.backInteriorCoverClassName)
218
228
  for (const e of E) {
219
229
  const t = e % 2 === 0 ? e + 1 : e - 1;
220
- if (t >= 0 && t < M && !E.has(t)) {
221
- const r = e === Math.min(...E) ? "front" : "back";
222
- q.set(t, r);
230
+ if (t >= 0 && t < F && !E.has(t)) {
231
+ const n = e === Math.min(...E) ? "front" : "back";
232
+ A.set(t, n);
223
233
  }
224
234
  }
225
- const re = a?.coverInset ?? "5%", ne = (e) => {
235
+ const se = c?.coverInset ?? "5%", ce = (e) => {
226
236
  const t = ["page"];
227
- te(e) && (t.push("page--cover"), a?.hardCovers && t.push("page--hard"), a?.noShadow && t.push("page--no-shadow"));
228
- const r = q.get(e);
229
- if (r) {
237
+ oe(e) && (t.push("page--cover"), c?.hardCovers && t.push("page--hard"), c?.noShadow && t.push("page--no-shadow"));
238
+ const n = A.get(e);
239
+ if (n) {
230
240
  t.push("page--cover-interior");
231
- const l = r === "front" ? a?.frontInteriorCoverClassName ?? a?.interiorCoverClassName : a?.backInteriorCoverClassName ?? a?.interiorCoverClassName;
232
- l && t.push(l);
241
+ const a = n === "front" ? c?.frontInteriorCoverClassName ?? c?.interiorCoverClassName : c?.backInteriorCoverClassName ?? c?.interiorCoverClassName;
242
+ a && t.push(a);
233
243
  }
234
244
  return t.join(" ");
235
- }, oe = n != null && M > 0 ? (() => {
236
- const e = Math.floor(Y / 2), t = Math.ceil(M / 2), r = 2, l = Math.max(0, e - n - r), b = Math.min(t - 1, e + n + r), i = l * 2, C = Math.min(M - 1, b * 2 + 1), P = new Set(
237
- Array.from({ length: C - i + 1 }, (o, I) => i + I)
245
+ }, ae = r != null && F > 0 ? (() => {
246
+ const e = Math.floor(ee / 2), t = Math.ceil(F / 2), n = 2, a = Math.max(0, e - r - n), S = Math.min(t - 1, e + r + n), i = a * 2, N = Math.min(F - 1, S * 2 + 1), P = new Set(
247
+ Array.from({ length: N - i + 1 }, (o, I) => i + I)
238
248
  );
239
249
  for (const o of E) {
240
250
  P.add(o);
241
251
  const I = o % 2 === 0 ? o + 1 : o - 1;
242
- I >= 0 && I < M && P.add(I);
252
+ I >= 0 && I < F && P.add(I);
243
253
  }
244
- return (o) => P.has(o) ? R[o] : null;
245
- })() : (e) => R[e], se = (e) => {
246
- const t = oe(e);
247
- if (q.has(e)) {
248
- const l = e % 2 === 1 !== (B === "rtl"), b = {
249
- "--cover-inset": re,
250
- ...l ? { "--cover-inset-right": "0px" } : { "--cover-inset-left": "0px" }
254
+ return (o) => P.has(o) || R.current.has(Math.floor(o / 2)) ? y.at(o) ?? null : null;
255
+ })() : (e) => y.at(e) ?? null, le = (e) => {
256
+ const t = ae(e);
257
+ if (A.has(e)) {
258
+ const a = e % 2 === 1 !== (b === "rtl"), S = {
259
+ "--cover-inset": se,
260
+ ...a ? { "--cover-inset-right": "0px" } : { "--cover-inset-left": "0px" }
251
261
  };
252
- return /* @__PURE__ */ c("div", { className: "page--cover-interior-inset", style: b, children: t });
262
+ return /* @__PURE__ */ l("div", { className: "page--cover-interior-inset", style: S, children: t });
253
263
  }
254
264
  return t;
255
265
  };
256
- return /* @__PURE__ */ O("div", { className: d, children: [
257
- R.map((e, t) => /* @__PURE__ */ c(
266
+ return /* @__PURE__ */ U("div", { className: d, children: [
267
+ y.map((e, t) => /* @__PURE__ */ l(
258
268
  "div",
259
269
  {
260
- className: ne(t),
261
- children: /* @__PURE__ */ c("div", { className: "flipbook-page-scrollport", children: /* @__PURE__ */ c("div", { className: "flipbook-page-content", dir: B, children: se(t) }) })
270
+ className: ce(t),
271
+ children: /* @__PURE__ */ l("div", { className: "flipbook-page-scrollport", children: /* @__PURE__ */ l("div", { className: "flipbook-page-content", dir: b, children: le(t) }) })
262
272
  },
263
273
  `page-${t}`
264
274
  )),
265
- Z.map(
266
- ({ key: e, bookmark: t, element: r, renderer: l }) => de(l ? l(t) : t.label, r, e)
275
+ te.map(
276
+ ({ key: e, bookmark: t, element: n, renderer: a }) => fe(a ? a(t) : t.label, n, e)
267
277
  )
268
278
  ] });
269
279
  }
270
280
  );
271
- ge.displayName = "FlipBook";
281
+ me.displayName = "FlipBook";
272
282
  export {
273
- ge as FlipBook,
274
- Ie as TocPage,
275
- Ce as createDefaultHistoryMapper
283
+ me as FlipBook,
284
+ Ce as TocPage,
285
+ ve as createDefaultHistoryMapper
276
286
  };
277
287
  //# sourceMappingURL=flip-book.js.map